Workaround for Windows XP common controls initialization error.

This commit is contained in:
LoRd_MuldeR 2020-09-30 21:23:06 +02:00
parent 93b10803bd
commit bc39e3f93a
5 changed files with 46 additions and 41 deletions

View File

@ -35,6 +35,7 @@ else
endif endif
CFLAGS += -municode -mwindows -march=$(MARCH) -mtune=$(MTUNE) CFLAGS += -municode -mwindows -march=$(MARCH) -mtune=$(MTUNE)
LDFLAGS = -lcomctl32
.PHONY: all init resources build strip clean .PHONY: all init resources build strip clean
@ -49,47 +50,47 @@ init:
mkdir -p obj mkdir -p obj
resources: init resources: init
echo $(OS)
windres -o obj/common.$(CPU_ARCH).o res/common.rc windres -o obj/common.$(CPU_ARCH).o res/common.rc
windres -o obj/splash_screen.$(CPU_ARCH).o res/splash_screen.rc windres -o obj/splash_screen.$(CPU_ARCH).o res/splash_screen.rc
windres -o obj/registry.$(CPU_ARCH).o res/registry.rc windres -o obj/registry.$(CPU_ARCH).o res/registry.rc
build: init resources build: init resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH).$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH).exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_nosplash.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_nowait.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_nowait_nosplash.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_registry.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_registry.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_registry_nosplash.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_registry_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_registry_nowait.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_registry_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_wrapped.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_wrapped.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nosplash.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash.$(SUFFIX) src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
strip: build strip: build
strip bin/launch5j_$(CPU_ARCH).$(SUFFIX) strip bin/launch5j_$(CPU_ARCH).exe
strip bin/launch5j_$(CPU_ARCH)_nosplash.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_nosplash.exe
strip bin/launch5j_$(CPU_ARCH)_nowait.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_nowait.exe
strip bin/launch5j_$(CPU_ARCH)_nowait_nosplash.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_nowait_nosplash.exe
strip bin/launch5j_$(CPU_ARCH)_registry.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_registry.exe
strip bin/launch5j_$(CPU_ARCH)_registry_nosplash.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_registry_nosplash.exe
strip bin/launch5j_$(CPU_ARCH)_registry_nowait.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_registry_nowait.exe
strip bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash.exe
strip bin/launch5j_$(CPU_ARCH)_wrapped.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_wrapped.exe
strip bin/launch5j_$(CPU_ARCH)_wrapped_nosplash.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_wrapped_nosplash.exe
strip bin/launch5j_$(CPU_ARCH)_wrapped_nowait.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_wrapped_nowait.exe
strip bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash.exe
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_wrapped_registry.exe
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash.exe
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait.exe
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash.$(SUFFIX) strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash.exe
clean: init clean: init
$(RM) bin/*.$(SUFFIX) $(RM) bin/*.$(SUFFIX)
$(RM) obj/*.o $(RM) obj/*.o

View File

@ -35,6 +35,7 @@ else
endif endif
CFLAGS += -municode -mwindows -march=$(MARCH) -mtune=$(MTUNE) CFLAGS += -municode -mwindows -march=$(MARCH) -mtune=$(MTUNE)
LDFLAGS = -lcomctl32
.PHONY: all init resources build strip clean .PHONY: all init resources build strip clean
@ -49,7 +50,6 @@ init:
mkdir -p obj mkdir -p obj
resources: init resources: init
echo $(OS)
windres -o obj/common.$(CPU_ARCH).o res/common.rc windres -o obj/common.$(CPU_ARCH).o res/common.rc
windres -o obj/splash_screen.$(CPU_ARCH).o res/splash_screen.rc windres -o obj/splash_screen.$(CPU_ARCH).o res/splash_screen.rc
windres -o obj/registry.$(CPU_ARCH).o res/registry.rc windres -o obj/registry.$(CPU_ARCH).o res/registry.rc

View File

@ -110,6 +110,8 @@ public class MakefileGenerator {
append(cmdLine, ' ', "obj/registry.$(CPU_ARCH).o"); append(cmdLine, ' ', "obj/registry.$(CPU_ARCH).o");
} }
append(cmdLine, ' ', "$(LDFLAGS)");
filenNames.add(fileName); filenNames.add(fileName);
return cmdLine.toString(); return cmdLine.toString();
} }

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="MuldeRsoft.Launch5j.ExeHead" type="win32"/>
<description>Launch5j</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security> <security>
<requestedPrivileges> <requestedPrivileges>

View File

@ -24,6 +24,7 @@
// Win32 API // Win32 API
#include <Windows.h> #include <Windows.h>
#include <shellapi.h> #include <shellapi.h>
#include <commctrl.h>
// Resources // Resources
#include "resource.h" #include "resource.h"
@ -323,7 +324,7 @@ static wchar_t *load_string(const HINSTANCE hinstance, const UINT id)
const int str_len = LoadStringW(hinstance, id, (PWCHAR)&buffer, 0); const int str_len = LoadStringW(hinstance, id, (PWCHAR)&buffer, 0);
if(str_len > 0) if(str_len > 0)
{ {
if (buffer = (wchar_t*) malloc(sizeof(wchar_t) * (str_len + 1U))) if ((buffer = (wchar_t*) malloc(sizeof(wchar_t) * (str_len + 1U))))
{ {
if(LoadStringW(hinstance, id, buffer, str_len + 1U) > 0) if(LoadStringW(hinstance, id, buffer, str_len + 1U) > 0)
{ {
@ -800,12 +801,12 @@ static const wchar_t *detect_java_runtime(const DWORD required_bitness, const UL
const wchar_t *java_runtime_path; const wchar_t *java_runtime_path;
if (running_on_64bit()) if (running_on_64bit())
{ {
if (java_runtime_path = detect_java_runtime_loop(TRUE, required_bitness, required_ver_min, required_ver_max)) if ((java_runtime_path = detect_java_runtime_loop(TRUE, required_bitness, required_ver_min, required_ver_max)))
{ {
return java_runtime_path; return java_runtime_path;
} }
} }
if (java_runtime_path = detect_java_runtime_loop(FALSE, required_bitness, required_ver_min, required_ver_max)) if ((java_runtime_path = detect_java_runtime_loop(FALSE, required_bitness, required_ver_min, required_ver_max)))
{ {
return java_runtime_path; return java_runtime_path;
} }
@ -1116,6 +1117,9 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
PROCESS_INFORMATION process_info; PROCESS_INFORMATION process_info;
STARTUPINFOW startup_info; STARTUPINFOW startup_info;
// Ensure that the ComCtl32 DLL is loaded
InitCommonControls();
// Initialize // Initialize
SecureZeroMemory(&startup_info, sizeof(STARTUPINFOW)); SecureZeroMemory(&startup_info, sizeof(STARTUPINFOW));
SecureZeroMemory(&process_info, sizeof(PROCESS_INFORMATION)); SecureZeroMemory(&process_info, sizeof(PROCESS_INFORMATION));
@ -1145,7 +1149,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
// Show the splash screen // Show the splash screen
#if L5J_ENABLE_SPLASH #if L5J_ENABLE_SPLASH
if (splash_image = LoadImage(hInstance, MAKEINTRESOURCE(ID_BITMAP_SPLASH), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE)) if ((splash_image = LoadImage(hInstance, MAKEINTRESOURCE(ID_BITMAP_SPLASH), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE)))
{ {
if (create_splash_screen(hwnd, splash_image)) if (create_splash_screen(hwnd, splash_image))
{ {