Let through more flags to EnumPrinters.

Fixes for GetPrinter/GetPrinterDriver.
This commit is contained in:
Huw D M Davies 1999-07-24 10:12:41 +00:00 committed by Alexandre Julliard
parent 91547cbf6a
commit 284d63ca72
1 changed files with 33 additions and 31 deletions

View File

@ -237,7 +237,7 @@ DWORD ENUMPRINTERS_GetDWORDFromRegistryA(
if (RegQueryValueExA(hPrinterSettings, KeyName, NULL, &DataType,
Data, &DataSize)!=ERROR_SUCCESS)
FIXME("Query of register didn't succeed?\n");
FIXME("Query of register '%s' didn't succeed?\n", KeyName);
if (DataType == REG_DWORD_LITTLE_ENDIAN)
Result = Data[0] + (Data[1]<<8) + (Data[2]<<16) + (Data[3]<<24);
if (DataType == REG_DWORD_BIG_ENDIAN)
@ -597,7 +597,8 @@ BOOL WINAPI EnumPrintersA(
DWORD dwType, /* Types of print objects to enumerate */
LPSTR lpszName, /* name of objects to enumerate */
DWORD dwLevel, /* type of printer info structure */
LPBYTE lpbPrinters,/* buffer which receives info*/ DWORD cbBuf, /* max size of buffer in bytes */
LPBYTE lpbPrinters, /* buffer which receives info */
DWORD cbBuf, /* max size of buffer in bytes */
LPDWORD lpdwNeeded, /* pointer to var: # bytes used/needed */
LPDWORD lpdwReturned /* number of entries returned */
)
@ -629,8 +630,9 @@ BOOL WINAPI EnumPrintersA(
*lpdwNeeded = 0;
/* check for valid Flags */
if (dwType != PRINTER_ENUM_LOCAL && dwType != PRINTER_ENUM_NAME)
if (!((dwType & PRINTER_ENUM_LOCAL) || (dwType & PRINTER_ENUM_NAME)))
{
FIXME("dwType = %08lx\n", dwType);
SetLastError(ERROR_INVALID_FLAGS);
return(0);
}
@ -712,7 +714,7 @@ BOOL WINAPI EnumPrintersA(
/* check whether this printer is allowed in the list
* by comparing name to lpszName
*/
if (dwType == PRINTER_ENUM_NAME)
if (dwType & PRINTER_ENUM_NAME)
if (strcmp(PrinterName,lpszName)!=0)
continue;
@ -1234,7 +1236,7 @@ BOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
needed = size;
WINSPOOL_GetStringFromRegA(hkeyPrinter, "Name", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
pi2->pPrinterName = ptr;
ptr += size;
} else
@ -1242,7 +1244,7 @@ BOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
needed += size;
WINSPOOL_GetStringFromRegA(hkeyPrinter, "Port", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
pi2->pPortName = ptr;
ptr += size;
} else
@ -1251,7 +1253,7 @@ BOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
WINSPOOL_GetStringFromRegA(hkeyPrinter, "Printer Driver", ptr, cbBuf,
&size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
pi2->pDriverName = ptr;
ptr += size;
} else
@ -1260,7 +1262,7 @@ BOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
WINSPOOL_GetStringFromRegA(hkeyPrinter, "Default DevMode", ptr, cbBuf,
&size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
pi2->pDevMode = (LPDEVMODEA)ptr;
ptr += size;
} else
@ -1269,7 +1271,7 @@ BOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
WINSPOOL_GetStringFromRegA(hkeyPrinter, "Print Processor", ptr, cbBuf,
&size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
pi2->pPrintProcessor = ptr;
ptr += size;
} else
@ -1293,7 +1295,7 @@ BOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
needed = size;
WINSPOOL_GetStringFromRegA(hkeyPrinter, "Name", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
pi5->pPrinterName = ptr;
ptr += size;
} else
@ -1301,7 +1303,7 @@ BOOL WINAPI GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
needed += size;
WINSPOOL_GetStringFromRegA(hkeyPrinter, "Port", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
pi5->pPortName = ptr;
ptr += size;
} else
@ -1463,7 +1465,7 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
needed += size;
WINSPOOL_GetStringFromRegA(hkeyDriver, "Driver", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
di2->pDriverPath = ptr;
ptr += size;
} else
@ -1471,7 +1473,7 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
needed += size;
WINSPOOL_GetStringFromRegA(hkeyDriver, "Data File", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
di2->pDataFile = ptr;
ptr += size;
} else
@ -1480,7 +1482,7 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
WINSPOOL_GetStringFromRegA(hkeyDriver, "Configuration File", ptr,
cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
di2->pConfigFile = ptr;
ptr += size;
} else
@ -1492,7 +1494,7 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
DRIVER_INFO_3A *di3 = (DRIVER_INFO_3A *)pDriverInfo;
WINSPOOL_GetStringFromRegA(hkeyDriver, "Help File", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
di3->pHelpFile = ptr;
ptr += size;
} else
@ -1501,7 +1503,7 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
WINSPOOL_GetStringFromRegA(hkeyDriver, "Dependent Files", ptr, cbBuf,
&size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
di3->pDependentFiles = ptr;
ptr += size;
} else
@ -1509,7 +1511,7 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
needed += size;
WINSPOOL_GetStringFromRegA(hkeyDriver, "Monitor", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
di3->pMonitorName = ptr;
ptr += size;
} else
@ -1517,7 +1519,7 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
needed += size;
WINSPOOL_GetStringFromRegA(hkeyDriver, "DataType", ptr, cbBuf, &size);
if(size <= cbBuf) {
if(cbBuf && size <= cbBuf) {
di3->pDefaultDataType = ptr;
ptr += size;
} else