diff options
-rw-r--r-- | source3/include/reg_objects.h | 119 | ||||
-rw-r--r-- | source3/include/registry.h | 125 |
2 files changed, 125 insertions, 119 deletions
diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h index a0a830622c..8cc74ed1bf 100644 --- a/source3/include/reg_objects.h +++ b/source3/include/reg_objects.h @@ -25,31 +25,6 @@ struct regval_blob; -/* - * A REG_SZ string is not necessarily NULL terminated. When retrieving it from - * the net, we guarantee this however. A server might want to push it without - * the terminator though. - */ - -struct registry_string { - size_t len; - char *str; -}; - -struct registry_value { - enum winreg_Type type; - union { - uint32 dword; - uint64 qword; - struct registry_string sz; - struct { - uint32 num_strings; - char **strings; - } multi_sz; - DATA_BLOB binary; - } v; -}; - /* container for registry values */ struct regval_ctr; @@ -58,100 +33,6 @@ struct regval_ctr; struct regsubkey_ctr; -/* - * - * Macros that used to reside in rpc_reg.h - * - */ - -#define HKEY_CLASSES_ROOT 0x80000000 -#define HKEY_CURRENT_USER 0x80000001 -#define HKEY_LOCAL_MACHINE 0x80000002 -#define HKEY_USERS 0x80000003 -#define HKEY_PERFORMANCE_DATA 0x80000004 - -#define KEY_HKLM "HKLM" -#define KEY_HKU "HKU" -#define KEY_HKCC "HKCC" -#define KEY_HKCR "HKCR" -#define KEY_HKPD "HKPD" -#define KEY_HKPT "HKPT" -#define KEY_HKPN "HKPN" -#define KEY_HKCU "HKCU" -#define KEY_HKDD "HKDD" -#define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services" -#define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog" -#define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares" -#define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters" -#define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" -#define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions" -#define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" -#define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" -#define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports" -#define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" -#define KEY_PERFLIB "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib" -#define KEY_PERFLIB_009 "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009" -#define KEY_GROUP_POLICY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Group Policy" -#define KEY_WINLOGON "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" -#define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" -#define KEY_SAMBA_GROUP_POLICY "HKLM\\SOFTWARE\\Samba\\Group Policy" -#define KEY_TREE_ROOT "" - -#define KEY_GP_MACHINE_POLICY "HKLM\\Software\\Policies" -#define KEY_GP_MACHINE_WIN_POLICY "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies" -#define KEY_GP_USER_POLICY "HKCU\\Software\\Policies" -#define KEY_GP_USER_WIN_POLICY "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies" -/* - * Registry key types - * Most keys are going to be GENERIC -- may need a better name? - * HKPD and HKPT are used by reg_perfcount.c - * they are special keys that contain performance data - */ -#define REG_KEY_GENERIC 0 -#define REG_KEY_HKPD 1 -#define REG_KEY_HKPT 2 - -/* - * container for function pointers to enumeration routines - * for virtual registry view - */ - -struct registry_ops { - /* functions for enumerating subkeys and values */ - int (*fetch_subkeys)( const char *key, struct regsubkey_ctr *subkeys); - int (*fetch_values) ( const char *key, struct regval_ctr *val ); - bool (*store_subkeys)( const char *key, struct regsubkey_ctr *subkeys ); - WERROR (*create_subkey)(const char *key, const char *subkey); - WERROR (*delete_subkey)(const char *key, const char *subkey); - bool (*store_values)( const char *key, struct regval_ctr *val ); - bool (*reg_access_check)( const char *keyname, uint32 requested, - uint32 *granted, - const NT_USER_TOKEN *token ); - WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key, - struct security_descriptor **psecdesc); - WERROR (*set_secdesc)(const char *key, - struct security_descriptor *sec_desc); - bool (*subkeys_need_update)(struct regsubkey_ctr *subkeys); - bool (*values_need_update)(struct regval_ctr *values); -}; - - -/* structure to store the registry handles */ - -struct registry_key_handle { - uint32 type; - char *name; /* full name of registry key */ - uint32 access_granted; - struct registry_ops *ops; -}; - -struct registry_key { - struct registry_key_handle *key; - struct regsubkey_ctr *subkeys; - struct regval_ctr *values; - struct nt_user_token *token; -}; - /* The following definitions come from registry/reg_objects.c */ WERROR regsubkey_ctr_init(TALLOC_CTX *mem_ctx, struct regsubkey_ctr **ctr); diff --git a/source3/include/registry.h b/source3/include/registry.h index 81580f02a8..6b43b522bc 100644 --- a/source3/include/registry.h +++ b/source3/include/registry.h @@ -3,6 +3,131 @@ #include "reg_objects.h" +/* + * A REG_SZ string is not necessarily NULL terminated. When retrieving it from + * the net, we guarantee this however. A server might want to push it without + * the terminator though. + */ + +struct registry_string { + size_t len; + char *str; +}; + +struct registry_value { + enum winreg_Type type; + union { + uint32 dword; + uint64 qword; + struct registry_string sz; + struct { + uint32 num_strings; + char **strings; + } multi_sz; + DATA_BLOB binary; + } v; +}; + +/* forward declarations. definitions in reg_objects.c */ +struct regval_ctr; +struct regsubkey_ctr; + +/* + * container for function pointers to enumeration routines + * for virtual registry view + */ + +struct registry_ops { + /* functions for enumerating subkeys and values */ + int (*fetch_subkeys)( const char *key, struct regsubkey_ctr *subkeys); + int (*fetch_values) ( const char *key, struct regval_ctr *val ); + bool (*store_subkeys)( const char *key, struct regsubkey_ctr *subkeys ); + WERROR (*create_subkey)(const char *key, const char *subkey); + WERROR (*delete_subkey)(const char *key, const char *subkey); + bool (*store_values)( const char *key, struct regval_ctr *val ); + bool (*reg_access_check)( const char *keyname, uint32 requested, + uint32 *granted, + const NT_USER_TOKEN *token ); + WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key, + struct security_descriptor **psecdesc); + WERROR (*set_secdesc)(const char *key, + struct security_descriptor *sec_desc); + bool (*subkeys_need_update)(struct regsubkey_ctr *subkeys); + bool (*values_need_update)(struct regval_ctr *values); +}; + +/* structure to store the registry handles */ + +struct registry_key_handle { + uint32 type; + char *name; /* full name of registry key */ + uint32 access_granted; + struct registry_ops *ops; +}; + +struct registry_key { + struct registry_key_handle *key; + struct regsubkey_ctr *subkeys; + struct regval_ctr *values; + struct nt_user_token *token; +}; + + +/* + * + * Macros that used to reside in rpc_reg.h + * + */ + +#define HKEY_CLASSES_ROOT 0x80000000 +#define HKEY_CURRENT_USER 0x80000001 +#define HKEY_LOCAL_MACHINE 0x80000002 +#define HKEY_USERS 0x80000003 +#define HKEY_PERFORMANCE_DATA 0x80000004 + +#define KEY_HKLM "HKLM" +#define KEY_HKU "HKU" +#define KEY_HKCC "HKCC" +#define KEY_HKCR "HKCR" +#define KEY_HKPD "HKPD" +#define KEY_HKPT "HKPT" +#define KEY_HKPN "HKPN" +#define KEY_HKCU "HKCU" +#define KEY_HKDD "HKDD" +#define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services" +#define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog" +#define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares" +#define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters" +#define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions" +#define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" +#define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" +#define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports" +#define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" +#define KEY_PERFLIB "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib" +#define KEY_PERFLIB_009 "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009" +#define KEY_GROUP_POLICY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Group Policy" +#define KEY_WINLOGON "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" +#define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" +#define KEY_SAMBA_GROUP_POLICY "HKLM\\SOFTWARE\\Samba\\Group Policy" +#define KEY_TREE_ROOT "" + +#define KEY_GP_MACHINE_POLICY "HKLM\\Software\\Policies" +#define KEY_GP_MACHINE_WIN_POLICY "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies" +#define KEY_GP_USER_POLICY "HKCU\\Software\\Policies" +#define KEY_GP_USER_WIN_POLICY "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies" + +/* + * Registry key types + * Most keys are going to be GENERIC -- may need a better name? + * HKPD and HKPT are used by reg_perfcount.c + * they are special keys that contain performance data + */ +#define REG_KEY_GENERIC 0 +#define REG_KEY_HKPD 1 +#define REG_KEY_HKPT 2 + + /* The following definitions come from registry/reg_api.c */ WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive, |