source: branches/samba-3.3.x/source/rpc_client/cli_reg.c

Last change on this file was 206, checked in by Herwig Bauernfeind, 16 years ago

Import Samba 3.3 branch at 3.0.0 level (psmedley's port)

File size: 2.3 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 RPC Pipe client
4
5 Copyright (C) Gerald (Jerry) Carter 2005-2006
6
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 3 of the License, or
10 (at your option) any later version.
11
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.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include "includes.h"
22#include "rpc_client.h"
23
24/*******************************************************************
25 connect to a registry hive root (open a registry policy)
26*******************************************************************/
27
28NTSTATUS rpccli_winreg_Connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
29 uint32 reg_type, uint32 access_mask,
30 POLICY_HND *reg_hnd)
31{
32 ZERO_STRUCTP(reg_hnd);
33
34 switch (reg_type)
35 {
36 case HKEY_CLASSES_ROOT:
37 return rpccli_winreg_OpenHKCR( cli, mem_ctx, NULL,
38 access_mask, reg_hnd, NULL);
39
40 case HKEY_LOCAL_MACHINE:
41 return rpccli_winreg_OpenHKLM( cli, mem_ctx, NULL,
42 access_mask, reg_hnd, NULL);
43
44 case HKEY_USERS:
45 return rpccli_winreg_OpenHKU( cli, mem_ctx, NULL,
46 access_mask, reg_hnd, NULL);
47
48 case HKEY_CURRENT_USER:
49 return rpccli_winreg_OpenHKCU( cli, mem_ctx, NULL,
50 access_mask, reg_hnd, NULL);
51
52 case HKEY_PERFORMANCE_DATA:
53 return rpccli_winreg_OpenHKPD( cli, mem_ctx, NULL,
54 access_mask, reg_hnd, NULL);
55
56 default:
57 /* fall through to end of function */
58 break;
59 }
60
61 return NT_STATUS_INVALID_PARAMETER;
62}
63
64/*******************************************************************
65 Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE
66 *******************************************************************/
67
68uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val )
69{
70 uint32 real_size = 0;
71
72 if ( !buf2 || !val )
73 return 0;
74
75 real_size = regval_size(val);
76 init_regval_buffer( buf2, (unsigned char*)regval_data_p(val), real_size );
77
78 return real_size;
79}
Note: See TracBrowser for help on using the repository browser.