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.

99 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. ForceShellLinkResolveNoUI.cpp
  5. Abstract:
  6. This shim prevents any sort of UI on the IShellLink::Resolve
  7. API by NULLing out the passed in HWND if SLR_NO_UI is specified
  8. in fFlags.
  9. Notes:
  10. This is a general purpose shim.
  11. History:
  12. 04/05/2000 markder Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(ForceShellLinkResolveNoUI)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_ENTRY_COMSERVER(SHELL32)
  19. APIHOOK_ENUM_END
  20. IMPLEMENT_COMSERVER_HOOK(SHELL32)
  21. /*++
  22. This stub function prevents any sort of UI on the IShellLink::Resolve API by
  23. NULLing out the passed in HWND if SLR_NO_UI is specified in fFlags.
  24. --*/
  25. HRESULT
  26. COMHOOK(IShellLinkA, Resolve)( PVOID pThis, HWND hwnd, DWORD fFlags )
  27. {
  28. HRESULT hrReturn = E_FAIL;
  29. _pfn_IShellLinkA_Resolve pfnOld;
  30. pfnOld = (_pfn_IShellLinkA_Resolve) ORIGINAL_COM(IShellLinkA, Resolve, pThis);
  31. if( fFlags & SLR_NO_UI )
  32. {
  33. hwnd = NULL;
  34. }
  35. if( pfnOld )
  36. {
  37. hrReturn = (*pfnOld)( pThis, hwnd, fFlags );
  38. }
  39. return hrReturn;
  40. }
  41. HRESULT
  42. COMHOOK(IShellLinkW, Resolve)( PVOID pThis, HWND hwnd, DWORD fFlags )
  43. {
  44. HRESULT hrReturn = E_FAIL;
  45. _pfn_IShellLinkW_Resolve pfnOld;
  46. pfnOld = (_pfn_IShellLinkW_Resolve) ORIGINAL_COM(IShellLinkW, Resolve, pThis);
  47. if( fFlags & SLR_NO_UI )
  48. {
  49. hwnd = NULL;
  50. }
  51. if( pfnOld )
  52. {
  53. hrReturn = (*pfnOld)( pThis, hwnd, fFlags );
  54. }
  55. return hrReturn;
  56. }
  57. /*++
  58. Register hooked functions
  59. --*/
  60. HOOK_BEGIN
  61. APIHOOK_ENTRY_COMSERVER(SHELL32)
  62. COMHOOK_ENTRY(ShellLink, IShellLinkA, Resolve, 19)
  63. COMHOOK_ENTRY(ShellLink, IShellLinkW, Resolve, 19)
  64. HOOK_END
  65. IMPLEMENT_SHIM_END