Source code of Windows XP (NT5)
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.

89 lines
2.3 KiB

  1. #ifndef __REGUTIL_HXX__
  2. #define __REGUTIL_HXX__
  3. #define INC_OLE2
  4. #include <windows.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <memory.h>
  8. #include <assert.h>
  9. typedef enum tagKEY_CLASS
  10. {
  11. KEY_UNKNOWN,
  12. KEY_FILEEXT,
  13. KEY_PROGID,
  14. KEY_CLSID,
  15. KEY_IID,
  16. KEY_APPID
  17. } KEY_CLASS;
  18. #define MAX_KEY_NAME_LENGTH 256
  19. class BasicRegistry
  20. {
  21. public:
  22. char StoredKeyName[MAX_KEY_NAME_LENGTH];
  23. public:
  24. BasicRegistry( HKEY hKey )
  25. {
  26. Key = hKey;
  27. KeyIndex = 0;
  28. }
  29. BasicRegistry( HKEY ParentKey, char * KeyName );
  30. ~BasicRegistry()
  31. {
  32. RegCloseKey( Key );
  33. }
  34. HKEY GetKey() { return Key; };
  35. // Initialize for enumeration.
  36. void InitForEnumeration( DWORD Index )
  37. {
  38. KeyIndex = Index;
  39. }
  40. // Next in enumeration.
  41. LONG NextKey( char * pNameOfKeyToEnumUnderParent,
  42. DWORD * pSizeOfKeyNameBuffer,
  43. BasicRegistry ** pNewChildKey,
  44. FILETIME ftLow,
  45. FILETIME ftHigh
  46. );
  47. LONG BasicRegistry::NextNumericKey(
  48. char * pBufferForKeyName,
  49. DWORD * pSizeOfKeyNameBuffer,
  50. BasicRegistry ** ppNewChildKey,
  51. FILETIME ftLow,
  52. FILETIME ftHigh
  53. );
  54. // Find Key
  55. LONG Find( char * SubKeyName, BasicRegistry ** pSubKey );
  56. // Get value.
  57. LONG QueryValue( char * ValueName,
  58. char * ValueResult,
  59. DWORD * SizeofValueResult );
  60. LONG QueryValueEx( char * ValueName,
  61. char * ValueResult,
  62. DWORD * SizeofValueResult );
  63. KEY_CLASS ClassifyKey( char * KeyName );
  64. private:
  65. HKEY Key;
  66. DWORD KeyIndex;
  67. };
  68. #endif // __REGUTIL_HXX__