|
///////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2005 Werner Willemsens
//
///////////////////////////////////////////////////////////////////////
// We can not use DllMain() because this is already used by the Proxy/Stub generated code
// DllMain is normally called by _DllMainCRTStartup(), the default DLL entry point
// See also "C:\WINCE500\PRIVATE\WINCEOS\COREOS\CORE\CORELIBC\CRTW32\STARTUP\pegdmain.c"
// Therefore we replace the default entry point by our own version
// Make sure you specify this in the project file (/ENTRY:)
#include <windows.h>
#include "channelhook.h"
extern "C" BOOL WINAPI _DllMainCRTStartup(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved);
BOOL WINAPI _NewDllMainCRTStartup(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
{
BOOL bRet;
if (dwReason == DLL_PROCESS_ATTACH)
{
// Call original DLL entry point first
bRet = _DllMainCRTStartup(hDllHandle, dwReason, lpreserved);
// And then install immediately Rich Error Hook
StartChannelHook();
}
if (dwReason == DLL_PROCESS_DETACH)
{
// Remove Rich Error Hook
StopChannelHook();
// Call original DLL (entry)exit point
bRet = _DllMainCRTStartup(hDllHandle, dwReason, lpreserved);
}
return bRet;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.