include/rpc_reg.h

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    SMB parameters and setup
00004    Copyright (C) Andrew Tridgell                 1992-1997.
00005    Copyright (C) Luke Kenneth Casson Leighton    1996-1997.
00006    Copyright (C) Paul Ashton                          1997.
00007    Copyright (C) Jeremy Cooper                        2004.
00008    Copyright (C) Gerald Carter                   2002-2005.
00009    
00010    This program is free software; you can redistribute it and/or modify
00011    it under the terms of the GNU General Public License as published by
00012    the Free Software Foundation; either version 2 of the License, or
00013    (at your option) any later version.
00014    
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019    
00020    You should have received a copy of the GNU General Public License
00021    along with this program; if not, write to the Free Software
00022    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023 */
00024 
00025 #ifndef _RPC_REG_H /* _RPC_REG_H */
00026 #define _RPC_REG_H 
00027 
00028 /* RPC opnum */
00029 
00030 #define REG_OPEN_HKCR           0x00
00031 #define REG_OPEN_HKLM           0x02
00032 #define REG_OPEN_HKPD           0x03
00033 #define REG_OPEN_HKU            0x04
00034 #define REG_CLOSE               0x05
00035 #define REG_CREATE_KEY_EX       0x06
00036 #define REG_DELETE_KEY          0x07
00037 #define REG_DELETE_VALUE        0x08
00038 #define REG_ENUM_KEY            0x09
00039 #define REG_ENUM_VALUE          0x0a
00040 #define REG_FLUSH_KEY           0x0b
00041 #define REG_GET_KEY_SEC         0x0c
00042 #define REG_OPEN_ENTRY          0x0f
00043 #define REG_QUERY_KEY           0x10
00044 #define REG_QUERY_VALUE         0x11
00045 #define REG_RESTORE_KEY         0x13
00046 #define REG_SAVE_KEY            0x14
00047 #define REG_SET_KEY_SEC         0x15
00048 #define REG_SET_VALUE           0x16
00049 #define REG_SHUTDOWN            0x18
00050 #define REG_ABORT_SHUTDOWN      0x19
00051 #define REG_OPEN_HKPT           0x20
00052 #define REG_GETVERSION          0x1a
00053 #define REG_SHUTDOWN_EX         0x1e
00054 
00055 
00056 #define HKEY_CLASSES_ROOT       0x80000000
00057 #define HKEY_CURRENT_USER       0x80000001
00058 #define HKEY_LOCAL_MACHINE      0x80000002
00059 #define HKEY_USERS              0x80000003
00060 #define HKEY_PERFORMANCE_DATA   0x80000004
00061 
00062 #define KEY_HKLM                "HKLM"
00063 #define KEY_HKU                 "HKU"
00064 #define KEY_HKCR                "HKCR"
00065 #define KEY_HKPD                "HKPD"
00066 #define KEY_HKPT                "HKPT"
00067 #define KEY_SERVICES            "HKLM\\SYSTEM\\CurrentControlSet\\Services"
00068 #define KEY_PRINTING            "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
00069 #define KEY_PRINTING_2K         "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
00070 #define KEY_PRINTING_PORTS      "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
00071 #define KEY_EVENTLOG            "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
00072 #define KEY_SHARES              "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
00073 #define KEY_TREE_ROOT           ""
00074 
00075 /* Registry data types */
00076 
00077 #define REG_NONE                       0
00078 #define REG_SZ                         1
00079 #define REG_EXPAND_SZ                  2
00080 #define REG_BINARY                     3
00081 #define REG_DWORD                      4
00082 #define REG_DWORD_LE                   4        /* DWORD, little endian */
00083 #define REG_DWORD_BE                   5        /* DWORD, big endian */
00084 #define REG_LINK                       6
00085 #define REG_MULTI_SZ                   7
00086 #define REG_RESOURCE_LIST              8
00087 #define REG_FULL_RESOURCE_DESCRIPTOR   9
00088 #define REG_RESOURCE_REQUIREMENTS_LIST 10
00089 
00090 /*
00091  * Registry key types
00092  *      Most keys are going to be GENERIC -- may need a better name?
00093  *      HKPD and HKPT are used by reg_perfcount.c
00094  *              they are special keys that contain performance data
00095  */
00096 #define REG_KEY_GENERIC         0
00097 #define REG_KEY_HKPD            1
00098 #define REG_KEY_HKPT            2
00099 
00100 /* 
00101  * container for function pointers to enumeration routines
00102  * for virtual registry view 
00103  */ 
00104  
00105 typedef struct {
00106         /* functions for enumerating subkeys and values */      
00107         int     (*fetch_subkeys)( const char *key, REGSUBKEY_CTR *subkeys);
00108         int     (*fetch_values) ( const char *key, REGVAL_CTR *val );
00109         BOOL    (*store_subkeys)( const char *key, REGSUBKEY_CTR *subkeys );
00110         BOOL    (*store_values)( const char *key, REGVAL_CTR *val );
00111         BOOL    (*reg_access_check)( const char *keyname, uint32 requested, uint32 *granted, NT_USER_TOKEN *token );
00112 } REGISTRY_OPS;
00113 
00114 typedef struct {
00115         const char      *keyname;       /* full path to name of key */
00116         REGISTRY_OPS    *ops;           /* registry function hooks */
00117 } REGISTRY_HOOK;
00118 
00119 
00120 /* structure to store the registry handles */
00121 
00122 typedef struct _RegistryKey {
00123         uint32          type;
00124         char            *name;          /* full name of registry key */
00125         uint32          access_granted;
00126         REGISTRY_HOOK   *hook;  
00127 } REGISTRY_KEY;
00128 
00129 /*
00130  * RPC REGISTRY STRUCTURES
00131  */
00132 
00133 /***********************************************/
00134 
00135 typedef struct {
00136         uint16 *server;
00137         uint32 access;     
00138 } REG_Q_OPEN_HIVE;
00139 
00140 typedef struct {
00141         POLICY_HND pol;
00142         WERROR status; 
00143 } REG_R_OPEN_HIVE;
00144 
00145 
00146 /***********************************************/
00147 
00148 typedef struct {
00149         POLICY_HND pol;
00150 } REG_Q_FLUSH_KEY;
00151 
00152 typedef struct {
00153         WERROR status; 
00154 } REG_R_FLUSH_KEY;
00155 
00156 
00157 /***********************************************/
00158 
00159 typedef struct {
00160         POLICY_HND handle;
00161         uint32 sec_info;
00162         uint32 ptr; 
00163         BUFHDR hdr_sec;
00164         SEC_DESC_BUF *data;
00165 } REG_Q_SET_KEY_SEC;
00166 
00167 typedef struct {
00168         WERROR status;
00169 } REG_R_SET_KEY_SEC;
00170 
00171 
00172 /***********************************************/
00173 
00174 typedef struct {
00175         POLICY_HND handle;
00176         uint32 sec_info;
00177         uint32 ptr; 
00178         BUFHDR hdr_sec; 
00179         SEC_DESC_BUF *data; 
00180 } REG_Q_GET_KEY_SEC;
00181 
00182 typedef struct {
00183         uint32 sec_info; 
00184         uint32 ptr; 
00185         BUFHDR hdr_sec; 
00186         SEC_DESC_BUF *data;
00187         WERROR status;
00188 } REG_R_GET_KEY_SEC;
00189 
00190 /***********************************************/
00191 
00192 typedef struct {
00193         POLICY_HND handle;   
00194         UNISTR4 name;           
00195         uint32 type;  
00196         RPC_DATA_BLOB value; 
00197         uint32 size;
00198 } REG_Q_SET_VALUE;
00199 
00200 typedef struct { 
00201         WERROR status;
00202 } REG_R_SET_VALUE;
00203 
00204 /***********************************************/
00205 
00206 typedef struct {
00207         POLICY_HND pol;
00208         uint32 val_index;
00209         UNISTR4 name;
00210         uint32 *type;  
00211         REGVAL_BUFFER *value; /* value, in byte buffer */
00212         uint32 *buffer_len; 
00213         uint32 *name_len; 
00214 } REG_Q_ENUM_VALUE;
00215 
00216 typedef struct { 
00217         UNISTR4 name;
00218         uint32 *type;
00219         REGVAL_BUFFER *value;
00220         uint32 *buffer_len1;
00221         uint32 *buffer_len2;
00222         WERROR status;
00223 } REG_R_ENUM_VALUE;
00224 
00225 /***********************************************/
00226 
00227 typedef struct {
00228         POLICY_HND handle;
00229         UNISTR4 name;
00230         UNISTR4 key_class;
00231         uint32 options;
00232         uint32 access;
00233         
00234         /* FIXME!  collapse all this into one structure */
00235         uint32 *sec_info;
00236         uint32 ptr2;
00237         BUFHDR hdr_sec;
00238         uint32 ptr3;
00239         SEC_DESC_BUF *data;
00240 
00241         uint32 *disposition; 
00242 } REG_Q_CREATE_KEY_EX;
00243 
00244 typedef struct {
00245         POLICY_HND handle;
00246         uint32 disposition;
00247         WERROR status; 
00248 } REG_R_CREATE_KEY_EX;
00249 
00250 /***********************************************/
00251 
00252 typedef struct {
00253         POLICY_HND handle;
00254         UNISTR4 name;
00255 } REG_Q_DELETE_KEY;
00256 
00257 typedef struct {
00258         WERROR status; 
00259 } REG_R_DELETE_KEY;
00260 
00261 /***********************************************/
00262 
00263 typedef struct {
00264         POLICY_HND handle;
00265         UNISTR4 name;
00266 } REG_Q_DELETE_VALUE;
00267 
00268 typedef struct {
00269         WERROR status;
00270 } REG_R_DELETE_VALUE;
00271 
00272 /***********************************************/
00273 
00274 typedef struct {
00275         POLICY_HND pol;
00276         UNISTR4 key_class;
00277 } REG_Q_QUERY_KEY;
00278 
00279 typedef struct {
00280         UNISTR4 key_class;
00281         uint32 num_subkeys;
00282         uint32 max_subkeylen;
00283         uint32 reserved;        /* 0x0000 0000 - according to MSDN (max_subkeysize?) */
00284         uint32 num_values;
00285         uint32 max_valnamelen;
00286         uint32 max_valbufsize; 
00287         uint32 sec_desc;        /* 0x0000 0078 */
00288         NTTIME mod_time;        /* modified time */
00289         WERROR status;         
00290 } REG_R_QUERY_KEY;
00291 
00292 
00293 /***********************************************/
00294 
00295 typedef struct {
00296         POLICY_HND pol;
00297 } REG_Q_GETVERSION;
00298 
00299 typedef struct {
00300         uint32 win_version;
00301         WERROR status;
00302 } REG_R_GETVERSION;
00303 
00304 
00305 /***********************************************/
00306 
00307 typedef struct {
00308         POLICY_HND pol; 
00309         UNISTR4 filename;
00310         uint32 flags;
00311 } REG_Q_RESTORE_KEY;
00312 
00313 typedef struct {
00314         WERROR status;         /* return status */
00315 } REG_R_RESTORE_KEY;
00316 
00317 
00318 /***********************************************/
00319 
00320 
00321 /* I have no idea if this is correct since I 
00322    have not seen the full structure on the wire 
00323    as of yet */
00324    
00325 typedef struct {
00326         uint32 max_len;
00327         uint32 len;
00328         SEC_DESC *secdesc;
00329 } REG_SEC_DESC_BUF;
00330 
00331 typedef struct {
00332         uint32 size;            /* size in bytes of security descriptor */
00333         REG_SEC_DESC_BUF secdesc;
00334         uint8  inherit;         /* see MSDN for a description */
00335 } SECURITY_ATTRIBUTE;
00336 
00337 typedef struct {
00338         POLICY_HND pol; 
00339         UNISTR4 filename;
00340         SECURITY_ATTRIBUTE *sec_attr;
00341 } REG_Q_SAVE_KEY;
00342 
00343 typedef struct {
00344         WERROR status;         /* return status */
00345 } REG_R_SAVE_KEY;
00346 
00347 
00348 /***********************************************/
00349 
00350 typedef struct {
00351         POLICY_HND pol; /* policy handle */
00352 } REG_Q_CLOSE;
00353 
00354 typedef struct {
00355         POLICY_HND pol; 
00356         WERROR status; 
00357 } REG_R_CLOSE;
00358 
00359 
00360 /***********************************************/
00361 
00362 typedef struct {
00363         POLICY_HND pol; 
00364         uint32 key_index;       
00365         uint16 key_name_len;   
00366         uint16 unknown_1;       /* 0x0414 */
00367         uint32 ptr1;          
00368         uint32 unknown_2;       /* 0x0000 020A */
00369         uint8  pad1[8];        
00370         uint32 ptr2;           
00371         uint8  pad2[8];        
00372         uint32 ptr3;           
00373         NTTIME time;           
00374 } REG_Q_ENUM_KEY;
00375 
00376 typedef struct { 
00377         UNISTR4 keyname;
00378         UNISTR4 *classname;
00379         NTTIME *time;            
00380         WERROR status;         /* return status */
00381 } REG_R_ENUM_KEY;
00382 
00383 
00384 /***********************************************/
00385 
00386 typedef struct {
00387         POLICY_HND pol;         /* policy handle */
00388         UNISTR4  name;
00389 
00390         uint32 ptr_reserved;    /* pointer */
00391   
00392         uint32 ptr_buf;         /* the next three fields follow if ptr_buf != 0 */
00393         uint32 ptr_bufsize;
00394         uint32 bufsize;
00395         uint32 buf_unk;
00396 
00397         uint32 unk1;
00398         uint32 ptr_buflen;
00399         uint32 buflen;
00400   
00401         uint32 ptr_buflen2;
00402         uint32 buflen2;
00403 
00404 } REG_Q_QUERY_VALUE;
00405 
00406 typedef struct { 
00407         uint32 *type;
00408         REGVAL_BUFFER *value;   /* key value */
00409         uint32 *buf_max_len;
00410         uint32 *buf_len;
00411         WERROR status;  /* return status */
00412 } REG_R_QUERY_VALUE;
00413 
00414 
00415 /***********************************************/
00416 
00417 typedef struct {
00418         POLICY_HND pol;
00419         UNISTR4 name; 
00420         uint32 unknown_0;       /* 32 bit unknown - 0x0000 0000 */
00421         uint32 access; 
00422 } REG_Q_OPEN_ENTRY;
00423 
00424 typedef struct {
00425         POLICY_HND handle;
00426         WERROR status;
00427 } REG_R_OPEN_ENTRY;
00428 
00429 /***********************************************/
00430  
00431 typedef struct {
00432         uint16 *server;
00433         UNISTR4 *message;       
00434         uint32 timeout;         /* in seconds */
00435         uint8 force;            /* boolean: force shutdown */
00436         uint8 reboot;           /* boolean: reboot on shutdown */               
00437 } REG_Q_SHUTDOWN;
00438 
00439 typedef struct {
00440         WERROR status;          /* return status */
00441 } REG_R_SHUTDOWN;
00442 
00443 /***********************************************/
00444  
00445 typedef struct {
00446         uint16 *server;
00447         UNISTR4 *message;       
00448         uint32 timeout;         /* in seconds */
00449         uint8 force;            /* boolean: force shutdown */
00450         uint8 reboot;           /* boolean: reboot on shutdown */
00451         uint32 reason;          /* reason - must be defined code */
00452 } REG_Q_SHUTDOWN_EX;
00453 
00454 typedef struct {
00455         WERROR status;
00456 } REG_R_SHUTDOWN_EX;
00457 
00458 /***********************************************/
00459 
00460 typedef struct {
00461         uint16 *server;
00462 } REG_Q_ABORT_SHUTDOWN;
00463 
00464 typedef struct { 
00465         WERROR status; 
00466 } REG_R_ABORT_SHUTDOWN;
00467 
00468 
00469 #endif /* _RPC_REG_H */
00470 

Sambaに対してSat Aug 29 21:22:56 2009に生成されました。  doxygen 1.4.7