Windows NT 4.0 source code leak
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.

121 lines
2.9 KiB

4 years ago
  1. /*++
  2. Module Name:
  3. windows\spooler\prtprocs\winprint\emf.c
  4. Abstract:
  5. Routines to facilitate printing of EMF jobs.
  6. Author:
  7. Gerrit van Wingerden (gerritv) 5-12-1995
  8. Revision History:
  9. --*/
  10. #include "stddef.h"
  11. #include <windef.h>
  12. #include <windows.h>
  13. #include <winspool.h>
  14. #include <winsplp.h>
  15. #include <wchar.h>
  16. #include "winprint.h"
  17. // !!LATER define these prototypes here until I get the spooler to include
  18. // the header files froms ntgdi\inc [gerritv] 5-12-95
  19. typedef int (CALLBACK* EMFPLAYPROC)( HDC hdc, INT iFunction, HANDLE hPageQuery );
  20. BOOL WINAPI GdiPlayEMF
  21. (
  22. LPWSTR pwszPrinterName,
  23. LPDEVMODEW pDevmode,
  24. LPWSTR pwszDocName,
  25. EMFPLAYPROC pfnEMFPlayFn,
  26. HANDLE hPageQuery
  27. );
  28. /*++
  29. *******************************************************************
  30. P r i n t E M F J o b
  31. Routine Description:
  32. Prints out a job with EMF data type.
  33. Arguments:
  34. pData => Data structure for this job
  35. pDocumentName => Name of this document
  36. Return Value:
  37. TRUE if successful
  38. FALSE if failed - GetLastError() will return reason.
  39. *******************************************************************
  40. --*/
  41. BOOL
  42. PrintEMFJob(
  43. IN PPRINTPROCESSORDATA pData,
  44. IN LPWSTR pDocumentName)
  45. {
  46. ULONG Copies;
  47. DWORD Start = 0;
  48. DWORD End = 0xffffffff;
  49. INT Priority = 0;
  50. /** Print the data pData->Copies times **/
  51. Copies = pData->Copies;
  52. try {
  53. while (Copies--) {
  54. /**
  55. WORKWORK - There is a problem here. It seems that
  56. the graphics engine deletes the print job
  57. once it is done playing it. Because of this,
  58. only one copy is spit out. One fix would be to copy
  59. the file off if we will be doing copies, then copy it
  60. back for each copy. Another would be to add a flag to
  61. the play call specifying whether to delete the file
  62. or not. Finally, we could just not support copies
  63. for journal jobs.
  64. WORKWORK - GdiPlayEMF supports a call back function to
  65. query which pages should be played next. This requires
  66. support fromt the spooler to allow random access to the
  67. spool file on a per page basis. When this is implemented
  68. we can print any number of copies we like using this call
  69. back function.
  70. **/
  71. /** Call the graphics engine to print the job **/
  72. if (!GdiPlayEMF(pData->pPrinterName,
  73. pData->pDevmode,
  74. pDocumentName,
  75. NULL,
  76. NULL)) {
  77. return FALSE;
  78. }
  79. } /* While copies to print **/
  80. } except (TRUE) {
  81. OutputDebugString(L"GdiPlayEMF gave an exception\n");
  82. return FALSE;
  83. }
  84. return TRUE;
  85. }