Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
996 B

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. IgnoreCRTExit.cpp
  5. Abstract:
  6. Prevent CRT shutdown routines from running. At some point MSVCRT didn't
  7. actually call these, so some apps fault when they really do get called.
  8. Notes:
  9. This is a general purpose shim.
  10. History:
  11. 05/09/2002 linstev Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(IgnoreCRTExit)
  15. #include "ShimHookMacro.h"
  16. typedef LPVOID (__cdecl *_pfn_atexit)(LPVOID);
  17. typedef LPVOID (__cdecl *_pfn__onexit)(LPVOID);
  18. APIHOOK_ENUM_BEGIN
  19. APIHOOK_ENUM_ENTRY(atexit)
  20. APIHOOK_ENUM_ENTRY(_onexit)
  21. APIHOOK_ENUM_END
  22. VOID
  23. __cdecl
  24. APIHOOK(atexit)(LPVOID lpFunc)
  25. {
  26. return;
  27. }
  28. LPVOID
  29. __cdecl
  30. APIHOOK(_onexit)(LPVOID lpFunc)
  31. {
  32. return lpFunc;
  33. }
  34. /*++
  35. Register hooked functions
  36. --*/
  37. HOOK_BEGIN
  38. APIHOOK_ENTRY(MSVCRT.DLL, atexit)
  39. APIHOOK_ENTRY(MSVCRT.DLL, _onexit)
  40. HOOK_END
  41. IMPLEMENT_SHIM_END