Wine Postscript driver not finding printers
David D. Hagood
wowbagger at sktc.net
Sat Feb 8 13:41:58 CST 2003
The attached patch fixes a bug in the Wine Postscript driver that keeps
it from finding printers in an LPRng type environment. The problem was
that AddPrinterW will not work if the printer name is not NULL, but
AddPrinterA calls AddPrinterA, which ALWAYS passes a name pointer into
AddPrinterW (thus AddPrinterA will NEVER work).
The attached patch changes AddPrinterA to pass a NULL down to
AddPrinterW if the name passed to AddPrinterA is NULL.
Additionally, I found that I must create the printer driver entry under
System\\CurrentControlSet\\Control\\Print\\Environments\\Drivers\\PS
Driver, as for some reason the system is not filling in the operating
system name. I have my windows version set as follows:
[Version]
; Windows version to imitate
(win95,win98,winme,nt351,nt40,win2k,winxp,win20,win30,win31)" },
"Windows" = "win2k"
;"Windows" = "win98"
; DOS version to imitate
;"DOS" = "6.22"
So perhaps there is a bug in that section of the logic too. I cheated
and just copied the driver entry from ..\\Print\\Environments\\Windows
4.0\\Drivers\\PS Driver to ..\\Print\\Environments\\Drivers\\PS Driver
and that seems to have fixed it.
-------------- next part --------------
? New Folder
? log
? debugger/Makefile
? debugger/lex.yy.c
? debugger/winedbg.exe.dbg.c
? debugger/winedbg.exe.spec.c
? debugger/y.tab.c
? debugger/y.tab.h
? dlls/msrle32/Makefile
? dlls/msrle32/msrle32.dll.dbg.c
? dlls/msrle32/msrle32.spec.c
? graphics/win16drv/prtdrv.glue.c
? if1632/relay16.s
? programs/winetest/Makefile
? tools/mingwrap
? tools/winelauncher
? tools/wrc/lex.ppl.c
? tools/wrc/ppy.tab.c
? tools/wrc/ppy.tab.h
? tsx11/Makefile
? tsx11/libwine_tsx11.so.1.0
? windows/x11drv/wineclipsrv
Index: dlls/winspool/info.c
===================================================================
RCS file: /home/wine/wine/dlls/winspool/info.c,v
retrieving revision 1.70
diff -u -r1.70 info.c
--- dlls/winspool/info.c 23 Jan 2003 23:07:39 -0000 1.70
+++ dlls/winspool/info.c 8 Feb 2003 19:35:00 -0000
@@ -1182,7 +1182,6 @@
*/
HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter)
{
- UNICODE_STRING pNameW;
PRINTER_INFO_2W *piW;
PRINTER_INFO_2A *piA = (PRINTER_INFO_2A*)pPrinter;
HANDLE ret;
@@ -1193,13 +1192,18 @@
SetLastError(ERROR_INVALID_LEVEL);
return 0;
}
- RtlCreateUnicodeStringFromAsciiz(&pNameW,pName);
piW = PRINTER_INFO_2AtoW(GetProcessHeap(), piA);
+ if (pName) {
+ UNICODE_STRING pNameW;
+ RtlCreateUnicodeStringFromAsciiz(&pNameW,pName);
- ret = AddPrinterW(pNameW.Buffer, Level, (LPBYTE)piW);
+ ret = AddPrinterW(pNameW.Buffer, Level, (LPBYTE)piW);
+ RtlFreeUnicodeString(&pNameW);
+ }
+ else
+ ret = AddPrinterW(NULL, Level, (LPBYTE)piW);
FREE_PRINTER_INFO_2W(GetProcessHeap(), piW);
- RtlFreeUnicodeString(&pNameW);
return ret;
}
More information about the wine-patches
mailing list