diff options
Diffstat (limited to 'testprogs')
-rw-r--r-- | testprogs/win32/spoolss/error.c | 4 | ||||
-rw-r--r-- | testprogs/win32/spoolss/printlib.c | 14 | ||||
-rw-r--r-- | testprogs/win32/spoolss/printlib_proto.h | 1 | ||||
-rw-r--r-- | testprogs/win32/spoolss/spoolss.c | 47 |
4 files changed, 62 insertions, 4 deletions
diff --git a/testprogs/win32/spoolss/error.c b/testprogs/win32/spoolss/error.c index ba15c1e62d..6296f07c35 100644 --- a/testprogs/win32/spoolss/error.c +++ b/testprogs/win32/spoolss/error.c @@ -31,6 +31,8 @@ const char *errstr(DWORD error) return "ERROR_ACCESS_DENIED"; case ERROR_INVALID_PARAMETER: return "ERROR_INVALID_PARAMETER"; + case ERROR_INVALID_HANDLE: + return "ERROR_INVALID_HANDLE"; case ERROR_CALL_NOT_IMPLEMENTED: return "ERROR_CALL_NOT_IMPLEMENTED"; case ERROR_INSUFFICIENT_BUFFER: @@ -109,6 +111,8 @@ const char *errstr(DWORD error) #endif case ERROR_CANCELLED: return "ERROR_CANCELLED"; + case RPC_S_SERVER_UNAVAILABLE: + return "RPC_S_SERVER_UNAVAILABLE"; default: break; } diff --git a/testprogs/win32/spoolss/printlib.c b/testprogs/win32/spoolss/printlib.c index c40ca6c2e1..9fc9d046f2 100644 --- a/testprogs/win32/spoolss/printlib.c +++ b/testprogs/win32/spoolss/printlib.c @@ -606,3 +606,17 @@ void print_printer_enum_values(PRINTER_ENUM_VALUES *info) return; } + +void print_printer_keys(LPSTR buffer) +{ + LPSTR p = NULL; + + p = buffer; + + while (p && *p) { + printf("%s\n", p); + for (; *p; p = CharNext(p)) { + p = CharNext(p); + } + } +} diff --git a/testprogs/win32/spoolss/printlib_proto.h b/testprogs/win32/spoolss/printlib_proto.h index fd6db22770..d408523ac4 100644 --- a/testprogs/win32/spoolss/printlib_proto.h +++ b/testprogs/win32/spoolss/printlib_proto.h @@ -39,6 +39,7 @@ void print_driver_info_4 (PDRIVER_INFO_4 info); void print_driver_info_6 (PDRIVER_INFO_6 info); void print_doc_info_1 (PDOC_INFO_1 info); void print_printer_enum_values (PRINTER_ENUM_VALUES *info); +void print_printer_keys(LPSTR buffer); #undef _PRINTF_ATTRIBUTE #define _PRINTF_ATTRIBUTE(a1, a2) diff --git a/testprogs/win32/spoolss/spoolss.c b/testprogs/win32/spoolss/spoolss.c index 5c77413268..66b9191bae 100644 --- a/testprogs/win32/spoolss/spoolss.c +++ b/testprogs/win32/spoolss/spoolss.c @@ -403,6 +403,42 @@ static BOOL test_EnumPrintProcessorDatatypes(struct torture_context *tctx, /**************************************************************************** ****************************************************************************/ +static BOOL test_EnumPrinterKey(struct torture_context *tctx, + LPSTR servername, + HANDLE handle, + LPCSTR key) +{ + LPSTR buffer = NULL; + DWORD needed = 0; + DWORD err = 0; + char tmp[1024]; + + torture_comment(tctx, "Testing EnumPrinterKey(%s)", key); + + err = EnumPrinterKey(handle, key, NULL, 0, &needed); + if (err == ERROR_MORE_DATA) { + buffer = (LPTSTR)malloc(needed); + torture_assert(tctx, buffer, "malloc failed"); + err = EnumPrinterKey(handle, key, buffer, needed, &needed); + } + if (err) { + sprintf(tmp, "EnumPrinterKey(%s) failed on [%s] (buffer size = %d), error: %s\n", + key, servername, needed, errstr(err)); + torture_fail(tctx, tmp); + } + + if (tctx->print) { + print_printer_keys(buffer); + } + + free(buffer); + + return TRUE; +} + +/**************************************************************************** +****************************************************************************/ + static BOOL test_GetPrinter(struct torture_context *tctx, LPSTR printername, HANDLE handle) @@ -561,6 +597,8 @@ static BOOL test_OnePrinter(struct torture_context *tctx, ret &= test_GetPrinterDriver(tctx, printername, architecture, handle); ret &= test_EnumForms(tctx, printername, handle); ret &= test_EnumJobs(tctx, printername, handle); + ret &= test_EnumPrinterKey(tctx, printername, handle, ""); + ret &= test_EnumPrinterKey(tctx, printername, handle, "PrinterDriverData"); ret &= test_ClosePrinter(tctx, handle); return ret; @@ -731,7 +769,7 @@ int main(int argc, char *argv[]) BOOL ret = FALSE; LPSTR servername; LPSTR architecture = "Windows NT x86"; - HANDLE handle; + HANDLE server_handle; struct torture_context *tctx; if (argc < 2) { @@ -756,9 +794,10 @@ int main(int argc, char *argv[]) ret &= test_EnumPrinters(tctx, servername); ret &= test_EnumDrivers(tctx, servername, architecture); - ret &= test_OpenPrinter(tctx, servername, &handle); - ret &= test_EnumForms(tctx, servername, handle); - ret &= test_ClosePrinter(tctx, handle); + ret &= test_OpenPrinter(tctx, servername, &server_handle); +/* ret &= test_EnumPrinterKey(tctx, servername, server_handle, ""); */ + ret &= test_EnumForms(tctx, servername, server_handle); + ret &= test_ClosePrinter(tctx, server_handle); ret &= test_EnumPorts(tctx, servername); ret &= test_EnumMonitors(tctx, servername); ret &= test_EnumPrintProcessors(tctx, servername, architecture); |