Huw Davies : comdlg32: GetPrinterW and GetPrinterDriverW return the size in bytes so don' t multiply by sizeof(WCHAR).

Alexandre Julliard julliard at winehq.org
Wed Nov 26 07:32:22 CST 2008


Module: wine
Branch: master
Commit: 31fd0d5d7a5a44868d5807596401e8878448c0e7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=31fd0d5d7a5a44868d5807596401e8878448c0e7

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Nov 25 15:40:05 2008 +0000

comdlg32: GetPrinterW and GetPrinterDriverW return the size in bytes so don't multiply by sizeof(WCHAR).

---

 dlls/comdlg32/printdlg.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 749f8e1..bdc2a0d 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -1125,11 +1125,11 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name,
 	return FALSE;
     }
     GetPrinterW(hprn, 2, NULL, 0, &needed);
-    PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*needed);
+    PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,needed);
     GetPrinterW(hprn, 2, (LPBYTE)PrintStructures->lpPrinterInfo, needed,
 		&needed);
     GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
-    PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*needed);
+    PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,needed);
     if (!GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)PrintStructures->lpDriverInfo,
 	    needed, &needed)) {
 	ERR("GetPrinterDriverA failed for %s, fix your config!\n",debugstr_w(PrintStructures->lpPrinterInfo->pPrinterName));
@@ -2283,11 +2283,11 @@ BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
 	}
 
 	GetPrinterW(hprn, 2, NULL, 0, &needed);
-	pbuf = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*needed);
+	pbuf = HeapAlloc(GetProcessHeap(), 0, needed);
 	GetPrinterW(hprn, 2, (LPBYTE)pbuf, needed, &needed);
 
 	GetPrinterDriverW(hprn, NULL, 3, NULL, 0, &needed);
-	dbuf = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*needed);
+	dbuf = HeapAlloc(GetProcessHeap(),0,needed);
 	if (!GetPrinterDriverW(hprn, NULL, 3, (LPBYTE)dbuf, needed, &needed)) {
 	    ERR("GetPrinterDriverA failed, le %d, fix your config for printer %s!\n",
 	        GetLastError(),debugstr_w(pbuf->pPrinterName));




More information about the wine-cvs mailing list