diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/librpc/gen_ndr/cli_winreg.c | 20 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_winreg.h | 4 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_winreg.c | 298 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_winreg.c | 17 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_winreg.h | 4 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/winreg.h | 16 | ||||
-rw-r--r-- | source3/librpc/idl/winreg.idl | 9 | ||||
-rw-r--r-- | source3/rpc_client/cli_reg.c | 6 | ||||
-rw-r--r-- | source3/rpc_server/srv_winreg_nt.c | 50 |
9 files changed, 212 insertions, 212 deletions
diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c index 0890a8d6b7..08ec10e00c 100644 --- a/source3/librpc/gen_ndr/cli_winreg.c +++ b/source3/librpc/gen_ndr/cli_winreg.c @@ -294,7 +294,7 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length) +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length) { struct winreg_EnumValue r; NTSTATUS status; @@ -304,9 +304,9 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.enum_index = enum_index; r.in.name = name; r.in.type = type; - r.in.value = value; - r.in.size = size; - r.in.length = length; + r.in.data = data; + r.in.data_size = data_size; + r.in.value_length = value_length; if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r); @@ -323,9 +323,9 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct /* Return variables */ *name = *r.out.name; *type = *r.out.type; - *value = *r.out.value; - *size = *r.out.size; - *length = *r.out.length; + *data = *r.out.data; + *data_size = *r.out.data_size; + *value_length = *r.out.value_length; /* Return result */ return werror_to_ntstatus(r.out.result); @@ -476,14 +476,14 @@ NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String class_in, struct winreg_String *class_out, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time) +NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time) { struct winreg_QueryInfoKey r; NTSTATUS status; /* In parameters */ r.in.handle = handle; - r.in.class_in = class_in; + r.in.classname = classname; if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r); @@ -498,7 +498,7 @@ NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem } /* Return variables */ - *class_out = *r.out.class_out; + *classname = *r.out.classname; *num_subkeys = *r.out.num_subkeys; *max_subkeylen = *r.out.max_subkeylen; *max_subkeysize = *r.out.max_subkeysize; diff --git a/source3/librpc/gen_ndr/cli_winreg.h b/source3/librpc/gen_ndr/cli_winreg.h index 3fabf18315..e31e266aef 100644 --- a/source3/librpc/gen_ndr/cli_winreg.h +++ b/source3/librpc/gen_ndr/cli_winreg.h @@ -11,13 +11,13 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key); NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value); NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time); -NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length); +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length); NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd); NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename); NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2); NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle); -NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String class_in, struct winreg_String *class_out, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time); +NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time); NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length); NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); diff --git a/source3/librpc/gen_ndr/ndr_winreg.c b/source3/librpc/gen_ndr/ndr_winreg.c index 998e4e0861..1a08fdb3d3 100644 --- a/source3/librpc/gen_ndr/ndr_winreg.c +++ b/source3/librpc/gen_ndr/ndr_winreg.c @@ -1361,20 +1361,20 @@ NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct if (r->in.type) { NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->in.type)); } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.value)); - if (r->in.value) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.size)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data)); + if (r->in.data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_size)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.value, *r->in.length)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.value_length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, *r->in.value_length)); } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.size)); - if (r->in.size) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.size)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data_size)); + if (r->in.data_size) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_size)); } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.length)); - if (r->in.length) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.value_length)); + if (r->in.value_length) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.value_length)); } } if (flags & NDR_OUT) { @@ -1384,20 +1384,20 @@ NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct if (r->out.type) { NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type)); } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.value)); - if (r->out.value) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.size)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data)); + if (r->out.data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_size)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.value, *r->out.length)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, *r->out.value_length)); } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.size)); - if (r->out.size) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.size)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data_size)); + if (r->out.data_size) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_size)); } - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.length)); - if (r->out.length) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.value_length)); + if (r->out.value_length) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_length)); } NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } @@ -1407,15 +1407,15 @@ NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winreg_EnumValue *r) { uint32_t _ptr_type; - uint32_t _ptr_value; - uint32_t _ptr_size; - uint32_t _ptr_length; + uint32_t _ptr_data; + uint32_t _ptr_data_size; + uint32_t _ptr_value_length; TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_name_0; TALLOC_CTX *_mem_save_type_0; - TALLOC_CTX *_mem_save_value_0; - TALLOC_CTX *_mem_save_size_0; - TALLOC_CTX *_mem_save_length_0; + TALLOC_CTX *_mem_save_data_0; + TALLOC_CTX *_mem_save_data_size_0; + TALLOC_CTX *_mem_save_value_length_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -1446,57 +1446,57 @@ NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winre NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->in.type)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value)); - if (_ptr_value) { - NDR_PULL_ALLOC(ndr, r->in.value); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->in.data); } else { - r->in.value = NULL; - } - if (r->in.value) { - _mem_save_value_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.value, 0); - NDR_CHECK(ndr_pull_array_size(ndr, &r->in.value)); - NDR_CHECK(ndr_pull_array_length(ndr, &r->in.value)); - if (ndr_get_array_length(ndr, &r->in.value) > ndr_get_array_size(ndr, &r->in.value)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.value), ndr_get_array_length(ndr, &r->in.value)); + r->in.data = NULL; + } + if (r->in.data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.data)); + if (ndr_get_array_length(ndr, &r->in.data) > ndr_get_array_size(ndr, &r->in.data)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.data), ndr_get_array_length(ndr, &r->in.data)); } - NDR_PULL_ALLOC_N(ndr, r->in.value, ndr_get_array_size(ndr, &r->in.value)); - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.value, ndr_get_array_length(ndr, &r->in.value))); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_0, 0); + NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_length(ndr, &r->in.data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size)); - if (_ptr_size) { - NDR_PULL_ALLOC(ndr, r->in.size); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_size)); + if (_ptr_data_size) { + NDR_PULL_ALLOC(ndr, r->in.data_size); } else { - r->in.size = NULL; + r->in.data_size = NULL; } - if (r->in.size) { - _mem_save_size_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.size, 0); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.size)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_size_0, 0); + if (r->in.data_size) { + _mem_save_data_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.data_size, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.data_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_size_0, 0); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_length)); - if (_ptr_length) { - NDR_PULL_ALLOC(ndr, r->in.length); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_length)); + if (_ptr_value_length) { + NDR_PULL_ALLOC(ndr, r->in.value_length); } else { - r->in.length = NULL; + r->in.value_length = NULL; } - if (r->in.length) { - _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.length, 0); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.length)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, 0); + if (r->in.value_length) { + _mem_save_value_length_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.value_length, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.value_length)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_length_0, 0); } NDR_PULL_ALLOC(ndr, r->out.name); *r->out.name = *r->in.name; - if (r->in.value) { - if (r->in.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.value, *r->in.size)); + if (r->in.data) { + if (r->in.data_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, *r->in.data_size)); } - if (r->in.value) { - if (r->in.length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; - NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.value, *r->in.length)); + if (r->in.data) { + if (r->in.value_length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.data, *r->in.value_length)); } } if (flags & NDR_OUT) { @@ -1519,56 +1519,56 @@ NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winre NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value)); - if (_ptr_value) { - NDR_PULL_ALLOC(ndr, r->out.value); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->out.data); } else { - r->out.value = NULL; - } - if (r->out.value) { - _mem_save_value_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.value, 0); - NDR_CHECK(ndr_pull_array_size(ndr, &r->out.value)); - NDR_CHECK(ndr_pull_array_length(ndr, &r->out.value)); - if (ndr_get_array_length(ndr, &r->out.value) > ndr_get_array_size(ndr, &r->out.value)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.value), ndr_get_array_length(ndr, &r->out.value)); + r->out.data = NULL; + } + if (r->out.data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->out.data)); + if (ndr_get_array_length(ndr, &r->out.data) > ndr_get_array_size(ndr, &r->out.data)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.data), ndr_get_array_length(ndr, &r->out.data)); } - NDR_PULL_ALLOC_N(ndr, r->out.value, ndr_get_array_size(ndr, &r->out.value)); - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.value, ndr_get_array_length(ndr, &r->out.value))); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_0, 0); + NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.data, ndr_get_array_length(ndr, &r->out.data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size)); - if (_ptr_size) { - NDR_PULL_ALLOC(ndr, r->out.size); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_size)); + if (_ptr_data_size) { + NDR_PULL_ALLOC(ndr, r->out.data_size); } else { - r->out.size = NULL; + r->out.data_size = NULL; } - if (r->out.size) { - _mem_save_size_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.size, 0); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.size)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_size_0, 0); + if (r->out.data_size) { + _mem_save_data_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.data_size, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.data_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_size_0, 0); } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_length)); - if (_ptr_length) { - NDR_PULL_ALLOC(ndr, r->out.length); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_length)); + if (_ptr_value_length) { + NDR_PULL_ALLOC(ndr, r->out.value_length); } else { - r->out.length = NULL; + r->out.value_length = NULL; } - if (r->out.length) { - _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.length, 0); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.length)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, 0); + if (r->out.value_length) { + _mem_save_value_length_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.value_length, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.value_length)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_length_0, 0); } NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); - if (r->out.value) { - if (r->out.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.value, *r->out.size)); + if (r->out.data) { + if (r->out.data_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, *r->out.data_size)); } - if (r->out.value) { - if (r->out.length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; - NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.value, *r->out.length)); + if (r->out.data) { + if (r->out.value_length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.data, *r->out.value_length)); } } return NT_STATUS_OK; @@ -1599,22 +1599,22 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name ndr_print_winreg_Type(ndr, "type", *r->in.type); } ndr->depth--; - ndr_print_ptr(ndr, "value", r->in.value); + ndr_print_ptr(ndr, "data", r->in.data); ndr->depth++; - if (r->in.value) { - ndr_print_array_uint8(ndr, "value", r->in.value, *r->in.length); + if (r->in.data) { + ndr_print_array_uint8(ndr, "data", r->in.data, *r->in.value_length); } ndr->depth--; - ndr_print_ptr(ndr, "size", r->in.size); + ndr_print_ptr(ndr, "data_size", r->in.data_size); ndr->depth++; - if (r->in.size) { - ndr_print_uint32(ndr, "size", *r->in.size); + if (r->in.data_size) { + ndr_print_uint32(ndr, "data_size", *r->in.data_size); } ndr->depth--; - ndr_print_ptr(ndr, "length", r->in.length); + ndr_print_ptr(ndr, "value_length", r->in.value_length); ndr->depth++; - if (r->in.length) { - ndr_print_uint32(ndr, "length", *r->in.length); + if (r->in.value_length) { + ndr_print_uint32(ndr, "value_length", *r->in.value_length); } ndr->depth--; ndr->depth--; @@ -1632,22 +1632,22 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name ndr_print_winreg_Type(ndr, "type", *r->out.type); } ndr->depth--; - ndr_print_ptr(ndr, "value", r->out.value); + ndr_print_ptr(ndr, "data", r->out.data); ndr->depth++; - if (r->out.value) { - ndr_print_array_uint8(ndr, "value", r->out.value, *r->out.length); + if (r->out.data) { + ndr_print_array_uint8(ndr, "data", r->out.data, *r->out.value_length); } ndr->depth--; - ndr_print_ptr(ndr, "size", r->out.size); + ndr_print_ptr(ndr, "data_size", r->out.data_size); ndr->depth++; - if (r->out.size) { - ndr_print_uint32(ndr, "size", *r->out.size); + if (r->out.data_size) { + ndr_print_uint32(ndr, "data_size", *r->out.data_size); } ndr->depth--; - ndr_print_ptr(ndr, "length", r->out.length); + ndr_print_ptr(ndr, "value_length", r->out.value_length); ndr->depth++; - if (r->out.length) { - ndr_print_uint32(ndr, "length", *r->out.length); + if (r->out.value_length) { + ndr_print_uint32(ndr, "value_length", *r->out.value_length); } ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -2063,13 +2063,12 @@ NTSTATUS ndr_push_winreg_QueryInfoKey(struct ndr_push *ndr, int flags, const str if (flags & NDR_IN) { if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); - NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.class_in)); + if (r->in.classname == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.classname)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.class_out)); - if (r->out.class_out) { - NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.class_out)); - } + if (r->out.classname == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.classname)); if (r->out.num_subkeys == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_subkeys)); if (r->out.max_subkeylen == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; @@ -2093,9 +2092,8 @@ NTSTATUS ndr_push_winreg_QueryInfoKey(struct ndr_push *ndr, int flags, const str NTSTATUS ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int flags, struct winreg_QueryInfoKey *r) { - uint32_t _ptr_class_out; TALLOC_CTX *_mem_save_handle_0; - TALLOC_CTX *_mem_save_class_out_0; + TALLOC_CTX *_mem_save_classname_0; TALLOC_CTX *_mem_save_num_subkeys_0; TALLOC_CTX *_mem_save_max_subkeylen_0; TALLOC_CTX *_mem_save_max_subkeysize_0; @@ -2114,7 +2112,15 @@ NTSTATUS ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int flags, struct wi NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.class_in)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.classname); + } + _mem_save_classname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.classname, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.classname)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_classname_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.classname); + *r->out.classname = *r->in.classname; NDR_PULL_ALLOC(ndr, r->out.num_subkeys); ZERO_STRUCTP(r->out.num_subkeys); NDR_PULL_ALLOC(ndr, r->out.max_subkeylen); @@ -2133,18 +2139,13 @@ NTSTATUS ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int flags, struct wi ZERO_STRUCTP(r->out.last_changed_time); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_class_out)); - if (_ptr_class_out) { - NDR_PULL_ALLOC(ndr, r->out.class_out); - } else { - r->out.class_out = NULL; - } - if (r->out.class_out) { - _mem_save_class_out_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.class_out, 0); - NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.class_out)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_class_out_0, 0); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.classname); } + _mem_save_classname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.classname, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.classname)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_classname_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.num_subkeys); } @@ -2220,17 +2221,18 @@ _PUBLIC_ void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *n ndr->depth++; ndr_print_policy_handle(ndr, "handle", r->in.handle); ndr->depth--; - ndr_print_winreg_String(ndr, "class_in", &r->in.class_in); + ndr_print_ptr(ndr, "classname", r->in.classname); + ndr->depth++; + ndr_print_winreg_String(ndr, "classname", r->in.classname); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "winreg_QueryInfoKey"); ndr->depth++; - ndr_print_ptr(ndr, "class_out", r->out.class_out); + ndr_print_ptr(ndr, "classname", r->out.classname); ndr->depth++; - if (r->out.class_out) { - ndr_print_winreg_String(ndr, "class_out", r->out.class_out); - } + ndr_print_winreg_String(ndr, "classname", r->out.classname); ndr->depth--; ndr_print_ptr(ndr, "num_subkeys", r->out.num_subkeys); ndr->depth++; diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c index a1acdf8741..82070b95e9 100644 --- a/source3/librpc/gen_ndr/srv_winreg.c +++ b/source3/librpc/gen_ndr/srv_winreg.c @@ -646,10 +646,10 @@ static BOOL api_winreg_EnumValue(pipes_struct *p) ZERO_STRUCT(r.out); r.out.name = r.in.name; r.out.type = r.in.type; - r.out.value = r.in.value; - r.out.size = r.in.size; - r.out.length = r.in.length; - r.out.result = _winreg_EnumValue(p, r.in.handle, r.in.enum_index, r.in.name, r.in.type, r.in.value, r.in.size, r.in.length); + r.out.data = r.in.data; + r.out.data_size = r.in.data_size; + r.out.value_length = r.in.value_length; + r.out.result = _winreg_EnumValue(p, r.in.handle, r.in.enum_index, r.in.name, r.in.type, r.in.data, r.in.data_size, r.in.value_length); if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &r); @@ -995,12 +995,7 @@ static BOOL api_winreg_QueryInfoKey(pipes_struct *p) NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r); ZERO_STRUCT(r.out); - r.out.class_out = talloc_zero_size(mem_ctx, sizeof(*r.out.class_out)); - if (r.out.class_out == NULL) { - talloc_free(mem_ctx); - return False; - } - + r.out.classname = r.in.classname; r.out.num_subkeys = talloc_zero_size(mem_ctx, sizeof(*r.out.num_subkeys)); if (r.out.num_subkeys == NULL) { talloc_free(mem_ctx); @@ -1049,7 +1044,7 @@ static BOOL api_winreg_QueryInfoKey(pipes_struct *p) return False; } - r.out.result = _winreg_QueryInfoKey(p, r.in.handle, r.in.class_in, r.out.class_out, r.out.num_subkeys, r.out.max_subkeylen, r.out.max_subkeysize, r.out.num_values, r.out.max_valnamelen, r.out.max_valbufsize, r.out.secdescsize, r.out.last_changed_time); + r.out.result = _winreg_QueryInfoKey(p, r.in.handle, r.in.classname, r.out.num_subkeys, r.out.max_subkeylen, r.out.max_subkeysize, r.out.num_values, r.out.max_valnamelen, r.out.max_valbufsize, r.out.secdescsize, r.out.last_changed_time); if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r); diff --git a/source3/librpc/gen_ndr/srv_winreg.h b/source3/librpc/gen_ndr/srv_winreg.h index 1dd956a3af..fecc5442d8 100644 --- a/source3/librpc/gen_ndr/srv_winreg.h +++ b/source3/librpc/gen_ndr/srv_winreg.h @@ -11,13 +11,13 @@ WERROR _winreg_CreateKey(pipes_struct *p, struct policy_handle *handle, struct w WERROR _winreg_DeleteKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String key); WERROR _winreg_DeleteValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value); WERROR _winreg_EnumKey(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time); -WERROR _winreg_EnumValue(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length); +WERROR _winreg_EnumValue(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length); WERROR _winreg_FlushKey(pipes_struct *p, struct policy_handle *handle); WERROR _winreg_GetKeySecurity(pipes_struct *p, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd); WERROR _winreg_LoadKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename); WERROR _winreg_NotifyChangeKeyValue(pipes_struct *p, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2); WERROR _winreg_OpenKey(pipes_struct *p, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle); -WERROR _winreg_QueryInfoKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String class_in, struct winreg_String *class_out, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time); +WERROR _winreg_QueryInfoKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time); WERROR _winreg_QueryValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length); WERROR _winreg_ReplaceKey(pipes_struct *p); WERROR _winreg_RestoreKey(pipes_struct *p); diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h index aa324ac0ce..6fc5f1cc01 100644 --- a/source3/librpc/gen_ndr/winreg.h +++ b/source3/librpc/gen_ndr/winreg.h @@ -215,17 +215,17 @@ struct winreg_EnumValue { uint32_t enum_index; struct winreg_StringBuf *name;/* [ref] */ enum winreg_Type *type;/* [unique] */ - uint8_t *value;/* [unique,length_is(*length),size_is(*size)] */ - uint32_t *size;/* [unique] */ - uint32_t *length;/* [unique] */ + uint8_t *data;/* [unique,length_is(*value_length),size_is(*data_size)] */ + uint32_t *data_size;/* [unique] */ + uint32_t *value_length;/* [unique] */ } in; struct { struct winreg_StringBuf *name;/* [ref] */ enum winreg_Type *type;/* [unique] */ - uint8_t *value;/* [unique,length_is(*length),size_is(*size)] */ - uint32_t *size;/* [unique] */ - uint32_t *length;/* [unique] */ + uint8_t *data;/* [unique,length_is(*value_length),size_is(*data_size)] */ + uint32_t *data_size;/* [unique] */ + uint32_t *value_length;/* [unique] */ WERROR result; } out; @@ -310,11 +310,11 @@ struct winreg_OpenKey { struct winreg_QueryInfoKey { struct { struct policy_handle *handle;/* [ref] */ - struct winreg_String class_in; + struct winreg_String *classname;/* [ref] */ } in; struct { - struct winreg_String *class_out;/* [unique] */ + struct winreg_String *classname;/* [ref] */ uint32_t *num_subkeys;/* [ref] */ uint32_t *max_subkeylen;/* [ref] */ uint32_t *max_subkeysize;/* [ref] */ diff --git a/source3/librpc/idl/winreg.idl b/source3/librpc/idl/winreg.idl index 0a58362152..d09a8a3fc9 100644 --- a/source3/librpc/idl/winreg.idl +++ b/source3/librpc/idl/winreg.idl @@ -155,9 +155,9 @@ [in] uint32 enum_index, [in,out,ref] winreg_StringBuf *name, [in,out,unique] winreg_Type *type, - [in,out,unique,size_is(*size),length_is(*length)] uint8 *value, - [in,out,unique] uint32 *size, - [in,out,unique] uint32 *length + [in,out,unique,size_is(*data_size),length_is(*value_length)] uint8 *data, + [in,out,unique] uint32 *data_size, + [in,out,unique] uint32 *value_length ); /******************/ @@ -208,8 +208,7 @@ /* Function: 0x10 */ WERROR winreg_QueryInfoKey( [in,ref] policy_handle *handle, - [in] winreg_String class_in, - [out] winreg_String *class_out, + [in,out,ref] winreg_String *classname, [out,ref] uint32 *num_subkeys, [out,ref] uint32 *max_subkeylen, [out,ref] uint32 *max_subkeysize, diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index 9b0420a4ec..42f0606ca6 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -70,11 +70,11 @@ NTSTATUS rpccli_winreg_query_key(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct uint32 *secdescsize, NTTIME *mod_time) { NTSTATUS status; - struct winreg_String classname_in, classname_out; + struct winreg_String classname; - classname_in.name = key_class; + classname.name = key_class; status = rpccli_winreg_QueryInfoKey( cli, mem_ctx, hnd, - classname_in, &classname_out, num_subkeys, + &classname, num_subkeys, max_subkeylen, max_subkeysize, num_values, max_valnamelen, max_valbufsize, secdescsize, mod_time ); diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index b874c5e5d1..7adc29ec0a 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -492,12 +492,12 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct policy_handle *handle, struct ****************************************************************************/ WERROR _winreg_QueryInfoKey(pipes_struct *p, struct policy_handle *handle, - struct winreg_String class_in, - struct winreg_String *class_out, uint32_t *num_subkeys, - uint32_t *max_subkeylen, uint32_t *max_subkeysize, + struct winreg_String *classname, + uint32_t *num_subkeys, uint32_t *max_subkeylen, + uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, - uint32_t *max_valbufsize, uint32_t *secdescsize, - NTTIME *last_changed_time) + uint32_t *max_valbufsize, + uint32_t *secdescsize, NTTIME *last_changed_time) { WERROR status = WERR_OK; REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, handle ); @@ -506,22 +506,23 @@ WERROR _winreg_QueryInfoKey(pipes_struct *p, struct policy_handle *handle, return WERR_BADFID; if ( !get_subkey_information( regkey, num_subkeys, max_subkeylen) ) { - DEBUG(0,("_reg_query_key: get_subkey_information() failed!\n")); + DEBUG(0,("_winreg_QueryInfoKey: get_subkey_information() failed!\n")); return WERR_ACCESS_DENIED; } if ( !get_value_information( regkey, num_values, max_valnamelen, max_valbufsize) ) { - DEBUG(0,("_reg_query_key: get_value_information() failed!\n")); + DEBUG(0,("_winreg_QueryInfoKey: get_value_information() failed!\n")); return WERR_ACCESS_DENIED; } - *secdescsize = 0x00000078; /* size for key's sec_desc */ - - /* Win9x set this to 0x0 since it does not keep timestamps. - Doing the same here for simplicity --jerry */ - + *secdescsize = 0; /* used to be hard coded for 0x00000078 */ *last_changed_time = 0; + *max_subkeysize = 0; /* maybe this is the classname length ? */ + /* don't bother with class names for now */ + + classname->name = NULL; + return status; } @@ -586,7 +587,7 @@ done: Implementation of REG_ENUM_VALUE ****************************************************************************/ -WERROR _winreg_EnumValue(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length) +WERROR _winreg_EnumValue(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length) { WERROR status = WERR_OK; REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, handle ); @@ -595,17 +596,17 @@ WERROR _winreg_EnumValue(pipes_struct *p, struct policy_handle *handle, uint32_t if ( !regkey ) return WERR_BADFID; - if ( !name || !type || !value || !size || !length ) + if ( !name ) return WERR_INVALID_PARAM; - - DEBUG(8,("_reg_enum_value: enumerating values for key [%s]\n", regkey->name)); + + DEBUG(8,("_winreg_EnumValue: enumerating values for key [%s]\n", regkey->name)); if ( !fetch_reg_values_specific( regkey, &val, enum_index ) ) { status = WERR_NO_MORE_ITEMS; goto done; } - DEBUG(10,("_reg_enum_value: retrieved value named [%s]\n", val->valuename)); + DEBUG(10,("_winreg_EnumValue: retrieved value named [%s]\n", val->valuename)); /* subkey has the string name now */ @@ -613,15 +614,18 @@ WERROR _winreg_EnumValue(pipes_struct *p, struct policy_handle *handle, uint32_t status = WERR_NOMEM; } - *size = regval_size( val ); - *length = regval_size( val ); + *value_length = regval_size( val ); + *type = val->type; - if ( (value = talloc_memdup( p->mem_ctx, regval_data_p(val), *size )) == NULL ) { - status = WERR_NOMEM; + if ( *data_size == 0 ) { + status = WERR_OK; + } else if ( *value_length > *data_size ) { + status = WERR_MORE_DATA; + } else { + memcpy( data, regval_data_p(val), *value_length ); + status = WERR_OK; } - *type = val->type; - done: free_registry_value( val ); |