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.

204 lines
6.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 SP_QUERYVALIDJOB 30
  31. #define CP_REINIT 31
  32. #define SP_TXTIMEOUT 32
  33. #define SP_DNSTIMEOUT 33
  34. #define CP_CHECKSPOOLER 34
  35. #define CP_SET_TT_ONLY 35
  36. #define CP_SETSPOOLER 36
  37. #define CP_SETDOSPRINT 37
  38. #define SP_DISK_BUFFER (20000) /* wait for about 20 K of disk space to free
  39. free up before attempting to write to disk */
  40. /* messages posted or sent to the spooler window */
  41. // change these to WM_SPOOLER_ messages
  42. #define SP_NEWJOB 0x1001
  43. #define SP_DELETEJOB 0x1002
  44. #define SP_DISKNEEDED 0x1003
  45. #define SP_QUERYDISKAVAIL 0x1004
  46. #define SP_ISPORTFREE 0x1005
  47. #define SP_CHANGEPORT 0x1006
  48. /* in /windows/oem/printer.h */
  49. // JCB.type status flag bits
  50. // job is done printing (no more pages will be spooled)
  51. #define JB_ENDDOC 0x0001
  52. // spooler canceled the job (user deleted it) either while it
  53. // is being spooled (spool routines care about this) or after
  54. // it is done spooling (no one really cares about this).
  55. #define JB_CANCELED_JOB 0x0002
  56. // the spool data is a metafile (with the devmode stuck on the end)
  57. #define JB_METAFILE 0x0080
  58. // don't spool, send data straight to the desired port (gdi
  59. // does all comm IO, deals with timeouts etc).
  60. #define JB_DIRECT_OUTPUT 0x8000
  61. // printing to a file ("FILE:" or file name). use dos
  62. // writes when outputting data. also used for non spooled net jobs
  63. // (net data goes through dos)
  64. #define JB_PRINT_TO_FILE 0x4000
  65. // this is a spooled job (going to be sent to printman eventually)
  66. #define JB_SPOOLED_JOB 0x2000
  67. // when the spooler is notified we mark the job with this, be careful
  68. // because the user can close down printman after notification
  69. #define JB_NOTIFIED_SPOOLER 0x1000
  70. // we are in an out of disk condition and we are waiting for printman
  71. // to finish outputting some spool data to get more disk space
  72. #define JB_WAITFORDISK 0x0800
  73. // tell printman to "print through dos" instead of using comm routines
  74. #define JB_DOS_WRITES 0x0200
  75. // use WNetCloseJob() instead of _lclose(), this is a net job
  76. #define JB_NET_JOB 0x0100
  77. // no deletion of file after spool (USED?)
  78. // #define JB_DEL_FILE 0x0400
  79. #define NAME_LEN 32
  80. #define BUF_SIZE 128
  81. #define MAX_PROFILE 80
  82. #define JCBBUF_LEN 256
  83. /* comm driver buffer sizes (used by print manager and gdi when opening ports) */
  84. #define COMM_INQUE 0x010
  85. #define COMM_OUTQUE 0x400
  86. #define COMM_ERR_BIT 0x8000
  87. #define TXTIMEOUT 45000 /* milliseconds */
  88. #define DNSTIMEOUT 15000 /* milliseconds */
  89. #define BAUDRATE 0
  90. #define PARITY 1
  91. #define BYTESIZE 2
  92. #define STOPBITS 3
  93. #define REPEAT 4
  94. #define MAXPORTLIST 20 /* max # ports listed in win.ini [ports] */
  95. #define MAXPORT MAXPORTLIST
  96. #define MAXSPOOL 100 /* max # jobs spooled per port */
  97. #define MAXMAP 18
  98. #define PORTINDENT 2
  99. #define JOBINDENT 3
  100. #define MAXPAGE 7 /* allow 7 pages at first */
  101. #define INC_PAGE 8 /* increase by 8 pages at a time */
  102. typedef struct {
  103. ATOM aPortName;
  104. ATOM aPrinterName;
  105. ATOM aDriverName;
  106. long txtimeout;
  107. long dnstimeout;
  108. } JCBQ;
  109. typedef struct jcb {
  110. unsigned type;
  111. int pagecnt;
  112. int maxpage;
  113. int portnum;
  114. HDC hDC;
  115. int chBuf;
  116. long timeSpooled;
  117. char buffer[JCBBUF_LEN];
  118. unsigned long size;
  119. unsigned long iLastPage;
  120. WORD psp; // the PSP of the app that started printing
  121. // PORT pPort; // use this instead of overloading page[1]
  122. char jobName[NAME_LEN];
  123. int page[MAXPAGE];
  124. } JCB, FAR *LPJCB;
  125. // DIALOGMARK.type values (NOT USED)
  126. // #define SP_TEXT 0 /* text type */
  127. // #define SP_NOTTEXT 1 /* not text type */
  128. // #define SP_DIALOG 2 /* dialog type data */
  129. // #define SP_CALLBACK 3 /* call back type function */
  130. // the PAGE structure containes an array of these, one for every dialog
  131. typedef struct {
  132. int size; // size of the dialog data
  133. long data_offset; // offset into the spool file of this data
  134. } DIALOGMARK, FAR *LPDIALOGMARK;
  135. // change these to 2 (these are rare things) and rename
  136. #define SP_DLGINC 8 // this many dlg msgs per page (initially)
  137. #define SP_DLGINIT 8 // grow DIALOGMARK.dialog array by this amount
  138. typedef struct page {
  139. int filenum; // file handle
  140. int maxdlg; // max number of dialog
  141. int dlg_index; // index into dialog[] of next dialog
  142. long spoolsize; // size of this page spool file
  143. OFSTRUCT fileBuf; // OpenFile() buffer
  144. DIALOGMARK dialog[SP_DLGINIT];
  145. } PAGE, FAR *LPPAGE;
  146. // #define SP_COMM_PORT 0
  147. // #define SP_FILE_PORT 1
  148. // #define SP_REMOTE_QUEUE 2
  149. // GDI uses this (not printman)
  150. typedef struct {
  151. int type;
  152. int fn;
  153. long retry; /* system timer on first error */
  154. } PORT;
  155. /* exported routines */
  156. // these should be in windows.h or printers.h, remove from here
  157. int WINAPI WriteDialog(HANDLE hJCB, LPSTR str, int n);
  158. int WINAPI WriteSpool(HANDLE hJCB, LPSTR str, int n);
  159. LONG WINAPI GetSpoolJob(int, long); // printman and control panel call here
  160. char WINAPI GetSpoolTempDrive(void); // no one should call this
  161. BOOL WINAPI QueryJob(HANDLE, int); // no one should call this