Another winspool HEAP_strdupAtoW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It looks like the recent commit to CVS:
http://cvs.winehq.com/patch.py?id=7225
combined these two patches:
http://www.winehq.com/hypermail/wine-patches/2003/02/0061.html
by Duane Clark
http://www.winehq.com/hypermail/wine-patches/2003/02/0071.html
by Stefan Becker

The first match had a mistake (an extra RtlCreateUnicodeStringFromAsciiz was left in) and the later patch reintroduced a HEAP_strdupAtoW call. So this patch takes care of those two items.

Printing now works fine (for me), though I just noticed a fixme that did not previously appear.
fixme:commdlg:PRINTDLG_SetUpPrinterListComboA Can't find '(null)' in printer list so trying to find default


Changelog:
Replace HEAP_strdupAtoW call and delete extra RtlCreateUnicodeStringFromAsciiz.

Index: dlls/winspool/info.c
===================================================================
RCS file: /home/wine/wine/dlls/winspool/info.c,v
retrieving revision 1.71
diff -u -r1.71 info.c
--- dlls/winspool/info.c	12 Feb 2003 01:19:25 -0000	1.71
+++ dlls/winspool/info.c	12 Feb 2003 04:46:31 -0000
@@ -151,6 +151,11 @@
     PRINTER_INFO_2A	pinfo2a;
     const char*		def;
     void *cupshandle = NULL;
+    const  char *ppd;
+    char   *port,*devline;
+    UNICODE_STRING  lpszNameW;
+    PWSTR pwstrNameW;
+    HKEY hkeyPrinters, hkeyPrinter;
 
     cupshandle = wine_dlopen(CUPS_SONAME, RTLD_NOW, NULL, 0);
     if (!cupshandle) 
@@ -172,27 +177,22 @@
 
     nrofdests = pcupsGetPrinters(&printers);
     for (i=0;i<nrofdests;i++) {
-	const char *ppd;
-	char	*port,*devline;
-        WCHAR   *pNameW;
-        HKEY     hkeyPrinters, hkeyPrinter;
-
         /* First check that the printer doesn't exist already */
-        pNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, printers[i]);
+        pwstrNameW = asciitounicode(&lpszNameW, printers[i]);
         if (RegCreateKeyA(HKEY_LOCAL_MACHINE, Printers, &hkeyPrinters) ==
             ERROR_SUCCESS) {
-             if (RegOpenKeyW(hkeyPrinters, pNameW, &hkeyPrinter) ==
+             if (RegOpenKeyW(hkeyPrinters, pwstrNameW, &hkeyPrinter) ==
                  ERROR_SUCCESS) {
                   /* We know this printer already */
                   RegCloseKey(hkeyPrinter);
                   RegCloseKey(hkeyPrinters);
-                  HeapFree(GetProcessHeap(),0,pNameW);
+                  RtlFreeUnicodeString(&lpszNameW);
                   TRACE("Printer %s already known. Skipping detection\n", printers[i]);
                   continue;
              }
              RegCloseKey(hkeyPrinters);
         }
-        HeapFree(GetProcessHeap(),0,pNameW);
+        RtlFreeUnicodeString(&lpszNameW);
 
         /* OK, we haven't seen this one yet. Request PPD for it */
 	ppd = pcupsGetPPD(printers[i]);
@@ -2194,7 +2194,6 @@
     UNICODE_STRING lpszNameW;
     PWSTR pwstrNameW;
     
-    RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName);
     pwstrNameW = asciitounicode(&lpszNameW,lpszName);
     ret = WINSPOOL_EnumPrinters(dwType, pwstrNameW, dwLevel, lpbPrinters, cbBuf,
 				lpdwNeeded, lpdwReturned, FALSE);

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux