[740] | 1 | /*
|
---|
| 2 | * Unix SMB/CIFS implementation.
|
---|
| 3 | * Virtual Windows Registry Layer
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) Gerald Carter 2002-2005
|
---|
| 6 | * Copyright (C) Volker Lendecke 2006
|
---|
| 7 | * Copyright (C) Michael Adam 2006-2010
|
---|
| 8 | *
|
---|
| 9 | * This program is free software; you can redistribute it and/or modify
|
---|
| 10 | * it under the terms of the GNU General Public License as published by
|
---|
| 11 | * the Free Software Foundation; either version 3 of the License, or
|
---|
| 12 | * (at your option) any later version.
|
---|
| 13 | *
|
---|
| 14 | * This program is distributed in the hope that it will be useful,
|
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 17 | * GNU General Public License for more details.
|
---|
| 18 | *
|
---|
| 19 | * You should have received a copy of the GNU General Public License
|
---|
| 20 | * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | #ifndef _REGISTRY_H
|
---|
| 24 | #define _REGISTRY_H
|
---|
| 25 |
|
---|
| 26 | #include "../librpc/gen_ndr/winreg.h"
|
---|
| 27 |
|
---|
| 28 | struct registry_value {
|
---|
| 29 | enum winreg_Type type;
|
---|
| 30 | DATA_BLOB data;
|
---|
| 31 | };
|
---|
| 32 |
|
---|
| 33 | /* forward declarations. definitions in reg_objects.c */
|
---|
| 34 | struct regval_ctr;
|
---|
| 35 | struct regsubkey_ctr;
|
---|
| 36 |
|
---|
| 37 | /*
|
---|
| 38 | * container for function pointers to enumeration routines
|
---|
| 39 | * for virtual registry view
|
---|
| 40 | */
|
---|
| 41 |
|
---|
| 42 | struct registry_ops {
|
---|
| 43 | /* functions for enumerating subkeys and values */
|
---|
| 44 | int (*fetch_subkeys)( const char *key, struct regsubkey_ctr *subkeys);
|
---|
| 45 | int (*fetch_values) ( const char *key, struct regval_ctr *val );
|
---|
| 46 | bool (*store_subkeys)( const char *key, struct regsubkey_ctr *subkeys );
|
---|
| 47 | WERROR (*create_subkey)(const char *key, const char *subkey);
|
---|
| 48 | WERROR (*delete_subkey)(const char *key, const char *subkey);
|
---|
| 49 | bool (*store_values)( const char *key, struct regval_ctr *val );
|
---|
| 50 | bool (*reg_access_check)( const char *keyname, uint32 requested,
|
---|
| 51 | uint32 *granted,
|
---|
| 52 | const struct security_token *token );
|
---|
| 53 | WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key,
|
---|
| 54 | struct security_descriptor **psecdesc);
|
---|
| 55 | WERROR (*set_secdesc)(const char *key,
|
---|
| 56 | struct security_descriptor *sec_desc);
|
---|
| 57 | bool (*subkeys_need_update)(struct regsubkey_ctr *subkeys);
|
---|
| 58 | bool (*values_need_update)(struct regval_ctr *values);
|
---|
| 59 | };
|
---|
| 60 |
|
---|
| 61 | /* structure to store the registry handles */
|
---|
| 62 |
|
---|
| 63 | struct registry_key_handle {
|
---|
| 64 | uint32 type;
|
---|
| 65 | char *name; /* full name of registry key */
|
---|
| 66 | uint32 access_granted;
|
---|
| 67 | struct registry_ops *ops;
|
---|
| 68 | };
|
---|
| 69 |
|
---|
| 70 | struct registry_key {
|
---|
| 71 | struct registry_key_handle *key;
|
---|
| 72 | struct regsubkey_ctr *subkeys;
|
---|
| 73 | struct regval_ctr *values;
|
---|
| 74 | struct security_token *token;
|
---|
| 75 | };
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | /*
|
---|
| 79 | *
|
---|
| 80 | * Macros that used to reside in rpc_reg.h
|
---|
| 81 | *
|
---|
| 82 | */
|
---|
| 83 |
|
---|
| 84 | #define HKEY_CLASSES_ROOT 0x80000000
|
---|
| 85 | #define HKEY_CURRENT_USER 0x80000001
|
---|
| 86 | #define HKEY_LOCAL_MACHINE 0x80000002
|
---|
| 87 | #define HKEY_USERS 0x80000003
|
---|
| 88 | #define HKEY_PERFORMANCE_DATA 0x80000004
|
---|
| 89 |
|
---|
| 90 | #define KEY_HKLM "HKLM"
|
---|
| 91 | #define KEY_HKU "HKU"
|
---|
| 92 | #define KEY_HKCC "HKCC"
|
---|
| 93 | #define KEY_HKCR "HKCR"
|
---|
| 94 | #define KEY_HKPD "HKPD"
|
---|
| 95 | #define KEY_HKPT "HKPT"
|
---|
| 96 | #define KEY_HKPN "HKPN"
|
---|
| 97 | #define KEY_HKCU "HKCU"
|
---|
| 98 | #define KEY_HKDD "HKDD"
|
---|
| 99 | #define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services"
|
---|
| 100 | #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
|
---|
| 101 | #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
|
---|
| 102 | #define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters"
|
---|
| 103 | #define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
|
---|
| 104 | #define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions"
|
---|
| 105 | #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
|
---|
| 106 | #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
|
---|
| 107 | #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
|
---|
| 108 | #define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
|
---|
| 109 | #define KEY_PERFLIB "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib"
|
---|
| 110 | #define KEY_PERFLIB_009 "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009"
|
---|
| 111 | #define KEY_GROUP_POLICY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Group Policy"
|
---|
| 112 | #define KEY_WINLOGON "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
|
---|
| 113 | #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf"
|
---|
| 114 | #define KEY_SAMBA_GROUP_POLICY "HKLM\\SOFTWARE\\Samba\\Group Policy"
|
---|
| 115 | #define KEY_TREE_ROOT ""
|
---|
| 116 |
|
---|
| 117 | #define KEY_GP_MACHINE_POLICY "HKLM\\Software\\Policies"
|
---|
| 118 | #define KEY_GP_MACHINE_WIN_POLICY "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies"
|
---|
| 119 | #define KEY_GP_USER_POLICY "HKCU\\Software\\Policies"
|
---|
| 120 | #define KEY_GP_USER_WIN_POLICY "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies"
|
---|
| 121 |
|
---|
| 122 | /*
|
---|
| 123 | * Registry key types
|
---|
| 124 | * Most keys are going to be GENERIC -- may need a better name?
|
---|
| 125 | * HKPD and HKPT are used by reg_perfcount.c
|
---|
| 126 | * they are special keys that contain performance data
|
---|
| 127 | */
|
---|
| 128 | #define REG_KEY_GENERIC 0
|
---|
| 129 | #define REG_KEY_HKPD 1
|
---|
| 130 | #define REG_KEY_HKPT 2
|
---|
| 131 |
|
---|
| 132 | #endif /* _REGISTRY_H */
|
---|