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.

78 lines
2.4 KiB

  1. /*++
  2. Copyright (C) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. REG.H
  5. Abstract:
  6. Utility Registry classes
  7. History:
  8. a-raymcc 30-May-96 Created.
  9. --*/
  10. #ifndef _REG_H_
  11. #define _REG_H_
  12. #include "corepol.h"
  13. #define WBEM_REG_WBEM L"Software\\Microsoft\\WBEM"
  14. #define WBEM_REG_WINMGMT L"Software\\Microsoft\\WBEM\\CIMOM"
  15. class POLARITY Registry
  16. {
  17. HKEY hPrimaryKey;
  18. HKEY hSubkey;
  19. int nStatus;
  20. LONG m_nLastError;
  21. public:
  22. enum { no_error, failed };
  23. int Open(HKEY hStart, wchar_t *pszStartKey, DWORD desiredAccess= KEY_ALL_ACCESS);
  24. Registry(wchar_t *pszLocalMachineStartKey, DWORD desiredAccess= KEY_ALL_ACCESS);
  25. // This create a special read only version which is usefull for marshalling
  26. // clients which are running with a lower priviledge set.
  27. Registry();
  28. Registry(HKEY hRoot, REGSAM flags, wchar_t *pszStartKey);
  29. Registry(HKEY hRoot, DWORD dwOptions, REGSAM flags, wchar_t *pszStartKey);
  30. ~Registry();
  31. int MoveToSubkey(wchar_t *pszNewSubkey);
  32. int GetDWORD(wchar_t *pszValueName, DWORD *pdwValue);
  33. int GetDWORDStr(wchar_t *pszValueName, DWORD *pdwValue);
  34. int GetStr(wchar_t *pszValue, wchar_t **pValue);
  35. // It is the callers responsibility to delete pData
  36. int GetBinary(wchar_t *pszValue, byte ** pData, DWORD * pdwSize);
  37. int SetBinary(wchar_t *pszValue, byte * pData, DWORD dwSize);
  38. //Returns a pointer to a string buffer containing the null-terminated string.
  39. //The last entry is a double null terminator (i.e. the registry format for
  40. //a REG_MULTI_SZ). Caller has do "delete []" the returned pointer.
  41. //dwSize is the size of the buffer returned.
  42. wchar_t* GetMultiStr(wchar_t *pszValueName, DWORD &dwSize);
  43. int SetDWORD(wchar_t *pszValueName, DWORD dwValue);
  44. int SetDWORDStr(wchar_t *pszValueName, DWORD dwValue);
  45. int SetStr(wchar_t *pszValueName, wchar_t *psvValue);
  46. int SetExpandStr(wchar_t *pszValueName, wchar_t *psvValue);
  47. //pData should be passed in with the last entry double null terminated.
  48. //(i.e. the registry format for a REG_MULTI_SZ).
  49. int SetMultiStr(wchar_t *pszValueName, wchar_t* pData, DWORD dwSize);
  50. LONG GetLastError() { return m_nLastError; }
  51. int DeleteValue(wchar_t *pszValueName);
  52. int GetType(wchar_t *pszValueName, DWORD *pdwType);
  53. };
  54. #endif