1998-03-11 21:11:04 +00:00
/*
2002-01-30 06:08:46 +00:00
Unix SMB / CIFS implementation .
1998-03-11 21:11:04 +00:00
SMB parameters and setup
2002-08-17 17:00:51 +00:00
Copyright ( C ) Andrew Tridgell 1992 - 1997.
Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1997.
Copyright ( C ) Paul Ashton 1997.
2005-03-23 23:26:33 +00:00
Copyright ( C ) Jeremy Cooper 2004.
Copyright ( C ) Gerald Carter 2002 - 2005.
1998-03-11 21:11:04 +00:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
# ifndef _RPC_REG_H /* _RPC_REG_H */
# define _RPC_REG_H
2005-05-23 16:25:31 +00:00
# include "reg_objects.h"
2005-04-05 17:49:16 +00:00
/* RPC opnum */
1998-03-11 21:11:04 +00:00
2002-08-17 17:00:51 +00:00
# define REG_OPEN_HKCR 0x00
2002-07-15 10:35:28 +00:00
# define REG_OPEN_HKLM 0x02
2005-03-23 23:26:33 +00:00
# define REG_OPEN_HKPD 0x03
2002-07-15 10:35:28 +00:00
# define REG_OPEN_HKU 0x04
# define REG_CLOSE 0x05
2005-03-23 23:26:33 +00:00
# define REG_CREATE_KEY 0x06
# define REG_DELETE_KEY 0x07
# define REG_DELETE_VALUE 0x08
2002-07-15 10:35:28 +00:00
# define REG_ENUM_KEY 0x09
2002-08-17 17:00:51 +00:00
# define REG_ENUM_VALUE 0x0a
2005-03-23 23:26:33 +00:00
# define REG_FLUSH_KEY 0x0b
# define REG_GET_KEY_SEC 0x0c
2002-07-15 10:35:28 +00:00
# define REG_OPEN_ENTRY 0x0f
# define REG_QUERY_KEY 0x10
2005-06-24 14:55:09 +00:00
# define REG_QUERY_VALUE 0x11
2005-04-05 17:49:16 +00:00
# define REG_RESTORE_KEY 0x13
2005-03-23 23:26:33 +00:00
# define REG_SAVE_KEY 0x14
# define REG_SET_KEY_SEC 0x15
2005-04-07 04:58:38 +00:00
# define REG_SET_VALUE 0x16
2001-08-10 09:52:10 +00:00
# define REG_SHUTDOWN 0x18
# define REG_ABORT_SHUTDOWN 0x19
2005-03-23 23:26:33 +00:00
# define REG_GETVERSION 0x1a
# define REG_SHUTDOWN_EX 0x1e
2002-07-15 10:35:28 +00:00
2001-08-10 09:52:10 +00:00
# define HKEY_CLASSES_ROOT 0x80000000
# define HKEY_CURRENT_USER 0x80000001
# define HKEY_LOCAL_MACHINE 0x80000002
# define HKEY_USERS 0x80000003
2005-03-23 23:26:33 +00:00
# define HKEY_PERFORMANCE_DATA 0x80000004
2001-08-10 09:52:10 +00:00
2005-05-23 16:25:31 +00:00
# define KEY_HKLM "HKLM"
# define KEY_HKU "HKU"
# define KEY_HKCR "HKCR"
# define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
# define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print"
# define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
# define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
# define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
# define KEY_TREE_ROOT ""
2002-08-17 17:00:51 +00:00
2001-12-17 01:45:20 +00:00
/* Registry data types */
# define REG_NONE 0
# define REG_SZ 1
# define REG_EXPAND_SZ 2
# define REG_BINARY 3
# define REG_DWORD 4
# define REG_DWORD_LE 4 /* DWORD, little endian */
# define REG_DWORD_BE 5 /* DWORD, big endian */
# define REG_LINK 6
# define REG_MULTI_SZ 7
# define REG_RESOURCE_LIST 8
# define REG_FULL_RESOURCE_DESCRIPTOR 9
# define REG_RESOURCE_REQUIREMENTS_LIST 10
2001-11-22 05:56:09 +00:00
2002-08-17 17:00:51 +00:00
/*
* container for function pointers to enumeration routines
* for vitural registry view
*/
typedef struct {
/* functions for enumerating subkeys and values */
2005-06-25 17:31:40 +00:00
int ( * fetch_subkeys ) ( const char * key , REGSUBKEY_CTR * subkeys ) ;
int ( * fetch_values ) ( const char * key , REGVAL_CTR * val ) ;
BOOL ( * store_subkeys ) ( const char * key , REGSUBKEY_CTR * subkeys ) ;
BOOL ( * store_values ) ( const char * key , REGVAL_CTR * val ) ;
2005-06-17 01:57:18 +00:00
BOOL ( * reg_access_check ) ( const char * keyname , uint32 requested , uint32 * granted , NT_USER_TOKEN * token ) ;
2002-08-17 17:00:51 +00:00
} REGISTRY_OPS ;
typedef struct {
2003-01-03 08:28:12 +00:00
const char * keyname ; /* full path to name of key */
2002-08-17 17:00:51 +00:00
REGISTRY_OPS * ops ; /* registry function hooks */
} REGISTRY_HOOK ;
/* structure to store the registry handles */
typedef struct _RegistryKey {
struct _RegistryKey * prev , * next ;
2005-06-17 01:57:18 +00:00
pstring name ; /* full name of registry key */
uint32 access_granted ;
REGISTRY_HOOK * hook ;
2002-08-17 17:00:51 +00:00
} REGISTRY_KEY ;
2005-03-23 23:26:33 +00:00
/*
* RPC REGISTRY STRUCTURES
*/
2002-08-17 17:00:51 +00:00
2005-03-23 23:26:33 +00:00
/***********************************************/
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
uint16 * server ;
uint32 access ;
} REG_Q_OPEN_HIVE ;
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ;
WERROR status ;
} REG_R_OPEN_HIVE ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 22:03:34 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ;
1998-11-11 00:43:41 +00:00
} REG_Q_FLUSH_KEY ;
1998-11-10 22:03:34 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
WERROR status ;
1998-11-11 00:43:41 +00:00
} REG_R_FLUSH_KEY ;
1998-11-10 22:03:34 +00:00
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-11 21:44:02 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-24 22:34:40 +00:00
POLICY_HND handle ;
2005-03-23 23:26:33 +00:00
uint32 sec_info ;
uint32 ptr ;
BUFHDR hdr_sec ;
SEC_DESC_BUF * data ;
1998-11-11 21:44:02 +00:00
} REG_Q_SET_KEY_SEC ;
2005-03-23 23:26:33 +00:00
typedef struct {
2005-01-10 20:33:41 +00:00
WERROR status ;
1998-11-11 21:44:02 +00:00
} REG_R_SET_KEY_SEC ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-24 22:34:40 +00:00
POLICY_HND handle ;
2005-03-23 23:26:33 +00:00
uint32 sec_info ;
uint32 ptr ;
BUFHDR hdr_sec ;
SEC_DESC_BUF * data ;
1998-11-10 19:05:00 +00:00
} REG_Q_GET_KEY_SEC ;
2005-03-23 23:26:33 +00:00
typedef struct {
uint32 sec_info ;
uint32 ptr ;
BUFHDR hdr_sec ;
SEC_DESC_BUF * data ;
2005-01-10 20:33:41 +00:00
WERROR status ;
1998-11-10 19:05:00 +00:00
} REG_R_GET_KEY_SEC ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-17 15:35:31 +00:00
POLICY_HND handle ;
2005-03-23 23:26:33 +00:00
UNISTR4 name ;
uint32 type ;
2005-04-07 04:58:38 +00:00
RPC_DATA_BLOB value ;
uint32 size ;
} REG_Q_SET_VALUE ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
WERROR status ;
2005-04-07 04:58:38 +00:00
} REG_R_SET_VALUE ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
/***********************************************/
2002-08-17 17:00:51 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ;
uint32 val_index ;
UNISTR4 name ;
uint32 * type ;
REGVAL_BUFFER * value ; /* value, in byte buffer */
2005-05-23 16:25:31 +00:00
uint32 * buffer_len ;
uint32 * name_len ;
1998-11-10 19:05:00 +00:00
} REG_Q_ENUM_VALUE ;
2005-03-23 23:26:33 +00:00
typedef struct {
UNISTR4 name ;
uint32 * type ;
REGVAL_BUFFER * value ;
2005-05-23 16:25:31 +00:00
uint32 * buffer_len1 ;
uint32 * buffer_len2 ;
2005-03-23 23:26:33 +00:00
WERROR status ;
1998-11-10 19:05:00 +00:00
} REG_R_ENUM_VALUE ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-16 20:04:16 +00:00
POLICY_HND handle ;
2005-03-23 23:26:33 +00:00
UNISTR4 name ;
2005-06-24 20:25:18 +00:00
UNISTR4 key_class ;
2005-03-23 23:26:33 +00:00
uint32 reserved ;
uint32 access ;
uint32 * sec_info ;
uint32 ptr2 ;
BUFHDR hdr_sec ;
uint32 ptr3 ;
1998-11-13 01:38:41 +00:00
SEC_DESC_BUF * data ;
1998-11-10 19:05:00 +00:00
uint32 unknown_2 ; /* 0x0000 0000 */
} REG_Q_CREATE_KEY ;
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-17 15:35:31 +00:00
POLICY_HND handle ;
2005-03-23 23:26:33 +00:00
uint32 unknown ;
WERROR status ;
1998-11-10 19:05:00 +00:00
} REG_R_CREATE_KEY ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 22:14:05 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-16 20:04:16 +00:00
POLICY_HND handle ;
2005-03-23 23:26:33 +00:00
UNISTR4 name ;
1998-11-10 22:14:05 +00:00
} REG_Q_DELETE_KEY ;
2005-03-23 23:26:33 +00:00
typedef struct {
WERROR status ;
1998-11-10 22:14:05 +00:00
} REG_R_DELETE_KEY ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-11 00:57:13 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-16 20:04:16 +00:00
POLICY_HND handle ;
2005-03-23 23:26:33 +00:00
UNISTR4 name ;
1998-11-11 00:57:13 +00:00
} REG_Q_DELETE_VALUE ;
2005-03-23 23:26:33 +00:00
typedef struct {
WERROR status ;
1998-11-11 00:57:13 +00:00
} REG_R_DELETE_VALUE ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ;
2005-06-24 20:25:18 +00:00
UNISTR4 key_class ;
1998-11-10 19:05:00 +00:00
} REG_Q_QUERY_KEY ;
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-24 20:25:18 +00:00
UNISTR4 key_class ;
1998-11-10 19:05:00 +00:00
uint32 num_subkeys ;
uint32 max_subkeylen ;
2005-03-23 23:26:33 +00:00
uint32 reserved ; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */
1998-11-10 19:05:00 +00:00
uint32 num_values ;
uint32 max_valnamelen ;
uint32 max_valbufsize ;
2005-03-23 23:26:33 +00:00
uint32 sec_desc ; /* 0x0000 0078 */
NTTIME mod_time ; /* modified time */
WERROR status ;
1998-11-10 19:05:00 +00:00
} REG_R_QUERY_KEY ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-16 20:45:55 +00:00
POLICY_HND pol ;
2005-03-23 23:26:33 +00:00
} REG_Q_GETVERSION ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-16 20:45:55 +00:00
uint32 win_version ;
WERROR status ;
2005-03-23 23:26:33 +00:00
} REG_R_GETVERSION ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ;
UNISTR4 filename ;
2005-04-05 17:49:16 +00:00
uint32 flags ;
} REG_Q_RESTORE_KEY ;
typedef struct {
WERROR status ; /* return status */
} REG_R_RESTORE_KEY ;
/***********************************************/
2005-04-07 04:58:38 +00:00
/* I have no idea if this is correct since I
have not seen the full structure on the wire
as of yet */
typedef struct {
uint32 max_len ;
uint32 len ;
SEC_DESC * secdesc ;
} REG_SEC_DESC_BUF ;
typedef struct {
uint32 size ; /* size in bytes of security descriptor */
REG_SEC_DESC_BUF secdesc ;
uint8 inherit ; /* see MSDN for a description */
} SECURITY_ATTRIBUTE ;
2005-04-05 17:49:16 +00:00
typedef struct {
POLICY_HND pol ;
UNISTR4 filename ;
2005-04-07 04:58:38 +00:00
SECURITY_ATTRIBUTE * sec_attr ;
2002-08-17 17:00:51 +00:00
} REG_Q_SAVE_KEY ;
2005-03-23 23:26:33 +00:00
typedef struct {
2005-01-10 20:33:41 +00:00
WERROR status ; /* return status */
2002-08-17 17:00:51 +00:00
} REG_R_SAVE_KEY ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ; /* policy handle */
1998-03-11 21:11:04 +00:00
} REG_Q_CLOSE ;
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ;
WERROR status ;
1998-03-11 21:11:04 +00:00
} REG_R_CLOSE ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ;
1998-11-10 19:05:00 +00:00
uint32 key_index ;
2005-05-23 16:25:31 +00:00
uint16 key_name_len ;
1998-11-10 19:05:00 +00:00
uint16 unknown_1 ; /* 0x0414 */
2005-05-23 16:25:31 +00:00
uint32 ptr1 ;
1998-11-10 19:05:00 +00:00
uint32 unknown_2 ; /* 0x0000 020A */
2005-05-23 16:25:31 +00:00
uint8 pad1 [ 8 ] ;
uint32 ptr2 ;
uint8 pad2 [ 8 ] ;
uint32 ptr3 ;
NTTIME time ;
1998-11-10 19:05:00 +00:00
} REG_Q_ENUM_KEY ;
2005-03-23 23:26:33 +00:00
typedef struct {
2005-05-23 16:25:31 +00:00
UNISTR4 keyname ;
UNISTR4 * classname ;
NTTIME * time ;
2005-01-10 20:33:41 +00:00
WERROR status ; /* return status */
1998-11-10 19:05:00 +00:00
} REG_R_ENUM_KEY ;
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ; /* policy handle */
UNISTR4 name ;
1998-03-11 21:11:04 +00:00
2001-08-10 09:52:10 +00:00
uint32 ptr_reserved ; /* pointer */
2000-05-15 20:53:08 +00:00
2001-08-10 09:52:10 +00:00
uint32 ptr_buf ; /* the next three fields follow if ptr_buf != 0 */
uint32 ptr_bufsize ;
uint32 bufsize ;
uint32 buf_unk ;
uint32 unk1 ;
uint32 ptr_buflen ;
uint32 buflen ;
2000-05-15 20:53:08 +00:00
2001-08-10 09:52:10 +00:00
uint32 ptr_buflen2 ;
uint32 buflen2 ;
1998-03-11 21:11:04 +00:00
2005-06-24 14:55:09 +00:00
} REG_Q_QUERY_VALUE ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
uint32 * type ;
REGVAL_BUFFER * value ; /* key value */
uint32 * buf_max_len ;
uint32 * buf_len ;
2005-01-10 20:33:41 +00:00
WERROR status ; /* return status */
2005-06-24 14:55:09 +00:00
} REG_R_QUERY_VALUE ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
/***********************************************/
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
POLICY_HND pol ;
UNISTR4 name ;
1998-03-11 21:11:04 +00:00
uint32 unknown_0 ; /* 32 bit unknown - 0x0000 0000 */
2005-03-23 23:26:33 +00:00
uint32 access ;
1998-03-11 21:11:04 +00:00
} REG_Q_OPEN_ENTRY ;
2005-03-23 23:26:33 +00:00
typedef struct {
2005-06-17 01:57:18 +00:00
POLICY_HND handle ;
2005-03-23 23:26:33 +00:00
WERROR status ;
1998-03-11 21:11:04 +00:00
} REG_R_OPEN_ENTRY ;
2005-03-23 23:26:33 +00:00
/***********************************************/
typedef struct {
uint16 * server ;
UNISTR4 * message ;
uint32 timeout ; /* in seconds */
2003-01-04 07:50:04 +00:00
uint8 force ; /* boolean: force shutdown */
2005-03-23 23:26:33 +00:00
uint8 reboot ; /* boolean: reboot on shutdown */
2001-08-10 09:52:10 +00:00
} REG_Q_SHUTDOWN ;
2005-03-23 23:26:33 +00:00
typedef struct {
2005-01-10 20:33:41 +00:00
WERROR status ; /* return status */
2001-08-10 09:52:10 +00:00
} REG_R_SHUTDOWN ;
2005-03-23 23:26:33 +00:00
/***********************************************/
typedef struct {
uint16 * server ;
UNISTR4 * message ;
uint32 timeout ; /* in seconds */
uint8 force ; /* boolean: force shutdown */
uint8 reboot ; /* boolean: reboot on shutdown */
uint32 reason ; /* reason - must be defined code */
} REG_Q_SHUTDOWN_EX ;
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
WERROR status ;
} REG_R_SHUTDOWN_EX ;
/***********************************************/
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
uint16 * server ;
} REG_Q_ABORT_SHUTDOWN ;
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
typedef struct {
WERROR status ;
2001-08-10 09:52:10 +00:00
} REG_R_ABORT_SHUTDOWN ;
1998-03-11 21:11:04 +00:00
# endif /* _RPC_REG_H */