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.

1731 lines
55 KiB

  1. #include "fsemacro.h" // rjs - macros for dynacomm
  2. #include <io.h> /* for open,read,write,close file crt -sdj*/
  3. #include <string.h> /* for strncpy -sdj */
  4. #include <stdio.h> /* for sprintf sscanf -sdj */
  5. #include <fcntl.h> /*added cause CRT's need defines*/
  6. #include <sys\types.h>
  7. #include <sys\stat.h>
  8. #include "asm2c_32.h"
  9. /*****************************************************************************/
  10. /* Compilation Switches */
  11. /*****************************************************************************/
  12. #ifdef DEBUG
  13. #define DEBOUT(a,b) DbgPrint("WIN32DEBUG: " a, (b));
  14. #else
  15. #define DEBOUT(a,b)
  16. #endif
  17. #define DEBUG_FLAG FALSE
  18. #define DEBUG_FLAG1 (DEBUG_FLAG & 0x0002)
  19. #define NULL_PORT TRUE /* enables DynaComm to function */
  20. /* without a valid COMM PORT */
  21. /*****************************************************************************/
  22. /* Type Definitions */
  23. /*****************************************************************************/
  24. typedef BYTE STRING; /* denotes PASCAL-type string */
  25. typedef BYTE * Ptr;
  26. typedef BYTE HUGE_T * HPSTR;
  27. typedef VOID (NEAR *procPtr)();
  28. typedef HWND ControlHandle;
  29. /*****************************************************************************/
  30. typedef enum {KBD_LOCK, KBD_UNLOCK, KBD_ECHO, KBD_BUFFER, KBD_WAIT} KBD_STATE;
  31. typedef enum {ICS_NONE, ICS_BRITISH, ICS_DANISH, ICS_FINISH,
  32. ICS_FRENCH, ICS_CANADIAN, ICS_GERMAN, ICS_ITALIAN,
  33. ICS_SPANISH, ICS_SWEDISH, ICS_SWISS, ICS_MAXTYPE} ICS_TYPE;
  34. typedef enum {XFRNORMAL, XFRCHAR, XFRLINE} TTXTTYPE;
  35. typedef enum {XFRCHRDELAY, XFRCHRWAIT} TCHRTYPE;
  36. typedef enum {XFRLINDELAY, XFRLINWAIT} TLINTYPE;
  37. typedef enum {BNEITHER, BPAUSE, BWHEN, BBOTH} BREAKCOND;
  38. typedef enum {EXNONE, EXVPOS, EXHPOS, EXSCS, EXSETMODE, EXRESETMODE} ESCEXTEND;
  39. typedef enum {TBLBEGINLINE, TBLNONSPACE, TBLONESPACE, TBLSPACES} TBLPOS;
  40. typedef enum {XFRNONE, XFRSND, XFRRCV, XFRTYP, XFRBSND, XFRBRCV} XFERFLAG;
  41. typedef enum {GRNONE, GRSEMI, GRHIGH, GRMEDM} VIDGRAPHICS;
  42. typedef enum {XFRDYNACOMM, XFRXMODEM, XFRYMODEM, XFRKERMIT, XFRYTERM} tBinType;
  43. typedef enum {XFRBOTH, XFRDATA, XFRRESOURCE} tBinFork;
  44. /*****************************************************************************/
  45. /* Constant Definitions */
  46. /*****************************************************************************/
  47. #define PATHLEN 80
  48. #define FILENAMELEN 32 // -sdj 12 is really bad if you have ntfs names 12
  49. #define ESCSKIPNDX 32 /* used: resetEmul (itutil1.c) */
  50. #define MAXTIMERNUM 3 /* mbbx 2.00: multiple timers */
  51. /*****************************************************************************/
  52. /* STANDARD CHARACTER CONSTANTS */
  53. #define CR 13 /* Carriage return */
  54. #define LF 10 /* Line Feed */
  55. #define SP 32 /* Space */
  56. #define TAB 9 /* Tab */
  57. #define FF 12 /* Form Feed */
  58. #define BS 8 /* BackSpace */
  59. #define ESC 27 /* Escape */
  60. #define BELL 7 /* Bell */
  61. #define CHFILL 32 /* buffer fill char. */
  62. #define XOFF 19 /* XOFF */
  63. #define XON 17 /* XON */
  64. #define CNTRLZ 26 /* end of file ^Z */
  65. #define CNTRLC 3 /* ^C same song second CHETX */
  66. #define CHSOH 1
  67. #define CHSTX 2
  68. #define CHETX 3
  69. #define CHEOT 4
  70. #define CHACK 6
  71. #define CHNAK 21
  72. #define CHCAN 24
  73. #define CHTIMEOUT -1
  74. #define CHQUOTE '"' /* mbbx 1.04: REZ... */
  75. #define CHSQUOTE '\''
  76. /* SYSTEM CONSTANTS */
  77. #define KILOBYTES * 1024
  78. #define KILOBYTESL * 1024L
  79. #define MEGABYTES * 1024 KILOBYTES
  80. #define MEGABYTESL * 1024 KILOBYTESL
  81. #define MAXUNSIGNEDINT 64 KILOBYTES - 1
  82. #define MAXUNSIGNEDINTL 64 KILOBYTESL - 1
  83. #define MAXINT 32 KILOBYTES - 1
  84. #define MININT -1 * MAXINT
  85. #define MAXINTL 32 KILOBYTESL -1
  86. #define MAXLONGINT 2048 MEGABYTESL
  87. #define MINLONGINT -1 * MAXLONGINT
  88. #define MAXUNSIGNEDCHAR 255
  89. #define TERM_MAXCHAR 127 /* changed from MAXCHAR to avoid conflict*/
  90. /* MAXCHAR was not used in any files anyway-sdj*/
  91. #define MILLISECONDS * 1
  92. #define SECONDS * 1000 MILLISECONDS
  93. #define versSettings 4
  94. #define STR255 256 /* Faking Pascal str255 type */
  95. #define DONTCARE 0xff /* General purpose don't care */
  96. #define MAXROWCOL MAXLONGINT /* Max. value for type ROWCOL */
  97. #define STANDARDKEY 0x00
  98. #define KEYPADKEY 0x01
  99. #define TERMINALFKEY 0x02
  100. #define SCROLLKEY 0x04
  101. #define SYSTEMFKEY 0xF0
  102. #define SHORTBREAK 0xFE /* Defined for serial short brk */
  103. #define LONGBREAK 0xFF /* Defined for serial long brk */
  104. #define DAYS_IN_A_YEAR 31+28+31+30+31+30+31+31+30+31+30+31
  105. #define SECS_IN_A_DAY 24l*60l*60l
  106. #define MAXSCREENLINE 23
  107. #define MINPOINTSIZE 6
  108. #define MAXPOINTSIZE 15 /* Maximum point size for the */
  109. /* terminal screen font */
  110. #define STATUSLINE 24
  111. #define UPDATETICKS 3
  112. #define YIELDCHARS 48 /* *** optimize this */
  113. /* ARRAY DECLARATOR CONSTANTS */
  114. #define LOCALMODEMBUFSZ 513 /* mbbx: previously 1024 */
  115. #define NINQUEUE 1024 /* mbbx 1.04: was 3072 */
  116. #define NOUTQUEUE 256 /* mbbx 1.04: was 512 */
  117. #define KEYSEQLEN 5
  118. #define SIZEOFEMULKEYINFO 50*KEYSEQLEN /* mbbx 2.00: was 52,44 */
  119. /* #define FKEYLEN 64 jtf 3.12 Max. sizeof funct. key text */
  120. #define DCS_FKEYLEVELS 4 /* Number of level keys */
  121. #define DCS_NUMFKEYS 8 /* Number of function keys */
  122. #define DCS_FKEYTITLESZ 20 /* Length of fkey title rkhx 2.00 */
  123. #define DCS_FKEYTEXTSZ 44 /* Length of fkey text rkhx 2.00 */
  124. #define DCS_NUMSYSVARS 10 /* rkhx 2.00 */
  125. #define MDMRESLEN 20
  126. #define TMPNSTR 255 /* Gen. purpose temp. string len*/
  127. #define MINRESSTR 32
  128. #define STATUSRECTBORDER 4
  129. #define SPACE 32 /* Space (yterm) */
  130. #define SERINBUFFSIZE LOCALMODEMBUFSZ /* mbbx: yterm */
  131. #define YTERMTIMEOUT 600
  132. /* VIRTUAL KEY STATE */
  133. #define VKS_SHIFT 0x0100 /* mbbx 1.04: keymap ... */
  134. #define VKS_CTRL 0x0200
  135. #define VKS_ALT 0x0400
  136. #define FKB_UPDATE_BKGD 0x0001 /* mbbx 2.00: fkey button options... */
  137. #define FKB_UPDATE_TIMER 0x0002
  138. #define FKB_DISABLE_CTRL 0x8000
  139. /* CHARACTER ATTRIBUTES */
  140. #define ANORMAL 0x00 /* mbbx 1.03 ... */
  141. #define ABOLD 0x01
  142. #define AREVERSE 0x02
  143. #define ABLINK 0x04
  144. #define AUNDERLINE 0x08
  145. #define APROTECT 0x10
  146. #define AGRAPHICS 0x20
  147. #define ADIRTY 0x40
  148. #define ACLEAR 0x80
  149. #define AMASK (ABOLD | AREVERSE | ABLINK | AUNDERLINE | APROTECT)
  150. #define ANOTGRAPHICS ~AGRAPHICS
  151. /* LINE ATTRIBUTES */
  152. #define LNORMAL 0
  153. #define LHIGHTOP 1
  154. #define LHIGHBOTTOM 2
  155. #define LWIDE 3
  156. #define LATTRIB 132
  157. #define LFLAGS 133
  158. #define LDIRTY 0x01
  159. #define LCLEAR 0x02
  160. #define ATTRROWLEN 134
  161. /* FILE ERROR CONSTANTS */
  162. #define NOERR FALSE /* No file error flag value */
  163. #define EOFERR 262
  164. #define FERR_FILENOTFOUND 2
  165. #define FERR_PATHNOTFOUND 3
  166. #define FERR_TOOMANYOPENFILES 4
  167. #define FERR_ACCESSDENIED 5
  168. #define FERR_INVALIDACCESS 12
  169. #define FERR_INVALIDFILENAME 257
  170. #define FERR_OPEN 258
  171. #define FERR_READ 259
  172. #define FERR_FILELENGTH 260
  173. #define FERR_CLOSE 261
  174. /* rkhx 2.00 ... */
  175. #if OLD_CODE /* mbbx 2.00: using bit fields... */
  176. /* commFlags */
  177. #define DCS_CF_RESETDEVICE 0x8000 /* select new comm device */
  178. #endif
  179. /* termFlags */
  180. #define DCS_TF_SCROLLBARS 0x0001 /* show terminal scroll bars */
  181. /* modemFlags */
  182. #define DCS_MF_USEDEFAULT 0x0001 /* use default modem settings */
  183. /* communication flags */ /* rjs bug2 */
  184. #define DCS_CF_NETNAMEPADDING 0x0001 /* if set, then use blank padding in NetBios names, else null */
  185. /* environmentFlags */
  186. #define DCS_EVF_FKEYSSHOW 0x0001 /* show fkeys */
  187. #define DCS_EVF_FKEYSARRANGE 0x0002 /* auto arrange when shown */
  188. /* parentFlags */
  189. #define DCS_PF_ 0x0001 /* */
  190. #define DCS_FILE_ID 0x20534344 /* mbbx 2.00 ... */
  191. /* #define DCS_HEADERSZ 4 */
  192. #define DCS_VERSIONSZ 6
  193. #define DCS_DESCRIPTIONSZ 53
  194. #define DCS_PASSWORDSZ 16
  195. #define DCS_ANSWERBACKSZ 44
  196. #define DCS_FONTFACESZ 32
  197. #define DCS_XLINSTRSZ 24
  198. #define DCS_MODEMCMDSZ 32
  199. #define DCS_FKEYNEXTSZ 20
  200. #define DCS_SYSVARSZ 44
  201. #define DCS_DCINITAGSZ 16
  202. #if OLD_CODE
  203. /* FILE DIALOG BOX ATTRIBUTE CONSTANTS */
  204. #define GETFILE 0x0001
  205. #define PUTFILE 0x0002
  206. #define VIEWTXTFILE 0x0004
  207. #define SENDTXTFILE 0x0008
  208. #define MACFILETYPE 0x0010
  209. #define APPENDTXTFILE 0x0020
  210. #define SENDFILE 0x0040
  211. #define FORCEXTENSION 0x0080
  212. #define RECEIVEFILE 0x0100
  213. #define EXECUTEFILE 0x0200
  214. #define PRINTFILE 0x0400
  215. #define REMOTEFILE 0x0800
  216. #endif
  217. /* strings constants: */
  218. #define DC_WNDCLASS "DC_Term" /* mbbx 1.04: REZ... */
  219. #define HEX_STR "0123456789ABCDEF" /* mbbx 2.00 */
  220. #define NULL_STR "\0" /* mbbx 1.00: 00 00 */
  221. #define VOID_STR "\1\0" /* mbbx 1.00: 01 00 00 */
  222. #define PRMPT_STR "\1?"
  223. #define LABEL_STR "\1*"
  224. #define SPACE_STR "\1 "
  225. #define SEMI_STR "\1;"
  226. #define TIME_STR "\800:00:00"
  227. #define OK_STR "\2OK"
  228. #define VIDEO_STR "\5VIDEO"
  229. #define CRLF_STR "\2\015\012"
  230. #define DBG_FNL_STR "["
  231. #define DBG_FNR_STR "]\r\n"
  232. #define MSDOS_STR "MSDOS"
  233. #define VT100_STR "VT-100"
  234. #define PAR2_STR "PAR2"
  235. #define TEXT_STR "TEXT"
  236. #define PARM_STR "PARM"
  237. #define CCL_STR "CCL "
  238. #define YT_WSA_STR "\3WSA"
  239. #define YT_W43_STR "\3W43"
  240. #define YT_RSA_STR "\3RSA"
  241. #define YT_R43_STR "\3R43"
  242. #define YT_CRC_STR "\02##"
  243. #define YT_RESP_STR "012345"
  244. /*****************************************************************************/
  245. /* Data File Definitions */
  246. /*****************************************************************************/
  247. typedef enum {FILE_NDX_DATA, FILE_NDX_SETTINGS, FILE_NDX_TASK,
  248. FILE_NDX_SCRIPT, FILE_NDX_MEMO, MAX_FILE_NDX} FILEDOCTYPE;
  249. #define DATA_FILE_TYPE "\\*.*"
  250. #define SETTINGS_FILE_TYPE "\\*.TRM"
  251. #define TASK_FILE_TYPE "\\*.TXT"
  252. #define SCRIPT_FILE_TYPE "\\*.TXT"
  253. #define MEMO_FILE_TYPE "\\*.TXT"
  254. #define ANY_FILE_TYPE "\\*.*"
  255. #define NO_FILE_TYPE "\\*." /* mbbx 2.00 */
  256. #define INI_FILE_TYPE "\\*.INI"
  257. #define EXE_FILE_TYPE "\\*.EXE"
  258. #define DRIVER_FILE_TYPE "\\*.DRV" /* mbbx 2.00 ... */
  259. /* #define TERMINAL_FILE_TYPE "\\*.TRM" mbbx 2.00: no forced extents */
  260. #define FILEDOCDATA struct tagFileDocData
  261. struct tagFileDocData
  262. {
  263. BYTE filePath[PATHLEN];
  264. BYTE fileName[16];
  265. BYTE fileExt[16];
  266. BYTE title[PATHLEN];
  267. } fileDocData[MAX_FILE_NDX];
  268. /*
  269. struct tagFileDocData
  270. {
  271. BYTE filePath[FO_MAXPATHLENGTH];
  272. BYTE fileName[FO_MAXFILELENGTH];
  273. BYTE fileExt[FO_MAXEXTLENGTH];
  274. BYTE title[FO_MAXPATHLENGTH];
  275. } fileDocData[MAX_FILE_NDX];
  276. */
  277. /* #define ATTRDIRLIST 0x4010 */
  278. INT saveFileType; /* mbbx 2.00: save prev file type... */
  279. /*****************************************************************************/
  280. /* Structure Definitions */
  281. /*****************************************************************************/
  282. /* rkhx 2.00 */
  283. /* obsolete
  284. typedef
  285. struct {
  286. BYTE title[TITLELEN];
  287. BYTE xtra[XTRALEN];
  288. } TITLEREC;
  289. */
  290. // -sdj this is the portable way to pack the structures 1 byte aligned.
  291. // win3.0 sources are compiled with -Zp option so that the structures are
  292. // byte aligned. This pragma would work for MIPS and X86 MS compilers
  293. #ifdef ORGCODE
  294. #else
  295. #pragma pack(1)
  296. #endif
  297. typedef
  298. struct {
  299. /* House keeping: 86 + 42 = 128 bytes */
  300. LONG fileID; /* mbbx 2.00 ... */
  301. /* BYTE header[DCS_HEADERSZ]; header ('DCS ') */
  302. BYTE version[DCS_VERSIONSZ]; /* version (2.00: ) */
  303. BYTE description[DCS_DESCRIPTIONSZ]; /* description */
  304. BYTE controlZ; /* fake eof for typing text */
  305. WORD fileSize; /* file size */
  306. WORD crc; /* crc check */
  307. WORD groupSave; /* global save params flag DCS_GS_... */
  308. BYTE password[DCS_PASSWORDSZ]; /* password */
  309. BYTE headerXtraRoom[42]; /* extra room for header section */
  310. /* Communications: (7 + 5) + (7 + 5) + (98 + 6) = 128 bytes */
  311. WORD fParity: 1; /* mbbx 2.00: bit fields... */
  312. WORD fCarrier: 1;
  313. WORD commFlags: 13; /* communication settings DCS_CF_... */
  314. WORD fResetDevice: 1;
  315. BYTE newDevRef; /* new comm device */
  316. BYTE comDevRef; /* comm device */
  317. BYTE comExtRef; /* comm extension */
  318. BYTE comPortRef; /* comm port */
  319. BYTE comModeRef;
  320. BYTE commXtraRoom1[5]; /* extra room for comm section */
  321. WORD speed; /* mbbx 2.00: allow ANY baud rate */
  322. BYTE dataBits;
  323. BYTE parity;
  324. BYTE stopBits;
  325. BYTE flowControl;
  326. BYTE priority; /* com priority (as per spooler) */
  327. BYTE commXtraRoom2[5]; /* extra room for comm section */
  328. BYTE localName[16]; /* used for deviceName */
  329. BYTE remoteName[64];
  330. BYTE deviceName[14]; /* used for deviceName */
  331. WORD netRcvTimeOut;
  332. WORD netSndTimeOut;
  333. BYTE commXtraRoom3[6]; /* extra room for comm section */
  334. /* Terminal: 94 + 34 = 128 bytes */
  335. WORD termFlags: 12;
  336. WORD fInpLFCR: 1;
  337. WORD fBSKey: 1;
  338. WORD fHideTermHSB: 1;
  339. WORD fHideTermVSB: 1;
  340. BYTE emulate; /* terminal emulation */
  341. BYTE fCtrlBits; /* mbbx 1.10: VT220 8BIT */
  342. BYTE answerBack[DCS_ANSWERBACKSZ]; /* answer back string */
  343. BYTE lineWrap;
  344. BYTE localEcho;
  345. BYTE sound;
  346. BYTE inpCRLF;
  347. BYTE outCRLF;
  348. BYTE columns;
  349. BYTE termCursor;
  350. BYTE cursorBlink;
  351. BYTE fontFace[DCS_FONTFACESZ]; /* font face */
  352. WORD fontSize; /* font point size */
  353. WORD language; /* mbbx 1.04 */
  354. WORD bufferLines; /* terminal scroll buffer size */
  355. /**** nov25,91 win31 added 2 bytes here! -sdj ********************/
  356. /**** to compensate the xtra room was reduced by 2 bytes 34->32 -sdj *********/
  357. BYTE setIBMXANSI;
  358. BYTE useWinCtrl;
  359. BYTE termXtraRoom[32]; /* extra room for terminal section */
  360. /* Binary Transfers: 9 + 119 = 128 bytes */
  361. WORD binXferFlags; /* binary transfer state DCS_BXF_... */
  362. BYTE xBinType;
  363. WORD rcvBlSz;
  364. WORD sendBlSz;
  365. BYTE retryCt;
  366. BYTE psChar; /* mbbx 1.04: xferPSChar */
  367. BYTE binXferXtraRoom[119]; /* extra room for bin xfer section */
  368. /* Text Transfers: 33 + 95 = 128 bytes */
  369. WORD txtXferFlags; /* text transfer state DCS_TXF_... */
  370. BYTE xTxtType;
  371. BYTE xChrType;
  372. BYTE xChrDelay;
  373. BYTE xLinType;
  374. BYTE xLinDelay;
  375. BYTE xLinStr[DCS_XLINSTRSZ];
  376. BYTE xWordWrap;
  377. BYTE xWrapCol;
  378. BYTE txtXferXtraRoom[95]; /* extra room for txt xfer section */
  379. /* Phone: 38 + 90 = 128 bytes */
  380. WORD phoneFlags; /* phone state DCS_PHF_... */
  381. BYTE phone[DCS_MODEMCMDSZ];
  382. BYTE dlyRetry;
  383. BYTE cntRetry;
  384. BYTE flgRetry;
  385. BYTE flgSignal;
  386. BYTE phoneXtraRoom[90]; /* extra room for phone section */
  387. /* Modem: 387 + 253 = 640 bytes */
  388. WORD modemFlags; /* modem state DCS_MF_... */
  389. BYTE xMdmType;
  390. BYTE dialPrefix[DCS_MODEMCMDSZ];
  391. BYTE dialSuffix[DCS_MODEMCMDSZ];
  392. BYTE hangPrefix[DCS_MODEMCMDSZ];
  393. BYTE hangSuffix[DCS_MODEMCMDSZ];
  394. BYTE binTXPrefix[DCS_MODEMCMDSZ];
  395. BYTE binTXSuffix[DCS_MODEMCMDSZ];
  396. BYTE binRXPrefix[DCS_MODEMCMDSZ];
  397. BYTE binRXSuffix[DCS_MODEMCMDSZ];
  398. BYTE answer[DCS_MODEMCMDSZ];
  399. BYTE originate[DCS_MODEMCMDSZ];
  400. BYTE fastInq[DCS_MODEMCMDSZ]; /* mbbx 2.00: not used */
  401. BYTE fastRsp[DCS_MODEMCMDSZ]; /* mbbx 2.00: not used */
  402. BYTE modemXtraRoom[221]; /* extra room for modem section */
  403. BYTE phone2[DCS_MODEMCMDSZ]; /* mbbx 2.00: not used */
  404. /* Environment: 2510 + 50 = 2560 bytes */
  405. WORD environmentFlags; /* environment state DCS_EVF_... */
  406. BYTE fKeyNext[DCS_FKEYNEXTSZ];
  407. BYTE fKeyTitle[DCS_FKEYLEVELS][DCS_NUMFKEYS][DCS_FKEYTITLESZ]; /* 4 * 8 * 20 = 640 */
  408. BYTE fKeyText[DCS_FKEYLEVELS][DCS_NUMFKEYS][DCS_FKEYTEXTSZ]; /* 4 * 8 * 44 = 1408 */
  409. BYTE systemVariables[DCS_NUMSYSVARS][DCS_SYSVARSZ]; /* 10 * 44 = 440 */
  410. BYTE environmentXtraRoom[50]; /* extra room for environment section */
  411. /* Parent: 42 + 86 = 128 bytes */
  412. WORD parentFlags; /* arrange/stack flags DCS_PF_... */
  413. SHORT dummy1;
  414. SHORT dummy2;
  415. SHORT dummy3;
  416. SHORT dummy4;
  417. BYTE keyMapTag[DCS_DCINITAGSZ]; /* key remapping tag (.ini file) */
  418. BYTE videoAttrTag[DCS_DCINITAGSZ]; /* video tag (.ini file) */
  419. BYTE szConnectorName[DCS_DCINITAGSZ]; /* slc nova 031 bjw nova 001 Connector DLL file name */
  420. BYTE connectorConfigData[32]; /* slc nova 028 */
  421. BYTE parentXtraRoom[86 - DCS_DCINITAGSZ - 32 ]; /* extra room for parent section */
  422. } recTrmParams;
  423. typedef recTrmParams FAR *LPSETTINGS;
  424. #ifdef ORGCODE
  425. #else
  426. #pragma pack()
  427. #endif
  428. typedef
  429. struct {
  430. LONG row;
  431. LONG col;
  432. } ROWCOL;
  433. typedef
  434. struct {
  435. GLOBALHANDLE hText;
  436. RECT viewRect;
  437. LONG selStart;
  438. LONG selEnd;
  439. BOOL active;
  440. FARPROC clikLoop;
  441. HFONT hFont;
  442. } tEHandle;
  443. #define TF_CHANGED 0x8000
  444. #define TF_NOCLOSE 0x4000
  445. #define TF_DIM 0x2000
  446. #define TF_HIDE 0x1000
  447. #define TF_DEFTITLE 0x0010
  448. typedef
  449. struct
  450. {
  451. BYTE filePath[PATHLEN+1];
  452. BYTE fileName[FILENAMELEN+1];
  453. BYTE fileExt[FILENAMELEN+1];
  454. BYTE title[PATHLEN+1];
  455. WORD flags;
  456. } curDataRec;
  457. typedef
  458. struct {
  459. BOOL good;
  460. BYTE vRefNum[PATHLEN+1];
  461. BYTE fName[PATHLEN+1];
  462. } FSReply;
  463. typedef
  464. struct {
  465. WORD hour;
  466. WORD minute;
  467. WORD second;
  468. WORD dayOfWeek; /* 0 = Sunday ... 6 = Saturday */
  469. WORD mm; /* Month (1 - 12) */
  470. WORD dd; /* Day (1 - 31) */
  471. WORD yy; /* Year (1980 - 2099) */
  472. } DOSTIME;
  473. typedef
  474. struct {
  475. BYTE fdType[4];
  476. BYTE fdCreator[4];
  477. INT fdFlags;
  478. DWORD ioFlLgLen;
  479. DWORD ioFlRLgLen;
  480. LONG ioFlCrDat;
  481. LONG ioFlMdDat;
  482. } PARAMBLOCKREC;
  483. typedef
  484. struct {
  485. BYTE reserved[21];
  486. BYTE attribute;
  487. WORD time;
  488. WORD date;
  489. LONG size;
  490. BYTE filename[14];
  491. } DTA;
  492. typedef DTA FAR *LPDTA;
  493. /*****************************************************************************/
  494. /* Variable Definitions */
  495. /*****************************************************************************/
  496. /* WORD winVersion; */
  497. INT itemHit;
  498. BOOL doneFlag; /* End of DynaComm - Flag */
  499. BOOL cancelAbort; /* Abort spooling process ? */
  500. DWORD dwWriteFileTimeout; /* used for wait after writefile*/
  501. BYTE MaxComPortNumberInMenu; /* N in max ComN, just now 4 */
  502. BYTE bPortDisconnected; /* this flag is used to indicate that
  503. the specified port is no longer accesible
  504. user should select some other port. Typically
  505. this will happen when user presses cntl-c or
  506. quit at the telnet prompt, and after this the
  507. right thing to do is to close this port and
  508. prompt user to select other port */
  509. int WindowXPosition; // x cord for createwindow
  510. int WindowYPosition; // y cord for createwindow
  511. int WindowWidth; // width for createwindow
  512. int WindowHeight; // height for createwindow
  513. CHAR szCurrentPortName[TMPNSTR+1]; // this variable will contain the name
  514. // of port which terminal attempted an open on
  515. BOOL bPortIsGood; /* to indicate that the port is good*/
  516. typedef struct _ComNumAndName {
  517. BYTE Index;
  518. CHAR PortName[TMPNSTR+1];
  519. } COMMNUMANDNAME, *PCOMMNUMANDNAME;
  520. COMMNUMANDNAME arComNumAndName[20];
  521. BOOL activTerm; /* Active terminal flag */
  522. POINT nScrollRange;
  523. POINT nScrollPos; /* port macro added MPOINT*/
  524. BOOL noSelect; /* rjs bugs 020 */
  525. BOOL activSelect;
  526. BOOL answerMode; /* Answer mode flag */
  527. BOOL mdmValid;
  528. BOOL cursorValid;
  529. BOOL debugFlg; /* Monitor mode (dis)enabled ? */
  530. BOOL prtFlag;
  531. BOOL transPrintFlag; /* rjs bug2 */
  532. BOOL prtPause;
  533. BOOL escSeq; /* Incoming are part of escSeq */
  534. BOOL ansi;
  535. BOOL escAnsi;
  536. BOOL escGraphics;
  537. BOOL escCursor;
  538. BOOL escVideo;
  539. BOOL statusLine; /* Status line enabled ? */
  540. BOOL chInsMode;
  541. BOOL vidInverse;
  542. BOOL cursorKeyMode;
  543. BOOL keyPadAppMode;
  544. BOOL originMode;
  545. BOOL grChrMode;
  546. BOOL cursorOn;
  547. BOOL dialing;
  548. BOOL cursBlinkOn;
  549. BOOL scrapSeq;
  550. BOOL outBufSeq;
  551. BOOL copiedTable;
  552. BOOL useScrap;
  553. BOOL mdmOnLine;
  554. BOOL timerActiv;
  555. BOOL useMacFileName;
  556. BOOL vScrollShowing;
  557. BOOL later;
  558. BOOL bufferFull;
  559. BOOL fKeysShown;
  560. BOOL protectMode; /* mbbx: emulation */
  561. BYTE szAppClass[20]; /* rjs bug2 */
  562. BYTE szAppName_private[20]; /* Windows registered name */
  563. BYTE szAppName[20]; /* Windows name */
  564. BYTE szMessage[80]; /* Tiled window caption */
  565. BYTE serBytes[LOCALMODEMBUFSZ]; /* Our IT local modem buffer */
  566. BYTE attrib[25][134]; /* Screen attribute map */
  567. BYTE curAttrib; /* Current character attribute */
  568. BYTE ch; /* Modem character */
  569. BYTE theChar; /* Modem character - all 7 bits */
  570. BYTE the8Char; /* Modem character - all 8 bits */
  571. BYTE tabs[132];
  572. BYTE fileVolume[80];
  573. BYTE macFileName[PATHLEN+1];
  574. BYTE charSet[2];
  575. BYTE chAscii;
  576. BYTE emulInfo[128];
  577. BYTE icsXlateTable[256]; /* mbbx 1.04: ics */
  578. BYTE ansiXlateTable[256]; /* mbbx 1.06A: ics new xlate */
  579. WORD keyMapState; /* mbbx 1.04: keymap */
  580. STRING mdmResult[MDMRESLEN]; /* Non-displayed modem chars. */
  581. STRING line25[132]; /* Status line 25 characters */
  582. STRING strAnsi[STR255];
  583. STRING outBuf[134];
  584. STRING fKeyStr[STR255];
  585. STRING keyPadString[5];
  586. /*---------------------------------------------------------------------------*/
  587. XFERFLAG xferFlag;
  588. BOOL xferStopped;
  589. INT xferErrors;
  590. LONG xferLength;
  591. HANDLE xferBufferHandle; /* rjs bugs 016 */
  592. WORD xferBufferCount; /* rjs bugs 016 */
  593. INT xferRefNo;
  594. STRING xferVRefNum[PATHLEN];
  595. STRING xferFname[PATHLEN];
  596. STRING rdCH[256];
  597. int ioCnt; /* flagged by port macro*/
  598. WORD xferMenuAdds;
  599. INT xferSndLF; /* mbbx: (-1,0,1)=>(NOLF,CR,CRLF) */
  600. WORD xferViewPause; /* mbbx: auto line count */
  601. WORD xferViewLine;
  602. INT xferBlkNumber;
  603. INT xferPct;
  604. INT xferLinDelay;
  605. INT xferChrDelay;
  606. BOOL xferPaused;
  607. BOOL xferBreak; /* mbbx 2.00: xfer ctrls */
  608. BOOL xferSaveCtlChr;
  609. BOOL xferTableSave;
  610. BOOL xferWaitEcho;
  611. BOOL xferAppend;
  612. BOOL xferFast;
  613. BYTE xferCharEcho;
  614. BYTE xferPSChar; /* mbbx 1.02: packet switching */
  615. STRING xferLinStr[DCS_XLINSTRSZ]; /* rkhx 2.00 */
  616. STRING strRXBytes[32];
  617. STRING strRXErrors[32];
  618. STRING strRXFname[32];
  619. STRING strRXFork[4];
  620. TTXTTYPE xferTxtType;
  621. TCHRTYPE xferChrType;
  622. TLINTYPE xferLinType;
  623. tBinType xferBinType;
  624. tBinFork xferBinFork;
  625. LONG xferEndTimer;
  626. LONG xferOrig;
  627. LONG xferBlkSize;
  628. LONG xferRLgLen;
  629. LONG xferLgLen;
  630. LONG xferBytes;
  631. LPBYTE xferBuffer;
  632. CHAR NoMemStr[41];
  633. /*---------------------------------------------------------------------------*/
  634. INT serNdx; /* Index into local modem buff. */
  635. INT serCount; /* Index comm. buffer */
  636. INT curCol;
  637. INT curLin;
  638. INT maxChars;
  639. INT maxLines;
  640. INT escChar;
  641. INT escSkip;
  642. BOOL termDirty; /* mbbx: used to be termLine */
  643. INT savTopLine;
  644. INT curTopLine;
  645. INT savLeftCol;
  646. INT chrWidth, stdChrWidth;
  647. INT chrHeight, stdChrHeight;
  648. INT scrRgnBeg;
  649. INT scrRgnEnd;
  650. INT escCol;
  651. INT escLin;
  652. INT curLeftCol;
  653. INT maxScreenLine; /* Windows only */
  654. INT visScreenLine; /* Windows only */
  655. INT curLevel;
  656. INT vidBG;
  657. INT textIndex;
  658. INT outBufCol;
  659. INT fKeyNdx;
  660. INT keyPadIndex;
  661. HANDLE sPort; /* Serial port id win32 */
  662. INT portLocks; /* number of unreleased getPorts*/
  663. BOOL sPortErr;
  664. INT lineFeeds;
  665. INT seqTableNdx;
  666. INT progress;
  667. INT decScs;
  668. INT shiftCharSet;
  669. INT activCursor;
  670. INT scrollBegin;
  671. INT scrollEnd;
  672. INT nScroll;
  673. INT fKeysHeight; /* (mbbx) */
  674. INT ctrlsHeight; /* mbbx 1.04 */
  675. ESCEXTEND escExtend;
  676. TBLPOS tblPos;
  677. VIDGRAPHICS vidGraphics;
  678. KBD_STATE kbdLock;
  679. DWORD gIdleTimer; /* rjs bug2 001 */
  680. LONG lastChTick;
  681. LONG timPointer;
  682. LONG cursorTick;
  683. LONG dialStart;
  684. LONG textLength;
  685. /* \\\ Long Pointers /// */
  686. LPBYTE textPtr;
  687. HWND hItWnd; /* Application Window Handle */
  688. HWND hTermWnd; /* Window handle to terminal */
  689. HWND hdbmyControls; /* Window handle to fkey dlg. */
  690. HWND hdbXferCtrls; /* mbbx 1.04: term ctrls */
  691. HWND hEdit;
  692. HWND fKeyHdl;
  693. HWND hwndThread; // rjs thread
  694. DWORD dwTimerRes; // rjs thread
  695. HWND commThread; // rjs thread
  696. BOOL CommThreadExit; // sdj thread
  697. BOOL gotCommEvent; // rjs thread
  698. HANDLE overlapEvent; // rjs thread
  699. BOOL gbThreadDoneFlag; // rjs thread
  700. HANDLE hMutex; // rjs thread
  701. BOOL gbXferActive; // rjs thread
  702. BOOL bgOutStandingWrite; /* slc swat */
  703. ControlHandle xferCtlStop;
  704. ControlHandle xferCtlPause;
  705. ControlHandle xferCtlScale;
  706. ControlHandle fKeyHandles[DCS_NUMFKEYS+1];
  707. HDC hPrintDC;
  708. HDC thePort;
  709. HBRUSH theBrush;
  710. HBRUSH blackBrush;
  711. HMENU hMenu;
  712. WORD sysAppMenu[16]; /* mbbx 2.00.03: control app menu */
  713. HMENU hEditMenu; /* Edit popup for Terminal WND */
  714. HMENU hLastEdit;
  715. HANDLE hInst;
  716. HANDLE hIconLib; /* mbbx 1.10: DCICONS.LIB */
  717. HANDLE hemulKeyInfo;
  718. HANDLE tEScrapHandle;
  719. HANDLE hDevNames;
  720. HANDLE hDevMode;
  721. HBITMAP hCloseBox; /* mbbx: mdi */
  722. HANDLE hDCCLib; /* mbbx 2.00: compile */
  723. HWND hDCCDlg; /* mbbx 2.00: compile */
  724. MSG msg; /* Application queue messages */
  725. RECT cursorRect; /* Rectangle of the current curs*/
  726. RECT timerRect;
  727. RECT statusRect; /* CCL commands show up in here */
  728. POINT lastPoint; /* last hTermWnd client point */
  729. DOSTIME startTimer[MAXTIMERNUM]; /* mbbx 2.00: multiple timers */
  730. DOSTIME lastTime;
  731. recTrmParams trmParams; /* Contains global 'settings' */
  732. tEHandle hTE; /* Main text edit window struct */
  733. curDataRec termData; /* Current data associated w/ */
  734. /* terminal window */
  735. PARAMBLOCKREC xferParams;
  736. struct icontype
  737. {
  738. HICON hIcon;
  739. INT last;
  740. BOOL flash;
  741. INT dy;
  742. INT dx;
  743. } icon;
  744. struct /* mbbx 2.00: intl date/time... */
  745. {
  746. INT iDate; /* 0=MDY, 1=DMY, 2=YMD */
  747. BYTE sDate[2]; /* date separator */
  748. INT iTime; /* 0=12HR, 1=24HR */
  749. BYTE sTime[2]; /* time separator */
  750. BYTE s1159[4]; /* AM trailing string */
  751. BYTE s2359[4]; /* PM trailing string */
  752. } intlData;
  753. /* \\\ Functions & Procedures /// */
  754. /* FARPROC lpdbPortInit; mbbx: now local */
  755. /* mbbx 1.04: obsolete...
  756. FARPROC lpitWndProc;
  757. FARPROC lptrmWndProc;
  758. FARPROC lpSizeBoxProc;
  759. FARPROC lpdbStdFN;
  760. FARPROC lpdbGetPutFN;
  761. FARPROC lpdbTypTFile;
  762. FARPROC lpdbRcvTFile;
  763. FARPROC lpdbSendFile;
  764. FARPROC lpdbPrompt;
  765. FARPROC lpdbSelSavApp;
  766. FARPROC lpdbPhon;
  767. FARPROC lpdbEmul;
  768. FARPROC lpdbTerm;
  769. FARPROC lpdbFkey;
  770. FARPROC lpdbTxtX;
  771. FARPROC lpdbBinX;
  772. FARPROC lpdbComm;
  773. FARPROC lpdbModem;
  774. FARPROC lpEditProc;
  775. */
  776. procPtr termState;
  777. procPtr escHandler;
  778. procPtr pEscTable[128];
  779. procPtr aEscTable[128];
  780. procPtr pProcTable[72]; /* mbbx 2.00 ... */
  781. procPtr aProcTable[72];
  782. procPtr ansiParseTable[16];
  783. /* KERMIT STUFF */
  784. #define DEL 127 /* Delete (rubout) */
  785. /* crt also defines EOF so dont define this twice -sdj*/
  786. #ifndef EOF
  787. #define EOF -1
  788. #endif
  789. #define DEFESC '^' /* Default escape character for CONNECT */
  790. #define DEFIM TRUE /* Default image mode */
  791. #define DEFFNC FALSE
  792. #define KERFILE 1 /* bufemp goes to a file */
  793. #define KERBUFF 2 /* bufemp goes to KER_buff */
  794. #define KERSCREEN 4 /* bufemp goes to the screen */
  795. #define tochar(ch) ((ch) + ' ')
  796. #define unchar(ch) ((ch) - ' ')
  797. #define ctl(ch) ((ch) ^ 64 )
  798. #define unpar(ch) ((ch) & 127)
  799. INT
  800. KER_size, /* Size of present data */
  801. KER_rpsiz, /* Maximum receive packet size */
  802. KER_spsiz, /* Maximum send packet size */
  803. KER_pad, /* How much padding to send */
  804. KER_timint, /* Timeout for foreign host on sends */
  805. KER_n, /* Packet number */
  806. KER_numtry, /* Times this packet retried */
  807. KER_oldtry, /* Times previous packet retried */
  808. ttyfd, /* File descriptor of tty for I/O, 0 if remote */
  809. KER_remote, /* -1 means we're a remote kermit */
  810. KER_image, /* -1 means 8-bit mode */
  811. KER_parflg, /* TRUE means use parity specified */
  812. KER_turn, /* TRUE means look for turnaround char (XON) */
  813. KER_lecho, /* TRUE for locally echo chars in connect mode */
  814. KER_8flag, /* TRUE means 8th bit quoting is done */
  815. KER_initState, /* jtf 3.20 Used for retries durring send/receive */
  816. KER_parMask, /* tge Used for auto parity selection */
  817. KER_mask, /* tge Used for auto parity checsum masking */
  818. KER_pktdeb, /* TRUE means log all packet to a file */
  819. KER_filnamcnv, /* -1 means do file name case conversions */
  820. KER_filecount, /* Number of files left to send */
  821. KER_timeout; /* TRUE means a timeout has occurred. */
  822. BYTE
  823. KER_state, /* Present state of the automaton */
  824. KER_cchksum, /* Our (computed) checksum */
  825. KER_padchar, /* Padding character to send */
  826. KER_eol, /* End-Of-Line character to send */
  827. KER_escchr, /* Connect command escape character */
  828. KER_quote, /* Quote character in incoming data */
  829. KER_select8, /* 8th bit quote character to send either 'Y' or '&'*/
  830. KER_firstfile,
  831. KER_getflag,
  832. **KER_filelist, /* List of files to be sent */
  833. *KER_filnam, /* Current file name */
  834. recpkt[94], /* Receive packet buffer */
  835. packet[94], /* Packet buffer */
  836. KER_buff[94], /* buffer for translations */
  837. outstr[80], /*output string for debugging and translations */
  838. KERRCVFLAG; /* direct recieved buffers to screen, file or buffer*/
  839. LONG
  840. KER_bytes; /* number of bytes received */
  841. /*
  842. 19 * 2 byte = 38 bytes
  843. 9 * 1 byte
  844. 2 * 4 bytes
  845. 3 * 94 bytes
  846. 1 * 80 bytes
  847. 1 * 1 byte = 380 bytes
  848. 1 * 4 bytes = 4 bytes
  849. 422 bytes total + room for filenames */
  850. /*****************************************************************************/
  851. /* Macro Definitions */
  852. /*****************************************************************************/
  853. #define proc void near
  854. #define getResId MAKEINTRESOURCE
  855. #define eraseRect(rectangle) FillRect(getPort(),(LPRECT) &rectangle, theBrush); releasePort()
  856. #define invalRect(rectangle) InvalidateRect(hTermWnd, (LPRECT) &rectangle)
  857. #define validRect(rectangle) ValidateRect(hTermWnd, (LPRECT) &rectangle)
  858. #define invertRect(rectanlge) InvertRect(getPort(), (LPRECT) &rectanlge); releasePort()
  859. #define tickCount() GetCurrentTime() * 60/1000
  860. #define TEDelete(h) SendMessage(h, WM_CLEAR, 0, 0L)
  861. #define sysBeep() MessageBeep(0)
  862. #define nullTerminate(str) str[*str+1] = 0
  863. #define strEquals(dst,src) memcpy(dst, src, (WORD) src[0] + 1), nullTerminate(dst)
  864. #define blockMove(src, dst, len) lmovmem(src, dst, (DWORD) len)
  865. #define equalString(str1, str2) !strcmpi(str1, str2)
  866. #define repeat do
  867. #define until(cond) while(!(cond))
  868. #define stringToNum(str,num) sscanf(&str[1], "%ld", num)
  869. #define c2p(str1, str2) lstrcpy((LPBYTE) &str1[1], (LPBYTE) str2), *str1 = lstrlen((LPBYTE) &str1[1])
  870. #define p2c(str1, str2) lmovmem((LPBYTE) &str2[1], (LPBYTE) str1, (unsigned) *str2), str1[*str2] = NULL
  871. #define SWAPBYTES(i) (((WORD) i >> 8) | (i << 8))
  872. #define yield(lpmsg, hWnd) PeekMessage(lpmsg, hWnd, 0, 0, FALSE)
  873. /*****************************************************************************/
  874. /* Forward Procedure Definitions */
  875. /*****************************************************************************/
  876. /*** INITCODE.C ***/
  877. //WORD MMain(HANDLE, HANDLE, LPSTR, INT); /* causing compiler to puke*/
  878. BOOL initWndClass(); /* mbbx 1.04: was registerIt(); */
  879. VOID initPort();
  880. VOID initIcon();
  881. BOOL createWindows(INT);
  882. /* VOID hidemyControls(); mbbx 2.00: obsolete... */
  883. VOID setDefaultFonts();
  884. VOID sizeWindows();
  885. HBITMAP NEAR extractCloseBitmap();
  886. BOOL initWindows(HANDLE, HANDLE, INT);
  887. VOID initDialogs();
  888. INT_PTR APIENTRY dbPortInit(HWND, UINT, WPARAM, LPARAM);
  889. BOOL NEAR setProfileExtent(BYTE *, BYTE *); /* mbbx 2.00: default paths... */
  890. BOOL NEAR initFileDocData(FILEDOCTYPE fileType, WORD strResID,BYTE *fileExt,BYTE *szSection);
  891. VOID initProfileData();
  892. BOOL setup();
  893. /* VOID initMemPort(); mbbx 2.00: */
  894. VOID NEAR initIconLib();
  895. BOOL NEAR initTermFile(BYTE *);
  896. BOOL NEAR initTaskExec(BYTE *);
  897. BOOL NEAR initEditFile(INT, BYTE *);
  898. VOID NEAR readCmdLine(LPSTR);
  899. VOID freeItResources();
  900. /*** WINMAIN.C ***/
  901. VOID FAR mainProcess();
  902. VOID FAR mainEventLoop();
  903. BOOL NEAR checkInputBuffer(MSG *);
  904. void APIENTRY idleProcess(VOID);
  905. VOID FAR updateTimer();
  906. BOOL updateFKeyButton(WPARAM wParam ,LPARAM lParam,WORD status); /* JAP fix adding wParam*/
  907. VOID getTimeString(BYTE *, DOSTIME *); /* mbbx 2.00: intl date/time */
  908. VOID FAR cursorAdjust();
  909. VOID NEAR blinkCursor();
  910. BOOL NEAR taskProcess();
  911. /*** WNDPROC.C ***/ /* mbbx 1.04 ... */
  912. VOID selectTopWindow();
  913. /* changed WORD -> UINT -sdj */
  914. LRESULT APIENTRY DC_WndProc(HWND, UINT, WPARAM, LPARAM);
  915. VOID termKeyProc(HWND hWnd, UINT message, WPARAM wParam,LPARAM lParam);
  916. /* changed WORD -> UINT -sdj */
  917. LRESULT APIENTRY TF_WndProc(HWND, UINT, WPARAM, LPARAM);
  918. /*** CHRPAINT.C ***/
  919. VOID eraseColorRect(HDC hDC,LPRECT rect,BYTE cAttr);
  920. VOID reDrawTermScreen(INT, INT, INT); /* mbbx 2.00.06: jtf disp2 */
  921. VOID reDrawTermLine(INT, INT, INT);
  922. VOID updateLine(INT);
  923. VOID drawTermLine(LPBYTE txtPtr,INT len, INT lin, INT col,BYTE lAttr,BYTE cAttr);
  924. VOID setAttrib(BYTE cAttr);
  925. /*** DOFILE.C ***/
  926. VOID getFileDocData(FILEDOCTYPE, BYTE *, BYTE *, BYTE *, BYTE *);
  927. VOID setFileDocData(FILEDOCTYPE, BYTE *, BYTE *, BYTE *, BYTE *); /* mbbx 2.00: no forced extents... */
  928. VOID getDataPath(FILEDOCTYPE, BYTE *, BYTE *);
  929. BOOL setDataPath(FILEDOCTYPE, BYTE *, BOOL);
  930. BOOL EditGetDocData(BYTE *, BYTE *, BYTE *);
  931. BOOL EditSetDocData(BYTE *, BYTE *, BYTE *, WORD, BOOL);
  932. /*** MODEMINP.C ***/
  933. VOID cleanRect(INT, INT);
  934. VOID updateLine(INT);
  935. proc scrollBuffer();
  936. proc doScroll();
  937. VOID trackCursor();
  938. VOID termCleanUp();
  939. proc putChar(BYTE ch);
  940. VOID checkSelect();
  941. VOID clrAttrib(INT, INT, INT, INT);
  942. proc clrLines(INT, INT);
  943. proc clrChars(INT, INT, INT);
  944. VOID getUnprot(INT, INT, INT *, INT *);
  945. INT getProtCol();
  946. proc pCursToggle();
  947. proc pCursOn();
  948. proc pCursOff();
  949. proc pCursRC();
  950. proc pSetStatusLine(); /* mbbx 1.03: TV925 ... */
  951. proc pCursHome();
  952. proc pVideo(BYTE attr);
  953. proc pCursRelative(INT, INT);
  954. proc pCursUp();
  955. proc pCursDn();
  956. proc pCursRt();
  957. proc pCursLt();
  958. proc pVPosAbsolute();
  959. proc pHPosAbsolute();
  960. proc pClrScr();
  961. proc pClrBol();
  962. proc pClrBop();
  963. proc pClrEol();
  964. proc pClrEop();
  965. proc pClrLine();
  966. proc scrollAttrib(INT, INT, INT, BOOL);
  967. proc pLF();
  968. proc pInsLin(INT, INT);
  969. proc pDelLin(INT, INT, INT);
  970. proc pDelChar(INT);
  971. VOID begGraphics();
  972. VOID endGraphics();
  973. proc pGrSemi();
  974. proc pGrDoIt(INT, HBRUSH);
  975. proc pGrFill();
  976. proc pGrChar();
  977. proc pSetGrMode();
  978. proc pSetMode();
  979. proc pDecScs();
  980. proc getParms();
  981. proc pInquire();
  982. proc pTab();
  983. proc pClearAllTabs();
  984. proc pSetTab();
  985. proc pClearTab();
  986. proc pCmpSrvResponse();
  987. proc pSndCursor();
  988. proc pIndex();
  989. proc pRevIndex();
  990. proc pSetLineAttrib();
  991. proc pInsChar();
  992. proc pSaveCursorPos();
  993. proc pRestoreCursorPos();
  994. proc pEscSkip();
  995. proc pNullState();
  996. proc pCursorState();
  997. proc pVPosState();
  998. proc pHPosState();
  999. proc pLAttrState();
  1000. proc pAnsi();
  1001. proc pAnsiState();
  1002. proc pGrState();
  1003. proc pSkipState();
  1004. proc pReverseOff();
  1005. proc pReverseOn();
  1006. proc pProtOff();
  1007. proc pProtOn();
  1008. proc pBegProtect(); /* mbbx 1.03: TV925 */
  1009. proc pEndProtect(); /* mbbx 1.03: TV925 */
  1010. proc pBegGraphics(); /* mbbx 1.03: TV925 */
  1011. proc pEndGraphics(); /* mbbx 1.03: TV925 */
  1012. proc pLinDel();
  1013. proc pCharDel();
  1014. proc pLinIns();
  1015. proc pNextLine();
  1016. proc pClrAll();
  1017. proc pPrintOn();
  1018. proc pPrintOff();
  1019. proc pTransPrint(); /* rjs bug2 */
  1020. VOID NEAR checkTransPrint(BYTE); /* rjs swat */
  1021. proc pVideoAttrib();
  1022. proc pVideoAttribState();
  1023. proc pCursorOnOff();
  1024. proc pCursorOnOffState();
  1025. proc pAnswerBack();
  1026. proc pEchoOff();
  1027. proc pEchoOn();
  1028. proc pCR();
  1029. proc pBackSpace();
  1030. proc pBeep();
  1031. proc pEscSequence();
  1032. VOID NEAR aSetCompLevel(); /* mbbx 1.10: VT220 8BIT */
  1033. VOID NEAR pSetCtrlBits(); /* mbbx 2.00: VT220 8BIT */
  1034. proc aCursor();
  1035. proc aClrEol();
  1036. proc aClrEop();
  1037. proc aCursUp();
  1038. proc aCursDn();
  1039. proc aCursRt();
  1040. proc aCursLt();
  1041. proc aClearTabs();
  1042. proc aVideo();
  1043. proc aSetMode();
  1044. proc aReport();
  1045. proc aSetScrRgn();
  1046. proc aDelLin();
  1047. proc aInsLin();
  1048. proc aDelChar();
  1049. proc pVT100H();
  1050. proc pVT100D();
  1051. proc pVT100M();
  1052. proc pVT100c();
  1053. proc pVT100P(); /* mbbx: new routine */
  1054. proc pDCS(); /* mbbx: yterm */
  1055. proc pDCSTerminate();
  1056. proc ansiArgument();
  1057. proc ansiDelimiter();
  1058. proc ansiHeathPrivate();
  1059. proc ansiDecPrivate();
  1060. proc testPause(BYTE);
  1061. BOOL NEAR writeRcvChar(BYTE theChar); /* mbbx 1.10 */
  1062. VOID NEAR putRcvChar(BYTE theChar); /* mbbx 1.10 */
  1063. VOID putDebugChar(BYTE, BOOL); /* mbbx 2.00: FAR, bRcvChar... */
  1064. VOID modemInp(INT, BOOL); /* mbbx 1.10 */
  1065. /*** PHONE.C ***/
  1066. BOOL termSendCmd(BYTE *str, INT nBytes,WORD wFlags);
  1067. /*** RDMODEM.C ***/
  1068. BOOL FAR testWhenEnabled();
  1069. BOOL FAR testWhenActive();
  1070. BOOL NEAR brake();
  1071. VOID rdModem(BOOL);
  1072. /*** SERIAL.C ***/
  1073. VOID resetSerial(recTrmParams *trmParams, BOOL bLoad, BOOL bInit, BYTE byFlowFlag); /* slc swat */
  1074. BOOL PASCAL NEAR resetSerialError0(recTrmParams *trmParams, WORD count);
  1075. BOOL PASCAL NEAR resetSerialError1(recTrmParams *trmParams, WORD count);
  1076. DWORD checkCommEvent(LPVOID);
  1077. /*** SETTINGS.C ***/
  1078. BOOL doSettings(INT, DLGPROC);
  1079. /* changed WORD -> UINT -sdj */
  1080. INT_PTR APIENTRY dbPhon(HWND, UINT, WPARAM, LPARAM);
  1081. INT_PTR APIENTRY dbEmul(HWND, UINT, WPARAM, LPARAM);
  1082. INT_PTR APIENTRY dbTerm(HWND, UINT, WPARAM, LPARAM);
  1083. VOID NEAR setDlgFkeys(HWND, INT);
  1084. VOID NEAR getDlgFkeys(HWND, INT);
  1085. /* changed WORD -> UINT -sdj */
  1086. INT_PTR APIENTRY dbFkey(HWND, UINT, WPARAM, LPARAM);
  1087. VOID NEAR enableChrItems(HWND, BOOL);
  1088. VOID NEAR enableLinItems(HWND, BOOL);
  1089. /* changed WORD -> UINT -sdj */
  1090. INT_PTR APIENTRY dbTxtX(HWND, UINT, WPARAM, LPARAM);
  1091. INT_PTR APIENTRY dbBinX(HWND, UINT, WPARAM, LPARAM);
  1092. INT_PTR APIENTRY dbComm(HWND, UINT, WPARAM, LPARAM);
  1093. INT_PTR APIENTRY dbComBios(HWND, WORD, WPARAM, LPARAM); /* mbbx 2.00: network... */
  1094. INT_PTR APIENTRY dbNetBios(HWND, WORD, WPARAM, LPARAM); /* mbbx 2.00: network... */
  1095. INT_PTR APIENTRY dbUBNetCI(HWND, WORD, WPARAM, LPARAM); /* mbbx 2.00: network... */
  1096. INT_PTR APIENTRY dbDevice(HWND, WORD, WPARAM, LPARAM); /* mbbx 2.00: network... */
  1097. /* changed WORD -> UINT -sdj */
  1098. INT_PTR APIENTRY dbModem(HWND, UINT, WPARAM, LPARAM); /* mbbx 1.10: CUA... */
  1099. VOID chkGrpButton(HWND, INT, INT, INT);
  1100. BYTE whichGrpButton(HWND, INT, INT);
  1101. /* mbbx 1.04: obsolete routines...
  1102. VOID initDlgPhon ();
  1103. VOID dlgCommandPhon ();
  1104. VOID initDlgEmul ();
  1105. VOID dlgCommandEmul ();
  1106. VOID initDlgTerm ();
  1107. VOID dlgCommandTerm ();
  1108. VOID initDlgFkey ();
  1109. VOID dlgCommandFkey ();
  1110. VOID setFkeys ();
  1111. VOID getFkeys ();
  1112. VOID enableButton ();
  1113. VOID initDlgTxtX ();
  1114. VOID dlgCommandTxtX ();
  1115. VOID initDlgBinX ();
  1116. VOID dlgCommandBinX ();
  1117. VOID initDlgComm ();
  1118. VOID dlgCommandComm ();
  1119. BOOL APIENTRY dbModem();
  1120. */
  1121. INT_PTR APIENTRY dbKerRemote(HWND, UINT, WPARAM, LPARAM);
  1122. /*
  1123. VOID initDlgKerRemote();
  1124. VOID dlgCommandKerRemote();
  1125. */
  1126. /*** MDMUTIL.C ***/
  1127. BOOL mdmConnect();
  1128. VOID modemReset();
  1129. VOID modemSendBreak(INT);
  1130. INT modemBytes();
  1131. /* BOOL modemAvail(); */
  1132. BYTE getMdmChar(BOOL); /* mbbx 1.06A: ics new xlate */
  1133. BOOL getRcvChar(BYTE *, BYTE);
  1134. BOOL waitRcvChar(BYTE *, WORD, BYTE,BYTE, ...);
  1135. BOOL modemRd(BYTE *); /* obsolete !!! */
  1136. BOOL modemRdy(); /* obsolete !!! */
  1137. BOOL modemWt(BYTE *); /* obsolete !!! */
  1138. VOID flushRBuff();
  1139. BOOL modemWrite(LPSTR, INT);
  1140. VOID modemWr(BYTE);
  1141. VOID termStr(STRING *, INT, BOOL);
  1142. /*** YTERM.C ***/
  1143. VOID yTermRcvBlock();
  1144. VOID yTermEnd();
  1145. VOID yTermCancel();
  1146. VOID yTermInit();
  1147. VOID blk43Decode();
  1148. VOID yTermPutStr();
  1149. INT yTermBlkEncode();
  1150. VOID ytSendCRC();
  1151. VOID yTermResponse();
  1152. VOID yTermBegin();
  1153. VOID yTermCheckSum();
  1154. VOID hostReady();
  1155. BYTE hostAck();
  1156. /*** DCUTIL1.C ***/
  1157. VOID setDefaults();
  1158. BOOL clearTermBuffer(UINT prevLines,UINT bufLines,UINT lineWidth); /* mbbx 2.00.03 ... */
  1159. BOOL initTermBuffer(WORD bufLines, WORD lineWidth,BOOL bReset);
  1160. VOID resetTermBuffer(VOID);
  1161. /*** DCUTIL2.C ***/
  1162. VOID showTerminal(BOOL, BOOL); /* mbbx 2.00.08: term init */
  1163. VOID showHidedbmyControls(BOOL, BOOL); /* mbbx 2.00 */
  1164. /*** DCUTIL3.C ***/
  1165. VOID buildTermFont();
  1166. VOID clearFontCache();
  1167. // VOID lsetmem(LPSTR, BYTE, WORD);
  1168. VOID getFileDate(DOSTIME *, INT);
  1169. // VOID lmovmem(LPSTR, LPSTR, WORD);
  1170. /*** SCROLL.C ***/
  1171. VOID updateTermScrollBars(BOOL); /* mbbx 2.00.06: jtf display... */
  1172. proc scrollTermWindow(INT, INT);
  1173. proc scrollTermLine(INT, INT, INT);
  1174. VOID scrollBits();
  1175. VOID scrollUp(INT, INT, INT);
  1176. VOID scrollDown(INT, INT, INT);
  1177. VOID pageScroll(INT);
  1178. VOID hPageScroll(INT);
  1179. VOID trackScroll(INT, INT);
  1180. /*** SHOWSTAT.C ***/ /* mbbx 2.00: xfer ctrls... */
  1181. VOID setXferCtrlButton(WORD wCtrlID, WORD wResID);
  1182. INT NEAR placeXferCtrl(HWND, INT);
  1183. VOID showXferCtrls(WORD fShowCtrls);
  1184. HDC NEAR beginXferCtrlUpdate(HWND, RECT *, BOOL);
  1185. VOID NEAR setItemText(INT, BYTE *, BOOL);
  1186. VOID bSetUp(BYTE *);
  1187. VOID showScale();
  1188. VOID updateProgress(BOOL);
  1189. VOID showBBytes(LONG, BOOL);
  1190. VOID showRXFname(BYTE *, INT);
  1191. VOID showBErrors(INT);
  1192. VOID updateIndicators();
  1193. /* mbbx: yterm mods to SNDBFILE.C */
  1194. VOID setupFinderInfo();
  1195. VOID getFinderInfo();
  1196. proc scrollTopPart ();
  1197. proc scroll ();
  1198. VOID pageFeed ();
  1199. VOID paintTerm ();
  1200. VOID setFKeyTitles(); /* mbbx 2.00 ... */
  1201. BOOL NEAR testFKeyLevel(INT);
  1202. INT NEAR nextFKeyLevel(INT);
  1203. VOID setFKeyLevel(INT, BOOL);
  1204. VOID doCommand ();
  1205. VOID resetEmul ();
  1206. VOID openAwindow ();
  1207. VOID clearBuffer ();
  1208. VOID termAnswer ();
  1209. VOID termSpecial ();
  1210. VOID clearModes ();
  1211. VOID onCursor ();
  1212. VOID offCursor ();
  1213. VOID putCursor ();
  1214. VOID reDrawTermLine ();
  1215. VOID toggleCursor ();
  1216. VOID doEditMenu ();
  1217. VOID scrollText ();
  1218. VOID xferFile ();
  1219. VOID termSpecial ();
  1220. VOID stripLeadingSpaces ();
  1221. VOID xferEnd ();
  1222. VOID trackScroll ();
  1223. VOID scrollBits ();
  1224. VOID scrollUp ();
  1225. VOID scrollDown ();
  1226. VOID pageScroll ();
  1227. VOID hPageScroll ();
  1228. VOID teScr ();
  1229. VOID delay (UINT units, DWORD *endingCount);
  1230. VOID setDefaultFonts ();
  1231. /* VOID zoomTerm (); */
  1232. VOID zoomChild(HWND);
  1233. VOID freeItResources ();
  1234. VOID updateTimer ();
  1235. VOID readDateTime ();
  1236. VOID timerAction(BOOL, BOOL); /* mbbx 1.03: VOID tmrAction(); */
  1237. VOID timerToggle(BOOL); /* mbbx 1.03: VOID tmrToggle(); */
  1238. VOID clipRect ();
  1239. //VOID setAttrib ();
  1240. VOID getMdmResult ();
  1241. VOID saveSelection ();
  1242. VOID frameTime ();
  1243. VOID loadKeyPadString ();
  1244. VOID rectCursor ();
  1245. VOID exitSerial ();
  1246. VOID errTest ();
  1247. VOID newFile ();
  1248. VOID clsFile ();
  1249. VOID savFile ();
  1250. VOID svsFile ();
  1251. VOID opnFile ();
  1252. VOID getWTitle ();
  1253. VOID addExtension();
  1254. VOID setWTitle ();
  1255. VOID execErr ();
  1256. VOID addParen ();
  1257. VOID rdErr ();
  1258. VOID stripFileExt ();
  1259. /* VOID forceExtension(); mbbx 2.00: defined in FILEOPEN.H */
  1260. VOID sndTFile ();
  1261. VOID typTFile ();
  1262. VOID rcvTFile ();
  1263. VOID sndBFile ();
  1264. VOID rcvPutFile ();
  1265. VOID rcvBFile ();
  1266. VOID rcvErr ();
  1267. VOID rcvPre ();
  1268. VOID showRXFname ();
  1269. VOID showScale ();
  1270. VOID sndBPre ();
  1271. VOID sndBFileErr ();
  1272. VOID showBErrors ();
  1273. VOID rcvErr ();
  1274. VOID rcvBPre ();
  1275. VOID showBBytes ();
  1276. VOID rxEventLoop ();
  1277. VOID rcvAbort ();
  1278. VOID getDateTime ();
  1279. VOID sec2date ();
  1280. VOID date2secs ();
  1281. VOID termActivate ();
  1282. VOID termDeactivate ();
  1283. VOID termSetSelect ();
  1284. VOID termClick ();
  1285. VOID releasePort ();
  1286. VOID dialPhone ();
  1287. VOID hangUpPhone ();
  1288. VOID waitCall ();
  1289. VOID printchar ();
  1290. VOID lineFeed ();
  1291. VOID endOfPrintJob ();
  1292. VOID prAction ();
  1293. VOID prSelection ();
  1294. VOID xShowLine ();
  1295. VOID ansInTalk ();
  1296. VOID ansKermit();
  1297. VOID selectTermFont ();
  1298. VOID sizeTimerRect ();
  1299. VOID hideTermCursor ();
  1300. VOID showTermCursor ();
  1301. BOOL getScrCh ();
  1302. BOOL copyTable ();
  1303. BOOL myAbort();
  1304. BOOL keyPadSequence ();
  1305. BOOL getArg ();
  1306. BOOL APIENTRY dbSendFile ();
  1307. BOOL APIENTRY pasClikLoop ();
  1308. BOOL APIENTRY dbSelSavApp ();
  1309. INT_PTR APIENTRY dbAbortDlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  1310. //BOOL APIENTRY dbDialing ();
  1311. //BOOL APIENTRY dbmyControls();
  1312. BOOL writeFile ();
  1313. BOOL myPutFile ();
  1314. BOOL getPutFN ();
  1315. BOOL newPath ();
  1316. BOOL searchFileSpec ();
  1317. BOOL checkFilename ();
  1318. BOOL isCharLegal ();
  1319. BOOL fnErr ();
  1320. BOOL fileExist ();
  1321. BOOL ldFile ();
  1322. BOOL readFile ();
  1323. BOOL rdFileErr ();
  1324. BOOL APIENTRY dbStdFN ();
  1325. BOOL APIENTRY dbGetPutFN ();
  1326. BOOL APIENTRY dbTypTFile ();
  1327. BOOL APIENTRY dbRcvTFile ();
  1328. BOOL APIENTRY abortDlgProc (HDC, INT);
  1329. BOOL readMacSettings ();
  1330. BOOL writeMacSettings ();
  1331. BOOL readMacSettings ();
  1332. BOOL writeMacSettings ();
  1333. //BOOL APIENTRY dbDialing ();
  1334. BOOL rcvPutBFile ();
  1335. BOOL getSndTFile ();
  1336. BOOL getSndBFile ();
  1337. BOOL getSndTFile ();
  1338. BOOL startOfPrintJob ();
  1339. BYTE *concat ();
  1340. // BYTE *getcwd ();
  1341. /* this is redefined here, now including the cruntime headers -sdj*/
  1342. /* BYTE *strchr (); */
  1343. BYTE whichGrpButton ();
  1344. INT valIndex ();
  1345. INT pos ();
  1346. INT classifyKey (WORD vrtKey);
  1347. INT availSerial ();
  1348. INT testBox ();
  1349. INT sysError ();
  1350. INT wrErr ();
  1351. LONG fileSize();
  1352. HDC getPort ();
  1353. HANDLE macToDOSText ();
  1354. /* VOID newHTE (); mbbx 2.00.03: old code */
  1355. /* VOID crBuffer(int, int); mbbx 2.00.03: old code */
  1356. /*** DATESTUF.C ***/
  1357. VOID date2secs (DOSTIME *, LONG *);
  1358. /*were not defined but called from initcode.c */
  1359. BOOL PrintFileInit();
  1360. void PrintFileShutDown ();
  1361. VOID sizeFkeys(LONG clientSize);
  1362. VOID initChildSize(RECT *pRect);
  1363. VOID setDefaultAttrib(BOOL bLoad);
  1364. VOID initDlgPos(HWND hDlg);
  1365. VOID initComDevSelect(HWND hDlg, WORD wListID, BOOL bInit);
  1366. BYTE getComDevSelect(HWND hDlg, WORD wListID, BYTE *newDevRef);
  1367. BOOL getFileType(BYTE *fileName, BYTE *fileExt);
  1368. VOID taskInit();
  1369. VOID keyMapInit();
  1370. BOOL termInitSetup(HANDLE hPrevInstance);
  1371. VOID forceExtension(BYTE *fileName, BYTE *fileExt, BOOL bReplace);
  1372. BOOL termFile(BYTE *filePath,BYTE *fileName,BYTE *fileExt,BYTE *title,WORD flags);
  1373. VOID sizeTerm(LONG termSize);
  1374. VOID keyMapCancel();
  1375. /*****************/
  1376. /* were not defined but called from winmain.c */
  1377. VOID xSndBFile();
  1378. VOID xRcvBFile();
  1379. /**************/
  1380. /* were not defined but called from winmain.c*/
  1381. void myDrawIcon(HDC hDC, BOOL bErase);
  1382. BOOL termCloseAll(VOID);
  1383. void flashIcon(BOOL bInitFlash, BOOL bEndProc);
  1384. WORD childZoomStatus(WORD wTest, WORD wSet);
  1385. VOID initMenuPopup(WORD menuIndex);
  1386. BOOL keyMapTranslate(WPARAM *wParam, LPARAM *lParam, STRING *mapStr);
  1387. BOOL fKeyStrBuffer(BYTE *str,WORD len);
  1388. BOOL keyMapSysKey(HWND hWnd, WORD message , WPARAM *wParam, LPARAM lParam); //sdj: AltGr
  1389. VOID longToPoint(long sel, POINT *pt);
  1390. VOID keyMapKeyProc(HWND hWnd, WORD message, WPARAM wParam, LPARAM lParam); //sdj: AltGr
  1391. BOOL termCloseFile(VOID);
  1392. VOID hpageScroll(int which);
  1393. VOID PrintFileString(LPSTR lpchr,LONG count, BOOL bCRtoLF);
  1394. BOOL PrintFileOn(HANDLE theInstance,HWND theWnd,
  1395. LPSTR thePrintName,LPSTR thePrintType,LPSTR thePrintDriver,
  1396. LPSTR thePrintPort,BOOL showDialog);
  1397. BOOL PrintFileOff();
  1398. void PrintFileLineFeed (BOOL nextLine);
  1399. void PrintFilePageFeed ();
  1400. BOOL termSaveFile(BOOL bGetName);
  1401. int testMsg(BYTE *str0, BYTE* str1, BYTE *str2);
  1402. VOID xferStopBreak(BOOL bStop);
  1403. VOID xferPauseResume(BOOL bPause, BOOL bResume);
  1404. void selectFKey(UINT wIDFKey);
  1405. BOOL sendKeyInput(BYTE theByte);
  1406. VOID sndAbort ();
  1407. int countChildWindows(BOOL bUnzoom);
  1408. VOID stripBlanks (LPBYTE ptr, DWORD *len);
  1409. VOID doFileNew();
  1410. VOID doFileOpen();
  1411. VOID doFileClose();
  1412. VOID doFileSave();
  1413. VOID doFileSaveAs();
  1414. VOID stripControl(STRING *str);
  1415. int TF_ErrProc(WORD errMess, WORD errType,WORD errCode);
  1416. BOOL XM_RcvFile(WORD rcvStatus);
  1417. BOOL FAR KER_Receive(BOOL bRemoteServer);
  1418. VOID listFontSizes(BYTE *faceName, BYTE *sizeList, int maxSize);
  1419. void updateIcon();
  1420. BOOL XM_SndFile(WORD);
  1421. BOOL FAR KER_Send();
  1422. VOID setAppTitle();
  1423. VOID icsResetTable(WORD icsType);
  1424. VOID rcvFileErr();
  1425. /* connector.c needs this fn from wndproc.c */
  1426. HWND dlgGetFocus();
  1427. /* initcode.c needs this from connect.c */
  1428. BOOL initConnectors(BOOL bInit);
  1429. /* defined in messages.c called from dcutil */
  1430. INT testResMsg(WORD wResID);
  1431. /* two famous functions. dont know how this was working in win3.0 -sdj*/
  1432. /* these functions have some case problem, called with uppercase B and
  1433. defined with lowercase b in term.c, not changed to Board */
  1434. VOID keyBoardToMouse(INT partCode);
  1435. /* this one was called as bSetup and defined as bSetUp() in showstat.c */
  1436. VOID bSetup(BYTE *str);
  1437. void APIENTRY nextFlash(HWND hWnd, UINT message, UINT_PTR nIDEvent, DWORD sysTime);
  1438. INT_PTR APIENTRY dbDialing(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
  1439. INT_PTR APIENTRY dbmyControls(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
  1440. /* rjs - add prototype for the about dialog function */
  1441. INT_PTR CALLBACK dbAbout(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);