Made WINSPOOL_GetPrinterDriver work again.

This commit is contained in:
Stefan Leichter 2000-11-12 03:39:53 +00:00 committed by Alexandre Julliard
parent abe635cfd7
commit a2053ab1c5
1 changed files with 14 additions and 11 deletions

View File

@ -1713,7 +1713,7 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
DWORD cbBuf, /* size of string buffer */ DWORD cbBuf, /* size of string buffer */
LPDWORD pcbNeeded, /* space needed for str. */ LPDWORD pcbNeeded, /* space needed for str. */
BOOL unicode) /* type of strings */ BOOL unicode) /* type of strings */
{ DWORD dw, size, type; { DWORD dw, size, tmp, type;
HKEY hkeyDriver; HKEY hkeyDriver;
LPBYTE strPtr = pDriverStrings; LPBYTE strPtr = pDriverStrings;
@ -1778,7 +1778,7 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
unicode)) { unicode)) {
*pcbNeeded += size; *pcbNeeded += size;
if(*pcbNeeded <= cbBuf) if(*pcbNeeded <= cbBuf)
WINSPOOL_GetStringFromReg(hkeyDriver, DriverW, strPtr, cbBuf, &size, WINSPOOL_GetStringFromReg(hkeyDriver, DriverW, strPtr, size, &tmp,
unicode); unicode);
if(ptr) if(ptr)
((PDRIVER_INFO_3W) ptr)->pDriverPath = (LPWSTR)strPtr; ((PDRIVER_INFO_3W) ptr)->pDriverPath = (LPWSTR)strPtr;
@ -1789,19 +1789,19 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
unicode)) { unicode)) {
*pcbNeeded += size; *pcbNeeded += size;
if(*pcbNeeded <= cbBuf) if(*pcbNeeded <= cbBuf)
WINSPOOL_GetStringFromReg(hkeyDriver, Data_FileW, strPtr, cbBuf, WINSPOOL_GetStringFromReg(hkeyDriver, Data_FileW, strPtr, size,
&size, unicode); &tmp, unicode);
if(ptr) if(ptr)
((PDRIVER_INFO_3W) ptr)->pDataFile = (LPWSTR)strPtr; ((PDRIVER_INFO_3W) ptr)->pDataFile = (LPWSTR)strPtr;
strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL; strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL;
} }
if(WINSPOOL_GetStringFromReg(hkeyDriver, Configuration_FileW, strPtr, if(WINSPOOL_GetStringFromReg(hkeyDriver, Configuration_FileW, strPtr,
cbBuf, &size, unicode)) { 0, &size, unicode)) {
*pcbNeeded += size; *pcbNeeded += size;
if(*pcbNeeded <= cbBuf) if(*pcbNeeded <= cbBuf)
WINSPOOL_GetStringFromReg(hkeyDriver, Configuration_FileW, strPtr, WINSPOOL_GetStringFromReg(hkeyDriver, Configuration_FileW, strPtr,
cbBuf, &size, unicode); size, &tmp, unicode);
if(ptr) if(ptr)
((PDRIVER_INFO_3W) ptr)->pConfigFile = (LPWSTR)strPtr; ((PDRIVER_INFO_3W) ptr)->pConfigFile = (LPWSTR)strPtr;
strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL; strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL;
@ -1809,6 +1809,7 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
if(Level == 2 ) { if(Level == 2 ) {
RegCloseKey(hkeyDriver); RegCloseKey(hkeyDriver);
TRACE("buffer space %ld required %ld\n", cbBuf, *pcbNeeded);
return TRUE; return TRUE;
} }
@ -1817,7 +1818,7 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
*pcbNeeded += size; *pcbNeeded += size;
if(*pcbNeeded <= cbBuf) if(*pcbNeeded <= cbBuf)
WINSPOOL_GetStringFromReg(hkeyDriver, Help_FileW, strPtr, WINSPOOL_GetStringFromReg(hkeyDriver, Help_FileW, strPtr,
cbBuf, &size, unicode); size, &tmp, unicode);
if(ptr) if(ptr)
((PDRIVER_INFO_3W) ptr)->pHelpFile = (LPWSTR)strPtr; ((PDRIVER_INFO_3W) ptr)->pHelpFile = (LPWSTR)strPtr;
strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL; strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL;
@ -1828,7 +1829,7 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
*pcbNeeded += size; *pcbNeeded += size;
if(*pcbNeeded <= cbBuf) if(*pcbNeeded <= cbBuf)
WINSPOOL_GetStringFromReg(hkeyDriver, Dependent_FilesW, strPtr, WINSPOOL_GetStringFromReg(hkeyDriver, Dependent_FilesW, strPtr,
cbBuf, &size, unicode); size, &tmp, unicode);
if(ptr) if(ptr)
((PDRIVER_INFO_3W) ptr)->pDependentFiles = (LPWSTR)strPtr; ((PDRIVER_INFO_3W) ptr)->pDependentFiles = (LPWSTR)strPtr;
strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL; strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL;
@ -1839,7 +1840,7 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
*pcbNeeded += size; *pcbNeeded += size;
if(*pcbNeeded <= cbBuf) if(*pcbNeeded <= cbBuf)
WINSPOOL_GetStringFromReg(hkeyDriver, MonitorW, strPtr, WINSPOOL_GetStringFromReg(hkeyDriver, MonitorW, strPtr,
cbBuf, &size, unicode); size, &tmp, unicode);
if(ptr) if(ptr)
((PDRIVER_INFO_3W) ptr)->pMonitorName = (LPWSTR)strPtr; ((PDRIVER_INFO_3W) ptr)->pMonitorName = (LPWSTR)strPtr;
strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL; strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL;
@ -1850,12 +1851,13 @@ static BOOL WINSPOOL_GetDriverInfoFromReg(
*pcbNeeded += size; *pcbNeeded += size;
if(*pcbNeeded <= cbBuf) if(*pcbNeeded <= cbBuf)
WINSPOOL_GetStringFromReg(hkeyDriver, MonitorW, strPtr, WINSPOOL_GetStringFromReg(hkeyDriver, MonitorW, strPtr,
cbBuf, &size, unicode); size, &tmp, unicode);
if(ptr) if(ptr)
((PDRIVER_INFO_3W) ptr)->pDefaultDataType = (LPWSTR)strPtr; ((PDRIVER_INFO_3W) ptr)->pDefaultDataType = (LPWSTR)strPtr;
strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL; strPtr = (pDriverStrings) ? pDriverStrings + (*pcbNeeded) : NULL;
} }
TRACE("buffer space %ld required %ld\n", cbBuf, *pcbNeeded);
RegCloseKey(hkeyDriver); RegCloseKey(hkeyDriver);
return TRUE; return TRUE;
} }
@ -1947,7 +1949,8 @@ static BOOL WINSPOOL_GetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment,
RegCloseKey(hkeyDrivers); RegCloseKey(hkeyDrivers);
if(pcbNeeded) *pcbNeeded = needed; if(pcbNeeded) *pcbNeeded = size + needed;
TRACE("buffer space %ld required %ld\n", cbBuf, *pcbNeeded);
if(cbBuf >= needed) return TRUE; if(cbBuf >= needed) return TRUE;
SetLastError(ERROR_INSUFFICIENT_BUFFER); SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE; return FALSE;