ODInEx.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. /* OpenDoors Online Software Programming Toolkit
  2. * (C) Copyright 1991 - 1999 by Brian Pirie.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. *
  18. *
  19. * File: ODInEx.h
  20. *
  21. * Description: OpenDoors initialization and shutdown operations
  22. * (od_init() and od_exit()), including drop file I/O.
  23. *
  24. * Revisions: Date Ver Who Change
  25. * ---------------------------------------------------------------
  26. * Nov 22, 1995 6.00 BP Created.
  27. * Nov 23, 1995 6.00 BP 32-bit portability.
  28. * Dec 03, 1995 6.00 BP Win32 port.
  29. * Jan 19, 1996 6.00 BP Don't use atexit() under Win32.
  30. * Jan 19, 1996 6.00 BP Make ODInitError() a shared function.
  31. * Jan 20, 1996 6.00 BP Prompt for user name if force_local.
  32. * Feb 02, 1996 6.00 BP Added RA 2.50 EXITINFO.BBS support.
  33. * Feb 19, 1996 6.00 BP Changed version number to 6.00.
  34. * Feb 20, 1996 6.00 BP Added bParsedCmdLine.
  35. * Feb 21, 1996 6.00 BP Don't override command line options.
  36. * Feb 21, 1996 6.00 BP Force single-byte structure alignment.
  37. * Feb 23, 1996 6.00 BP Make DTR disable code shared.
  38. * Mar 03, 1996 6.10 BP Begin version 6.10.
  39. */
  40. #ifndef _INC_ODINEX
  41. #define _INC_ODINEX
  42. #include "ODPlat.h"
  43. /* Drop file structures. */
  44. /* Force byte alignment, if possible */
  45. #ifdef __TURBOC__
  46. #if(__TURBOC__ >= 0x295)
  47. #pragma option -a-
  48. #endif /* __TURBOC__ >= 0x295 */
  49. #endif /* __TURBOC__ */
  50. #ifdef _MSC_VER
  51. #pragma pack(1)
  52. #endif /* _MSC_VER */
  53. typedef struct
  54. {
  55. WORD baud;
  56. DWORD num_calls;
  57. char last_caller[36];
  58. char sLastHandle[36]; /* New to RA 2.50 */
  59. char extra1[92];
  60. char start_date[9];
  61. WORD busyperhour[24];
  62. WORD busyperday[7];
  63. char name[36];
  64. char location[26];
  65. char organisation[51];
  66. char address[3][51];
  67. char handle[36];
  68. char comment[81];
  69. DWORD password_crc;
  70. char dataphone[16];
  71. char homephone[16];
  72. char lasttime[6];
  73. char lastdate[9];
  74. BYTE attrib;
  75. BYTE attrib2;
  76. char flags[4];
  77. DWORD credit;
  78. DWORD pending;
  79. WORD posted;
  80. WORD sec;
  81. DWORD lastread;
  82. DWORD nocalls;
  83. DWORD ups;
  84. DWORD downs;
  85. DWORD upk;
  86. DWORD downk;
  87. DWORD todayk;
  88. INT16 elapsed;
  89. WORD screenlen;
  90. char lastpwdchange;
  91. WORD group;
  92. WORD combinedrecord[200];
  93. char firstcall[9];
  94. char birthday[9];
  95. char subdate[9];
  96. BYTE screenwidth;
  97. BYTE language;
  98. BYTE dateformat;
  99. char forwardto[36];
  100. WORD msgarea;
  101. WORD filearea;
  102. BYTE default_protocol;
  103. WORD file_group;
  104. BYTE last_dob_check;
  105. BYTE sex;
  106. DWORD xirecord;
  107. WORD msg_group;
  108. BYTE btAttribute3; /* New to RA 2.50. */
  109. char sPassword[16]; /* New to RA 2.50. */
  110. BYTE extra2[31];
  111. char status;
  112. char starttime[6];
  113. char errorlevel;
  114. char days;
  115. char forced;
  116. char lasttimerun[9];
  117. char netmailentered;
  118. char echomailentered;
  119. char logintime[6];
  120. char logindate[9];
  121. INT16 timelimit;
  122. DWORD loginsec;
  123. WORD userrecord;
  124. WORD readthru;
  125. WORD numberpages;
  126. WORD downloadlimit;
  127. char timeofcreation[6];
  128. DWORD logonpasswordcrc;
  129. BYTE wantchat;
  130. INT16 deducted_time;
  131. char menustack[50][9];
  132. BYTE menustackpointer;
  133. char extra3[200];
  134. BYTE error_free;
  135. BYTE sysop_next;
  136. char emsi_session;
  137. char emsi_crtdef[41];
  138. char emsi_protocols[41];
  139. char emsi_capabilities[41];
  140. char emsi_requests[41];
  141. char emsi_software[41];
  142. BYTE hold_attr1;
  143. BYTE hold_attr2;
  144. BYTE hold_len;
  145. char page_reason[81];
  146. BYTE status_line;
  147. char last_cost_menu[9];
  148. WORD menu_cost_per_min;
  149. BYTE has_avatar;
  150. BYTE has_rip;
  151. BYTE btRIPVersion; /* New to RA 2.50. */
  152. BYTE btExtraSpace[85];
  153. } tRA2ExitInfoRecord;
  154. typedef struct
  155. {
  156. WORD baud;
  157. DWORD num_calls;
  158. char last_caller[36];
  159. char extraspace[128];
  160. char start_date[9];
  161. WORD busyperhour[24];
  162. WORD busyperday[7];
  163. char uname[36];
  164. char uloc[26];
  165. char password[16];
  166. char dataphone[13];
  167. char homephone[13];
  168. char lasttime[6];
  169. char lastdate[9];
  170. BYTE attrib;
  171. BYTE flags[4];
  172. WORD credit;
  173. WORD pending;
  174. WORD posted;
  175. WORD lastread;
  176. WORD sec;
  177. WORD nocalls;
  178. WORD ups;
  179. WORD downs;
  180. WORD upk;
  181. WORD downk;
  182. WORD todayk;
  183. WORD elapsed;
  184. WORD screenlen;
  185. BYTE lastpwdchange;
  186. BYTE attrib2;
  187. BYTE group;
  188. WORD xirecord;
  189. char extra2[3];
  190. char status;
  191. char starttime[6];
  192. char errorlevel;
  193. char days;
  194. char forced;
  195. char lasttimerun[9];
  196. char netmailentered;
  197. char echomailentered;
  198. char logintime[6];
  199. char logindate[9];
  200. WORD timelimit;
  201. DWORD loginsec;
  202. DWORD net_credit;
  203. WORD userrecord;
  204. WORD readthru;
  205. WORD numberpages;
  206. WORD downloadlimint;
  207. union
  208. {
  209. struct
  210. {
  211. char timeofcreation[6];
  212. char logonpassword[16];
  213. char wantchat;
  214. } ra;
  215. struct
  216. {
  217. char qwantchat;
  218. char gosublevel;
  219. char menustack[20][9];
  220. char menu[9];
  221. BYTE screenclear;
  222. BYTE moreprompts;
  223. BYTE graphicsmode;
  224. BYTE externedit;
  225. INT16 screenlength;
  226. BYTE mnpconnect;
  227. char chatreason[49];
  228. BYTE externlogoff;
  229. BYTE ansicapable;
  230. BYTE ripactive;
  231. BYTE extraspace[199];
  232. } qbbs;
  233. } bbs;
  234. } tExitInfoRecord;
  235. typedef struct
  236. {
  237. INT16 deducted_time;
  238. char menustack[50][9];
  239. char menustackpointer;
  240. char userhandle[36];
  241. char comment[81];
  242. char firstcall[9];
  243. char combinedrecord[25];
  244. char birthday[9];
  245. char subdate[9];
  246. BYTE screenwidth;
  247. BYTE msgarea;
  248. BYTE filearea;
  249. BYTE language;
  250. BYTE dateformat;
  251. char forwardto[36];
  252. char extra_space[43];
  253. char error_free;
  254. char sysop_next;
  255. char emsi_session;
  256. char emsi_crtdef[41];
  257. char emsi_protocols[41];
  258. char emsi_capabilities[41];
  259. char emsi_requests[41];
  260. char emsi_software[41];
  261. char hold_attr1;
  262. char hold_attr2;
  263. char hold_len;
  264. char extr_space[100];
  265. } tExtendedExitInfo;
  266. struct _pcbsys
  267. {
  268. char display[2]; /* "-1" = On, " 0" = Off */
  269. char printer[2];
  270. char pagebell[2];
  271. char calleralarm[2];
  272. char sysopflag; /* ' ', 'N'=sysop next, 'X'=exit to dos */
  273. char errorcorrection[2];
  274. char graphicsmode; /* 'Y'=Yes, 'N'=No, '7'=7E1 */
  275. char nodechat; /* 'A'=available, 'U'=unavailable */
  276. char dteportspeed[5];
  277. char connectspeed[5]; /* "Local"=local mode */
  278. WORD recordnum;
  279. char firstname[15];
  280. char password[15];
  281. INT16 logontimeval; /* minutes since midnight */
  282. INT16 todayused; /* -ve # of minutes */
  283. char logontime[5];
  284. INT16 timeallowed;
  285. WORD kallowed;
  286. char conference;
  287. char joined[5];
  288. char scanned[5];
  289. INT16 conferenceaddtime;
  290. INT16 creditminutes;
  291. char languageext[4];
  292. char fullname[25];
  293. INT16 minutesremaining;
  294. char node; /* ' ' if no network */
  295. char eventtime[5];
  296. char eventactive[2];
  297. char slideevent[2];
  298. DWORD memmessage;
  299. char comport; /* 0=none, 1-8 */
  300. char reserved1[2];
  301. char useansi; /* 1 = yes, 0 = no */
  302. char lasteventdate[8];
  303. WORD lasteventminute;
  304. char dosexit;
  305. char eventupcoming;
  306. char stopuploads;
  307. WORD conferencearea;
  308. };
  309. struct _userssyshdr
  310. {
  311. WORD Version; /* PCBoard version number (i.e. 145) */
  312. DWORD RecNo; /* Record number from USER's file */
  313. WORD SizeOfRec; /* Size of "fixed" user record */
  314. WORD NumOfAreas; /* Number of conference areas (Main=1) */
  315. WORD NumOfBitFields; /* Number of Bit Map fields for conferences */
  316. WORD SizeOfBitFields; /* Size of each Bit Map field */
  317. char AppName[15]; /* Name of the Third Party Application */
  318. WORD AppVersion; /* Version number for the application */
  319. WORD AppSizeOfRec; /* Size of a "fixed length" record (if any) */
  320. WORD AppSizeOfConfRec; /* Size of each conference record (if any) */
  321. DWORD AppRecOffset; /* Offset of AppRec into USERS.INF record */
  322. char Updated; /* TRUE if USERS.SYS has been updated */
  323. };
  324. struct _pcbflags
  325. {
  326. int Dirty :1; /* Dirty Flag (meaning file has been updated) */
  327. int MsgClear :1; /* User's choice for screen clear after messages */
  328. int HasMail :1; /* Indicates if NEW mail has been left for user */
  329. int Reserved :5;
  330. };
  331. struct _pcbdate
  332. {
  333. int Day :5; /* 5 bit integer representing the Day */
  334. int Month :4; /* 4 bit integer representing the Month */
  335. int Year :7; /* 7 bit integer representing the Year MINUS 80 */
  336. };
  337. struct _userssysrec
  338. {
  339. char Name[26]; /* Name (NULL terminated) */
  340. char City[25]; /* City (NULL terminated) */
  341. char Password[13]; /* Password (NULL terminated) */
  342. char BusDataPhone[14]; /* Business or Data Phone (NULL terminated) */
  343. char HomeVoicePhone[14];/* Home or Voice Phone (NULL terminated) */
  344. WORD LastDateOn; /* Julian date for the Last Date On */
  345. char LastTimeOn[6]; /* Last Time On (NULL Terminated) */
  346. char ExpertMode; /* 1=Expert, 0=Novice */
  347. char Protocol; /* Protocol (A thru Z) */
  348. struct _pcbflags PackedFlags;
  349. struct _pcbdate DateLastDirRead;
  350. INT16 SecurityLevel; /* Security Level */
  351. WORD NumTimesOn; /* Number of times the caller has connected */
  352. char PageLen; /* Page Length when display data on the screen */
  353. WORD NumUploads; /* Total number of FILES uploaded */
  354. WORD NumDownloads; /* Total number of FILES downloaded */
  355. DWORD DailyDnldBytes; /* Number of BYTES downloaded so far today */
  356. char UserComment[31]; /* Comment field #1 (NULL terminated) */
  357. char SysopComment[31]; /* Comment field #1 (NULL terminated) */
  358. INT16 ElapsedTimeOn; /* Number of minutes online */
  359. WORD RegExpDate; /* Julian date for Registration Expiration Date */
  360. INT16 ExpSecurityLevel; /* Expired Security Level */
  361. WORD LastConference; /* Number of the conference the caller was in */
  362. DWORD TotDnldBytes; /* Total number of BYTES downloaded */
  363. DWORD TotUpldBytes; /* Total number of BYTES uploaded */
  364. char DeleteFlag; /* 1=delete this record, 0=keep */
  365. DWORD RecNum; /* Record Number in USERS.INF file */
  366. char Reserved[9]; /* Bytes 391-399 from the USERS file */
  367. DWORD MsgsRead; /* Number of messages the user has read in PCB */
  368. DWORD MsgsLeft; /* Number of messages the user has left in PCB */
  369. };
  370. /* Restore original structure alignment, if possible. */
  371. #ifdef _MSC_VER
  372. #pragma pack()
  373. #endif /* _MSC_VER */
  374. /* od_init() and od_exit() global helper functons. */
  375. #ifndef ODPLAT_WIN32
  376. void ODAtExitCallback(void);
  377. #endif /* !ODPLAT_WIN32 */
  378. INT ODWriteExitInfoPrimitive(FILE *pfDropFile, INT nCount);
  379. BOOL ODReadExitInfoPrimitive(FILE *pfDropFile, INT nCount);
  380. INT ODSearchForDropFile(char **papszFileNames, INT nNumFileNames,
  381. char *pszFound, char *pszDirectory);
  382. void ODInitError(char *pszErrorText);
  383. #ifdef ODPLAT_WIN32
  384. BOOL CALLBACK ODInitLoginDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
  385. LPARAM lParam);
  386. void ODInExDisableDTR(void);
  387. #endif /* ODPLAT_WIN32 */
  388. /* Global variables. */
  389. extern WORD wODNodeNumber;
  390. extern BOOL bIsCoSysop;
  391. extern BOOL bIsSysop;
  392. extern char *apszDropFileInfo[25];
  393. extern BYTE btExitReason;
  394. extern DWORD dwForcedBPS;
  395. extern INT nForcedPort;
  396. extern DWORD dwFileBPS;
  397. extern char szDropFilePath[120];
  398. extern char szExitinfoBBSPath[120];
  399. extern INT16 nInitialElapsed;
  400. extern char *szOriginalDir;
  401. extern BYTE btDoorSYSLock;
  402. extern time_t nStartupUnixTime;
  403. extern INT16 nInitialRemaining;
  404. extern BOOL bSysopNameSet;
  405. extern char szForcedSysopName[40];
  406. extern BOOL bSystemNameSet;
  407. extern char szForcedSystemName[40];
  408. extern BOOL bUserFull;
  409. extern BOOL bCalledFromConfig;
  410. extern tRA2ExitInfoRecord *pRA2ExitInfoRecord;
  411. extern tExitInfoRecord *pExitInfoRecord;
  412. extern tExtendedExitInfo *pExtendedExitInfo;
  413. extern struct _pcbsys *pPCBoardSysRecord;
  414. extern struct _userssyshdr *pUserSysHeader;
  415. extern struct _userssysrec *pUserSysRecord;
  416. extern BOOL bPreOrExit;
  417. extern BOOL bRAStatus;
  418. extern BOOL bPromptForUserName;
  419. extern BOOL bParsedCmdLine;
  420. extern WORD wPreSetInfo;
  421. #ifdef ODPLAT_WIN32
  422. extern tODThreadHandle hFrameThread;
  423. #endif /* ODPLAT_WIN32 */
  424. /* wPreSetInfo flags. */
  425. #define PRESET_BPS 0x0001
  426. #define PRESET_PORT 0x0002
  427. #define PRESET_REQUIRED (PRESET_BPS | PRESET_PORT)
  428. #endif /* _INC_ODINEX */