diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 1db78c24e..48ebdb986 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -377,9 +377,9 @@ if(WIN32) set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" ) else() 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 - PUBLIC -Wno-deprecated-declarations -Wno-restrict) + INTERFACE -Wno-deprecated-declarations -Wno-restrict) set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "-include Export.h" ) add_library(dfhooks SHARED Hooks.cpp) target_link_libraries(dfhooks dfhack) diff --git a/library/modules/DFSteam.cpp b/library/modules/DFSteam.cpp index 103e2dfee..9aab53466 100644 --- a/library/modules/DFSteam.cpp +++ b/library/modules/DFSteam.cpp @@ -108,7 +108,7 @@ static bool is_running_on_wine() { return !!pwine_get_version; } -static DWORD findProcess(const LPWSTR name) { +static DWORD findProcess(LPCWSTR name) { PROCESSENTRY32W entry; entry.dwSize = sizeof(PROCESSENTRY32W); @@ -150,11 +150,14 @@ static bool launchDFHack(color_ostream& out) { si.cb = sizeof(si); 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, // and the Steam API in the launchdf process will think it is in DF's context. - BOOL res = CreateProcessW(L"hack/launchdf.exe", - NULL, NULL, NULL, FALSE, 0, "\0", NULL, &si, &pi); + BOOL res = CreateProcessW(procname, + NULL, NULL, NULL, FALSE, 0, (LPVOID)env, NULL, &si, &pi); return !!res; }