- ZERO_STRUCT(printer);
-
- if (!W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, lp_const_servicename(snum))))
- return WERR_INVALID_PRINTER_NAME;
-
- if (!W_ERROR_IS_OK(get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version))) {
- free_a_printer(&printer, 2);
- return WERR_UNKNOWN_PRINTER_DRIVER;
- }
-
- result = fill_printer_driver_info2(mem_ctx, r, &driver->info3, servername);
-
- free_a_printer_driver(driver);
- free_a_printer(&printer,2);
-
- return result;
-}
-
-/********************************************************************
- * construct_printer_info_3
- * fill a printer_info_3 struct
- ********************************************************************/
-
-static WERROR construct_printer_driver_info_3(TALLOC_CTX *mem_ctx,
- struct spoolss_DriverInfo3 *r,
- int snum,
- const char *servername,
- const char *architecture,
- uint32_t version)
-{
- NT_PRINTER_INFO_LEVEL *printer = NULL;
- union spoolss_DriverInfo *driver;
- WERROR status;
- ZERO_STRUCT(driver);
-
- status=get_a_printer(NULL, &printer, 2, lp_const_servicename(snum) );
- DEBUG(8,("construct_printer_driver_info_3: status: %s\n", win_errstr(status)));
- if (!W_ERROR_IS_OK(status))
- return WERR_INVALID_PRINTER_NAME;
-
- status = get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version);
- DEBUG(8,("construct_printer_driver_info_3: status: %s\n", win_errstr(status)));
-
-#if 0 /* JERRY */
-
- /*
- * I put this code in during testing. Helpful when commenting out the
- * support for DRIVER_INFO_6 in regards to win2k. Not needed in general
- * as win2k always queries the driver using an infor level of 6.
- * I've left it in (but ifdef'd out) because I'll probably
- * use it in experimentation again in the future. --jerry 22/01/2002
- */
-
- if (!W_ERROR_IS_OK(status)) {
- /*
- * Is this a W2k client ?
- */
- if (version == 3) {
- /* Yes - try again with a WinNT driver. */
- version = 2;
- status=get_a_printer_driver(&driver, 3, printer->info_2->drivername, architecture, version);
- DEBUG(8,("construct_printer_driver_info_3: status: %s\n", win_errstr(status)));
- }
-#endif
-
- if (!W_ERROR_IS_OK(status)) {
- free_a_printer(&printer,2);
- return WERR_UNKNOWN_PRINTER_DRIVER;
- }
-
-#if 0 /* JERRY */
- }
-#endif
-
-
- status = fill_printer_driver_info3(mem_ctx, r, &driver->info3, servername);
-
- free_a_printer_driver(driver);
- free_a_printer(&printer,2);
-
- return status;
-}
-
-/********************************************************************
- * construct_printer_info_6
- * fill a printer_info_6 struct
- ********************************************************************/
-
-static WERROR construct_printer_driver_info_6(TALLOC_CTX *mem_ctx,
- struct spoolss_DriverInfo6 *r,
- int snum,
- const char *servername,
- const char *architecture,
- uint32_t version)
-{
- NT_PRINTER_INFO_LEVEL *printer = NULL;
- union spoolss_DriverInfo *driver;
- WERROR status;
-
- status=get_a_printer(NULL, &printer, 2, lp_const_servicename(snum) );
-
- DEBUG(8,("construct_printer_driver_info_6: status: %s\n", win_errstr(status)));
-
- if (!W_ERROR_IS_OK(status))
- return WERR_INVALID_PRINTER_NAME;
-
- status = get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version);
-
- DEBUG(8,("construct_printer_driver_info_6: status: %s\n", win_errstr(status)));
-
- if (!W_ERROR_IS_OK(status))
- {
- /*
- * Is this a W2k client ?
- */
-
- if (version < 3) {
- free_a_printer(&printer,2);
- return WERR_UNKNOWN_PRINTER_DRIVER;
- }
-
- /* Yes - try again with a WinNT driver. */
- version = 2;
- status = get_a_printer_driver(mem_ctx, &driver, 3, printer->info_2->drivername, architecture, version);
- DEBUG(8,("construct_printer_driver_info_6: status: %s\n", win_errstr(status)));
- if (!W_ERROR_IS_OK(status)) {
- free_a_printer(&printer,2);
- return WERR_UNKNOWN_PRINTER_DRIVER;
- }
- }
-
- status = fill_printer_driver_info6(mem_ctx, r, &driver->info3, servername);
-
- free_a_printer(&printer,2);
- free_a_printer_driver(driver);
-
- return status;
-}
-
-/********************************************************************
- * construct_printer_info_101
- * fill a printer_info_101 struct
- ********************************************************************/
-
-static WERROR construct_printer_driver_info_101(TALLOC_CTX *mem_ctx,
- struct spoolss_DriverInfo101 *r,
- int snum,
- const char *servername,
- const char *architecture,
- uint32_t version)
-{
- NT_PRINTER_INFO_LEVEL *printer = NULL;
- union spoolss_DriverInfo *driver;
- WERROR result;
-