Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1994 - 1996 Microsoft Corporation
  3. Module Name:
  4. devqury.c
  5. Abstract:
  6. This module provides all the scheduling services for the Local Spooler
  7. Author:
  8. Krishna Ganugapati (KrishnaG) 15-June-1994
  9. Revision History:
  10. --*/
  11. #include <precomp.h>
  12. BOOL (*pfnOpenPrinter)(LPTSTR, LPHANDLE, LPPRINTER_DEFAULTS);
  13. BOOL (*pfnClosePrinter)(HANDLE);
  14. BOOL (*pfnDevQueryPrint)(HANDLE, LPDEVMODE, DWORD *, LPWSTR, DWORD);
  15. BOOL (*pfnPrinterEvent)(LPWSTR, INT, DWORD, LPARAM, DWORD *);
  16. LONG (*pfnDocumentProperties)(HWND, HANDLE, LPWSTR, PDEVMODE, PDEVMODE, DWORD);
  17. BOOL
  18. InitializeWinSpoolDrv(
  19. VOID
  20. )
  21. {
  22. fnWinSpoolDrv fnList;
  23. if (!SplInitializeWinSpoolDrv(&fnList)) {
  24. return FALSE;
  25. }
  26. pfnOpenPrinter = fnList.pfnOpenPrinter;
  27. pfnClosePrinter = fnList.pfnClosePrinter;
  28. pfnDevQueryPrint = fnList.pfnDevQueryPrint;
  29. pfnPrinterEvent = fnList.pfnPrinterEvent;
  30. pfnDocumentProperties = fnList.pfnDocumentProperties;
  31. return TRUE;
  32. }
  33. BOOL
  34. CallDevQueryPrint(
  35. LPWSTR pPrinterName,
  36. LPDEVMODE pDevMode,
  37. LPWSTR ErrorString,
  38. DWORD dwErrorString,
  39. DWORD dwPrinterFlags,
  40. DWORD dwJobFlags
  41. )
  42. {
  43. HANDLE hPrinter;
  44. DWORD dwResID=0;
  45. //
  46. // Do not process for Direct printing
  47. // If a job is submitted as direct, then
  48. // ignore the devquery print stuff
  49. //
  50. if ( dwJobFlags ) {
  51. return TRUE;
  52. }
  53. if (!pDevMode) {
  54. return TRUE;
  55. }
  56. if (dwPrinterFlags && pfnOpenPrinter && pfnDevQueryPrint && pfnClosePrinter) {
  57. if ( (*pfnOpenPrinter)(pPrinterName, &hPrinter, NULL) ) {
  58. (*pfnDevQueryPrint)(hPrinter, pDevMode, &dwResID, ErrorString, dwErrorString);
  59. (*pfnClosePrinter)(hPrinter);
  60. }
  61. }
  62. return(dwResID == 0);
  63. }