GetPrinterDriverDirectoryA: do not crash on null pointers.

This commit is contained in:
Stefan Leichter 2003-01-08 19:52:25 +00:00 committed by Alexandre Julliard
parent 242e395bbc
commit 7a78ca04ed
1 changed files with 4 additions and 3 deletions

View File

@ -2507,10 +2507,11 @@ BOOL WINAPI GetPrinterDriverDirectoryA(LPSTR pName, LPSTR pEnvironment,
if (ret) {
ret = WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1,
pDriverDirectory, cbBuf, NULL, NULL);
*pcbNeeded = WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1,
NULL, 0, NULL, NULL);
if(pcbNeeded)
*pcbNeeded = WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1,
NULL, 0, NULL, NULL);
} else
*pcbNeeded = pcbNeededW * sizeof(CHAR)/sizeof(WCHAR);
if(pcbNeeded) *pcbNeeded = pcbNeededW * sizeof(CHAR)/sizeof(WCHAR);
TRACE("provided<%ld> required <%ld>\n", cbBuf, *pcbNeeded);