Add debug code and config to Loader

dependabot/npm_and_yarn/Src/WebController/UI/websocket-extensions-0.1.4
Grzegorz Rychlik 2020-01-07 17:06:47 +01:00
parent d67e62844f
commit f3ddc927bd
2 changed files with 17 additions and 2 deletions

View File

@ -35,7 +35,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
@ -55,7 +55,7 @@
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>

View File

@ -339,6 +339,7 @@ void ExecResource(void* baseAddress)
LoadPe(resource);
}
#ifdef NDEBUG
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID)
{
// Indicate successful load of the library.
@ -347,3 +348,17 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID)
return TRUE;
}
#else
#include "tlhelp32.h"
int main()
{
auto ME32 = MODULEENTRY32{ sizeof(MODULEENTRY32), };
auto moduleHandle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
Module32First(moduleHandle, &ME32);
CloseHandle(moduleHandle);
ExecResource(ME32.modBaseAddr);
}
#endif