|
|
@ -2,15 +2,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
int WINAPI wWinMain(HINSTANCE hi, HINSTANCE hpi, PWSTR cmd, int ns)
|
|
|
|
int WINAPI wWinMain(HINSTANCE hi, HINSTANCE hpi, PWSTR cmd, int ns)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
STARTUPINFOA si;
|
|
|
|
STARTUPINFOW si;
|
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
|
|
|
|
|
|
|
|
ZeroMemory(&si, sizeof(si));
|
|
|
|
ZeroMemory(&si, sizeof(si));
|
|
|
|
si.cb = sizeof(si);
|
|
|
|
si.cb = sizeof(si);
|
|
|
|
ZeroMemory(&pi, sizeof(pi));
|
|
|
|
ZeroMemory(&pi, sizeof(pi));
|
|
|
|
|
|
|
|
|
|
|
|
if (CreateProcessA("Dwarf Fortress.exe",
|
|
|
|
WCHAR steamPath[1024];
|
|
|
|
NULL,
|
|
|
|
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,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
FALSE,
|
|
|
@ -20,7 +33,7 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE hpi, PWSTR cmd, int ns)
|
|
|
|
&si,
|
|
|
|
&si,
|
|
|
|
&pi) == 0)
|
|
|
|
&pi) == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MessageBoxA(NULL, "could not launch 'Dwarf Fortress.exe'", NULL, 0);
|
|
|
|
MessageBoxW(NULL, L"could not launch Dwarf Fortress", NULL, 0);
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|