Source code of Windows XP (NT5)
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.

175 lines
5.8 KiB

  1. #ifndef WINAPI
  2. #ifdef BUILDDLL /* ;Internal */
  3. #define WINAPI _loadds far pascal /* ;Internal */
  4. #define CALLBACK _loadds far pascal /* ;Internal */
  5. #else /* ;Internal */
  6. #define WINAPI far pascal
  7. #define CALLBACK far pascal
  8. #endif /* ;Internal */
  9. #endif
  10. #define LWORD(x) ((int)((x)&0xFFFF))
  11. /* spooler error code */
  12. #define SP_ERROR (-1) /* general error - mostly used when spooler isn't loaded */
  13. #define SP_APPABORT (-2) /* app aborted the job through the driver */
  14. #define SP_USERABORT (-3) /* user aborted the job through spooler's front end */
  15. #define SP_OUTOFDISK (-4) /* simply no disk to spool */
  16. #define SP_OUTOFMEMORY (-5)
  17. #define SP_RETRY (-6) /* retry sending to the port again */
  18. #define SP_NOTREPORTED 0x4000 /* set if GDI did not report error */
  19. /* subfunctions of the Spooler support function, GetSpoolJob()
  20. * CP_* are used by the control panel for modifying the printer setup/
  21. */
  22. #define SP_PRINTERNAME 20
  23. #define SP_REGISTER 21
  24. #define SP_CONNECTEDPORTCNT 25
  25. #define SP_QUERYDISKUSAGE 26
  26. #define SP_DISKFREED 27
  27. #define SP_INIT 28
  28. #define SP_LISTEDPORTCNT 29
  29. #define CP_ISPORTFREE 30
  30. #define CP_REINIT 31
  31. #define SP_TXTIMEOUT 32
  32. #define SP_DNSTIMEOUT 33
  33. #define CP_CHECKSPOOLER 34
  34. #define CP_SET_TT_ONLY 35
  35. #define CP_SETSPOOLER 36
  36. #define CP_SETDOSPRINT 37
  37. #define SP_DISK_BUFFER (20000) /* wait for about 20 K of disk space to free
  38. free up before attempting to write to disk */
  39. /* messages posted or sent to the spooler window
  40. */
  41. #define SP_NEWJOB 0x1001
  42. #define SP_DELETEJOB 0x1002
  43. #define SP_DISKNEEDED 0x1003
  44. #define SP_QUERYDISKAVAIL 0x1004
  45. #define SP_ISPORTFREE 0x1005
  46. #define SP_CHANGEPORT 0x1006
  47. /* in /windows/oem/printer.h */
  48. /* job status flag bits in the type field of the JCB structure
  49. */
  50. #define JB_ENDDOC 0x0001
  51. #define JB_INVALIDDOC 0x0002
  52. #define JB_DIRECT_SPOOL 0x8000 /* go directly to the printer without the spooler */
  53. #define JB_FILE_PORT 0x4000 /* were given a file for a port name */
  54. #define JB_VALID_SPOOL 0x2000 /* everything is cool, continue to spool normally */
  55. #define JB_NOTIFIED_SPOOLER 0x1000 /* already notified the spooler of this job */
  56. #define JB_WAITFORDISK 0x0800 /* out of disk condition has been detected previously */
  57. #define JB_DEL_FILE 0x0400 /* no deletion of file after spool */
  58. #define JB_FILE_SPOOL 0x0200 /* spooling a file */
  59. #define JB_NET_SPOOL 0x0100 /* sending directly to network */
  60. /* allow 2 dialog box messages initially and increment 8 at a time */
  61. #define SP_DLGINC 8
  62. #define SP_DLGINIT 8
  63. #define NAME_LEN 32
  64. #define BUF_SIZE 128
  65. #define MAX_PROFILE 80
  66. #define JCBBUF_LEN 256
  67. #define lower(c) ((c > 'A' && c < 'Z') ? (c - 'A' + 'a') : c)
  68. #define IDS_LENGTH 60
  69. /* comm driver stuff */
  70. #define COMM_INQUE 0x010 /* wm091385 */
  71. #define COMM_OUTQUE 0x030 /* wm091385 */
  72. #define COMM_OUTQUEPMODE 0x400 /* New size for pmode */
  73. #define COMM_ERR_BIT 0x8000
  74. #define TXTIMEOUT 45000 /* milliseconds */
  75. #define DNSTIMEOUT 15000 /* milliseconds */
  76. #define BAUDRATE 0
  77. #define PARITY 1
  78. #define BYTESIZE 2
  79. #define STOPBITS 3
  80. #define REPEAT 4
  81. typedef struct {
  82. int type; /* type of dialog. This will tell whether it is */
  83. /* call back function or pure dialog etc */
  84. int size; /* size of special function data */
  85. int adr;
  86. }DIALOGMARK;
  87. #define SP_TEXT 0 /* text type */
  88. #define SP_NOTTEXT 1 /* not text type */
  89. #define SP_DIALOG 2 /* dialog type data */
  90. #define SP_CALLBACK 3 /* call back type function */
  91. #define MAXPORTLIST 20 /* max # ports listed in win.ini [ports] */
  92. #define MAXPORT MAXPORTLIST
  93. #define MAXSPOOL 100 /* max # jobs spooled per port */
  94. #define MAXMAP 18
  95. #define PORTINDENT 2
  96. #define JOBINDENT 3
  97. #define MAXPAGE 7 /* allow 7 pages at first */
  98. #define INC_PAGE 8 /* increase by 8 pages at a time */
  99. typedef struct {
  100. int pnum;
  101. int printeratom;
  102. long txtimeout;
  103. long dnstimeout;
  104. }JCBQ;
  105. typedef struct jcb {
  106. unsigned type;
  107. int pagecnt;
  108. int maxpage;
  109. int portnum;
  110. HDC hDC;
  111. int chBuf;
  112. long timeSpooled;
  113. char buffer[JCBBUF_LEN];
  114. unsigned long size;
  115. unsigned long iLastPage;
  116. WORD psp; // the PSP of the app that started printing
  117. char jobName[NAME_LEN];
  118. int page[MAXPAGE];
  119. }JCB;
  120. typedef struct page {
  121. int filenum;
  122. unsigned maxdlg; /* max number of dialog */
  123. unsigned dlgptr; /* number of dialogs */
  124. long spoolsize;
  125. OFSTRUCT fileBuf;
  126. DIALOGMARK dialog[SP_DLGINIT];
  127. }PAGE;
  128. #define SP_COMM_PORT 0
  129. #define SP_FILE_PORT 1
  130. #define SP_REMOTE_QUEUE 2
  131. #define SP_QUERYVALIDJOB 30
  132. typedef struct
  133. {
  134. int type;
  135. int fn;
  136. long retry; /* system timer on first error */
  137. } PORT;
  138. /* exported routines */
  139. BOOL WINAPI QueryJob(HANDLE, int);
  140. BOOL WINAPI QueryAbort(HANDLE, int);
  141. int WINAPI WriteDialog(HANDLE hJCB, LPSTR str, int n);
  142. int WINAPI WriteSpool(HANDLE hJCB, LPSTR str, int n);
  143. LONG WINAPI GetSpoolJob(int, long);
  144. char WINAPI GetSpoolTempDrive(void);