Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Corrected startup executable
Browse files Browse the repository at this point in the history
Former-commit-id: a7ddb9e
  • Loading branch information
arkpar committed Nov 9, 2016
1 parent 314d075 commit 7ddb54f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions windows/ptray/ptray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ bool GetParityExePath(TCHAR* dest, size_t destSize)
return PathAppend(dest, _T("parity.exe")) == TRUE;
}

bool GetTrayExePath(TCHAR* dest, size_t destSize)
{
if (!dest || MAX_PATH > destSize)
return false;
GetModuleFileName(NULL, dest, (DWORD)destSize);
return true;
}

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
Expand Down Expand Up @@ -311,9 +319,10 @@ void EnableAutostart(bool enable) {
if (lRes != ERROR_SUCCESS)
return;

if (enable) {
if (enable)
{
TCHAR path[MAX_PATH] = { 0 };
if (!GetParityExePath(path, MAX_PATH))
if (!GetTrayExePath(path, MAX_PATH))
return;
RegSetValueEx(hKey, L"Parity", 0, REG_SZ, (LPBYTE)path, MAX_PATH);
}
Expand Down

0 comments on commit 7ddb54f

Please sign in to comment.