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.

59 lines
2.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2002.
  5. //
  6. // File: reghelp.hxx
  7. //
  8. // Contents: Registry helper functions for accessing HKCR
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // Notes:
  15. // The registry APIs do a surprising thing when you access
  16. // HKEY_CLASSES_ROOT. They will determine which user hive to use
  17. // based on whoever was impersonating when the first access was made for
  18. // the process, and it will use that mapping no matte who is impersonated
  19. // later. As such, it is impossible to know at any point in time where you
  20. // will be picking up your user mapping when you access HKCR.
  21. // This could present security holes if a malicious user were able to force
  22. // their own hive to be the first one accessed. So, for example, a
  23. // malicious user could force their own InprocServer32 value to be used
  24. // instead of one from a different user's hive.
  25. //
  26. // The APIs in this file provide a reliable means of accessing HKCR, so that
  27. // you always know what the mapping will be. These functions will use
  28. // HKEY_USERS\SID_ProcessToken\Software\Classes instead of trying to get
  29. // the current user's token.
  30. //
  31. //----------------------------------------------------------------------------
  32. #pragma once
  33. // ----------------------------------------------------------------------------
  34. // Registry functions for accessing HKCR.
  35. // ----------------------------------------------------------------------------
  36. #define OpenClassesRootKey OpenClassesRootKeyW
  37. #define OpenClassesRootKeyEx OpenClassesRootKeyExW
  38. #define QueryClassesRootValue QueryClassesRootValueW
  39. #define SetClassesRootValue SetClassesRootValueW
  40. #ifdef __cplusplus
  41. extern "C"
  42. {
  43. #endif
  44. LONG WINAPI OpenClassesRootKeyW(LPCWSTR psSubKey,HKEY *phkResult);
  45. LONG WINAPI OpenClassesRootKeyExW(LPCWSTR pszSubKey,REGSAM samDesired,HKEY *phkResult);
  46. LONG WINAPI QueryClassesRootValueW(LPCWSTR pszSubKey,LPWSTR pszValue,PLONG lpcbValue);
  47. LONG WINAPI SetClassesRootValueW(LPCWSTR pszSubKey,DWORD dwType,LPCWSTR pszData,DWORD cbData);
  48. LONG WINAPI OpenClassesRootKeyA(LPCSTR psSubKey,HKEY *phkResult);
  49. LONG WINAPI OpenClassesRootKeyExA(LPCSTR pszSubKey,REGSAM samDesired,HKEY *phkResult);
  50. LONG WINAPI QueryClassesRootValueA(LPCSTR pszSubKey,LPSTR pszValue,PLONG lpcbValue);
  51. #ifdef __cplusplus
  52. }
  53. #endif