get compiling on windows

develop
Myk Taylor 2023-06-17 22:14:11 -07:00
parent 2efef75b4e
commit 8a079e1ae7
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 9 additions and 6 deletions

@ -377,9 +377,9 @@ if(WIN32)
set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" ) set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" )
else() else()
set_target_properties(dfhack PROPERTIES COMPILE_FLAGS "-include Export.h" ) set_target_properties(dfhack PROPERTIES COMPILE_FLAGS "-include Export.h" )
# required because of protobuf headers # required because of transitively-included protobuf headers
target_compile_options(dfhack target_compile_options(dfhack
PUBLIC -Wno-deprecated-declarations -Wno-restrict) INTERFACE -Wno-deprecated-declarations -Wno-restrict)
set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "-include Export.h" ) set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "-include Export.h" )
add_library(dfhooks SHARED Hooks.cpp) add_library(dfhooks SHARED Hooks.cpp)
target_link_libraries(dfhooks dfhack) target_link_libraries(dfhooks dfhack)

@ -108,7 +108,7 @@ static bool is_running_on_wine() {
return !!pwine_get_version; return !!pwine_get_version;
} }
static DWORD findProcess(const LPWSTR name) { static DWORD findProcess(LPCWSTR name) {
PROCESSENTRY32W entry; PROCESSENTRY32W entry;
entry.dwSize = sizeof(PROCESSENTRY32W); entry.dwSize = sizeof(PROCESSENTRY32W);
@ -150,11 +150,14 @@ static bool launchDFHack(color_ostream& out) {
si.cb = sizeof(si); si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi)); ZeroMemory(&pi, sizeof(pi));
// note that the enviornment must be explicitly zeroed out and not NULL, static LPCWSTR procname = L"hack/launchdf.exe";
static const char * env = "\0";
// note that the environment must be explicitly zeroed out and not NULL,
// otherwise the launched process will inherit this process's environment, // otherwise the launched process will inherit this process's environment,
// and the Steam API in the launchdf process will think it is in DF's context. // and the Steam API in the launchdf process will think it is in DF's context.
BOOL res = CreateProcessW(L"hack/launchdf.exe", BOOL res = CreateProcessW(procname,
NULL, NULL, NULL, FALSE, 0, "\0", NULL, &si, &pi); NULL, NULL, NULL, FALSE, 0, (LPVOID)env, NULL, &si, &pi);
return !!res; return !!res;
} }