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.

77 lines
2.0 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. CString csRegValue;
  37. const WCHAR szInprocServer[] = L"CLSID\\{B9C12481-D072-11D0-9E80-0060976FD1F8}\\InprocServer32";
  38. // Call the RegQueryValueExW overloaded function for CString's.
  39. LONG lRet = RegQueryValueExW(csRegValue, HKEY_CLASSES_ROOT, szInprocServer, NULL);
  40. if (lRet == ERROR_SUCCESS)
  41. {
  42. if (csRegValue.Replace(L"ksysint.dll", L"Correction.hlp") == 1)
  43. {
  44. return ORIGINAL_API(WinHelpA)(hWndMain, csRegValue.GetAnsi(), uCommand, dwData);
  45. }
  46. }
  47. }
  48. }
  49. CSTRING_CATCH
  50. {
  51. // Do nothing
  52. }
  53. return ORIGINAL_API(WinHelpA)(hWndMain, lpszHelp, uCommand, dwData);
  54. }
  55. HOOK_BEGIN
  56. APIHOOK_ENTRY(USER32.DLL, WinHelpA)
  57. HOOK_END
  58. IMPLEMENT_SHIM_END