2002-08-17 17:00:51 +00:00
/*
2002-01-30 06:08:46 +00:00
* Unix SMB / CIFS implementation .
1998-03-11 21:11:04 +00:00
* RPC Pipe client / server routines
1999-12-13 13:27:58 +00:00
* Copyright ( C ) Andrew Tridgell 1992 - 1997 ,
* Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1997 ,
* Copyright ( C ) Paul Ashton 1997.
2001-08-10 09:52:10 +00:00
* Copyright ( C ) Marc Jacobsen 1999.
* Copyright ( C ) Simo Sorce 2000.
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 .
*/
# include "includes.h"
2002-07-15 10:35:28 +00:00
# undef DBGC_CLASS
# define DBGC_CLASS DBGC_RPC_PARSE
2002-08-17 17:00:51 +00:00
/*******************************************************************
2005-03-23 23:26:33 +00:00
Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE
2002-08-17 17:00:51 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-09-30 17:13:37 +00:00
uint32 reg_init_regval_buffer ( REGVAL_BUFFER * buf2 , REGISTRY_VALUE * val )
2002-08-17 17:00:51 +00:00
{
uint32 real_size = 0 ;
if ( ! buf2 | | ! val )
return 0 ;
2002-09-25 15:19:00 +00:00
real_size = regval_size ( val ) ;
2005-03-23 23:26:33 +00:00
init_regval_buffer ( buf2 , ( unsigned char * ) regval_data_p ( val ) , real_size ) ;
2002-08-17 17:00:51 +00:00
return real_size ;
}
1999-10-29 16:24:11 +00:00
/*******************************************************************
2005-03-23 23:26:33 +00:00
Inits a hive connect request structure
1999-10-29 16:24:11 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
void init_reg_q_open_hive ( REG_Q_OPEN_HIVE * q_o , uint32 access_desired )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
q_o - > server = TALLOC_P ( get_talloc_ctx ( ) , uint16 ) ;
* q_o - > server = 0x1 ;
q_o - > access = access_desired ;
1998-11-10 19:05:00 +00:00
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
2005-03-23 23:26:33 +00:00
Marshalls a hive connect request
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_open_hive ( const char * desc , REG_Q_OPEN_HIVE * q_u ,
prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2005-03-23 23:26:33 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_open_hive " ) ;
1998-03-11 21:11:04 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " server " , ps , depth , ( void * * ) & q_u - > server , sizeof ( uint16 ) , ( PRS_POINTER_CAST ) prs_uint16 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " access " , ps , depth , & q_u - > access ) )
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
2005-03-23 23:26:33 +00:00
Unmarshalls a hive connect response
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_open_hive ( const char * desc , REG_R_OPEN_HIVE * r_u ,
prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_open_hive " ) ;
1998-03-11 21:11:04 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & r_u - > pol , ps , depth ) )
2001-08-10 09:52:10 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
2001-08-10 09:52:10 +00:00
return False ;
return True ;
}
1998-11-10 22:03:34 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits a structure .
1998-11-10 22:03:34 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-10-15 18:46:22 +00:00
1999-12-13 13:27:58 +00:00
void init_reg_q_flush_key ( REG_Q_FLUSH_KEY * q_u , POLICY_HND * pol )
{
memcpy ( & q_u - > pol , pol , sizeof ( q_u - > pol ) ) ;
1998-11-10 22:03:34 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_flush_key ( const char * desc , REG_Q_FLUSH_KEY * q_u , prs_struct * ps , int depth )
1998-11-10 22:03:34 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:03:34 +00:00
1998-11-11 00:43:41 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_flush_key " ) ;
1998-11-10 22:03:34 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:03:34 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 22:03:34 +00:00
}
/*******************************************************************
2005-03-23 23:26:33 +00:00
Unmarshalls a registry key flush response
1998-11-10 22:03:34 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_flush_key ( const char * desc , REG_R_FLUSH_KEY * r_u ,
prs_struct * ps , int depth )
1998-11-10 22:03:34 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:03:34 +00:00
1998-11-11 00:43:41 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_flush_key " ) ;
1998-11-10 22:03:34 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:03:34 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 22:03:34 +00:00
}
1998-11-13 01:38:41 +00:00
/*******************************************************************
reads or writes SEC_DESC_BUF and SEC_DATA structures .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
static BOOL reg_io_hdrbuf_sec ( uint32 ptr , uint32 * ptr3 , BUFHDR * hdr_sec ,
SEC_DESC_BUF * data , prs_struct * ps , int depth )
1998-11-13 01:38:41 +00:00
{
1999-12-13 13:27:58 +00:00
if ( ptr ! = 0 ) {
1998-11-13 01:38:41 +00:00
uint32 hdr_offset ;
uint32 old_offset ;
2005-03-23 23:26:33 +00:00
if ( ! smb_io_hdrbuf_pre ( " hdr_sec " , hdr_sec , ps , depth ,
& hdr_offset ) )
1999-12-13 13:27:58 +00:00
return False ;
old_offset = prs_offset ( ps ) ;
if ( ptr3 ! = NULL ) {
if ( ! prs_uint32 ( " ptr3 " , ps , depth , ptr3 ) )
return False ;
1998-11-13 01:38:41 +00:00
}
1999-12-13 13:27:58 +00:00
if ( ptr3 = = NULL | | * ptr3 ! = 0 ) {
2005-03-23 23:26:33 +00:00
/* JRA - this next line is probably wrong... */
if ( ! sec_io_desc_buf ( " data " , & data , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-13 01:38:41 +00:00
}
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_hdrbuf_post ( " hdr_sec " , hdr_sec , ps , depth ,
hdr_offset , data - > max_len , data - > len ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_set_offset ( ps , old_offset + data - > len +
sizeof ( uint32 ) * ( ( ptr3 ! = NULL ) ? 5 : 3 ) ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-13 01:38:41 +00:00
}
1999-10-15 18:46:22 +00:00
return True ;
1998-11-13 01:38:41 +00:00
}
1998-11-10 19:05:00 +00:00
/*******************************************************************
2005-03-23 23:26:33 +00:00
Inits a registry key create request
1998-11-10 19:05:00 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-29 16:35:32 +00:00
void init_reg_q_create_key_ex ( REG_Q_CREATE_KEY_EX * q_c , POLICY_HND * hnd ,
2005-06-24 20:25:18 +00:00
char * name , char * key_class , uint32 access_desired ,
2005-03-23 23:26:33 +00:00
SEC_DESC_BUF * sec_buf )
1998-11-10 19:05:00 +00:00
{
ZERO_STRUCTP ( q_c ) ;
2005-06-16 20:04:16 +00:00
memcpy ( & q_c - > handle , hnd , sizeof ( q_c - > handle ) ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
init_unistr4 ( & q_c - > name , name , UNI_STR_TERMINATE ) ;
2005-06-24 20:25:18 +00:00
init_unistr4 ( & q_c - > key_class , key_class , UNI_STR_TERMINATE ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_c - > access = access_desired ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_c - > sec_info = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* q_c - > sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION ;
1998-11-10 19:05:00 +00:00
1998-11-13 01:38:41 +00:00
q_c - > data = sec_buf ;
1998-11-10 19:05:00 +00:00
q_c - > ptr2 = 1 ;
1999-12-13 13:27:58 +00:00
init_buf_hdr ( & q_c - > hdr_sec , sec_buf - > len , sec_buf - > len ) ;
1998-11-13 01:38:41 +00:00
q_c - > ptr3 = 1 ;
2005-09-01 13:57:10 +00:00
q_c - > disposition = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
2005-03-23 23:26:33 +00:00
Marshalls a registry key create request
1998-11-10 19:05:00 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-29 16:35:32 +00:00
BOOL reg_io_q_create_key_ex ( const char * desc , REG_Q_CREATE_KEY_EX * q_u ,
2005-03-23 23:26:33 +00:00
prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-29 16:35:32 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_create_key_ex " ) ;
1998-11-10 19:05:00 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-16 20:04:16 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > handle , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " name " , ps , depth , & q_u - > name ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-06-24 20:25:18 +00:00
if ( ! prs_unistr4 ( " key_class " , ps , depth , & q_u - > key_class ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-09-01 13:57:10 +00:00
if ( ! prs_uint32 ( " options " , ps , depth , & q_u - > options ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " access " , ps , depth , & q_u - > access ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " sec_info " , ps , depth , ( void * * ) & q_u - > sec_info , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-09-01 13:57:10 +00:00
if ( q_u - > sec_info ) {
if ( ! prs_uint32 ( " ptr2 " , ps , depth , & q_u - > ptr2 ) )
return False ;
if ( ! reg_io_hdrbuf_sec ( q_u - > ptr2 , & q_u - > ptr3 , & q_u - > hdr_sec , q_u - > data , ps , depth ) )
return False ;
}
1998-11-10 19:05:00 +00:00
2005-09-01 13:57:10 +00:00
if ( ! prs_pointer ( " disposition " , ps , depth , ( void * * ) & q_u - > disposition , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
2005-03-23 23:26:33 +00:00
Unmarshalls a registry key create response
1998-11-10 19:05:00 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-29 16:35:32 +00:00
BOOL reg_io_r_create_key_ex ( const char * desc , REG_R_CREATE_KEY_EX * r_u ,
2005-03-23 23:26:33 +00:00
prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-29 16:35:32 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_create_key_ex " ) ;
1998-11-10 19:05:00 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-17 15:35:31 +00:00
if ( ! smb_io_pol_hnd ( " " , & r_u - > handle , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-06-29 16:35:32 +00:00
if ( ! prs_uint32 ( " disposition " , ps , depth , & r_u - > disposition ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
1998-11-11 00:57:13 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits a structure .
1998-11-11 00:57:13 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_reg_q_delete_val ( REG_Q_DELETE_VALUE * q_c , POLICY_HND * hnd ,
2005-03-23 23:26:33 +00:00
char * name )
1998-11-11 00:57:13 +00:00
{
ZERO_STRUCTP ( q_c ) ;
2005-06-16 20:04:16 +00:00
memcpy ( & q_c - > handle , hnd , sizeof ( q_c - > handle ) ) ;
2005-03-23 23:26:33 +00:00
init_unistr4 ( & q_c - > name , name , UNI_STR_TERMINATE ) ;
1998-11-11 00:57:13 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-16 20:59:39 +00:00
BOOL reg_io_q_delete_value ( const char * desc , REG_Q_DELETE_VALUE * q_u ,
2005-03-23 23:26:33 +00:00
prs_struct * ps , int depth )
1998-11-11 00:57:13 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-11 00:57:13 +00:00
2005-06-16 20:59:39 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_delete_value " ) ;
1998-11-11 00:57:13 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-11 00:57:13 +00:00
2005-06-16 20:04:16 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > handle , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-11 00:57:13 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " name " , ps , depth , & q_u - > name ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-11 00:57:13 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-16 20:59:39 +00:00
BOOL reg_io_r_delete_value ( const char * desc , REG_R_DELETE_VALUE * r_u ,
2005-03-23 23:26:33 +00:00
prs_struct * ps , int depth )
1998-11-11 00:57:13 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-11 00:57:13 +00:00
2005-06-16 20:59:39 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_delete_value " ) ;
1998-11-11 00:57:13 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-11 00:57:13 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-11 00:57:13 +00:00
}
1998-11-10 22:14:05 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits a structure .
1998-11-10 22:14:05 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_reg_q_delete_key ( REG_Q_DELETE_KEY * q_c , POLICY_HND * hnd ,
2005-03-23 23:26:33 +00:00
char * name )
1998-11-10 22:14:05 +00:00
{
ZERO_STRUCTP ( q_c ) ;
2005-06-16 20:04:16 +00:00
memcpy ( & q_c - > handle , hnd , sizeof ( q_c - > handle ) ) ;
1998-11-10 22:14:05 +00:00
2005-03-23 23:26:33 +00:00
init_unistr4 ( & q_c - > name , name , UNI_STR_TERMINATE ) ;
1998-11-10 22:14:05 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_delete_key ( const char * desc , REG_Q_DELETE_KEY * q_u ,
prs_struct * ps , int depth )
1998-11-10 22:14:05 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:14:05 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_delete_key " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:14:05 +00:00
2005-06-16 20:04:16 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > handle , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:14:05 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " " , ps , depth , & q_u - > name ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 22:14:05 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_delete_key ( const char * desc , REG_R_DELETE_KEY * r_u , prs_struct * ps , int depth )
1998-11-10 22:14:05 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:14:05 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_delete_key " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 22:14:05 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 22:14:05 +00:00
}
1998-11-10 19:05:00 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits a structure .
1998-11-10 19:05:00 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-24 20:25:18 +00:00
void init_reg_q_query_key ( REG_Q_QUERY_KEY * q_o , POLICY_HND * hnd , const char * key_class )
1998-11-10 19:05:00 +00:00
{
ZERO_STRUCTP ( q_o ) ;
1999-12-13 13:27:58 +00:00
memcpy ( & q_o - > pol , hnd , sizeof ( q_o - > pol ) ) ;
2005-06-24 20:25:18 +00:00
init_unistr4 ( & q_o - > key_class , key_class , UNI_STR_TERMINATE ) ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_query_key ( const char * desc , REG_Q_QUERY_KEY * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_query_key " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-06-24 20:25:18 +00:00
if ( ! prs_unistr4 ( " key_class " , ps , depth , & q_u - > key_class ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_query_key ( const char * desc , REG_R_QUERY_KEY * r_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_query_key " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-24 20:25:18 +00:00
if ( ! prs_unistr4 ( " key_class " , ps , depth , & r_u - > key_class ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " num_subkeys " , ps , depth , & r_u - > num_subkeys ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " max_subkeylen " , ps , depth , & r_u - > max_subkeylen ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " reserved " , ps , depth , & r_u - > reserved ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " num_values " , ps , depth , & r_u - > num_values ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " max_valnamelen " , ps , depth , & r_u - > max_valnamelen ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " max_valbufsize " , ps , depth , & r_u - > max_valbufsize ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " sec_desc " , ps , depth , & r_u - > sec_desc ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! smb_io_time ( " mod_time " , & r_u - > mod_time , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2002-08-17 17:00:51 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits a structure .
1998-11-10 19:05:00 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-10-15 18:46:22 +00:00
2005-03-23 23:26:33 +00:00
void init_reg_q_getversion ( REG_Q_GETVERSION * q_o , POLICY_HND * hnd )
1999-12-13 13:27:58 +00:00
{
memcpy ( & q_o - > pol , hnd , sizeof ( q_o - > pol ) ) ;
1998-11-10 19:05:00 +00:00
}
2002-08-17 17:00:51 +00:00
1998-11-10 19:05:00 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_getversion ( const char * desc , REG_Q_GETVERSION * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_getversion " ) ;
1998-11-10 19:05:00 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2002-08-17 17:00:51 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_getversion ( const char * desc , REG_R_GETVERSION * r_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_getversion " ) ;
1998-11-10 19:05:00 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2002-08-17 17:00:51 +00:00
2005-06-16 20:59:39 +00:00
if ( ! prs_uint32 ( " win_version " , ps , depth , & r_u - > win_version ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
2002-08-17 17:00:51 +00:00
2005-04-05 17:49:16 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL reg_io_q_restore_key ( const char * desc , REG_Q_RESTORE_KEY * q_u , prs_struct * ps , int depth )
{
if ( ! q_u )
return False ;
prs_debug ( ps , depth , desc , " reg_io_q_restore_key " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
return False ;
if ( ! prs_unistr4 ( " filename " , ps , depth , & q_u - > filename ) )
return False ;
if ( ! prs_uint32 ( " flags " , ps , depth , & q_u - > flags ) )
return False ;
return True ;
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL reg_io_r_restore_key ( const char * desc , REG_R_RESTORE_KEY * r_u , prs_struct * ps , int depth )
{
if ( ! r_u )
return False ;
prs_debug ( ps , depth , desc , " reg_io_r_restore_key " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
return False ;
return True ;
}
2005-05-26 20:36:04 +00:00
/*******************************************************************
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void init_q_reg_save_key ( REG_Q_SAVE_KEY * q_u , POLICY_HND * handle , const char * fname )
{
memcpy ( & q_u - > pol , handle , sizeof ( q_u - > pol ) ) ;
init_unistr4 ( & q_u - > filename , fname , UNI_STR_TERMINATE ) ;
q_u - > sec_attr = NULL ;
}
2002-08-17 17:00:51 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_save_key ( const char * desc , REG_Q_SAVE_KEY * q_u , prs_struct * ps , int depth )
2002-08-17 17:00:51 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
2002-08-17 17:00:51 +00:00
return False ;
prs_debug ( ps , depth , desc , " reg_io_q_save_key " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
2002-08-17 17:00:51 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " filename " , ps , depth , & q_u - > filename ) )
2002-08-17 17:00:51 +00:00
return False ;
2005-04-07 04:58:38 +00:00
#if 0 /* reg_io_sec_attr() */
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " unknown " , ps , depth , & q_u - > unknown ) )
2002-08-17 17:00:51 +00:00
return False ;
2005-04-07 04:58:38 +00:00
# endif
2002-08-17 17:00:51 +00:00
return True ;
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_save_key ( const char * desc , REG_R_SAVE_KEY * r_u , prs_struct * ps , int depth )
2002-08-17 17:00:51 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
2002-08-17 17:00:51 +00:00
return False ;
prs_debug ( ps , depth , desc , " reg_io_r_save_key " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits an REG_Q_CLOSE structure .
1998-11-10 19:05:00 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_reg_q_close ( REG_Q_CLOSE * q_c , POLICY_HND * hnd )
{
DEBUG ( 5 , ( " init_reg_q_close \n " ) ) ;
1999-10-15 18:46:22 +00:00
1999-12-13 13:27:58 +00:00
memcpy ( & q_c - > pol , hnd , sizeof ( q_c - > pol ) ) ;
1998-11-10 19:05:00 +00:00
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
BOOL reg_io_q_close ( const char * desc , REG_Q_CLOSE * q_u , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
1999-12-13 13:27:58 +00:00
if ( q_u = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
2002-07-15 10:35:28 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_close " ) ;
1998-03-11 21:11:04 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
BOOL reg_io_r_close ( const char * desc , REG_R_CLOSE * r_u , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2002-07-15 10:35:28 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_close " ) ;
1998-03-11 21:11:04 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
if ( ! smb_io_pol_hnd ( " " , & r_u - > pol , ps , depth ) )
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-01-10 20:33:41 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
1998-11-12 16:03:35 +00:00
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
void init_reg_q_set_key_sec ( REG_Q_SET_KEY_SEC * q_u , POLICY_HND * pol ,
uint32 sec_info , SEC_DESC_BUF * sec_desc_buf )
1999-12-13 13:27:58 +00:00
{
2005-06-24 22:34:40 +00:00
memcpy ( & q_u - > handle , pol , sizeof ( q_u - > handle ) ) ;
1998-11-12 16:03:35 +00:00
2005-03-23 23:26:33 +00:00
q_u - > sec_info = sec_info ;
1998-11-12 16:03:35 +00:00
2005-03-23 23:26:33 +00:00
q_u - > ptr = 1 ;
init_buf_hdr ( & q_u - > hdr_sec , sec_desc_buf - > len , sec_desc_buf - > len ) ;
q_u - > data = sec_desc_buf ;
1998-11-12 16:03:35 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_set_key_sec ( const char * desc , REG_Q_SET_KEY_SEC * q_u , prs_struct * ps , int depth )
1998-11-12 16:03:35 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-12 16:03:35 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_set_key_sec " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-12 16:03:35 +00:00
2005-06-24 22:34:40 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > handle , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-12 16:03:35 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " sec_info " , ps , depth , & q_u - > sec_info ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & q_u - > ptr ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-12 16:03:35 +00:00
2005-03-23 23:26:33 +00:00
if ( ! reg_io_hdrbuf_sec ( q_u - > ptr , NULL , & q_u - > hdr_sec , q_u - > data , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-12 16:03:35 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_set_key_sec ( const char * desc , REG_R_SET_KEY_SEC * q_u , prs_struct * ps , int depth )
1998-11-12 16:03:35 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-12 16:03:35 +00:00
1998-11-12 19:21:20 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_set_key_sec " ) ;
1998-11-12 16:03:35 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-12 16:03:35 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & q_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-12 16:03:35 +00:00
}
1998-11-10 19:05:00 +00:00
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
void init_reg_q_get_key_sec ( REG_Q_GET_KEY_SEC * q_u , POLICY_HND * pol ,
uint32 sec_info , uint32 sec_buf_size ,
SEC_DESC_BUF * psdb )
1999-12-13 13:27:58 +00:00
{
2005-06-24 22:34:40 +00:00
memcpy ( & q_u - > handle , pol , sizeof ( q_u - > handle ) ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > sec_info = sec_info ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > ptr = psdb ! = NULL ? 1 : 0 ;
q_u - > data = psdb ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
init_buf_hdr ( & q_u - > hdr_sec , sec_buf_size , 0 ) ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_get_key_sec ( const char * desc , REG_Q_GET_KEY_SEC * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_get_key_sec " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-24 22:34:40 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > handle , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " sec_info " , ps , depth , & q_u - > sec_info ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & q_u - > ptr ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! reg_io_hdrbuf_sec ( q_u - > ptr , NULL , & q_u - > hdr_sec , q_u - > data , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
1998-11-11 19:22:08 +00:00
#if 0
1998-11-10 19:05:00 +00:00
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_reg_r_get_key_sec ( REG_R_GET_KEY_SEC * r_i , POLICY_HND * pol ,
1998-11-10 19:05:00 +00:00
uint32 buf_len , uint8 * buf ,
2001-08-27 19:46:22 +00:00
NTSTATUS status )
1998-11-10 19:05:00 +00:00
{
r_i - > ptr = 1 ;
1999-12-13 13:27:58 +00:00
init_buf_hdr ( & r_i - > hdr_sec , buf_len , buf_len ) ;
init_sec_desc_buf ( r_i - > data , buf_len , 1 ) ;
1998-11-10 19:05:00 +00:00
r_i - > status = status ; /* 0x0000 0000 or 0x0000 007a */
}
1998-11-11 19:22:08 +00:00
# endif
1998-11-10 19:05:00 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_get_key_sec ( const char * desc , REG_R_GET_KEY_SEC * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_get_key_sec " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & q_u - > ptr ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( q_u - > ptr ! = 0 ) {
if ( ! smb_io_hdrbuf ( " " , & q_u - > hdr_sec , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! sec_io_desc_buf ( " " , & q_u - > data , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
}
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & q_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-06-24 14:55:09 +00:00
BOOL init_reg_q_query_value ( REG_Q_QUERY_VALUE * q_u , POLICY_HND * pol , const char * val_name ,
2005-03-23 23:26:33 +00:00
REGVAL_BUFFER * value_output )
1999-12-13 13:27:58 +00:00
{
2005-03-23 23:26:33 +00:00
if ( q_u = = NULL )
2000-05-15 20:53:08 +00:00
return False ;
2005-03-23 23:26:33 +00:00
q_u - > pol = * pol ;
2000-05-15 20:53:08 +00:00
2005-03-23 23:26:33 +00:00
init_unistr4 ( & q_u - > name , val_name , UNI_STR_TERMINATE ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > ptr_reserved = 1 ;
q_u - > ptr_buf = 1 ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > ptr_bufsize = 1 ;
q_u - > bufsize = value_output - > buf_max_len ;
q_u - > buf_unk = 0 ;
1999-11-18 00:26:11 +00:00
2005-03-23 23:26:33 +00:00
q_u - > unk1 = 0 ;
q_u - > ptr_buflen = 1 ;
q_u - > buflen = value_output - > buf_max_len ;
1999-10-15 18:46:22 +00:00
2005-03-23 23:26:33 +00:00
q_u - > ptr_buflen2 = 1 ;
q_u - > buflen2 = 0 ;
2000-05-15 20:53:08 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-24 14:55:09 +00:00
BOOL reg_io_q_query_value ( const char * desc , REG_Q_QUERY_VALUE * q_u , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-06-24 14:55:09 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_query_value " ) ;
1998-03-11 21:11:04 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " name " , ps , depth , & q_u - > name ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr_reserved " , ps , depth , & ( q_u - > ptr_reserved ) ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr_buf " , ps , depth , & ( q_u - > ptr_buf ) ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( q_u - > ptr_buf ) {
if ( ! prs_uint32 ( " ptr_bufsize " , ps , depth , & ( q_u - > ptr_bufsize ) ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " bufsize " , ps , depth , & ( q_u - > bufsize ) ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " buf_unk " , ps , depth , & ( q_u - > buf_unk ) ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
}
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " unk1 " , ps , depth , & ( q_u - > unk1 ) ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr_buflen " , ps , depth , & ( q_u - > ptr_buflen ) ) )
2000-05-15 20:53:08 +00:00
return False ;
1999-10-15 18:46:22 +00:00
2005-03-23 23:26:33 +00:00
if ( q_u - > ptr_buflen ) {
if ( ! prs_uint32 ( " buflen " , ps , depth , & ( q_u - > buflen ) ) )
2002-07-15 10:35:28 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr_buflen2 " , ps , depth , & ( q_u - > ptr_buflen2 ) ) )
2002-07-15 10:35:28 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " buflen2 " , ps , depth , & ( q_u - > buflen2 ) ) )
2002-07-15 10:35:28 +00:00
return False ;
}
2000-05-15 20:53:08 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
2002-08-17 17:00:51 +00:00
/*******************************************************************
Inits a structure .
2005-06-24 14:55:09 +00:00
New version to replace older init_reg_r_query_value ( )
2002-08-17 17:00:51 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-06-24 14:55:09 +00:00
BOOL init_reg_r_query_value ( uint32 include_keyval , REG_R_QUERY_VALUE * r_u ,
2005-01-10 20:33:41 +00:00
REGISTRY_VALUE * val , WERROR status )
2002-08-17 17:00:51 +00:00
{
2005-03-23 23:26:33 +00:00
uint32 buf_len = 0 ;
REGVAL_BUFFER buf2 ;
2002-08-17 17:00:51 +00:00
2005-03-23 23:26:33 +00:00
if ( ! r_u | | ! val )
2002-08-17 17:00:51 +00:00
return False ;
2005-03-23 23:26:33 +00:00
r_u - > type = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* r_u - > type = val - > type ;
2002-08-17 17:00:51 +00:00
2005-03-23 23:26:33 +00:00
buf_len = reg_init_regval_buffer ( & buf2 , val ) ;
2002-08-17 17:00:51 +00:00
2005-03-23 23:26:33 +00:00
r_u - > buf_max_len = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* r_u - > buf_max_len = buf_len ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
r_u - > buf_len = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* r_u - > buf_len = buf_len ;
2002-08-17 17:00:51 +00:00
/* if include_keyval is not set, don't send the key value, just
the buflen data . probably used by NT5 to allocate buffer space - SK */
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( include_keyval ) {
r_u - > value = TALLOC_P ( get_talloc_ctx ( ) , REGVAL_BUFFER ) ;
/* steal the memory */
* r_u - > value = buf2 ;
}
2000-05-15 20:53:08 +00:00
2005-03-23 23:26:33 +00:00
r_u - > status = status ;
2002-08-17 17:00:51 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-24 14:55:09 +00:00
BOOL reg_io_r_query_value ( const char * desc , REG_R_QUERY_VALUE * r_u , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-06-24 14:55:09 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_query_value " ) ;
1998-03-11 21:11:04 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " type " , ps , depth , ( void * * ) & r_u - > type , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " value " , ps , depth , ( void * * ) & r_u - > value , sizeof ( REGVAL_BUFFER ) , ( PRS_POINTER_CAST ) smb_io_regval_buffer ) )
2000-05-15 20:53:08 +00:00
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " buf_max_len " , ps , depth , ( void * * ) & r_u - > buf_max_len , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
2000-05-15 20:53:08 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " buf_len " , ps , depth , ( void * * ) & r_u - > buf_len , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
2000-05-15 20:53:08 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
2000-05-15 20:53:08 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
1998-11-10 19:05:00 +00:00
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
void init_reg_q_enum_val ( REG_Q_ENUM_VALUE * q_u , POLICY_HND * pol ,
2005-05-23 16:25:31 +00:00
uint32 val_idx ,
uint32 max_name_len , uint32 max_buf_len )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
ZERO_STRUCTP ( q_u ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
memcpy ( & q_u - > pol , pol , sizeof ( q_u - > pol ) ) ;
q_u - > val_index = val_idx ;
1998-11-10 19:05:00 +00:00
2005-05-23 16:25:31 +00:00
q_u - > name . size = max_name_len * 2 ;
q_u - > name . string = TALLOC_ZERO_P ( get_talloc_ctx ( ) , UNISTR2 ) ;
q_u - > name . string - > uni_max_len = max_name_len ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > type = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* q_u - > type = 0x0 ;
1998-11-10 19:05:00 +00:00
2005-05-23 16:25:31 +00:00
q_u - > value = TALLOC_ZERO_P ( get_talloc_ctx ( ) , REGVAL_BUFFER ) ;
2005-03-23 23:26:33 +00:00
q_u - > value - > buf_max_len = max_buf_len ;
1998-11-10 19:05:00 +00:00
2005-05-23 16:25:31 +00:00
q_u - > buffer_len = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* q_u - > buffer_len = max_buf_len ;
1998-11-10 19:05:00 +00:00
2005-05-23 16:25:31 +00:00
q_u - > name_len = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* q_u - > name_len = 0x0 ;
1998-11-10 19:05:00 +00:00
}
2002-08-17 17:00:51 +00:00
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void init_reg_r_enum_val ( REG_R_ENUM_VALUE * r_u , REGISTRY_VALUE * val )
{
uint32 real_size ;
ZERO_STRUCTP ( r_u ) ;
/* value name */
DEBUG ( 10 , ( " init_reg_r_enum_val: Valuename => [%s] \n " , val - > valuename ) ) ;
2005-03-23 23:26:33 +00:00
init_unistr4 ( & r_u - > name , val - > valuename , UNI_STR_TERMINATE ) ;
2002-08-17 17:00:51 +00:00
/* type */
2005-03-23 23:26:33 +00:00
r_u - > type = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* r_u - > type = val - > type ;
2002-08-17 17:00:51 +00:00
/* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */
2005-03-23 23:26:33 +00:00
r_u - > value = TALLOC_P ( get_talloc_ctx ( ) , REGVAL_BUFFER ) ;
real_size = reg_init_regval_buffer ( r_u - > value , val ) ;
2002-08-17 17:00:51 +00:00
/* lengths */
2005-05-23 16:25:31 +00:00
r_u - > buffer_len1 = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* r_u - > buffer_len1 = real_size ;
r_u - > buffer_len2 = TALLOC_P ( get_talloc_ctx ( ) , uint32 ) ;
* r_u - > buffer_len2 = real_size ;
2002-08-17 17:00:51 +00:00
}
1998-11-10 19:05:00 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_enum_val ( const char * desc , REG_Q_ENUM_VALUE * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( q_u = = NULL )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_enum_val " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " val_index " , ps , depth , & q_u - > val_index ) )
1999-12-13 13:27:58 +00:00
return False ;
2002-08-17 17:00:51 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " name " , ps , depth , & q_u - > name ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " type " , ps , depth , ( void * * ) & q_u - > type , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " value " , ps , depth , ( void * * ) & q_u - > value , sizeof ( REGVAL_BUFFER ) , ( PRS_POINTER_CAST ) smb_io_regval_buffer ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_pointer ( " buffer_len " , ps , depth , ( void * * ) & q_u - > buffer_len , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_pointer ( " name_len " , ps , depth , ( void * * ) & q_u - > name_len , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_enum_val ( const char * desc , REG_R_ENUM_VALUE * r_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_enum_val " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " name " , ps , depth , & r_u - > name ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " type " , ps , depth , ( void * * ) & r_u - > type , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " value " , ps , depth , ( void * * ) & r_u - > value , sizeof ( REGVAL_BUFFER ) , ( PRS_POINTER_CAST ) smb_io_regval_buffer ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_pointer ( " buffer_len1 " , ps , depth , ( void * * ) & r_u - > buffer_len1 , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_pointer ( " buffer_len2 " , ps , depth , ( void * * ) & r_u - > buffer_len2 , sizeof ( uint32 ) , ( PRS_POINTER_CAST ) prs_uint32 ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-04-07 04:58:38 +00:00
void init_reg_q_set_val ( REG_Q_SET_VALUE * q_u , POLICY_HND * pol ,
1998-11-10 19:05:00 +00:00
char * val_name , uint32 type ,
2005-04-07 04:58:38 +00:00
RPC_DATA_BLOB * val )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
ZERO_STRUCTP ( q_u ) ;
1998-11-10 19:05:00 +00:00
2005-06-17 15:35:31 +00:00
memcpy ( & q_u - > handle , pol , sizeof ( q_u - > handle ) ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
init_unistr4 ( & q_u - > name , val_name , UNI_STR_TERMINATE ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > type = type ;
2005-04-07 04:58:38 +00:00
q_u - > value = * val ;
q_u - > size = val - > buf_len ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-16 20:04:16 +00:00
BOOL reg_io_q_set_value ( const char * desc , REG_Q_SET_VALUE * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( q_u = = NULL )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-16 20:59:39 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_set_value " ) ;
1998-11-10 19:05:00 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-17 15:35:31 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > handle , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " name " , ps , depth , & q_u - > name ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " type " , ps , depth , & q_u - > type ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-04-07 04:58:38 +00:00
if ( ! smb_io_rpc_blob ( " value " , & q_u - > value , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
2005-04-07 04:58:38 +00:00
if ( ! prs_uint32 ( " size " , ps , depth , & q_u - > size ) )
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-06-16 20:04:16 +00:00
BOOL reg_io_r_set_value ( const char * desc , REG_R_SET_VALUE * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-06-16 20:59:39 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_set_value " ) ;
1998-11-10 19:05:00 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & q_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
void init_reg_q_enum_key ( REG_Q_ENUM_KEY * q_u , POLICY_HND * pol , uint32 key_idx )
1999-12-13 13:27:58 +00:00
{
2005-03-23 23:26:33 +00:00
memcpy ( & q_u - > pol , pol , sizeof ( q_u - > pol ) ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > key_index = key_idx ;
q_u - > key_name_len = 0 ;
q_u - > unknown_1 = 0x0414 ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > ptr1 = 1 ;
q_u - > unknown_2 = 0x0000020A ;
memset ( q_u - > pad1 , 0 , sizeof ( q_u - > pad1 ) ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > ptr2 = 1 ;
memset ( q_u - > pad2 , 0 , sizeof ( q_u - > pad2 ) ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > ptr3 = 1 ;
unix_to_nt_time ( & q_u - > time , 0 ) ; /* current time? */
1998-11-10 19:05:00 +00:00
}
2002-07-15 10:35:28 +00:00
/*******************************************************************
makes a reply structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-05-23 16:25:31 +00:00
void init_reg_r_enum_key ( REG_R_ENUM_KEY * r_u , char * subkey )
2002-07-15 10:35:28 +00:00
{
if ( ! r_u )
return ;
2005-07-19 10:15:10 +00:00
init_unistr4 ( & r_u - > keyname , subkey , UNI_STR_TERMINATE ) ;
2005-05-23 16:25:31 +00:00
r_u - > classname = TALLOC_ZERO_P ( get_talloc_ctx ( ) , UNISTR4 ) ;
r_u - > time = TALLOC_ZERO_P ( get_talloc_ctx ( ) , NTTIME ) ;
2002-07-15 10:35:28 +00:00
}
1998-11-10 19:05:00 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_enum_key ( const char * desc , REG_Q_ENUM_KEY * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( q_u = = NULL )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_enum_key " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " key_index " , ps , depth , & q_u - > key_index ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint16 ( " key_name_len " , ps , depth , & q_u - > key_name_len ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint16 ( " unknown_1 " , ps , depth , & q_u - > unknown_1 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr1 " , ps , depth , & q_u - > ptr1 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( q_u - > ptr1 ! = 0 ) {
if ( ! prs_uint32 ( " unknown_2 " , ps , depth , & q_u - > unknown_2 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint8s ( False , " pad1 " , ps , depth , q_u - > pad1 , sizeof ( q_u - > pad1 ) ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
}
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr2 " , ps , depth , & q_u - > ptr2 ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( q_u - > ptr2 ! = 0 ) {
if ( ! prs_uint8s ( False , " pad2 " , ps , depth , q_u - > pad2 , sizeof ( q_u - > pad2 ) ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
}
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " ptr3 " , ps , depth , & q_u - > ptr3 ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( q_u - > ptr3 ! = 0 ) {
if ( ! smb_io_time ( " " , & q_u - > time , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
}
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_enum_key ( const char * desc , REG_R_ENUM_KEY * q_u , prs_struct * ps , int depth )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_enum_key " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_unistr4 ( " keyname " , ps , depth , & q_u - > keyname ) )
return False ;
1998-11-10 19:05:00 +00:00
2005-05-23 16:25:31 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_pointer ( " class " , ps , depth , ( void * * ) & q_u - > classname , sizeof ( UNISTR4 ) , ( PRS_POINTER_CAST ) prs_unistr4 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-05-23 16:25:31 +00:00
if ( ! prs_pointer ( " time " , ps , depth , ( void * * ) & q_u - > time , sizeof ( NTTIME ) , ( PRS_POINTER_CAST ) smb_io_nttime ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-05-23 16:25:31 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & q_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-11-10 19:05:00 +00:00
}
/*******************************************************************
makes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
void init_reg_q_open_entry ( REG_Q_OPEN_ENTRY * q_u , POLICY_HND * pol ,
2002-07-15 10:35:28 +00:00
char * key_name , uint32 access_desired )
1998-11-10 19:05:00 +00:00
{
2005-03-23 23:26:33 +00:00
memcpy ( & q_u - > pol , pol , sizeof ( q_u - > pol ) ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
init_unistr4 ( & q_u - > name , key_name , UNI_STR_TERMINATE ) ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
q_u - > unknown_0 = 0x00000000 ;
q_u - > access = access_desired ;
1998-11-10 19:05:00 +00:00
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_open_entry ( const char * desc , REG_Q_OPEN_ENTRY * q_u , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-04-07 04:58:38 +00:00
prs_debug ( ps , depth , desc , " reg_io_q_open_entry " ) ;
1998-03-11 21:11:04 +00:00
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( ! smb_io_pol_hnd ( " " , & q_u - > pol , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_unistr4 ( " name " , ps , depth , & q_u - > name ) )
1999-12-13 13:27:58 +00:00
return False ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-11-10 19:05:00 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & q_u - > unknown_0 ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " access " , ps , depth , & q_u - > access ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_open_entry ( const char * desc , REG_R_OPEN_ENTRY * r_u , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
prs_debug ( ps , depth , desc , " reg_io_r_open_entry " ) ;
depth + + ;
2000-01-14 19:34:57 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-06-17 01:57:18 +00:00
if ( ! smb_io_pol_hnd ( " handle " , & r_u - > handle , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
2001-08-10 09:52:10 +00:00
/*******************************************************************
Inits a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2003-09-25 21:26:16 +00:00
2005-03-23 23:26:33 +00:00
void init_reg_q_shutdown ( REG_Q_SHUTDOWN * q_u , const char * msg ,
2003-01-13 20:04:40 +00:00
uint32 timeout , BOOL do_reboot , BOOL force )
2001-08-10 09:52:10 +00:00
{
2005-03-23 23:26:33 +00:00
q_u - > server = TALLOC_P ( get_talloc_ctx ( ) , uint16 ) ;
* q_u - > server = 0x1 ;
2001-08-10 09:52:10 +00:00
2005-09-22 19:21:27 +00:00
q_u - > message = TALLOC_ZERO_P ( get_talloc_ctx ( ) , UNISTR4 ) ;
2005-09-15 18:35:26 +00:00
if ( msg & & * msg ) {
init_unistr4 ( q_u - > message , msg , UNI_FLAGS_NONE ) ;
2005-09-16 20:59:12 +00:00
/* Win2000 is apparently very sensitive to these lengths */
/* do a special case here */
q_u - > message - > string - > uni_max_len + + ;
q_u - > message - > size + = 2 ;
2005-09-15 18:35:26 +00:00
}
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
q_u - > timeout = timeout ;
2003-01-04 08:44:05 +00:00
2005-03-23 23:26:33 +00:00
q_u - > reboot = do_reboot ? 1 : 0 ;
q_u - > force = force ? 1 : 0 ;
}
/*******************************************************************
Inits a REG_Q_SHUTDOWN_EX structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void init_reg_q_shutdown_ex ( REG_Q_SHUTDOWN_EX * q_u_ex , const char * msg ,
uint32 timeout , BOOL do_reboot , BOOL force , uint32 reason )
{
REG_Q_SHUTDOWN q_u ;
ZERO_STRUCT ( q_u ) ;
init_reg_q_shutdown ( & q_u , msg , timeout , do_reboot , force ) ;
/* steal memory */
q_u_ex - > server = q_u . server ;
q_u_ex - > message = q_u . message ;
q_u_ex - > reboot = q_u . reboot ;
q_u_ex - > force = q_u . force ;
q_u_ex - > reason = reason ;
2001-08-10 09:52:10 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2003-09-25 21:26:16 +00:00
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_shutdown ( const char * desc , REG_Q_SHUTDOWN * q_u , prs_struct * ps ,
2001-08-10 09:52:10 +00:00
int depth )
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
2001-08-10 09:52:10 +00:00
return False ;
prs_debug ( ps , depth , desc , " reg_io_q_shutdown " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " server " , ps , depth , ( void * * ) & q_u - > server , sizeof ( uint16 ) , ( PRS_POINTER_CAST ) prs_uint16 ) )
2001-08-10 09:52:10 +00:00
return False ;
2005-09-15 18:35:26 +00:00
if ( ! prs_align ( ps ) )
return False ;
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " message " , ps , depth , ( void * * ) & q_u - > message , sizeof ( UNISTR4 ) , ( PRS_POINTER_CAST ) prs_unistr4 ) )
2001-08-10 09:52:10 +00:00
return False ;
2005-03-23 23:26:33 +00:00
2001-08-10 09:52:10 +00:00
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint32 ( " timeout " , ps , depth , & ( q_u - > timeout ) ) )
2001-08-10 09:52:10 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint8 ( " force " , ps , depth , & ( q_u - > force ) ) )
2003-01-04 08:44:05 +00:00
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_uint8 ( " reboot " , ps , depth , & ( q_u - > reboot ) ) )
2001-08-10 09:52:10 +00:00
return False ;
2005-03-23 23:26:33 +00:00
2001-08-10 09:52:10 +00:00
return True ;
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_shutdown ( const char * desc , REG_R_SHUTDOWN * r_u , prs_struct * ps ,
2001-08-10 09:52:10 +00:00
int depth )
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
2001-08-10 09:52:10 +00:00
return False ;
prs_debug ( ps , depth , desc , " reg_io_r_shutdown " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
2001-08-10 09:52:10 +00:00
return False ;
return True ;
}
/*******************************************************************
2005-03-23 23:26:33 +00:00
reads or writes a REG_Q_SHUTDOWN_EX structure .
2001-08-10 09:52:10 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_shutdown_ex ( const char * desc , REG_Q_SHUTDOWN_EX * q_u , prs_struct * ps ,
int depth )
2001-08-10 09:52:10 +00:00
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
return False ;
prs_debug ( ps , depth , desc , " reg_io_q_shutdown_ex " ) ;
depth + + ;
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_pointer ( " server " , ps , depth , ( void * * ) & q_u - > server , sizeof ( uint16 ) , ( PRS_POINTER_CAST ) prs_uint16 ) )
return False ;
2005-09-15 18:35:26 +00:00
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " message " , ps , depth , ( void * * ) & q_u - > message , sizeof ( UNISTR4 ) , ( PRS_POINTER_CAST ) prs_unistr4 ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " timeout " , ps , depth , & ( q_u - > timeout ) ) )
return False ;
2001-08-10 09:52:10 +00:00
2005-03-23 23:26:33 +00:00
if ( ! prs_uint8 ( " force " , ps , depth , & ( q_u - > force ) ) )
return False ;
if ( ! prs_uint8 ( " reboot " , ps , depth , & ( q_u - > reboot ) ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " reason " , ps , depth , & ( q_u - > reason ) ) )
return False ;
return True ;
}
/*******************************************************************
reads or writes a REG_R_SHUTDOWN_EX structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL reg_io_r_shutdown_ex ( const char * desc , REG_R_SHUTDOWN_EX * r_u , prs_struct * ps ,
int depth )
{
if ( ! r_u )
return False ;
prs_debug ( ps , depth , desc , " reg_io_r_shutdown_ex " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
return False ;
return True ;
}
/*******************************************************************
Inits a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void init_reg_q_abort_shutdown ( REG_Q_ABORT_SHUTDOWN * q_u )
{
q_u - > server = TALLOC_P ( get_talloc_ctx ( ) , uint16 ) ;
* q_u - > server = 0x1 ;
2001-08-10 09:52:10 +00:00
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
BOOL reg_io_q_abort_shutdown ( const char * desc , REG_Q_ABORT_SHUTDOWN * q_u ,
2001-08-10 09:52:10 +00:00
prs_struct * ps , int depth )
{
2005-03-23 23:26:33 +00:00
if ( ! q_u )
2001-08-10 09:52:10 +00:00
return False ;
prs_debug ( ps , depth , desc , " reg_io_q_abort_shutdown " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_pointer ( " server " , ps , depth , ( void * * ) & q_u - > server , sizeof ( uint16 ) , ( PRS_POINTER_CAST ) prs_uint16 ) )
2001-08-10 09:52:10 +00:00
return False ;
2005-09-15 18:35:26 +00:00
if ( ! prs_align ( ps ) )
return False ;
2001-08-10 09:52:10 +00:00
return True ;
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-03-23 23:26:33 +00:00
BOOL reg_io_r_abort_shutdown ( const char * desc , REG_R_ABORT_SHUTDOWN * r_u ,
2001-08-10 09:52:10 +00:00
prs_struct * ps , int depth )
{
2005-03-23 23:26:33 +00:00
if ( ! r_u )
2001-08-10 09:52:10 +00:00
return False ;
prs_debug ( ps , depth , desc , " reg_io_r_abort_shutdown " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
2005-03-23 23:26:33 +00:00
if ( ! prs_werror ( " status " , ps , depth , & r_u - > status ) )
2001-08-10 09:52:10 +00:00
return False ;
return True ;
}