From be95cb6f8357334af08d1502910a429328b85bc5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Dec 2009 10:32:35 +0100 Subject: spoolss: more mork on SetPrinterInfo() levels. Guenther --- librpc/gen_ndr/ndr_spoolss.c | 150 ++++++++++++++++++++++--------------------- librpc/gen_ndr/ndr_spoolss.h | 2 + librpc/gen_ndr/spoolss.h | 16 +++-- librpc/idl/spoolss.idl | 16 +++-- 4 files changed, 102 insertions(+), 82 deletions(-) (limited to 'librpc') diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c index 6178b1c93b..fb93aafcac 100644 --- a/librpc/gen_ndr/ndr_spoolss.c +++ b/librpc/gen_ndr/ndr_spoolss.c @@ -6781,12 +6781,12 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo2(struct ndr_push *ndr, NDR_CHECK(ndr_push_unique_ptr(ndr, r->drivername)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->comment)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->location)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->devmode)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->devmode_ptr)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->sepfile)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->printprocessor)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->datatype)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->parameters)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->secdesc)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->secdesc_ptr)); NDR_CHECK(ndr_push_spoolss_PrinterAttributes(ndr, NDR_SCALARS, r->attributes)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->defaultpriority)); @@ -6840,14 +6840,6 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo2(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->location, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->location, ndr_charset_length(r->location, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - if (r->devmode) { - { - struct ndr_push *_ndr_devmode; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_devmode, 0, -1)); - NDR_CHECK(ndr_push_spoolss_DeviceMode(_ndr_devmode, NDR_SCALARS, r->devmode)); - NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_devmode, 0, -1)); - } - } if (r->sepfile) { NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->sepfile, CH_UTF16))); NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0)); @@ -6872,14 +6864,6 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo2(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->parameters, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->parameters, ndr_charset_length(r->parameters, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - if (r->secdesc) { - { - struct ndr_push *_ndr_secdesc; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_secdesc, 0, -1)); - NDR_CHECK(ndr_push_security_descriptor(_ndr_secdesc, NDR_SCALARS|NDR_BUFFERS, r->secdesc)); - NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_secdesc, 0, -1)); - } - } } return NDR_ERR_SUCCESS; } @@ -6900,8 +6884,6 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo2(struct ndr_pull *ndr, TALLOC_CTX *_mem_save_comment_0; uint32_t _ptr_location; TALLOC_CTX *_mem_save_location_0; - uint32_t _ptr_devmode; - TALLOC_CTX *_mem_save_devmode_0; uint32_t _ptr_sepfile; TALLOC_CTX *_mem_save_sepfile_0; uint32_t _ptr_printprocessor; @@ -6910,8 +6892,6 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo2(struct ndr_pull *ndr, TALLOC_CTX *_mem_save_datatype_0; uint32_t _ptr_parameters; TALLOC_CTX *_mem_save_parameters_0; - uint32_t _ptr_secdesc; - TALLOC_CTX *_mem_save_secdesc_0; if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 5)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_servername)); @@ -6956,12 +6936,7 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo2(struct ndr_pull *ndr, } else { r->location = NULL; } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_devmode)); - if (_ptr_devmode) { - NDR_PULL_ALLOC(ndr, r->devmode); - } else { - r->devmode = NULL; - } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->devmode_ptr)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sepfile)); if (_ptr_sepfile) { NDR_PULL_ALLOC(ndr, r->sepfile); @@ -6986,12 +6961,7 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo2(struct ndr_pull *ndr, } else { r->parameters = NULL; } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_secdesc)); - if (_ptr_secdesc) { - NDR_PULL_ALLOC(ndr, r->secdesc); - } else { - r->secdesc = NULL; - } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->secdesc_ptr)); 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) { @@ -7090,17 +7060,6 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo2(struct ndr_pull *ndr, NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->location, ndr_get_array_length(ndr, &r->location), sizeof(uint16_t), CH_UTF16)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_location_0, 0); } - if (r->devmode) { - _mem_save_devmode_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->devmode, 0); - { - struct ndr_pull *_ndr_devmode; - NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_devmode, 0, -1)); - NDR_CHECK(ndr_pull_spoolss_DeviceMode(_ndr_devmode, NDR_SCALARS, r->devmode)); - NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_devmode, 0, -1)); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devmode_0, 0); - } if (r->sepfile) { _mem_save_sepfile_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->sepfile, 0); @@ -7149,17 +7108,6 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo2(struct ndr_pull *ndr, NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->parameters, ndr_get_array_length(ndr, &r->parameters), sizeof(uint16_t), CH_UTF16)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_parameters_0, 0); } - if (r->secdesc) { - _mem_save_secdesc_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->secdesc, 0); - { - struct ndr_pull *_ndr_secdesc; - NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_secdesc, 0, -1)); - NDR_CHECK(ndr_pull_security_descriptor(_ndr_secdesc, NDR_SCALARS|NDR_BUFFERS, r->secdesc)); - NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_secdesc, 0, -1)); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_secdesc_0, 0); - } } return NDR_ERR_SUCCESS; } @@ -7210,12 +7158,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterInfo2(struct ndr_print *ndr, const cha ndr_print_string(ndr, "location", r->location); } ndr->depth--; - ndr_print_ptr(ndr, "devmode", r->devmode); - ndr->depth++; - if (r->devmode) { - ndr_print_spoolss_DeviceMode(ndr, "devmode", r->devmode); - } - ndr->depth--; + ndr_print_uint32(ndr, "devmode_ptr", r->devmode_ptr); ndr_print_ptr(ndr, "sepfile", r->sepfile); ndr->depth++; if (r->sepfile) { @@ -7240,12 +7183,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterInfo2(struct ndr_print *ndr, const cha ndr_print_string(ndr, "parameters", r->parameters); } ndr->depth--; - ndr_print_ptr(ndr, "secdesc", r->secdesc); - ndr->depth++; - if (r->secdesc) { - ndr_print_security_descriptor(ndr, "secdesc", r->secdesc); - } - ndr->depth--; + ndr_print_uint32(ndr, "secdesc_ptr", r->secdesc_ptr); ndr_print_spoolss_PrinterAttributes(ndr, "attributes", r->attributes); ndr_print_uint32(ndr, "priority", r->priority); ndr_print_uint32(ndr, "defaultpriority", r->defaultpriority); @@ -7588,6 +7526,70 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterInfo7(struct ndr_print *ndr, const cha ndr->depth--; } +static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo8(struct ndr_push *ndr, int ndr_flags, const struct spoolss_SetPrinterInfo8 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->devmode_ptr)); + NDR_CHECK(ndr_push_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo8(struct ndr_pull *ndr, int ndr_flags, struct spoolss_SetPrinterInfo8 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->devmode_ptr)); + NDR_CHECK(ndr_pull_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_spoolss_SetPrinterInfo8(struct ndr_print *ndr, const char *name, const struct spoolss_SetPrinterInfo8 *r) +{ + ndr_print_struct(ndr, name, "spoolss_SetPrinterInfo8"); + ndr->depth++; + ndr_print_uint32(ndr, "devmode_ptr", r->devmode_ptr); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo9(struct ndr_push *ndr, int ndr_flags, const struct spoolss_SetPrinterInfo9 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->devmode_ptr)); + NDR_CHECK(ndr_push_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo9(struct ndr_pull *ndr, int ndr_flags, struct spoolss_SetPrinterInfo9 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->devmode_ptr)); + NDR_CHECK(ndr_pull_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_spoolss_SetPrinterInfo9(struct ndr_print *ndr, const char *name, const struct spoolss_SetPrinterInfo9 *r) +{ + ndr_print_struct(ndr, name, "spoolss_SetPrinterInfo9"); + ndr->depth++; + ndr_print_uint32(ndr, "devmode_ptr", r->devmode_ptr); + ndr->depth--; +} + static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo(struct ndr_push *ndr, int ndr_flags, const union spoolss_SetPrinterInfo *r) { if (ndr_flags & NDR_SCALARS) { @@ -7693,13 +7695,13 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo(struct ndr_push *ndr, i case 8: if (r->info8) { - NDR_CHECK(ndr_push_spoolss_DeviceModeInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->info8)); + NDR_CHECK(ndr_push_spoolss_SetPrinterInfo8(ndr, NDR_SCALARS, r->info8)); } break; case 9: if (r->info9) { - NDR_CHECK(ndr_push_spoolss_DeviceModeInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->info9)); + NDR_CHECK(ndr_push_spoolss_SetPrinterInfo9(ndr, NDR_SCALARS, r->info9)); } break; @@ -7916,7 +7918,7 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo(struct ndr_pull *ndr, i if (r->info8) { _mem_save_info8_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->info8, 0); - NDR_CHECK(ndr_pull_spoolss_DeviceModeInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->info8)); + NDR_CHECK(ndr_pull_spoolss_SetPrinterInfo8(ndr, NDR_SCALARS, r->info8)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info8_0, 0); } break; @@ -7925,7 +7927,7 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo(struct ndr_pull *ndr, i if (r->info9) { _mem_save_info9_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->info9, 0); - NDR_CHECK(ndr_pull_spoolss_DeviceModeInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->info9)); + NDR_CHECK(ndr_pull_spoolss_SetPrinterInfo9(ndr, NDR_SCALARS, r->info9)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info9_0, 0); } break; @@ -8020,7 +8022,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterInfo(struct ndr_print *ndr, const char ndr_print_ptr(ndr, "info8", r->info8); ndr->depth++; if (r->info8) { - ndr_print_spoolss_DeviceModeInfo(ndr, "info8", r->info8); + ndr_print_spoolss_SetPrinterInfo8(ndr, "info8", r->info8); } ndr->depth--; break; @@ -8029,7 +8031,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterInfo(struct ndr_print *ndr, const char ndr_print_ptr(ndr, "info9", r->info9); ndr->depth++; if (r->info9) { - ndr_print_spoolss_DeviceModeInfo(ndr, "info9", r->info9); + ndr_print_spoolss_SetPrinterInfo9(ndr, "info9", r->info9); } ndr->depth--; break; diff --git a/librpc/gen_ndr/ndr_spoolss.h b/librpc/gen_ndr/ndr_spoolss.h index 66cc02e69f..ee74c78b87 100644 --- a/librpc/gen_ndr/ndr_spoolss.h +++ b/librpc/gen_ndr/ndr_spoolss.h @@ -340,6 +340,8 @@ void ndr_print_spoolss_SetPrinterInfo4(struct ndr_print *ndr, const char *name, void ndr_print_spoolss_SetPrinterInfo5(struct ndr_print *ndr, const char *name, const struct spoolss_SetPrinterInfo5 *r); void ndr_print_spoolss_SetPrinterInfo6(struct ndr_print *ndr, const char *name, const struct spoolss_SetPrinterInfo6 *r); void ndr_print_spoolss_SetPrinterInfo7(struct ndr_print *ndr, const char *name, const struct spoolss_SetPrinterInfo7 *r); +void ndr_print_spoolss_SetPrinterInfo8(struct ndr_print *ndr, const char *name, const struct spoolss_SetPrinterInfo8 *r); +void ndr_print_spoolss_SetPrinterInfo9(struct ndr_print *ndr, const char *name, const struct spoolss_SetPrinterInfo9 *r); void ndr_print_spoolss_SetPrinterInfo(struct ndr_print *ndr, const char *name, const union spoolss_SetPrinterInfo *r); void ndr_print_spoolss_SetPrinterInfoCtr(struct ndr_print *ndr, const char *name, const struct spoolss_SetPrinterInfoCtr *r); enum ndr_err_code ndr_push_spoolss_StringArray(struct ndr_push *ndr, int ndr_flags, const struct spoolss_StringArray *r); diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h index e9c433c6c4..08d1a38829 100644 --- a/librpc/gen_ndr/spoolss.h +++ b/librpc/gen_ndr/spoolss.h @@ -1144,12 +1144,12 @@ struct spoolss_SetPrinterInfo2 { const char *drivername;/* [unique,charset(UTF16)] */ const char *comment;/* [unique,charset(UTF16)] */ const char *location;/* [unique,charset(UTF16)] */ - struct spoolss_DeviceMode *devmode;/* [unique,subcontext(0)] */ + uint32_t devmode_ptr; const char *sepfile;/* [unique,charset(UTF16)] */ const char *printprocessor;/* [unique,charset(UTF16)] */ const char *datatype;/* [unique,charset(UTF16)] */ const char *parameters;/* [unique,charset(UTF16)] */ - struct security_descriptor *secdesc;/* [unique,subcontext(0)] */ + uint32_t secdesc_ptr; uint32_t attributes; uint32_t priority;/* [range(0,99)] */ uint32_t defaultpriority; @@ -1187,6 +1187,14 @@ struct spoolss_SetPrinterInfo7 { uint32_t action; }; +struct spoolss_SetPrinterInfo8 { + uint32_t devmode_ptr; +}; + +struct spoolss_SetPrinterInfo9 { + uint32_t devmode_ptr; +}; + union spoolss_SetPrinterInfo { struct spoolss_SetPrinterInfo0 *info0;/* [unique,case(0)] */ struct spoolss_SetPrinterInfo1 *info1;/* [unique,case] */ @@ -1196,8 +1204,8 @@ union spoolss_SetPrinterInfo { struct spoolss_SetPrinterInfo5 *info5;/* [unique,case(5)] */ struct spoolss_SetPrinterInfo6 *info6;/* [unique,case(6)] */ struct spoolss_SetPrinterInfo7 *info7;/* [unique,case(7)] */ - struct spoolss_DeviceModeInfo *info8;/* [unique,case(8)] */ - struct spoolss_DeviceModeInfo *info9;/* [unique,case(9)] */ + struct spoolss_SetPrinterInfo8 *info8;/* [unique,case(8)] */ + struct spoolss_SetPrinterInfo9 *info9;/* [unique,case(9)] */ }/* [switch_type(uint32)] */; struct spoolss_SetPrinterInfoCtr { diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl index 5eb6c1499c..259ffd4d7e 100644 --- a/librpc/idl/spoolss.idl +++ b/librpc/idl/spoolss.idl @@ -891,12 +891,12 @@ import "misc.idl", "security.idl", "winreg.idl"; [string,charset(UTF16)] uint16 *drivername; [string,charset(UTF16)] uint16 *comment; [string,charset(UTF16)] uint16 *location; - [subcontext(0)] spoolss_DeviceMode *devmode; + uint32 devmode_ptr; [string,charset(UTF16)] uint16 *sepfile; [string,charset(UTF16)] uint16 *printprocessor; [string,charset(UTF16)] uint16 *datatype; [string,charset(UTF16)] uint16 *parameters; - [subcontext(0)] security_descriptor *secdesc; + uint32 secdesc_ptr; spoolss_PrinterAttributes attributes; [range(0,99)] uint32 priority; uint32 defaultpriority; @@ -934,6 +934,14 @@ import "misc.idl", "security.idl", "winreg.idl"; spoolss_DsPrintAction action; } spoolss_SetPrinterInfo7; + typedef struct { + uint32 devmode_ptr; + } spoolss_SetPrinterInfo8; + + typedef struct { + uint32 devmode_ptr; + } spoolss_SetPrinterInfo9; + typedef [switch_type(uint32)] union { [case(0)] spoolss_SetPrinterInfo0 *info0; [case(1)] spoolss_SetPrinterInfo1 *info1; @@ -943,8 +951,8 @@ import "misc.idl", "security.idl", "winreg.idl"; [case(5)] spoolss_SetPrinterInfo5 *info5; [case(6)] spoolss_SetPrinterInfo6 *info6; [case(7)] spoolss_SetPrinterInfo7 *info7; - [case(8)] spoolss_DeviceModeInfo *info8; - [case(9)] spoolss_DeviceModeInfo *info9; + [case(8)] spoolss_SetPrinterInfo8 *info8; + [case(9)] spoolss_SetPrinterInfo9 *info9; [default]; } spoolss_SetPrinterInfo; -- cgit