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.

90 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. Outlook97.cpp
  5. Abstract:
  6. Investigation by zekel.
  7. Outlook 97 has an untested code-path:
  8. where iIndex == -173 and hInstDll == hinstShell32
  9. ...
  10. else if (iIndex < 0)
  11. {
  12. pThis->m_nEnumWant = 0;
  13. pThis->EnumIconFunc(hInstDll, MAKEINTRESOURCE(-iIndex), &iepStuff);
  14. }
  15. which will always fault, i.e. since iIndex used to be positive, this always
  16. worked.
  17. Notes:
  18. This is an app specific shim.
  19. History:
  20. 06/15/2001 linstev Created
  21. --*/
  22. #include "precomp.h"
  23. #include "LegalStr.h"
  24. IMPLEMENT_SHIM_BEGIN(Outlook97)
  25. #include "ShimHookMacro.h"
  26. APIHOOK_ENUM_BEGIN
  27. APIHOOK_ENUM_ENTRY(SHGetFileInfoA)
  28. APIHOOK_ENUM_END
  29. /*++
  30. Fix faulting case.
  31. --*/
  32. DWORD_PTR
  33. APIHOOK(SHGetFileInfoA)(
  34. LPCSTR pszPath,
  35. DWORD dwFileAttributes,
  36. SHFILEINFOA *psfi,
  37. UINT cbFileInfo,
  38. UINT uFlags
  39. )
  40. {
  41. DWORD_PTR dwRet = ORIGINAL_API(SHGetFileInfoA)(pszPath, dwFileAttributes,
  42. psfi, cbFileInfo, uFlags);
  43. if (dwRet && ((uFlags & (SHGFI_ICONLOCATION | SHGFI_PIDL)) == (SHGFI_ICONLOCATION | SHGFI_PIDL))) {
  44. //
  45. // Check to see if this is shell32, IDI_FAVORITES
  46. // Outlook faults if we return a negative index here
  47. //
  48. if (psfi->iIcon == -173 && stristr(psfi->szDisplayName, "shell32")) {
  49. LOGN(eDbgLevelError, "Negative icon id detected - fixing");
  50. psfi->iIcon = 0;
  51. psfi->szDisplayName[0] = 0;
  52. }
  53. }
  54. return dwRet;
  55. }
  56. /*++
  57. Register hooked functions
  58. --*/
  59. HOOK_BEGIN
  60. APIHOOK_ENTRY(SHELL32.DLL, SHGetFileInfoA)
  61. HOOK_END
  62. IMPLEMENT_SHIM_END