Initial commit

This commit is contained in:
coddec
2017-12-04 13:27:18 +11:00
commit f6150dafc8
1282 changed files with 193271 additions and 0 deletions
+256
View File
@@ -0,0 +1,256 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#define STRICT_TYPED_ITEMIDS
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include <windows.h>
#include <commctrl.h>
#include <shlwapi.h>
#include <Psapi.h>
#include <atlstr.h>
#include "StringUtils.h"
#include "ResourceHelper.h"
#include "ClassicIEDLL\ClassicIEDLL.h"
// Manifest to enable the 6.0 common controls
#pragma comment(linker, \
"\"/manifestdependency:type='Win32' "\
"name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' "\
"processorArchitecture='*' "\
"publicKeyToken='6595b64144ccf1df' "\
"language='*'\"")
// Find and activate the Settings window
static BOOL CALLBACK FindSettingsEnum( HWND hwnd, LPARAM lParam )
{
wchar_t className[256];
if (!GetClassName(hwnd,className,_countof(className)) || _wcsicmp(className,L"#32770")!=0)
return TRUE;
DWORD process=0;
GetWindowThreadProcessId(hwnd,&process);
HANDLE hProcess=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,process);
bool bFound=false;
if (hProcess!=INVALID_HANDLE_VALUE)
{
wchar_t path[_MAX_PATH];
if (GetModuleFileNameEx(hProcess,NULL,path,_countof(path)))
{
if (_wcsicmp(PathFindFileName(path),L"ClassicIE_32.exe")==0)
{
SetForegroundWindow(hwnd);
bFound=true;
}
}
CloseHandle(hProcess);
}
return !bFound;
}
void ZoneConfigure( HWND hWnd, const wchar_t *url )
{
// use undocumented function 383 from shlwapi
typedef void (WINAPI* FZoneConfigureW)(HWND,LPCWSTR);
FZoneConfigureW ZoneConfigureW;
HMODULE hShlwapi=LoadLibrary(L"shlwapi.dll");
if(hShlwapi)
{
ZoneConfigureW=(FZoneConfigureW)GetProcAddress(hShlwapi,MAKEINTRESOURCEA(383));
if(ZoneConfigureW)
ZoneConfigureW(hWnd,url);
FreeLibrary(hShlwapi);
}
}
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow )
{
if (wcsncmp(lpCmdLine,L"zone ",5)==0)
{
wchar_t token[100];
const wchar_t *url=GetToken(lpCmdLine+5,token,_countof(token),L" ");
ZoneConfigure((HWND)_wtol(token),url);
return 0;
}
{
const wchar_t *pXml=wcsstr(lpCmdLine,L"-xml ");
if (pXml)
{
wchar_t xml[_MAX_PATH];
GetToken(pXml+5,xml,_countof(xml),L" ");
CoInitialize(NULL);
bool res=DllImportSettingsXml(xml);
CoUninitialize();
return res?0:1;
}
}
{
const wchar_t *pBackup=wcsstr(lpCmdLine,L"-backup ");
if (pBackup)
{
wchar_t xml[_MAX_PATH];
GetToken(pBackup+8,xml,_countof(xml),L" ");
CoInitialize(NULL);
bool res=DllExportSettingsXml(xml);
CoUninitialize();
return res?0:1;
}
}
#ifndef _WIN64
const wchar_t *pSaveAdmx=wcsstr(lpCmdLine,L"-saveadmx ");
if (pSaveAdmx)
{
wchar_t language[100];
GetToken(pSaveAdmx+10,language,_countof(language),L" ");
if (!DllSaveAdmx("ClassicIE.admx","ClassicIE.adml","ClassicIEADMX.txt",language))
return 1;
return 0;
}
#endif
WaitDllInitThread();
DWORD settings=GetIESettings();
HWND topWindow=(HWND)_wtol(lpCmdLine);
if (topWindow)
{
DWORD processId;
DWORD threadId=GetWindowThreadProcessId(topWindow,&processId);
bool bWrongBitness=false;
{
HANDLE hProcess=OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,processId);
if (hProcess)
{
BOOL bWow64;
#ifdef _WIN64
bWrongBitness=(IsWow64Process(hProcess,&bWow64) && bWow64); // the current process is 64-bit, but the target is wow64 (32-bit)
#else
if (IsWow64Process(GetCurrentProcess(),&bWow64) && bWow64)
{
bWrongBitness=(!IsWow64Process(hProcess,&bWow64) || !bWow64); // the current process is 32-bit, but the target is 64-bit
}
#endif
CloseHandle(hProcess);
}
}
if (bWrongBitness)
{
wchar_t path[_MAX_PATH];
GetModuleFileName(hInstance,path,_countof(path));
PathRemoveFileSpec(path);
#ifdef _WIN64
PathAppend(path,L"ClassicIE_32.exe");
#else
PathAppend(path,L"ClassicIE_64.exe");
#endif
wchar_t cmdLine[1024];
Sprintf(cmdLine,_countof(cmdLine),L"%s %s",path,lpCmdLine);
STARTUPINFO startupInfo={sizeof(startupInfo)};
PROCESS_INFORMATION processInfo;
memset(&processInfo,0,sizeof(processInfo));
if (CreateProcess(path,cmdLine,NULL,NULL,TRUE,0,NULL,NULL,&startupInfo,&processInfo))
{
CloseHandle(processInfo.hThread);
CloseHandle(processInfo.hProcess);
}
return settings;
}
CheckForNewVersionIE();
if (!(settings&IE_SETTING_CAPTION))
return settings;
HWND caption=FindWindowEx(topWindow,NULL,L"Client Caption",NULL);
DllLogToFile(CIE_LOG,L"exe: topWindow=%X, caption=%X",(DWORD)topWindow,(DWORD)caption);
UINT message=RegisterWindowMessage(L"ClassicIE.Injected");
if (caption)
{
if (SendMessage(caption,message,0,0)!=0)
return settings;
{
HANDLE hToken;
if (OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&hToken))
{
TOKEN_PRIVILEGES tp={1};
if (LookupPrivilegeValue(NULL,L"SeDebugPrivilege",&tp.Privileges[0].Luid))
tp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken,FALSE,&tp,sizeof(TOKEN_PRIVILEGES),NULL,NULL);
CloseHandle(hToken);
}
}
#ifdef _WIN64
HMODULE hHookModule=GetModuleHandle(L"ClassicIEDLL_64.dll");
#else
HMODULE hHookModule=GetModuleHandle(L"ClassicIEDLL_32.dll");
#endif
HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS,FALSE,processId);
if (hProcess)
{
wchar_t path[_MAX_PATH];
GetModuleFileName(hHookModule,path,_countof(path));
void *remotePath=VirtualAllocEx(hProcess,NULL,sizeof(path),MEM_COMMIT,PAGE_READWRITE);
if (remotePath)
{
if (WriteProcessMemory(hProcess,remotePath,path,sizeof(path),NULL))
{
HANDLE hThread=CreateRemoteThread(hProcess,NULL,0,(LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle(L"kernel32.dll"),"LoadLibraryW"),remotePath,0,NULL);
if (hThread)
{
WaitForSingleObject(hThread,INFINITE);
CloseHandle(hThread);
}
}
VirtualFreeEx(hProcess,remotePath,sizeof(path),MEM_RELEASE);
}
CloseHandle(hProcess);
}
}
return settings;
}
#ifndef _WIN64
if (*lpCmdLine)
#endif
return settings;
// if 32-bit exe is called with no arguments, show the settings
INITCOMMONCONTROLSEX init={sizeof(init),ICC_STANDARD_CLASSES};
InitCommonControlsEx(&init);
// prevent multiple instances from running on the same desktop
// the assumption is that multiple desktops for the same user will have different name (but may repeat across users)
wchar_t userName[256];
DWORD len=_countof(userName);
GetUserName(userName,&len);
len=0;
HANDLE desktop=GetThreadDesktop(GetCurrentThreadId());
GetUserObjectInformation(desktop,UOI_NAME,NULL,0,&len);
wchar_t *deskName=(wchar_t*)malloc(len);
GetUserObjectInformation(desktop,UOI_NAME,deskName,len,&len);
wchar_t mutexName[1024];
Sprintf(mutexName,_countof(mutexName),L"ClassicIESettings.Mutex.%s.%s",userName,deskName);
free(deskName);
HANDLE hMutex=CreateMutex(NULL,TRUE,mutexName);
if (GetLastError()==ERROR_ALREADY_EXISTS || GetLastError()==ERROR_ACCESS_DENIED)
{
EnumWindows(FindSettingsEnum,0);
return 0;
}
ShowIESettings();
return 0;
}
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>
+101
View File
@@ -0,0 +1,101 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\0"
END
3 TEXTINCLUDE
BEGIN
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,3,1,0
PRODUCTVERSION 4,3,1,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "IvoSoft"
VALUE "FileDescription", "Classic IE"
VALUE "FileVersion", "4, 3, 1, 0"
VALUE "InternalName", "ClassicIE"
VALUE "LegalCopyright", "Copyright (C) 2009-2016, Ivo Beltchev"
VALUE "OriginalFilename", "ClassicIE.exe"
VALUE "ProductName", "Classic Shell"
VALUE "ProductVersion", "4, 3, 1, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "..\\ClassicShellSetup\\ClassicShell.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
+527
View File
@@ -0,0 +1,527 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ClassicIE"
ProjectGUID="{65D5C193-E807-4094-AE19-19E6A310A312}"
RootNamespace="ClassicIE"
SccProjectName="Perforce Project"
SccLocalPath=".."
SccProvider="MSSCCI:Perforce SCM"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\ClassicShellLib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="shlwapi.lib comctl32.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_32.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="ClassicIE.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(ConfigurationName)64"
IntermediateDirectory="$(ConfigurationName)64"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\ClassicShellLib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="shlwapi.lib comctl32.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_64.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="ClassicIE.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\ClassicShellLib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="shlwapi.lib comctl32.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_32.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="ClassicIE.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(ConfigurationName)64"
IntermediateDirectory="$(ConfigurationName)64"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\ClassicShellLib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="shlwapi.lib comctl32.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="ClassicIE.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Setup|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\ClassicShellLib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BUILD_SETUP"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="shlwapi.lib comctl32.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_32.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="ClassicIE.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Setup|x64"
OutputDirectory="$(ConfigurationName)64"
IntermediateDirectory="$(ConfigurationName)64"
ConfigurationType="1"
UseOfATL="1"
CharacterSet="1"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\ClassicShellLib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="shlwapi.lib comctl32.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="ClassicIE.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\ClassicIE.cpp"
>
</File>
<File
RelativePath=".\ClassicIE.manifest"
>
</File>
<File
RelativePath=".\ClassicIE.rc"
>
</File>
<File
RelativePath="..\Localization\English\ClassicIEADMX.txt"
>
</File>
<File
RelativePath="..\ClassicShellSetup\ClassicShell.ico"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,405 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#include "stdafx.h"
#include "ClassicIEDLL_i.h"
#include "ClassicIEBHO.h"
#include "ClassicIEDLL.h"
#include "Settings.h"
#include "SettingsUIHelper.h"
#include "ResourceHelper.h"
#include "Translations.h"
#include "FNVHash.h"
#include "dllmain.h"
#include <shlguid.h>
static bool IsLowIntegrity( void )
{
bool bLow=false;
HANDLE hToken;
if (OpenProcessToken(GetCurrentProcess(),TOKEN_QUERY|TOKEN_QUERY_SOURCE,&hToken))
{
DWORD dwLengthNeeded;
if (!GetTokenInformation(hToken,TokenIntegrityLevel,NULL,0,&dwLengthNeeded))
{
TOKEN_MANDATORY_LABEL *pTIL=(TOKEN_MANDATORY_LABEL*)malloc(dwLengthNeeded);
if (pTIL)
{
if (GetTokenInformation(hToken,TokenIntegrityLevel,pTIL,dwLengthNeeded,&dwLengthNeeded))
{
DWORD dwIntegrityLevel=*GetSidSubAuthority(pTIL->Label.Sid,(DWORD)(UCHAR)(*GetSidSubAuthorityCount(pTIL->Label.Sid)-1));
bLow=(dwIntegrityLevel<SECURITY_MANDATORY_MEDIUM_RID);
}
free(pTIL);
}
}
CloseHandle(hToken);
}
return bLow;
}
static DWORD StartBroker( bool bWait, const wchar_t *param )
{
wchar_t path[_MAX_PATH];
GetModuleFileName(g_Instance,path,_countof(path));
PathRemoveFileSpec(path);
#ifndef _WIN64
BOOL bWow64;
if (!IsWow64Process(GetCurrentProcess(),&bWow64) || !bWow64 || (GetVersionEx(GetModuleHandle(NULL))>>24)<10)
PathAppend(path,L"ClassicIE_32.exe");
else
#endif
PathAppend(path,L"ClassicIE_64.exe");
wchar_t cmdLine[1024];
Sprintf(cmdLine,_countof(cmdLine),L"\"%s\" %s",path,param);
STARTUPINFO startupInfo={sizeof(startupInfo)};
PROCESS_INFORMATION processInfo;
memset(&processInfo,0,sizeof(processInfo));
DWORD res=GetIESettings();
if (CreateProcess(path,cmdLine,NULL,NULL,TRUE,0,NULL,NULL,&startupInfo,&processInfo))
{
CloseHandle(processInfo.hThread);
if (bWait)
{
if (WaitForSingleObject(processInfo.hProcess,2000)==WAIT_OBJECT_0)
GetExitCodeProcess(processInfo.hProcess,&res);
}
CloseHandle(processInfo.hProcess);
}
return res;
}
HRESULT STDMETHODCALLTYPE CClassicIEBHO::SetSite( IUnknown *pUnkSite )
{
if (m_pWebBrowser && m_dwEventCookie!=0xFEFEFEFE)
DispEventUnadvise(m_pWebBrowser,&DIID_DWebBrowserEvents2);
m_pWebBrowser=NULL;
IObjectWithSiteImpl<CClassicIEBHO>::SetSite(pUnkSite);
if (pUnkSite)
{
HMODULE hFrame=GetModuleHandle(L"ieframe.dll");
bool bLowIntegrity=IsLowIntegrity();
m_ProtectedMode.LoadString(hFrame,bLowIntegrity?12939:12940);
m_ProtectedMode=L" | "+m_ProtectedMode;
// find the top window and run another process to subclass it (the top window can be in a higher-level process, so we can't subclass from here)
LogToFile(CIE_LOG,L"SetSite");
CComQIPtr<IServiceProvider> pProvider=pUnkSite;
m_Settings=0;
if (pProvider)
{
pProvider->QueryService(SID_SShellBrowser,IID_IShellBrowser,(void**)&m_pBrowser);
HWND hwnd;
HWND topWindow=NULL;
if (m_pBrowser && SUCCEEDED(m_pBrowser->GetWindow(&hwnd)))
{
HWND topWindow=GetAncestor(hwnd,GA_ROOT);
if (topWindow)
{
wchar_t param[100];
Sprintf(param,_countof(param),L"%u",(DWORD)topWindow);
m_Settings=StartBroker(bLowIntegrity,param);
if (m_Settings&(IE_SETTING_PROGRESS|IE_SETTING_ZONE))
{
m_pZoneManager.CoCreateInstance(CLSID_InternetZoneManager,NULL,CLSCTX_INPROC_SERVER);
m_pSecurityManager.CoCreateInstance(CLSID_InternetSecurityManager,NULL,CLSCTX_INPROC_SERVER);
pProvider->QueryService(SID_SWebBrowserApp,IID_IWebBrowser2,(void**)&m_pWebBrowser);
if (m_pWebBrowser)
{
if (m_dwEventCookie==0xFEFEFEFE) // ATL's event cookie is 0xFEFEFEFE when the sink is not advised
DispEventAdvise(m_pWebBrowser,&DIID_DWebBrowserEvents2);
}
}
}
}
}
}
else
{
m_pBrowser=NULL;
m_pWebBrowser=NULL;
m_pZoneManager=NULL;
m_pSecurityManager=NULL;
}
return S_OK;
}
HRESULT WINAPI CClassicIEBHO::UpdateRegistry( BOOL bRegister )
{
wchar_t path[_MAX_PATH];
GetModuleFileName(g_Instance,path,_countof(path));
PathRemoveFileSpec(path);
CString menu;
menu.LoadString(IDS_SETTINGS_TITLE);
_ATL_REGMAP_ENTRY mapEntries[]={
{L"MODULEPATH",path},
{L"MENUTEXT",menu},
{NULL,NULL}
};
return _AtlModule.UpdateRegistryFromResource(IDR_CLASSICIEBHO,bRegister,mapEntries);
}
LRESULT CALLBACK CClassicIEBHO::SubclassStatusProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData )
{
if (uMsg==SB_SETPARTS && wParam>0)
{
CClassicIEBHO *pThis=(CClassicIEBHO*)uIdSubclass;
int w0=*(int*)lParam; // total width
int w1=pThis->m_Progress<0?0:PROGRESS_WIDTH; // progress part
int w2=pThis->m_TextWidth; // zone part
int w=w1+w2;
int parts[PART_COUNT];
parts[PART_TEXT]=w0;
if (parts[PART_TEXT]>=w+MIN_TEXT_WIDTH)
parts[PART_TEXT]-=w;
else if (parts[PART_TEXT]>=MIN_TEXT_WIDTH)
parts[PART_TEXT]=MIN_TEXT_WIDTH;
if (parts[PART_TEXT]>w0)
parts[PART_TEXT]=w0;
if (parts[PART_TEXT]+w1>w0)
w1=0;
parts[PART_PROGRESS]=parts[PART_TEXT]+w1;
parts[PART_ZONE]=w0;
parts[PART_ZOOM]=-1;
DefSubclassProc(hWnd,SB_SETPARTS,_countof(parts),(LPARAM)parts);
TOOLINFO tool={sizeof(tool),TTF_SUBCLASS,hWnd};
tool.uId=1;
DefSubclassProc(hWnd,SB_GETRECT,PART_ZONE,(LPARAM)&tool.rect);
SendMessage(pThis->m_Tooltip,TTM_NEWTOOLRECT,0,(LPARAM)&tool);
if (w1==0)
ShowWindow(pThis->m_ProgressBar,SW_HIDE);
else
{
RECT rc;
DefSubclassProc(hWnd,SB_GETRECT,PART_PROGRESS,(LPARAM)&rc);
rc.left+=2;
rc.right-=2;
rc.top+=1;
rc.bottom-=1;
SetWindowPos(pThis->m_ProgressBar,NULL,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,SWP_NOZORDER|SWP_SHOWWINDOW);
}
return TRUE;
}
if (uMsg==SB_GETPARTS)
{
int parts[10];
int n=(int)DefSubclassProc(hWnd,SB_GETPARTS,_countof(parts),(LPARAM)parts);
const int *p=parts;
if (n>2)
{
p+=n-2;
n=2;
}
if (lParam)
memcpy((int*)lParam,p,4*((n<(int)wParam)?n:wParam));
return n;
}
if (uMsg==SB_GETRECT)
{
if (wParam==1) wParam=PART_ZOOM;
else if (wParam>PART_OFFSET) wParam-=PART_OFFSET;
}
if (uMsg==SB_SETTEXT)
{
if (!SendMessage(hWnd,SB_ISSIMPLE,0,0))
{
if ((wParam&255)==1) wParam=PART_ZOOM;
else if ((wParam&255)>PART_OFFSET) wParam-=PART_OFFSET;
}
}
if (uMsg==WM_LBUTTONDBLCLK)
{
POINT pt={(short)LOWORD(lParam),(short)HIWORD(lParam)};
RECT rc;
DefSubclassProc(hWnd,SB_GETRECT,PART_ZONE,(LPARAM)&rc);
if (PtInRect(&rc,pt))
{
CClassicIEBHO *pThis=(CClassicIEBHO*)uIdSubclass;
CComBSTR url;
if (pThis->m_pWebBrowser && SUCCEEDED(pThis->m_pWebBrowser->get_LocationURL(&url)))
{
wchar_t buf[1024];
Sprintf(buf,_countof(buf),L"zone %u %s",(unsigned)GetAncestor(hWnd,GA_ROOT),(const wchar_t*)url);
StartBroker(false,buf);
}
return 0;
}
}
if (uMsg==SB_SIMPLE)
{
CClassicIEBHO *pThis=(CClassicIEBHO*)uIdSubclass;
LRESULT res=DefSubclassProc(hWnd,uMsg,wParam,lParam);
if (wParam)
{
ShowWindow(pThis->m_ProgressBar,SW_HIDE);
}
else
{
pThis->ResetParts();
}
return res;
}
return DefSubclassProc(hWnd,uMsg,wParam,lParam);
}
void CClassicIEBHO::ResetParts( void )
{
int parts[256];
int n=(int)SendMessage(m_StatusBar,SB_GETPARTS,_countof(parts),(LPARAM)parts);
SendMessage(m_StatusBar,SB_SETPARTS,n,(LPARAM)parts);
}
STDMETHODIMP CClassicIEBHO::OnNavigateComplete( IDispatch *pDisp, VARIANT *URL )
{
HWND status;
if (!m_pBrowser || FAILED(m_pBrowser->GetControlWindow(FCW_STATUS,&status)))
return S_OK;
if (m_StatusBar!=status)
{
if (m_StatusBar) RemoveWindowSubclass(m_StatusBar,SubclassStatusProc,(UINT_PTR)this);
m_StatusBar=status;
if (m_StatusBar)
{
m_TextWidth=0;
SetWindowSubclass(m_StatusBar,SubclassStatusProc,(UINT_PTR)this,0);
ResetParts();
}
}
if (!m_StatusBar) return S_OK;
if (!m_Tooltip)
{
m_Tooltip=CreateWindowEx(WS_EX_TOPMOST|WS_EX_TOOLWINDOW|WS_EX_TRANSPARENT,TOOLTIPS_CLASS,NULL,WS_POPUP|TTS_NOPREFIX|TTS_ALWAYSTIP,0,0,0,0,m_StatusBar,NULL,g_Instance,NULL);
TOOLINFO tool={sizeof(tool),TTF_SUBCLASS,m_StatusBar};
tool.uId=1;
tool.hinst=GetModuleHandle(L"ieframe.dll");
tool.lpszText=MAKEINTRESOURCE(12941);
SendMessage(m_Tooltip,TTM_ADDTOOL,0,(LPARAM)&tool);
}
if (!m_ProgressBar)
{
m_ProgressBar=CreateWindowEx(0,PROGRESS_CLASS,NULL,WS_CHILD|PBS_SMOOTH,0,0,0,0,m_StatusBar,NULL,g_Instance,NULL);
SendMessage(m_ProgressBar,PBM_SETRANGE,0,MAKELPARAM(0,100));
}
m_TextWidth=0;
if (!(m_Settings&IE_SETTING_ZONE))
return S_OK;
wchar_t text[256];
text[0]=0;
HICON hIcon=NULL;
if (m_pZoneManager && m_pSecurityManager && URL && URL->vt==VT_BSTR)
{
DWORD zone;
ZONEATTRIBUTES attributes={sizeof(attributes)};
if (SUCCEEDED(m_pSecurityManager->MapUrlToZone(URL->bstrVal,&zone,0)) && SUCCEEDED(m_pZoneManager->GetZoneAttributes(zone,&attributes)))
{
Strcpy(text,_countof(text),attributes.szDisplayName);
if (m_Settings&IE_SETTING_PROTECTED)
Strcat(text,_countof(text),m_ProtectedMode);
unsigned int key=CalcFNVHash(attributes.szIconPath);
std::map<unsigned int,HICON>::const_iterator it=m_IconCache.find(key);
if (it!=m_IconCache.end())
hIcon=it->second;
else
{
wchar_t path[_MAX_PATH];
wchar_t *str=wcschr(attributes.szIconPath,'#');
if (!str) str=wcschr(attributes.szIconPath,',');
int index=0;
if (str)
{
index=_wtol(str+1);
*str=0;
}
Strcpy(path,_countof(path),attributes.szIconPath);
if (PathIsRelative(path))
PathFindOnPath(path,NULL);
if (index==0)
hIcon=(HICON)LoadImage(NULL,path,IMAGE_ICON,16,16,LR_LOADFROMFILE);
else
{
HMODULE hModule=LoadLibraryEx(path,NULL,LOAD_LIBRARY_AS_DATAFILE|LOAD_LIBRARY_AS_IMAGE_RESOURCE);
if (hModule)
{
hIcon=(HICON)LoadImage(hModule,MAKEINTRESOURCE(index),IMAGE_ICON,16,16,0);
FreeLibrary(hModule);
}
}
m_IconCache[key]=hIcon;
}
}
}
if (text[0])
{
HDC hdc=GetDC(m_StatusBar);
HGDIOBJ font0=SelectObject(hdc,(HFONT)SendMessage(m_StatusBar,WM_GETFONT,0,0));
SIZE size;
GetTextExtentPoint32(hdc,text,Strlen(text),&size);
m_TextWidth=size.cx;
SelectObject(hdc,font0);
ReleaseDC(m_StatusBar,hdc);
}
// reset the parts to apply the new text width
m_TextWidth+=32;
ResetParts();
// set text and icon
SendMessage(m_StatusBar,SB_SETTEXT,PART_ZONE+PART_OFFSET,(LPARAM)text);
SendMessage(m_StatusBar,SB_SETICON,PART_ZONE,(LPARAM)hIcon);
return S_OK;
}
STDMETHODIMP CClassicIEBHO::OnProgressChange( long progress, long progressMax )
{
if (!(m_Settings&IE_SETTING_PROGRESS))
return S_OK;
bool bVisible=(IsWindowVisible(m_ProgressBar)!=0);
if (progress<0 || progressMax==0)
{
m_Progress=-1;
if (!bVisible) return S_OK;
}
else
{
m_Progress=progress*100/progressMax;
SendMessage(m_ProgressBar,PBM_SETPOS,m_Progress,0);
if (bVisible) return S_OK;
}
ResetParts();
RedrawWindow(m_StatusBar,NULL,NULL,RDW_UPDATENOW|RDW_ALLCHILDREN);
return S_OK;
}
STDMETHODIMP CClassicIEBHO::OnQuit( void )
{
if (m_pWebBrowser && m_dwEventCookie!=0xFEFEFEFE) // ATL's event cookie is 0xFEFEFEFE, when the sink is not advised
return DispEventUnadvise(m_pWebBrowser,&DIID_DWebBrowserEvents2);
return S_OK;
}
@@ -0,0 +1,92 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#pragma once
#include <exdispid.h>
#include <shobjidl.h>
#include <map>
// CClassicIEBHO
class ATL_NO_VTABLE CClassicIEBHO :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CClassicIEBHO, &CLSID_ClassicIEBHO>,
public IObjectWithSiteImpl<CClassicIEBHO>,
public IDispEventImpl<1,CClassicIEBHO,&DIID_DWebBrowserEvents2,&LIBID_SHDocVw,1,1>
{
public:
CClassicIEBHO()
{
m_Settings=0;
m_StatusBar=NULL;
m_Tooltip=NULL;
m_ProgressBar=NULL;
m_TextWidth=0;
m_Progress=-1;
}
static HRESULT WINAPI UpdateRegistry( BOOL bRegister );
BEGIN_SINK_MAP( CClassicIEBHO )
SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_NAVIGATECOMPLETE2, OnNavigateComplete)
SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_PROGRESSCHANGE, OnProgressChange)
SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_ONQUIT, OnQuit)
END_SINK_MAP()
BEGIN_COM_MAP(CClassicIEBHO)
COM_INTERFACE_ENTRY(IObjectWithSite)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
// IObjectWithSite
STDMETHOD(SetSite)(IUnknown *pUnkSite);
// DWebBrowserEvents2
STDMETHOD(OnNavigateComplete)( IDispatch *pDisp, VARIANT *URL );
STDMETHOD(OnProgressChange)( long progress, long progressMax );
STDMETHOD(OnQuit)( void );
private:
enum
{
PART_TEXT,
PART_PROGRESS,
PART_ZONE,
PART_ZOOM,
PART_COUNT,
PART_OFFSET=100,
PROGRESS_WIDTH=110,
MIN_TEXT_WIDTH=100,
};
CComPtr<IShellBrowser>m_pBrowser;
CComPtr<IWebBrowser2> m_pWebBrowser;
CComPtr<IInternetZoneManager> m_pZoneManager;
CComPtr<IInternetSecurityManager> m_pSecurityManager;
DWORD m_Settings;
HWND m_StatusBar;
HWND m_Tooltip;
HWND m_ProgressBar;
CString m_ProtectedMode;
int m_TextWidth;
int m_Progress;
std::map<unsigned int,HICON> m_IconCache;
static LRESULT CALLBACK SubclassStatusProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData );
void ResetParts( void );
};
OBJECT_ENTRY_AUTO(__uuidof(ClassicIEBHO), CClassicIEBHO)
@@ -0,0 +1,108 @@
HKCR
{
ClassicIE.ClassicIEBHO.1 = s 'ClassicIEBHO Class'
{
CLSID = s '{EA801577-E6AD-4BD5-8F71-4BE0154331A4}'
}
ClassicIE.ClassicIEBHO = s 'ClassicIEBHO Class'
{
CLSID = s '{EA801577-E6AD-4BD5-8F71-4BE0154331A4}'
CurVer = s 'ClassicIE.ClassicIEBHO.1'
}
NoRemove CLSID
{
ForceRemove {EA801577-E6AD-4BD5-8F71-4BE0154331A4} = s 'ClassicIEBHO Class'
{
ProgID = s 'ClassicIE.ClassicIEBHO.1'
VersionIndependentProgID = s 'ClassicIE.ClassicIEBHO'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{FDA50A1E-B8CE-49DE-8D17-B034A84AA280}'
}
}
}
HKLM
{
NoRemove SOFTWARE
{
NoRemove Microsoft
{
NoRemove Windows
{
NoRemove CurrentVersion
{
NoRemove Explorer
{
NoRemove 'Browser Helper Objects'
{
ForceRemove '{EA801577-E6AD-4BD5-8F71-4BE0154331A4}'
{
val NoExplorer = d '1'
}
}
}
NoRemove Policies
{
NoRemove Ext
{
NoRemove CLSID
{
ForceRemove val {EA801577-E6AD-4BD5-8F71-4BE0154331A4} = s '2'
}
}
}
}
}
}
}
}
HKLM
{
NoRemove SOFTWARE
{
NoRemove Microsoft
{
NoRemove 'Internet Explorer'
{
NoRemove 'Low Rights'
{
NoRemove ElevationPolicy
{
ForceRemove '{56753E59-AF1D-4FBA-9E15-31557124ADA2}'
{
val AppPath = s '%MODULEPATH%'
val AppName = s 'ClassicIE_32.exe'
val Policy = d '3'
}
ForceRemove '{C0393554-9B48-458A-B91B-3F684D003B2F}'
{
val AppPath = s '%MODULEPATH%'
val AppName = s 'ClassicIE_64.exe'
val Policy = d '3'
}
ForceRemove '{02E6771D-8375-42B9-9F83-B4730F697900}'
{
val AppPath = s '%MODULEPATH%'
val AppName = s 'ClassicShellUpdate.exe'
val Policy = d '3'
}
}
}
NoRemove Extensions
{
ForceRemove '{56753E59-AF1D-4FBA-9E15-31557124ADA2}'
{
val CLSID = s '{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}'
val MenuText = s '%MENUTEXT%'
val Exec = s '%MODULEPATH%\ClassicIE_32.exe'
}
}
}
}
}
}
@@ -0,0 +1,84 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#include "stdafx.h"
#include "resource.h"
#include "ClassicIEDLL_i.h"
#include "ClassicIEDLL.h"
#include "Settings.h"
#include "dllmain.h"
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
return _AtlModule.DllCanUnloadNow();
}
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
WaitDllInitThread();
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
WaitDllInitThread();
// registers object, typelib and all interfaces in typelib
HRESULT res=_AtlModule.DllRegisterServer();
if (SUCCEEDED(res))
{
// mark the extension as compatible with the enhanced protected mode of IE10
CComPtr<ICatRegister> catRegister;
catRegister.CoCreateInstance(CLSID_StdComponentCategoriesMgr);
if (catRegister)
{
CATID CATID_AppContainerCompatible={0x59fb2056,0xd625,0x48d0,{0xa9,0x44,0x1a,0x85,0xb5,0xab,0x26,0x40}};
catRegister->RegisterClassImplCategories(CLSID_ClassicIEBHO,1,&CATID_AppContainerCompatible);
}
}
return res;
}
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
WaitDllInitThread();
return _AtlModule.DllUnregisterServer();
}
// DllInstall - Adds/Removes entries to the system registry per user
// per machine.
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
{
WaitDllInitThread();
HRESULT hr = E_FAIL;
static const wchar_t szUserSwitch[] = L"user";
if (pszCmdLine != NULL)
{
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
{
AtlSetPerUserRegistration(true);
}
}
if (bInstall)
{
hr = DllRegisterServer();
if (FAILED(hr))
{
DllUnregisterServer();
}
}
else
{
hr = DllUnregisterServer();
}
return hr;
}
@@ -0,0 +1,33 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#pragma once
#ifdef CLASSICIEDLL_EXPORTS
#define CSIEAPI __declspec(dllexport)
#else
#define CSIEAPI __declspec(dllimport)
#endif
void InitClassicIE( HMODULE hModule );
CSIEAPI void ShowIESettings( void );
CSIEAPI DWORD GetIESettings( void );
CSIEAPI void CheckForNewVersionIE( void );
CSIEAPI void WaitDllInitThread( void );
CSIEAPI void DllLogToFile( const wchar_t *location, const wchar_t *message, ... );
#ifndef _WIN64
CSIEAPI bool DllSaveAdmx( const char *admxFile, const char *admlFile, const char *docFile, const wchar_t *language );
#endif
CSIEAPI bool DllImportSettingsXml( const wchar_t *fname );
CSIEAPI bool DllExportSettingsXml( const wchar_t *fname );
enum
{
IE_SETTING_CAPTION=1,
IE_SETTING_PROGRESS=2,
IE_SETTING_ZONE=4,
IE_SETTING_PROTECTED=8,
};
#define CIE_LOG L"Software\\IvoSoft\\ClassicIE\\Settings|LogLevel|%LOCALAPPDATA%\\ClassicShell\\ClassicIELog.txt"
@@ -0,0 +1,36 @@
// ClassicIEDLL.idl : IDL source for ClassicIEDLL
//
// This file will be processed by the MIDL tool to
// produce the type library (ClassicIEDLL.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(C698A81E-5D02-42B1-9801-5381CA8BBC2F),
dual,
nonextensible,
helpstring("IClassicIEBHO Interface"),
pointer_default(unique)
]
interface IClassicIEBHO : IDispatch{
};
[
uuid(FDA50A1E-B8CE-49DE-8D17-B034A84AA280),
version(1.0),
helpstring("ClassicIE 1.0 Type Library")
]
library ClassicIEDLLLib
{
importlib("stdole2.tlb");
[
uuid(EA801577-E6AD-4BD5-8F71-4BE0154331A4),
helpstring("ClassicIEBHO Class")
]
coclass ClassicIEBHO
{
[default] interface IClassicIEBHO;
};
};
@@ -0,0 +1,183 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "..\..\ClassicShellLib\resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""..\\..\\ClassicShellLib\\resource.h""\r\0"
END
3 TEXTINCLUDE
BEGIN
"#include ""..\\..\\ClassicShellLib\\resource.h""\r\n"
"#include ""..\\..\\ClassicShellLib\\ClassicShellLib.rc""\r\r\n"
"1 TYPELIB ""ClassicIEDLL.tlb""\r\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,3,1,0
PRODUCTVERSION 4,3,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "IvoSoft"
VALUE "FileDescription", "Customizations for the title bar and status bar of IE"
VALUE "FileVersion", "4, 3, 1, 0"
VALUE "InternalName", "ClassicIEDLL.dll"
VALUE "LegalCopyright", "Copyright (C) 2009-2016, Ivo Beltchev"
VALUE "OriginalFilename", "ClassicIEDLL.dll"
VALUE "ProductName", "Classic Shell"
VALUE "ProductVersion", "4, 3, 1, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_CLASSICIEDLL REGISTRY "ClassicIEDLL.rgs"
IDR_CLASSICIEBHO REGISTRY "ClassicIEBHO.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APPICON ICON "..\\..\\ClassicShellSetup\\ClassicShell.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_GLOW BITMAP "glow.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_APP_TITLE "Classic IE"
IDS_SETTINGS_TITLE "Classic IE Settings"
IDS_SETTINGS_TITLE_VER "Classic IE Settings %d.%d.%d"
IDS_NEW_SETTINGS "The new settings will take effect after you restart Internet Explorer."
IDS_TITLE_SETTINGS "Title Bar"
IDS_SHOW_CAPTION "Show caption in the title bar"
IDS_SHOW_CAPTION_TIP "When this is checked, Internet Explorer will show the page title in the title bar"
IDS_CENTER_CAPTION "Center caption"
END
STRINGTABLE
BEGIN
IDS_CENTER_CAPTION_TIP "When this is checked, the caption will be centered in the title bar"
IDS_LANGUAGE_SETTINGS "Language"
IDS_CAPTION_FONT "Caption font"
IDS_CAPTION_FONT_TIP "Select the font and text size to use for the caption"
IDS_TEXT_COLOR "Text color"
IDS_TEXT_COLOR_TIP "Select the color for the caption text"
IDS_MAXTEXT_COLOR "Text color (maximized)"
IDS_MAXTEXT_COLOR_TIP "Select the color for the caption text when the window is maximized"
IDS_INTEXT_COLOR "Text color (inactive)"
IDS_INTEXT_COLOR_TIP "Select the color for the caption text when the window is inactive"
IDS_MAXINTEXT_COLOR "Text color (maximized, inactive)"
IDS_MAXINTEXT_COLOR_TIP "Select the color for the caption text when the window is maximized and inactive"
IDS_GLOW "Text glow"
IDS_GLOW_TIP "When this is checked, the text will have a glow around it"
IDS_GLOW_COLOR "Glow color"
IDS_GLOW_COLOR_TIP "Select the color for the caption glow"
END
STRINGTABLE
BEGIN
IDS_MAXGLOW "Text glow (maximized)"
IDS_MAXGLOW_TIP "When this is checked, the text in the maximized window will have a glow around it"
IDS_MAXGLOW_COLOR "Glow color (maximized)"
IDS_MAXGLOW_COLOR_TIP "Select the color for the caption glow when the window is maximized"
IDS_STATUS_SETTINGS "Status Bar"
IDS_SHOW_PROGRESS "Show progress"
IDS_SHOW_PROGRESS_TIP "When this is checked, the status bar will show the progress of the current page"
IDS_SHOW_ZONE "Show zone"
IDS_SHOW_ZONE_TIP "When this is checked, the status bar will show the current security zone"
IDS_SHOW_PROTECTED "Show protected mode"
IDS_SHOW_PROTECTED_TIP "When this is checked, the status bar will show if the browser is running in protected mode"
IDS_SHOW_ICON "Show icon in the title bar"
IDS_SHOW_ICON_TIP "When this is checked, Internet Explorer will show the page icon in the title bar"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "..\..\ClassicShellLib\resource.h"
#include "..\..\ClassicShellLib\ClassicShellLib.rc"
1 TYPELIB "ClassicIEDLL.tlb"
@@ -0,0 +1,11 @@
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'ClassicIE'
'ClassicIE.DLL'
{
val AppID = s '%APPID%'
}
}
}
@@ -0,0 +1,845 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ClassicIEDLL"
ProjectGUID="{BC0E6E7C-08C1-4F12-A754-4608E5A22FA8}"
RootNamespace="ClassicIEDLL"
SccProjectName="Perforce Project"
SccLocalPath="..\.."
SccProvider="MSSCCI:Perforce SCM"
Keyword="AtlProj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/ClassicIEDLL.tlb"
HeaderFileName="ClassicIEDLL_i.h"
DLLDataFileName=""
InterfaceIdentifierFileName="ClassicIEDLL_i.c"
ProxyFileName="ClassicIEDLL_p.c"
ValidateParameters="true"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\ClassicShellLib"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;CLASSICIEDLL_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories="&quot;$(IntDir)&quot;;..\..\ClassicShellLib"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
AdditionalDependencies="uxtheme.lib dwmapi.lib comctl32.lib msimg32.lib winmm.lib htmlhelp.lib wininet.lib wintrust.lib crypt32.lib"
OutputFile="..\$(OutDir)\$(ProjectName)_32.dll"
LinkIncremental="2"
ModuleDefinitionFile=".\ClassicIEDLL_32.def"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(ConfigurationName)64"
IntermediateDirectory="$(ConfigurationName)64"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="3"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/ClassicIEDLL.tlb"
HeaderFileName="ClassicIEDLL_i.h"
DLLDataFileName=""
InterfaceIdentifierFileName="ClassicIEDLL_i.c"
ProxyFileName="ClassicIEDLL_p.c"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\ClassicShellLib"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;CLASSICIEDLL_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories="&quot;$(IntDir)&quot;;..\..\ClassicShellLib"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
AdditionalDependencies="uxtheme.lib dwmapi.lib comctl32.lib msimg32.lib winmm.lib htmlhelp.lib wininet.lib wintrust.lib crypt32.lib"
OutputFile="..\$(OutDir)\$(ProjectName)_64.dll"
LinkIncremental="2"
ModuleDefinitionFile=".\ClassicIEDLL_64.def"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/ClassicIEDLL.tlb"
HeaderFileName="ClassicIEDLL_i.h"
DLLDataFileName=""
InterfaceIdentifierFileName="ClassicIEDLL_i.c"
ProxyFileName="ClassicIEDLL_p.c"
ValidateParameters="true"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..\..\ClassicShellLib"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;CLASSICIEDLL_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="&quot;$(IntDir)&quot;;..\..\ClassicShellLib"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
AdditionalDependencies="uxtheme.lib dwmapi.lib comctl32.lib msimg32.lib winmm.lib htmlhelp.lib wininet.lib wintrust.lib crypt32.lib"
OutputFile="..\$(OutDir)\$(ProjectName)_32.dll"
LinkIncremental="1"
ModuleDefinitionFile=".\ClassicIEDLL_32.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(ConfigurationName)64"
IntermediateDirectory="$(ConfigurationName)64"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="3"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/ClassicIEDLL.tlb"
HeaderFileName="ClassicIEDLL_i.h"
DLLDataFileName=""
InterfaceIdentifierFileName="ClassicIEDLL_i.c"
ProxyFileName="ClassicIEDLL_p.c"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..\..\ClassicShellLib"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;CLASSICIEDLL_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="&quot;$(IntDir)&quot;;..\..\ClassicShellLib"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="true"
AdditionalDependencies="uxtheme.lib dwmapi.lib comctl32.lib msimg32.lib winmm.lib htmlhelp.lib wininet.lib wintrust.lib crypt32.lib"
OutputFile="..\$(OutDir)\$(ProjectName)_64.dll"
LinkIncremental="1"
ModuleDefinitionFile=".\ClassicIEDLL_64.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Setup|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/ClassicIEDLL.tlb"
HeaderFileName="ClassicIEDLL_i.h"
DLLDataFileName=""
InterfaceIdentifierFileName="ClassicIEDLL_i.c"
ProxyFileName="ClassicIEDLL_p.c"
ValidateParameters="true"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..\..\ClassicShellLib"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;CLASSICIEDLL_EXPORTS;BUILD_SETUP"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="&quot;$(IntDir)&quot;;..\..\ClassicShellLib"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="false"
AdditionalDependencies="uxtheme.lib dwmapi.lib comctl32.lib msimg32.lib winmm.lib htmlhelp.lib wininet.lib wintrust.lib crypt32.lib"
OutputFile="..\$(OutDir)\$(ProjectName)_32.dll"
LinkIncremental="1"
ModuleDefinitionFile=".\ClassicIEDLL_32.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Setup|x64"
OutputDirectory="$(ConfigurationName)64"
IntermediateDirectory="$(ConfigurationName)64"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="3"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/ClassicIEDLL.tlb"
HeaderFileName="ClassicIEDLL_i.h"
DLLDataFileName=""
InterfaceIdentifierFileName="ClassicIEDLL_i.c"
ProxyFileName="ClassicIEDLL_p.c"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..\..\ClassicShellLib"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;CLASSICIEDLL_EXPORTS;BUILD_SETUP"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="&quot;$(IntDir)&quot;;..\..\ClassicShellLib"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RegisterOutput="false"
AdditionalDependencies="uxtheme.lib dwmapi.lib comctl32.lib msimg32.lib winmm.lib htmlhelp.lib wininet.lib wintrust.lib crypt32.lib"
OutputFile="..\$(OutDir)\$(ProjectName)_64.dll"
LinkIncremental="1"
ModuleDefinitionFile=".\ClassicIEDLL_64.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\ClassicIEBHO.cpp"
>
</File>
<File
RelativePath=".\ClassicIEDLL.cpp"
>
</File>
<File
RelativePath=".\ClassicIEDLL.idl"
>
</File>
<File
RelativePath=".\ClassicIEDLL_32.def"
>
</File>
<File
RelativePath=".\ClassicIEDLL_64.def"
>
</File>
<File
RelativePath=".\dllmain.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAsManaged="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAsManaged="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAsManaged="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAsManaged="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Setup|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAsManaged="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Setup|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAsManaged="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\DrawCaption.cpp"
>
</File>
<File
RelativePath=".\SettingsUI.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Setup|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Setup|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\ClassicIEBHO.h"
>
</File>
<File
RelativePath=".\ClassicIEDLL.h"
>
</File>
<File
RelativePath=".\dllmain.h"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\SettingsUI.h"
>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\targetver.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\ClassicIEBHO.rgs"
>
</File>
<File
RelativePath=".\ClassicIEDLL.rc"
>
</File>
<File
RelativePath=".\ClassicIEDLL.rgs"
>
</File>
<File
RelativePath="..\..\ClassicShellSetup\ClassicShell.ico"
>
</File>
<File
RelativePath=".\glow.bmp"
>
</File>
</Filter>
<Filter
Name="Generated Files"
>
<File
RelativePath=".\ClassicIEDLL_i.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAs="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAs="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAs="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAs="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Setup|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAs="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Setup|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAs="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\ClassicIEDLL_i.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,11 @@
; ClassicIEDLL_32.def : Declares the module parameters.
LIBRARY "ClassicIEDLL_32.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllInstall PRIVATE
DllSaveAdmx
@@ -0,0 +1,10 @@
; ClassicIEDLL.def : Declares the module parameters.
LIBRARY "ClassicIEDLL_64.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllInstall PRIVATE
@@ -0,0 +1,345 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#include "stdafx.h"
#include "ClassicIEDLL.h"
#include "Settings.h"
#include "ResourceHelper.h"
#include "SettingsUIHelper.h"
#include <vssym32.h>
#include <dwmapi.h>
static _declspec(thread) SIZE g_SysButtonSize; // the size of the system buttons (close, minimize) for this thread's window
static WNDPROC g_OldClassCaptionProc;
static HBITMAP g_GlowBmp;
static HBITMAP g_GlowBmpMax;
static LONG g_bInjected; // the process is injected
static int g_DPI;
static UINT g_Message; // private message to detect if the caption is subclassed
static ATOM g_SubclassAtom;
struct CustomCaption
{
int leftPadding;
int topPadding;
int iconPadding;
};
static CustomCaption g_CustomCaption[3]={
{2,3,10}, // Aero
{4,2,10}, // Aero maximized
{4,2,10}, // Basic
};
void GetSysButtonSize( HWND hWnd )
{
TITLEBARINFOEX titleInfo={sizeof(titleInfo)};
SendMessage(hWnd,WM_GETTITLEBARINFOEX,0,(LPARAM)&titleInfo);
int buttonLeft=titleInfo.rgrect[2].left;
if (buttonLeft>titleInfo.rgrect[5].left) buttonLeft=titleInfo.rgrect[5].left;
int buttonRight=titleInfo.rgrect[2].right;
if (buttonRight<titleInfo.rgrect[5].right) buttonRight=titleInfo.rgrect[5].right;
int w=buttonRight-buttonLeft;
int h=titleInfo.rgrect[5].bottom-titleInfo.rgrect[5].top;
g_SysButtonSize.cx=w;
g_SysButtonSize.cy=h;
}
// Subclasses the main IE frame to redraw the caption when the text changes
static LRESULT CALLBACK SubclassFrameProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (uMsg==g_Message)
{
GetSysButtonSize(hWnd);
HWND caption=FindWindowEx(hWnd,NULL,L"Client Caption",NULL);
if (caption)
InvalidateRect(caption,NULL,FALSE);
return 0;
}
if (uMsg==WM_SETTEXT || uMsg==WM_ACTIVATE)
{
HWND caption=FindWindowEx(hWnd,NULL,L"Client Caption",NULL);
if (caption)
InvalidateRect(caption,NULL,FALSE);
}
if (uMsg==WM_SIZE || uMsg==WM_SETTINGCHANGE)
{
GetSysButtonSize(hWnd);
if (uMsg==WM_SETTINGCHANGE)
{
CSettingsLockWrite lock;
UpdateSettings();
}
}
while (1)
{
WNDPROC proc=(WNDPROC)GetProp(hWnd,MAKEINTATOM(g_SubclassAtom));
if (proc)
return CallWindowProc(proc,hWnd,uMsg,wParam,lParam);
}
}
static LRESULT DefCaptionProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
while (1)
{
WNDPROC proc=(WNDPROC)GetProp(hWnd,MAKEINTATOM(g_SubclassAtom));
if (proc)
return CallWindowProc(proc,hWnd,uMsg,wParam,lParam);
}
}
// Subclasses the caption window to draw the icon and the text
static LRESULT CALLBACK SubclassCaptionProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (uMsg==g_Message)
return 1;
if (uMsg==WM_ERASEBKGND)
return 0;
if (uMsg==WM_PAINT)
{
HTHEME theme=OpenThemeData(hWnd,L"Window");
if (!theme) return DefCaptionProc(hWnd,uMsg,wParam,lParam);
// get the icon and the text from the parent
HWND parent=GetParent(hWnd);
wchar_t caption[256];
GetWindowText(parent,caption,_countof(caption));
HICON hIcon=(HICON)SendMessage(parent,WM_GETICON,ICON_SMALL,0);
int iconSize=GetSystemMetrics(SM_CXSMICON);
bool bMaximized=IsZoomed(parent)!=0;
bool bActive=(parent==GetActiveWindow());
RECT rc;
GetClientRect(hWnd,&rc);
if (!g_DPI)
{
HDC hdc=GetDC(NULL);
g_DPI=GetDeviceCaps(hdc,LOGPIXELSY);
ReleaseDC(NULL,hdc);
}
// create a font from the user settings
HFONT font=CreateFontSetting(GetSettingString(L"CaptionFont"),g_DPI);
if (!font)
{
LOGFONT lFont;
GetThemeSysFont(theme,TMT_CAPTIONFONT,&lFont);
font=CreateFontIndirect(&lFont);
}
bool bIcon=GetSettingBool(L"ShowIcon");
bool bCenter=GetSettingBool(L"CenterCaption");
bool bGlow=GetSettingBool(bMaximized?L"MaxGlow":L"Glow");
DTTOPTS opts={sizeof(opts),DTT_COMPOSITED|DTT_TEXTCOLOR};
opts.crText=GetSettingInt(bMaximized?(bActive?L"MaxColor":L"InactiveMaxColor"):(bActive?L"TextColor":L"InactiveColor"))&0xFFFFFF;
BOOL bComposition;
if (SUCCEEDED(DwmIsCompositionEnabled(&bComposition)) && bComposition)
{
// Aero Theme
PAINTSTRUCT ps;
HDC hdc=BeginPaint(hWnd,&ps);
BP_PAINTPARAMS paintParams={sizeof(paintParams),BPPF_ERASE};
HDC hdcPaint=NULL;
HPAINTBUFFER hBufferedPaint=BeginBufferedPaint(hdc,&ps.rcPaint,BPBF_TOPDOWNDIB,&paintParams,&hdcPaint);
if (hdcPaint)
{
// exclude the caption buttons
rc.right-=g_SysButtonSize.cx+5;
if (GetWinVersion()==WIN_VER_VISTA) rc.bottom++;
if (!bMaximized)
{
rc.left+=g_CustomCaption[0].leftPadding;
int y=g_CustomCaption[0].topPadding;
if (y>rc.bottom-iconSize) y=rc.bottom-iconSize;
if (bIcon)
{
DrawIconEx(hdcPaint,rc.left,y,hIcon,iconSize,iconSize,0,NULL,DI_NORMAL|DI_NOMIRROR);
rc.left+=iconSize;
}
rc.left+=g_CustomCaption[0].iconPadding;
rc.bottom++;
}
else
{
// when the window is maximized, the caption bar is partially off-screen, so align the icon to the bottom
rc.left+=g_CustomCaption[1].leftPadding;
if (bIcon)
{
DrawIconEx(hdcPaint,rc.left,rc.bottom-iconSize-g_CustomCaption[1].topPadding,hIcon,iconSize,iconSize,0,NULL,DI_NORMAL|DI_NOMIRROR);
rc.left+=iconSize;
}
rc.left+=g_CustomCaption[1].iconPadding;
if (GetWinVersion()>=WIN_VER_WIN10)
rc.bottom++;
}
if (GetWinVersion()<WIN_VER_WIN10)
rc.top=rc.bottom-g_SysButtonSize.cy;
HFONT font0=(HFONT)SelectObject(hdcPaint,font);
RECT rcText={0,0,0,0};
opts.dwFlags|=DTT_CALCRECT;
DrawThemeTextEx(theme,hdcPaint,0,0,caption,-1,DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE|DT_CALCRECT,&rcText,&opts);
int textWidth=rcText.right-rcText.left;
if (bCenter && textWidth<rc.right-rc.left)
{
rc.left+=(rc.right-rc.left-textWidth)/2;
}
if (textWidth>rc.right-rc.left)
textWidth=rc.right-rc.left;
opts.dwFlags&=~DTT_CALCRECT;
if (bGlow)
{
HDC hSrc=CreateCompatibleDC(hdcPaint);
HGDIOBJ bmp0=SelectObject(hSrc,bMaximized?g_GlowBmpMax:g_GlowBmp);
BLENDFUNCTION func={AC_SRC_OVER,0,255,AC_SRC_ALPHA};
AlphaBlend(hdcPaint,rc.left-11,rc.top,11,rc.bottom-rc.top,hSrc,0,0,11,24,func);
AlphaBlend(hdcPaint,rc.left,rc.top,textWidth,rc.bottom-rc.top,hSrc,11,0,2,24,func);
AlphaBlend(hdcPaint,rc.left+textWidth,rc.top,11,rc.bottom-rc.top,hSrc,13,0,11,24,func);
SelectObject(hSrc,bmp0);
DeleteDC(hSrc);
}
DrawThemeTextEx(theme,hdcPaint,0,0,caption,-1,DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE|DT_END_ELLIPSIS,&rc,&opts);
SelectObject(hdcPaint,font0);
EndBufferedPaint(hBufferedPaint,TRUE);
}
EndPaint(hWnd,&ps);
}
else
{
// Basic Theme
// first draw the caption bar
DefCaptionProc(hWnd,uMsg,wParam,lParam);
// then draw the caption directly in the window DC
HDC hdc=GetWindowDC(hWnd);
// exclude the caption buttons
rc.right-=g_SysButtonSize.cx+5;
rc.top=rc.bottom-g_SysButtonSize.cy;
rc.left+=g_CustomCaption[2].leftPadding;
if (bIcon)
{
DrawIconEx(hdc,rc.left,rc.bottom-iconSize-g_CustomCaption[2].topPadding,hIcon,iconSize,iconSize,0,NULL,DI_NORMAL|DI_NOMIRROR);
rc.left+=iconSize;
}
rc.left+=g_CustomCaption[2].iconPadding;
HFONT font0=(HFONT)SelectObject(hdc,font);
RECT rcText={0,0,0,0};
opts.dwFlags|=DTT_CALCRECT;
DrawThemeTextEx(theme,hdc,0,0,caption,-1,DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE|DT_CALCRECT,&rcText,&opts);
int textWidth=rcText.right-rcText.left;
if (bCenter && textWidth<rc.right-rc.left)
{
rc.left+=(rc.right-rc.left-textWidth)/2;
}
if (textWidth>rc.right-rc.left)
textWidth=rc.right-rc.left;
opts.dwFlags&=~DTT_CALCRECT;
if (bGlow)
{
HDC hSrc=CreateCompatibleDC(hdc);
HGDIOBJ bmp0=SelectObject(hSrc,bMaximized?g_GlowBmpMax:g_GlowBmp);
BLENDFUNCTION func={AC_SRC_OVER,0,255,AC_SRC_ALPHA};
AlphaBlend(hdc,rc.left-11,rc.top,11,rc.bottom-rc.top,hSrc,0,0,11,24,func);
AlphaBlend(hdc,rc.left,rc.top,textWidth,rc.bottom-rc.top,hSrc,11,0,2,24,func);
AlphaBlend(hdc,rc.left+textWidth,rc.top,11,rc.bottom-rc.top,hSrc,13,0,11,24,func);
SelectObject(hSrc,bmp0);
DeleteDC(hSrc);
}
DrawThemeTextEx(theme,hdc,0,0,caption,-1,DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE|DT_END_ELLIPSIS,&rc,&opts);
SelectObject(hdc,font0);
ReleaseDC(hWnd,hdc);
}
DeleteObject(font);
CloseThemeData(theme);
return 0;
}
return DefCaptionProc(hWnd,uMsg,wParam,lParam);
}
// Replacement proc for the "Client Caption" class that hooks the main frame and the caption windows
static LRESULT CALLBACK ClassCaptionProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (uMsg==WM_CREATE)
{
WNDPROC proc=(WNDPROC)SetWindowLongPtr(hWnd,GWLP_WNDPROC,(LONG_PTR)SubclassCaptionProc);
SetProp(hWnd,MAKEINTATOM(g_SubclassAtom),(HANDLE)proc);
HWND frame=GetParent(hWnd);
proc=(WNDPROC)SetWindowLongPtr(frame,GWLP_WNDPROC,(LONG_PTR)SubclassFrameProc);
SetProp(frame,MAKEINTATOM(g_SubclassAtom),(HANDLE)proc);
PostMessage(frame,g_Message,0,0);
}
return CallWindowProc(g_OldClassCaptionProc,hWnd,uMsg,wParam,lParam);
}
static BOOL CALLBACK EnumTopWindows( HWND hwnd, LPARAM lParam )
{
DWORD processId;
DWORD threadId=GetWindowThreadProcessId(hwnd,&processId);
if (processId==GetCurrentProcessId())
{
HWND caption=FindWindowEx(hwnd,NULL,L"Client Caption",NULL);
if (caption)
{
LogToFile(CIE_LOG,L"InitClassicIE: caption=%X",(DWORD)caption);
if (!g_OldClassCaptionProc)
g_OldClassCaptionProc=(WNDPROC)SetClassLongPtr(caption,GCLP_WNDPROC,(LONG_PTR)ClassCaptionProc);
WNDPROC proc=(WNDPROC)SetWindowLongPtr(caption,GWLP_WNDPROC,(LONG_PTR)SubclassCaptionProc);
SetProp(caption,MAKEINTATOM(g_SubclassAtom),(HANDLE)proc);
proc=(WNDPROC)SetWindowLongPtr(hwnd,GWLP_WNDPROC,(LONG_PTR)SubclassFrameProc);
SetProp(hwnd,MAKEINTATOM(g_SubclassAtom),(HANDLE)proc);
PostMessage(hwnd,g_Message,0,0);
}
}
return TRUE;
}
void InitClassicIE( HMODULE hModule )
{
CRegKey regKey;
if (regKey.Open(HKEY_CURRENT_USER,GetSettingsRegPath())==ERROR_SUCCESS)
{
DWORD val;
if (regKey.QueryDWORDValue(L"CustomAero",val)==ERROR_SUCCESS)
{
g_CustomCaption[0].leftPadding=(val&255);
g_CustomCaption[0].topPadding=((val>>8)&255);
g_CustomCaption[0].iconPadding=((val>>16)&255);
}
if (regKey.QueryDWORDValue(L"CustomAeroMax",val)==ERROR_SUCCESS)
{
g_CustomCaption[1].leftPadding=(val&255);
g_CustomCaption[1].topPadding=((val>>8)&255);
g_CustomCaption[1].iconPadding=((val>>16)&255);
}
if (regKey.QueryDWORDValue(L"CustomBasic",val)==ERROR_SUCCESS)
{
g_CustomCaption[2].leftPadding=(val&255);
g_CustomCaption[2].topPadding=((val>>8)&255);
g_CustomCaption[2].iconPadding=((val>>16)&255);
}
}
g_Message=RegisterWindowMessage(L"ClassicIE.Injected");
g_SubclassAtom=GlobalAddAtom(L"ClassicIE.Subclass");
ChangeWindowMessageFilter(g_Message,MSGFLT_ADD);
g_GlowBmp=(HBITMAP)LoadImage(g_Instance,MAKEINTRESOURCE(IDB_GLOW),IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION);
PremultiplyBitmap(g_GlowBmp,GetSettingInt(L"GlowColor"));
g_GlowBmpMax=(HBITMAP)LoadImage(g_Instance,MAKEINTRESOURCE(IDB_GLOW),IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION);
PremultiplyBitmap(g_GlowBmpMax,GetSettingInt(L"MaxGlowColor"));
EnumWindows(EnumTopWindows,0);
}
@@ -0,0 +1,171 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#include "stdafx.h"
#include "Settings.h"
#include "SettingsUIHelper.h"
#include "LanguageSettingsHelper.h"
#include "ResourceHelper.h"
#include "Translations.h"
#include "resource.h"
#include "dllmain.h"
#include "ClassicIEDLL.h"
#include <dwmapi.h>
#include <vssym32.h>
///////////////////////////////////////////////////////////////////////////////
static CSetting g_Settings[]={
{L"Basic",CSetting::TYPE_GROUP,IDS_BASIC_SETTINGS},
{L"EnableSettings",CSetting::TYPE_BOOL,0,0,1,CSetting::FLAG_HIDDEN|CSetting::FLAG_NOSAVE},
{L"TitleBar",CSetting::TYPE_GROUP,IDS_TITLE_SETTINGS},
{L"ShowCaption",CSetting::TYPE_BOOL,IDS_SHOW_CAPTION,IDS_SHOW_CAPTION_TIP,1,CSetting::FLAG_WARM|CSetting::FLAG_BASIC},
{L"ShowIcon",CSetting::TYPE_BOOL,IDS_SHOW_ICON,IDS_SHOW_ICON_TIP,1,CSetting::FLAG_WARM|CSetting::FLAG_BASIC,L"ShowCaption"},
{L"CenterCaption",CSetting::TYPE_BOOL,IDS_CENTER_CAPTION,IDS_CENTER_CAPTION_TIP,0,CSetting::FLAG_WARM|CSetting::FLAG_BASIC,L"ShowCaption"},
{L"CaptionFont",CSetting::TYPE_FONT,IDS_CAPTION_FONT,IDS_CAPTION_FONT_TIP,L"Segoe UI, normal, 9",CSetting::FLAG_WARM,L"ShowCaption"},
{L"TextColor",CSetting::TYPE_COLOR,IDS_TEXT_COLOR,IDS_TEXT_COLOR_TIP,0,CSetting::FLAG_WARM,L"ShowCaption"},
{L"MaxColor",CSetting::TYPE_COLOR,IDS_MAXTEXT_COLOR,IDS_MAXTEXT_COLOR_TIP,0,CSetting::FLAG_WARM|(1<<24),L"ShowCaption"},
{L"InactiveColor",CSetting::TYPE_COLOR,IDS_INTEXT_COLOR,IDS_INTEXT_COLOR_TIP,0,CSetting::FLAG_WARM|(2<<24),L"ShowCaption"},
{L"InactiveMaxColor",CSetting::TYPE_COLOR,IDS_MAXINTEXT_COLOR,IDS_MAXINTEXT_COLOR_TIP,0,CSetting::FLAG_WARM|(3<<24),L"ShowCaption"},
{L"Glow",CSetting::TYPE_BOOL,IDS_GLOW,IDS_GLOW_TIP,0,CSetting::FLAG_WARM,L"ShowCaption"},
{L"GlowColor",CSetting::TYPE_COLOR,IDS_GLOW_COLOR,IDS_GLOW_COLOR_TIP,0xFFFFFF,CSetting::FLAG_WARM|(4<<24),L"#Glow",L"Glow"},
{L"MaxGlow",CSetting::TYPE_BOOL,IDS_MAXGLOW,IDS_MAXGLOW_TIP,0,CSetting::FLAG_WARM,L"ShowCaption"},
{L"MaxGlowColor",CSetting::TYPE_COLOR,IDS_MAXGLOW_COLOR,IDS_MAXGLOW_COLOR_TIP,0xFFFFFF,CSetting::FLAG_WARM|(5<<24),L"#MaxGlow",L"MaxGlow"},
{L"StatusBar",CSetting::TYPE_GROUP,IDS_STATUS_SETTINGS},
{L"ShowProgress",CSetting::TYPE_BOOL,IDS_SHOW_PROGRESS,IDS_SHOW_PROGRESS_TIP,1,CSetting::FLAG_WARM|CSetting::FLAG_BASIC},
{L"ShowZone",CSetting::TYPE_BOOL,IDS_SHOW_ZONE,IDS_SHOW_ZONE_TIP,1,CSetting::FLAG_WARM|CSetting::FLAG_BASIC},
{L"ShowProtected",CSetting::TYPE_BOOL,IDS_SHOW_PROTECTED,IDS_SHOW_PROTECTED_TIP,1,CSetting::FLAG_WARM,L"ShowZone",L"ShowZone"},
{L"Language",CSetting::TYPE_GROUP,IDS_LANGUAGE_SETTINGS,0,0,0,NULL,NULL,GetLanguageSettings(COMPONENT_IE)},
{L"Language",CSetting::TYPE_STRING,0,0,L"",CSetting::FLAG_SHARED},
{NULL}
};
void UpgradeSettings( bool bShared )
{
}
void UpdateSettings( void )
{
bool bWin8=(GetWinVersion()>=WIN_VER_WIN8);
BOOL bComposition=0;
if (FAILED(DwmIsCompositionEnabled(&bComposition)))
bComposition=FALSE;
if (bComposition && bWin8)
{
// check for High Contrast theme on Win8
HIGHCONTRAST contrast={sizeof(contrast)};
if (SystemParametersInfo(SPI_GETHIGHCONTRAST,sizeof(contrast),&contrast,0) && (contrast.dwFlags&HCF_HIGHCONTRASTON))
bComposition=FALSE;
else
{
// check for Basic theme
DWORD color;
BOOL opaque;
if (SUCCEEDED(DwmGetColorizationColor(&color,&opaque)) && opaque)
bComposition=FALSE;
}
}
UpdateSetting(L"Glow",CComVariant(bComposition?1:0),false);
UpdateSetting(L"MaxGlow",CComVariant(bComposition?1:0),false);
UpdateSetting(L"CenterCaption",CComVariant((bWin8 && GetWinVersion()<WIN_VER_WIN10)?1:0),false);
// create a dummy window to get a theme
HWND hwnd=CreateWindow(L"#32770",L"",WS_OVERLAPPEDWINDOW,0,0,0,0,NULL,NULL,NULL,0);
HTHEME theme=OpenThemeData(hwnd,L"Window");
if (theme)
{
HDC hdc=GetDC(NULL);
int dpi=GetDeviceCaps(hdc,LOGPIXELSY);
ReleaseDC(NULL,hdc);
LOGFONT font;
GetThemeSysFont(theme,TMT_CAPTIONFONT,&font);
wchar_t text[256];
const wchar_t *type=font.lfItalic?L"italic":L"normal";
if (font.lfWeight>=FW_BOLD)
type=font.lfItalic?L"bold_italic":L"bold";
Sprintf(text,_countof(text),L"%s, %s, %d",font.lfFaceName,type,(-font.lfHeight*72+dpi/2)/dpi);
UpdateSetting(L"CaptionFont",CComVariant(text),false);
int color=GetThemeSysColor(theme,COLOR_CAPTIONTEXT);
UpdateSetting(L"TextColor",CComVariant(color),false);
UpdateSetting(L"MaxColor",CComVariant(color),false);
if (bWin8)
color=GetThemeSysColor(theme,COLOR_INACTIVECAPTIONTEXT);
UpdateSetting(L"InactiveColor",CComVariant(color),false);
UpdateSetting(L"InactiveMaxColor",CComVariant(color),false);
CloseThemeData(theme);
}
else
{
int color=GetSysColor(COLOR_CAPTIONTEXT);
UpdateSetting(L"TextColor",CComVariant(color),false);
UpdateSetting(L"MaxColor",CComVariant(color),false);
color=GetSysColor(COLOR_INACTIVECAPTIONTEXT);
UpdateSetting(L"InactiveColor",CComVariant(color),false);
UpdateSetting(L"InactiveMaxColor",CComVariant(color),false);
}
DestroyWindow(hwnd);
CRegKey regKey;
wchar_t language[100]=L"";
if (regKey.Open(HKEY_LOCAL_MACHINE,L"Software\\IvoSoft\\ClassicShell",KEY_READ|KEY_WOW64_64KEY)==ERROR_SUCCESS)
{
ULONG size=_countof(language);
if (regKey.QueryStringValue(L"DefaultLanguage",language,&size)!=ERROR_SUCCESS)
language[0]=0;
}
UpdateSetting(L"Language",language,false);
}
void InitSettings( void )
{
InitSettings(g_Settings,COMPONENT_IE,NULL);
}
void ClosingSettings( HWND hWnd, int flags, int command )
{
if (command==IDOK)
{
if (flags&CSetting::FLAG_WARM)
{
if (FindWindow(L"IEFrame",NULL))
MessageBox(hWnd,LoadStringEx(IDS_NEW_SETTINGS),LoadStringEx(IDS_APP_TITLE),MB_OK|MB_ICONINFORMATION);
}
}
}
void SettingChangedCallback( const CSetting *pSetting )
{
}
CSIEAPI void ShowIESettings( void )
{
if (!GetSettingBool(L"EnableSettings"))
return;
wchar_t title[100];
DWORD ver=GetVersionEx(g_Instance);
if (ver)
Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE_VER),ver>>24,(ver>>16)&0xFF,ver&0xFFFF);
else
Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE));
EditSettings(title,true,0);
}
CSIEAPI DWORD GetIESettings( void )
{
DWORD res=0;
if (GetSettingBool(L"ShowCaption")) res|=IE_SETTING_CAPTION;
if (GetSettingBool(L"ShowProgress")) res|=IE_SETTING_PROGRESS;
if (GetSettingBool(L"ShowZone")) res|=IE_SETTING_ZONE;
if (GetSettingBool(L"ShowProtected")) res|=IE_SETTING_PROTECTED;
return res;
}
@@ -0,0 +1,6 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#pragma once
void InitSettings( void );
@@ -0,0 +1,160 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#include "stdafx.h"
#include "resource.h"
#include "..\..\ClassicShellLib\resource.h"
#include "Settings.h"
#include "SettingsUI.h"
#include "SettingsUIHelper.h"
#include "DownloadHelper.h"
#include "Translations.h"
#include "ResourceHelper.h"
#include "dllmain.h"
#include "ClassicIEDLL.h"
#pragma comment(linker, \
"\"/manifestdependency:type='Win32' "\
"name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' "\
"processorArchitecture='*' "\
"publicKeyToken='6595b64144ccf1df' "\
"language='*'\"")
CClassicIEDLLModule _AtlModule;
static int g_LoadDialogs[]=
{
IDD_SETTINGS,0x04000000,
IDD_SETTINGSTREE,0x04000000,
IDD_LANGUAGE,0x04000000,
IDD_PROGRESS,0x04000004,
0
};
const wchar_t *GetDocRelativePath( void )
{
return DOC_PATH;
}
static void NewVersionCallback( VersionData &data )
{
wchar_t path[_MAX_PATH];
GetModuleFileName(g_Instance,path,_countof(path));
PathRemoveFileSpec(path);
PathAppend(path,L"ClassicShellUpdate.exe");
wchar_t cmdLine[1024];
Sprintf(cmdLine,_countof(cmdLine),L"\"%s\" -popup",path);
STARTUPINFO startupInfo={sizeof(startupInfo)};
PROCESS_INFORMATION processInfo;
memset(&processInfo,0,sizeof(processInfo));
if (CreateProcess(path,cmdLine,NULL,NULL,TRUE,0,NULL,NULL,&startupInfo,&processInfo))
{
CloseHandle(processInfo.hThread);
CloseHandle(processInfo.hProcess);
}
}
CSIEAPI void CheckForNewVersionIE( void )
{
CheckForNewVersion(NULL,COMPONENT_IE,CHECK_AUTO_WAIT,NewVersionCallback);
}
static HANDLE g_DllInitThread;
static DWORD CALLBACK DllInitThread( void* )
{
InitSettings();
CString language=GetSettingString(L"Language");
ParseTranslations(NULL,language);
HINSTANCE resInstance=LoadTranslationDll(language);
LoadTranslationResources(resInstance,g_LoadDialogs);
if (resInstance)
FreeLibrary(resInstance);
InitClassicIE(g_Instance);
return 0;
}
CSIEAPI void WaitDllInitThread( void )
{
ATLASSERT(g_DllInitThread);
WaitForSingleObject(g_DllInitThread,INFINITE);
}
CSIEAPI void DllLogToFile( const wchar_t *location, const wchar_t *message, ... )
{
va_list args;
va_start(args,message);
VLogToFile(location,message,args);
va_end(args);
}
#ifndef _WIN64
CSIEAPI bool DllSaveAdmx( const char *admxFile, const char *admlFile, const char *docFile, const wchar_t *language )
{
WaitDllInitThread();
HMODULE dll=NULL;
if (language[0])
{
wchar_t path[_MAX_PATH];
GetCurrentDirectory(_countof(path),path);
PathAppend(path,language);
PathAddExtension(path,L".dll");
dll=LoadLibraryEx(path,NULL,LOAD_LIBRARY_AS_DATAFILE|LOAD_LIBRARY_AS_IMAGE_RESOURCE);
}
LoadTranslationResources(dll,NULL);
return SaveAdmx(COMPONENT_IE,admxFile,admlFile,docFile);
}
#endif
CSIEAPI bool DllImportSettingsXml( const wchar_t *fname )
{
return ImportSettingsXml(fname);
}
CSIEAPI bool DllExportSettingsXml( const wchar_t *fname )
{
return ExportSettingsXml(fname);
}
// DLL Entry Point
extern "C" BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
{
if (dwReason==DLL_PROCESS_ATTACH)
{
wchar_t path[_MAX_PATH];
GetModuleFileName(NULL,path,_countof(path));
const wchar_t *exe=PathFindFileName(path);
if (_wcsicmp(exe,L"explorer.exe")==0) return FALSE;
if (_wcsicmp(exe,L"iexplore.exe")==0)
{
DWORD version=GetVersionEx(GetModuleHandle(NULL));
if (version<0x09000000) return FALSE;
CRegKey regSettings, regSettingsUser, regPolicy, regPolicyUser;
bool bUpgrade=OpenSettingsKeys(COMPONENT_EXPLORER,regSettings,regSettingsUser,regPolicy,regPolicyUser);
CSetting settings[]={
{L"ShowCaption",CSetting::TYPE_BOOL,0,0,1},
{L"ShowProgress",CSetting::TYPE_BOOL,0,0,1},
{L"ShowZone",CSetting::TYPE_BOOL,0,0,1},
{NULL}
};
settings[0].LoadValue(regSettings,regSettingsUser,regPolicy,regPolicyUser);
settings[1].LoadValue(regSettings,regSettingsUser,regPolicy,regPolicyUser);
settings[2].LoadValue(regSettings,regSettingsUser,regPolicy,regPolicyUser);
if (!GetSettingBool(settings[0]) && !GetSettingBool(settings[1]) && !GetSettingBool(settings[2])) return FALSE;
}
g_Instance=hInstance;
g_DllInitThread=CreateThread(NULL,0,DllInitThread,NULL,0,NULL);
}
return _AtlModule.DllMain(dwReason, lpReserved);
}
@@ -0,0 +1,15 @@
// Classic Shell (c) 2009-2016, Ivo Beltchev
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#pragma once
#include "ClassicIEDLL_i.h"
class CClassicIEDLLModule : public CAtlDllModuleT< CClassicIEDLLModule >
{
public :
DECLARE_LIBID(LIBID_ClassicIEDLLLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_CLASSICIEDLL, "{DF3255F4-FF55-44FA-A728-E77B83E9E403}")
};
extern class CClassicIEDLLModule _AtlModule;
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -0,0 +1,57 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ClassicIEDLL.rc
//
#define IDI_APPICON 1
#define IDR_CLASSICIEDLL 101
#define IDR_CLASSICIEBHO 102
#define IDB_BITMAP1 201
#define IDB_GLOW 201
#define IDS_APP_TITLE 5000
#define IDS_SETTINGS_TITLE 5001
#define IDS_SETTINGS_TITLE_VER 5002
#define IDS_NEW_SETTINGS 5003
#define IDS_TITLE_SETTINGS 5004
#define IDS_SHOW_CAPTION 5005
#define IDS_SHOW_CAPTION_TIP 5006
#define IDS_CENTER_CAPTION 5007
#define IDS_CENTER_CAPTION_TIP 5008
#define IDS_LANGUAGE_SETTINGS 5009
#define IDS_CAPTION_FONT 5010
#define IDS_CAPTION_FONT_TIP 5011
#define IDS_TEXT_COLOR 5012
#define IDS_TEXT_COLOR_TIP 5013
#define IDS_MAXTEXT_COLOR 5014
#define IDS_MAXTEXT_COLOR_TIP 5015
#define IDS_INTEXT_COLOR 5016
#define IDS_INTEXT_COLOR_TIP 5017
#define IDS_MAXINTEXT_COLOR 5018
#define IDS_MAXINTEXT_COLOR_TIP 5019
#define IDS_GLOW 5020
#define IDS_GLOW_TIP 5021
#define IDS_GLOW_COLOR 5022
#define IDS_GLOW_COLOR_TIP 5023
#define IDS_MAXGLOW 5024
#define IDS_MAXGLOW_TIP 5025
#define IDS_MAXGLOW_COLOR 5026
#define IDS_MAXGLOW_COLOR_TIP 5027
#define IDS_STATUS_SETTINGS 5028
#define IDS_SHOW_PROGRESS 5029
#define IDS_SHOW_PROGRESS_TIP 5030
#define IDS_SHOW_ZONE 5031
#define IDS_SHOW_ZONE_TIP 5032
#define IDS_SHOW_PROTECTED 5033
#define IDS_SHOW_PROTECTED_TIP 5034
#define IDS_SHOW_ICON 5035
#define IDS_SHOW_ICON_TIP 5036
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 202
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif
@@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// ClassicIEDLL.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
@@ -0,0 +1,35 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
#ifndef STRICT
#define STRICT
#endif
#include "targetver.h"
#define ISOLATION_AWARE_ENABLED 1
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#include <atlstr.h>
using namespace ATL;
#ifdef BUILD_SETUP
#define INI_PATH L""
#define DOC_PATH L""
#else
#define INI_PATH L"..\\"
#define DOC_PATH L"..\\..\\Docs\\Help\\"
#endif
#include "StringUtils.h"
@@ -0,0 +1,24 @@
#pragma once
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Specifies that the minimum required platform is Windows 7.
#define WINVER 0x0602 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows 7.
#define _WIN32_WINNT 0x0602 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
#endif
+21
View File
@@ -0,0 +1,21 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ClassicIE.rc
//
#define IDC_MYICON 2
#define IDD_CLASSICIE_DIALOG 102
#define IDR_MAINFRAME 128
#define IDI_ICON1 129
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif