From 8780853ab739e843372142784abaadf25e92ca53 Mon Sep 17 00:00:00 2001 From: Stefan Leichter Date: Wed, 15 Jan 2003 00:51:16 +0000 Subject: [PATCH] Make GetPrinterDriverDirectoryA pass all tests. --- dlls/winspool/info.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/winspool/info.c b/dlls/winspool/info.c index 646cabc7938..1c33bee518a 100644 --- a/dlls/winspool/info.c +++ b/dlls/winspool/info.c @@ -2505,11 +2505,12 @@ BOOL WINAPI GetPrinterDriverDirectoryA(LPSTR pName, LPSTR pEnvironment, ret = GetPrinterDriverDirectoryW( nameW.Buffer, environmentW.Buffer, Level, (LPBYTE)driverDirectoryW, len, &pcbNeededW ); if (ret) { - ret = WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1, + DWORD needed; + needed = 1 + WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1, pDriverDirectory, cbBuf, NULL, NULL); if(pcbNeeded) - *pcbNeeded = WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1, - NULL, 0, NULL, NULL); + *pcbNeeded = needed; + ret = (needed <= cbBuf) ? TRUE : FALSE; } else if(pcbNeeded) *pcbNeeded = pcbNeededW * sizeof(CHAR)/sizeof(WCHAR); -- 2.11.4.GIT