From ad267718ddaec0b1fc1588f180f11500c7f31d69 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 4 Jun 2000 02:29:00 +0000 Subject: fixed the pack/unpack of the devicemode we were being bitten by uint16/uint32 mixups (This used to be commit 1d37f76953534f7bf9d8890dda30c7e00cbb024c) --- source3/include/nt_printing.h | 6 +- source3/printing/nt_printing.c | 132 +++++++++++++++++++++++++---------------- 2 files changed, 86 insertions(+), 52 deletions(-) diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h index 3aad3beff9..9282367885 100644 --- a/source3/include/nt_printing.h +++ b/source3/include/nt_printing.h @@ -186,11 +186,12 @@ typedef struct nt_printer_param typedef struct ntdevicemode { fstring devicename; + fstring formname; + uint16 specversion; uint16 driverversion; uint16 size; uint16 driverextra; - uint32 fields; uint16 orientation; uint16 papersize; uint16 paperlength; @@ -204,8 +205,9 @@ typedef struct ntdevicemode uint16 yresolution; uint16 ttoption; uint16 collate; - fstring formname; uint16 logpixels; + + uint32 fields; uint32 bitsperpel; uint32 pelswidth; uint32 pelsheight; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 98259d40ae..fb3afde303 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -491,31 +491,44 @@ static int pack_devicemode(NT_DEVICEMODE *nt_devmode, char *buf, int buflen) if (!nt_devmode) return len; - len += tdb_pack(buf+len, buflen-len, "fddddddddddddddddddddddp", - nt_devmode->formname, - nt_devmode->specversion, - nt_devmode->driverversion, - nt_devmode->size, - nt_devmode->driverextra, - nt_devmode->fields, - nt_devmode->orientation, - nt_devmode->papersize, - nt_devmode->paperlength, - nt_devmode->paperwidth, - nt_devmode->scale, - nt_devmode->copies, - nt_devmode->defaultsource, - nt_devmode->printquality, - nt_devmode->color, - nt_devmode->duplex, - nt_devmode->yresolution, - nt_devmode->ttoption, - nt_devmode->collate, - nt_devmode->icmmethod, - nt_devmode->icmintent, - nt_devmode->mediatype, - nt_devmode->dithertype, - nt_devmode->private); + len += tdb_pack(buf+len, buflen-len, "fwwwwwwwwwwwwwwwwwwddddddddddddddp", + nt_devmode->formname, + + nt_devmode->specversion, + nt_devmode->driverversion, + nt_devmode->size, + nt_devmode->driverextra, + nt_devmode->orientation, + nt_devmode->papersize, + nt_devmode->paperlength, + nt_devmode->paperwidth, + nt_devmode->scale, + nt_devmode->copies, + nt_devmode->defaultsource, + nt_devmode->printquality, + nt_devmode->color, + nt_devmode->duplex, + nt_devmode->yresolution, + nt_devmode->ttoption, + nt_devmode->collate, + nt_devmode->logpixels, + + nt_devmode->fields, + nt_devmode->bitsperpel, + nt_devmode->pelswidth, + nt_devmode->pelsheight, + nt_devmode->displayflags, + nt_devmode->displayfrequency, + nt_devmode->icmmethod, + nt_devmode->icmintent, + nt_devmode->mediatype, + nt_devmode->dithertype, + nt_devmode->reserved1, + nt_devmode->reserved2, + nt_devmode->panningwidth, + nt_devmode->panningheight, + nt_devmode->private); + if (nt_devmode->private) { len += tdb_pack(buf+len, buflen-len, "B", @@ -523,6 +536,8 @@ static int pack_devicemode(NT_DEVICEMODE *nt_devmode, char *buf, int buflen) nt_devmode->private); } + DEBUG(8,("Packed devicemode [%s]\n", nt_devmode->formname)); + return len; } @@ -652,6 +667,9 @@ static uint32 add_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info) safe_free(buf); + DEBUG(8,("packed printer [%s] with form [%s] len=%d\n", + info->portname, info->devmode->formname, len)); + return ret; } @@ -893,31 +911,43 @@ static int unpack_devicemode(NT_DEVICEMODE **nt_devmode, char *buf, int buflen) if (!*nt_devmode) return len; - len += tdb_unpack(buf+len, buflen-len, "fddddddddddddddddddddddp", - devmode.formname, - &devmode.specversion, - &devmode.driverversion, - &devmode.size, - &devmode.driverextra, - &devmode.fields, - &devmode.orientation, - &devmode.papersize, - &devmode.paperlength, - &devmode.paperwidth, - &devmode.scale, - &devmode.copies, - &devmode.defaultsource, - &devmode.printquality, - &devmode.color, - &devmode.duplex, - &devmode.yresolution, - &devmode.ttoption, - &devmode.collate, - &devmode.icmmethod, - &devmode.icmintent, - &devmode.mediatype, - &devmode.dithertype, - &devmode.private); + len += tdb_unpack(buf+len, buflen-len, "fwwwwwwwwwwwwwwwwwwddddddddddddddp", + devmode.formname, + + &devmode.specversion, + &devmode.driverversion, + &devmode.size, + &devmode.driverextra, + &devmode.orientation, + &devmode.papersize, + &devmode.paperlength, + &devmode.paperwidth, + &devmode.scale, + &devmode.copies, + &devmode.defaultsource, + &devmode.printquality, + &devmode.color, + &devmode.duplex, + &devmode.yresolution, + &devmode.ttoption, + &devmode.collate, + &devmode.logpixels, + + &devmode.fields, + &devmode.bitsperpel, + &devmode.pelswidth, + &devmode.pelsheight, + &devmode.displayflags, + &devmode.displayfrequency, + &devmode.icmmethod, + &devmode.icmintent, + &devmode.mediatype, + &devmode.dithertype, + &devmode.reserved1, + &devmode.reserved2, + &devmode.panningwidth, + &devmode.panningheight, + &devmode.private); if (devmode.private) { devmode.private = (uint8 *)malloc(devmode.driverextra); @@ -929,6 +959,8 @@ static int unpack_devicemode(NT_DEVICEMODE **nt_devmode, char *buf, int buflen) *nt_devmode = (NT_DEVICEMODE *)memdup(&devmode, sizeof(devmode)); + DEBUG(8,("Unpacked devicemode [%s]\n", devmode.formname)); + return len; } -- cgit