Detlef Riekenberg : winspool: Implement Level 9 for GetPrinter.
Alexandre Julliard
julliard at winehq.org
Fri Feb 29 06:17:11 CST 2008
Module: wine
Branch: master
Commit: 81dadcb1a1435894dbffb604a61012c3db08b08e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=81dadcb1a1435894dbffb604a61012c3db08b08e
Author: Detlef Riekenberg <wine.dev at web.de>
Date: Thu Feb 28 21:46:17 2008 +0100
winspool: Implement Level 9 for GetPrinter.
---
dlls/winspool.drv/info.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index af02b9e..7622582 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -4032,6 +4032,43 @@ static BOOL WINSPOOL_GetPrinter_7(HKEY hkeyPrinter, PRINTER_INFO_7W *pi7, LPBYTE
return space;
}
+/*********************************************************************
+ * WINSPOOL_GetPrinter_9
+ *
+ * Fills out a PRINTER_INFO_9A|W struct storing the strings in buf.
+ * The strings are either stored as unicode or ascii.
+ */
+static BOOL WINSPOOL_GetPrinter_9(HKEY hkeyPrinter, PRINTER_INFO_9W *pi9, LPBYTE buf,
+ DWORD cbBuf, LPDWORD pcbNeeded, BOOL unicode)
+{
+ DWORD size;
+ BOOL space = (cbBuf > 0);
+
+ *pcbNeeded = 0;
+
+ if(WINSPOOL_GetDevModeFromReg(hkeyPrinter, Default_DevModeW, buf, cbBuf, &size, unicode)) {
+ if(space && size <= cbBuf) {
+ pi9->pDevMode = (LPDEVMODEW)buf;
+ } else
+ space = FALSE;
+ *pcbNeeded += size;
+ }
+ else
+ {
+ WINSPOOL_GetDefaultDevMode(buf, cbBuf, &size, unicode);
+ if(space && size <= cbBuf) {
+ pi9->pDevMode = (LPDEVMODEW)buf;
+ } else
+ space = FALSE;
+ *pcbNeeded += size;
+ }
+
+ if(!space && pi9) /* zero out pi9 if we can't completely fill buf */
+ memset(pi9, 0, sizeof(*pi9));
+
+ return space;
+}
+
/*****************************************************************************
* WINSPOOL_GetPrinter
*
@@ -4166,6 +4203,26 @@ static BOOL WINSPOOL_GetPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
}
+ case 9:
+ {
+ PRINTER_INFO_9W *pi9 = (PRINTER_INFO_9W *)pPrinter;
+
+ size = sizeof(PRINTER_INFO_9W);
+ if(size <= cbBuf) {
+ ptr = pPrinter + size;
+ cbBuf -= size;
+ memset(pPrinter, 0, size);
+ } else {
+ pi9 = NULL;
+ cbBuf = 0;
+ }
+
+ ret = WINSPOOL_GetPrinter_9(hkeyPrinter, pi9, ptr, cbBuf, &needed, unicode);
+ needed += size;
+ break;
+ }
+
+
default:
FIXME("Unimplemented level %d\n", Level);
SetLastError(ERROR_INVALID_LEVEL);
More information about the wine-cvs
mailing list