diff options
author | Günther Deschner <gd@samba.org> | 2009-12-05 00:50:18 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-12-07 14:42:12 +0100 |
commit | 08823166a13d5ec3027b0c5a0db5e684b8e3c3b6 (patch) | |
tree | 6d79085b5872d5624ddc1e7f7e56543a5a436e40 /librpc/gen_ndr | |
parent | a367b2b5df30b92ccacc4fc15c07c1fd955c7d5b (diff) | |
download | samba-08823166a13d5ec3027b0c5a0db5e684b8e3c3b6.tar.gz samba-08823166a13d5ec3027b0c5a0db5e684b8e3c3b6.tar.bz2 samba-08823166a13d5ec3027b0c5a0db5e684b8e3c3b6.zip |
spoolss: rework spoolss_GetPrinterDataEx and spoolss_SetPrinterDataEx.
Guenther
Diffstat (limited to 'librpc/gen_ndr')
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.c | 30 | ||||
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.h | 16 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.c | 114 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.h | 15 | ||||
-rw-r--r-- | librpc/gen_ndr/spoolss.h | 63 | ||||
-rw-r--r-- | librpc/gen_ndr/srv_spoolss.c | 8 |
6 files changed, 183 insertions, 63 deletions
diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c index 0a5c2a6eb7..e63a78195f 100644 --- a/librpc/gen_ndr/cli_spoolss.c +++ b/librpc/gen_ndr/cli_spoolss.c @@ -11710,8 +11710,8 @@ struct tevent_req *rpccli_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx, const char *_key_name /* [in] [charset(UTF16)] */, const char *_value_name /* [in] [charset(UTF16)] */, enum winreg_Type _type /* [in] */, - uint8_t *_buffer /* [in] [ref,size_is(offered)] */, - uint32_t _offered /* [in] */) + union spoolss_PrinterData _data /* [in] [subcontext(4),switch_is(type)] */, + uint32_t __offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */) { struct tevent_req *req; struct rpccli_spoolss_SetPrinterDataEx_state *state; @@ -11730,8 +11730,8 @@ struct tevent_req *rpccli_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx, state->orig.in.key_name = _key_name; state->orig.in.value_name = _value_name; state->orig.in.type = _type; - state->orig.in.buffer = _buffer; - state->orig.in.offered = _offered; + state->orig.in.data = _data; + state->orig.in._offered = __offered; /* Out parameters */ @@ -11814,8 +11814,8 @@ NTSTATUS rpccli_spoolss_SetPrinterDataEx(struct rpc_pipe_client *cli, const char *key_name /* [in] [charset(UTF16)] */, const char *value_name /* [in] [charset(UTF16)] */, enum winreg_Type type /* [in] */, - uint8_t *buffer /* [in] [ref,size_is(offered)] */, - uint32_t offered /* [in] */, + union spoolss_PrinterData data /* [in] [subcontext(4),switch_is(type)] */, + uint32_t _offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */, WERROR *werror) { struct spoolss_SetPrinterDataEx r; @@ -11826,8 +11826,8 @@ NTSTATUS rpccli_spoolss_SetPrinterDataEx(struct rpc_pipe_client *cli, r.in.key_name = key_name; r.in.value_name = value_name; r.in.type = type; - r.in.buffer = buffer; - r.in.offered = offered; + r.in.data = data; + r.in._offered = _offered; status = cli->dispatch(cli, mem_ctx, @@ -11868,9 +11868,9 @@ struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx, struct policy_handle *_handle /* [in] [ref] */, const char *_key_name /* [in] [charset(UTF16)] */, const char *_value_name /* [in] [charset(UTF16)] */, - enum winreg_Type *_type /* [out] [ref] */, - uint8_t *_buffer /* [out] [ref,size_is(offered)] */, uint32_t _offered /* [in] */, + enum winreg_Type *_type /* [out] [ref] */, + union spoolss_PrinterData *_data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, uint32_t *_needed /* [out] [ref] */) { struct tevent_req *req; @@ -11893,7 +11893,7 @@ struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx, /* Out parameters */ state->orig.out.type = _type; - state->orig.out.buffer = _buffer; + state->orig.out.data = _data; state->orig.out.needed = _needed; /* Result */ @@ -11943,7 +11943,7 @@ static void rpccli_spoolss_GetPrinterDataEx_done(struct tevent_req *subreq) /* Copy out parameters */ *state->orig.out.type = *state->tmp.out.type; - memcpy(state->orig.out.buffer, state->tmp.out.buffer, (state->tmp.in.offered) * sizeof(*state->orig.out.buffer)); + *state->orig.out.data = *state->tmp.out.data; *state->orig.out.needed = *state->tmp.out.needed; /* Copy result */ @@ -11983,9 +11983,9 @@ NTSTATUS rpccli_spoolss_GetPrinterDataEx(struct rpc_pipe_client *cli, struct policy_handle *handle /* [in] [ref] */, const char *key_name /* [in] [charset(UTF16)] */, const char *value_name /* [in] [charset(UTF16)] */, - enum winreg_Type *type /* [out] [ref] */, - uint8_t *buffer /* [out] [ref,size_is(offered)] */, uint32_t offered /* [in] */, + enum winreg_Type *type /* [out] [ref] */, + union spoolss_PrinterData *data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, uint32_t *needed /* [out] [ref] */, WERROR *werror) { @@ -12014,7 +12014,7 @@ NTSTATUS rpccli_spoolss_GetPrinterDataEx(struct rpc_pipe_client *cli, /* Return variables */ *type = *r.out.type; - memcpy(buffer, r.out.buffer, (r.in.offered) * sizeof(*buffer)); + *data = *r.out.data; *needed = *r.out.needed; /* Return result */ diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h index 58a45ee672..f2c1353628 100644 --- a/librpc/gen_ndr/cli_spoolss.h +++ b/librpc/gen_ndr/cli_spoolss.h @@ -1199,8 +1199,8 @@ struct tevent_req *rpccli_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx, const char *_key_name /* [in] [charset(UTF16)] */, const char *_value_name /* [in] [charset(UTF16)] */, enum winreg_Type _type /* [in] */, - uint8_t *_buffer /* [in] [ref,size_is(offered)] */, - uint32_t _offered /* [in] */); + union spoolss_PrinterData _data /* [in] [subcontext(4),switch_is(type)] */, + uint32_t __offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */); NTSTATUS rpccli_spoolss_SetPrinterDataEx_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, WERROR *result); @@ -1210,8 +1210,8 @@ NTSTATUS rpccli_spoolss_SetPrinterDataEx(struct rpc_pipe_client *cli, const char *key_name /* [in] [charset(UTF16)] */, const char *value_name /* [in] [charset(UTF16)] */, enum winreg_Type type /* [in] */, - uint8_t *buffer /* [in] [ref,size_is(offered)] */, - uint32_t offered /* [in] */, + union spoolss_PrinterData data /* [in] [subcontext(4),switch_is(type)] */, + uint32_t _offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */, WERROR *werror); struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -1219,9 +1219,9 @@ struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx, struct policy_handle *_handle /* [in] [ref] */, const char *_key_name /* [in] [charset(UTF16)] */, const char *_value_name /* [in] [charset(UTF16)] */, - enum winreg_Type *_type /* [out] [ref] */, - uint8_t *_buffer /* [out] [ref,size_is(offered)] */, uint32_t _offered /* [in] */, + enum winreg_Type *_type /* [out] [ref] */, + union spoolss_PrinterData *_data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, uint32_t *_needed /* [out] [ref] */); NTSTATUS rpccli_spoolss_GetPrinterDataEx_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, @@ -1231,9 +1231,9 @@ NTSTATUS rpccli_spoolss_GetPrinterDataEx(struct rpc_pipe_client *cli, struct policy_handle *handle /* [in] [ref] */, const char *key_name /* [in] [charset(UTF16)] */, const char *value_name /* [in] [charset(UTF16)] */, - enum winreg_Type *type /* [out] [ref] */, - uint8_t *buffer /* [out] [ref,size_is(offered)] */, uint32_t offered /* [in] */, + enum winreg_Type *type /* [out] [ref] */, + union spoolss_PrinterData *data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */, uint32_t *needed /* [out] [ref] */, WERROR *werror); struct tevent_req *rpccli_spoolss_EnumPrinterDataEx_send(TALLOC_CTX *mem_ctx, diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c index f783a834ee..eba51dce91 100644 --- a/librpc/gen_ndr/ndr_spoolss.c +++ b/librpc/gen_ndr/ndr_spoolss.c @@ -27662,7 +27662,7 @@ _PUBLIC_ void ndr_print_spoolss_4c(struct ndr_print *ndr, const char *name, int ndr->depth--; } -static enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterDataEx *r) +_PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_SetPrinterDataEx *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -27678,12 +27678,8 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->in.value_name, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.value_name, ndr_charset_length(r->in.value_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); - if (r->in.buffer == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->in.offered)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.buffer, r->in.offered)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->in.data)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in._offered)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); @@ -27691,6 +27687,21 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, return NDR_ERR_SUCCESS; } +_PUBLIC_ enum ndr_err_code ndr_push___spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_SetPrinterDataEx *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); + } + if (flags & NDR_OUT) { + if (r->out.data == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.data, r->in.type)); + NDR_CHECK(ndr_push_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); + } + return NDR_ERR_SUCCESS; +} + static enum ndr_err_code ndr_pull_spoolss_SetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_SetPrinterDataEx *r) { TALLOC_CTX *_mem_save_handle_0; @@ -27717,15 +27728,14 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterDataEx(struct ndr_pull *ndr, NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.value_name), sizeof(uint16_t))); NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.value_name, ndr_get_array_length(ndr, &r->in.value_name), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type)); - NDR_CHECK(ndr_pull_array_size(ndr, &r->in.buffer)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC_N(ndr, r->in.buffer, ndr_get_array_size(ndr, &r->in.buffer)); - } - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.buffer, ndr_get_array_size(ndr, &r->in.buffer))); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); - if (r->in.buffer) { - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.buffer, r->in.offered)); + { + struct ndr_pull *_ndr_data; + NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_data, 4, -1)); + NDR_CHECK(ndr_pull_set_switch_value(_ndr_data, &r->in.data, r->in.type)); + NDR_CHECK(ndr_pull_spoolss_PrinterData(_ndr_data, NDR_SCALARS|NDR_BUFFERS, &r->in.data)); + NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_data, 4, -1)); } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in._offered)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); @@ -27750,11 +27760,9 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterDataEx(struct ndr_print *ndr, const ch ndr_print_string(ndr, "key_name", r->in.key_name); ndr_print_string(ndr, "value_name", r->in.value_name); ndr_print_winreg_Type(ndr, "type", r->in.type); - ndr_print_ptr(ndr, "buffer", r->in.buffer); - ndr->depth++; - ndr_print_array_uint8(ndr, "buffer", r->in.buffer, r->in.offered); - ndr->depth--; - ndr_print_uint32(ndr, "offered", r->in.offered); + ndr_print_set_switch_value(ndr, &r->in.data, r->in.type); + ndr_print_spoolss_PrinterData(ndr, "data", &r->in.data); + ndr_print_uint32(ndr, "_offered", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_spoolss_PrinterData(&r->in.data, r->in.type, ndr->iconv_convenience, flags):r->in._offered); ndr->depth--; } if (flags & NDR_OUT) { @@ -27766,7 +27774,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterDataEx(struct ndr_print *ndr, const ch ndr->depth--; } -static enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r) +_PUBLIC_ enum ndr_err_code ndr_push__spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_GetPrinterDataEx *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -27788,11 +27796,10 @@ static enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type)); - if (r->out.buffer == NULL) { + if (r->out.data == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->in.offered)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.buffer, r->in.offered)); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, *r->out.data)); if (r->out.needed == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -27802,10 +27809,11 @@ static enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r) +_PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_GetPrinterDataEx *r) { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_type_0; + TALLOC_CTX *_mem_save_data_0; TALLOC_CTX *_mem_save_needed_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -27834,8 +27842,8 @@ static enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); NDR_PULL_ALLOC(ndr, r->out.type); ZERO_STRUCTP(r->out.type); - NDR_PULL_ALLOC_N(ndr, r->out.buffer, r->in.offered); - memset(r->out.buffer, 0, (r->in.offered) * sizeof(*r->out.buffer)); + NDR_PULL_ALLOC(ndr, r->out.data); + ZERO_STRUCTP(r->out.data); NDR_PULL_ALLOC(ndr, r->out.needed); ZERO_STRUCTP(r->out.needed); } @@ -27847,11 +27855,13 @@ static enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, NDR_PULL_SET_MEM_CTX(ndr, r->out.type, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_array_size(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_PULL_ALLOC(ndr, r->out.data); } - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer))); + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.data, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, r->out.data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.needed); } @@ -27860,9 +27870,44 @@ static enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, 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->in.offered)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_push___spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_GetPrinterDataEx *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); + } + if (flags & NDR_OUT) { + if (r->out.data == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.data, r->in.type)); + NDR_CHECK(ndr_push_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull___spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct __spoolss_GetPrinterDataEx *r) +{ + TALLOC_CTX *_mem_save_data_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type)); + NDR_PULL_ALLOC(ndr, r->out.data); + ZERO_STRUCTP(r->out.data); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.data); + } + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.data, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.data, r->in.type)); + NDR_CHECK(ndr_pull_spoolss_PrinterData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); } return NDR_ERR_SUCCESS; } @@ -27893,9 +27938,10 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterDataEx(struct ndr_print *ndr, const ch ndr->depth++; ndr_print_winreg_Type(ndr, "type", *r->out.type); ndr->depth--; - ndr_print_ptr(ndr, "buffer", r->out.buffer); + ndr_print_ptr(ndr, "data", r->out.data); ndr->depth++; - ndr_print_array_uint8(ndr, "buffer", r->out.buffer, r->in.offered); + ndr_print_set_switch_value(ndr, r->out.data, *r->out.type); + ndr_print_spoolss_PrinterData(ndr, "data", r->out.data); ndr->depth--; ndr_print_ptr(ndr, "needed", r->out.needed); ndr->depth++; diff --git a/librpc/gen_ndr/ndr_spoolss.h b/librpc/gen_ndr/ndr_spoolss.h index 895e1e9a37..1c31a95ef4 100644 --- a/librpc/gen_ndr/ndr_spoolss.h +++ b/librpc/gen_ndr/ndr_spoolss.h @@ -716,7 +716,22 @@ void ndr_print_spoolss_DeletePrinterData(struct ndr_print *ndr, const char *name void ndr_print_spoolss_4a(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_4a *r); void ndr_print_spoolss_4b(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_4b *r); void ndr_print_spoolss_4c(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_4c *r); +enum ndr_err_code ndr_push__spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_SetPrinterDataEx *r); +enum ndr_err_code ndr_pull__spoolss_SetPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_SetPrinterDataEx *r); +void ndr_print__spoolss_SetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct _spoolss_SetPrinterDataEx *r); +enum ndr_err_code ndr_push___spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_SetPrinterDataEx *r); +enum ndr_err_code ndr_pull___spoolss_SetPrinterDataEx(struct ndr_pull *ndr, int flags, struct __spoolss_SetPrinterDataEx *r); +void ndr_print___spoolss_SetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct __spoolss_SetPrinterDataEx *r); +enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterDataEx *r); void ndr_print_spoolss_SetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_SetPrinterDataEx *r); +enum ndr_err_code ndr_push__spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_GetPrinterDataEx *r); +enum ndr_err_code ndr_pull__spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_GetPrinterDataEx *r); +void ndr_print__spoolss_GetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct _spoolss_GetPrinterDataEx *r); +enum ndr_err_code ndr_push___spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_GetPrinterDataEx *r); +enum ndr_err_code ndr_pull___spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct __spoolss_GetPrinterDataEx *r); +void ndr_print___spoolss_GetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct __spoolss_GetPrinterDataEx *r); +enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterDataEx *r); +enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterDataEx *r); void ndr_print_spoolss_GetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_GetPrinterDataEx *r); enum ndr_err_code ndr_push__spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_EnumPrinterDataEx *r); enum ndr_err_code ndr_pull__spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_EnumPrinterDataEx *r); diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h index e209cb464b..d6c267c82a 100644 --- a/librpc/gen_ndr/spoolss.h +++ b/librpc/gen_ndr/spoolss.h @@ -3468,23 +3468,82 @@ struct spoolss_4c { }; +struct _spoolss_SetPrinterDataEx { + struct { + struct policy_handle *handle;/* [ref] */ + const char *key_name;/* [charset(UTF16)] */ + const char *value_name;/* [charset(UTF16)] */ + enum winreg_Type type; + DATA_BLOB data; + uint32_t _offered; + } in; + + struct { + WERROR result; + } out; + +}; + + +struct __spoolss_SetPrinterDataEx { + struct { + enum winreg_Type type; + } in; + + struct { + union spoolss_PrinterData *data;/* [ref,switch_is(type)] */ + } out; + +}; + + struct spoolss_SetPrinterDataEx { struct { struct policy_handle *handle;/* [ref] */ const char *key_name;/* [charset(UTF16)] */ const char *value_name;/* [charset(UTF16)] */ enum winreg_Type type; - uint8_t *buffer;/* [ref,size_is(offered)] */ + union spoolss_PrinterData data;/* [subcontext(4),switch_is(type)] */ + uint32_t _offered;/* [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct _spoolss_GetPrinterDataEx { + struct { + struct policy_handle *handle;/* [ref] */ + const char *key_name;/* [charset(UTF16)] */ + const char *value_name;/* [charset(UTF16)] */ uint32_t offered; } in; struct { + enum winreg_Type *type;/* [ref] */ + DATA_BLOB *data;/* [ref] */ + uint32_t *needed;/* [ref] */ WERROR result; } out; }; +struct __spoolss_GetPrinterDataEx { + struct { + enum winreg_Type type; + } in; + + struct { + union spoolss_PrinterData *data;/* [ref,switch_is(type)] */ + } out; + +}; + + struct spoolss_GetPrinterDataEx { struct { struct policy_handle *handle;/* [ref] */ @@ -3495,7 +3554,7 @@ struct spoolss_GetPrinterDataEx { struct { enum winreg_Type *type;/* [ref] */ - uint8_t *buffer;/* [ref,size_is(offered)] */ + union spoolss_PrinterData *data;/* [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */ uint32_t *needed;/* [ref] */ WERROR result; } out; diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c index 3b981f0dbb..bc50c0bb5f 100644 --- a/librpc/gen_ndr/srv_spoolss.c +++ b/librpc/gen_ndr/srv_spoolss.c @@ -6147,8 +6147,8 @@ static bool api_spoolss_GetPrinterDataEx(pipes_struct *p) return false; } - r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered); - if (r->out.buffer == NULL) { + r->out.data = talloc_zero(r, union spoolss_PrinterData); + if (r->out.data == NULL) { talloc_free(r); return false; } @@ -9465,8 +9465,8 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered); - if (r->out.buffer == NULL) { + r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData); + if (r->out.data == NULL) { return NT_STATUS_NO_MEMORY; } |