diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-03-20 16:40:09 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-03-20 16:40:09 +0100 |
commit | ca202cf464aec82e63be4b2160f394f56b8c195e (patch) | |
tree | 58b432b7d67c5cf3b35a16c7df9b028d39e3b3a5 /librpc | |
parent | 44787565715f0622cc1d049854427d735ca1c14b (diff) | |
parent | 2de464a7658f91d2d01087080b984d52c3483426 (diff) | |
download | samba-ca202cf464aec82e63be4b2160f394f56b8c195e.tar.gz samba-ca202cf464aec82e63be4b2160f394f56b8c195e.tar.bz2 samba-ca202cf464aec82e63be4b2160f394f56b8c195e.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba into displaysec
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.c | 36 | ||||
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.h | 22 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.c | 757 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.h | 19 | ||||
-rw-r--r-- | librpc/gen_ndr/spoolss.h | 305 | ||||
-rw-r--r-- | librpc/gen_ndr/srv_spoolss.c | 63 | ||||
-rw-r--r-- | librpc/idl/spoolss.idl | 202 | ||||
-rw-r--r-- | librpc/ndr/ndr_spoolss_buf.c | 186 | ||||
-rw-r--r-- | librpc/ndr/ndr_spoolss_buf.h | 6 |
9 files changed, 1143 insertions, 453 deletions
diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c index 2e0582e088..1e94a2a63c 100644 --- a/librpc/gen_ndr/cli_spoolss.c +++ b/librpc/gen_ndr/cli_spoolss.c @@ -1302,8 +1302,8 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli, struct policy_handle *handle /* [in] [ref] */, const char *value_name /* [in] [charset(UTF16)] */, uint32_t offered /* [in] */, - enum spoolss_PrinterDataType *type /* [out] [ref] */, - union spoolss_PrinterData data /* [out] [subcontext_size(offered),subcontext(4),switch_is(*type)] */, + 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) { @@ -1339,7 +1339,7 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli, /* Return variables */ *type = *r.out.type; - return NT_STATUS_NOT_SUPPORTED; + *data = *r.out.data; *needed = *r.out.needed; /* Return result */ @@ -1354,7 +1354,7 @@ NTSTATUS rpccli_spoolss_SetPrinterData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle /* [in] [ref] */, const char *value_name /* [in] [charset(UTF16)] */, - enum spoolss_PrinterDataType type /* [in] */, + enum winreg_Type type /* [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) @@ -3426,8 +3426,8 @@ NTSTATUS rpccli_spoolss_EnumPrinterData(struct rpc_pipe_client *cli, const char *value_name /* [out] [charset(UTF16),size_is(value_offered/2)] */, uint32_t value_offered /* [in] */, uint32_t *value_needed /* [out] [ref] */, - uint32_t *printerdata_type /* [out] [ref] */, - DATA_BLOB *buffer /* [out] [ref] */, + enum winreg_Type *type /* [out] [ref] */, + uint8_t *data /* [out] [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */, uint32_t data_offered /* [in] */, uint32_t *data_needed /* [out] [ref] */, WERROR *werror) @@ -3466,8 +3466,8 @@ NTSTATUS rpccli_spoolss_EnumPrinterData(struct rpc_pipe_client *cli, /* Return variables */ memcpy(CONST_DISCARD(char *, value_name), r.out.value_name, r.in.value_offered / 2 * sizeof(*value_name)); *value_needed = *r.out.value_needed; - *printerdata_type = *r.out.printerdata_type; - *buffer = *r.out.buffer; + *type = *r.out.type; + memcpy(data, r.out.data, r.in.data_offered * sizeof(*data)); *data_needed = *r.out.data_needed; /* Return result */ @@ -3651,7 +3651,7 @@ NTSTATUS rpccli_spoolss_SetPrinterDataEx(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)] */, - uint32_t type /* [in] */, + enum winreg_Type type /* [in] */, uint8_t *buffer /* [in] [ref,size_is(offered)] */, uint32_t offered /* [in] */, WERROR *werror) @@ -3704,7 +3704,7 @@ 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)] */, - uint32_t *type /* [out] [ref] */, + enum winreg_Type *type /* [out] [ref] */, uint8_t *buffer /* [out] [ref,size_is(offered)] */, uint32_t offered /* [in] */, uint32_t *needed /* [out] [ref] */, @@ -3758,10 +3758,10 @@ NTSTATUS rpccli_spoolss_EnumPrinterDataEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle /* [in] [ref] */, const char *key_name /* [in] [charset(UTF16)] */, - uint8_t *buffer /* [out] [ref,size_is(offered)] */, uint32_t offered /* [in] */, - uint32_t *needed /* [out] [ref] */, uint32_t *count /* [out] [ref] */, + struct spoolss_PrinterEnumValues **info /* [out] [ref,size_is(,*count)] */, + uint32_t *needed /* [out] [ref] */, WERROR *werror) { struct spoolss_EnumPrinterDataEx r; @@ -3795,9 +3795,9 @@ NTSTATUS rpccli_spoolss_EnumPrinterDataEx(struct rpc_pipe_client *cli, } /* Return variables */ - memcpy(buffer, r.out.buffer, r.in.offered * sizeof(*buffer)); - *needed = *r.out.needed; *count = *r.out.count; + *info = *r.out.info; + *needed = *r.out.needed; /* Return result */ if (werror) { @@ -3811,8 +3811,8 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle /* [in] [ref] */, const char *key_name /* [in] [charset(UTF16)] */, - uint16_t *key_buffer /* [out] [ref,size_is(key_buffer_size/2)] */, - uint32_t key_buffer_size /* [in] */, + const char ** *key_buffer /* [out] [subcontext_size(offered),ref,subcontext(0),flag(LIBNDR_FLAG_STR_NULLTERM)] */, + uint32_t offered /* [in] */, uint32_t *needed /* [out] [ref] */, WERROR *werror) { @@ -3822,7 +3822,7 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli, /* In parameters */ r.in.handle = handle; r.in.key_name = key_name; - r.in.key_buffer_size = key_buffer_size; + r.in.offered = offered; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterKey, &r); @@ -3847,7 +3847,7 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli, } /* Return variables */ - memcpy(key_buffer, r.out.key_buffer, r.in.key_buffer_size / 2 * sizeof(*key_buffer)); + *key_buffer = *r.out.key_buffer; *needed = *r.out.needed; /* Return result */ diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h index 3aebf3308e..eb86e8c6a0 100644 --- a/librpc/gen_ndr/cli_spoolss.h +++ b/librpc/gen_ndr/cli_spoolss.h @@ -191,15 +191,15 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli, struct policy_handle *handle /* [in] [ref] */, const char *value_name /* [in] [charset(UTF16)] */, uint32_t offered /* [in] */, - enum spoolss_PrinterDataType *type /* [out] [ref] */, - union spoolss_PrinterData data /* [out] [subcontext_size(offered),subcontext(4),switch_is(*type)] */, + 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); NTSTATUS rpccli_spoolss_SetPrinterData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle /* [in] [ref] */, const char *value_name /* [in] [charset(UTF16)] */, - enum spoolss_PrinterDataType type /* [in] */, + enum winreg_Type type /* [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); @@ -446,8 +446,8 @@ NTSTATUS rpccli_spoolss_EnumPrinterData(struct rpc_pipe_client *cli, const char *value_name /* [out] [charset(UTF16),size_is(value_offered/2)] */, uint32_t value_offered /* [in] */, uint32_t *value_needed /* [out] [ref] */, - uint32_t *printerdata_type /* [out] [ref] */, - DATA_BLOB *buffer /* [out] [ref] */, + enum winreg_Type *type /* [out] [ref] */, + uint8_t *data /* [out] [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */, uint32_t data_offered /* [in] */, uint32_t *data_needed /* [out] [ref] */, WERROR *werror); @@ -470,7 +470,7 @@ NTSTATUS rpccli_spoolss_SetPrinterDataEx(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)] */, - uint32_t type /* [in] */, + enum winreg_Type type /* [in] */, uint8_t *buffer /* [in] [ref,size_is(offered)] */, uint32_t offered /* [in] */, WERROR *werror); @@ -479,7 +479,7 @@ 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)] */, - uint32_t *type /* [out] [ref] */, + enum winreg_Type *type /* [out] [ref] */, uint8_t *buffer /* [out] [ref,size_is(offered)] */, uint32_t offered /* [in] */, uint32_t *needed /* [out] [ref] */, @@ -488,17 +488,17 @@ NTSTATUS rpccli_spoolss_EnumPrinterDataEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle /* [in] [ref] */, const char *key_name /* [in] [charset(UTF16)] */, - uint8_t *buffer /* [out] [ref,size_is(offered)] */, uint32_t offered /* [in] */, - uint32_t *needed /* [out] [ref] */, uint32_t *count /* [out] [ref] */, + struct spoolss_PrinterEnumValues **info /* [out] [ref,size_is(,*count)] */, + uint32_t *needed /* [out] [ref] */, WERROR *werror); NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle /* [in] [ref] */, const char *key_name /* [in] [charset(UTF16)] */, - uint16_t *key_buffer /* [out] [ref,size_is(key_buffer_size/2)] */, - uint32_t key_buffer_size /* [in] */, + const char ** *key_buffer /* [out] [subcontext_size(offered),ref,subcontext(0),flag(LIBNDR_FLAG_STR_NULLTERM)] */, + uint32_t offered /* [in] */, uint32_t *needed /* [out] [ref] */, WERROR *werror); NTSTATUS rpccli_spoolss_DeletePrinterDataEx(struct rpc_pipe_client *cli, diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c index 8c8b687a01..f5b161a9c7 100644 --- a/librpc/gen_ndr/ndr_spoolss.c +++ b/librpc/gen_ndr/ndr_spoolss.c @@ -1366,6 +1366,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrinterInfo2(struct ndr_pull *ndr, i } NDR_CHECK(ndr_pull_spoolss_PrinterAttributes(ndr, NDR_SCALARS, &r->attributes)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority)); + if (r->priority > 99) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->defaultpriority)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->starttime)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->untiltime)); @@ -2797,6 +2800,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_JobInfo1(struct ndr_pull *ndr, int n } NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority)); + if (r->priority > 99) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->total_pages)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pages_printed)); @@ -3298,6 +3304,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_JobInfo2(struct ndr_pull *ndr, int n } NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority)); + if (r->priority > 99) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_time)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->until_time)); @@ -3965,6 +3974,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_JobInfo4(struct ndr_pull *ndr, int n } NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority)); + if (r->priority > 99) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_time)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->until_time)); @@ -4519,6 +4531,9 @@ static enum ndr_err_code ndr_pull_spoolss_SetJobInfo1(struct ndr_pull *ndr, int } NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority)); + if (r->priority > 99) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->total_pages)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pages_printed)); @@ -4833,6 +4848,9 @@ static enum ndr_err_code ndr_pull_spoolss_SetJobInfo2(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_secdesc_ptr)); NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority)); + if (r->priority > 99) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_time)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->until_time)); @@ -5230,6 +5248,9 @@ static enum ndr_err_code ndr_pull_spoolss_SetJobInfo4(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_secdesc_ptr)); NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority)); + if (r->priority > 99) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_time)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->until_time)); @@ -6286,6 +6307,9 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo2(struct ndr_pull *ndr, } NDR_CHECK(ndr_pull_spoolss_PrinterAttributes(ndr, NDR_SCALARS, &r->attributes)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority)); + if (r->priority > 99) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->defaultpriority)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->starttime)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->untiltime)); @@ -14530,43 +14554,15 @@ _PUBLIC_ size_t ndr_size_spoolss_OSVersionEx(const struct spoolss_OSVersionEx *r return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersionEx, ic); } -static enum ndr_err_code ndr_push_spoolss_PrinterDataType(struct ndr_push *ndr, int ndr_flags, enum spoolss_PrinterDataType r) -{ - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_spoolss_PrinterDataType(struct ndr_pull *ndr, int ndr_flags, enum spoolss_PrinterDataType *r) -{ - uint32_t v; - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); - *r = v; - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_spoolss_PrinterDataType(struct ndr_print *ndr, const char *name, enum spoolss_PrinterDataType r) -{ - const char *val = NULL; - - switch (r) { - case SPOOLSS_PRINTER_DATA_TYPE_NULL: val = "SPOOLSS_PRINTER_DATA_TYPE_NULL"; break; - case SPOOLSS_PRINTER_DATA_TYPE_STRING: val = "SPOOLSS_PRINTER_DATA_TYPE_STRING"; break; - case SPOOLSS_PRINTER_DATA_TYPE_BINARY: val = "SPOOLSS_PRINTER_DATA_TYPE_BINARY"; break; - case SPOOLSS_PRINTER_DATA_TYPE_UINT32: val = "SPOOLSS_PRINTER_DATA_TYPE_UINT32"; break; - case SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY: val = "SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY"; break; - } - ndr_print_enum(ndr, name, "ENUM", val, r); -} - _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterData(struct ndr_push *ndr, int ndr_flags, const union spoolss_PrinterData *r) { if (ndr_flags & NDR_SCALARS) { int level = ndr_push_get_switch_value(ndr, r); switch (level) { - case SPOOLSS_PRINTER_DATA_TYPE_NULL: { + case REG_NONE: { break; } - case SPOOLSS_PRINTER_DATA_TYPE_STRING: { + case REG_SZ: { { uint32_t _flags_save_string = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); @@ -14575,7 +14571,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterData(struct ndr_push *ndr, in } break; } - case SPOOLSS_PRINTER_DATA_TYPE_BINARY: { + case REG_BINARY: { { uint32_t _flags_save_DATA_BLOB = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); @@ -14584,11 +14580,11 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterData(struct ndr_push *ndr, in } break; } - case SPOOLSS_PRINTER_DATA_TYPE_UINT32: { + case REG_DWORD: { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->value)); break; } - case SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY: { + case REG_MULTI_SZ: { { uint32_t _flags_save_string_array = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); @@ -14611,19 +14607,19 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterData(struct ndr_push *ndr, in if (ndr_flags & NDR_BUFFERS) { int level = ndr_push_get_switch_value(ndr, r); switch (level) { - case SPOOLSS_PRINTER_DATA_TYPE_NULL: + case REG_NONE: break; - case SPOOLSS_PRINTER_DATA_TYPE_STRING: + case REG_SZ: break; - case SPOOLSS_PRINTER_DATA_TYPE_BINARY: + case REG_BINARY: break; - case SPOOLSS_PRINTER_DATA_TYPE_UINT32: + case REG_DWORD: break; - case SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY: + case REG_MULTI_SZ: break; default: @@ -14640,10 +14636,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrinterData(struct ndr_pull *ndr, in level = ndr_pull_get_switch_value(ndr, r); if (ndr_flags & NDR_SCALARS) { switch (level) { - case SPOOLSS_PRINTER_DATA_TYPE_NULL: { + case REG_NONE: { break; } - case SPOOLSS_PRINTER_DATA_TYPE_STRING: { + case REG_SZ: { { uint32_t _flags_save_string = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); @@ -14652,7 +14648,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrinterData(struct ndr_pull *ndr, in } break; } - case SPOOLSS_PRINTER_DATA_TYPE_BINARY: { + case REG_BINARY: { { uint32_t _flags_save_DATA_BLOB = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); @@ -14661,11 +14657,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrinterData(struct ndr_pull *ndr, in } break; } - case SPOOLSS_PRINTER_DATA_TYPE_UINT32: { + case REG_DWORD: { NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->value)); break; } - case SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY: { + case REG_MULTI_SZ: { { uint32_t _flags_save_string_array = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); @@ -14687,19 +14683,19 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrinterData(struct ndr_pull *ndr, in } if (ndr_flags & NDR_BUFFERS) { switch (level) { - case SPOOLSS_PRINTER_DATA_TYPE_NULL: + case REG_NONE: break; - case SPOOLSS_PRINTER_DATA_TYPE_STRING: + case REG_SZ: break; - case SPOOLSS_PRINTER_DATA_TYPE_BINARY: + case REG_BINARY: break; - case SPOOLSS_PRINTER_DATA_TYPE_UINT32: + case REG_DWORD: break; - case SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY: + case REG_MULTI_SZ: break; default: @@ -14716,22 +14712,22 @@ _PUBLIC_ void ndr_print_spoolss_PrinterData(struct ndr_print *ndr, const char *n level = ndr_print_get_switch_value(ndr, r); ndr_print_union(ndr, name, level, "spoolss_PrinterData"); switch (level) { - case SPOOLSS_PRINTER_DATA_TYPE_NULL: + case REG_NONE: break; - case SPOOLSS_PRINTER_DATA_TYPE_STRING: + case REG_SZ: ndr_print_string(ndr, "string", r->string); break; - case SPOOLSS_PRINTER_DATA_TYPE_BINARY: + case REG_BINARY: ndr_print_DATA_BLOB(ndr, "binary", r->binary); break; - case SPOOLSS_PRINTER_DATA_TYPE_UINT32: + case REG_DWORD: ndr_print_uint32(ndr, "value", r->value); break; - case SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY: + case REG_MULTI_SZ: ndr_print_string_array(ndr, "string_array", r->string_array); break; @@ -16968,13 +16964,13 @@ _PUBLIC_ void ndr_print_spoolss_PrinterChangeFlags(struct ndr_print *ndr, const ndr->depth--; } -static enum ndr_err_code ndr_push_spoolss_Field(struct ndr_push *ndr, int ndr_flags, enum spoolss_Field r) +_PUBLIC_ enum ndr_err_code ndr_push_spoolss_JobNotifyField(struct ndr_push *ndr, int ndr_flags, enum spoolss_JobNotifyField r) { NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_spoolss_Field(struct ndr_pull *ndr, int ndr_flags, enum spoolss_Field *r) +_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_JobNotifyField(struct ndr_pull *ndr, int ndr_flags, enum spoolss_JobNotifyField *r) { uint16_t v; NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); @@ -16982,37 +16978,86 @@ static enum ndr_err_code ndr_pull_spoolss_Field(struct ndr_pull *ndr, int ndr_fl return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, enum spoolss_Field r) +_PUBLIC_ void ndr_print_spoolss_JobNotifyField(struct ndr_print *ndr, const char *name, enum spoolss_JobNotifyField r) { const char *val = NULL; switch (r) { - case SPOOLSS_FIELD_SERVER_NAME: val = "SPOOLSS_FIELD_SERVER_NAME"; break; - case SPOOLSS_FIELD_PRINTER_NAME: val = "SPOOLSS_FIELD_PRINTER_NAME"; break; - case SPOOLSS_FIELD_SHARE_NAME: val = "SPOOLSS_FIELD_SHARE_NAME"; break; - case SPOOLSS_FIELD_PORT_NAME: val = "SPOOLSS_FIELD_PORT_NAME"; break; - case SPOOLSS_FIELD_DRIVER_NAME: val = "SPOOLSS_FIELD_DRIVER_NAME"; break; - case SPOOLSS_FIELD_COMMENT: val = "SPOOLSS_FIELD_COMMENT"; break; - case SPOOLSS_FIELD_LOCATION: val = "SPOOLSS_FIELD_LOCATION"; break; - case SPOOLSS_FIELD_DEVMODE: val = "SPOOLSS_FIELD_DEVMODE"; break; - case SPOOLSS_FIELD_SEPFILE: val = "SPOOLSS_FIELD_SEPFILE"; break; - case SPOOLSS_FIELD_PRINT_PROCESSOR: val = "SPOOLSS_FIELD_PRINT_PROCESSOR"; break; - case SPOOLSS_FIELD_PARAMETERS: val = "SPOOLSS_FIELD_PARAMETERS"; break; - case SPOOLSS_FIELD_DATATYPE: val = "SPOOLSS_FIELD_DATATYPE"; break; - case SPOOLSS_FIELD_SECURITY_DESCRIPTOR: val = "SPOOLSS_FIELD_SECURITY_DESCRIPTOR"; break; - case SPOOLSS_FIELD_ATTRIBUTES: val = "SPOOLSS_FIELD_ATTRIBUTES"; break; - case SPOOLSS_FIELD_PRIORITY: val = "SPOOLSS_FIELD_PRIORITY"; break; - case SPOOLSS_FIELD_DEFAULT_PRIORITY: val = "SPOOLSS_FIELD_DEFAULT_PRIORITY"; break; - case SPOOLSS_FIELD_START_TIME: val = "SPOOLSS_FIELD_START_TIME"; break; - case SPOOLSS_FIELD_UNTIL_TIME: val = "SPOOLSS_FIELD_UNTIL_TIME"; break; - case SPOOLSS_FIELD_STATUS: val = "SPOOLSS_FIELD_STATUS"; break; - case SPOOLSS_FIELD_STATUS_STRING: val = "SPOOLSS_FIELD_STATUS_STRING"; break; - case SPOOLSS_FIELD_CJOBS: val = "SPOOLSS_FIELD_CJOBS"; break; - case SPOOLSS_FIELD_AVERAGE_PPM: val = "SPOOLSS_FIELD_AVERAGE_PPM"; break; - case SPOOLSS_FIELD_TOTAL_PAGES: val = "SPOOLSS_FIELD_TOTAL_PAGES"; break; - case SPOOLSS_FIELD_PAGES_PRINTED: val = "SPOOLSS_FIELD_PAGES_PRINTED"; break; - case SPOOLSS_FIELD_TOTAL_BYTES: val = "SPOOLSS_FIELD_TOTAL_BYTES"; break; - case SPOOLSS_FIELD_BYTES_PRINTED: val = "SPOOLSS_FIELD_BYTES_PRINTED"; break; + case JOB_NOTIFY_FIELD_PRINTER_NAME: val = "JOB_NOTIFY_FIELD_PRINTER_NAME"; break; + case JOB_NOTIFY_FIELD_MACHINE_NAME: val = "JOB_NOTIFY_FIELD_MACHINE_NAME"; break; + case JOB_NOTIFY_FIELD_PORT_NAME: val = "JOB_NOTIFY_FIELD_PORT_NAME"; break; + case JOB_NOTIFY_FIELD_USER_NAME: val = "JOB_NOTIFY_FIELD_USER_NAME"; break; + case JOB_NOTIFY_FIELD_NOTIFY_NAME: val = "JOB_NOTIFY_FIELD_NOTIFY_NAME"; break; + case JOB_NOTIFY_FIELD_DATATYPE: val = "JOB_NOTIFY_FIELD_DATATYPE"; break; + case JOB_NOTIFY_FIELD_PRINT_PROCESSOR: val = "JOB_NOTIFY_FIELD_PRINT_PROCESSOR"; break; + case JOB_NOTIFY_FIELD_PARAMETERS: val = "JOB_NOTIFY_FIELD_PARAMETERS"; break; + case JOB_NOTIFY_FIELD_DRIVER_NAME: val = "JOB_NOTIFY_FIELD_DRIVER_NAME"; break; + case JOB_NOTIFY_FIELD_DEVMODE: val = "JOB_NOTIFY_FIELD_DEVMODE"; break; + case JOB_NOTIFY_FIELD_STATUS: val = "JOB_NOTIFY_FIELD_STATUS"; break; + case JOB_NOTIFY_FIELD_STATUS_STRING: val = "JOB_NOTIFY_FIELD_STATUS_STRING"; break; + case JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR: val = "JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR"; break; + case JOB_NOTIFY_FIELD_DOCUMENT: val = "JOB_NOTIFY_FIELD_DOCUMENT"; break; + case JOB_NOTIFY_FIELD_PRIORITY: val = "JOB_NOTIFY_FIELD_PRIORITY"; break; + case JOB_NOTIFY_FIELD_POSITION: val = "JOB_NOTIFY_FIELD_POSITION"; break; + case JOB_NOTIFY_FIELD_SUBMITTED: val = "JOB_NOTIFY_FIELD_SUBMITTED"; break; + case JOB_NOTIFY_FIELD_START_TIME: val = "JOB_NOTIFY_FIELD_START_TIME"; break; + case JOB_NOTIFY_FIELD_UNTIL_TIME: val = "JOB_NOTIFY_FIELD_UNTIL_TIME"; break; + case JOB_NOTIFY_FIELD_TIME: val = "JOB_NOTIFY_FIELD_TIME"; break; + case JOB_NOTIFY_FIELD_TOTAL_PAGES: val = "JOB_NOTIFY_FIELD_TOTAL_PAGES"; break; + case JOB_NOTIFY_FIELD_PAGES_PRINTED: val = "JOB_NOTIFY_FIELD_PAGES_PRINTED"; break; + case JOB_NOTIFY_FIELD_TOTAL_BYTES: val = "JOB_NOTIFY_FIELD_TOTAL_BYTES"; break; + case JOB_NOTIFY_FIELD_BYTES_PRINTED: val = "JOB_NOTIFY_FIELD_BYTES_PRINTED"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +_PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrintNotifyField(struct ndr_push *ndr, int ndr_flags, enum spoolss_PrintNotifyField r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrintNotifyField(struct ndr_pull *ndr, int ndr_flags, enum spoolss_PrintNotifyField *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_spoolss_PrintNotifyField(struct ndr_print *ndr, const char *name, enum spoolss_PrintNotifyField r) +{ + const char *val = NULL; + + switch (r) { + case PRINTER_NOTIFY_FIELD_SERVER_NAME: val = "PRINTER_NOTIFY_FIELD_SERVER_NAME"; break; + case PRINTER_NOTIFY_FIELD_PRINTER_NAME: val = "PRINTER_NOTIFY_FIELD_PRINTER_NAME"; break; + case PRINTER_NOTIFY_FIELD_SHARE_NAME: val = "PRINTER_NOTIFY_FIELD_SHARE_NAME"; break; + case PRINTER_NOTIFY_FIELD_PORT_NAME: val = "PRINTER_NOTIFY_FIELD_PORT_NAME"; break; + case PRINTER_NOTIFY_FIELD_DRIVER_NAME: val = "PRINTER_NOTIFY_FIELD_DRIVER_NAME"; break; + case PRINTER_NOTIFY_FIELD_COMMENT: val = "PRINTER_NOTIFY_FIELD_COMMENT"; break; + case PRINTER_NOTIFY_FIELD_LOCATION: val = "PRINTER_NOTIFY_FIELD_LOCATION"; break; + case PRINTER_NOTIFY_FIELD_DEVMODE: val = "PRINTER_NOTIFY_FIELD_DEVMODE"; break; + case PRINTER_NOTIFY_FIELD_SEPFILE: val = "PRINTER_NOTIFY_FIELD_SEPFILE"; break; + case PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR: val = "PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR"; break; + case PRINTER_NOTIFY_FIELD_PARAMETERS: val = "PRINTER_NOTIFY_FIELD_PARAMETERS"; break; + case PRINTER_NOTIFY_FIELD_DATATYPE: val = "PRINTER_NOTIFY_FIELD_DATATYPE"; break; + case PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR: val = "PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR"; break; + case PRINTER_NOTIFY_FIELD_ATTRIBUTES: val = "PRINTER_NOTIFY_FIELD_ATTRIBUTES"; break; + case PRINTER_NOTIFY_FIELD_PRIORITY: val = "PRINTER_NOTIFY_FIELD_PRIORITY"; break; + case PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY: val = "PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY"; break; + case PRINTER_NOTIFY_FIELD_START_TIME: val = "PRINTER_NOTIFY_FIELD_START_TIME"; break; + case PRINTER_NOTIFY_FIELD_UNTIL_TIME: val = "PRINTER_NOTIFY_FIELD_UNTIL_TIME"; break; + case PRINTER_NOTIFY_FIELD_STATUS: val = "PRINTER_NOTIFY_FIELD_STATUS"; break; + case PRINTER_NOTIFY_FIELD_STATUS_STRING: val = "PRINTER_NOTIFY_FIELD_STATUS_STRING"; break; + case PRINTER_NOTIFY_FIELD_CJOBS: val = "PRINTER_NOTIFY_FIELD_CJOBS"; break; + case PRINTER_NOTIFY_FIELD_AVERAGE_PPM: val = "PRINTER_NOTIFY_FIELD_AVERAGE_PPM"; break; + case PRINTER_NOTIFY_FIELD_TOTAL_PAGES: val = "PRINTER_NOTIFY_FIELD_TOTAL_PAGES"; break; + case PRINTER_NOTIFY_FIELD_PAGES_PRINTED: val = "PRINTER_NOTIFY_FIELD_PAGES_PRINTED"; break; + case PRINTER_NOTIFY_FIELD_TOTAL_BYTES: val = "PRINTER_NOTIFY_FIELD_TOTAL_BYTES"; break; + case PRINTER_NOTIFY_FIELD_BYTES_PRINTED: val = "PRINTER_NOTIFY_FIELD_BYTES_PRINTED"; break; + case PRINTER_NOTIFY_FIELD_OBJECT_GUID: val = "PRINTER_NOTIFY_FIELD_OBJECT_GUID"; break; + case PRINTER_NOTIFY_FIELD_FRIENDLY_NAME: val = "PRINTER_NOTIFY_FIELD_FRIENDLY_NAME"; break; } ndr_print_enum(ndr, name, "ENUM", val, r); } @@ -17036,12 +17081,84 @@ _PUBLIC_ void ndr_print_spoolss_NotifyType(struct ndr_print *ndr, const char *na const char *val = NULL; switch (r) { - case SPOOLSS_NOTIFY_PRINTER: val = "SPOOLSS_NOTIFY_PRINTER"; break; - case SPOOLSS_NOTIFY_JOB: val = "SPOOLSS_NOTIFY_JOB"; break; + case PRINTER_NOTIFY_TYPE: val = "PRINTER_NOTIFY_TYPE"; break; + case JOB_NOTIFY_TYPE: val = "JOB_NOTIFY_TYPE"; break; } ndr_print_enum(ndr, name, "ENUM", val, r); } +static enum ndr_err_code ndr_push_spoolss_Field(struct ndr_push *ndr, int ndr_flags, const union spoolss_Field *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case PRINTER_NOTIFY_TYPE: { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->field)); + break; } + + case JOB_NOTIFY_TYPE: { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->field)); + break; } + + default: { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->field)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case PRINTER_NOTIFY_TYPE: + break; + + case JOB_NOTIFY_TYPE: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_spoolss_Field(struct ndr_pull *ndr, int ndr_flags, union spoolss_Field *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case PRINTER_NOTIFY_TYPE: { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->field)); + break; } + + case JOB_NOTIFY_TYPE: { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->field)); + break; } + + default: { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->field)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case PRINTER_NOTIFY_TYPE: + break; + + case JOB_NOTIFY_TYPE: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + static enum ndr_err_code ndr_push_spoolss_NotifyOptionType(struct ndr_push *ndr, int ndr_flags, const struct spoolss_NotifyOptionType *r) { uint32_t cntr_fields_1; @@ -17058,7 +17175,8 @@ static enum ndr_err_code ndr_push_spoolss_NotifyOptionType(struct ndr_push *ndr, if (r->fields) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); for (cntr_fields_1 = 0; cntr_fields_1 < r->count; cntr_fields_1++) { - NDR_CHECK(ndr_push_spoolss_Field(ndr, NDR_SCALARS, r->fields[cntr_fields_1])); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->fields[cntr_fields_1], r->type)); + NDR_CHECK(ndr_push_spoolss_Field(ndr, NDR_SCALARS, &r->fields[cntr_fields_1])); } } } @@ -17094,6 +17212,7 @@ static enum ndr_err_code ndr_pull_spoolss_NotifyOptionType(struct ndr_pull *ndr, _mem_save_fields_1 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->fields, 0); for (cntr_fields_1 = 0; cntr_fields_1 < r->count; cntr_fields_1++) { + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->fields[cntr_fields_1], r->type)); NDR_CHECK(ndr_pull_spoolss_Field(ndr, NDR_SCALARS, &r->fields[cntr_fields_1])); } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_fields_1, 0); @@ -17124,7 +17243,8 @@ _PUBLIC_ void ndr_print_spoolss_NotifyOptionType(struct ndr_print *ndr, const ch for (cntr_fields_1=0;cntr_fields_1<r->count;cntr_fields_1++) { char *idx_1=NULL; if (asprintf(&idx_1, "[%d]", cntr_fields_1) != -1) { - ndr_print_spoolss_Field(ndr, "fields", r->fields[cntr_fields_1]); + ndr_print_set_switch_value(ndr, &r->fields[cntr_fields_1], r->type); + ndr_print_spoolss_Field(ndr, "fields", &r->fields[cntr_fields_1]); free(idx_1); } } @@ -17509,7 +17629,8 @@ static enum ndr_err_code ndr_push_spoolss_Notify(struct ndr_push *ndr, int ndr_f if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_spoolss_NotifyType(ndr, NDR_SCALARS, r->type)); - NDR_CHECK(ndr_push_spoolss_Field(ndr, NDR_SCALARS, r->field)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->field, r->type)); + NDR_CHECK(ndr_push_spoolss_Field(ndr, NDR_SCALARS, &r->field)); NDR_CHECK(ndr_push_spoolss_NotifyTable(ndr, NDR_SCALARS, r->variable_type)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->job_id)); NDR_CHECK(ndr_push_set_switch_value(ndr, &r->data, r->variable_type)); @@ -17526,6 +17647,7 @@ static enum ndr_err_code ndr_pull_spoolss_Notify(struct ndr_pull *ndr, int ndr_f if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_spoolss_NotifyType(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->field, r->type)); NDR_CHECK(ndr_pull_spoolss_Field(ndr, NDR_SCALARS, &r->field)); NDR_CHECK(ndr_pull_spoolss_NotifyTable(ndr, NDR_SCALARS, &r->variable_type)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->job_id)); @@ -17543,7 +17665,8 @@ _PUBLIC_ void ndr_print_spoolss_Notify(struct ndr_print *ndr, const char *name, ndr_print_struct(ndr, name, "spoolss_Notify"); ndr->depth++; ndr_print_spoolss_NotifyType(ndr, "type", r->type); - ndr_print_spoolss_Field(ndr, "field", r->field); + ndr_print_set_switch_value(ndr, &r->field, r->type); + ndr_print_spoolss_Field(ndr, "field", &r->field); ndr_print_spoolss_NotifyTable(ndr, "variable_type", r->variable_type); ndr_print_uint32(ndr, "job_id", r->job_id); ndr_print_set_switch_value(ndr, &r->data, r->variable_type); @@ -18235,6 +18358,148 @@ _PUBLIC_ void ndr_print_spoolss_AccessRights(struct ndr_print *ndr, const char * ndr->depth--; } +_PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterEnumValues(struct ndr_push *ndr, int ndr_flags, const struct spoolss_PrinterEnumValues *r) +{ + uint32_t _save_relative_base_offset = ndr_push_get_relative_base_offset(ndr); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_setup_relative_base_offset1(ndr, r, ndr->offset)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2 * strlen_m_term(r->value_name))); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->data)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_spoolss_PrinterData(r->data, r->type, ndr->iconv_convenience, ndr->flags))); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_setup_relative_base_offset2(ndr, r)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + if (r->value_name) { + NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value_name)); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->value_name)); + } + ndr->flags = _flags_save_string; + } + if (r->data) { + NDR_CHECK(ndr_push_relative_ptr2(ndr, r->data)); + { + struct ndr_push *_ndr_data; + NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_data, 0, r->data_length)); + NDR_CHECK(ndr_push_set_switch_value(_ndr_data, r->data, r->type)); + NDR_CHECK(ndr_push_spoolss_PrinterData(_ndr_data, NDR_SCALARS|NDR_BUFFERS, r->data)); + NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_data, 0, r->data_length)); + } + } + } + ndr_push_restore_relative_base_offset(ndr, _save_relative_base_offset); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_PrinterEnumValues(struct ndr_pull *ndr, int ndr_flags, struct spoolss_PrinterEnumValues *r) +{ + uint32_t _save_relative_base_offset = ndr_pull_get_relative_base_offset(ndr); + uint32_t _ptr_value_name; + TALLOC_CTX *_mem_save_value_name_0; + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_setup_relative_base_offset1(ndr, r, ndr->offset)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_name)); + if (_ptr_value_name) { + NDR_PULL_ALLOC(ndr, r->value_name); + NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value_name, _ptr_value_name)); + } else { + r->value_name = NULL; + } + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->value_name_len)); + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->data); + NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->data, _ptr_data)); + } else { + r->data = NULL; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_length)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_setup_relative_base_offset2(ndr, r)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + if (r->value_name) { + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; + NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value_name)); + _mem_save_value_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->value_name, 0); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->value_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_name_0, 0); + ndr->offset = _relative_save_offset; + } + ndr->flags = _flags_save_string; + } + if (r->data) { + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; + NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->data)); + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); + { + struct ndr_pull *_ndr_data; + NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_data, 0, r->data_length)); + NDR_CHECK(ndr_pull_set_switch_value(_ndr_data, r->data, r->type)); + NDR_CHECK(ndr_pull_spoolss_PrinterData(_ndr_data, NDR_SCALARS|NDR_BUFFERS, r->data)); + NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_data, 0, r->data_length)); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + ndr->offset = _relative_save_offset; + } + } + ndr_pull_restore_relative_base_offset(ndr, _save_relative_base_offset); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_spoolss_PrinterEnumValues(struct ndr_print *ndr, const char *name, const struct spoolss_PrinterEnumValues *r) +{ + ndr_print_struct(ndr, name, "spoolss_PrinterEnumValues"); + ndr->depth++; + ndr_print_ptr(ndr, "value_name", r->value_name); + ndr->depth++; + if (r->value_name) { + ndr_print_string(ndr, "value_name", r->value_name); + } + ndr->depth--; + ndr_print_uint32(ndr, "value_name_len", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?2 * strlen_m_term(r->value_name):r->value_name_len); + ndr_print_winreg_Type(ndr, "type", r->type); + ndr_print_ptr(ndr, "data", r->data); + ndr->depth++; + if (r->data) { + ndr_print_set_switch_value(ndr, r->data, r->type); + ndr_print_spoolss_PrinterData(ndr, "data", r->data); + } + ndr->depth--; + ndr_print_uint32(ndr, "data_length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_spoolss_PrinterData(r->data, r->type, ndr->iconv_convenience, ndr->flags):r->data_length); + ndr->depth--; +} + +_PUBLIC_ size_t ndr_size_spoolss_PrinterEnumValues(const struct spoolss_PrinterEnumValues *r, struct smb_iconv_convenience *ic, int flags) +{ + return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterEnumValues, ic); +} + _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DeleteDriverFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); @@ -21610,8 +21875,11 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_GetPrinterData(struct ndr_push *ndr if (r->out.type == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_spoolss_PrinterDataType(ndr, NDR_SCALARS, *r->out.type)); - NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->out.data)); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type)); + if (r->out.data == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + 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"); } @@ -21625,6 +21893,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr { 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); @@ -21646,6 +21915,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(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(ndr, r->out.data); + ZERO_STRUCTP(r->out.data); NDR_PULL_ALLOC(ndr, r->out.needed); ZERO_STRUCTP(r->out.needed); } @@ -21655,9 +21926,15 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr } _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.type, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_spoolss_PrinterDataType(ndr, NDR_SCALARS, r->out.type)); + 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_DATA_BLOB(ndr, NDR_SCALARS, &r->out.data)); + 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_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); } @@ -21673,25 +21950,37 @@ _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr _PUBLIC_ enum ndr_err_code ndr_push___spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct __spoolss_GetPrinterData *r) { if (flags & NDR_IN) { - NDR_CHECK(ndr_push_spoolss_PrinterDataType(ndr, NDR_SCALARS, r->in.type)); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); } if (flags & NDR_OUT) { - 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)); + 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_GetPrinterData(struct ndr_pull *ndr, int flags, struct __spoolss_GetPrinterData *r) { + TALLOC_CTX *_mem_save_data_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); - NDR_CHECK(ndr_pull_spoolss_PrinterDataType(ndr, NDR_SCALARS, &r->in.type)); + 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) { - 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)); + 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; } @@ -21719,10 +22008,13 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterData(struct ndr_print *ndr, const char ndr->depth++; ndr_print_ptr(ndr, "type", r->out.type); ndr->depth++; - ndr_print_spoolss_PrinterDataType(ndr, "type", *r->out.type); + ndr_print_winreg_Type(ndr, "type", *r->out.type); + ndr->depth--; + ndr_print_ptr(ndr, "data", r->out.data); + ndr->depth++; + 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_set_switch_value(ndr, &r->out.data, *r->out.type); - ndr_print_spoolss_PrinterData(ndr, "data", &r->out.data); ndr_print_ptr(ndr, "needed", r->out.needed); ndr->depth++; ndr_print_uint32(ndr, "needed", *r->out.needed); @@ -21744,7 +22036,7 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterData(struct ndr_push *ndr NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); NDR_CHECK(ndr_push_uint32(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_spoolss_PrinterDataType(ndr, NDR_SCALARS, r->in.type)); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->in.data)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in._offered)); } @@ -21757,11 +22049,14 @@ _PUBLIC_ enum ndr_err_code ndr_push__spoolss_SetPrinterData(struct ndr_push *ndr _PUBLIC_ enum ndr_err_code ndr_push___spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct __spoolss_SetPrinterData *r) { if (flags & NDR_IN) { - NDR_CHECK(ndr_push_spoolss_PrinterDataType(ndr, NDR_SCALARS, r->in.type)); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); } if (flags & NDR_OUT) { - 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)); + 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; } @@ -21784,7 +22079,7 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterData(struct ndr_pull *ndr, i } 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_spoolss_PrinterDataType(ndr, NDR_SCALARS, &r->in.type)); + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type)); { struct ndr_pull *_ndr_data; NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_data, 4, -1)); @@ -21815,7 +22110,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterData(struct ndr_print *ndr, const char ndr_print_policy_handle(ndr, "handle", r->in.handle); ndr->depth--; ndr_print_string(ndr, "value_name", r->in.value_name); - ndr_print_spoolss_PrinterDataType(ndr, "type", r->in.type); + ndr_print_winreg_Type(ndr, "type", r->in.type); 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); @@ -25550,14 +25845,20 @@ static enum ndr_err_code ndr_push_spoolss_EnumPrinterData(struct ndr_push *ndr, return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_needed)); - if (r->out.printerdata_type == NULL) { + if (r->out.type == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.printerdata_type)); - if (r->out.buffer == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type)); + { + uint32_t _flags_save_uint8 = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (r->out.data == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.data_offered)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, r->in.data_offered)); + ndr->flags = _flags_save_uint8; } - NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, *r->out.buffer)); if (r->out.data_needed == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -25571,8 +25872,7 @@ static enum ndr_err_code ndr_pull_spoolss_EnumPrinterData(struct ndr_pull *ndr, { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_value_needed_0; - TALLOC_CTX *_mem_save_printerdata_type_0; - TALLOC_CTX *_mem_save_buffer_0; + TALLOC_CTX *_mem_save_type_0; TALLOC_CTX *_mem_save_data_needed_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -25589,10 +25889,10 @@ static enum ndr_err_code ndr_pull_spoolss_EnumPrinterData(struct ndr_pull *ndr, NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.data_offered)); NDR_PULL_ALLOC(ndr, r->out.value_needed); ZERO_STRUCTP(r->out.value_needed); - NDR_PULL_ALLOC(ndr, r->out.printerdata_type); - ZERO_STRUCTP(r->out.printerdata_type); - NDR_PULL_ALLOC(ndr, r->out.buffer); - ZERO_STRUCTP(r->out.buffer); + NDR_PULL_ALLOC(ndr, r->out.type); + ZERO_STRUCTP(r->out.type); + NDR_PULL_ALLOC_N(ndr, r->out.data, r->in.data_offered); + memset(r->out.data, 0, (r->in.data_offered) * sizeof(*r->out.data)); NDR_PULL_ALLOC(ndr, r->out.data_needed); ZERO_STRUCTP(r->out.data_needed); } @@ -25607,19 +25907,22 @@ static enum ndr_err_code ndr_pull_spoolss_EnumPrinterData(struct ndr_pull *ndr, NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.value_needed)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_needed_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.printerdata_type); + NDR_PULL_ALLOC(ndr, r->out.type); } - _mem_save_printerdata_type_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.printerdata_type, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.printerdata_type)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_printerdata_type_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.buffer); + _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(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); + { + uint32_t _flags_save_uint8 = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + 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_size(ndr, &r->out.data))); + ndr->flags = _flags_save_uint8; } - _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, r->out.buffer)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.data_needed); } @@ -25631,6 +25934,9 @@ static enum ndr_err_code ndr_pull_spoolss_EnumPrinterData(struct ndr_pull *ndr, if (r->out.value_name) { NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.value_name, r->in.value_offered / 2)); } + if (r->out.data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, r->in.data_offered)); + } } return NDR_ERR_SUCCESS; } @@ -25662,13 +25968,13 @@ _PUBLIC_ void ndr_print_spoolss_EnumPrinterData(struct ndr_print *ndr, const cha ndr->depth++; ndr_print_uint32(ndr, "value_needed", *r->out.value_needed); ndr->depth--; - ndr_print_ptr(ndr, "printerdata_type", r->out.printerdata_type); + ndr_print_ptr(ndr, "type", r->out.type); ndr->depth++; - ndr_print_uint32(ndr, "printerdata_type", *r->out.printerdata_type); + 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_DATA_BLOB(ndr, "buffer", *r->out.buffer); + ndr_print_array_uint8(ndr, "data", r->out.data, r->in.data_offered); ndr->depth--; ndr_print_ptr(ndr, "data_needed", r->out.data_needed); ndr->depth++; @@ -25887,7 +26193,7 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); NDR_CHECK(ndr_push_uint32(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_uint32(ndr, NDR_SCALARS, r->in.type)); + 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"); } @@ -25926,7 +26232,7 @@ 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_uint32(ndr, NDR_SCALARS, &r->in.type)); + 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)); @@ -25959,7 +26265,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterDataEx(struct ndr_print *ndr, const ch ndr->depth--; ndr_print_string(ndr, "key_name", r->in.key_name); ndr_print_string(ndr, "value_name", r->in.value_name); - ndr_print_uint32(ndr, "type", r->in.type); + 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); @@ -25997,7 +26303,7 @@ static enum ndr_err_code ndr_push_spoolss_GetPrinterDataEx(struct ndr_push *ndr, if (r->out.type == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.type)); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type)); if (r->out.buffer == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -26055,7 +26361,7 @@ static enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct ndr_pull *ndr, } _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.type, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.type)); + 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) { @@ -26101,7 +26407,7 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterDataEx(struct ndr_print *ndr, const ch ndr->depth++; ndr_print_ptr(ndr, "type", r->out.type); ndr->depth++; - ndr_print_uint32(ndr, "type", *r->out.type); + ndr_print_winreg_Type(ndr, "type", *r->out.type); ndr->depth--; ndr_print_ptr(ndr, "buffer", r->out.buffer); ndr->depth++; @@ -26117,7 +26423,7 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterDataEx(struct ndr_print *ndr, const ch ndr->depth--; } -_PUBLIC_ enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r) +_PUBLIC_ enum ndr_err_code ndr_push__spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct _spoolss_EnumPrinterDataEx *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -26131,11 +26437,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *n NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); } if (flags & NDR_OUT) { - 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->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.info)); if (r->out.needed == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -26149,7 +26451,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *n return NDR_ERR_SUCCESS; } -_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r) +_PUBLIC_ enum ndr_err_code ndr_pull__spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct _spoolss_EnumPrinterDataEx *r) { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_needed_0; @@ -26172,19 +26474,13 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *n NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.key_name), sizeof(uint16_t))); NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.key_name, ndr_get_array_length(ndr, &r->in.key_name), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); - 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.needed); ZERO_STRUCTP(r->out.needed); NDR_PULL_ALLOC(ndr, r->out.count); ZERO_STRUCTP(r->out.count); } if (flags & NDR_OUT) { - 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_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer))); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->out.info)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.needed); } @@ -26200,15 +26496,54 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *n NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.count)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_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_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct __spoolss_EnumPrinterDataEx *r) +{ + uint32_t cntr_info_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count)); + } + if (flags & NDR_OUT) { + for (cntr_info_0 = 0; cntr_info_0 < r->in.count; cntr_info_0++) { + NDR_CHECK(ndr_push_spoolss_PrinterEnumValues(ndr, NDR_SCALARS, &r->out.info[cntr_info_0])); + } + for (cntr_info_0 = 0; cntr_info_0 < r->in.count; cntr_info_0++) { + NDR_CHECK(ndr_push_spoolss_PrinterEnumValues(ndr, NDR_BUFFERS, &r->out.info[cntr_info_0])); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull___spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct __spoolss_EnumPrinterDataEx *r) +{ + uint32_t cntr_info_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.count)); + } + if (flags & NDR_OUT) { + NDR_PULL_ALLOC_N(ndr, r->out.info, r->in.count); + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0); + for (cntr_info_0 = 0; cntr_info_0 < r->in.count; cntr_info_0++) { + NDR_CHECK(ndr_pull_spoolss_PrinterEnumValues(ndr, NDR_SCALARS, &r->out.info[cntr_info_0])); } + for (cntr_info_0 = 0; cntr_info_0 < r->in.count; cntr_info_0++) { + NDR_CHECK(ndr_pull_spoolss_PrinterEnumValues(ndr, NDR_BUFFERS, &r->out.info[cntr_info_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); } return NDR_ERR_SUCCESS; } _PUBLIC_ void ndr_print_spoolss_EnumPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_EnumPrinterDataEx *r) { + uint32_t cntr_info_2; ndr_print_struct(ndr, name, "spoolss_EnumPrinterDataEx"); ndr->depth++; if (flags & NDR_SET_VALUES) { @@ -26228,17 +26563,31 @@ _PUBLIC_ void ndr_print_spoolss_EnumPrinterDataEx(struct ndr_print *ndr, const c if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "spoolss_EnumPrinterDataEx"); ndr->depth++; - ndr_print_ptr(ndr, "buffer", r->out.buffer); + ndr_print_ptr(ndr, "count", r->out.count); ndr->depth++; - ndr_print_array_uint8(ndr, "buffer", r->out.buffer, r->in.offered); + ndr_print_uint32(ndr, "count", *r->out.count); ndr->depth--; - ndr_print_ptr(ndr, "needed", r->out.needed); + ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - ndr_print_uint32(ndr, "needed", *r->out.needed); + ndr_print_ptr(ndr, "info", *r->out.info); + ndr->depth++; + if (*r->out.info) { + ndr->print(ndr, "%s: ARRAY(%d)", "info", (int)*r->out.count); + ndr->depth++; + for (cntr_info_2=0;cntr_info_2<*r->out.count;cntr_info_2++) { + char *idx_2=NULL; + if (asprintf(&idx_2, "[%d]", cntr_info_2) != -1) { + ndr_print_spoolss_PrinterEnumValues(ndr, "info", &(*r->out.info)[cntr_info_2]); + free(idx_2); + } + } + ndr->depth--; + } ndr->depth--; - ndr_print_ptr(ndr, "count", r->out.count); + ndr->depth--; + ndr_print_ptr(ndr, "needed", r->out.needed); ndr->depth++; - ndr_print_uint32(ndr, "count", *r->out.count); + ndr_print_uint32(ndr, "needed", *r->out.needed); ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -26248,7 +26597,6 @@ _PUBLIC_ void ndr_print_spoolss_EnumPrinterDataEx(struct ndr_print *ndr, const c _PUBLIC_ enum ndr_err_code ndr_push_spoolss_EnumPrinterKey(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterKey *r) { - uint32_t cntr_key_buffer_1; if (flags & NDR_IN) { if (r->in.handle == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); @@ -26258,15 +26606,25 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_EnumPrinterKey(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.key_name, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.key_name, ndr_charset_length(r->in.key_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.key_buffer_size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered)); } if (flags & NDR_OUT) { - if (r->out.key_buffer == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.key_buffer_size / 2)); - for (cntr_key_buffer_1 = 0; cntr_key_buffer_1 < r->in.key_buffer_size / 2; cntr_key_buffer_1++) { - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->out.key_buffer[cntr_key_buffer_1])); + { + uint32_t _flags_save_string_array = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + if (r->out.key_buffer == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.key_buffer)); + if (*r->out.key_buffer) { + { + struct ndr_push *_ndr_key_buffer; + NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_key_buffer, 0, r->in.offered)); + NDR_CHECK(ndr_push_string_array(_ndr_key_buffer, NDR_SCALARS, *r->out.key_buffer)); + NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_key_buffer, 0, r->in.offered)); + } + } + ndr->flags = _flags_save_string_array; } if (r->out.needed == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); @@ -26279,8 +26637,9 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_EnumPrinterKey(struct ndr_push *ndr, _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterKey(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterKey *r) { - uint32_t cntr_key_buffer_1; + uint32_t _ptr_key_buffer; TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_key_buffer_0; TALLOC_CTX *_mem_save_key_buffer_1; TALLOC_CTX *_mem_save_needed_0; if (flags & NDR_IN) { @@ -26300,23 +26659,41 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterKey(struct ndr_pull *ndr, } NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.key_name), sizeof(uint16_t))); NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.key_name, ndr_get_array_length(ndr, &r->in.key_name), sizeof(uint16_t), CH_UTF16)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.key_buffer_size)); - NDR_PULL_ALLOC_N(ndr, r->out.key_buffer, r->in.key_buffer_size / 2); - memset(r->out.key_buffer, 0, (r->in.key_buffer_size / 2) * sizeof(*r->out.key_buffer)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered)); + NDR_PULL_ALLOC(ndr, r->out.key_buffer); + ZERO_STRUCTP(r->out.key_buffer); NDR_PULL_ALLOC(ndr, r->out.needed); ZERO_STRUCTP(r->out.needed); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_array_size(ndr, &r->out.key_buffer)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC_N(ndr, r->out.key_buffer, ndr_get_array_size(ndr, &r->out.key_buffer)); - } - _mem_save_key_buffer_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.key_buffer, 0); - for (cntr_key_buffer_1 = 0; cntr_key_buffer_1 < r->in.key_buffer_size / 2; cntr_key_buffer_1++) { - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->out.key_buffer[cntr_key_buffer_1])); + { + uint32_t _flags_save_string_array = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.key_buffer); + } + _mem_save_key_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.key_buffer, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_key_buffer)); + if (_ptr_key_buffer) { + NDR_PULL_ALLOC(ndr, *r->out.key_buffer); + } else { + *r->out.key_buffer = NULL; + } + if (*r->out.key_buffer) { + _mem_save_key_buffer_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.key_buffer, 0); + { + struct ndr_pull *_ndr_key_buffer; + NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_key_buffer, 0, r->in.offered)); + NDR_CHECK(ndr_pull_string_array(_ndr_key_buffer, NDR_SCALARS, r->out.key_buffer)); + NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_key_buffer, 0, r->in.offered)); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_buffer_1, 0); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_buffer_0, LIBNDR_FLAG_REF_ALLOC); + ndr->flags = _flags_save_string_array; } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_buffer_1, 0); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.needed); } @@ -26325,16 +26702,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterKey(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.key_buffer) { - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.key_buffer, r->in.key_buffer_size / 2)); - } } return NDR_ERR_SUCCESS; } _PUBLIC_ void ndr_print_spoolss_EnumPrinterKey(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_EnumPrinterKey *r) { - uint32_t cntr_key_buffer_1; ndr_print_struct(ndr, name, "spoolss_EnumPrinterKey"); ndr->depth++; if (flags & NDR_SET_VALUES) { @@ -26348,7 +26721,7 @@ _PUBLIC_ void ndr_print_spoolss_EnumPrinterKey(struct ndr_print *ndr, const char ndr_print_policy_handle(ndr, "handle", r->in.handle); ndr->depth--; ndr_print_string(ndr, "key_name", r->in.key_name); - ndr_print_uint32(ndr, "key_buffer_size", r->in.key_buffer_size); + ndr_print_uint32(ndr, "offered", r->in.offered); ndr->depth--; } if (flags & NDR_OUT) { @@ -26356,14 +26729,10 @@ _PUBLIC_ void ndr_print_spoolss_EnumPrinterKey(struct ndr_print *ndr, const char ndr->depth++; ndr_print_ptr(ndr, "key_buffer", r->out.key_buffer); ndr->depth++; - ndr->print(ndr, "%s: ARRAY(%d)", "key_buffer", (int)r->in.key_buffer_size / 2); + ndr_print_ptr(ndr, "key_buffer", *r->out.key_buffer); ndr->depth++; - for (cntr_key_buffer_1=0;cntr_key_buffer_1<r->in.key_buffer_size / 2;cntr_key_buffer_1++) { - char *idx_1=NULL; - if (asprintf(&idx_1, "[%d]", cntr_key_buffer_1) != -1) { - ndr_print_uint16(ndr, "key_buffer", r->out.key_buffer[cntr_key_buffer_1]); - free(idx_1); - } + if (*r->out.key_buffer) { + ndr_print_string_array(ndr, "key_buffer", *r->out.key_buffer); } ndr->depth--; ndr->depth--; diff --git a/librpc/gen_ndr/ndr_spoolss.h b/librpc/gen_ndr/ndr_spoolss.h index b6418f5900..0feb4a2c5e 100644 --- a/librpc/gen_ndr/ndr_spoolss.h +++ b/librpc/gen_ndr/ndr_spoolss.h @@ -387,7 +387,6 @@ enum ndr_err_code ndr_push_spoolss_OSVersionEx(struct ndr_push *ndr, int ndr_fla enum ndr_err_code ndr_pull_spoolss_OSVersionEx(struct ndr_pull *ndr, int ndr_flags, struct spoolss_OSVersionEx *r); void ndr_print_spoolss_OSVersionEx(struct ndr_print *ndr, const char *name, const struct spoolss_OSVersionEx *r); size_t ndr_size_spoolss_OSVersionEx(const struct spoolss_OSVersionEx *r, struct smb_iconv_convenience *ic, int flags); -void ndr_print_spoolss_PrinterDataType(struct ndr_print *ndr, const char *name, enum spoolss_PrinterDataType r); enum ndr_err_code ndr_push_spoolss_PrinterData(struct ndr_push *ndr, int ndr_flags, const union spoolss_PrinterData *r); enum ndr_err_code ndr_pull_spoolss_PrinterData(struct ndr_pull *ndr, int ndr_flags, union spoolss_PrinterData *r); void ndr_print_spoolss_PrinterData(struct ndr_print *ndr, const char *name, const union spoolss_PrinterData *r); @@ -452,8 +451,14 @@ enum ndr_err_code ndr_push_spoolss_PrintProcDataTypesInfo(struct ndr_push *ndr, enum ndr_err_code ndr_pull_spoolss_PrintProcDataTypesInfo(struct ndr_pull *ndr, int ndr_flags, union spoolss_PrintProcDataTypesInfo *r); void ndr_print_spoolss_PrintProcDataTypesInfo(struct ndr_print *ndr, const char *name, const union spoolss_PrintProcDataTypesInfo *r); void ndr_print_spoolss_PrinterChangeFlags(struct ndr_print *ndr, const char *name, uint32_t r); -void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, enum spoolss_Field r); +enum ndr_err_code ndr_push_spoolss_JobNotifyField(struct ndr_push *ndr, int ndr_flags, enum spoolss_JobNotifyField r); +enum ndr_err_code ndr_pull_spoolss_JobNotifyField(struct ndr_pull *ndr, int ndr_flags, enum spoolss_JobNotifyField *r); +void ndr_print_spoolss_JobNotifyField(struct ndr_print *ndr, const char *name, enum spoolss_JobNotifyField r); +enum ndr_err_code ndr_push_spoolss_PrintNotifyField(struct ndr_push *ndr, int ndr_flags, enum spoolss_PrintNotifyField r); +enum ndr_err_code ndr_pull_spoolss_PrintNotifyField(struct ndr_pull *ndr, int ndr_flags, enum spoolss_PrintNotifyField *r); +void ndr_print_spoolss_PrintNotifyField(struct ndr_print *ndr, const char *name, enum spoolss_PrintNotifyField r); void ndr_print_spoolss_NotifyType(struct ndr_print *ndr, const char *name, enum spoolss_NotifyType r); +void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r); void ndr_print_spoolss_NotifyOptionType(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyOptionType *r); void ndr_print_spoolssNotifyOptionFlags(struct ndr_print *ndr, const char *name, uint32_t r); void ndr_print_spoolss_NotifyOption(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyOption *r); @@ -470,6 +475,10 @@ void ndr_print_spoolss_UserLevel3(struct ndr_print *ndr, const char *name, const void ndr_print_spoolss_UserLevel(struct ndr_print *ndr, const char *name, const union spoolss_UserLevel *r); void ndr_print_spoolss_UserLevelCtr(struct ndr_print *ndr, const char *name, const struct spoolss_UserLevelCtr *r); void ndr_print_spoolss_AccessRights(struct ndr_print *ndr, const char *name, uint32_t r); +enum ndr_err_code ndr_push_spoolss_PrinterEnumValues(struct ndr_push *ndr, int ndr_flags, const struct spoolss_PrinterEnumValues *r); +enum ndr_err_code ndr_pull_spoolss_PrinterEnumValues(struct ndr_pull *ndr, int ndr_flags, struct spoolss_PrinterEnumValues *r); +void ndr_print_spoolss_PrinterEnumValues(struct ndr_print *ndr, const char *name, const struct spoolss_PrinterEnumValues *r); +size_t ndr_size_spoolss_PrinterEnumValues(const struct spoolss_PrinterEnumValues *r, struct smb_iconv_convenience *ic, int flags); enum ndr_err_code ndr_push_spoolss_DeleteDriverFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r); enum ndr_err_code ndr_pull_spoolss_DeleteDriverFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); void ndr_print_spoolss_DeleteDriverFlags(struct ndr_print *ndr, const char *name, uint32_t r); @@ -662,6 +671,12 @@ void ndr_print_spoolss_4b(struct ndr_print *ndr, const char *name, int flags, co void ndr_print_spoolss_4c(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_4c *r); void ndr_print_spoolss_SetPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_SetPrinterDataEx *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); +void ndr_print__spoolss_EnumPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct _spoolss_EnumPrinterDataEx *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); +void ndr_print___spoolss_EnumPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct __spoolss_EnumPrinterDataEx *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); void ndr_print_spoolss_EnumPrinterDataEx(struct ndr_print *ndr, const char *name, int flags, const struct spoolss_EnumPrinterDataEx *r); diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h index 77fb03ac89..8340b34e45 100644 --- a/librpc/gen_ndr/spoolss.h +++ b/librpc/gen_ndr/spoolss.h @@ -15,6 +15,10 @@ #define PRINTER_ENUM_ICONMASK ( (PRINTER_ENUM_ICON1|PRINTER_ENUM_ICON2|PRINTER_ENUM_ICON3|PRINTER_ENUM_ICON4|PRINTER_ENUM_ICON5|PRINTER_ENUM_ICON6|PRINTER_ENUM_ICON7|PRINTER_ENUM_ICON8) ) #define SPOOLSS_ARCHITECTURE_NT_X86 ( "Windows NT x86" ) #define SPOOLSS_DEFAULT_SERVER_PATH ( "C:\\WINDOWS\\system32\\spool" ) +#define SPL_LOCAL_PORT ( "Local Port" ) +#define SPL_TCPIP_PORT ( "Standard TCP/IP Port" ) +#define SPL_XCV_MONITOR_LOCALMON ( ",XcvMonitor Local Port" ) +#define SPL_XCV_MONITOR_TCPMON ( ",XcvMonitor Standard TCP/IP Port" ) #define PRINTER_CHANGE_PRINTER ( 0x000000FF ) #define PRINTER_CHANGE_JOB ( 0x0000FF00 ) #define PRINTER_CHANGE_FORM ( (PRINTER_CHANGE_ADD_FORM|PRINTER_CHANGE_SET_FORM|PRINTER_CHANGE_DELETE_FORM) ) @@ -324,7 +328,7 @@ struct spoolss_PrinterInfo2 { const char * parameters;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ struct security_descriptor *secdesc;/* [relative,subcontext(0)] */ uint32_t attributes; - uint32_t priority; + uint32_t priority;/* [range(0,99)] */ uint32_t defaultpriority; uint32_t starttime; uint32_t untiltime; @@ -398,7 +402,7 @@ struct spoolss_JobInfo1 { const char * data_type;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ const char * text_status;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ uint32_t status; - uint32_t priority; + uint32_t priority;/* [range(0,99)] */ uint32_t position; uint32_t total_pages; uint32_t pages_printed; @@ -420,7 +424,7 @@ struct spoolss_JobInfo2 { const char * text_status;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ struct security_descriptor *secdesc;/* [relative] */ uint32_t status; - uint32_t priority; + uint32_t priority;/* [range(0,99)] */ uint32_t position; uint32_t start_time; uint32_t until_time; @@ -452,7 +456,7 @@ struct spoolss_JobInfo4 { const char * text_status;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ struct security_descriptor *secdesc;/* [relative] */ uint32_t status; - uint32_t priority; + uint32_t priority;/* [range(0,99)] */ uint32_t position; uint32_t start_time; uint32_t until_time; @@ -480,7 +484,7 @@ struct spoolss_SetJobInfo1 { const char *data_type;/* [unique,charset(UTF16)] */ const char *text_status;/* [unique,charset(UTF16)] */ uint32_t status; - uint32_t priority; + uint32_t priority;/* [range(0,99)] */ uint32_t position; uint32_t total_pages; uint32_t pages_printed; @@ -502,7 +506,7 @@ struct spoolss_SetJobInfo2 { const char *text_status;/* [unique,charset(UTF16)] */ uint32_t _secdesc_ptr; uint32_t status; - uint32_t priority; + uint32_t priority;/* [range(0,99)] */ uint32_t position; uint32_t start_time; uint32_t until_time; @@ -528,7 +532,7 @@ struct spoolss_SetJobInfo4 { const char *text_status;/* [unique,charset(UTF16)] */ uint32_t _secdesc_ptr; uint32_t status; - uint32_t priority; + uint32_t priority;/* [range(0,99)] */ uint32_t position; uint32_t start_time; uint32_t until_time; @@ -652,7 +656,7 @@ struct spoolss_SetPrinterInfo2 { const char *parameters;/* [unique,charset(UTF16)] */ struct security_descriptor *secdesc;/* [unique,subcontext(0)] */ uint32_t attributes; - uint32_t priority; + uint32_t priority;/* [range(0,99)] */ uint32_t defaultpriority; uint32_t starttime; uint32_t untiltime; @@ -1058,30 +1062,11 @@ struct spoolss_OSVersionEx { uint32_t unknown3; }/* [gensize,public] */; -enum spoolss_PrinterDataType -#ifndef USE_UINT_ENUMS - { - SPOOLSS_PRINTER_DATA_TYPE_NULL=0, - SPOOLSS_PRINTER_DATA_TYPE_STRING=1, - SPOOLSS_PRINTER_DATA_TYPE_BINARY=3, - SPOOLSS_PRINTER_DATA_TYPE_UINT32=4, - SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY=7 -} -#else - { __donnot_use_enum_spoolss_PrinterDataType=0x7FFFFFFF} -#define SPOOLSS_PRINTER_DATA_TYPE_NULL ( 0 ) -#define SPOOLSS_PRINTER_DATA_TYPE_STRING ( 1 ) -#define SPOOLSS_PRINTER_DATA_TYPE_BINARY ( 3 ) -#define SPOOLSS_PRINTER_DATA_TYPE_UINT32 ( 4 ) -#define SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY ( 7 ) -#endif -; - union spoolss_PrinterData { - const char * string;/* [flag(LIBNDR_FLAG_STR_NULLTERM),case(SPOOLSS_PRINTER_DATA_TYPE_STRING)] */ - DATA_BLOB binary;/* [flag(LIBNDR_FLAG_REMAINING),case(SPOOLSS_PRINTER_DATA_TYPE_BINARY)] */ - uint32_t value;/* [case(SPOOLSS_PRINTER_DATA_TYPE_UINT32)] */ - const char ** string_array;/* [flag(LIBNDR_FLAG_STR_NULLTERM),case(SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY)] */ + const char * string;/* [flag(LIBNDR_FLAG_STR_NULLTERM),case(REG_SZ)] */ + DATA_BLOB binary;/* [flag(LIBNDR_FLAG_REMAINING),case(REG_BINARY)] */ + uint32_t value;/* [case(REG_DWORD)] */ + const char ** string_array;/* [flag(LIBNDR_FLAG_STR_NULLTERM),case(REG_MULTI_SZ)] */ DATA_BLOB data;/* [flag(LIBNDR_FLAG_REMAINING),default] */ }/* [gensize,public,nodiscriminant] */; @@ -1299,87 +1284,152 @@ union spoolss_PrintProcDataTypesInfo { #define PRINTER_CHANGE_DELETE_PRINTER_DRIVER ( 0x40000000 ) #define PRINTER_CHANGE_TIMEOUT ( 0x80000000 ) -enum spoolss_Field +enum spoolss_JobNotifyField +#ifndef USE_UINT_ENUMS + { + JOB_NOTIFY_FIELD_PRINTER_NAME=0x00, + JOB_NOTIFY_FIELD_MACHINE_NAME=0x01, + JOB_NOTIFY_FIELD_PORT_NAME=0x02, + JOB_NOTIFY_FIELD_USER_NAME=0x03, + JOB_NOTIFY_FIELD_NOTIFY_NAME=0x04, + JOB_NOTIFY_FIELD_DATATYPE=0x05, + JOB_NOTIFY_FIELD_PRINT_PROCESSOR=0x06, + JOB_NOTIFY_FIELD_PARAMETERS=0x07, + JOB_NOTIFY_FIELD_DRIVER_NAME=0x08, + JOB_NOTIFY_FIELD_DEVMODE=0x09, + JOB_NOTIFY_FIELD_STATUS=0x0a, + JOB_NOTIFY_FIELD_STATUS_STRING=0x0b, + JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR=0x0c, + JOB_NOTIFY_FIELD_DOCUMENT=0x0d, + JOB_NOTIFY_FIELD_PRIORITY=0x0e, + JOB_NOTIFY_FIELD_POSITION=0x0f, + JOB_NOTIFY_FIELD_SUBMITTED=0x10, + JOB_NOTIFY_FIELD_START_TIME=0x11, + JOB_NOTIFY_FIELD_UNTIL_TIME=0x12, + JOB_NOTIFY_FIELD_TIME=0x13, + JOB_NOTIFY_FIELD_TOTAL_PAGES=0x14, + JOB_NOTIFY_FIELD_PAGES_PRINTED=0x15, + JOB_NOTIFY_FIELD_TOTAL_BYTES=0x16, + JOB_NOTIFY_FIELD_BYTES_PRINTED=0x17 +} +#else + { __donnot_use_enum_spoolss_JobNotifyField=0x7FFFFFFF} +#define JOB_NOTIFY_FIELD_PRINTER_NAME ( 0x00 ) +#define JOB_NOTIFY_FIELD_MACHINE_NAME ( 0x01 ) +#define JOB_NOTIFY_FIELD_PORT_NAME ( 0x02 ) +#define JOB_NOTIFY_FIELD_USER_NAME ( 0x03 ) +#define JOB_NOTIFY_FIELD_NOTIFY_NAME ( 0x04 ) +#define JOB_NOTIFY_FIELD_DATATYPE ( 0x05 ) +#define JOB_NOTIFY_FIELD_PRINT_PROCESSOR ( 0x06 ) +#define JOB_NOTIFY_FIELD_PARAMETERS ( 0x07 ) +#define JOB_NOTIFY_FIELD_DRIVER_NAME ( 0x08 ) +#define JOB_NOTIFY_FIELD_DEVMODE ( 0x09 ) +#define JOB_NOTIFY_FIELD_STATUS ( 0x0a ) +#define JOB_NOTIFY_FIELD_STATUS_STRING ( 0x0b ) +#define JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR ( 0x0c ) +#define JOB_NOTIFY_FIELD_DOCUMENT ( 0x0d ) +#define JOB_NOTIFY_FIELD_PRIORITY ( 0x0e ) +#define JOB_NOTIFY_FIELD_POSITION ( 0x0f ) +#define JOB_NOTIFY_FIELD_SUBMITTED ( 0x10 ) +#define JOB_NOTIFY_FIELD_START_TIME ( 0x11 ) +#define JOB_NOTIFY_FIELD_UNTIL_TIME ( 0x12 ) +#define JOB_NOTIFY_FIELD_TIME ( 0x13 ) +#define JOB_NOTIFY_FIELD_TOTAL_PAGES ( 0x14 ) +#define JOB_NOTIFY_FIELD_PAGES_PRINTED ( 0x15 ) +#define JOB_NOTIFY_FIELD_TOTAL_BYTES ( 0x16 ) +#define JOB_NOTIFY_FIELD_BYTES_PRINTED ( 0x17 ) +#endif +; + +enum spoolss_PrintNotifyField #ifndef USE_UINT_ENUMS { - SPOOLSS_FIELD_SERVER_NAME=0, - SPOOLSS_FIELD_PRINTER_NAME=1, - SPOOLSS_FIELD_SHARE_NAME=2, - SPOOLSS_FIELD_PORT_NAME=3, - SPOOLSS_FIELD_DRIVER_NAME=4, - SPOOLSS_FIELD_COMMENT=5, - SPOOLSS_FIELD_LOCATION=6, - SPOOLSS_FIELD_DEVMODE=7, - SPOOLSS_FIELD_SEPFILE=8, - SPOOLSS_FIELD_PRINT_PROCESSOR=9, - SPOOLSS_FIELD_PARAMETERS=10, - SPOOLSS_FIELD_DATATYPE=11, - SPOOLSS_FIELD_SECURITY_DESCRIPTOR=12, - SPOOLSS_FIELD_ATTRIBUTES=13, - SPOOLSS_FIELD_PRIORITY=14, - SPOOLSS_FIELD_DEFAULT_PRIORITY=15, - SPOOLSS_FIELD_START_TIME=16, - SPOOLSS_FIELD_UNTIL_TIME=17, - SPOOLSS_FIELD_STATUS=18, - SPOOLSS_FIELD_STATUS_STRING=19, - SPOOLSS_FIELD_CJOBS=20, - SPOOLSS_FIELD_AVERAGE_PPM=21, - SPOOLSS_FIELD_TOTAL_PAGES=22, - SPOOLSS_FIELD_PAGES_PRINTED=23, - SPOOLSS_FIELD_TOTAL_BYTES=24, - SPOOLSS_FIELD_BYTES_PRINTED=25 + PRINTER_NOTIFY_FIELD_SERVER_NAME=0x00, + PRINTER_NOTIFY_FIELD_PRINTER_NAME=0x01, + PRINTER_NOTIFY_FIELD_SHARE_NAME=0x02, + PRINTER_NOTIFY_FIELD_PORT_NAME=0x03, + PRINTER_NOTIFY_FIELD_DRIVER_NAME=0x04, + PRINTER_NOTIFY_FIELD_COMMENT=0x05, + PRINTER_NOTIFY_FIELD_LOCATION=0x06, + PRINTER_NOTIFY_FIELD_DEVMODE=0x07, + PRINTER_NOTIFY_FIELD_SEPFILE=0x08, + PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR=0x09, + PRINTER_NOTIFY_FIELD_PARAMETERS=0x0a, + PRINTER_NOTIFY_FIELD_DATATYPE=0x0b, + PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR=0x0c, + PRINTER_NOTIFY_FIELD_ATTRIBUTES=0x0d, + PRINTER_NOTIFY_FIELD_PRIORITY=0x0e, + PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY=0x0f, + PRINTER_NOTIFY_FIELD_START_TIME=0x10, + PRINTER_NOTIFY_FIELD_UNTIL_TIME=0x11, + PRINTER_NOTIFY_FIELD_STATUS=0x12, + PRINTER_NOTIFY_FIELD_STATUS_STRING=0x13, + PRINTER_NOTIFY_FIELD_CJOBS=0x14, + PRINTER_NOTIFY_FIELD_AVERAGE_PPM=0x15, + PRINTER_NOTIFY_FIELD_TOTAL_PAGES=0x16, + PRINTER_NOTIFY_FIELD_PAGES_PRINTED=0x17, + PRINTER_NOTIFY_FIELD_TOTAL_BYTES=0x18, + PRINTER_NOTIFY_FIELD_BYTES_PRINTED=0x19, + PRINTER_NOTIFY_FIELD_OBJECT_GUID=0x1a, + PRINTER_NOTIFY_FIELD_FRIENDLY_NAME=0x1b } #else - { __donnot_use_enum_spoolss_Field=0x7FFFFFFF} -#define SPOOLSS_FIELD_SERVER_NAME ( 0 ) -#define SPOOLSS_FIELD_PRINTER_NAME ( 1 ) -#define SPOOLSS_FIELD_SHARE_NAME ( 2 ) -#define SPOOLSS_FIELD_PORT_NAME ( 3 ) -#define SPOOLSS_FIELD_DRIVER_NAME ( 4 ) -#define SPOOLSS_FIELD_COMMENT ( 5 ) -#define SPOOLSS_FIELD_LOCATION ( 6 ) -#define SPOOLSS_FIELD_DEVMODE ( 7 ) -#define SPOOLSS_FIELD_SEPFILE ( 8 ) -#define SPOOLSS_FIELD_PRINT_PROCESSOR ( 9 ) -#define SPOOLSS_FIELD_PARAMETERS ( 10 ) -#define SPOOLSS_FIELD_DATATYPE ( 11 ) -#define SPOOLSS_FIELD_SECURITY_DESCRIPTOR ( 12 ) -#define SPOOLSS_FIELD_ATTRIBUTES ( 13 ) -#define SPOOLSS_FIELD_PRIORITY ( 14 ) -#define SPOOLSS_FIELD_DEFAULT_PRIORITY ( 15 ) -#define SPOOLSS_FIELD_START_TIME ( 16 ) -#define SPOOLSS_FIELD_UNTIL_TIME ( 17 ) -#define SPOOLSS_FIELD_STATUS ( 18 ) -#define SPOOLSS_FIELD_STATUS_STRING ( 19 ) -#define SPOOLSS_FIELD_CJOBS ( 20 ) -#define SPOOLSS_FIELD_AVERAGE_PPM ( 21 ) -#define SPOOLSS_FIELD_TOTAL_PAGES ( 22 ) -#define SPOOLSS_FIELD_PAGES_PRINTED ( 23 ) -#define SPOOLSS_FIELD_TOTAL_BYTES ( 24 ) -#define SPOOLSS_FIELD_BYTES_PRINTED ( 25 ) + { __donnot_use_enum_spoolss_PrintNotifyField=0x7FFFFFFF} +#define PRINTER_NOTIFY_FIELD_SERVER_NAME ( 0x00 ) +#define PRINTER_NOTIFY_FIELD_PRINTER_NAME ( 0x01 ) +#define PRINTER_NOTIFY_FIELD_SHARE_NAME ( 0x02 ) +#define PRINTER_NOTIFY_FIELD_PORT_NAME ( 0x03 ) +#define PRINTER_NOTIFY_FIELD_DRIVER_NAME ( 0x04 ) +#define PRINTER_NOTIFY_FIELD_COMMENT ( 0x05 ) +#define PRINTER_NOTIFY_FIELD_LOCATION ( 0x06 ) +#define PRINTER_NOTIFY_FIELD_DEVMODE ( 0x07 ) +#define PRINTER_NOTIFY_FIELD_SEPFILE ( 0x08 ) +#define PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR ( 0x09 ) +#define PRINTER_NOTIFY_FIELD_PARAMETERS ( 0x0a ) +#define PRINTER_NOTIFY_FIELD_DATATYPE ( 0x0b ) +#define PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR ( 0x0c ) +#define PRINTER_NOTIFY_FIELD_ATTRIBUTES ( 0x0d ) +#define PRINTER_NOTIFY_FIELD_PRIORITY ( 0x0e ) +#define PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY ( 0x0f ) +#define PRINTER_NOTIFY_FIELD_START_TIME ( 0x10 ) +#define PRINTER_NOTIFY_FIELD_UNTIL_TIME ( 0x11 ) +#define PRINTER_NOTIFY_FIELD_STATUS ( 0x12 ) +#define PRINTER_NOTIFY_FIELD_STATUS_STRING ( 0x13 ) +#define PRINTER_NOTIFY_FIELD_CJOBS ( 0x14 ) +#define PRINTER_NOTIFY_FIELD_AVERAGE_PPM ( 0x15 ) +#define PRINTER_NOTIFY_FIELD_TOTAL_PAGES ( 0x16 ) +#define PRINTER_NOTIFY_FIELD_PAGES_PRINTED ( 0x17 ) +#define PRINTER_NOTIFY_FIELD_TOTAL_BYTES ( 0x18 ) +#define PRINTER_NOTIFY_FIELD_BYTES_PRINTED ( 0x19 ) +#define PRINTER_NOTIFY_FIELD_OBJECT_GUID ( 0x1a ) +#define PRINTER_NOTIFY_FIELD_FRIENDLY_NAME ( 0x1b ) #endif ; enum spoolss_NotifyType #ifndef USE_UINT_ENUMS { - SPOOLSS_NOTIFY_PRINTER=0, - SPOOLSS_NOTIFY_JOB=1 + PRINTER_NOTIFY_TYPE=0x00, + JOB_NOTIFY_TYPE=0x01 } #else { __donnot_use_enum_spoolss_NotifyType=0x7FFFFFFF} -#define SPOOLSS_NOTIFY_PRINTER ( 0 ) -#define SPOOLSS_NOTIFY_JOB ( 1 ) +#define PRINTER_NOTIFY_TYPE ( 0x00 ) +#define JOB_NOTIFY_TYPE ( 0x01 ) #endif ; +union spoolss_Field { + uint16_t field;/* [case(PRINTER_NOTIFY_TYPE)] */ +}/* [noprint,nodiscriminant] */; + struct spoolss_NotifyOptionType { enum spoolss_NotifyType type; uint16_t u1; uint32_t u2; uint32_t u3; uint32_t count; - enum spoolss_Field *fields;/* [unique,size_is(count)] */ + union spoolss_Field *fields;/* [unique,switch_is(type),size_is(count)] */ }; /* bitmap spoolssNotifyOptionFlags */ @@ -1426,7 +1476,7 @@ union spoolss_NotifyData { struct spoolss_Notify { enum spoolss_NotifyType type; - enum spoolss_Field field; + union spoolss_Field field;/* [switch_is(type)] */ enum spoolss_NotifyTable variable_type; uint32_t job_id; union spoolss_NotifyData data;/* [switch_is(variable_type)] */ @@ -1494,6 +1544,14 @@ struct spoolss_UserLevelCtr { #define JOB_ACCESS_ADMINISTER ( 0x00000010 ) #define JOB_ACCESS_READ ( 0x00000020 ) +struct spoolss_PrinterEnumValues { + const char * value_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t value_name_len;/* [value(2*strlen_m_term(value_name))] */ + enum winreg_Type type; + union spoolss_PrinterData *data;/* [relative,subcontext_size(r->data_length),subcontext(0),switch_is(type)] */ + uint32_t data_length;/* [value(ndr_size_spoolss_PrinterData(data,type,ndr->iconv_convenience,ndr->flags))] */ +}/* [relative_base,gensize,public] */; + /* bitmap spoolss_DeleteDriverFlags */ #define DPD_DELETE_UNUSED_FILES ( 0x00000001 ) #define DPD_DELETE_SPECIFIC_VERSION ( 0x00000002 ) @@ -2087,8 +2145,8 @@ struct _spoolss_GetPrinterData { } in; struct { - enum spoolss_PrinterDataType *type;/* [ref] */ - DATA_BLOB data; + enum winreg_Type *type;/* [ref] */ + DATA_BLOB *data;/* [ref] */ uint32_t *needed;/* [ref] */ WERROR result; } out; @@ -2098,11 +2156,11 @@ struct _spoolss_GetPrinterData { struct __spoolss_GetPrinterData { struct { - enum spoolss_PrinterDataType type; + enum winreg_Type type; } in; struct { - union spoolss_PrinterData data;/* [switch_is(type)] */ + union spoolss_PrinterData *data;/* [ref,switch_is(type)] */ } out; }; @@ -2116,8 +2174,8 @@ struct spoolss_GetPrinterData { } in; struct { - enum spoolss_PrinterDataType *type;/* [ref] */ - union spoolss_PrinterData data;/* [subcontext_size(offered),subcontext(4),switch_is(*type)] */ + enum winreg_Type *type;/* [ref] */ + union spoolss_PrinterData *data;/* [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */ uint32_t *needed;/* [ref] */ WERROR result; } out; @@ -2129,7 +2187,7 @@ struct _spoolss_SetPrinterData { struct { struct policy_handle *handle;/* [ref] */ const char *value_name;/* [charset(UTF16)] */ - enum spoolss_PrinterDataType type; + enum winreg_Type type; DATA_BLOB data; uint32_t _offered; } in; @@ -2143,11 +2201,11 @@ struct _spoolss_SetPrinterData { struct __spoolss_SetPrinterData { struct { - enum spoolss_PrinterDataType type; + enum winreg_Type type; } in; struct { - union spoolss_PrinterData data;/* [switch_is(type)] */ + union spoolss_PrinterData *data;/* [ref,switch_is(type)] */ } out; }; @@ -2157,7 +2215,7 @@ struct spoolss_SetPrinterData { struct { struct policy_handle *handle;/* [ref] */ const char *value_name;/* [charset(UTF16)] */ - enum spoolss_PrinterDataType type; + enum winreg_Type type; union spoolss_PrinterData data;/* [subcontext(4),switch_is(type)] */ uint32_t _offered;/* [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */ } in; @@ -2826,8 +2884,8 @@ struct spoolss_EnumPrinterData { struct { const char *value_name;/* [charset(UTF16),size_is(value_offered/2)] */ uint32_t *value_needed;/* [ref] */ - uint32_t *printerdata_type;/* [ref] */ - DATA_BLOB *buffer;/* [ref] */ + enum winreg_Type *type;/* [ref] */ + uint8_t *data;/* [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */ uint32_t *data_needed;/* [ref] */ WERROR result; } out; @@ -2877,7 +2935,7 @@ struct spoolss_SetPrinterDataEx { struct policy_handle *handle;/* [ref] */ const char *key_name;/* [charset(UTF16)] */ const char *value_name;/* [charset(UTF16)] */ - uint32_t type; + enum winreg_Type type; uint8_t *buffer;/* [ref,size_is(offered)] */ uint32_t offered; } in; @@ -2898,7 +2956,7 @@ struct spoolss_GetPrinterDataEx { } in; struct { - uint32_t *type;/* [ref] */ + enum winreg_Type *type;/* [ref] */ uint8_t *buffer;/* [ref,size_is(offered)] */ uint32_t *needed;/* [ref] */ WERROR result; @@ -2907,7 +2965,7 @@ struct spoolss_GetPrinterDataEx { }; -struct spoolss_EnumPrinterDataEx { +struct _spoolss_EnumPrinterDataEx { struct { struct policy_handle *handle;/* [ref] */ const char *key_name;/* [charset(UTF16)] */ @@ -2915,7 +2973,7 @@ struct spoolss_EnumPrinterDataEx { } in; struct { - uint8_t *buffer;/* [ref,size_is(offered)] */ + DATA_BLOB info; uint32_t *needed;/* [ref] */ uint32_t *count;/* [ref] */ WERROR result; @@ -2924,15 +2982,44 @@ struct spoolss_EnumPrinterDataEx { }; +struct __spoolss_EnumPrinterDataEx { + struct { + uint32_t count; + } in; + + struct { + struct spoolss_PrinterEnumValues *info; + } out; + +}; + + +struct spoolss_EnumPrinterDataEx { + struct { + struct policy_handle *handle;/* [ref] */ + const char *key_name;/* [charset(UTF16)] */ + uint32_t offered; + } in; + + struct { + uint32_t *count;/* [ref] */ + struct spoolss_PrinterEnumValues **info;/* [ref,size_is(,*count)] */ + uint32_t *needed;/* [ref] */ + WERROR result; + } out; + +}; + + struct spoolss_EnumPrinterKey { struct { struct policy_handle *handle;/* [ref] */ const char *key_name;/* [charset(UTF16)] */ - uint32_t key_buffer_size; + uint32_t offered; } in; struct { - uint16_t *key_buffer;/* [ref,size_is(key_buffer_size/2)] */ + const char ** *key_buffer;/* [subcontext_size(offered),ref,subcontext(0),flag(LIBNDR_FLAG_STR_NULLTERM)] */ uint32_t *needed;/* [ref] */ WERROR result; } out; diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c index 9cb930f979..79efbb5970 100644 --- a/librpc/gen_ndr/srv_spoolss.c +++ b/librpc/gen_ndr/srv_spoolss.c @@ -2113,12 +2113,18 @@ static bool api_spoolss_GetPrinterData(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.type = talloc_zero(r, enum spoolss_PrinterDataType); + r->out.type = talloc_zero(r, enum winreg_Type); if (r->out.type == NULL) { talloc_free(r); return false; } + r->out.data = talloc_zero(r, union spoolss_PrinterData); + if (r->out.data == NULL) { + talloc_free(r); + return false; + } + r->out.needed = talloc_zero(r, uint32_t); if (r->out.needed == NULL) { talloc_free(r); @@ -5649,14 +5655,14 @@ static bool api_spoolss_EnumPrinterData(pipes_struct *p) return false; } - r->out.printerdata_type = talloc_zero(r, uint32_t); - if (r->out.printerdata_type == NULL) { + r->out.type = talloc_zero(r, enum winreg_Type); + if (r->out.type == NULL) { talloc_free(r); return false; } - r->out.buffer = talloc_zero(r, DATA_BLOB); - if (r->out.buffer == NULL) { + r->out.data = talloc_zero_array(r, uint8_t, r->in.data_offered); + if (r->out.data == NULL) { talloc_free(r); return false; } @@ -6106,7 +6112,7 @@ static bool api_spoolss_GetPrinterDataEx(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.type = talloc_zero(r, uint32_t); + r->out.type = talloc_zero(r, enum winreg_Type); if (r->out.type == NULL) { talloc_free(r); return false; @@ -6198,20 +6204,20 @@ static bool api_spoolss_EnumPrinterDataEx(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered); - if (r->out.buffer == NULL) { + r->out.count = talloc_zero(r, uint32_t); + if (r->out.count == NULL) { talloc_free(r); return false; } - r->out.needed = talloc_zero(r, uint32_t); - if (r->out.needed == NULL) { + r->out.info = talloc_zero(r, struct spoolss_PrinterEnumValues *); + if (r->out.info == NULL) { talloc_free(r); return false; } - r->out.count = talloc_zero(r, uint32_t); - if (r->out.count == NULL) { + r->out.needed = talloc_zero(r, uint32_t); + if (r->out.needed == NULL) { talloc_free(r); return false; } @@ -6290,7 +6296,7 @@ static bool api_spoolss_EnumPrinterKey(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.key_buffer = talloc_zero_array(r, uint16_t, r->in.key_buffer_size / 2); + r->out.key_buffer = talloc_zero(r, const char **); if (r->out.key_buffer == NULL) { talloc_free(r); return false; @@ -7865,11 +7871,16 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_GETPRINTERDATA: { struct spoolss_GetPrinterData *r = (struct spoolss_GetPrinterData *)_r; ZERO_STRUCT(r->out); - r->out.type = talloc_zero(mem_ctx, enum spoolss_PrinterDataType); + r->out.type = talloc_zero(mem_ctx, enum winreg_Type); if (r->out.type == NULL) { return NT_STATUS_NO_MEMORY; } + r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData); + if (r->out.data == NULL) { + return NT_STATUS_NO_MEMORY; + } + r->out.needed = talloc_zero(mem_ctx, uint32_t); if (r->out.needed == NULL) { return NT_STATUS_NO_MEMORY; @@ -8292,13 +8303,13 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - r->out.printerdata_type = talloc_zero(mem_ctx, uint32_t); - if (r->out.printerdata_type == NULL) { + r->out.type = talloc_zero(mem_ctx, enum winreg_Type); + if (r->out.type == NULL) { return NT_STATUS_NO_MEMORY; } - r->out.buffer = talloc_zero(mem_ctx, DATA_BLOB); - if (r->out.buffer == NULL) { + r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.data_offered); + if (r->out.data == NULL) { return NT_STATUS_NO_MEMORY; } @@ -8344,7 +8355,7 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_GETPRINTERDATAEX: { struct spoolss_GetPrinterDataEx *r = (struct spoolss_GetPrinterDataEx *)_r; ZERO_STRUCT(r->out); - r->out.type = talloc_zero(mem_ctx, uint32_t); + r->out.type = talloc_zero(mem_ctx, enum winreg_Type); if (r->out.type == NULL) { return NT_STATUS_NO_MEMORY; } @@ -8366,18 +8377,18 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_ENUMPRINTERDATAEX: { struct spoolss_EnumPrinterDataEx *r = (struct spoolss_EnumPrinterDataEx *)_r; ZERO_STRUCT(r->out); - r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered); - if (r->out.buffer == NULL) { + r->out.count = talloc_zero(mem_ctx, uint32_t); + if (r->out.count == NULL) { return NT_STATUS_NO_MEMORY; } - r->out.needed = talloc_zero(mem_ctx, uint32_t); - if (r->out.needed == NULL) { + r->out.info = talloc_zero(mem_ctx, struct spoolss_PrinterEnumValues *); + if (r->out.info == NULL) { return NT_STATUS_NO_MEMORY; } - r->out.count = talloc_zero(mem_ctx, uint32_t); - if (r->out.count == NULL) { + r->out.needed = talloc_zero(mem_ctx, uint32_t); + if (r->out.needed == NULL) { return NT_STATUS_NO_MEMORY; } @@ -8388,7 +8399,7 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_ENUMPRINTERKEY: { struct spoolss_EnumPrinterKey *r = (struct spoolss_EnumPrinterKey *)_r; ZERO_STRUCT(r->out); - r->out.key_buffer = talloc_zero_array(mem_ctx, uint16_t, r->in.key_buffer_size / 2); + r->out.key_buffer = talloc_zero(mem_ctx, const char **); if (r->out.key_buffer == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl index f837afbd5d..a1bb95aa9f 100644 --- a/librpc/idl/spoolss.idl +++ b/librpc/idl/spoolss.idl @@ -289,7 +289,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [relative] nstring *parameters; [relative,subcontext(0)] security_descriptor *secdesc; spoolss_PrinterAttributes attributes; - uint32 priority; + [range(0,99)] uint32 priority; uint32 defaultpriority; uint32 starttime; uint32 untiltime; @@ -410,7 +410,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [relative] nstring *data_type; [relative] nstring *text_status; spoolss_JobStatus status; - uint32 priority; + [range(0,99)] uint32 priority; uint32 position; uint32 total_pages; uint32 pages_printed; @@ -432,7 +432,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [relative] nstring *text_status; [relative] security_descriptor *secdesc; spoolss_JobStatus status; - uint32 priority; + [range(0,99)] uint32 priority; uint32 position; uint32 start_time; uint32 until_time; @@ -464,7 +464,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [relative] nstring *text_status; [relative] security_descriptor *secdesc; spoolss_JobStatus status; - uint32 priority; + [range(0,99)] uint32 priority; uint32 position; uint32 start_time; uint32 until_time; @@ -493,7 +493,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [string,charset(UTF16)] uint16 *data_type; [string,charset(UTF16)] uint16 *text_status; spoolss_JobStatus status; - uint32 priority; + [range(0,99)] uint32 priority; uint32 position; uint32 total_pages; uint32 pages_printed; @@ -515,7 +515,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [string,charset(UTF16)] uint16 *text_status; uint32 _secdesc_ptr; spoolss_JobStatus status; - uint32 priority; + [range(0,99)] uint32 priority; uint32 position; uint32 start_time; uint32 until_time; @@ -541,7 +541,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [string,charset(UTF16)] uint16 *text_status; uint32 _secdesc_ptr; spoolss_JobStatus status; - uint32 priority; + [range(0,99)] uint32 priority; uint32 position; uint32 start_time; uint32 until_time; @@ -704,7 +704,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [string,charset(UTF16)] uint16 *parameters; [subcontext(0)] security_descriptor *secdesc; spoolss_PrinterAttributes attributes; - uint32 priority; + [range(0,99)] uint32 priority; uint32 defaultpriority; uint32 starttime; uint32 untiltime; @@ -1302,20 +1302,12 @@ import "misc.idl", "security.idl", "winreg.idl"; uint32 unknown3;/* hmm? w2k3: 131346(0x20112) winxp sp1: 503382272 0x1E010100 */ } spoolss_OSVersionEx; - typedef [v1_enum] enum { - SPOOLSS_PRINTER_DATA_TYPE_NULL = 0, - SPOOLSS_PRINTER_DATA_TYPE_STRING = 1, - SPOOLSS_PRINTER_DATA_TYPE_BINARY = 3, - SPOOLSS_PRINTER_DATA_TYPE_UINT32 = 4, - SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY = 7 - } spoolss_PrinterDataType; - typedef [nodiscriminant,public,gensize] union { - [case(SPOOLSS_PRINTER_DATA_TYPE_NULL)]; - [case(SPOOLSS_PRINTER_DATA_TYPE_STRING)] nstring string; - [case(SPOOLSS_PRINTER_DATA_TYPE_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary; - [case(SPOOLSS_PRINTER_DATA_TYPE_UINT32)] uint32 value; - [case(SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY)] nstring_array string_array; + [case(REG_NONE)]; + [case(REG_SZ)] nstring string; + [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary; + [case(REG_DWORD)] uint32 value; + [case(REG_MULTI_SZ)] nstring_array string_array; [default,flag(NDR_REMAINING)] DATA_BLOB data; } spoolss_PrinterData; @@ -1323,20 +1315,20 @@ import "misc.idl", "security.idl", "winreg.idl"; [in,ref] policy_handle *handle, [in] [string,charset(UTF16)] uint16 value_name[], [in] uint32 offered, - [out,ref] spoolss_PrinterDataType *type, - [out] DATA_BLOB data, + [out,ref] winreg_Type *type, + [out,ref] DATA_BLOB *data, [out,ref] uint32 *needed ); [noopnum,noprint,public] void __spoolss_GetPrinterData( - [in] spoolss_PrinterDataType type, - [out,switch_is(type)] spoolss_PrinterData data + [in] winreg_Type type, + [out,ref,switch_is(type)] spoolss_PrinterData *data ); [nopull,nopush,public] WERROR spoolss_GetPrinterData( [in,ref] policy_handle *handle, [in] [string,charset(UTF16)] uint16 value_name[], [in] uint32 offered, - [out,ref] spoolss_PrinterDataType *type, - [out,subcontext(4),subcontext_size(offered),switch_is(*type)] spoolss_PrinterData data, + [out,ref] winreg_Type *type, + [out,ref,subcontext(4),subcontext_size(offered),switch_is(*type)] spoolss_PrinterData *data, [out,ref] uint32 *needed ); @@ -1345,18 +1337,18 @@ import "misc.idl", "security.idl", "winreg.idl"; [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterData( [in,ref] policy_handle *handle, [in] [string,charset(UTF16)] uint16 value_name[], - [in] spoolss_PrinterDataType type, + [in] winreg_Type type, [in] DATA_BLOB data, [in] uint32 _offered ); [noopnum,nopull,noprint,public] void __spoolss_SetPrinterData( - [in] spoolss_PrinterDataType type, - [out,switch_is(type)] spoolss_PrinterData data + [in] winreg_Type type, + [out,ref,switch_is(type)] spoolss_PrinterData *data ); [nopush] WERROR spoolss_SetPrinterData( [in,ref] policy_handle *handle, [in] [string,charset(UTF16)] uint16 value_name[], - [in] spoolss_PrinterDataType type, + [in] winreg_Type type, [in,subcontext(4),switch_is(type)] spoolss_PrinterData data, [in,value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] uint32 _offered ); @@ -1509,6 +1501,16 @@ import "misc.idl", "security.idl", "winreg.idl"; [out,ref] uint32 *needed ); + /* + * Special strings for the OpenPrinter() call. See the MSDN DDK + * docs on the XcvDataPort() for more details. + */ + + const string SPL_LOCAL_PORT = "Local Port"; + const string SPL_TCPIP_PORT = "Standard TCP/IP Port"; + const string SPL_XCV_MONITOR_LOCALMON = ",XcvMonitor Local Port"; + const string SPL_XCV_MONITOR_TCPMON = ",XcvMonitor Standard TCP/IP Port"; + typedef [public,gensize] struct { [relative] nstring *port_name; } spoolss_PortInfo1; @@ -1890,40 +1892,75 @@ import "misc.idl", "security.idl", "winreg.idl"; [todo] WERROR spoolss_ResetPrinterEx( ); - typedef [enum16bit] enum { - SPOOLSS_FIELD_SERVER_NAME = 0, - SPOOLSS_FIELD_PRINTER_NAME = 1, - SPOOLSS_FIELD_SHARE_NAME = 2, - SPOOLSS_FIELD_PORT_NAME = 3, - SPOOLSS_FIELD_DRIVER_NAME = 4, - SPOOLSS_FIELD_COMMENT = 5, - SPOOLSS_FIELD_LOCATION = 6, - SPOOLSS_FIELD_DEVMODE = 7, - SPOOLSS_FIELD_SEPFILE = 8, - SPOOLSS_FIELD_PRINT_PROCESSOR = 9, - SPOOLSS_FIELD_PARAMETERS = 10, - SPOOLSS_FIELD_DATATYPE = 11, - SPOOLSS_FIELD_SECURITY_DESCRIPTOR=12, - SPOOLSS_FIELD_ATTRIBUTES = 13, - SPOOLSS_FIELD_PRIORITY = 14, - SPOOLSS_FIELD_DEFAULT_PRIORITY = 15, - SPOOLSS_FIELD_START_TIME = 16, - SPOOLSS_FIELD_UNTIL_TIME = 17, - SPOOLSS_FIELD_STATUS = 18, - SPOOLSS_FIELD_STATUS_STRING = 19, - SPOOLSS_FIELD_CJOBS = 20, - SPOOLSS_FIELD_AVERAGE_PPM = 21, - SPOOLSS_FIELD_TOTAL_PAGES = 22, - SPOOLSS_FIELD_PAGES_PRINTED = 23, - SPOOLSS_FIELD_TOTAL_BYTES = 24, - SPOOLSS_FIELD_BYTES_PRINTED = 25 - } spoolss_Field; + typedef [enum16bit,public] enum { + JOB_NOTIFY_FIELD_PRINTER_NAME = 0x00, + JOB_NOTIFY_FIELD_MACHINE_NAME = 0x01, + JOB_NOTIFY_FIELD_PORT_NAME = 0x02, + JOB_NOTIFY_FIELD_USER_NAME = 0x03, + JOB_NOTIFY_FIELD_NOTIFY_NAME = 0x04, + JOB_NOTIFY_FIELD_DATATYPE = 0x05, + JOB_NOTIFY_FIELD_PRINT_PROCESSOR = 0x06, + JOB_NOTIFY_FIELD_PARAMETERS = 0x07, + JOB_NOTIFY_FIELD_DRIVER_NAME = 0x08, + JOB_NOTIFY_FIELD_DEVMODE = 0x09, + JOB_NOTIFY_FIELD_STATUS = 0x0a, + JOB_NOTIFY_FIELD_STATUS_STRING = 0x0b, + JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR = 0x0c, + JOB_NOTIFY_FIELD_DOCUMENT = 0x0d, + JOB_NOTIFY_FIELD_PRIORITY = 0x0e, + JOB_NOTIFY_FIELD_POSITION = 0x0f, + JOB_NOTIFY_FIELD_SUBMITTED = 0x10, + JOB_NOTIFY_FIELD_START_TIME = 0x11, + JOB_NOTIFY_FIELD_UNTIL_TIME = 0x12, + JOB_NOTIFY_FIELD_TIME = 0x13, + JOB_NOTIFY_FIELD_TOTAL_PAGES = 0x14, + JOB_NOTIFY_FIELD_PAGES_PRINTED = 0x15, + JOB_NOTIFY_FIELD_TOTAL_BYTES = 0x16, + JOB_NOTIFY_FIELD_BYTES_PRINTED = 0x17 + } spoolss_JobNotifyField; + + typedef [enum16bit,public] enum { + PRINTER_NOTIFY_FIELD_SERVER_NAME = 0x00, + PRINTER_NOTIFY_FIELD_PRINTER_NAME = 0x01, + PRINTER_NOTIFY_FIELD_SHARE_NAME = 0x02, + PRINTER_NOTIFY_FIELD_PORT_NAME = 0x03, + PRINTER_NOTIFY_FIELD_DRIVER_NAME = 0x04, + PRINTER_NOTIFY_FIELD_COMMENT = 0x05, + PRINTER_NOTIFY_FIELD_LOCATION = 0x06, + PRINTER_NOTIFY_FIELD_DEVMODE = 0x07, + PRINTER_NOTIFY_FIELD_SEPFILE = 0x08, + PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR = 0x09, + PRINTER_NOTIFY_FIELD_PARAMETERS = 0x0a, + PRINTER_NOTIFY_FIELD_DATATYPE = 0x0b, + PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR = 0x0c, + PRINTER_NOTIFY_FIELD_ATTRIBUTES = 0x0d, + PRINTER_NOTIFY_FIELD_PRIORITY = 0x0e, + PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY = 0x0f, + PRINTER_NOTIFY_FIELD_START_TIME = 0x10, + PRINTER_NOTIFY_FIELD_UNTIL_TIME = 0x11, + PRINTER_NOTIFY_FIELD_STATUS = 0x12, + PRINTER_NOTIFY_FIELD_STATUS_STRING = 0x13, + PRINTER_NOTIFY_FIELD_CJOBS = 0x14, + PRINTER_NOTIFY_FIELD_AVERAGE_PPM = 0x15, + PRINTER_NOTIFY_FIELD_TOTAL_PAGES = 0x16, + PRINTER_NOTIFY_FIELD_PAGES_PRINTED = 0x17, + PRINTER_NOTIFY_FIELD_TOTAL_BYTES = 0x18, + PRINTER_NOTIFY_FIELD_BYTES_PRINTED = 0x19, + PRINTER_NOTIFY_FIELD_OBJECT_GUID = 0x1a, + PRINTER_NOTIFY_FIELD_FRIENDLY_NAME = 0x1b + } spoolss_PrintNotifyField; typedef [enum16bit] enum { - SPOOLSS_NOTIFY_PRINTER = 0, - SPOOLSS_NOTIFY_JOB = 1 + PRINTER_NOTIFY_TYPE = 0x00, + JOB_NOTIFY_TYPE = 0x01 } spoolss_NotifyType; + typedef [nodiscriminant,noprint] union { + [case(PRINTER_NOTIFY_TYPE)] uint16 field; + [case(JOB_NOTIFY_TYPE)] uint16 field; + [default] uint16 field; + } spoolss_Field; + /******************/ /* Function: 0x41 */ typedef struct { @@ -1932,7 +1969,7 @@ import "misc.idl", "security.idl", "winreg.idl"; uint32 u2; uint32 u3; uint32 count; - [size_is(count)] spoolss_Field *fields; + [size_is(count),switch_is(type)] spoolss_Field *fields; } spoolss_NotifyOptionType; typedef [bitmap32bit] bitmap { @@ -1981,7 +2018,7 @@ import "misc.idl", "security.idl", "winreg.idl"; typedef struct { spoolss_NotifyType type; - spoolss_Field field; + [switch_is(type)] spoolss_Field field; spoolss_NotifyTable variable_type; uint32 job_id; [switch_is(variable_type)] spoolss_NotifyData data; @@ -2163,8 +2200,8 @@ import "misc.idl", "security.idl", "winreg.idl"; [out,size_is(value_offered/2),charset(UTF16)] uint16 value_name[], [in] uint32 value_offered, [out,ref] uint32 *value_needed, - [out,ref] uint32 *printerdata_type, - [out,ref] DATA_BLOB *buffer, + [out,ref] winreg_Type *type, + [out,ref,size_is(data_offered),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *data, [in] uint32 data_offered, [out,ref] uint32 *data_needed ); @@ -2197,7 +2234,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [in,ref] policy_handle *handle, [in] [string,charset(UTF16)] uint16 key_name[], [in] [string,charset(UTF16)] uint16 value_name[], - [in] uint32 type, + [in] winreg_Type type, [in,ref] [size_is(offered)] uint8 *buffer, [in] uint32 offered ); @@ -2208,7 +2245,7 @@ import "misc.idl", "security.idl", "winreg.idl"; [in,ref] policy_handle *handle, [in] [string,charset(UTF16)] uint16 key_name[], [in] [string,charset(UTF16)] uint16 value_name[], - [out,ref] uint32 *type, + [out,ref] winreg_Type *type, [out,ref] [size_is(offered)] uint8 *buffer, [in] uint32 offered, [out,ref] uint32 *needed @@ -2216,22 +2253,43 @@ import "misc.idl", "security.idl", "winreg.idl"; /******************/ /* Function: 0x4f */ - [public] WERROR spoolss_EnumPrinterDataEx( + + typedef [relative_base,public,gensize] struct { + [relative] nstring *value_name; + [value(2*strlen_m_term(value_name))] uint32 value_name_len; + winreg_Type type; + [relative,switch_is(type),subcontext(0),subcontext_size(r->data_length)] spoolss_PrinterData *data; + [value(ndr_size_spoolss_PrinterData(data, type, ndr->iconv_convenience, ndr->flags))] uint32 data_length; + } spoolss_PrinterEnumValues; + + [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDataEx( [in,ref] policy_handle *handle, [in] [string,charset(UTF16)] uint16 key_name[], - [out,ref] [size_is(offered)] uint8 *buffer, - [in] uint32 offered, + [out] DATA_BLOB info, + [in] uint32 offered, [out,ref] uint32 *needed, [out,ref] uint32 *count ); + [public,noopnum,noprint] void __spoolss_EnumPrinterDataEx( + [in] uint32 count, + [out] spoolss_PrinterEnumValues info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPrinterDataEx( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 key_name[], + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,size_is(,*count)] spoolss_PrinterEnumValues **info, + [out,ref] uint32 *needed + ); /******************/ /* Function: 0x50 */ [public] WERROR spoolss_EnumPrinterKey( [in, ref] policy_handle *handle, [in] [string,charset(UTF16)] uint16 key_name[], - [out,ref] [size_is(key_buffer_size/2)] uint16 *key_buffer, - [in] uint32 key_buffer_size, + [out,ref] [subcontext(0),subcontext_size(offered)] nstring_array **key_buffer, + [in] uint32 offered, [out,ref] uint32 *needed ); diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c index 351dbf7016..0acae3dedb 100644 --- a/librpc/ndr/ndr_spoolss_buf.c +++ b/librpc/ndr/ndr_spoolss_buf.c @@ -5,6 +5,7 @@ Copyright (C) Andrew Tridgell 2003 Copyright (C) Tim Potter 2003 + Copyright (C) Guenther Deschner 2009 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 @@ -173,7 +174,7 @@ } while (0) /* TODO: set _ndr_info->flags correct */ -#define NDR_SPOOLSS_SIZE_ENUM(fn) do { \ +#define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \ struct __##fn __r;\ DATA_BLOB _data_blob_info;\ struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\ @@ -187,6 +188,21 @@ return _data_blob_info.length;\ } while(0) +/* TODO: set _ndr_info->flags correct */ +#define NDR_SPOOLSS_SIZE_ENUM(fn) do { \ + struct __##fn __r;\ + DATA_BLOB _data_blob_info;\ + struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\ + if (!_ndr_info) return 0;\ + _ndr_info->flags|=0;\ + __r.in.count = count;\ + __r.out.info = info;\ + _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \ + _data_blob_info = ndr_push_blob(_ndr_info);\ + return _data_blob_info.length;\ +} while(0) + + /* spoolss_EnumPrinters */ @@ -216,7 +232,7 @@ enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info) { - NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinters); + NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters); } /* @@ -252,7 +268,7 @@ enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, str uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_JobInfo *info) { - NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumJobs); + NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs); } /* @@ -284,7 +300,7 @@ enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_DriverInfo *info) { - NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDrivers); + NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers); } /* @@ -312,7 +328,7 @@ enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, st uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_FormInfo *info) { - NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumForms); + NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms); } /* @@ -340,7 +356,7 @@ enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, st uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PortInfo *info) { - NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPorts); + NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts); } /* @@ -368,7 +384,7 @@ enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info) { - NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumMonitors); + NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors); } /* @@ -401,7 +417,7 @@ enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info) { - NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrintProcessors); + NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors); } /* @@ -434,7 +450,107 @@ enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info) { - NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrintProcDataTypes); + NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes); +} + +/* + spoolss_EnumPrinterDataEx +*/ + +enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r) +{ + struct _spoolss_EnumPrinterDataEx _r; + if (flags & NDR_IN) { + _r.in.handle = r->in.handle; + _r.in.key_name = r->in.key_name; + _r.in.offered = r->in.offered; + NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r)); + } + if (flags & NDR_OUT) { + struct ndr_push *_ndr_info; + _r.in.handle = r->in.handle; + _r.in.key_name = r->in.key_name; + _r.in.offered = r->in.offered; + _r.out.count = r->out.count; + _r.out.needed = r->out.needed; + _r.out.result = r->out.result; + _r.out.info = data_blob(NULL, 0); + if (r->in.offered >= *r->out.needed) { + struct __spoolss_EnumPrinterDataEx __r; + _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience); + NDR_ERR_HAVE_NO_MEMORY(_ndr_info); + _ndr_info->flags= ndr->flags; + __r.in.count = *r->out.count; + __r.out.info = *r->out.info; + NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r)); + if (r->in.offered > _ndr_info->offset) { + uint32_t _padding_len = r->in.offered - _ndr_info->offset; + NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len)); + } + _r.out.info = ndr_push_blob(_ndr_info); + } + NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r)); + } + return NDR_ERR_SUCCESS; +} + +enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r) +{ + struct _spoolss_EnumPrinterDataEx _r; + if (flags & NDR_IN) { + _r.in.handle = r->in.handle; + _r.in.key_name = r->in.key_name; + ZERO_STRUCT(r->out); + NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r)); + r->in.handle = _r.in.handle; + r->in.key_name = _r.in.key_name; + r->in.offered = _r.in.offered; + r->out.needed = _r.out.needed; + r->out.count = _r.out.count; + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + _r.in.handle = r->in.handle; + _r.in.key_name = r->in.key_name; + _r.in.offered = r->in.offered; + _r.out.count = r->out.count; + _r.out.needed = r->out.needed; + NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + *r->out.info = NULL; + r->out.needed = _r.out.needed; + r->out.count = _r.out.count; + r->out.result = _r.out.result; + if (_r.out.info.length) { + struct ndr_pull *_ndr_info; + NDR_PULL_ALLOC(ndr, *r->out.info); + _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info, ndr->iconv_convenience); + NDR_ERR_HAVE_NO_MEMORY(_ndr_info); + _ndr_info->flags= ndr->flags; + if (r->in.offered != _ndr_info->data_size) { + return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, + "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]", + (unsigned)r->in.offered, (unsigned)_ndr_info->data_size); + } + if (*r->out.needed <= _ndr_info->data_size) { + struct __spoolss_EnumPrinterDataEx __r; + __r.in.count = *r->out.count; + __r.out.info = NULL; + NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r)); + *r->out.info = __r.out.info; + } + } + } + return NDR_ERR_SUCCESS; +} + +uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, + uint32_t count, struct spoolss_PrinterEnumValues *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx); } /* @@ -451,15 +567,17 @@ enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flag } if (flags & NDR_OUT) { struct ndr_push *_ndr_info; + DATA_BLOB blob = data_blob(NULL, 0); _r.in.handle = r->in.handle; _r.in.value_name= r->in.value_name; _r.in.offered = r->in.offered; _r.out.type = r->out.type; - _r.out.data = data_blob(NULL, 0); + _r.out.data = &blob; _r.out.needed = r->out.needed; _r.out.result = r->out.result; { struct __spoolss_GetPrinterData __r; + DATA_BLOB _blob; _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience); NDR_ERR_HAVE_NO_MEMORY(_ndr_info); _ndr_info->flags= ndr->flags; @@ -470,7 +588,8 @@ enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flag uint32_t _padding_len = r->in.offered - _ndr_info->offset; NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len)); } - _r.out.data = ndr_push_blob(_ndr_info); + _blob = ndr_push_blob(_ndr_info); + _r.out.data = &_blob; } NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r)); } @@ -481,13 +600,14 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flag { struct _spoolss_GetPrinterData _r; if (flags & NDR_IN) { + DATA_BLOB blob = data_blob(NULL,0); ZERO_STRUCT(r->out); _r.in.handle = r->in.handle; _r.in.value_name= r->in.value_name; _r.in.offered = r->in.offered; _r.out.type = r->out.type; - _r.out.data = data_blob(NULL,0), + _r.out.data = &blob; _r.out.needed = r->out.needed; NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r)); r->in.handle = _r.in.handle; @@ -496,26 +616,30 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flag r->out.needed = _r.out.needed; } if (flags & NDR_OUT) { + DATA_BLOB blob = data_blob_talloc(ndr,NULL,0); _r.in.handle = r->in.handle; _r.in.value_name= r->in.value_name; _r.in.offered = r->in.offered; _r.out.type = r->out.type; - _r.out.data = data_blob(NULL,0), + _r.out.data = &blob; _r.out.needed = r->out.needed; _r.out.result = r->out.result; NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r)); r->out.type = _r.out.type; - ZERO_STRUCT(r->out.data); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.data); + } + ZERO_STRUCTP(r->out.data); r->out.needed = _r.out.needed; r->out.result = _r.out.result; - if (_r.out.data.length != r->in.offered) { + if (_r.out.data && _r.out.data->length != r->in.offered) { return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]", - (unsigned)r->in.offered, (unsigned)_r.out.data.length); + (unsigned)r->in.offered, (unsigned)_r.out.data->length); } - if (_r.out.data.length > 0 && *r->out.needed <= _r.out.data.length) { + if (_r.out.data && _r.out.data->length > 0 && *r->out.needed <= _r.out.data->length) { struct __spoolss_GetPrinterData __r; - struct ndr_pull *_ndr_data = ndr_pull_init_blob(&_r.out.data, ndr, ndr->iconv_convenience); + struct ndr_pull *_ndr_data = ndr_pull_init_blob(_r.out.data, ndr, ndr->iconv_convenience); NDR_ERR_HAVE_NO_MEMORY(_ndr_data); _ndr_data->flags= ndr->flags; __r.in.type = *r->out.type; @@ -523,7 +647,7 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flag NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, flags, &__r)); r->out.data = __r.out.data; } else { - *r->out.type = SPOOLSS_PRINTER_DATA_TYPE_NULL; + *r->out.type = REG_NONE; } } return NDR_ERR_SUCCESS; @@ -545,7 +669,7 @@ enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flag _ndr_data->flags= ndr->flags; __r.in.type = r->in.type; - __r.out.data = r->in.data; + __r.out.data = discard_const_p(union spoolss_PrinterData, &r->in.data); NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r)); _data_blob_data = ndr_push_blob(_ndr_data); @@ -1062,3 +1186,25 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, } return NDR_ERR_SUCCESS; } + +void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "spoolss_Field"); + switch (level) { + case PRINTER_NOTIFY_TYPE: + ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field); + break; + + case JOB_NOTIFY_TYPE: + ndr_print_spoolss_JobNotifyField(ndr, "field", r->field); + break; + + default: + ndr_print_uint16(ndr, "field", r->field); + break; + + } +} + diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h index 04a84bfb62..aa6e277c5f 100644 --- a/librpc/ndr/ndr_spoolss_buf.h +++ b/librpc/ndr/ndr_spoolss_buf.h @@ -38,7 +38,10 @@ enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r); uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info); - +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); +uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, + uint32_t count, struct spoolss_PrinterEnumValues *info); enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r); enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r); enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r); @@ -46,6 +49,7 @@ uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags); _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r); _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r); +void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r); #undef _PRINTF_ATTRIBUTE #define _PRINTF_ATTRIBUTE(a1, a2) |