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.

427 lines
16 KiB

  1. /* connect.h */
  2. /*************************************************************************
  3. * If defined, the following flags inhibit definition
  4. * of the indicated items.
  5. *
  6. * JUST COPY AND PASTE THE DEFINES THAT YOU NEED
  7. *************************************************************************
  8. #define NOORDINALS TRUE
  9. #define NOPROTOTYPES TRUE
  10. #define NODLLPROTOTYPES TRUE
  11. #define NODCPROTOTYPES TRUE
  12. #define NOCONSTANTS TRUE
  13. #define NOCONNECTORS TRUE
  14. #define NOGLOBALS TRUE
  15. #define NO TRUE
  16. *************************************************************************
  17. */
  18. #ifndef MINCONSTR /* seh nova 005 */
  19. #define MINCONSTR 64 /* seh nova 005 */
  20. #endif
  21. #ifndef MINRESSTR
  22. #define MINRESSTR 32 /* seh nova 005 this must match dynacomm.h */
  23. #endif
  24. #ifndef NOORDINALS
  25. /* define ordinal values for all exported functions */
  26. #define ORD_GETDLLTYPE 959
  27. #define ORD_GETCONNECTCAPS 962
  28. #define ORD_SETPARAMETERS 800
  29. #define ORD_GETEXTENDEDINFO 801
  30. #define ORD_RESETCONNECTOR 802
  31. #define ORD_EXITCONNECTOR 803
  32. #define ORD_CONNECTCONNECTOR 804
  33. #define ORD_READCONNECTOR 805
  34. #define ORD_WRITECONNECTOR 806
  35. #define ORD_COMMANDCONNECTOR 807
  36. #define ORD_DISCONNECTCONNECTOR 808
  37. #define ORD_SETUPCONNECTOR 809
  38. #endif /* NOORDINALS */
  39. #ifndef NOCONSTANTS
  40. /* constants defined here (listed by function that uses them */
  41. /* GetDLLType */
  42. #define GDT_SHOW_EGO TRUE
  43. #define GDT_QUIET FALSE
  44. #define DC_CONNECTOR 4257
  45. /* GetConnectCaps, SetParameters */
  46. #define SET_PARAMETERS 0x0001
  47. #define SP_GETCAPS 0x0001
  48. #define SP_QUIET 0x0000
  49. #define SP_SHOW 0x0002
  50. #define SP_GETDEFAULT 0x0004
  51. #define SP_SETDEFAULT 0x0008
  52. #ifdef ORGCODE
  53. #define SP_PARITY 0x0001
  54. #define SP_BAUD 0x0002
  55. #define SP_DATABITS 0x0004
  56. #define SP_STOPBITS 0x0008
  57. #define SP_HANDSHAKING 0x0010
  58. #define SP_PARITY_CHECK 0x0020
  59. #define SP_CARRIER_DETECT 0x0040
  60. #endif
  61. /* available baud rates */
  62. #define GP_AVAIL_BAUD 0x0002
  63. /* values can be.... */
  64. #ifdef ORGCODE
  65. #define BAUD_075 0x0001
  66. #define BAUD_110 0x0002
  67. #define BAUD_300 0x0004
  68. #define BAUD_600 0x0008
  69. #define BAUD_120 0x0010
  70. #define BAUD_240 0x0020
  71. #define BAUD_480 0x0040
  72. #define BAUD_960 0x0080
  73. #define BAUD_192 0x0100
  74. #else
  75. #define BAUD_120 BAUD_1200
  76. #define BAUD_240 BAUD_2400
  77. #define BAUD_480 BAUD_4800
  78. #define BAUD_960 BAUD_9600
  79. #define BAUD_192 BAUD_19200
  80. #endif
  81. #ifdef ORGCODE
  82. #define BAUD_USER 0x0200
  83. #endif
  84. #define BAUD_ALL (BAUD_075+BAUD_110+BAUD_300+BAUD_600+BAUD_120+BAUD_240+BAUD_480+BAUD_960+BAUD_192+BAUD_USER)
  85. #define BAUD_OFFSET 0x1000 /* tge used for resources */
  86. /* available data bits */
  87. #define GP_AVAIL_DATABITS 0x0004
  88. /* values can be.... */
  89. #ifdef ORGCODE
  90. #define DATABITS_5 0x0001
  91. #define DATABITS_6 0x0002
  92. #define DATABITS_7 0x0004
  93. #define DATABITS_8 0x0008
  94. #endif
  95. #define DATABITS_ALL (DATABITS_5+DATABITS_6+DATABITS_7+DATABITS_8)
  96. #define DATABITS_OFFSET 0x2000 /* tge used for resources */
  97. /* available stops bits */
  98. #define GP_AVAIL_STOPBITS 0x0008
  99. /* values can be.... */
  100. #ifdef ORGCODE
  101. #define STOPBITS_10 0x0001
  102. #define STOPBITS_15 0x0002
  103. #define STOPBITS_20 0x0004
  104. #endif
  105. #define STOPBITS_ALL (STOPBITS_10+STOPBITS_15+STOPBITS_20)
  106. #define STOPBITS_OFFSET 0x3000 /* tge used for resources */
  107. /* available parity options */
  108. #define GP_AVAIL_PARITY 0x0010
  109. /* values can be ... */
  110. #ifdef ORGCODE
  111. #define PARITY_NONE 0x0001
  112. #define PARITY_ODD 0x0002
  113. #define PARITY_EVEN 0x0004
  114. #define PARITY_MARK 0x0008
  115. #define PARITY_SPACE 0x0010
  116. #endif
  117. #define PARITY_ALL (PARITY_NONE+PARITY_ODD+PARITY_EVEN+PARITY_MARK+PARITY_SPACE)
  118. #define PARITY_OFFSET 0x4000 /* tge used for resources */
  119. /* available handshaking */
  120. #define GP_AVAIL_HANDSHAKE 0x0020
  121. /* values can be...*/
  122. #define HANDSHAKE_XONXOFF 0x0001
  123. #define HANDSHAKE_HARDWARE 0x0002
  124. #define HANDSHAKE_NONE 0x0004
  125. #define HANDSHAKE_ETXFLOW 0x0008
  126. #define HANDSHAKE_ALL (HANDSHAKE_XONXOFF+HANDSHAKE_HARDWARE+HANDSHAKE_NONE+HANDSHAKE_ETXFLOW)
  127. #define HANDSHAKE_OFFSET 0x5000 /* tge used for resources */
  128. /* misc. options */
  129. #define GP_AVAIL_MISC 0x0040
  130. /* values can be... */
  131. #define MISC_CARRIER_DETECT 0x0001
  132. #define MISC_PARITY_CHECK 0x0002
  133. #define MISC_ALL (MISC_CARRIER_DETECT+MISC_PARITY_CHECK)
  134. #define MISC_NONE 0x0000
  135. #define MISC_OFFSET 0x6000 /* tge used for resources */
  136. /* GetExtendedInfo */
  137. #define GI_STRSIZE 80
  138. /* if GetExtendedInfo does not have extended info for what we want,
  139. it gives us this message */
  140. #define GIN_NOINFO 0xffff
  141. /* else, the following stuff is used */
  142. /* we send GetExtendedInfo this in parameter one and error code in param 2 */
  143. #define GI_ERROR 0x0000
  144. /* and GetExtended info returns this ... */
  145. #define GIN_ERRWARNING 0x0000
  146. #define GIN_ERRDLLCRASH 0x0001
  147. #define GIN_ERRAPPCRASH 0x0002
  148. #define GIN_ERRSYSCRASH 0x0003
  149. #define GIN_ERRFATAL 0x0004
  150. /* we send GetExtendedInfo this is param 1 */
  151. #define GI_IDENTIFY 0x0001
  152. /* and one of these in param 2 */
  153. #define GI_DLLFILENAME 0x0000 /* put dll file name is param 3 */
  154. #define GI_DLLNAME 0x0001 /* put dll name is param 3 (used in listbox) */
  155. #define GI_CLIENTNAME 0x0002 /* put client name is param 3 */
  156. #define GI_SERVERNAME 0x0003 /* put server name is param 3 */
  157. #define GI_DLLVERSION 0x0004 /* put version # in param 3 */
  158. #define GI_DLLINIFILENAME 0x0005 /* put ini filename in param 3 */
  159. #define GI_SETUPBOX 0x0006 /* return TRUE if setup button should be enabled */
  160. /* and GetExtended info returns this ... */
  161. #define GI_OK TRUE
  162. /* connector read and write errors */
  163. #define CONNECT_READ_ERROR 0xffff
  164. #define CONNECT_WRITE_ERROR (CONNECT_READ_ERROR)
  165. /* connector ini list error */
  166. #define CONNECT_NO_CONNECTORS (-2)
  167. /* CommandConnector */
  168. #define DLL_CMD_BREAK 0x0001
  169. /* ConnectConnector */
  170. #define STAT_CONNECTED 1 /* slc nova xxx */
  171. #define STAT_NOT_CONNECTED 2 /* slc nova xxx */
  172. #define STAT_WAIT_CONNECT 3 /* bjw nova 002 */
  173. #define STAT_ERROR 4 /* bjw nova 002 */
  174. /* control block constants */
  175. #define TYPE_MODEM 0x0001
  176. #define TYPE_NETWORK 0x0002
  177. #define TYPE_PHYSICAL 0x0003
  178. #endif /* NOCONSTANTS */
  179. #ifndef NOCONNECTORS
  180. /* User Union (not to be mistaken with the AFL-CIO */
  181. #define CCB_UNION_SIZE 512 /* seh/slc nova */
  182. typedef union
  183. {
  184. BYTE Byte[CCB_UNION_SIZE];
  185. WORD Word[CCB_UNION_SIZE / sizeof(WORD)];
  186. LONG Long[CCB_UNION_SIZE / sizeof(LONG)];
  187. PSTR Pstr[CCB_UNION_SIZE / sizeof(PSTR)];
  188. LPSTR Lpstr[CCB_UNION_SIZE / sizeof(LPSTR)];
  189. HANDLE Handle[CCB_UNION_SIZE / sizeof(HANDLE)];
  190. } USER_UNION;
  191. /* Connector Control Block */
  192. typedef struct
  193. {
  194. WORD wVersion; /* version number (always equals 100) */
  195. HANDLE hConnectorInst; /* instance handle of connector DLL */
  196. WORD wType; /* Type of connection (network, physical, ect...) */
  197. WORD wStatus; /* Status (connected, not connected, ect... */
  198. WPARAM wParamFlags; /* flags returned by GetConnectCaps(SET_PARAMETERS) */
  199. WORD wBaudFlags; /* flags returned by GetConnectCaps(GP_AVAIL_BAUD) */
  200. WORD wDataBitFlags; /* flags returned by GetConnectCaps(GP_AVAIL_DATABITS) */
  201. WORD wStopBitFlags; /* flags returned by GetConnectCaps(GP_AVAIL_STOPBITS) */
  202. WORD wParityFlags; /* flags returned by GetConnectCaps(GP_AVAIL_PARITY) */
  203. WORD wHandshakeFlags; /* flags returned by GetConnectCaps(GP_AVAIL_HANDSHAKE) */
  204. WORD wMiscFlags; /* flags returned by GetConnectCaps(GP_AVAIL_MISC) */
  205. WORD wSpeed; /* currently set baud rate (actual value) */ /* seh nova 005 */
  206. WORD wBaudSet; /* currently set baud rate (control id) */
  207. WORD wDataBitSet; /* currently set data bits (control id) */
  208. WORD wStopBitSet; /* currently set stop bits (control id) */
  209. WORD wParitySet; /* currently set parity (control id) */
  210. WORD wHandshakeSet; /* currently set handshaking (control id) */
  211. WORD wMiscSet; /* currently set misc (bit flags) */
  212. BYTE szPhoneNumber[MINRESSTR]; /* Phone Number to Dial */
  213. BYTE szDLLFileName[MINRESSTR]; /* DOS filename for DLL */
  214. BYTE szDLLName[MINRESSTR]; /* Name used in connectors listbox */
  215. BYTE szClient[16]; /* client name (for network DLL use) */
  216. BYTE szServer[64]; /* server name (for network DLL use) */
  217. WORD wNetBiosLNum; /* slc nova NetBIOS Local Session Number */
  218. WORD wNetBiosRNum; /* slc nova NetBIOS Remote Session Number */
  219. WORD byPadChar; /* char used for blank padding */
  220. WORD wReadBufferSize; /* size of read transfer buffer */
  221. WORD wReadBufferRead; /* actual bytes read */ /* bjw nova 002 */
  222. LPSTR lpReadBuffer; /* address of read transfer buffer */
  223. HANDLE hReadBuffer; /* handle to read transfer buffer */
  224. WORD wWriteBufferSize; /* size of write transfer buffer */
  225. WORD wWriteBufferUsed; /* size of write transfer buffer used */ /* seh nova 005 */
  226. LPSTR lpWriteBuffer; /* address of write transfer buffer */
  227. HANDLE hWriteBuffer; /* handle to write transfer buffer */
  228. LPSTR lpNCB; /* address of NetBIOS Control Block */
  229. HANDLE hNCB; /* handle to NetBIOS Control Block */
  230. LPSTR lpNCBWrite; /* address of NetBIOS Control Block */
  231. HANDLE hNCBWrite; /* handle to NetBIOS Control Block */
  232. LPSTR lpNCBRead; /* address of NetBIOS Control Block */
  233. HANDLE hNCBRead; /* handle to NetBIOS Control Block */
  234. WORD wTimeRemain; /* NetBIOS Listen Timeout */
  235. BYTE configBuffer[32]; /* Saved in DCS file (for DLL use) */
  236. USER_UNION User; /* DLL's are free to use this space
  237. in anyway that they would like to */
  238. } CONNECTOR_CONTROL_BLOCK, *PCONNECTOR_CONTROL_BLOCK, FAR *LPCONNECTOR_CONTROL_BLOCK;
  239. /* connector array structure */
  240. typedef struct
  241. {
  242. WORD wNumOfChannels; /* number of opened channels */
  243. WORD wTopChannel; /* if a session window is the top window, */
  244. /* then this is it's index into CCB array */
  245. HANDLE hCCBArray;
  246. LPCONNECTOR_CONTROL_BLOCK lpCCB[1]; /* array of CCB's (dynamically allocated) */
  247. } CONNECTORS, *PCONNECTORS, FAR *LPCONNECTORS;
  248. #endif /* NOCONNECTORS */
  249. #ifndef NOGLOBALS
  250. HANDLE ghConnectors; /* global handle to connector data struct */
  251. HANDLE ghCCB; /* global handle CONNECTOR_CONTROL_BLOCK */
  252. LPCONNECTORS xglpConnectors; /* not used anymore - long pointer to connector data structure */
  253. HANDLE ghWorkConnector; /* handle for temporary connector work (settings) */
  254. BYTE gszWork[MINCONSTR]; /* slc nova xxx */
  255. #endif /* NOGLOBALS */
  256. #ifndef NOPROTOTYPES
  257. /* exported functions prototypes */
  258. #ifndef NODLLPROTOTYPES
  259. /* Connect DLL's */
  260. WORD APIENTRY GetDLLType(HWND, BOOL);
  261. WORD APIENTRY GetConnectCaps(WORD);
  262. WORD APIENTRY SetParameters(WORD, LPCONNECTOR_CONTROL_BLOCK);
  263. WORD APIENTRY GetExtendedInfo(WORD, WORD, LPSTR);
  264. WORD APIENTRY ResetConnector(HWND, LPCONNECTOR_CONTROL_BLOCK, BOOL);
  265. WORD APIENTRY ExitConnector(HWND, LPCONNECTOR_CONTROL_BLOCK, BOOL);
  266. WORD APIENTRY ConnectConnector(HWND, LPCONNECTOR_CONTROL_BLOCK, BOOL);
  267. WORD APIENTRY ReadConnector(LPCONNECTOR_CONTROL_BLOCK);
  268. WORD APIENTRY WriteConnector(LPCONNECTOR_CONTROL_BLOCK);
  269. WORD APIENTRY CommandConnector(HWND, LPCONNECTOR_CONTROL_BLOCK, WORD, LONG);
  270. WORD APIENTRY DisconnectConnector(HANDLE, LPCONNECTOR_CONTROL_BLOCK);
  271. #endif /* NODLLPROTOTYPES */
  272. #ifndef NODCPROTOTYPES
  273. /* DynaComm */
  274. BOOL initConnectors(BOOL);
  275. VOID addConnectorList(HWND, WORD); /* slc nova 031 */
  276. HANDLE loadConnector(HWND, HANDLE, LPSTR, BOOL); /* slc nova 031 */
  277. WORD getConnectorCaps(LPCONNECTOR_CONTROL_BLOCK); /* slc nova 031 */
  278. WORD setConnectorSettings(HWND, HANDLE, BOOL);
  279. WORD getConnectorSettings(LPCONNECTOR_CONTROL_BLOCK, BOOL); /* slc nova 031 */
  280. WORD DLL_ResetConnector(HANDLE, BOOL); /* slc nova 031 */
  281. WORD DLL_SetupConnector(HANDLE, BOOL); /* slc nova 031 */
  282. WORD DLL_ExitConnector(HANDLE, recTrmParams *);
  283. WORD DLL_ConnectConnector(HANDLE, BOOL); /* slc nova 031 */
  284. WORD DLL_ReadConnector(HANDLE); /* slc nova 031 */
  285. WORD DLL_WriteConnector(HANDLE); /* slc nova 031 */
  286. WORD DLL_CommandConnector(HANDLE, LPCONNECTOR_CONTROL_BLOCK, WORD, LONG);
  287. WORD DLL_DisconnectConnector(HANDLE hCCB); /* slc nova 031 seh nova 005 */
  288. WORD DLL_modemSendBreak(HANDLE, INT);
  289. WORD DLL_ConnectBytes(HANDLE); /* slc nova 031 */
  290. WORD getConnectType(HANDLE hConnector, HANDLE hCCB); /* seh nova 005 */
  291. VOID ccbFromTrmParams(LPCONNECTOR_CONTROL_BLOCK, recTrmParams *);
  292. VOID ccbToTrmParams(recTrmParams *, LPCONNECTOR_CONTROL_BLOCK);
  293. BOOL DLL_HasSetupBox(HANDLE hConnector); /* seh nova 006 */
  294. WORD putCCB_BAUDITM(WORD); /* slc nova xxx */
  295. WORD putCCB_BAUD(WORD);
  296. WORD putCCB_DATABITS(WORD);
  297. WORD putCCB_PARITY(WORD);
  298. WORD putCCB_STOPBITS(WORD);
  299. WORD putCCB_FLOWCTRL(WORD);
  300. WORD putCCB_MISCSET(WORD, WORD);
  301. #endif /* NODCPROTOTYPES */
  302. #endif /* NOPROTOTYPES */
  303. /* taken from dcrc.h bjw nova 002 */
  304. #ifdef NEED_DCRC
  305. /* bjw gold 027 - the evil warning! */
  306. /*****************************************************************************
  307. * B I G - T I M E , W A R N I N G !, W A R N I N G !, W A R N I N G !
  308. *
  309. * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
  310. *
  311. * If any of the folling ID's change (and you better have a good reason!)
  312. * make sure and change the corresponding ID's in any DLL that uses them and
  313. * recompile DynaComm and ALL connector DLL's.
  314. * If you really have to change one of these items, DynaComm will no longer
  315. * be compatible with earlier settings files or connector DLL's.
  316. * I WARNED YOU!
  317. *
  318. ******************************************************************************/
  319. #define ITMSETUP 3 /* seh nova 005 */
  320. #define IDDBCOMM 7
  321. #define ITMBD110 11
  322. #define ITMBD300 12
  323. #define ITMBD600 13 /* mbbx 2.00: support 600 baud */
  324. #define ITMBD120 14
  325. #define ITMBD240 15
  326. #define ITMBD480 16
  327. #define ITMBD960 17
  328. #define ITMBD192 18
  329. #define ITMDATA4 21 /* not used */
  330. #define ITMDATA5 22
  331. #define ITMDATA6 23
  332. #define ITMDATA7 24
  333. #define ITMDATA8 25
  334. #define ITMSTOP1 31
  335. #define ITMSTOP5 32
  336. #define ITMSTOP2 33
  337. #define ITMNOPARITY 41
  338. #define ITMODDPARITY 42
  339. #define ITMEVENPARITY 43
  340. #define ITMMARKPARITY 44
  341. #define ITMSPACEPARITY 45
  342. #define ITMXONFLOW 51
  343. #define ITMHARDFLOW 52
  344. #define ITMNOFLOW 53
  345. #define ITMETXFLOW 54 /* jtfx 2.01.75 ... */
  346. #define ITMCONNECTOR 61
  347. #define ITMPARITY 91
  348. #define ITMCARRIER 92
  349. #endif /* NEED_DCRC */
  350. /* WINCIM typedef's */
  351. typedef CONNECTOR_CONTROL_BLOCK CCB;
  352. typedef CCB FAR * LPCCB;