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.

80 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. CrystalWebPageServer.cpp
  5. Abstract:
  6. The app calls GetEnhMetaFileHeader passing
  7. nSize of 1000. We need to change it to 100 to make the app not crash.
  8. If we don't do it this will cause memory corruption. Win9x seems to
  9. be fine with it. Maybe it will crash the app less often in Win9x than
  10. it does in Win2k.
  11. Notes:
  12. This is an app specific shim.
  13. History:
  14. 02/16/2000 clupu Created
  15. --*/
  16. #include "precomp.h"
  17. IMPLEMENT_SHIM_BEGIN(CrystalWebPageServer)
  18. #include "ShimHookMacro.h"
  19. APIHOOK_ENUM_BEGIN
  20. APIHOOK_ENUM_ENTRY(GetEnhMetaFileHeader)
  21. APIHOOK_ENUM_END
  22. /*++
  23. The app calls GetEnhMetaFileHeader passing
  24. nSize of 1000. We need to change it to 100 to make the app work
  25. --*/
  26. UINT
  27. APIHOOK(GetEnhMetaFileHeader)(
  28. HENHMETAFILE hemf,
  29. UINT nSize,
  30. LPENHMETAHEADER lpEnhMetaHeader
  31. )
  32. {
  33. if (nSize == 1000) {
  34. nSize = 100;
  35. DPFN(
  36. eDbgLevelInfo,
  37. "CrystalWebPageServer.dll, GetEnhMetaFileHeader: changed the size to 100.\n");
  38. }
  39. //
  40. // Call the original API
  41. //
  42. return ORIGINAL_API(GetEnhMetaFileHeader)(
  43. hemf,
  44. nSize,
  45. lpEnhMetaHeader);
  46. }
  47. /*++
  48. Register hooked functions
  49. --*/
  50. HOOK_BEGIN
  51. APIHOOK_ENTRY(GDI32.DLL, GetEnhMetaFileHeader)
  52. HOOK_END
  53. IMPLEMENT_SHIM_END