From 9f8c28cf3dc9dc4af27db02e3a4216593c22fbf3 Mon Sep 17 00:00:00 2001 From: Aurimas Fischer Date: Sat, 7 Feb 2009 16:00:40 +0200 Subject: winspool.drv: use AddPrinterW instead of AddPrinterA --- dlls/winspool.drv/info.c | 91 ++++++++++++++++++++++++---------------------- 1 files changed, 48 insertions(+), 43 deletions(-) diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index df6bf91..ca33168 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -470,7 +470,8 @@ static BOOL CUPS_LoadPrinters(void) int i, nrofdests; BOOL hadprinter = FALSE, haddefault = FALSE; cups_dest_t *dests; - PRINTER_INFO_2A pinfo2a; + PRINTER_INFO_2W pinfo2w; + UNICODE_STRING usBuffer; char *port,*devline; HKEY hkeyPrinter, hkeyPrinters, hkey; char loaderror[256]; @@ -529,31 +530,33 @@ static BOOL CUPS_LoadPrinters(void) RegDeleteValueW(hkeyPrinter, May_Delete_Value); RegCloseKey(hkeyPrinter); } else { - static CHAR data_type[] = "RAW", - print_proc[] = "WinPrint", - comment[] = "WINEPS Printer using CUPS", - location[] = "", - params[] = "", - share_name[] = "", - sep_file[] = ""; + static WCHAR data_type[] = {'R','A','W',0}, + print_proc[] = {'W','i','n','P','r','i','n','t',0}, + comment[] = {'W','I','N','E','P','S',' ','P','r','i','n','t','e','r',' ','u','s','i', + 'n','g',' ','C','U','P','S',0}, + location[] = {'<','p','h','y','s','i','c','a','l',' ','l','o','c','a','t','i','o','n', + ' ','o','f',' ','p','r','i','n','t','e','r','>',0}, + params[] = {'<','p','a','r','a','m','e','t','e','r','s','?','>',0}, + share_name[] = {'<','s','h','a','r','e',' ','n','a','m','e','?','>',0}, + sep_file[] = {'<','s','e','p',' ','f','i','l','e','?','>',0}; add_printer_driver(dests[i].name); - memset(&pinfo2a,0,sizeof(pinfo2a)); - pinfo2a.pPrinterName = dests[i].name; - pinfo2a.pDatatype = data_type; - pinfo2a.pPrintProcessor = print_proc; - pinfo2a.pDriverName = dests[i].name; - pinfo2a.pComment = comment; - pinfo2a.pLocation = location; - pinfo2a.pPortName = port; - pinfo2a.pParameters = params; - pinfo2a.pShareName = share_name; - pinfo2a.pSepFile = sep_file; - - if (!AddPrinterA(NULL,2,(LPBYTE)&pinfo2a)) { + memset(&pinfo2w,0,sizeof(pinfo2w)); + pinfo2w.pPrinterName = asciitounicode(&usBuffer,dests[i].name); + pinfo2w.pDatatype = data_type; + pinfo2w.pPrintProcessor = print_proc; + pinfo2w.pDriverName = asciitounicode(&usBuffer,dests[i].name); + pinfo2w.pComment = comment; + pinfo2w.pLocation = location; + pinfo2w.pPortName = asciitounicode(&usBuffer,port); + pinfo2w.pParameters = params; + pinfo2w.pShareName = share_name; + pinfo2w.pSepFile = sep_file; + + if (!AddPrinterW(NULL,2,(LPBYTE)&pinfo2w)) { if (GetLastError() != ERROR_PRINTER_ALREADY_EXISTS) - ERR("printer '%s' not added by AddPrinterA (error %d)\n",dests[i].name,GetLastError()); + ERR("printer '%s' not added by AddPrinterW (error %d)\n",dests[i].name,GetLastError()); } } HeapFree(GetProcessHeap(),0,port); @@ -573,7 +576,8 @@ static BOOL CUPS_LoadPrinters(void) static BOOL PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) { - PRINTER_INFO_2A pinfo2a; + PRINTER_INFO_2W pinfo2w; + UNICODE_STRING usBuffer; char *e,*s,*name,*prettyname,*devname; BOOL ret = FALSE, set_default = FALSE; char *port = NULL, *devline,*env_default; @@ -666,30 +670,31 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) { RegDeleteValueW(hkeyPrinter, May_Delete_Value); RegCloseKey(hkeyPrinter); } else { - static CHAR data_type[] = "RAW", - print_proc[] = "WinPrint", - comment[] = "WINEPS Printer using LPR", - params[] = "", - share_name[] = "", - sep_file[] = ""; + static WCHAR data_type[] = {'R','A','W',0}, + print_proc[] = {'W','i','n','P','r','i','n','t',0}, + comment[] = {'W','I','N','E','P','S',' ','P','r','i','n','t','e','r',' ','u','s','i', + 'n','g',' ','L','P','R',0}, + params[] = {'<','p','a','r','a','m','e','t','e','r','s','?','>',0}, + share_name[] = {'<','s','h','a','r','e',' ','n','a','m','e','?','>',0}, + sep_file[] = {'<','s','e','p',' ','f','i','l','e','?','>',0}; add_printer_driver(devname); - memset(&pinfo2a,0,sizeof(pinfo2a)); - pinfo2a.pPrinterName = devname; - pinfo2a.pDatatype = data_type; - pinfo2a.pPrintProcessor = print_proc; - pinfo2a.pDriverName = devname; - pinfo2a.pComment = comment; - pinfo2a.pLocation = prettyname; - pinfo2a.pPortName = port; - pinfo2a.pParameters = params; - pinfo2a.pShareName = share_name; - pinfo2a.pSepFile = sep_file; - - if (!AddPrinterA(NULL,2,(LPBYTE)&pinfo2a)) { + memset(&pinfo2w,0,sizeof(pinfo2w)); + pinfo2w.pPrinterName = asciitounicode(&usBuffer,devname); + pinfo2w.pDatatype = data_type; + pinfo2w.pPrintProcessor = print_proc; + pinfo2w.pDriverName = asciitounicode(&usBuffer,devname); + pinfo2w.pComment = comment; + pinfo2w.pLocation = asciitounicode(&usBuffer,prettyname); + pinfo2w.pPortName = asciitounicode(&usBuffer,port); + pinfo2w.pParameters = params; + pinfo2w.pShareName = share_name; + pinfo2w.pSepFile = sep_file; + + if (!AddPrinterW(NULL,2,(LPBYTE)&pinfo2w)) { if (GetLastError()!=ERROR_PRINTER_ALREADY_EXISTS) - ERR("%s not added by AddPrinterA (%d)\n",name,GetLastError()); + ERR("%s not added by AddPrinterW (%d)\n",name,GetLastError()); } } RegCloseKey(hkeyPrinters); -- 1.6.0.4