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.

73 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. EasyCDCreator4.cpp
  5. Abstract:
  6. Prevent the uninstall program from deleting the whole
  7. HKCR\Drive\ShellEx\ContextMenuHandlers key.
  8. Notes:
  9. This is an app specific shim.
  10. History:
  11. 06/10/2001 maonis Created
  12. --*/
  13. #include "precomp.h"
  14. #include "strsafe.h"
  15. IMPLEMENT_SHIM_BEGIN(EasyCDCreator4)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_ENTRY(RegOpenKeyA)
  19. APIHOOK_ENUM_END
  20. /*++
  21. Return failure to this call so it doesn't attempt to delete the subkeys.
  22. --*/
  23. LONG
  24. APIHOOK(RegOpenKeyA)(
  25. HKEY hKey,
  26. LPCSTR lpSubKey,
  27. PHKEY phkResult
  28. )
  29. {
  30. if (hKey == HKEY_CLASSES_ROOT && !strcmp(lpSubKey, "Drive"))
  31. {
  32. // We delete the key that the app created manually.
  33. RegDeleteKeyA(
  34. HKEY_CLASSES_ROOT,
  35. "Drive\\shellex\\ContextMenuHandlers\\{df987040-eac5-11cf-bc30-444553540000}");
  36. return 1;
  37. }
  38. else
  39. {
  40. return ORIGINAL_API(RegOpenKeyA)(hKey, lpSubKey, phkResult);
  41. }
  42. }
  43. /*++
  44. Register hooked functions
  45. --*/
  46. HOOK_BEGIN
  47. APIHOOK_ENTRY(ADVAPI32.DLL, RegOpenKeyA)
  48. HOOK_END
  49. IMPLEMENT_SHIM_END