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.

75 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. ForceAppendMenuSuccess.cpp
  5. Abstract:
  6. Apps call AppendMenu passing the handle of the system menu.
  7. This is prohibited in Windows 2000 and the API will fail. The present
  8. shim will return success to all AppenMenu calls since there is no
  9. easy way to tell if an HMENU is the handle of the real system menu.
  10. Notes:
  11. This is a general shim.
  12. History:
  13. 02/16/2000 clupu Created
  14. --*/
  15. #include "precomp.h"
  16. IMPLEMENT_SHIM_BEGIN(ForceAppendMenuSuccess)
  17. #include "ShimHookMacro.h"
  18. APIHOOK_ENUM_BEGIN
  19. APIHOOK_ENUM_ENTRY(AppendMenuA)
  20. APIHOOK_ENUM_END
  21. /*++
  22. Return TRUE to AppendMenuA no matter what.
  23. --*/
  24. BOOL
  25. APIHOOK(AppendMenuA)(
  26. HMENU hMenu,
  27. UINT uFlags,
  28. UINT_PTR uIDNewItem,
  29. LPSTR lpNewItem
  30. )
  31. {
  32. BOOL bReturn = ORIGINAL_API(AppendMenuA)(
  33. hMenu,
  34. uFlags,
  35. uIDNewItem,
  36. lpNewItem);
  37. if (!bReturn) {
  38. LOGN(
  39. eDbgLevelInfo,
  40. "ForceAppendMenuSuccess.dll, AppendMenuA returns TRUE instead of FALSE.");
  41. }
  42. return TRUE;
  43. }
  44. /*++
  45. Register hooked functions
  46. --*/
  47. HOOK_BEGIN
  48. APIHOOK_ENTRY(USER32.DLL, AppendMenuA)
  49. HOOK_END
  50. IMPLEMENT_SHIM_END