r23041: Remainder of fix for 4630: fix special case of unix_to_nt_time() for
[Samba/nascimento.git] / source3 / rpc_client / cli_reg.c
blob83ff96b8b3f91bc7c4b36b8d57fc442389595e54
1 /*
2 Unix SMB/CIFS implementation.
3 RPC Pipe client
5 Copyright (C) Gerald (Jerry) Carter 2005-2006
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "includes.h"
23 #include "rpc_client.h"
25 /*******************************************************************
26 connect to a registry hive root (open a registry policy)
27 *******************************************************************/
29 NTSTATUS rpccli_winreg_Connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
30 uint32 reg_type, uint32 access_mask,
31 POLICY_HND *reg_hnd)
33 ZERO_STRUCTP(reg_hnd);
35 switch (reg_type)
37 case HKEY_CLASSES_ROOT:
38 return rpccli_winreg_OpenHKCR( cli, mem_ctx, NULL,
39 access_mask, reg_hnd );
41 case HKEY_LOCAL_MACHINE:
42 return rpccli_winreg_OpenHKLM( cli, mem_ctx, NULL,
43 access_mask, reg_hnd );
45 case HKEY_USERS:
46 return rpccli_winreg_OpenHKU( cli, mem_ctx, NULL,
47 access_mask, reg_hnd );
49 case HKEY_PERFORMANCE_DATA:
50 return rpccli_winreg_OpenHKPD( cli, mem_ctx, NULL,
51 access_mask, reg_hnd );
53 default:
54 /* fall through to end of function */
55 break;
58 return NT_STATUS_INVALID_PARAMETER;
61 /*******************************************************************
62 Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE
63 *******************************************************************/
65 uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val )
67 uint32 real_size = 0;
69 if ( !buf2 || !val )
70 return 0;
72 real_size = regval_size(val);
73 init_regval_buffer( buf2, (unsigned char*)regval_data_p(val), real_size );
75 return real_size;