1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00
This commit is contained in:
Mohmed abdel-fattah 2024-07-08 14:26:36 +02:00 committed by GitHub
commit 1f2f3fcab8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 792 additions and 59 deletions

View file

@ -19,7 +19,7 @@ TARGET := $(word 1,$(subst -, ,$(TUPLE)))
DEF_SUFFIX := $(if $(TARGET:x86_64=),.def,.def64) DEF_SUFFIX := $(if $(TARGET:x86_64=),.def,.def64)
.PHONY: all .PHONY: all
all: dwmapi-delaylib.lib version-delaylib.lib wintrust-delaylib.lib all: dwmapi-delaylib.lib version-delaylib.lib wintrust-delaylib.lib uxtheme-delaylib.lib
%.def64: %.def %.def64: %.def
$(AM_V_SED) "s/@.*//" $< >$@ $(AM_V_SED) "s/@.*//" $< >$@

View file

@ -367,7 +367,7 @@ uninstall-am:
.PHONY: all .PHONY: all
all: dwmapi-delaylib.lib version-delaylib.lib wintrust-delaylib.lib all: dwmapi-delaylib.lib version-delaylib.lib wintrust-delaylib.lib uxtheme-delaylib.lib
%.def64: %.def %.def64: %.def
$(AM_V_SED) "s/@.*//" $< >$@ $(AM_V_SED) "s/@.*//" $< >$@

View file

@ -1,2 +1,3 @@
EXPORTS EXPORTS
DwmGetWindowAttribute@16 DwmGetWindowAttribute@16
DwmSetWindowAttribute@16

79
.mingw/uxtheme.def Normal file
View file

@ -0,0 +1,79 @@
;
; Definition file of UxTheme.dll
; Automatic generated by gendef
; written by Kai Tietz 2008
;
LIBRARY "UxTheme.dll"
EXPORTS
BeginPanningFeedback@4
EndPanningFeedback@8
UpdatePanningFeedback@16
BeginBufferedAnimation@32
BeginBufferedPaint@20
BufferedPaintClear@8
BufferedPaintInit@0
BufferedPaintRenderAnimation@8
BufferedPaintSetAlpha@12
DrawThemeBackgroundEx@24
BufferedPaintStopAllAnimations@4
BufferedPaintUnInit@0
CloseThemeData@4
DrawThemeBackground@24
DrawThemeEdge@32
DrawThemeIcon@28
DrawThemeParentBackground@12
DrawThemeParentBackgroundEx@16
DrawThemeText@36
OpenThemeDataEx@12
DrawThemeTextEx@36
EnableThemeDialogTexture@8
EnableTheming@4
EndBufferedAnimation@8
EndBufferedPaint@8
GetBufferedPaintBits@12
GetBufferedPaintDC@4
GetBufferedPaintTargetDC@4
GetBufferedPaintTargetRect@8
GetCurrentThemeName@24
GetThemeAppProperties@0
GetThemeBackgroundContentRect@24
GetThemeBackgroundExtent@24
GetThemeBackgroundRegion@24
GetThemeBitmap@24
GetThemeBool@20
GetThemeColor@20
GetThemeDocumentationProperty@16
GetThemeEnumValue@20
GetThemeFilename@24
GetThemeFont@24
GetThemeInt@20
GetThemeIntList@20
GetThemeMargins@28
GetThemeMetric@24
GetThemePartSize@28
GetThemePosition@20
GetThemePropertyOrigin@20
GetThemeRect@20
GetThemeStream@28
GetThemeString@24
GetThemeSysBool@8
GetThemeSysColor@8
GetThemeSysColorBrush@8
GetThemeSysFont@12
GetThemeSysInt@12
GetThemeSysSize@8
GetThemeSysString@16
GetThemeTextExtent@36
GetThemeTextMetrics@20
GetThemeTransitionDuration@24
GetWindowTheme@4
HitTestThemeBackground@40
IsAppThemed@0
IsCompositionActive@0
IsThemeActive@0
IsThemeBackgroundPartiallyTransparent@12
IsThemeDialogTextureEnabled@4
IsThemePartDefined@12
OpenThemeData@8
SetThemeAppProperties@4
SetWindowTheme@12

View file

@ -133,12 +133,12 @@
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;uxtheme.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel> <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;uxtheme.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -162,12 +162,12 @@
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;uxtheme.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel> <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm</AdditionalLibraryDirectories>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;uxtheme.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -193,12 +193,12 @@
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;uxtheme.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel> <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64</AdditionalLibraryDirectories>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;uxtheme.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -229,12 +229,12 @@
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;uxtheme.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel> <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;uxtheme.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -260,13 +260,13 @@
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;uxtheme.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel> <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;uxtheme.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -292,13 +292,13 @@
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;uxtheme.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel> <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm</AdditionalLibraryDirectories>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;uxtheme.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -326,13 +326,13 @@
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;uxtheme.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel> <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64</AdditionalLibraryDirectories>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;uxtheme.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -363,13 +363,13 @@
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;uxtheme.lib;uxtheme.lib;shell32.lib;shlwapi.lib;version.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel> <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;uxtheme.dll;shell32.dll;shlwapi.dll;version.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View file

@ -280,7 +280,7 @@ NONVULNERABLE_LIBS = -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lcomctl32 -
# Ideally there would also be virtdisk and wininet as delaylib's below, but the MinGW folks haven't quite sorted out delay-loading # Ideally there would also be virtdisk and wininet as delaylib's below, but the MinGW folks haven't quite sorted out delay-loading
# for x86_32 so as soon as you try to call APIs from these, the application will crash! # for x86_32 so as soon as you try to call APIs from these, the application will crash!
# See https://github.com/pbatard/rufus/issues/1877#issuecomment-1109683039 as well as https://github.com/pbatard/rufus/issues/2272 # See https://github.com/pbatard/rufus/issues/1877#issuecomment-1109683039 as well as https://github.com/pbatard/rufus/issues/2272
VULNERABLE_LIBS = -ldwmapi-delaylib -lversion-delaylib -lwintrust-delaylib VULNERABLE_LIBS = -ldwmapi-delaylib -lversion-delaylib -lwintrust-delaylib -luxtheme-delaylib
AM_V_WINDRES_0 = @echo " RC $@";$(WINDRES) AM_V_WINDRES_0 = @echo " RC $@";$(WINDRES)
AM_V_WINDRES_1 = $(WINDRES) AM_V_WINDRES_1 = $(WINDRES)
AM_V_WINDRES_ = $(AM_V_WINDRES_$(AM_DEFAULT_VERBOSITY)) AM_V_WINDRES_ = $(AM_V_WINDRES_$(AM_DEFAULT_VERBOSITY))

View file

@ -27,9 +27,16 @@
extern "C" { extern "C" {
#endif #endif
// disable all warnings until fix theme
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#define REGKEY_HKCU HKEY_CURRENT_USER #define REGKEY_HKCU HKEY_CURRENT_USER
#define REGKEY_HKLM HKEY_LOCAL_MACHINE #define REGKEY_HKLM HKEY_LOCAL_MACHINE
/* Delete a registry key from <key_root>\Software and all its values /* Delete a registry key from <key_root>\Software and all its values
If the key has subkeys, this call will fail. */ If the key has subkeys, this call will fail. */
static __inline BOOL DeleteRegistryKey(HKEY key_root, const char* key_name) static __inline BOOL DeleteRegistryKey(HKEY key_root, const char* key_name)
@ -202,6 +209,17 @@ static __inline BOOL WriteRegistryKey32(HKEY root, const char* key, int32_t val)
DWORD tmp = (DWORD)val; DWORD tmp = (DWORD)val;
return SetRegistryKey32(root, key, tmp); return SetRegistryKey32(root, key, tmp);
} }
static __inline BOOL IsAppsUseDarkMode() {
char buffer [4] ;
DWORD cbData = (DWORD)(sizeof(buffer));
LSTATUS res = RegGetValue(REGKEY_HKCU, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"AppsUseLightTheme", RRF_RT_REG_DWORD, NULL, buffer, &cbData);
if (res == ERROR_SUCCESS)
{
int i = (int)(buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0]);
return i == 0;
}
return FALSE;
}
/* Helpers for boolean registry operations */ /* Helpers for boolean registry operations */
#define ReadRegistryKeyBool(root, key) (ReadRegistryKey32(root, key) != 0) #define ReadRegistryKeyBool(root, key) (ReadRegistryKey32(root, key) != 0)

View file

@ -38,7 +38,7 @@
#include <getopt.h> #include <getopt.h>
#include <assert.h> #include <assert.h>
#include <delayimp.h> #include <delayimp.h>
#include"ui_data.h"
#include "rufus.h" #include "rufus.h"
#include "format.h" #include "format.h"
#include "missing.h" #include "missing.h"
@ -57,6 +57,10 @@
#include "cdio/logging.h" #include "cdio/logging.h"
#include "../res/grub/grub_version.h" #include "../res/grub/grub_version.h"
#include "../res/grub2/grub2_version.h" #include "../res/grub2/grub2_version.h"
#include<dwmapi.h>
#include <Richedit.h>
#include <uxtheme.h>
enum bootcheck_return { enum bootcheck_return {
BOOTCHECK_PROCEED = 0, BOOTCHECK_PROCEED = 0,
@ -103,7 +107,7 @@ extern const char* old_c32_name[NB_OLD_C32];
extern const char* cert_name[3]; extern const char* cert_name[3];
extern const char* FileSystemLabel[FS_MAX]; extern const char* FileSystemLabel[FS_MAX];
extern const char *bootmgr_efi_name, *efi_dirname, *efi_bootname[ARCH_MAX]; extern const char *bootmgr_efi_name, *efi_dirname, *efi_bootname[ARCH_MAX];
static UINT_PTR uIdSubclass = 1;
/* /*
* Globals * Globals
*/ */
@ -147,6 +151,23 @@ const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10, 1, 1, 1, 1 };
const char* flash_type[BADLOCKS_PATTERN_TYPES] = { "SLC", "MLC", "TLC" }; const char* flash_type[BADLOCKS_PATTERN_TYPES] = { "SLC", "MLC", "TLC" };
RUFUS_DRIVE rufus_drive[MAX_DRIVES] = { 0 }; RUFUS_DRIVE rufus_drive[MAX_DRIVES] = { 0 };
// hdc is a memory DC with a 32bpp bitmap selected into it.
// This function sets the alpha channel to 255 without
// affecting any of the color channels.
void MakeBitmapOpaque( HDC hdc, int x, int y, int cx, int cy)
{
BITMAPINFO bi = {0};
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biWidth = 1;
bi.bmiHeader.biHeight = 1;
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 32;
bi.bmiHeader.biCompression = BI_RGB;
RGBQUAD bitmapBits = { 0x00, 0x00, 0x00, 0xFF };
StretchDIBits(hdc, x, y, cx, cy, 0, 0, 1, 1, &bitmapBits, &bi,DIB_RGB_COLORS, SRCPAINT);
}
// TODO: Remember to update copyright year in stdlg's AboutCallback() WM_INITDIALOG, // TODO: Remember to update copyright year in stdlg's AboutCallback() WM_INITDIALOG,
// localization_data.sh and the .rc when the year changes! // localization_data.sh and the .rc when the year changes!
@ -934,10 +955,279 @@ out:
SetProposedLabel(device_index); SetProposedLabel(device_index);
return TRUE; return TRUE;
} }
/*
* DarkMode CheckBox Subclass Proc
*/
static LRESULT CALLBACK ButtonSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam,LPARAM lParam, UINT_PTR idSubclass, DWORD_PTR dwRefData)
{
if (!IsAppsUseDarkMode())
{
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
switch (uMsg)
{
case WM_PAINT:
{
DefSubclassProc(hWnd, uMsg, wParam, lParam);
if (!IsWindowEnabled(hWnd))
{
return true;
}
HDC hDc = GetDC(hWnd);
RECT rc1;
GetClientRect(hWnd, &rc1);
SetBkMode(hDc, TRANSPARENT);
SetTextColor(hDc, RGB(255, 255, 255));
HTHEME btnTheme = OpenThemeData(hWnd, L"Button");
SIZE siz;
GetThemePartSize(btnTheme, hDc, 3, 1, NULL, TS_DRAW, &siz);
rc1.left += siz.cx + 2;
FillRect(hDc, &rc1, CreateSolidBrush(ColorControlDark));
rc1.top += GetSystemMetrics(SM_CXPADDEDBORDER);
WCHAR szCaption[60];
GetWindowText(hWnd, szCaption, ARRAYSIZE(szCaption));
DTTOPTS opts;
opts.dwSize = sizeof(DTTOPTS);
opts.dwFlags = DTT_TEXTCOLOR;
opts.crText = RGB(255, 255, 255);
HFONT font = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
SelectObject(hDc, font);
DrawThemeTextEx(btnTheme, hDc, 3, 0, szCaption, -1, DT_SINGLELINE | DT_LEFT, &rc1, &opts);
ReleaseDC(hWnd, hDc);
return true;
}
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
/*
* Set DarkMode to all Child Windows
*/
static BOOL CALLBACK ThemeCallback(HWND hWnd, LPARAM lParam)
{
WCHAR str[20] = {0};
GetClassName(hWnd, str, 20);
bool isDarkmode = IsAppsUseDarkMode();
if (_wcsicmp(str, L"Button") == 0)
{
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
if ((style & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX)
{
if (!isDarkmode)
{
RemoveWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass);
return true;
}
else
SetWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass, 0);
}
else
SetWindowTheme(hWnd, isDarkmode ? L"DarkMode_Explorer" : L"Explorer", NULL);
}
else if (_wcsicmp(str, L"ComboBox") == 0)
{
SetWindowTheme(hWnd, isDarkmode ? L"DarkMode_CFD" : L"Explorer", NULL);
}
else if (_wcsicmp(str, L"ToolbarWindow32") == 0)
{
wchar_t toolbarText[50];
wchar_t multiToolbarText[50] ;
utf8_to_wchar_no_alloc(lmprintf(MSG_315), multiToolbarText, ARRAYSIZE(multiToolbarText));
GetWindowText(hWnd, &toolbarText, 16);
if (_wcsicmp(toolbarText, multiToolbarText) != 0)
SetWindowTheme(hWnd, isDarkmode ? L"DarkMode" : L"Explorer", NULL);
}
else if (_wcsicmp(str, L"EDIT") == 0)
{
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
if (((style & WS_VSCROLL) == WS_VSCROLL) || ((style & WS_HSCROLL) == WS_HSCROLL))
SetWindowTheme(hWnd, isDarkmode ? L"DarkMode_Explorer" : L"Explorer", NULL);
else
SetWindowTheme(hWnd, isDarkmode ? L"DarkMode_CFD" : L"Explorer", NULL);
}
return TRUE;
}
/*
* DarkMod Dialog Subclass Proc
*/
static LRESULT CALLBACK DlgSubclassProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR idSubclass, DWORD_PTR dwRefData)
{
HDC dc;
switch (message)
{
case WM_NCPAINT:
{
LRESULT result = DefSubclassProc(hDlg, message, wParam, lParam);
HDC windowDC = GetWindowDC(hDlg);
RECT rcWin, rcClient;
GetWindowRect(hDlg, &rcWin);
GetClientRect(hDlg, &rcClient);
MapWindowPoints(hDlg, NULL, (LPPOINT)&rcWin, 2);
int rcWinWidth = rcWin.right - rcWin.left;
int rcWinHieght = rcWin.bottom - rcWin.top;
int rcrcClientWidth = rcClient.right - rcClient.left;
int rcrcClientHieght = rcClient.bottom - rcClient.top;
int borderWidth = (rcWinWidth - rcrcClientWidth) / 2;
int captionHight = rcWinHieght - rcrcClientHieght - borderWidth;
OffsetRect(&rcWin, -rcWin.left, -rcWin.top);
OffsetRect(&rcClient, -rcWin.left, -rcWin.top);
HRGN copy =CreateRectRgn(0, 0, 0, 0);
HRGN updateRgn = wParam != 1 ? copy : CreateRectRgnIndirect(&rcWin);
HRGN clipRgn = CreateRectRgn(0, 0, 0, 0);
HRGN ncRgn = CreateRectRgn(0, 0, 0, 0);
CombineRgn(copy, copy, (HRGN)wParam, RGN_COPY);
if (wParam == 1)
clipRgn = CreateRectRgnIndirect(&rcClient);
else
GetClipRgn(windowDC, clipRgn);
CombineRgn(ncRgn, updateRgn, clipRgn, RGN_OR);
SelectClipRgn(windowDC, ncRgn);
FillRect(windowDC, &rcWin, CreateSolidBrush(RGB(63, 63, 63)));
HRGN hRgn= CreateRectRgnIndirect(&rcWin);
SelectClipRgn(windowDC, hRgn);
MakeBitmapOpaque(windowDC, 0, 0, rcWinWidth, rcWinHieght);
safe_release_dc(hDlg, windowDC);
return result;
}
case WM_NCCALCSIZE:
{
//TODO: get real caption Size
if (wParam)
{
NCCALCSIZE_PARAMS* ncParma = (NCCALCSIZE_PARAMS*)(lParam);
ncParma->rgrc[0].left += 1;//pr++;
ncParma->rgrc[0].top += 31;
ncParma->rgrc[0].right -= 1;
ncParma->rgrc[0].bottom -= 1;
return 0;
}
else
{
RECT* rect = (RECT*)lParam;
rect->top += 31;
rect->left += 1;
rect->right -= 1;
rect->bottom -= 1;
return 0;
}
}
case WM_SHOWWINDOW:
{
if (wParam)
{
EnumChildWindows(hDlg, ThemeCallback, lParam);
BOOL allowncpaint = TRUE;
COLORREF caption = RGB(0x0,0x0,0x0);
DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int));
RECT rcDlg;
GetWindowRect(hDlg, &rcDlg);
SetWindowPos(hDlg, 0, 0, 0, rcDlg.right-rcDlg.left, rcDlg.bottom-rcDlg.top, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
if (hLog)
{
RECT rcLog;
GetWindowRect(hLog, &rcLog);
GetClientRect(hDlg, &rcDlg);
rcLog.left = rcDlg.left + 1;
rcLog.right = rcDlg.right - 1;
SetWindowPos(hLog, NULL, 0, 0, rcLog.right - rcLog.left, rcLog.bottom - rcLog.top, SWP_NOMOVE | SWP_NOZORDER);
}
RedrawWindow(hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME | RDW_ERASENOW);
}
return DefSubclassProc(hDlg, message, wParam, lParam);
}
case WM_CTLCOLORLISTBOX:
SetBkColor((HDC)wParam, RGB(25, 25, 25));
SetTextColor((HDC)wParam, RGB(255, 255, 255));
return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25));
case WM_CTLCOLOREDIT:
{
HDC hdc = (HDC)wParam;
SetBkColor((HDC)wParam, RGB(25, 25, 25));
HBRUSH sysbrash = GetSysColorBrush(COLOR_WINDOWFRAME);
SetTextColor(hdc, RGB(255, 255, 255));
return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25));
}
case WM_CTLCOLORBTN:
case WM_CTLCOLORDLG:
return (INT_PTR)CreateSolidBrush(ColorControlDark);
case WM_CTLCOLORSTATIC:
dc = GetDC((HWND)lParam);
safe_release_dc((HWND)lParam, dc);
if ((HWND)lParam == GetDlgItem(hDlg, IDC_LABEL))
{
SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOWFRAME));
return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25));
}
if ((HWND)lParam != GetDlgItem(hDlg, IDS_CSM_HELP_TXT))
{
SetBkMode((HDC)wParam, TRANSPARENT);
SetTextColor((HDC)wParam, TOOLBAR_ICON_COLOR);
//MakeBitmapOpaque((HDC)wParam, 0, 0, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top);
return (INT_PTR)CreateSolidBrush(ColorControlDark);
}
SetBkMode((HDC)wParam, TRANSPARENT);
SetTextColor((HDC)wParam, TOOLBAR_ICON_COLOR);
return (INT_PTR)CreateSolidBrush(ColorControlDark);
case WM_SETTINGCHANGE:
{
if (IsAppsUseDarkMode())
{
BOOL allowncpaint = TRUE;
COLORREF caption = RGB(0x0,0x0,0x0);
DWM_WINDOW_CORNER_PREFERENCE f = DWMWCP_DONOTROUND;
DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_WINDOW_CORNER_PREFERENCE, &f, sizeof(f));
DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int));
if (hLog)
{
RECT rcLog, rcDlg;
GetWindowRect(hLog, &rcLog);
GetClientRect(hDlg, &rcDlg);
rcLog.left = rcDlg.left + 1;
rcLog.right = rcDlg.right - 1;
SetWindowPos(hLog, NULL, 0, 0, rcLog.right - rcLog.left, rcLog.bottom - rcLog.top, SWP_NOMOVE | SWP_NOZORDER);
}
}
return DefSubclassProc(hDlg, message, wParam, lParam);
}
default:
return DefSubclassProc(hDlg, message, wParam, lParam);
break;
}
}
// Callback for the log window // Callback for the log window
BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
BOOL resized_already = FALSE;
REQRESIZE* rsz;
HDC hDC; HDC hDC;
HFONT hf; HFONT hf;
LONG lfHeight; LONG lfHeight;
@ -948,10 +1238,14 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
apply_localization(IDD_LOG, hDlg); apply_localization(IDD_LOG, hDlg);
hLog = GetDlgItem(hDlg, IDC_LOG_EDIT);
hLog = GetDlgItem(hDlg, IDC_LOG_EDIT);
// Increase the size of our log textbox to MAX_LOG_SIZE (unsigned word) // Increase the size of our log textbox to MAX_LOG_SIZE (unsigned word)
PostMessage(hLog, EM_LIMITTEXT, MAX_LOG_SIZE , 0); PostMessage(hLog, EM_LIMITTEXT, MAX_LOG_SIZE , 0);
if (IsAppsUseDarkMode())
{
SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0);
}
// Set the font to Unicode so that we can display anything // Set the font to Unicode so that we can display anything
hDC = GetDC(NULL); hDC = GetDC(NULL);
lfHeight = -MulDiv(9, GetDeviceCaps(hDC, LOGPIXELSY), 72); lfHeight = -MulDiv(9, GetDeviceCaps(hDC, LOGPIXELSY), 72);
@ -973,6 +1267,7 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
style &= ~(ES_RIGHT); style &= ~(ES_RIGHT);
SetWindowLongPtr(hLog, GWL_STYLE, style); SetWindowLongPtr(hLog, GWL_STYLE, style);
break; break;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
case IDCANCEL: case IDCANCEL:
@ -1018,7 +1313,34 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
ResizeButtonHeight(hDlg, IDC_LOG_SAVE); ResizeButtonHeight(hDlg, IDC_LOG_SAVE);
ResizeButtonHeight(hDlg, IDC_LOG_CLEAR); ResizeButtonHeight(hDlg, IDC_LOG_CLEAR);
return TRUE; return TRUE;
case WM_SETTINGCHANGE:
if (!IsAppsUseDarkMode())
{
BOOL allowncpaint = FALSE;
COLORREF caption = DWMWA_COLOR_DEFAULT;
DWM_WINDOW_CORNER_PREFERENCE f = DWMWCP_DONOTROUND;
DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int));
DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_WINDOW_CORNER_PREFERENCE, &f, sizeof(f));
if (hLog)
{
RECT rcLog, rcDlg;
GetWindowRect(hLog, &rcLog);
GetClientRect(hDlg, &rcDlg);
rcLog.left = rcDlg.left + 1;
rcLog.right = rcDlg.right - 1;
SetWindowPos(hLog, NULL, 0, 0, rcLog.right - rcLog.left, rcLog.bottom - rcLog.top, SWP_NOMOVE | SWP_NOZORDER);
} }
RemoveWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass);
}
else
SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0);
EnumChildWindows(hDlg, ThemeCallback, lParam);
return TRUE;
}
return FALSE; return FALSE;
} }
@ -1232,6 +1554,7 @@ out:
return ret; return ret;
} }
// The scanning process can be blocking for message processing => use a thread // The scanning process can be blocking for message processing => use a thread
DWORD WINAPI ImageScanThread(LPVOID param) DWORD WINAPI ImageScanThread(LPVOID param)
{ {
@ -2149,6 +2472,8 @@ static void PrintStatusTimeout(const char* str, BOOL val)
/* /*
* Main dialog callback * Main dialog callback
*/ */
static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
static DWORD DeviceNum = 0; static DWORD DeviceNum = 0;
@ -2704,6 +3029,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f;
safe_release_dc(hDlg, hDC); safe_release_dc(hDlg, hDC);
apply_localization(IDD_DIALOG, hDlg); apply_localization(IDD_DIALOG, hDlg);
if (IsAppsUseDarkMode())
SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0);
// The AppStore version always enables Fido // The AppStore version always enables Fido
if (appstore_version) if (appstore_version)
SetFidoCheck(); SetFidoCheck();
@ -2713,6 +3040,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
log_displayed = FALSE; log_displayed = FALSE;
hLogDialog = MyCreateDialog(hMainInstance, IDD_LOG, hDlg, (DLGPROC)LogCallback); hLogDialog = MyCreateDialog(hMainInstance, IDD_LOG, hDlg, (DLGPROC)LogCallback);
InitDialog(hDlg); InitDialog(hDlg);
GetDevices(0); GetDevices(0);
EnableControls(TRUE, FALSE); EnableControls(TRUE, FALSE);
UpdateImage(FALSE); UpdateImage(FALSE);
@ -2736,6 +3064,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
// Set 'START' as the selected button if it's enabled, otherwise use 'SELECT', instead // Set 'START' as the selected button if it's enabled, otherwise use 'SELECT', instead
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)(IsWindowEnabled(hStart) ? hStart : hSelectImage), TRUE); SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)(IsWindowEnabled(hStart) ? hStart : hSelectImage), TRUE);
#if defined(ALPHA) #if defined(ALPHA)
// Add a VERY ANNOYING popup for Alpha releases, so that people don't start redistributing them // Add a VERY ANNOYING popup for Alpha releases, so that people don't start redistributing them
MessageBoxA(NULL, "This is an Alpha version of " APPLICATION_NAME " - It is meant to be used for " MessageBoxA(NULL, "This is an Alpha version of " APPLICATION_NAME " - It is meant to be used for "
@ -2746,9 +3075,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
"testing ONLY and should NOT be distributed as a release.", "TEST VERSION", MSG_INFO); "testing ONLY and should NOT be distributed as a release.", "TEST VERSION", MSG_INFO);
#endif #endif
// Let's not take any risk: Ask Windows to redraw the whole dialog before we exit init // Let's not take any risk: Ask Windows to redraw the whole dialog before we exit init
RedrawWindow(hMainDialog, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW); RedrawWindow(hMainDialog, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
InvalidateRect(hMainDialog, NULL, TRUE); InvalidateRect(hMainDialog, NULL, TRUE);
return (INT_PTR)FALSE; return (INT_PTR)FALSE;
case WM_DRAWITEM: case WM_DRAWITEM:
@ -2773,22 +3104,34 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
} }
} }
break;
break;
case WM_SETTINGCHANGE:
if (!IsAppsUseDarkMode())
{
BOOL allowncpaint = FALSE;
COLORREF caption = DWMWA_COLOR_DEFAULT;
DWM_WINDOW_CORNER_PREFERENCE f = DWMWCP_ROUND;
DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_WINDOW_CORNER_PREFERENCE, &f, sizeof(f));
DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int));
RemoveWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass);
}
else
{
SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0);
}
EnumChildWindows(hDlg, ThemeCallback, lParam);
RedrawWindow(hMainDialog, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASENOW);
return DefWindowProc(hDlg, message, wParam, lParam);
case WM_PAINT: case WM_PAINT:
hDC = BeginPaint(hDlg, &ps); hDC = BeginPaint(hDlg, &ps);
OnPaint(hDC); OnPaint(hDC);
EndPaint(hDlg, &ps); EndPaint(hDlg, &ps);
break; break;
case WM_CTLCOLORSTATIC:
if ((HWND)lParam != GetDlgItem(hDlg, IDS_CSM_HELP_TXT))
return FALSE;
SetBkMode((HDC)wParam, TRANSPARENT);
CreateStaticFont((HDC)wParam, &hyperlink_font, FALSE);
SelectObject((HDC)wParam, hyperlink_font);
SetTextColor((HDC)wParam, TOOLBAR_ICON_COLOR);
return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
case WM_NOTIFY: case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) { switch (((LPNMHDR)lParam)->code) {

View file

@ -43,6 +43,8 @@
#include "registry.h" #include "registry.h"
#include "settings.h" #include "settings.h"
#include "license.h" #include "license.h"
#include <Uxtheme.h>
#include <dwmapi.h>
/* Globals */ /* Globals */
extern BOOL is_x86_64, appstore_version; extern BOOL is_x86_64, appstore_version;
@ -60,6 +62,7 @@ static const char* notification_dont_display_setting;
static WNDPROC update_original_proc = NULL; static WNDPROC update_original_proc = NULL;
static HWINEVENTHOOK ap_weh = NULL; static HWINEVENTHOOK ap_weh = NULL;
static char title_str[2][128], button_str[128]; static char title_str[2][128], button_str[128];
static UINT_PTR uIdSubclass = 1;
HWND hFidoDlg = NULL; HWND hFidoDlg = NULL;
static int update_settings_reposition_ids[] = { static int update_settings_reposition_ids[] = {
@ -75,6 +78,8 @@ static int update_settings_reposition_ids[] = {
IDCANCEL, IDCANCEL,
}; };
/* /*
* https://blogs.msdn.microsoft.com/oldnewthing/20040802-00/?p=38283/ * https://blogs.msdn.microsoft.com/oldnewthing/20040802-00/?p=38283/
*/ */
@ -83,6 +88,246 @@ void SetDialogFocus(HWND hDlg, HWND hCtrl)
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)hCtrl, TRUE); SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)hCtrl, TRUE);
} }
/*
* DarkMode CheckBox Subclass Proc
*/
static LRESULT CALLBACK ButtonSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR idSubclass, DWORD_PTR dwRefData)
{
if (!IsAppsUseDarkMode())
{
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
switch (uMsg)
{
case WM_PAINT:
{
DefSubclassProc(hWnd, uMsg, wParam, lParam);
if (!IsWindowEnabled(hWnd))
{
return TRUE;
}
HDC hDc = GetDC(hWnd);
RECT rc1;
GetClientRect(hWnd, &rc1);
SetBkMode(hDc, TRANSPARENT);
SetTextColor(hDc, RGB(255, 255, 255));
HTHEME btnTheme = OpenThemeData(hWnd, L"Button");
SIZE siz;
GetThemePartSize(btnTheme, hDc, 3, 1, NULL, TS_DRAW, &siz);
rc1.left += siz.cx + 2;
FillRect(hDc, &rc1, CreateSolidBrush(ColorControlDark));
rc1.top += GetSystemMetrics(SM_CXPADDEDBORDER);
WCHAR szCaption[60];
GetWindowText(hWnd, szCaption, ARRAYSIZE(szCaption));
DTTOPTS opts;
opts.dwSize = sizeof(DTTOPTS);
opts.dwFlags = DTT_TEXTCOLOR;
opts.crText = RGB(255, 255, 255);
HFONT font = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
SelectObject(hDc, font);
DrawThemeTextEx(btnTheme, hDc, 3, 0, szCaption, -1, DT_SINGLELINE | DT_LEFT, &rc1, &opts);
ReleaseDC(hWnd, hDc);
return TRUE;
}
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
/*
* Set DarkMode to all Child Windows
*/
static BOOL CALLBACK ThemeCallback(HWND hWnd, LPARAM lParam)
{
WCHAR str[30] = { 0 };
GetClassName(hWnd, str, ARRAYSIZE(str));
BOOL isDarkMode = IsAppsUseDarkMode();
if (_wcsicmp(str, L"Button") == 0)
{
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
if ((style & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX)
{
if (!isDarkMode)
{
RemoveWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass);
return TRUE;
}
else
SetWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass, 0);
}
else
SetWindowTheme(hWnd, isDarkMode ? L"DarkMode_Explorer" : L"Explorer", NULL);
}
else if (_wcsicmp(str, L"ComboBox") == 0)
{
SetWindowTheme(hWnd, isDarkMode ? L"DarkMode_CFD" : L"Explorer", NULL);
}
else if (_wcsicmp(str, L"ToolBar") == 0)
{
WCHAR title[30] = {0};
GetWindowText(hWnd, title, ARRAYSIZE(title));
if (_wcsicmp(title, L"Multiple buttons") != 0)
SetWindowTheme(hWnd, isDarkMode ? L"DarkMode" : L"Explorer", NULL);
}
else if (_wcsicmp(str, L"EDIT") == 0)
{
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
if(((style & WS_VSCROLL) == WS_VSCROLL) || ((style & WS_HSCROLL) == WS_HSCROLL))
SetWindowTheme(hWnd, isDarkMode ? L"DarkMode_Explorer" : L"Explorer", NULL);
else
SetWindowTheme(hWnd, isDarkMode ? L"DarkMode_CFD" : L"Explorer", NULL);
}
else if (_wcsicmp(str, L"RichEdit20W") == 0)
{
SendMessage(hWnd, EM_SETBKGNDCOLOR, 0, isDarkMode ? (LPARAM)ColorControlDark : (LPARAM)GetSysColor(COLOR_BTNFACE));
CHARFORMAT cf;
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_COLOR;
cf.crTextColor = isDarkMode ? RGB(255, 255, 255): RGB(0, 0, 0);
cf.dwEffects = 0;
SendMessage(hWnd, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf);
//SetWindowTheme(hEdit[i], L"DarkMode_Explorer", NULL);
SetWindowTheme(hWnd, NULL, isDarkMode ? L"DarkMode_Explorer::ScrollBar" : L"Explorer::ScrollBar");
}
return TRUE;
}
/*
* DarkMod Dialog Subclass Proc
*/
static LRESULT CALLBACK DlgSubclassProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR idSubclass, DWORD_PTR dwRefData)
{
if (!IsAppsUseDarkMode())
{
return DefSubclassProc(hDlg, message, wParam, lParam);
}
switch (message)
{
case WM_NCPAINT:
{
LRESULT result = DefSubclassProc(hDlg, message, wParam, lParam);
HDC windowDC = GetWindowDC(hDlg);
RECT rcWin, rcClient;
GetWindowRect(hDlg, &rcWin);
GetClientRect(hDlg, &rcClient);
MapWindowPoints(hDlg, NULL, (LPPOINT)&rcWin, 2);
int rcWinWidth = rcWin.right - rcWin.left;
int rcWinHieght = rcWin.bottom - rcWin.top;
int rcrcClientWidth = rcClient.right - rcClient.left;
int rcrcClientHieght = rcClient.bottom - rcClient.top;
int borderWidth = (rcWinWidth - rcrcClientWidth) / 2;
int captionHight = rcWinHieght - rcrcClientHieght - borderWidth;
OffsetRect(&rcWin, -rcWin.left, -rcWin.top);
OffsetRect(&rcClient, -rcWin.left, -rcWin.top);
HRGN copy = CreateRectRgn(0, 0, 0, 0);
HRGN updateRgn = wParam != 1 ? copy : CreateRectRgnIndirect(&rcWin);
HRGN clipRgn = CreateRectRgn(0, 0, 0, 0);
HRGN ncRgn = CreateRectRgn(0, 0, 0, 0);
CombineRgn(copy, copy, (HRGN)wParam, RGN_COPY);
if (wParam == 1)
clipRgn = CreateRectRgnIndirect(&rcClient);
else
GetClipRgn(windowDC, clipRgn);
CombineRgn(ncRgn, updateRgn, clipRgn, RGN_OR);
SelectClipRgn(windowDC, ncRgn);
FillRect(windowDC, &rcWin, CreateSolidBrush(RGB(63, 63, 63)));
HRGN hRgn = CreateRectRgnIndirect(&rcWin);
SelectClipRgn(windowDC, hRgn);
MakeBitmapOpaque(windowDC, 0, 0, rcWinWidth, rcWinHieght);
safe_release_dc(hDlg, windowDC);
return result;
}
case WM_NCCALCSIZE:
{
//TODO: get real caption Size
if (wParam)
{
NCCALCSIZE_PARAMS* ncParma = (NCCALCSIZE_PARAMS*)(lParam);
ncParma->rgrc[0].left += 1;//pr++;
ncParma->rgrc[0].top += 31;
ncParma->rgrc[0].right -= 1;
ncParma->rgrc[0].bottom -= 1;
return 0;
}
else
{
RECT* rect = (RECT*)lParam;
rect->top += 31;
rect->left += 1;
rect->right -= 1;
rect->bottom -= 1;
return 0;
}
}
case WM_SHOWWINDOW:
{
if (wParam)
{
EnumChildWindows(hDlg, ThemeCallback, lParam);
BOOL allowncpaint = TRUE;
COLORREF caption = RGB(0x0, 0x0, 0x0);
DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption);
DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int));
RECT rcDlg;
GetWindowRect(hDlg, &rcDlg);
SetWindowPos(hDlg, 0, 0, 0, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE);
if (hLog)
{
RECT rcLog;
GetWindowRect(hLog, &rcLog);
GetClientRect(hDlg, &rcDlg);
rcLog.left = rcDlg.left + 1;
rcLog.right = rcDlg.right - 1;
SetWindowPos(hLog, NULL, 0, 0, rcLog.right - rcLog.left, rcLog.bottom - rcLog.top, SWP_NOMOVE | SWP_NOZORDER);
}
RedrawWindow(hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME | RDW_ERASENOW);
}
return DefSubclassProc(hDlg, message, wParam, lParam);
}
case WM_CTLCOLORLISTBOX:
SetBkColor((HDC)wParam, RGB(25, 25, 25));
SetTextColor((HDC)wParam, RGB(255, 255, 255));
return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25));
case WM_CTLCOLOREDIT:
{
HDC hdc = (HDC)wParam;
SetBkColor((HDC)wParam, RGB(25, 25, 25));
SetTextColor(hdc, RGB(255, 255, 255));
return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25));
}
case WM_CTLCOLORBTN:
case WM_CTLCOLORDLG:
return (INT_PTR)CreateSolidBrush(ColorControlDark);
case WM_CTLCOLORSTATIC:
SetBkMode((HDC)wParam, TRANSPARENT);
SetTextColor((HDC)wParam, TOOLBAR_ICON_COLOR);
return (INT_PTR)CreateSolidBrush(ColorControlDark);
default:
return DefSubclassProc(hDlg, message, wParam, lParam);
break;
}
}
/* /*
* Return the UTF8 path of a file selected through a load or save dialog * Return the UTF8 path of a file selected through a load or save dialog
* All string parameters are UTF-8 * All string parameters are UTF-8
@ -216,7 +461,6 @@ out:
void CreateStatusBar(void) void CreateStatusBar(void)
{ {
RECT rect; RECT rect;
int edge[2];
HFONT hFont; HFONT hFont;
// Create the status bar // Create the status bar
@ -226,10 +470,10 @@ void CreateStatusBar(void)
// Create 2 status areas // Create 2 status areas
GetClientRect(hMainDialog, &rect); GetClientRect(hMainDialog, &rect);
edge[0] = rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale); int edge[] = { rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale) , rect.right,-1};
edge[1] = rect.right;
SendMessage(hStatus, SB_SETPARTS, (WPARAM)ARRAYSIZE(edge), (LPARAM)&edge);
SendMessage(hStatus, SB_SETPARTS, (WPARAM)ARRAYSIZE(edge), (LPARAM)&edge);
//SendMessage(hStatus, WM_SIZE, 0, 0);
// Set the font // Set the font
hFont = CreateFontA(-MulDiv(9, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72), hFont = CreateFontA(-MulDiv(9, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72),
0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
@ -337,6 +581,7 @@ INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
style &= ~(ES_RIGHT); style &= ~(ES_RIGHT);
SetWindowLongPtr(hLicense, GWL_STYLE, style); SetWindowLongPtr(hLicense, GWL_STYLE, style);
SetDlgItemTextA(hDlg, IDC_LICENSE_TEXT, gplv3); SetDlgItemTextA(hDlg, IDC_LICENSE_TEXT, gplv3);
SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0);
break; break;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
@ -403,6 +648,7 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
// Need to send an explicit SetSel to avoid being positioned at the end of richedit control when tabstop is used // Need to send an explicit SetSel to avoid being positioned at the end of richedit control when tabstop is used
SendMessage(hEdit[1], EM_SETSEL, 0, 0); SendMessage(hEdit[1], EM_SETSEL, 0, 0);
SendMessage(hEdit[0], EM_REQUESTRESIZE, 0, 0); SendMessage(hEdit[0], EM_REQUESTRESIZE, 0, 0);
SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0);
break; break;
case WM_NOTIFY: case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) { switch (((LPNMHDR)lParam)->code) {
@ -555,6 +801,7 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDYES), 0, dh -cbh, 0, 0, 1.0f); ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDYES), 0, dh -cbh, 0, 0, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDNO), 0, dh -cbh, 0, 0, 1.0f); ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDNO), 0, dh -cbh, 0, 0, 1.0f);
} }
SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0);
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
// Change the background colour for static text and icon // Change the background colour for static text and icon
@ -988,6 +1235,9 @@ INT_PTR CALLBACK TooltipCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
return (INT_PTR)FALSE; return (INT_PTR)FALSE;
switch (message) { switch (message) {
case WM_NCPAINT:
SendMessageW(ttlist[i].hTip, TTM_SETWINDOWTHEME, 0, IsAppsUseDarkMode() ? ((LPARAM)&L"DarkMode_Explorer") : ((LPARAM)&L"Explorer"));
return CallWindowProc(ttlist[i].original_proc, hDlg, message, wParam, lParam);
case WM_NOTIFY: case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) { switch (((LPNMHDR)lParam)->code) {
case TTN_GETDISPINFOW: case TTN_GETDISPINFOW:
@ -1318,6 +1568,7 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
SendMessage(hPolicy, EM_SETEVENTMASK, 0, ENM_LINK|ENM_REQUESTRESIZE); SendMessage(hPolicy, EM_SETEVENTMASK, 0, ENM_LINK|ENM_REQUESTRESIZE);
SendMessageA(hPolicy, EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE)); SendMessageA(hPolicy, EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE));
SendMessage(hPolicy, EM_REQUESTRESIZE, 0, 0); SendMessage(hPolicy, EM_REQUESTRESIZE, 0, 0);
SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0);
break; break;
case WM_NOTIFY: case WM_NOTIFY:
if ((((LPNMHDR)lParam)->code == EN_REQUESTRESIZE) && (!resized_already)) { if ((((LPNMHDR)lParam)->code == EN_REQUESTRESIZE) && (!resized_already)) {
@ -1568,6 +1819,9 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
if ((HWND)lParam != GetDlgItem(hDlg, IDC_WEBSITE)) if ((HWND)lParam != GetDlgItem(hDlg, IDC_WEBSITE))
return FALSE; return FALSE;
HDC hdcCtrl = GET_WM_CTLCOLOR_HDC(wParam, lParam, message);
HWND hWndCtrl = GET_WM_CTLCOLOR_HWND(wParam, lParam, message);
WORD cc = GET_WM_CTLCOLOR_TYPE(wParam, lParam, message);
// Change the font for the hyperlink // Change the font for the hyperlink
SetBkMode((HDC)wParam, TRANSPARENT); SetBkMode((HDC)wParam, TRANSPARENT);
CreateStaticFont((HDC)wParam, &hyperlink_font, TRUE); CreateStaticFont((HDC)wParam, &hyperlink_font, TRUE);

View file

@ -38,10 +38,10 @@
#include "resource.h" #include "resource.h"
#include "msapi_utf8.h" #include "msapi_utf8.h"
#include "localization.h" #include "localization.h"
#include "WinUser.h"
#include "ui.h" #include "ui.h"
#include "ui_data.h" #include "ui_data.h"
#include "registry.h"
UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU; UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
HIMAGELIST hUpImageList, hDownImageList; HIMAGELIST hUpImageList, hDownImageList;
extern BOOL use_vds, appstore_version; extern BOOL use_vds, appstore_version;
@ -350,6 +350,13 @@ void PositionMainControls(HWND hDlg)
GetWindowRect(hCtrl, &rc); GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
advanced_device_section_height = rc.top; advanced_device_section_height = rc.top;
LONG_PTR style = GetWindowLongPtrW(hCtrl, GWL_STYLE);
/*if ((style & SS_OWNERDRAW) != SS_OWNERDRAW)
{
style |= SS_OWNERDRAW;
style |= ~BS_AUTOCHECKBOX;
SetWindowLongPtrW(hCtrl, GWL_STYLE, style);
}*/
hCtrl = GetDlgItem(hDlg, IDC_UEFI_MEDIA_VALIDATION); hCtrl = GetDlgItem(hDlg, IDC_UEFI_MEDIA_VALIDATION);
GetWindowRect(hCtrl, &rc); GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
@ -893,14 +900,20 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam
wchar_t winfo[128]; wchar_t winfo[128];
static BOOL marquee_mode = FALSE; static BOOL marquee_mode = FALSE;
static uint32_t pos = 0, min = 0, max = 0xFFFF; static uint32_t pos = 0, min = 0, max = 0xFFFF;
static COLORREF color = PROGRESS_BAR_NORMAL_COLOR; BOOL isDark = IsAppsUseDarkMode();
COLORREF normalColor = isDark ? PROGRESS_BAR_DARK_NORMAL_COLOR : PROGRESS_BAR_NORMAL_COLOR;
COLORREF backgroundColor = isDark ? PROGRESS_BAR_DARK_BACKGROUND_COLOR : PROGRESS_BAR_BACKGROUND_COLOR;
COLORREF normalTextColor = isDark ? PROGRESS_BAR_DARK_NORMAL_TEXT_COLOR : PROGRESS_BAR_NORMAL_TEXT_COLOR;
COLORREF invertedlTextColor = isDark ? PROGRESS_BAR_DARK_INVERTED_TEXT_COLOR : PROGRESS_BAR_INVERTED_TEXT_COLOR;
COLORREF boxColor = isDark ? PROGRESS_BAR_DARK_BOX_COLOR : PROGRESS_BAR_BOX_COLOR;
COLORREF color = normalColor;
switch (message) { switch (message) {
case PBM_SETSTATE: case PBM_SETSTATE:
switch (wParam) { switch (wParam) {
case PBST_NORMAL: case PBST_NORMAL:
color = PROGRESS_BAR_NORMAL_COLOR; color = normalColor;
break; break;
case PBST_PAUSED: case PBST_PAUSED:
color = PROGRESS_BAR_PAUSED_COLOR; color = PROGRESS_BAR_PAUSED_COLOR;
@ -930,7 +943,7 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam
if ((wParam == TRUE) && (!marquee_mode)) { if ((wParam == TRUE) && (!marquee_mode)) {
marquee_mode = TRUE; marquee_mode = TRUE;
pos = min; pos = min;
color = PROGRESS_BAR_NORMAL_COLOR; color = normalColor;
SetTimer(hCtrl, TID_MARQUEE_TIMER, MARQUEE_TIMER_REFRESH, NULL); SetTimer(hCtrl, TID_MARQUEE_TIMER, MARQUEE_TIMER_REFRESH, NULL);
InvalidateRect(hProgress, NULL, TRUE); InvalidateRect(hProgress, NULL, TRUE);
} else if ((wParam == FALSE) && (marquee_mode)) { } else if ((wParam == FALSE) && (marquee_mode)) {
@ -971,7 +984,7 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam
// Optional first segment // Optional first segment
if (pos + ((max - min) / 5) > max) { if (pos + ((max - min) / 5) > max) {
rc.right = MulDiv(pos + ((max - min) / 5) - max, rc.right, max - min); rc.right = MulDiv(pos + ((max - min) / 5) - max, rc.right, max - min);
SetTextColor(hDC, PROGRESS_BAR_INVERTED_TEXT_COLOR); SetTextColor(hDC, invertedlTextColor);
SetBkColor(hDC, color); SetBkColor(hDC, color);
ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2,
ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL);
@ -981,8 +994,8 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam
// Optional second segment // Optional second segment
if (pos > min) { if (pos > min) {
rc.right = MulDiv(pos - min, rc.right, max - min); rc.right = MulDiv(pos - min, rc.right, max - min);
SetTextColor(hDC, PROGRESS_BAR_NORMAL_TEXT_COLOR); SetTextColor(hDC, normalTextColor);
SetBkColor(hDC, PROGRESS_BAR_BACKGROUND_COLOR); SetBkColor(hDC, backgroundColor);
ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2,
ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL);
rc.left = rc.right; rc.left = rc.right;
@ -990,14 +1003,14 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam
} }
// Second to last segment // Second to last segment
rc.right = MulDiv(pos - min + ((max - min) / 5), rc.right, max - min); rc.right = MulDiv(pos - min + ((max - min) / 5), rc.right, max - min);
SetTextColor(hDC, PROGRESS_BAR_INVERTED_TEXT_COLOR); SetTextColor(hDC, invertedlTextColor);
SetBkColor(hDC, color); SetBkColor(hDC, color);
ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2,
ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL);
} else { } else {
// First segment // First segment
rc.right = (pos > min) ? MulDiv(pos - min, rc.right, max - min) : rc.left; rc.right = (pos > min) ? MulDiv(pos - min, rc.right, max - min) : rc.left;
SetTextColor(hDC, PROGRESS_BAR_INVERTED_TEXT_COLOR); SetTextColor(hDC, invertedlTextColor);
SetBkColor(hDC, color); SetBkColor(hDC, color);
ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2,
ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL);
@ -1005,12 +1018,12 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam
// Last segment // Last segment
rc.left = rc.right; rc.left = rc.right;
rc.right = full_right; rc.right = full_right;
SetTextColor(hDC, PROGRESS_BAR_NORMAL_TEXT_COLOR); SetTextColor(hDC, normalTextColor);
SetBkColor(hDC, PROGRESS_BAR_BACKGROUND_COLOR); SetBkColor(hDC, backgroundColor);
ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2,
ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL);
// Bounding rectangle // Bounding rectangle
SetDCPenColor(hDC, PROGRESS_BAR_BOX_COLOR); SetDCPenColor(hDC, boxColor);
Rectangle(hDC, rc2.left, rc2.top, rc2.right, rc2.bottom); Rectangle(hDC, rc2.left, rc2.top, rc2.right, rc2.bottom);
EndPaint(hCtrl, &ps); EndPaint(hCtrl, &ps);
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
@ -1060,8 +1073,16 @@ void CreateAdditionalControls(HWND hDlg)
hIconDown = (HICON)LoadImage(hDll, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); hIconDown = (HICON)LoadImage(hDll, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED);
hUpImageList = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_HIGHQUALITYSCALE, 1, 0); hUpImageList = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_HIGHQUALITYSCALE, 1, 0);
hDownImageList = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_HIGHQUALITYSCALE, 1, 0); hDownImageList = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_HIGHQUALITYSCALE, 1, 0);
if (!IsAppsUseDarkMode())
{
ImageList_AddIcon(hUpImageList, hIconUp); ImageList_AddIcon(hUpImageList, hIconUp);
ImageList_AddIcon(hDownImageList, hIconDown); ImageList_AddIcon(hDownImageList, hIconDown);
}
else
{
ImageList_AddMasked(hUpImageList, LoadBitmap(0, MAKEINTRESOURCE(32753)), CLR_DEFAULT);
ImageList_AddMasked(hDownImageList, LoadBitmap(0, MAKEINTRESOURCE(32752)), CLR_DEFAULT);
}
// Create the advanced options toolbars // Create the advanced options toolbars
memset(wtbtext, 0, sizeof(wtbtext)); memset(wtbtext, 0, sizeof(wtbtext));
@ -1585,10 +1606,12 @@ void SetBootTypeDropdownWidth(void)
void OnPaint(HDC hdc) void OnPaint(HDC hdc)
{ {
int i; int i;
HPEN hp = CreatePen(0, (fScale < 1.5f) ? 2 : 3, RGB(0, 0, 0));
HPEN hp = CreatePen(0, (fScale < 1.5f) ? 2 : 3, IsAppsUseDarkMode() ? RGB(255,255,255) : RGB(0, 0, 0));
SelectObject(hdc, hp); SelectObject(hdc, hp);
for (i = 0; i < ARRAYSIZE(section_vpos); i++) { for (i = 0; i < ARRAYSIZE(section_vpos); i++) {
MoveToEx(hdc, mw + 10, section_vpos[i], NULL); MoveToEx(hdc, mw + 10, section_vpos[i], NULL);
LineTo(hdc, mw + fw, section_vpos[i]); LineTo(hdc, mw + fw, section_vpos[i]);
} }
} }

View file

@ -21,7 +21,8 @@
#include <stdint.h> #include <stdint.h>
#include "resource.h" #include "resource.h"
#include "localization.h" #include "localization.h"
//#include<vsstyle.h>
//#include <vssym32.h>
#pragma once #pragma once
// Progress bar colors // Progress bar colors
@ -33,8 +34,17 @@
#define PROGRESS_BAR_PAUSED_COLOR RGB(0xDA, 0xCB, 0x26) #define PROGRESS_BAR_PAUSED_COLOR RGB(0xDA, 0xCB, 0x26)
#define PROGRESS_BAR_ERROR_COLOR RGB(0xDA, 0x26, 0x26) #define PROGRESS_BAR_ERROR_COLOR RGB(0xDA, 0x26, 0x26)
#define PROGRESS_BAR_DARK_NORMAL_TEXT_COLOR RGB(0xFF, 0xFF, 0xFF)
#define PROGRESS_BAR_DARK_INVERTED_TEXT_COLOR RGB(0x00, 0x00, 0x00)
#define PROGRESS_BAR_DARK_BACKGROUND_COLOR RGB(0x3F, 0x3F, 0x3F)
#define PROGRESS_BAR_DARK_BOX_COLOR RGB(192, 192,192)
#define PROGRESS_BAR_DARK_NORMAL_COLOR RGB(40,100,180)
#define PROGRESS_BAR_DARK_PAUSED_COLOR RGB(0xDA, 0xCB, 0x26)
#define PROGRESS_BAR_DARK_ERROR_COLOR RGB(0xDA, 0x26, 0x26)
#define ColorControlDark RGB(32, 32, 32)
// Toolbar icons main color // Toolbar icons main color
#define TOOLBAR_ICON_COLOR RGB(0x29, 0x80, 0xB9) #define TOOLBAR_ICON_COLOR RGB(255, 255, 255) //(0x29, 0x80, 0xB9)
// Toolbar default style // Toolbar default style
#define TOOLBAR_STYLE ( WS_CHILD | WS_TABSTOP | WS_VISIBLE | \ #define TOOLBAR_STYLE ( WS_CHILD | WS_TABSTOP | WS_VISIBLE | \
@ -106,3 +116,4 @@ extern void ShowLanguageMenu(RECT rcExclude);
extern void SetPassesTooltip(void); extern void SetPassesTooltip(void);
extern void SetBootTypeDropdownWidth(void); extern void SetBootTypeDropdownWidth(void);
extern void OnPaint(HDC hdc); extern void OnPaint(HDC hdc);
extern void MakeBitmapOpaque(HDC hdc, int x, int y, int cx, int cy);

View file

@ -20,6 +20,10 @@
#include <windows.h> #include <windows.h>
#include "resource.h" #include "resource.h"
// disable all warnings about unused variable
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#pragma once #pragma once
// GUIDs needed to set a control's accessibility props // GUIDs needed to set a control's accessibility props