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.

79 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. AutoDeskWorld2.cpp
  5. Abstract:
  6. Set LPMODULEENTRY32->GlblcntUsage to 1 if the call to Module32First was
  7. successful.
  8. No idea why this works on NT4 on Win9x.
  9. Notes:
  10. This is an app specific shim.
  11. History:
  12. 02/16/2000 clupu Created
  13. --*/
  14. #include "precomp.h"
  15. #include <tlhelp32.h>
  16. IMPLEMENT_SHIM_BEGIN(AutoDeskWorld2)
  17. #include "ShimHookMacro.h"
  18. // Undefine this here!! Otherwise, in a unicode build
  19. // environment, Module32First is #defined as Module32FirstW.
  20. #ifdef Module32First
  21. #undef Module32First
  22. #endif
  23. APIHOOK_ENUM_BEGIN
  24. APIHOOK_ENUM_ENTRY(Module32First)
  25. APIHOOK_ENUM_END
  26. /*++
  27. Set LPMODULEENTRY32->GlblcntUsage to 1 if the call to Module32First was
  28. successful.
  29. --*/
  30. BOOL
  31. APIHOOK(Module32First)(
  32. HANDLE SnapSection,
  33. LPMODULEENTRY32 lpme
  34. )
  35. {
  36. BOOL bRet;
  37. bRet = ORIGINAL_API(Module32First)(SnapSection, lpme);
  38. if (bRet) {
  39. DPFN( eDbgLevelInfo, "setting lpme->GlblcntUsage to 1");
  40. lpme->GlblcntUsage = 1;
  41. }
  42. return bRet;
  43. }
  44. /*++
  45. Register hooked functions
  46. --*/
  47. HOOK_BEGIN
  48. APIHOOK_ENTRY(KERNEL32.DLL, Module32First)
  49. HOOK_END
  50. IMPLEMENT_SHIM_END