diff options
Diffstat (limited to 'source3/librpc/gen_ndr')
-rw-r--r-- | source3/librpc/gen_ndr/cli_ntsvcs.c | 17 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_ntsvcs.h | 7 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_ntsvcs.c | 153 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ntsvcs.h | 14 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_ntsvcs.c | 10 |
5 files changed, 201 insertions, 0 deletions
diff --git a/source3/librpc/gen_ndr/cli_ntsvcs.c b/source3/librpc/gen_ndr/cli_ntsvcs.c index 615cdb64c9..864caef1f3 100644 --- a/source3/librpc/gen_ndr/cli_ntsvcs.c +++ b/source3/librpc/gen_ndr/cli_ntsvcs.c @@ -566,12 +566,25 @@ NTSTATUS rpccli_PNP_GetDepth(struct rpc_pipe_client *cli, NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *devicepath /* [in] [ref,charset(UTF16)] */, + uint32_t property /* [in] */, + uint32_t *unknown1 /* [in,out] [ref] */, + uint8_t *buffer /* [out] [ref,length_is(*buffer_size),size_is(*buffer_size)] */, + uint32_t *buffer_size /* [in,out] [ref] */, + uint32_t *needed /* [in,out] [ref] */, + uint32_t unknown3 /* [in] */, WERROR *werror) { struct PNP_GetDeviceRegProp r; NTSTATUS status; /* In parameters */ + r.in.devicepath = devicepath; + r.in.property = property; + r.in.unknown1 = unknown1; + r.in.buffer_size = buffer_size; + r.in.needed = needed; + r.in.unknown3 = unknown3; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(PNP_GetDeviceRegProp, &r); @@ -597,6 +610,10 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli, } /* Return variables */ + *unknown1 = *r.out.unknown1; + memcpy(buffer, r.out.buffer, *r.in.buffer_size); + *buffer_size = *r.out.buffer_size; + *needed = *r.out.needed; /* Return result */ if (werror) { diff --git a/source3/librpc/gen_ndr/cli_ntsvcs.h b/source3/librpc/gen_ndr/cli_ntsvcs.h index c20673f96b..a52a79ecc5 100644 --- a/source3/librpc/gen_ndr/cli_ntsvcs.h +++ b/source3/librpc/gen_ndr/cli_ntsvcs.h @@ -48,6 +48,13 @@ NTSTATUS rpccli_PNP_GetDepth(struct rpc_pipe_client *cli, WERROR *werror); NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *devicepath /* [in] [ref,charset(UTF16)] */, + uint32_t property /* [in] */, + uint32_t *unknown1 /* [in,out] [ref] */, + uint8_t *buffer /* [out] [ref,length_is(*buffer_size),size_is(*buffer_size)] */, + uint32_t *buffer_size /* [in,out] [ref] */, + uint32_t *needed /* [in,out] [ref] */, + uint32_t unknown3 /* [in] */, WERROR *werror); NTSTATUS rpccli_PNP_SetDeviceRegProp(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/librpc/gen_ndr/ndr_ntsvcs.c b/source3/librpc/gen_ndr/ndr_ntsvcs.c index 9a0e2bcf4f..1ce5b15a88 100644 --- a/source3/librpc/gen_ndr/ndr_ntsvcs.c +++ b/source3/librpc/gen_ndr/ndr_ntsvcs.c @@ -688,8 +688,48 @@ _PUBLIC_ void ndr_print_PNP_GetDepth(struct ndr_print *ndr, const char *name, in static enum ndr_err_code ndr_push_PNP_GetDeviceRegProp(struct ndr_push *ndr, int flags, const struct PNP_GetDeviceRegProp *r) { if (flags & NDR_IN) { + if (r->in.devicepath == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.devicepath, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.devicepath, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.devicepath, ndr_charset_length(r->in.devicepath, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.property)); + if (r->in.unknown1 == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.unknown1)); + if (r->in.buffer_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.buffer_size)); + if (r->in.needed == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.needed)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown3)); } if (flags & NDR_OUT) { + if (r->out.unknown1 == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.unknown1)); + if (r->out.buffer == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.buffer, *r->out.buffer_size)); + if (r->out.buffer_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size)); + if (r->out.needed == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.needed)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -697,10 +737,89 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceRegProp(struct ndr_push *ndr, int static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int flags, struct PNP_GetDeviceRegProp *r) { + TALLOC_CTX *_mem_save_unknown1_0; + TALLOC_CTX *_mem_save_buffer_size_0; + TALLOC_CTX *_mem_save_needed_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.devicepath)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.devicepath)); + if (ndr_get_array_length(ndr, &r->in.devicepath) > ndr_get_array_size(ndr, &r->in.devicepath)) { + 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.devicepath), ndr_get_array_length(ndr, &r->in.devicepath)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.devicepath), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.devicepath, ndr_get_array_length(ndr, &r->in.devicepath), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.property)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.unknown1); + } + _mem_save_unknown1_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.unknown1, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.unknown1)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_unknown1_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.buffer_size); + } + _mem_save_buffer_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.buffer_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.buffer_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.needed); + } + _mem_save_needed_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.needed, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.needed)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_needed_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown3)); + NDR_PULL_ALLOC(ndr, r->out.unknown1); + *r->out.unknown1 = *r->in.unknown1; + NDR_PULL_ALLOC_N(ndr, r->out.buffer, *r->in.buffer_size); + memset(r->out.buffer, 0, (*r->in.buffer_size) * sizeof(*r->out.buffer)); + NDR_PULL_ALLOC(ndr, r->out.buffer_size); + *r->out.buffer_size = *r->in.buffer_size; + NDR_PULL_ALLOC(ndr, r->out.needed); + *r->out.needed = *r->in.needed; } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.unknown1); + } + _mem_save_unknown1_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.unknown1, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.unknown1)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_unknown1_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->out.buffer)); + if (ndr_get_array_length(ndr, &r->out.buffer) > ndr_get_array_size(ndr, &r->out.buffer)) { + 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.buffer), ndr_get_array_length(ndr, &r->out.buffer)); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC_N(ndr, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer)); + } + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.buffer, ndr_get_array_length(ndr, &r->out.buffer))); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.buffer_size); + } + _mem_save_buffer_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.buffer_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.needed); + } + _mem_save_needed_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.needed, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.needed)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_needed_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + if (r->out.buffer) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.buffer, *r->out.buffer_size)); + } + if (r->out.buffer) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.buffer, *r->out.buffer_size)); + } } return NDR_ERR_SUCCESS; } @@ -715,11 +834,45 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceRegProp(struct ndr_print *ndr, const char * if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "PNP_GetDeviceRegProp"); ndr->depth++; + ndr_print_ptr(ndr, "devicepath", r->in.devicepath); + ndr->depth++; + ndr_print_string(ndr, "devicepath", r->in.devicepath); + ndr->depth--; + ndr_print_uint32(ndr, "property", r->in.property); + ndr_print_ptr(ndr, "unknown1", r->in.unknown1); + ndr->depth++; + ndr_print_uint32(ndr, "unknown1", *r->in.unknown1); + ndr->depth--; + ndr_print_ptr(ndr, "buffer_size", r->in.buffer_size); + ndr->depth++; + ndr_print_uint32(ndr, "buffer_size", *r->in.buffer_size); + ndr->depth--; + ndr_print_ptr(ndr, "needed", r->in.needed); + ndr->depth++; + ndr_print_uint32(ndr, "needed", *r->in.needed); + ndr->depth--; + ndr_print_uint32(ndr, "unknown3", r->in.unknown3); ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "PNP_GetDeviceRegProp"); ndr->depth++; + ndr_print_ptr(ndr, "unknown1", r->out.unknown1); + ndr->depth++; + ndr_print_uint32(ndr, "unknown1", *r->out.unknown1); + ndr->depth--; + ndr_print_ptr(ndr, "buffer", r->out.buffer); + ndr->depth++; + ndr_print_array_uint8(ndr, "buffer", r->out.buffer, *r->out.buffer_size); + ndr->depth--; + ndr_print_ptr(ndr, "buffer_size", r->out.buffer_size); + ndr->depth++; + ndr_print_uint32(ndr, "buffer_size", *r->out.buffer_size); + ndr->depth--; + ndr_print_ptr(ndr, "needed", r->out.needed); + ndr->depth++; + ndr_print_uint32(ndr, "needed", *r->out.needed); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } diff --git a/source3/librpc/gen_ndr/ntsvcs.h b/source3/librpc/gen_ndr/ntsvcs.h index 9cdfa656b4..95484e49f5 100644 --- a/source3/librpc/gen_ndr/ntsvcs.h +++ b/source3/librpc/gen_ndr/ntsvcs.h @@ -5,6 +5,7 @@ #ifndef _HEADER_ntsvcs #define _HEADER_ntsvcs +#define DEV_REGPROP_DESC ( 1 ) struct PNP_HwProfInfo { uint32_t unknown1; uint16_t unknown2[160]; @@ -130,6 +131,19 @@ struct PNP_GetDepth { struct PNP_GetDeviceRegProp { struct { + const char *devicepath;/* [ref,charset(UTF16)] */ + uint32_t property; + uint32_t unknown3; + uint32_t *unknown1;/* [ref] */ + uint32_t *buffer_size;/* [ref] */ + uint32_t *needed;/* [ref] */ + } in; + + struct { + uint8_t *buffer;/* [ref,length_is(*buffer_size),size_is(*buffer_size)] */ + uint32_t *unknown1;/* [ref] */ + uint32_t *buffer_size;/* [ref] */ + uint32_t *needed;/* [ref] */ WERROR result; } out; diff --git a/source3/librpc/gen_ndr/srv_ntsvcs.c b/source3/librpc/gen_ndr/srv_ntsvcs.c index 339de6c747..523b4d8c91 100644 --- a/source3/librpc/gen_ndr/srv_ntsvcs.c +++ b/source3/librpc/gen_ndr/srv_ntsvcs.c @@ -1007,6 +1007,16 @@ static bool api_PNP_GetDeviceRegProp(pipes_struct *p) NDR_PRINT_IN_DEBUG(PNP_GetDeviceRegProp, r); } + ZERO_STRUCT(r->out); + r->out.unknown1 = r->in.unknown1; + r->out.buffer = talloc_zero_array(r, uint8_t, *r->out.buffer_size); + if (r->out.buffer == NULL) { + talloc_free(r); + return false; + } + + r->out.buffer_size = r->in.buffer_size; + r->out.needed = r->in.needed; r->out.result = _PNP_GetDeviceRegProp(p, r); if (p->rng_fault_state) { |