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.

60 lines
1.5 KiB

  1. /*++
  2. Copyright (C) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. NTREG.H
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef _NTREG_H_
  9. #define _NTREG_H_
  10. #include <windows.h>
  11. //#include "corepol.h"
  12. class CNTRegistry
  13. {
  14. HKEY m_hPrimaryKey;
  15. HKEY m_hSubkey;
  16. int m_nStatus;
  17. LONG m_nLastError;
  18. public:
  19. enum { no_error, failed, out_of_memory, no_more_items, access_denied, not_found };
  20. CNTRegistry();
  21. ~CNTRegistry();
  22. int Open(HKEY hStart, WCHAR *pszStartKey);
  23. int MoveToSubkey(WCHAR *pszNewSubkey);
  24. int DeleteValue(WCHAR *pwszValueName);
  25. int GetDWORD(WCHAR *pwszValueName, DWORD *pdwValue);
  26. int GetStr(WCHAR *pwszValueName, WCHAR **pwszValue);
  27. int GetBinary(WCHAR *pwszValueName, BYTE** ppBuffer, DWORD * pdwSize);
  28. //Returns a pointer to a string buffer containing the null-terminated string.
  29. //The last entry is a double null terminator (i.e. the registry format for
  30. //a REG_MULTI_SZ). Caller has do "delete []" the returned pointer.
  31. //dwSize is the size of the buffer returned.
  32. int GetMultiStr(WCHAR *pwszValueName, WCHAR** pwszValue, DWORD &dwSize);
  33. // Allows key enumneration
  34. int Enum( DWORD dwIndex, wmilib::auto_buffer<WCHAR> & pwszValue, DWORD& dwSize );
  35. int SetDWORD(WCHAR *pwszValueName, DWORD dwValue);
  36. int SetStr(WCHAR *pwszValueName, WCHAR *wszValue);
  37. int SetBinary(WCHAR *pwszValueName, BYTE* pBuffer, DWORD dwSize );
  38. LONG GetLastError() { return m_nLastError; }
  39. };
  40. #endif