summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/gen_ndr/cli_winreg.c2
-rw-r--r--librpc/gen_ndr/cli_winreg.h2
-rw-r--r--librpc/gen_ndr/ndr_winreg.c89
-rw-r--r--librpc/gen_ndr/ndr_winreg.h1
-rw-r--r--librpc/gen_ndr/winreg.h10
5 files changed, 91 insertions, 13 deletions
diff --git a/librpc/gen_ndr/cli_winreg.c b/librpc/gen_ndr/cli_winreg.c
index 58eff22966..00f9e2d610 100644
--- a/librpc/gen_ndr/cli_winreg.c
+++ b/librpc/gen_ndr/cli_winreg.c
@@ -497,7 +497,7 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
uint32_t enum_index /* [in] */,
- struct winreg_StringBuf *name /* [in,out] [ref] */,
+ struct winreg_ValNameBuf *name /* [in,out] [ref] */,
enum winreg_Type *type /* [in,out] [unique] */,
uint8_t *value /* [in,out] [unique,length_is(*length),size_is(*size)] */,
uint32_t *size /* [in,out] [unique] */,
diff --git a/librpc/gen_ndr/cli_winreg.h b/librpc/gen_ndr/cli_winreg.h
index a5a5fa2e48..20d2a755ce 100644
--- a/librpc/gen_ndr/cli_winreg.h
+++ b/librpc/gen_ndr/cli_winreg.h
@@ -68,7 +68,7 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
uint32_t enum_index /* [in] */,
- struct winreg_StringBuf *name /* [in,out] [ref] */,
+ struct winreg_ValNameBuf *name /* [in,out] [ref] */,
enum winreg_Type *type /* [in,out] [unique] */,
uint8_t *value /* [in,out] [unique,length_is(*length),size_is(*size)] */,
uint32_t *size /* [in,out] [unique] */,
diff --git a/librpc/gen_ndr/ndr_winreg.c b/librpc/gen_ndr/ndr_winreg.c
index d37cf8fcde..fe76bcaf5b 100644
--- a/librpc/gen_ndr/ndr_winreg.c
+++ b/librpc/gen_ndr/ndr_winreg.c
@@ -275,7 +275,7 @@ static enum ndr_err_code ndr_push_winreg_StringBuf(struct ndr_push *ndr, int ndr
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term_null(r->name) * 2));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
}
@@ -283,8 +283,8 @@ static enum ndr_err_code ndr_push_winreg_StringBuf(struct ndr_push *ndr, int ndr
if (r->name) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size / 2));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2 / 2));
- NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term(r->name) * 2 / 2, sizeof(uint16_t), CH_UTF16));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term_null(r->name) * 2 / 2));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term_null(r->name) * 2 / 2, sizeof(uint16_t), CH_UTF16));
}
}
return NDR_ERR_SUCCESS;
@@ -331,6 +331,77 @@ _PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name
{
ndr_print_struct(ndr, name, "winreg_StringBuf");
ndr->depth++;
+ ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term_null(r->name) * 2:r->length);
+ ndr_print_uint16(ndr, "size", r->size);
+ ndr_print_ptr(ndr, "name", r->name);
+ ndr->depth++;
+ if (r->name) {
+ ndr_print_string(ndr, "name", r->name);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_winreg_ValNameBuf(struct ndr_push *ndr, int ndr_flags, const struct winreg_ValNameBuf *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->name) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size / 2));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2 / 2));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term(r->name) * 2 / 2, sizeof(uint16_t), CH_UTF16));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_winreg_ValNameBuf(struct ndr_pull *ndr, int ndr_flags, struct winreg_ValNameBuf *r)
+{
+ uint32_t _ptr_name;
+ TALLOC_CTX *_mem_save_name_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
+ if (_ptr_name) {
+ NDR_PULL_ALLOC(ndr, r->name);
+ } else {
+ r->name = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->name) {
+ _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
+ if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->name)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->name), ndr_get_array_length(ndr, &r->name));
+ }
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t), CH_UTF16));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
+ }
+ if (r->name) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->name, r->size / 2));
+ }
+ if (r->name) {
+ NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->name, r->length / 2));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_winreg_ValNameBuf(struct ndr_print *ndr, const char *name, const struct winreg_ValNameBuf *r)
+{
+ ndr_print_struct(ndr, name, "winreg_ValNameBuf");
+ ndr->depth++;
ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name) * 2:r->length);
ndr_print_uint16(ndr, "size", r->size);
ndr_print_ptr(ndr, "name", r->name);
@@ -1458,7 +1529,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_winreg_EnumValue(struct ndr_push *ndr, int f
if (r->in.name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
+ NDR_CHECK(ndr_push_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.type));
if (r->in.type) {
NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->in.type));
@@ -1483,7 +1554,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_winreg_EnumValue(struct ndr_push *ndr, int f
if (r->out.name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
+ NDR_CHECK(ndr_push_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.type));
if (r->out.type) {
NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type));
@@ -1536,7 +1607,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int f
}
_mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
+ NDR_CHECK(ndr_pull_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type));
if (_ptr_type) {
@@ -1609,7 +1680,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int f
}
_mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.name, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
+ NDR_CHECK(ndr_pull_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type));
if (_ptr_type) {
@@ -1695,7 +1766,7 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name
ndr_print_uint32(ndr, "enum_index", r->in.enum_index);
ndr_print_ptr(ndr, "name", r->in.name);
ndr->depth++;
- ndr_print_winreg_StringBuf(ndr, "name", r->in.name);
+ ndr_print_winreg_ValNameBuf(ndr, "name", r->in.name);
ndr->depth--;
ndr_print_ptr(ndr, "type", r->in.type);
ndr->depth++;
@@ -1729,7 +1800,7 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name
ndr->depth++;
ndr_print_ptr(ndr, "name", r->out.name);
ndr->depth++;
- ndr_print_winreg_StringBuf(ndr, "name", r->out.name);
+ ndr_print_winreg_ValNameBuf(ndr, "name", r->out.name);
ndr->depth--;
ndr_print_ptr(ndr, "type", r->out.type);
ndr->depth++;
diff --git a/librpc/gen_ndr/ndr_winreg.h b/librpc/gen_ndr/ndr_winreg.h
index bc6cad1bcb..a8766f4cca 100644
--- a/librpc/gen_ndr/ndr_winreg.h
+++ b/librpc/gen_ndr/ndr_winreg.h
@@ -93,6 +93,7 @@ void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const st
void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r);
void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r);
void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r);
+void ndr_print_winreg_ValNameBuf(struct ndr_print *ndr, const char *name, const struct winreg_ValNameBuf *r);
enum ndr_err_code ndr_push_winreg_NotifyChangeType(struct ndr_push *ndr, int ndr_flags, uint32_t r);
enum ndr_err_code ndr_pull_winreg_NotifyChangeType(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
void ndr_print_winreg_NotifyChangeType(struct ndr_print *ndr, const char *name, uint32_t r);
diff --git a/librpc/gen_ndr/winreg.h b/librpc/gen_ndr/winreg.h
index a98120ccf5..79cf33e769 100644
--- a/librpc/gen_ndr/winreg.h
+++ b/librpc/gen_ndr/winreg.h
@@ -84,6 +84,12 @@ enum winreg_CreateAction
;
struct winreg_StringBuf {
+ uint16_t length;/* [value(strlen_m_term_null(name)*2)] */
+ uint16_t size;
+ const char *name;/* [unique,length_is(length/2),charset(UTF16),size_is(size/2)] */
+};
+
+struct winreg_ValNameBuf {
uint16_t length;/* [value(strlen_m_term(name)*2)] */
uint16_t size;
const char *name;/* [unique,length_is(length/2),charset(UTF16),size_is(size/2)] */
@@ -261,7 +267,7 @@ struct winreg_EnumValue {
struct {
struct policy_handle *handle;/* [ref] */
uint32_t enum_index;
- struct winreg_StringBuf *name;/* [ref] */
+ struct winreg_ValNameBuf *name;/* [ref] */
enum winreg_Type *type;/* [unique] */
uint8_t *value;/* [unique,length_is(*length),size_is(*size)] */
uint32_t *size;/* [unique] */
@@ -269,7 +275,7 @@ struct winreg_EnumValue {
} in;
struct {
- struct winreg_StringBuf *name;/* [ref] */
+ struct winreg_ValNameBuf *name;/* [ref] */
enum winreg_Type *type;/* [unique] */
uint8_t *value;/* [unique,length_is(*length),size_is(*size)] */
uint32_t *size;/* [unique] */