summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/printing/nt_printing.c2
-rw-r--r--source3/rpc_parse/parse_spoolss.c27
2 files changed, 29 insertions, 0 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index e9af659c19..26320c24fa 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -3099,6 +3099,8 @@ static WERROR save_driver_init_2(NT_PRINTER_INFO_LEVEL *printer, NT_PRINTER_PARA
goto done;
}
+ memset(nt_devmode, 0x0, sizeof(NT_DEVICEMODE));
+
ZERO_STRUCTP(nt_devmode);
/*
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index a995375cfe..1cbb97c337 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -616,6 +616,21 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
return False;
if (!prs_uint32("displayfrequency", ps, depth, &devmode->displayfrequency))
return False;
+
+ /*
+ * Conditional parsing. Assume that the DeviceMode has been
+ * zero'd by the caller.
+ */
+ switch(devmode->specversion) {
+
+ /* Used by spooler when issuing OpenPrinter() calls. NT 3.5x? */
+ case 0x0320:
+ break;
+
+ /* See the comments on the DEVMODE in the msdn GDI documentation */
+ /* (WINVER >= 0x0400) */
+ case 0x0400:
+ case 0x0401:
if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod))
return False;
if (!prs_uint32("icmintent", ps, depth, &devmode->icmintent))
@@ -628,10 +643,22 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
return False;
if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2))
return False;
+
+ /* (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400) */
+ if (devmode->specversion == 0x401) {
if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth))
return False;
if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight))
return False;
+ }
+ break;
+
+ /* log an error if we see something else */
+ default:
+ DEBUG(0,("spoolss_io_devmode: Unknown specversion [0x%x]!\n", devmode->specversion));
+ DEBUG(0,("spoolss_io_devmode: Please report to samba-technical@samba.org\n"));
+ break;
+ }
if (devmode->driverextra!=0) {
if (UNMARSHALLING(ps)) {