From 0243b40a1d4c3a67ac6d5e4c921d73a2d0a59c0b Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 25 Jan 2007 22:24:26 +0000 Subject: [PATCH] according to MSDN, passing NULL as hModule to GetModuleFileName will get the path for the executable of the process so there's no need for g_hInstance git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4904 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/Main.c | 2 +- Source/exehead/fileform.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/exehead/Main.c b/Source/exehead/Main.c index 237eff6a..96a7588e 100644 --- a/Source/exehead/Main.c +++ b/Source/exehead/Main.c @@ -216,7 +216,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, if (m_Err) // not done yet { // get current name - int l=GetModuleFileName(g_hInstance,ibuf,sizeof(ibuf)); + int l=GetModuleFileName(NULL,ibuf,sizeof(ibuf)); // check if it is ?Au_.exe - if so, fuck it if (!lstrcmpi(ibuf+l-(sizeof(s)-2),s+1)) break; diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index b1501fd3..d4d2cf23 100644 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -130,7 +130,7 @@ const char * NSISCALL loadHeaders(int cl_flags) HANDLE db_hFile; - GetModuleFileName(g_hInstance, state_exe_directory, NSIS_MAX_STRLEN); + GetModuleFileName(NULL, state_exe_directory, NSIS_MAX_STRLEN); g_db_hFile = db_hFile = myOpenFile(state_exe_directory, GENERIC_READ, OPEN_EXISTING); if (db_hFile == INVALID_HANDLE_VALUE)