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.

87 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. EncartaEncyclopediaDeluxe2K.cpp
  5. Abstract:
  6. This shim fixes a problem with Encarta Encyclopedia Deluxe 2000.
  7. Notes:
  8. This is an app specific shim.
  9. History:
  10. 01/04/2001 a-brienw Created
  11. --*/
  12. #include "precomp.h"
  13. IMPLEMENT_SHIM_BEGIN(EncartaEncyclopediaDeluxe2K)
  14. #include "ShimHookMacro.h"
  15. APIHOOK_ENUM_BEGIN
  16. APIHOOK_ENUM_ENTRY(WinExec)
  17. APIHOOK_ENUM_END
  18. /*++
  19. Hook WinExec to see if Encarta is calling for MSINFO32.
  20. If so then direct it to the version that comes with the OS.
  21. --*/
  22. UINT
  23. APIHOOK(WinExec)(
  24. LPSTR lpCmdLine, // command line
  25. UINT uCmdShow // window style
  26. )
  27. {
  28. CSTRING_TRY
  29. {
  30. CString csCmdLine(lpCmdLine);
  31. int nMsinfoIndex = csCmdLine.Find(L"MSINFO32.EXE");
  32. if (nMsinfoIndex)
  33. {
  34. CString csCmdLine;
  35. SHGetSpecialFolderPathW(csCmdLine, CSIDL_PROGRAM_FILES_COMMON);
  36. csCmdLine += L"\\Microsoft Shared\\MSInfo\\msinfo32.exe";
  37. // Test for existance of the corrected path of msinfo32.exe
  38. HANDLE hFile = CreateFileW(csCmdLine, GENERIC_READ, FILE_SHARE_READ,
  39. NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
  40. if( hFile != INVALID_HANDLE_VALUE )
  41. {
  42. CloseHandle( hFile );
  43. return ORIGINAL_API(WinExec)(csCmdLine.GetAnsi(), uCmdShow);
  44. }
  45. }
  46. }
  47. CSTRING_CATCH
  48. {
  49. // Do nothing
  50. }
  51. return ORIGINAL_API(WinExec)(lpCmdLine, uCmdShow);
  52. }
  53. /*++
  54. Register hooked functions
  55. --*/
  56. HOOK_BEGIN
  57. APIHOOK_ENTRY(KERNEL32.DLL, WinExec)
  58. HOOK_END
  59. IMPLEMENT_SHIM_END