2023-03-07 23:13:08 -07:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
int WINAPI wWinMain(HINSTANCE hi, HINSTANCE hpi, PWSTR cmd, int ns)
|
|
|
|
{
|
2023-03-31 20:05:19 -06:00
|
|
|
STARTUPINFOW si;
|
2023-03-07 23:13:08 -07:00
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
|
|
|
|
ZeroMemory(&si, sizeof(si));
|
|
|
|
si.cb = sizeof(si);
|
|
|
|
ZeroMemory(&pi, sizeof(pi));
|
|
|
|
|
2023-03-31 20:05:19 -06:00
|
|
|
WCHAR steamPath[1024];
|
|
|
|
DWORD datasize = 1024;
|
|
|
|
|
|
|
|
LONG retCode = RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Valve\\Steam", L"SteamExe", RRF_RT_REG_SZ, NULL, &steamPath, &datasize);
|
|
|
|
|
|
|
|
if (retCode != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
MessageBoxW(NULL, L"Could not find Steam client executable", NULL, 0);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
WCHAR commandLine[1024] = L"steam.exe -applaunch 975370";
|
|
|
|
|
|
|
|
if (CreateProcessW(steamPath,
|
|
|
|
commandLine,
|
2023-03-07 23:13:08 -07:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&si,
|
|
|
|
&pi) == 0)
|
|
|
|
{
|
2023-03-31 20:05:19 -06:00
|
|
|
MessageBoxW(NULL, L"could not launch Dwarf Fortress", NULL, 0);
|
2023-03-07 23:13:08 -07:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|