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.

86 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Omikron.cpp
  5. Abstract:
  6. Shims RegQueryValueExA so that when the app asks for the shell command
  7. for opening an rtffile, it gets what it expected to see under Win95:
  8. "C:\WINDOWS\WORDPAD.EXE %1" This is, of course, wrong, but we then apply
  9. CorrectFilePaths, so when it actually goes out to launch wordpad, it has
  10. the right path.
  11. This is necessary because it can't have a path name with spaces in it
  12. Notes:
  13. This is specific to Omikron.
  14. History:
  15. 3/27/2000 dmunsil Created
  16. --*/
  17. #include "precomp.h"
  18. IMPLEMENT_SHIM_BEGIN(Omikron)
  19. #include "ShimHookMacro.h"
  20. APIHOOK_ENUM_BEGIN
  21. APIHOOK_ENUM_ENTRY(RegQueryValueExA)
  22. APIHOOK_ENUM_END
  23. LONG
  24. APIHOOK(RegQueryValueExA)(
  25. HKEY hKey,
  26. LPSTR lpValueName,
  27. LPDWORD lpReserved,
  28. LPDWORD lpType,
  29. LPBYTE lpData,
  30. LPDWORD lpcbData
  31. )
  32. {
  33. LONG lReturn;
  34. lReturn = ORIGINAL_API(RegQueryValueExA)(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
  35. if (lReturn != ERROR_SUCCESS)
  36. {
  37. return lReturn;
  38. }
  39. if (lpType && lpcbData && lpData && (*lpType == REG_SZ || *lpType == REG_EXPAND_SZ))
  40. {
  41. CSTRING_TRY
  42. {
  43. LPSTR lpszData = (LPSTR)lpData;
  44. CString csData(lpszData);
  45. if (csData.Find(L"wordpad.exe \"%1\"") >= 0)
  46. {
  47. lstrcpyA(lpszData, "c:\\windows\\wordpad.exe \"%1\"");
  48. }
  49. }
  50. CSTRING_CATCH
  51. {
  52. // Do nothing
  53. }
  54. }
  55. return lReturn;
  56. }
  57. HOOK_BEGIN
  58. APIHOOK_ENTRY(ADVAPI32.DLL, RegQueryValueExA )
  59. HOOK_END
  60. IMPLEMENT_SHIM_END