| 156 | } |
| 157 | |
| 158 | static bool launchDFHack(color_ostream& out) { |
| 159 | if (is_running_on_wine()) { |
| 160 | DEBUG(dfsteam, out).print("not attempting to re-launch DFHack on wine\n"); |
| 161 | return false; |
| 162 | } |
| 163 | |
| 164 | if (findProcess(L"launchdf.exe") != -1) { |
| 165 | DEBUG(dfsteam, out).print("launchdf.exe already running\n"); |
| 166 | return true; |
| 167 | } |
| 168 | |
| 169 | STARTUPINFOW si; |
| 170 | PROCESS_INFORMATION pi; |
| 171 | |
| 172 | ZeroMemory(&si, sizeof(si)); |
| 173 | si.cb = sizeof(si); |
| 174 | ZeroMemory(&pi, sizeof(pi)); |
| 175 | |
| 176 | auto procpath = Core::getInstance().getHackPath() / "launchdf.exe"; |
| 177 | static const char * env = "\0"; |
| 178 | |
| 179 | // note that the environment must be explicitly zeroed out and not NULL, |
| 180 | // otherwise the launched process will inherit this process's environment, |
| 181 | // and the Steam API in the launchdf process will think it is in DF's context. |
| 182 | BOOL res = CreateProcessW(procpath.wstring().c_str(), |
| 183 | NULL, NULL, NULL, FALSE, 0, (LPVOID)env, NULL, &si, &pi); |
| 184 | |
| 185 | return !!res; |
| 186 | } |
| 187 | |
| 188 | #else |
| 189 |
no test coverage detected