From 0c20eac9b081cd9c1c81dfbc3e48e069f859edc1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 5 Nov 2017 17:42:58 +0300 Subject: AssocMsg: fix for launching it via rundll32 --- plugins/AssocMgr/src/main.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'plugins/AssocMgr/src/main.cpp') diff --git a/plugins/AssocMgr/src/main.cpp b/plugins/AssocMgr/src/main.cpp index ddc2075d52..10bd63eaf9 100644 --- a/plugins/AssocMgr/src/main.cpp +++ b/plugins/AssocMgr/src/main.cpp @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +#pragma comment(lib, "delayimp.lib") + HINSTANCE hInst; static HANDLE hHookModulesLoaded; int hLangpack; @@ -39,6 +41,25 @@ PLUGININFOEX pluginInfo = { {0x52685cd7, 0xec7, 0x44c1, {0xa1, 0xa6, 0x38, 0x16, 0x12, 0x41, 0x82, 0x2}} }; +///////////////////////////////////////////////////////////////////////////////////////// +// if we run here, we're running from the command prompt + +static bool bPathSet = false; + +FARPROC WINAPI myDliHook(unsigned dliNotify, PDelayLoadInfo) +{ + if (dliNotify == dliNotePreLoadLibrary && !bPathSet) { + bPathSet = true; + SetCurrentDirectoryW(L"Libs"); + LoadLibraryW(L"ucrtbase.dll"); + } + return NULL; +} + +PfnDliHook __pfnDliNotifyHook2 = &myDliHook; + +///////////////////////////////////////////////////////////////////////////////////////// + BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInst = hinstDLL; -- cgit v1.2.3