Source code of Windows XP (NT5)
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.

74 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. WordPerfect8.cpp
  5. Abstract:
  6. If the SafeArray* to the SafeArrayAccessData is an invalid one
  7. this function returns a NULL pointer for the data. Corel WordPerfect8
  8. was AV'ing because of this.
  9. This is an app specific shim.
  10. History:
  11. 02/07/2001 prashkud Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(WordPerfect8)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(SafeArrayAccessData)
  18. APIHOOK_ENUM_END
  19. /*++
  20. This hooks SafeArrayAccessData and returns
  21. an error code if *ppvData is NULL.
  22. --*/
  23. HRESULT
  24. APIHOOK(SafeArrayAccessData)(
  25. SAFEARRAY *psa,
  26. void HUGEP **ppvData
  27. )
  28. {
  29. HRESULT hRes = S_OK;
  30. hRes = ORIGINAL_API(SafeArrayAccessData)(
  31. psa,
  32. ppvData
  33. );
  34. if (*ppvData == NULL)
  35. {
  36. DPFN( eDbgLevelError, "Getting a NULL pointer for the\
  37. SafeArray Data - ppvData = %lx & *ppvData =%lx",ppvData,*ppvData);
  38. DPFN( eDbgLevelError, "SAFEARRAY is psa = %lx,\
  39. psa.cbElements= %l",psa,psa->cbElements);
  40. hRes = E_UNEXPECTED;
  41. }
  42. return hRes;
  43. }
  44. /*++
  45. Register hooked functions
  46. --*/
  47. HOOK_BEGIN
  48. APIHOOK_ENTRY(OLEAUT32.DLL, SafeArrayAccessData)
  49. HOOK_END
  50. IMPLEMENT_SHIM_END