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.

83 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. LHVoiceXPressPlus.cpp
  5. Abstract:
  6. App passes a .hlp without path. Winhlp32 can't locate the file because
  7. it's not in any of the locations that winhlp32 looks at. We pass in
  8. the file with full path.
  9. History:
  10. 01/28/2001 maonis Created
  11. --*/
  12. #include "precomp.h"
  13. IMPLEMENT_SHIM_BEGIN(LHVoiceXPressPlus)
  14. #include "ShimHookMacro.h"
  15. APIHOOK_ENUM_BEGIN
  16. APIHOOK_ENUM_ENTRY(WinHelpA)
  17. APIHOOK_ENUM_END
  18. BOOL
  19. APIHOOK(WinHelpA)(
  20. HWND hWndMain,
  21. LPCSTR lpszHelp,
  22. UINT uCommand,
  23. DWORD dwData
  24. )
  25. {
  26. CSTRING_TRY
  27. {
  28. CString csHelp(lpszHelp);
  29. if (csHelp.CompareNoCase(L"Correction.hlp") == 0)
  30. {
  31. // The way we get the directory for the app is we look into the
  32. // registry and get the location of the inproc server ksysint.dll.
  33. // Coolpad.exe always loads this dll - if you don't have this dll
  34. // registered, you can't run the app anyway.
  35. HKEY hkey;
  36. DWORD type;
  37. DWORD cbPath = MAX_PATH;
  38. CString csRegValue;
  39. WCHAR * lpszNewHelpFile = csRegValue.GetBuffer(cbPath);
  40. const WCHAR szInprocServer[] = L"CLSID\\{B9C12481-D072-11D0-9E80-0060976FD1F8}\\InprocServer32";
  41. if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szInprocServer, 0, KEY_READ, &hkey) == ERROR_SUCCESS)
  42. {
  43. LONG lRet = RegQueryValueExW(hkey, NULL, 0, &type, (LPBYTE)lpszNewHelpFile, &cbPath);
  44. if (lRet == ERROR_SUCCESS)
  45. {
  46. RegCloseKey(hkey);
  47. csRegValue.ReleaseBuffer(cbPath);
  48. csRegValue.Replace(L"ksysint.dll", L"Correction.hlp");
  49. return ORIGINAL_API(WinHelpA)(hWndMain, csRegValue.GetAnsi(), uCommand, dwData);
  50. }
  51. }
  52. }
  53. }
  54. CSTRING_CATCH
  55. {
  56. // Do nothing
  57. }
  58. return ORIGINAL_API(WinHelpA)(hWndMain, lpszHelp, uCommand, dwData);
  59. }
  60. HOOK_BEGIN
  61. APIHOOK_ENTRY(USER32.DLL, WinHelpA)
  62. HOOK_END
  63. IMPLEMENT_SHIM_END