2 * When this file is linked to a DLL, it sets up a delay-load hook that
3 * intervenes when the DLL is trying to load 'node.exe' or 'iojs.exe'
4 * dynamically. Instead of trying to locate the .exe file it'll just return
5 * a handle to the process image.
7 * This allows compiled addons to work when node.exe or iojs.exe is renamed.
12 #ifndef WIN32_LEAN_AND_MEAN
13 #define WIN32_LEAN_AND_MEAN
21 static FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo* info) {
23 if (event != dliNotePreLoadLibrary)
26 if (_stricmp(info->szDll, "iojs.exe") != 0 &&
27 _stricmp(info->szDll, "node.exe") != 0)
30 m = GetModuleHandle(NULL);
34 decltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook;