emulate path

This commit is contained in:
Akash Mozumdar 2019-01-22 11:23:35 -05:00
parent c0e8a638ba
commit cba353438d
2 changed files with 5 additions and 4 deletions

View File

@ -218,7 +218,8 @@ void MainWindow::LaunchProcess()
std::wstring process = S(QInputDialog::getItem(this, SELECT_PROCESS, "", savedProcesses, 0, true, &ok, Qt::WindowCloseButtonHint)); std::wstring process = S(QInputDialog::getItem(this, SELECT_PROCESS, "", savedProcesses, 0, true, &ok, Qt::WindowCloseButtonHint));
if (!ok) return; if (!ok) return;
if (S(process) == SEARCH_GAME) process = S(QDir::toNativeSeparators(QFileDialog::getOpenFileName(this, SELECT_PROCESS, "C:\\", PROCESSES))); if (S(process) == SEARCH_GAME) process = S(QDir::toNativeSeparators(QFileDialog::getOpenFileName(this, SELECT_PROCESS, "C:\\", PROCESSES)));
if (process.empty()) return; if (process.find(L'\\') == std::wstring::npos) return;
std::wstring path = std::wstring(process).erase(process.rfind(L'\\'));
PROCESS_INFORMATION info = {}; PROCESS_INFORMATION info = {};
if (QMessageBox::question(this, SELECT_PROCESS, USE_JP_LOCALE) == QMessageBox::Yes) if (QMessageBox::question(this, SELECT_PROCESS, USE_JP_LOCALE) == QMessageBox::Yes)
@ -238,12 +239,12 @@ void MainWindow::LaunchProcess()
} LEB; } LEB;
GetTimeZoneInformation(&LEB.Timezone); GetTimeZoneInformation(&LEB.Timezone);
((LONG(__stdcall*)(decltype(&LEB), LPCWSTR appName, LPWSTR commandLine, LPCWSTR currentDir, void*, void*, PROCESS_INFORMATION*, void*, void*, void*, void*)) ((LONG(__stdcall*)(decltype(&LEB), LPCWSTR appName, LPWSTR commandLine, LPCWSTR currentDir, void*, void*, PROCESS_INFORMATION*, void*, void*, void*, void*))
GetProcAddress(localeEmulator, "LeCreateProcess"))(&LEB, process.c_str(), NULL, NULL, NULL, NULL, &info, NULL, NULL, NULL, NULL); GetProcAddress(localeEmulator, "LeCreateProcess"))(&LEB, process.c_str(), NULL, path.c_str(), NULL, NULL, &info, NULL, NULL, NULL, NULL);
} }
if (info.hProcess == NULL) if (info.hProcess == NULL)
{ {
STARTUPINFOW DUMMY = { sizeof(DUMMY) }; STARTUPINFOW DUMMY = { sizeof(DUMMY) };
CreateProcessW(process.c_str(), NULL, nullptr, nullptr, FALSE, 0, nullptr, NULL, &DUMMY, &info); CreateProcessW(process.c_str(), NULL, nullptr, nullptr, FALSE, 0, nullptr, path.c_str(), &DUMMY, &info);
} }
if (info.hProcess == NULL) return Host::AddConsoleOutput(LAUNCH_FAILED); if (info.hProcess == NULL) return Host::AddConsoleOutput(LAUNCH_FAILED);
Host::InjectProcess(info.dwProcessId); Host::InjectProcess(info.dwProcessId);

View File

@ -11912,7 +11912,7 @@ bool InsertSRPGHook()
HookParam hp = {}; HookParam hp = {};
hp.offset = 4; hp.offset = 4;
hp.address = addr; hp.address = addr;
hp.type = USING_STRING | USING_UNICODE | NO_CONTEXT; hp.type = USING_STRING | USING_UNICODE;
NewHook(hp, "SRPG"); NewHook(hp, "SRPG");
return true; return true;
} }