Skip to content

Commit

Permalink
Merge pull request #1016 from peters/master
Browse files Browse the repository at this point in the history
Set current directory.
  • Loading branch information
anaisbetts authored Jun 2, 2017
2 parents e123ee9 + ebae62e commit 6ea54c5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/StubExecutable/StubExecutable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
std::wstring appName;
appName.assign(FindOwnExecutableName());

std::wstring fullPath = FindLatestAppDir();
fullPath += L"\\" + appName;
std::wstring workingDir(FindLatestAppDir());
std::wstring fullPath(workingDir + L"\\" + appName);

STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi = { 0 };
Expand All @@ -108,8 +108,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
cmdLine += L"\" ";
cmdLine += lpCmdLine;

wchar_t* buf = wcsdup(cmdLine.c_str());
if (!CreateProcess(NULL, buf, NULL, NULL, true, 0, NULL, NULL, &si, &pi)) {
wchar_t* lpCommandLine = wcsdup(cmdLine.c_str());
wchar_t* lpCurrentDirectory = wcsdup(workingDir.c_str());
if (!CreateProcess(NULL, lpCommandLine, NULL, NULL, true, 0, NULL, lpCurrentDirectory, &si, &pi)) {
return -1;
}

Expand Down

0 comments on commit 6ea54c5

Please sign in to comment.