src,win: improve unmanaged handling

Used scoped disabling of managed code handling to ensure no other
files get affected.

PR-URL: https://github.com/nodejs/node-gyp/pull/1852
Reviewed-By: João Reis <reis@janeasystems.com>
This commit is contained in:
Peter Sabath 2019-08-08 14:37:34 +02:00 committed by João Reis
parent c7f1bcaff5
commit af876e10f0

View file

@ -7,10 +7,10 @@
* This allows compiled addons to work when the host executable is renamed. * This allows compiled addons to work when the host executable is renamed.
*/ */
#pragma unmanaged
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma managed(push, off)
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
@ -34,4 +34,6 @@ static FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo* info) {
decltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook; decltype(__pfnDliNotifyHook2) __pfnDliNotifyHook2 = load_exe_hook;
#pragma managed(pop)
#endif #endif