From f9da274b53197968417843340d586931728cf3a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Wed, 16 Dec 2009 10:32:35 +0100 Subject: [PATCH] spoolss: more mork on SetPrinterInfo() levels. Guenther (cherry picked from commit be95cb6f8357334af08d1502910a429328b85bc5) --- librpc/gen_ndr/ndr_spoolss.c | 146 +++++++++++++++++++++---------------------- librpc/gen_ndr/ndr_spoolss.h | 2 + librpc/gen_ndr/spoolss.h | 16 +++-- librpc/idl/spoolss.idl | 16 +++-- 4 files changed, 98 insertions(+), 82 deletions(-) diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c index 59d987f3526..ef3fd3d0e97 100644 --- a/librpc/gen_ndr/ndr_spoolss.c +++ b/librpc/gen_ndr/ndr_spoolss.c @@ -6146,12 +6146,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)); @@ -6204,14 +6204,6 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo2(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint32(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_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->sepfile, CH_UTF16))); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); @@ -6236,14 +6228,6 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo2(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint32(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; } @@ -6264,8 +6248,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; @@ -6274,8 +6256,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, 4)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_servername)); @@ -6320,12 +6300,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); @@ -6350,12 +6325,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) { @@ -6453,17 +6423,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); @@ -6512,17 +6471,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; } @@ -6573,12 +6521,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) { @@ -6603,12 +6546,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); @@ -6941,6 +6879,66 @@ _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)); + } + 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)); + } + 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)); + } + 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)); + } + 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) { @@ -7045,13 +7043,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; @@ -7267,7 +7265,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; @@ -7276,7 +7274,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; @@ -7371,7 +7369,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; @@ -7380,7 +7378,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 288ef3c776c..fcbec8ea9ba 100644 --- a/librpc/gen_ndr/ndr_spoolss.h +++ b/librpc/gen_ndr/ndr_spoolss.h @@ -302,6 +302,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 04bdbcc0711..4dbdccc918a 100644 --- a/librpc/gen_ndr/spoolss.h +++ b/librpc/gen_ndr/spoolss.h @@ -658,12 +658,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; @@ -701,6 +701,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] */ @@ -710,8 +718,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 ee3a891a647..accf96a2216 100644 --- a/librpc/idl/spoolss.idl +++ b/librpc/idl/spoolss.idl @@ -700,12 +700,12 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") [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; @@ -743,6 +743,14 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") 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; @@ -752,8 +760,8 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") [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; -- 2.11.4.GIT