2004-04-04 20:24:08 +04:00
/*
Unix SMB / CIFS implementation .
endpoint server for the winreg pipe
Copyright ( C ) Jelmer Vernooij 2004
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"
2004-11-02 10:42:47 +03:00
# include "rpc_server/dcerpc_server.h"
2005-09-04 18:47:19 +04:00
# include "lib/registry/registry.h"
2004-11-01 13:30:34 +03:00
# include "librpc/gen_ndr/ndr_winreg.h"
2004-05-04 10:11:47 +04:00
# include "rpc_server/common/common.h"
2006-03-16 03:23:11 +03:00
# include "librpc/gen_ndr/ndr_security.h"
2004-04-04 20:24:08 +04:00
2004-10-29 02:38:27 +04:00
enum handle_types { HTYPE_REGVAL , HTYPE_REGKEY } ;
2004-12-10 23:07:04 +03:00
static NTSTATUS dcerpc_winreg_bind ( struct dcesrv_call_state * dce_call , const struct dcesrv_interface * iface )
2004-04-06 00:44:33 +04:00
{
2004-12-10 23:07:04 +03:00
struct registry_context * ctx ;
2006-03-21 04:30:22 +03:00
reg_open_local ( & ctx , dce_call - > conn - > auth_state . session_info , NULL ) ;
2004-12-10 23:07:04 +03:00
2005-01-10 15:15:26 +03:00
dce_call - > context - > private = ctx ;
2004-12-10 23:07:04 +03:00
return NT_STATUS_OK ;
2004-04-06 00:44:33 +04:00
}
2004-12-10 23:07:04 +03:00
# define DCESRV_INTERFACE_WINREG_BIND dcerpc_winreg_bind
static WERROR winreg_openhive ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx , uint32_t hkey , struct policy_handle * * outh )
2004-04-06 00:44:33 +04:00
{
2005-01-10 15:15:26 +03:00
struct registry_context * ctx = dce_call - > context - > private ;
2004-10-29 02:38:27 +04:00
struct dcesrv_handle * h ;
2004-04-09 02:39:47 +04:00
WERROR error ;
2004-09-27 20:37:41 +04:00
2005-01-10 15:15:26 +03:00
h = dcesrv_handle_new ( dce_call - > context , HTYPE_REGKEY ) ;
2004-09-27 20:37:41 +04:00
2004-12-11 23:06:40 +03:00
error = reg_get_predefined_key ( ctx , hkey , ( struct registry_key * * ) & h - > data ) ;
2004-12-10 23:07:04 +03:00
if ( ! W_ERROR_IS_OK ( error ) ) {
return error ;
2004-10-29 02:38:27 +04:00
}
* outh = & h - > wire_handle ;
2004-12-10 23:07:04 +03:00
return error ;
2004-10-29 02:38:27 +04:00
}
2004-04-06 00:44:33 +04:00
2004-05-04 10:07:52 +04:00
# define func_winreg_OpenHive(k,n) static WERROR winreg_Open ## k (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_Open ## k *r) \
2004-04-09 02:39:47 +04:00
{ \
2004-10-29 02:38:27 +04:00
return winreg_openhive ( dce_call , mem_ctx , n , & r - > out . handle ) ; \
2004-04-09 02:39:47 +04:00
}
2004-12-10 23:07:04 +03:00
func_winreg_OpenHive ( HKCR , HKEY_CLASSES_ROOT )
func_winreg_OpenHive ( HKCU , HKEY_CURRENT_USER )
func_winreg_OpenHive ( HKLM , HKEY_LOCAL_MACHINE )
func_winreg_OpenHive ( HKPD , HKEY_PERFORMANCE_DATA )
func_winreg_OpenHive ( HKU , HKEY_USERS )
func_winreg_OpenHive ( HKCC , HKEY_CURRENT_CONFIG )
func_winreg_OpenHive ( HKDD , HKEY_DYN_DATA )
2004-12-11 20:12:16 +03:00
func_winreg_OpenHive ( HKPT , HKEY_PERFORMANCE_TEXT )
func_winreg_OpenHive ( HKPN , HKEY_PERFORMANCE_NLSTEXT )
2004-04-04 20:24:08 +04:00
/*
2004-04-09 02:39:47 +04:00
winreg_CloseKey
2004-04-04 20:24:08 +04:00
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_CloseKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2005-01-10 15:15:26 +03:00
struct winreg_CloseKey * r )
2004-04-04 20:24:08 +04:00
{
2004-10-29 02:38:27 +04:00
struct dcesrv_handle * h ;
2004-05-04 10:07:52 +04:00
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-04-06 00:44:33 +04:00
2005-01-10 15:15:26 +03:00
talloc_free ( h ) ;
2004-04-06 00:44:33 +04:00
2005-08-20 08:40:08 +04:00
ZERO_STRUCTP ( r - > out . handle ) ;
2004-05-04 10:07:52 +04:00
return WERR_OK ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_CreateKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_CreateKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2005-01-10 15:15:26 +03:00
struct winreg_CreateKey * r )
2004-04-04 20:24:08 +04:00
{
2004-10-29 02:38:27 +04:00
struct dcesrv_handle * h , * newh ;
2004-04-09 02:39:47 +04:00
WERROR error ;
2005-08-24 12:31:39 +04:00
struct security_descriptor sd ;
2004-05-04 10:07:52 +04:00
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-10-29 02:38:27 +04:00
2005-01-10 15:15:26 +03:00
newh = dcesrv_handle_new ( dce_call - > context , HTYPE_REGKEY ) ;
2004-10-29 02:38:27 +04:00
2005-08-24 12:31:39 +04:00
/* the security descriptor is optional */
if ( r - > in . secdesc ! = NULL ) {
DATA_BLOB sdblob ;
NTSTATUS status ;
sdblob . data = r - > in . secdesc - > sd . data ;
sdblob . length = r - > in . secdesc - > sd . len ;
if ( sdblob . data = = NULL ) {
return WERR_INVALID_PARAM ;
}
status = ndr_pull_struct_blob_all ( & sdblob , mem_ctx , & sd ,
( ndr_pull_flags_fn_t ) ndr_pull_security_descriptor ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
return WERR_INVALID_PARAM ;
}
}
error = reg_key_add_name ( newh , ( struct registry_key * ) h - > data , r - > in . name . name ,
2005-10-22 12:00:09 +04:00
r - > in . access_mask ,
2005-08-24 12:31:39 +04:00
r - > in . secdesc ? & sd : NULL ,
2005-01-10 15:15:26 +03:00
( struct registry_key * * ) & newh - > data ) ;
if ( W_ERROR_IS_OK ( error ) ) {
2005-08-24 12:31:39 +04:00
r - > out . new_handle = & newh - > wire_handle ;
2004-10-29 02:38:27 +04:00
} else {
2005-01-10 15:15:26 +03:00
talloc_free ( newh ) ;
2004-04-09 02:39:47 +04:00
}
2004-05-04 10:07:52 +04:00
return error ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_DeleteKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_DeleteKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_DeleteKey * r )
{
2004-10-29 02:38:27 +04:00
struct dcesrv_handle * h ;
2004-05-04 10:07:52 +04:00
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2005-08-20 08:40:08 +04:00
return reg_key_del ( ( struct registry_key * ) h - > data , r - > in . key . name ) ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_DeleteValue
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_DeleteValue ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_DeleteValue * r )
{
2004-10-29 02:38:27 +04:00
struct dcesrv_handle * h ;
2004-12-13 03:45:29 +03:00
struct registry_key * key ;
2004-10-29 02:38:27 +04:00
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-10-29 02:38:27 +04:00
2004-12-13 03:45:29 +03:00
key = h - > data ;
2004-10-29 02:38:27 +04:00
2004-12-13 03:45:29 +03:00
return reg_del_value ( key , r - > in . value . name ) ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_EnumKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_EnumKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_EnumKey * r )
{
2004-10-29 02:38:27 +04:00
struct dcesrv_handle * h ;
2004-09-22 16:33:39 +04:00
struct registry_key * key ;
2004-05-04 10:07:52 +04:00
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-04-09 02:39:47 +04:00
2004-10-29 03:06:12 +04:00
r - > out . result = reg_key_get_subkey_by_index ( mem_ctx , ( struct registry_key * ) h - > data , r - > in . enum_index , & key ) ;
if ( W_ERROR_IS_OK ( r - > out . result ) ) {
2005-08-17 17:06:05 +04:00
if ( 2 * strlen_m_term ( key - > name ) > r - > in . name - > size ) {
2005-08-17 05:25:58 +04:00
return WERR_MORE_DATA ;
}
2005-08-17 17:06:05 +04:00
r - > out . name - > length = 2 * strlen_m_term ( key - > name ) ;
2005-08-17 05:25:58 +04:00
r - > out . name - > name = key - > name ;
2006-09-15 22:34:03 +04:00
r - > out . keyclass = talloc_zero ( mem_ctx , struct winreg_StringBuf ) ;
2005-08-17 17:06:05 +04:00
if ( r - > in . last_changed_time ) {
r - > out . last_changed_time = & key - > last_mod ;
}
2004-10-29 03:06:12 +04:00
}
2004-04-09 02:39:47 +04:00
2004-10-29 05:10:40 +04:00
return r - > out . result ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_EnumValue
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_EnumValue ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-12-09 15:50:50 +03:00
struct winreg_EnumValue * r )
2004-04-04 20:24:08 +04:00
{
2004-10-29 17:38:37 +04:00
struct dcesrv_handle * h ;
struct registry_key * key ;
struct registry_value * value ;
WERROR result ;
2004-10-29 02:38:27 +04:00
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-10-29 17:38:37 +04:00
key = h - > data ;
result = reg_key_get_value_by_index ( mem_ctx , key , r - > in . enum_index , & value ) ;
if ( ! W_ERROR_IS_OK ( result ) ) {
return result ;
}
2005-08-17 05:25:58 +04:00
/* the client can optionally pass a NULL for type, meaning they don't
want that back */
if ( r - > in . type ! = NULL ) {
2006-04-30 17:54:03 +04:00
r - > out . type = talloc ( mem_ctx , enum winreg_Type ) ;
2005-08-17 05:25:58 +04:00
* r - > out . type = value - > data_type ;
}
/* check the client has enough room for the value */
2005-08-17 17:09:42 +04:00
if ( r - > in . value ! = NULL & &
r - > in . size ! = NULL & &
2005-09-03 21:17:30 +04:00
value - > data . length > * r - > in . size ) {
2005-08-17 05:25:58 +04:00
return WERR_MORE_DATA ;
}
2004-10-29 17:38:37 +04:00
2005-08-17 05:25:58 +04:00
/* and enough room for the name */
2005-08-17 17:06:05 +04:00
if ( r - > in . name - > size < 2 * strlen_m_term ( value - > name ) ) {
2005-08-17 05:25:58 +04:00
return WERR_MORE_DATA ;
}
r - > out . name - > name = value - > name ;
2005-08-17 17:06:05 +04:00
r - > out . name - > length = 2 * strlen_m_term ( value - > name ) ;
r - > out . name - > size = 2 * strlen_m_term ( value - > name ) ;
2005-08-17 05:25:58 +04:00
if ( r - > in . value ) {
2005-09-03 21:17:30 +04:00
r - > out . value = value - > data . data ;
2005-08-17 05:25:58 +04:00
}
if ( r - > in . size ) {
r - > out . size = talloc ( mem_ctx , uint32_t ) ;
2005-09-03 21:17:30 +04:00
* r - > out . size = value - > data . length ;
2005-08-17 05:25:58 +04:00
r - > out . length = r - > out . size ;
}
2004-10-29 17:38:37 +04:00
return WERR_OK ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_FlushKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_FlushKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_FlushKey * r )
{
2004-10-29 15:44:59 +04:00
struct dcesrv_handle * h ;
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-10-29 15:44:59 +04:00
return reg_key_flush ( h - > data ) ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_GetKeySecurity
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_GetKeySecurity ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_GetKeySecurity * r )
{
2004-12-13 05:04:34 +03:00
struct dcesrv_handle * h ;
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-12-13 05:04:34 +03:00
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_LoadKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_LoadKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_LoadKey * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_NotifyChangeKeyValue
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_NotifyChangeKeyValue ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_NotifyChangeKeyValue * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_OpenKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_OpenKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_OpenKey * r )
{
2004-10-29 02:38:27 +04:00
struct dcesrv_handle * h , * newh ;
2004-05-04 10:07:52 +04:00
WERROR result ;
2006-09-15 22:34:03 +04:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . parent_handle , HTYPE_REGKEY ) ;
2004-04-09 02:39:47 +04:00
2005-08-17 17:06:05 +04:00
if ( r - > in . keyname . name & & strcmp ( r - > in . keyname . name , " " ) = = 0 ) {
newh = talloc_reference ( dce_call - > context , h ) ;
result = WERR_OK ;
} else {
newh = dcesrv_handle_new ( dce_call - > context , HTYPE_REGKEY ) ;
result = reg_open_key ( newh , ( struct registry_key * ) h - > data ,
r - > in . keyname . name , ( struct registry_key * * ) & newh - > data ) ;
}
2004-05-04 10:07:52 +04:00
if ( W_ERROR_IS_OK ( result ) ) {
2004-10-29 02:38:27 +04:00
r - > out . handle = & newh - > wire_handle ;
} else {
2005-01-10 15:15:26 +03:00
talloc_free ( newh ) ;
2004-04-09 02:39:47 +04:00
}
2004-04-06 00:44:33 +04:00
2004-05-04 10:07:52 +04:00
return result ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_QueryInfoKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_QueryInfoKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_QueryInfoKey * r )
{
2004-10-29 17:38:37 +04:00
struct dcesrv_handle * h ;
struct registry_key * k ;
WERROR ret ;
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-10-29 17:38:37 +04:00
k = h - > data ;
2006-09-15 22:34:03 +04:00
ret = reg_key_num_subkeys ( k , r - > out . num_subkeys ) ;
2004-10-29 17:38:37 +04:00
if ( ! W_ERROR_IS_OK ( ret ) ) {
return ret ;
}
2006-09-15 22:34:03 +04:00
ret = reg_key_num_values ( k , r - > out . num_values ) ;
2004-10-29 17:38:37 +04:00
if ( ! W_ERROR_IS_OK ( ret ) ) {
return ret ;
}
2006-09-15 22:34:03 +04:00
ret = reg_key_subkeysizes ( k , r - > out . max_subkeysize , r - > out . max_subkeylen ) ;
2004-10-29 17:38:37 +04:00
if ( ! W_ERROR_IS_OK ( ret ) ) {
return ret ;
}
2006-09-15 22:34:03 +04:00
ret = reg_key_valuesizes ( k , r - > out . max_valnamelen , r - > out . max_valbufsize ) ;
2004-10-29 17:38:37 +04:00
if ( ! W_ERROR_IS_OK ( ret ) ) {
return ret ;
}
r - > out . secdescsize = 0 ; /* FIXME */
2004-12-15 03:16:54 +03:00
ZERO_STRUCT ( r - > out . last_changed_time ) ; /* FIXME */
if ( ! W_ERROR_IS_OK ( ret ) ) {
2004-10-29 17:38:37 +04:00
return ret ;
}
return WERR_OK ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_QueryValue
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_QueryValue ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_QueryValue * r )
{
2004-12-13 05:04:34 +03:00
struct dcesrv_handle * h ;
struct registry_key * key ;
struct registry_value * val ;
WERROR result ;
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-12-13 05:04:34 +03:00
key = h - > data ;
result = reg_key_get_value_by_name ( mem_ctx , key , r - > in . value_name . name , & val ) ;
if ( ! W_ERROR_IS_OK ( result ) ) {
return result ;
}
2004-12-15 05:27:22 +03:00
/* Just asking for the size of the buffer */
2006-04-30 17:54:03 +04:00
r - > out . type = ( enum winreg_Type * ) & val - > data_type ;
2006-09-10 15:32:31 +04:00
r - > out . length = talloc ( mem_ctx , uint32_t ) ;
if ( ! r - > out . length ) {
return WERR_NOMEM ;
}
* r - > out . length = val - > data . length ;
2004-12-15 05:27:22 +03:00
if ( ! r - > in . data ) {
2005-02-10 08:09:35 +03:00
r - > out . size = talloc ( mem_ctx , uint32_t ) ;
2005-09-03 21:17:30 +04:00
* r - > out . size = val - > data . length ;
2004-12-15 05:27:22 +03:00
} else {
r - > out . size = r - > in . size ;
2005-09-03 21:17:30 +04:00
r - > out . data = val - > data . data ;
2004-12-15 05:27:22 +03:00
}
2004-12-13 05:04:34 +03:00
return WERR_OK ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_ReplaceKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_ReplaceKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_ReplaceKey * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_RestoreKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_RestoreKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_RestoreKey * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_SaveKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_SaveKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_SaveKey * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_SetKeySecurity
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_SetKeySecurity ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_SetKeySecurity * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_SetValue
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_SetValue ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_SetValue * r )
{
2004-12-15 03:16:54 +03:00
struct dcesrv_handle * h ;
struct registry_key * key ;
WERROR result ;
2005-09-03 21:17:30 +04:00
DATA_BLOB data ;
2004-12-15 03:16:54 +03:00
2005-01-10 15:15:26 +03:00
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2004-12-15 03:16:54 +03:00
key = h - > data ;
2005-09-03 21:17:30 +04:00
data . data = r - > in . data ;
data . length = r - > in . size ;
result = reg_val_set ( key , r - > in . name . name , r - > in . type , data ) ;
2004-12-15 03:16:54 +03:00
if ( ! W_ERROR_IS_OK ( result ) ) {
return result ;
}
return WERR_OK ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_UnLoadKey
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_UnLoadKey ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_UnLoadKey * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_InitiateSystemShutdown
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_InitiateSystemShutdown ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_InitiateSystemShutdown * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_AbortSystemShutdown
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_AbortSystemShutdown ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_AbortSystemShutdown * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_GetVersion
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_GetVersion ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2005-08-18 15:16:32 +04:00
struct winreg_GetVersion * r )
2004-04-04 20:24:08 +04:00
{
2005-08-18 15:16:32 +04:00
struct dcesrv_handle * h ;
DCESRV_PULL_HANDLE_FAULT ( h , r - > in . handle , HTYPE_REGKEY ) ;
2006-09-15 22:34:03 +04:00
* r - > out . version = 5 ;
2004-10-29 17:38:37 +04:00
return WERR_OK ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_QueryMultipleValues
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_QueryMultipleValues ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_QueryMultipleValues * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_InitiateSystemShutdownEx
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_InitiateSystemShutdownEx ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_InitiateSystemShutdownEx * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_SaveKeyEx
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_SaveKeyEx ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_SaveKeyEx * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/*
winreg_QueryMultipleValues2
*/
2004-05-04 10:07:52 +04:00
static WERROR winreg_QueryMultipleValues2 ( struct dcesrv_call_state * dce_call , TALLOC_CTX * mem_ctx ,
2004-04-04 20:24:08 +04:00
struct winreg_QueryMultipleValues2 * r )
{
2004-05-04 10:07:52 +04:00
return WERR_NOT_SUPPORTED ;
2004-04-04 20:24:08 +04:00
}
/* include the generated boilerplate */
# include "librpc/gen_ndr/ndr_winreg_s.c"