}
}
+ if (tctx->print) {
+ print_printer_info_bylevel(levels[i], buffer, returned);
+ }
+
free(buffer);
buffer = NULL;
}
LPSTR servername,
LPSTR architecture)
{
- DWORD levels[] = { 1, 2, 3, 4, 5, 6, 8 };
- DWORD success[] = { 1, 1, 1, 1, 1, 1, 1 };
+ DWORD levels[] = { 1, 2, 3, 4, 5, 6 };
+ DWORD success[] = { 1, 1, 1, 1, 1, 1 };
DWORD i;
LPBYTE buffer = NULL;
****************************************************************************/
static BOOL test_EnumPrintProcessorDatatypes(struct torture_context *tctx,
- LPSTR servername,
- LPSTR architecture)
+ LPSTR servername)
{
DWORD levels[] = { 1 };
DWORD success[] = { 1 };
torture_comment(tctx, "Testing EnumPrintProcessorDatatypes level %d", levels[i]);
- EnumPrintProcessorDatatypes(servername, architecture, levels[i], NULL, 0, &needed, &returned);
+ EnumPrintProcessorDatatypes(servername, "winprint", levels[i], NULL, 0, &needed, &returned);
err = GetLastError();
if (err == ERROR_INSUFFICIENT_BUFFER) {
err = 0;
buffer = malloc(needed);
torture_assert(tctx, buffer, "malloc failed");
- if (!EnumPrintProcessorDatatypes(servername, architecture, levels[i], buffer, needed, &needed, &returned)) {
+ if (!EnumPrintProcessorDatatypes(servername, "winprint", levels[i], buffer, needed, &needed, &returned)) {
err = GetLastError();
}
}
/****************************************************************************
****************************************************************************/
+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)
LPSTR architecture,
HANDLE handle)
{
- DWORD levels[] = { 1, 2, 3, 4, 5, 6, 8, 101};
- DWORD success[] = { 1, 1, 1, 1, 1, 1, 1, 1 };
+ DWORD levels[] = { 1, 2, 3, 4, 5, 6, 8 };
+ DWORD success[] = { 1, 1, 1, 1, 1, 1, 1 };
DWORD i;
LPBYTE buffer = NULL;
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;
/****************************************************************************
****************************************************************************/
-static BOOL test_OneDriver(struct torture_context *tctx,
- LPSTR printername,
- LPSTR drivername)
-{
- return TRUE;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_EachDriver(struct torture_context *tctx,
- LPSTR servername)
-{
- return TRUE;
-}
-
-/****************************************************************************
-****************************************************************************/
-
static BOOL test_EachPrinter(struct torture_context *tctx,
LPSTR servername,
LPSTR architecture)
DWORD i;
DWORD flags = PRINTER_ENUM_NAME;
PPRINTER_INFO_1 buffer = NULL;
+ BOOL ret = TRUE;
torture_comment(tctx, "Testing EnumPrinters level %d", 1);
}
for (i=0; i < returned; i++) {
- torture_assert(tctx, test_OnePrinter(tctx, buffer[i].pName, architecture),
- "failed to test one printer");
+ ret &= test_OnePrinter(tctx, buffer[i].pName, architecture);
}
free(buffer);
- return TRUE;
+ return ret;
}
/****************************************************************************
BOOL ret = FALSE;
LPSTR servername;
LPSTR architecture = "Windows NT x86";
- HANDLE handle;
+ HANDLE server_handle;
struct torture_context *tctx;
if (argc < 2) {
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);
- ret &= test_EnumPrintProcessorDatatypes(tctx, servername, architecture);
+ ret &= test_EnumPrintProcessorDatatypes(tctx, servername);
ret &= test_GetPrintProcessorDirectory(tctx, servername, architecture);
ret &= test_GetPrinterDriverDirectory(tctx, servername, architecture);
ret &= test_EachPrinter(tctx, servername, architecture);
- ret &= test_EachDriver(tctx, servername);
if (!ret) {
if (tctx->last_reason) {