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.

68 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 1985 - 1999, Microsoft Corporation
  3. Module Name:
  4. registry.h
  5. Abstract:
  6. This file defines the Registry Class.
  7. Author:
  8. Revision History:
  9. Notes:
  10. --*/
  11. #ifndef _REGISTRY_H_
  12. #define _REGISTRY_H_
  13. class CRegistry
  14. {
  15. public:
  16. CRegistry() {
  17. _hKey = NULL;
  18. _iEnumKeyIndex = -1;
  19. _dwMaxSubKeyLen = 0;
  20. _pMemBlock = NULL;
  21. }
  22. ~CRegistry() {
  23. if (_hKey != NULL) {
  24. RegCloseKey(_hKey);
  25. _hKey = NULL;
  26. }
  27. Release();
  28. }
  29. DWORD CreateKey(HKEY hKey, LPCTSTR lpSubKey, REGSAM access = KEY_ALL_ACCESS, LPSECURITY_ATTRIBUTES lpSecAttr = NULL, LPDWORD pDisposition = NULL);
  30. DWORD OpenKey(HKEY hKey, LPCTSTR lpSubKey, REGSAM access = KEY_ALL_ACCESS);
  31. typedef enum {
  32. REG_QUERY_NUMBER_OF_SUBKEYS,
  33. REG_QUERY_MAX_SUBKEY_LEN
  34. } REG_QUERY;
  35. DWORD QueryInfoKey(REG_QUERY iType, LPBYTE lpData);
  36. DWORD GetFirstSubKey(LPTSTR* lppStr, LPDWORD lpdwSize);
  37. DWORD GetNextSubKey(LPTSTR* lppStr, LPDWORD lpdwSize);
  38. private:
  39. void* Allocate(DWORD dwSize);
  40. void Release();
  41. HKEY _hKey; // Handle of registry key.
  42. int _iEnumKeyIndex; // Index of enumration key.
  43. DWORD _dwMaxSubKeyLen; // Longest subkey name length
  44. LPBYTE _pMemBlock; // Memory block for enumration.
  45. };
  46. #endif // _REGISTRY_H_