Replace HEAP_strdupAtoW call and delete extra
RtlCreateUnicodeStringFromAsciiz.
This commit is contained in:
parent
d14ad4ff8a
commit
45abf7cfa0
@ -151,6 +151,11 @@ CUPS_LoadPrinters(void) {
|
|||||||
PRINTER_INFO_2A pinfo2a;
|
PRINTER_INFO_2A pinfo2a;
|
||||||
const char* def;
|
const char* def;
|
||||||
void *cupshandle = NULL;
|
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);
|
cupshandle = wine_dlopen(CUPS_SONAME, RTLD_NOW, NULL, 0);
|
||||||
if (!cupshandle)
|
if (!cupshandle)
|
||||||
@ -172,27 +177,22 @@ CUPS_LoadPrinters(void) {
|
|||||||
|
|
||||||
nrofdests = pcupsGetPrinters(&printers);
|
nrofdests = pcupsGetPrinters(&printers);
|
||||||
for (i=0;i<nrofdests;i++) {
|
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 */
|
/* 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) ==
|
if (RegCreateKeyA(HKEY_LOCAL_MACHINE, Printers, &hkeyPrinters) ==
|
||||||
ERROR_SUCCESS) {
|
ERROR_SUCCESS) {
|
||||||
if (RegOpenKeyW(hkeyPrinters, pNameW, &hkeyPrinter) ==
|
if (RegOpenKeyW(hkeyPrinters, pwstrNameW, &hkeyPrinter) ==
|
||||||
ERROR_SUCCESS) {
|
ERROR_SUCCESS) {
|
||||||
/* We know this printer already */
|
/* We know this printer already */
|
||||||
RegCloseKey(hkeyPrinter);
|
RegCloseKey(hkeyPrinter);
|
||||||
RegCloseKey(hkeyPrinters);
|
RegCloseKey(hkeyPrinters);
|
||||||
HeapFree(GetProcessHeap(),0,pNameW);
|
RtlFreeUnicodeString(&lpszNameW);
|
||||||
TRACE("Printer %s already known. Skipping detection\n", printers[i]);
|
TRACE("Printer %s already known. Skipping detection\n", printers[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RegCloseKey(hkeyPrinters);
|
RegCloseKey(hkeyPrinters);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(),0,pNameW);
|
RtlFreeUnicodeString(&lpszNameW);
|
||||||
|
|
||||||
/* OK, we haven't seen this one yet. Request PPD for it */
|
/* OK, we haven't seen this one yet. Request PPD for it */
|
||||||
ppd = pcupsGetPPD(printers[i]);
|
ppd = pcupsGetPPD(printers[i]);
|
||||||
@ -2194,7 +2194,6 @@ BOOL WINAPI EnumPrintersA(DWORD dwType, LPSTR lpszName,
|
|||||||
UNICODE_STRING lpszNameW;
|
UNICODE_STRING lpszNameW;
|
||||||
PWSTR pwstrNameW;
|
PWSTR pwstrNameW;
|
||||||
|
|
||||||
RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName);
|
|
||||||
pwstrNameW = asciitounicode(&lpszNameW,lpszName);
|
pwstrNameW = asciitounicode(&lpszNameW,lpszName);
|
||||||
ret = WINSPOOL_EnumPrinters(dwType, pwstrNameW, dwLevel, lpbPrinters, cbBuf,
|
ret = WINSPOOL_EnumPrinters(dwType, pwstrNameW, dwLevel, lpbPrinters, cbBuf,
|
||||||
lpdwNeeded, lpdwReturned, FALSE);
|
lpdwNeeded, lpdwReturned, FALSE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user