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.

89 lines
1.8 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. IMPLEMENT_SHIM_BEGIN(Outlook97)
  24. #include "ShimHookMacro.h"
  25. APIHOOK_ENUM_BEGIN
  26. APIHOOK_ENUM_ENTRY(SHGetFileInfoA)
  27. APIHOOK_ENUM_END
  28. /*++
  29. Fix faulting case.
  30. --*/
  31. DWORD_PTR
  32. APIHOOK(SHGetFileInfoA)(
  33. LPCSTR pszPath,
  34. DWORD dwFileAttributes,
  35. SHFILEINFOA *psfi,
  36. UINT cbFileInfo,
  37. UINT uFlags
  38. )
  39. {
  40. DWORD_PTR dwRet = ORIGINAL_API(SHGetFileInfoA)(pszPath, dwFileAttributes,
  41. psfi, cbFileInfo, uFlags);
  42. if (dwRet && ((uFlags & (SHGFI_ICONLOCATION | SHGFI_PIDL)) == (SHGFI_ICONLOCATION | SHGFI_PIDL))) {
  43. //
  44. // Check to see if this is shell32, IDI_FAVORITES
  45. // Outlook faults if we return a negative index here
  46. //
  47. if (psfi->iIcon == -173 && stristr(psfi->szDisplayName, "shell32")) {
  48. LOGN(eDbgLevelError, "Negative icon id detected - fixing");
  49. psfi->iIcon = 0;
  50. psfi->szDisplayName[0] = 0;
  51. }
  52. }
  53. return dwRet;
  54. }
  55. /*++
  56. Register hooked functions
  57. --*/
  58. HOOK_BEGIN
  59. APIHOOK_ENTRY(SHELL32.DLL, SHGetFileInfoA)
  60. HOOK_END
  61. IMPLEMENT_SHIM_END