home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / lora299s.zip / LSERVER.CPP < prev    next >
C/C++ Source or Header  |  1997-02-02  |  32KB  |  1,082 lines

  1.  
  2. // ----------------------------------------------------------------------
  3. // LoraBBS Professional Edition - Version 3.00.6
  4. // Copyright (c) 1996 by Marco Maccaferri. All rights reserved.
  5. //
  6. // History:
  7. //    13/06/96 - Initial coding.
  8. // ----------------------------------------------------------------------
  9.  
  10. #include "_ldefs.h"
  11. #include "lserver.h"
  12. #include "lora.h"
  13.  
  14. #if defined(__OS2__)
  15. #define IDOK            1
  16. #define IDCANCEL        2
  17. #endif
  18.  
  19. #define WMU_ADDITEM        1
  20. #define WMU_CLEAR          2
  21.  
  22. #if defined(__OS2__)
  23. HAB  hab;
  24. HWND hwndMainFrame, hwndMainClient;
  25. HWND hwndBBS, hwndFTP, hwndMail, hwndNews, hwndWeb;
  26. #elif defined(__NT__)
  27. HINSTANCE hinst;
  28. HWND hwndMainClient, hwndMainList;
  29. #endif
  30.  
  31. // ---------------------------------------------------------------------------
  32.  
  33. USHORT BM_QueryCheck (HWND m_hWnd, int id)
  34. {
  35.    return ((USHORT)WinSendDlgItemMsg (m_hWnd, id, BM_QUERYCHECK, 0L, 0L));
  36. }
  37.  
  38. VOID BM_SetCheck (HWND m_hWnd, int id, USHORT value)
  39. {
  40.    WinSendDlgItemMsg (m_hWnd, id, BM_SETCHECK, MPFROMSHORT (value), 0L);
  41. }
  42.  
  43. VOID SetDlgItemText (HWND m_hWnd, int id, PSZ text)
  44. {
  45.    WinSetDlgItemText (m_hWnd, id, text);
  46. }
  47.  
  48. // ---------------------------------------------------------------------------
  49.  
  50. class TPMLog : public TLog
  51. {
  52. public:
  53.    TPMLog (HWND hwnd);
  54.    ~TPMLog (void);
  55.  
  56.    VOID   Write (PSZ pszFormat, ...);
  57.    VOID   WriteSend (PSZ pszFormat, ...);
  58.  
  59. private:
  60.    HWND   hwndList;
  61. #if defined(__OS2__)
  62.    HMTX   hmtx;
  63. #endif
  64. };
  65.  
  66. TPMLog::TPMLog (HWND hwnd)
  67. {
  68.    hwndList = hwnd;
  69. #if defined(__OS2__)
  70.    DosCreateMutexSem ("\\SEM32\\INETLOG", &hmtx, 0L, FALSE);
  71. #endif
  72. }
  73.  
  74. TPMLog::~TPMLog (void)
  75. {
  76. #if defined(__OS2__)
  77.    DosCloseMutexSem (hmtx);
  78. #endif
  79. }
  80.  
  81. VOID TPMLog::Write (PSZ pszFormat, ...)
  82. {
  83.    va_list arglist;
  84.    PSZ MsgTemp;
  85.    time_t t;
  86.    struct tm *timep;
  87.  
  88. #if defined(__OS2__)
  89.    DosRequestMutexSem (hmtx, -1);
  90. #endif
  91.  
  92.    va_start (arglist, pszFormat);
  93.    vsprintf (Buffer, pszFormat, arglist);
  94.    va_end (arglist);
  95.  
  96.    t = time (NULL);
  97.    timep = localtime (&t);
  98.    sprintf (Temp, "%c %02d %3s %02d:%02d:%02d %s %s", Buffer[0], timep->tm_mday, Months[timep->tm_mon], timep->tm_hour, timep->tm_min, timep->tm_sec, "LORA", &Buffer[1]);
  99.  
  100.    if (fp != NULL) {
  101.       fprintf (fp, "%s\n", Temp);
  102.       fflush (fp);
  103.    }
  104.  
  105.    if (hwndList != NULL) {
  106.       sprintf (Temp, "%c %02d:%02d %s", Buffer[0], timep->tm_hour, timep->tm_min, &Buffer[1]);
  107.       if ((MsgTemp = (PSZ)malloc (strlen (Temp) + 1)) != NULL) {
  108.          strcpy (MsgTemp, Temp);
  109. #if defined(__OS2__)
  110.          WinPostMsg (hwndList, WM_USER, MPFROMSHORT (WMU_ADDITEM), MPFROMP (MsgTemp));
  111. #elif defined(__NT__)
  112.          PostMessage (hwndList, WM_USER, WMU_ADDITEM, (LPARAM)MsgTemp);
  113. #endif
  114.       }
  115.    }
  116.  
  117. #if defined(__OS2__)
  118.    DosReleaseMutexSem (hmtx);
  119. #endif
  120. }
  121.  
  122. VOID TPMLog::WriteSend (PSZ pszFormat, ...)
  123. {
  124.    va_list arglist;
  125.    PSZ MsgTemp;
  126.    time_t t;
  127.    struct tm *timep;
  128.  
  129. #if defined(__OS2__)
  130.    DosRequestMutexSem (hmtx, -1);
  131. #endif
  132.  
  133.    va_start (arglist, pszFormat);
  134.    vsprintf (Buffer, pszFormat, arglist);
  135.    va_end (arglist);
  136.  
  137.    t = time (NULL);
  138.    timep = localtime (&t);
  139.    sprintf (Temp, "%c %02d %3s %02d:%02d:%02d %s %s", Buffer[0], timep->tm_mday, Months[timep->tm_mon], timep->tm_hour, timep->tm_min, timep->tm_sec, "LORA", &Buffer[1]);
  140.  
  141.    if (fp != NULL) {
  142.       fprintf (fp, "%s\n", Temp);
  143.       fflush (fp);
  144.    }
  145.  
  146.    if (hwndList != NULL) {
  147.       sprintf (Temp, "%c %02d:%02d %s", Buffer[0], timep->tm_hour, timep->tm_min, &Buffer[1]);
  148.       if ((MsgTemp = (PSZ)malloc (strlen (Temp) + 1)) != NULL) {
  149.          strcpy (MsgTemp, Temp);
  150. #if defined(__OS2__)
  151.          WinSendMsg (hwndList, WM_USER, MPFROMSHORT (WMU_ADDITEM), MPFROMP (MsgTemp));
  152. #elif defined(__NT__)
  153.          SendMessage (hwndList, WM_USER, WMU_ADDITEM, (LPARAM)MsgTemp);
  154. #endif
  155.       }
  156.    }
  157.  
  158. #if defined(__OS2__)
  159.    DosReleaseMutexSem (hmtx);
  160. #endif
  161. }
  162.  
  163. // ----------------------------------------------------------------------------
  164.  
  165. #define MAX_TELNET_SLOTS      16
  166.  
  167. USHORT TelnetSlots[MAX_TELNET_SLOTS];
  168. USHORT WebInit, MailInit, PopInit, FtpInit, TelnetInit, NewsInit;
  169. class  TConfig *Cfg;
  170. class  TPMLog *Log;
  171. class  TTcpip *Web, *Mail, *Pop, *Ftp, *Telnet, *News;
  172.  
  173. // ----------------------------------------------------------------------------
  174.  
  175. VOID WebThread (PVOID Args)
  176. {
  177.    class TTcpip *Data;
  178.    class TWeb *Server;
  179.  
  180. #if defined(__OS2__)
  181. //   DosSetPriority (PRTYS_THREAD, PRTYC_IDLETIME, PRTYD_MAXIMUM, 0);
  182. #endif
  183.  
  184.    if ((Data = (class TTcpip *)Args) != NULL) {
  185.       if ((Server = new TWeb) != NULL) {
  186.          Server->Tcp = Data;
  187.          Server->Cfg = Cfg;
  188.          Server->Log = Log;
  189.          Server->Run ();
  190.       }
  191.       Data->ClosePort ();
  192.       delete Data;
  193.    }
  194.  
  195.    _endthread ();
  196. }
  197.  
  198. VOID FtpThread (PVOID Args)
  199. {
  200.    class TTcpip *Data;
  201.    class TFTP *Server;
  202.  
  203. #if defined(__OS2__)
  204. //   DosSetPriority (PRTYS_THREAD, PRTYC_IDLETIME, PRTYD_MAXIMUM, 0);
  205. #elif defined(__NT__)
  206. //   SetPriorityClass (NULL, IDLE_PRIORITY_CLASS);
  207. #endif
  208.  
  209.    if ((Data = (class TTcpip *)Args) != NULL) {
  210.       if ((Server = new TFTP) != NULL) {
  211.          Server->Tcp = Data;
  212.          Server->Cfg = Cfg;
  213.          Server->Log = Log;
  214.          strcpy (Server->ClientIP, Data->ClientIP);
  215.          if (Server->Login () == TRUE)
  216.             Server->Run ();
  217.       }
  218.       Data->ClosePort ();
  219.       delete Data;
  220.    }
  221.  
  222.    _endthread ();
  223. }
  224.  
  225. VOID PopThread (PVOID Args)
  226. {
  227.    class TTcpip *Data;
  228.    class TPOP3 *Server;
  229.  
  230. #if defined(__OS2__)
  231. //   DosSetPriority (PRTYS_THREAD, PRTYC_IDLETIME, PRTYD_MAXIMUM, 0);
  232. #endif
  233.  
  234.    if ((Data = (class TTcpip *)Args) != NULL) {
  235.       if ((Server = new TPOP3) != NULL) {
  236.          Server->Tcp = Data;
  237.          Server->Cfg = Cfg;
  238.          Server->Log = Log;
  239.          Server->Run ();
  240.       }
  241.       Data->ClosePort ();
  242.       delete Data;
  243.    }
  244.  
  245.    _endthread ();
  246. }
  247.  
  248. VOID NewsThread (PVOID Args)
  249. {
  250.    class TTcpip *Data;
  251.    class TNNTP *Server;
  252.  
  253. #if defined(__OS2__)
  254. //   DosSetPriority (PRTYS_THREAD, PRTYC_IDLETIME, PRTYD_MAXIMUM, 0);
  255. #endif
  256.  
  257.    if ((Data = (class TTcpip *)Args) != NULL) {
  258.       if ((Server = new TNNTP) != NULL) {
  259.          Server->Tcp = Data;
  260.          Server->Cfg = Cfg;
  261.          Server->Log = Log;
  262.          Server->Run ();
  263.       }
  264.       Data->ClosePort ();
  265.       delete Data;
  266.    }
  267.  
  268.    _endthread ();
  269. }
  270.  
  271. VOID BbsThread (PVOID Args)
  272. {
  273.    USHORT i, Mailer, Task = 1;
  274.    CHAR Temp[128], Title[64], CtlName[64];
  275. #if defined(__OS2__)
  276.    CHAR ObjBuf[64];
  277.    ULONG id;
  278.    STARTDATA StartData;
  279.    PID Pid;
  280. #endif
  281.    class TTcpip *Data;
  282.    class TBbs *Bbs;
  283.    class TLog *BBSLog;
  284.    class TPipe *Pipe;
  285.  
  286. #if defined(__OS2__)
  287. //   DosSetPriority (PRTYS_THREAD, PRTYC_IDLETIME, PRTYD_MAXIMUM, 0);
  288. #endif
  289.  
  290.    if ((Data = (class TTcpip *)Args) != NULL) {
  291.       Mailer = FALSE;
  292.       for (i = 0; i < MAX_TELNET_SLOTS; i++) {
  293.          if (TelnetSlots[i] == FALSE) {
  294.             TelnetSlots[i] = TRUE;
  295.             Task = (USHORT)(Cfg->TaskNumber + i);
  296.             break;
  297.          }
  298.       }
  299.       if (i < MAX_TELNET_SLOTS) {
  300.          if ((BBSLog = new TLog) != NULL) {
  301.             sprintf (Temp, Cfg->LogFile, Task);
  302.             BBSLog->Open (Temp);
  303.          }
  304.          if ((Bbs = new TBbs) != NULL) {
  305.             if ((Pipe = new TPipe) != NULL) {
  306.                sprintf (Title, "Snoop - Line %u", Cfg->TaskNumber);
  307.                sprintf (Temp, "\\PIPE\\SNOOP%u", Cfg->TaskNumber);
  308.                sprintf (CtlName, "\\PIPE\\CTL%u", Cfg->TaskNumber);
  309.  
  310. #if defined(__OS2__)
  311.                memset (&StartData, 0, sizeof (STARTDATA));
  312.                StartData.Length = sizeof (STARTDATA);
  313.                StartData.Related = SSF_RELATED_CHILD;
  314.                StartData.FgBg = SSF_FGBG_BACK;
  315.                StartData.TraceOpt = SSF_TRACEOPT_NONE;
  316.                StartData.PgmTitle = Title;
  317.                StartData.PgmName = "SNOOP.EXE";
  318.                StartData.PgmInputs = Temp;
  319.                StartData.TermQ = NULL;
  320.                StartData.Environment = 0;
  321.                StartData.InheritOpt = SSF_INHERTOPT_PARENT;
  322.                StartData.SessionType = SSF_TYPE_FULLSCREEN;
  323.                StartData.IconFile = 0;
  324.                StartData.PgmHandle = 0;
  325.                StartData.PgmControl = SSF_CONTROL_VISIBLE;
  326.                StartData.InitXPos = 30;
  327.                StartData.InitYPos = 40;
  328.                StartData.InitXSize = 200;
  329.                StartData.InitYSize = 140;
  330.                StartData.Reserved = 0;
  331.                StartData.ObjectBuffer = ObjBuf;
  332.                StartData.ObjectBuffLen = sizeof (ObjBuf);
  333.                DosStartSession (&StartData, &id, &Pid);
  334.  
  335.                if (Pipe->Initialize (Temp, CtlName, 1) == TRUE)
  336.                   Bbs->Snoop = Pipe;
  337. #endif
  338.             }
  339.  
  340.             Bbs->Log = BBSLog;
  341.             Bbs->Cfg = Cfg;
  342.             Bbs->Com = Data;
  343.             Bbs->Task = Task;
  344.             Bbs->Speed = 57600L;
  345.  
  346.             Log->Write ("+BBS started on task #%d", Task);
  347.             Data->SendBytes ((UCHAR *)"\xFF\xFD\x01\xFF\xFD\x00\xFF\xFB\x01\xFF\xFB\x00", 12);
  348.  
  349.             Bbs->Run ();
  350.             Mailer = Bbs->Remote;
  351.  
  352.             if (Pipe != NULL) {
  353. #if defined(__OS2__)
  354.                DosStopSession (STOP_SESSION_SPECIFIED, id);
  355. #endif
  356.                delete Pipe;
  357.             }
  358.  
  359.             delete Bbs;
  360.          }
  361.  
  362.          if (BBSLog != NULL)
  363.             delete BBSLog;
  364.  
  365.          Log->Write (":Task #%d terminated", Task);
  366.          TelnetSlots[i] = FALSE;
  367.       }
  368.       Data->ClosePort ();
  369.       delete Data;
  370.    }
  371. }
  372.  
  373. // ----------------------------------------------------------------------------
  374.  
  375. #if defined(__OS2__)
  376. MRESULT EXPENTRY MainWinProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  377. #elif defined(__NT__)
  378. LRESULT CALLBACK MainWinProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  379. #endif
  380. {
  381.    switch (msg) {
  382.       case WM_CREATE: {
  383. #if defined(__OS2__)
  384.          HWND hwndMainList;
  385.  
  386.          if ((hwndMainList = WinCreateWindow (hwnd, WC_LISTBOX, NULL, LS_NOADJUSTPOS|LS_HORZSCROLL|WS_GROUP|WS_TABSTOP|WS_VISIBLE, 0, 0, 0, 0, hwnd, HWND_TOP, 101, NULL, NULL)) != NULLHANDLE)
  387.             WinSetPresParam (hwndMainList, PP_FONTNAMESIZE, 14, "11.System VIO");
  388. #elif defined(__NT__)
  389.          LOGFONT logFont;
  390.          HFONT hFont;
  391.  
  392.          if ((hwndMainList = CreateWindow ("LISTBOX", "", LBS_NOINTEGRALHEIGHT|LBS_MULTIPLESEL|WS_CHILD, 0, 0, 100, 50, hwnd, NULL, hinst, NULL)) != NULL) {
  393.             logFont.lfHeight = 12;
  394.             logFont.lfWidth = 8;
  395.             logFont.lfEscapement = 0;
  396.             logFont.lfOrientation = 0;
  397.             logFont.lfWeight = FW_NORMAL;
  398.             logFont.lfItalic = FALSE;
  399.             logFont.lfUnderline = FALSE;
  400.             logFont.lfStrikeOut = FALSE;
  401.             logFont.lfCharSet = OEM_CHARSET;
  402.             logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
  403.             logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
  404.             logFont.lfQuality = DEFAULT_QUALITY;
  405.             logFont.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE;
  406.             strcpy (logFont.lfFaceName, "Fixedsys");
  407.             if ((hFont = CreateFontIndirect (&logFont)) != NULL)
  408.                SendMessage (hwndMainList, WM_SETFONT, (WPARAM)hFont, MAKELPARAM (FALSE, 0));
  409.             ShowWindow (hwndMainList, SW_SHOW);
  410.          }
  411. #endif
  412.          if (hwndMainList != NULL) {
  413.             if ((Log = new TPMLog (hwnd)) != NULL) {
  414.                Log->Open ("server.log");
  415. #if defined(__OS2__)
  416.                Log->Write ("+Begin, v%s (OS/2)", VERSION);
  417. #elif defined(__NT__)
  418.                Log->Write ("+Begin, v%s (Win32)", VERSION);
  419. #endif
  420.             }
  421.          }
  422.  
  423.          Web = Mail = Pop = Ftp = Telnet = News = NULL;
  424.          WebInit = MailInit = PopInit = FALSE;
  425.          FtpInit = TelnetInit = NewsInit = FALSE;
  426.  
  427.          Telnet = new TTcpip;
  428.          Ftp = new TTcpip;
  429.          Web = new TTcpip;
  430.          Pop = new TTcpip;
  431.          News = new TTcpip;
  432.          break;
  433.       }
  434.  
  435. #if defined(__NT__)
  436.       case WM_CTLCOLORLISTBOX: {
  437.          LOGBRUSH logBrush;
  438.  
  439.          SetBkColor ((HDC)wParam, GetSysColor (COLOR_WINDOW));
  440.  
  441.          logBrush.lbStyle = BS_SOLID;
  442.          logBrush.lbColor = GetSysColor (COLOR_WINDOW);
  443.          logBrush.lbHatch = 0;
  444.  
  445.          return ((BOOL)CreateBrushIndirect (&logBrush));
  446.       }
  447. #endif
  448.  
  449.       case WM_USER:
  450. #if defined(__OS2__)
  451.          switch (SHORT1FROMMP (mp1)) {
  452. #elif defined(__NT__)
  453.          switch (wParam) {
  454. #endif
  455.             case WMU_ADDITEM: {
  456.                USHORT Item;
  457.  
  458. #if defined(__OS2__)
  459.                if ((USHORT)WinSendMsg (WinWindowFromID (hwnd, 101), LM_QUERYITEMCOUNT, 0L, 0L) > 200)
  460.                   WinSendMsg (WinWindowFromID (hwnd, 101), LM_DELETEITEM, MPFROMSHORT (0), 0L);
  461.  
  462.                Item = (USHORT)WinSendMsg (WinWindowFromID (hwnd, 101), LM_INSERTITEM, MPFROMSHORT (LIT_END), mp2);
  463.                WinSendMsg (WinWindowFromID (hwnd, 101), LM_SELECTITEM, MPFROMSHORT (Item), MPFROMSHORT (TRUE));
  464.                free ((PSZ)mp2);
  465. #elif defined(__NT__)
  466.                SendMessage (hwndMainList, LB_SETSEL, FALSE, (LPARAM)-1);
  467.                Item = (USHORT)SendMessage (hwndMainList, LB_ADDSTRING, 0, lParam);
  468.                SendMessage (hwndMainList, LB_SETSEL, TRUE, (LPARAM)Item);
  469.                free ((PSZ)lParam);
  470. #endif
  471.                break;
  472.             }
  473.  
  474.             case WMU_CLEAR:
  475. #if defined(__OS2__)
  476.                WinSendMsg (WinWindowFromID (hwnd, 101), LM_DELETEALL, 0L, 0L);
  477. #elif defined(__NT__)
  478. #endif
  479.                break;
  480.          }
  481.          break;
  482.  
  483.       case WM_TIMER: {
  484.          USHORT Socket;
  485.          class TTcpip *Data;
  486.  
  487. #if defined(__OS2__)
  488.          if (SHORT1FROMMP (mp1) == 2) {
  489.             ULONG Value[3];
  490.  
  491.             Value[0] = 0L;
  492.             DosQuerySysInfo (20, 20, (UCHAR *)Value, sizeof (Value));
  493.             Log->Write ("+%lu bytes remain in heap", Value[0]);
  494.          }
  495. #endif
  496.  
  497.          if (Web != NULL && WebInit == TRUE) {
  498.             if ((Socket = Web->WaitClient ()) != 0) {
  499.                Log->Write (":From %s (%s)", Web->ClientName, Web->ClientIP);
  500.                if ((Data = new TTcpip) != NULL) {
  501.                   Data->Initialize (0, Socket);
  502. #if defined(__BORLANDC__)
  503.                   _beginthread (WebThread, 8192, (PVOID)Data);
  504. #elif defined(_MSC_VER)
  505.                   DWORD ThreadId;
  506.  
  507.                   CreateThread (NULL, 8192, (LPTHREAD_START_ROUTINE)WebThread, (PVOID)Data, 0L, &ThreadId);
  508. #else
  509.                   _beginthread (WebThread, NULL, 8192U, (PVOID)Data);
  510. #endif
  511.                }
  512.             }
  513.          }
  514.          if (Ftp != NULL && FtpInit == TRUE) {
  515.             if ((Socket = Ftp->WaitClient ()) != 0) {
  516.                Log->Write (":FTP: Incoming from %s (%s)", Ftp->ClientName, Ftp->ClientIP);
  517.                if ((Data = new TTcpip) != NULL) {
  518.                   Data->Initialize (0, Socket);
  519.                   strcpy (Data->ClientIP, Ftp->ClientIP);
  520. #if defined(__BORLANDC__)
  521.                   _beginthread (FtpThread, 8192, (PVOID)Data);
  522. #elif defined(_MSC_VER)
  523.                   DWORD ThreadId;
  524.  
  525.                   CreateThread (NULL, 8192, (LPTHREAD_START_ROUTINE)FtpThread, (PVOID)Data, 0L, &ThreadId);
  526. #else
  527.                   _beginthread (FtpThread, NULL, 32768U, (PVOID)Data);
  528. #endif
  529.                }
  530.             }
  531.          }
  532.          if (Telnet != NULL && TelnetInit == TRUE) {
  533.             if ((Socket = Telnet->WaitClient ()) != 0) {
  534.                Log->Write ("+Telnet: Incoming from %s (%s)", Telnet->ClientName, Telnet->ClientIP);
  535.                if ((Data = new TTcpip) != NULL) {
  536.                   Log->Write (":Telnet socket #%d", Socket);
  537.                   Data->Initialize (0, Socket);
  538. #if defined(__BORLANDC__)
  539.                   _beginthread (BbsThread, 8192, (PVOID)Data);
  540. #elif defined(_MSC_VER)
  541.                   DWORD ThreadId;
  542.  
  543.                   CreateThread (NULL, 8192, (LPTHREAD_START_ROUTINE)BbsThread, (PVOID)Data, 0L, &ThreadId);
  544. #else
  545.                   _beginthread (BbsThread, NULL, 32768U, (PVOID)Data);
  546. #endif
  547.                }
  548.             }
  549.          }
  550.          if (Pop != NULL && PopInit == TRUE) {
  551.             if ((Socket = Pop->WaitClient ()) != 0) {
  552.                Log->Write (":POP3: Incoming from %s (%s)", Pop->ClientName, Pop->ClientIP);
  553.                if ((Data = new TTcpip) != NULL) {
  554.                   Data->Initialize (0, Socket);
  555. #if defined(__BORLANDC__)
  556.                   _beginthread (PopThread, 8192, (PVOID)Data);
  557. #elif defined(_MSC_VER)
  558.                   DWORD ThreadId;
  559.  
  560.                   CreateThread (NULL, 8192, (LPTHREAD_START_ROUTINE)PopThread, (PVOID)Data, 0L, &ThreadId);
  561. #else
  562.                   _beginthread (PopThread, NULL, 8192, (PVOID)Data);
  563. #endif
  564.                }
  565.             }
  566.          }
  567.          if (News != NULL && NewsInit == TRUE) {
  568.             if ((Socket = News->WaitClient ()) != 0) {
  569.                Log->Write (":NNTP: Incoming from %s (%s)", News->ClientName, News->ClientIP);
  570.                if ((Data = new TTcpip) != NULL) {
  571.                   Data->Initialize (0, Socket);
  572. #if defined(__BORLANDC__)
  573.                   _beginthread (NewsThread, 8192, (PVOID)Data);
  574. #elif defined(_MSC_VER)
  575.                   DWORD ThreadId;
  576.  
  577.                   CreateThread (NULL, 8192, (LPTHREAD_START_ROUTINE)NewsThread, (PVOID)Data, 0L, &ThreadId);
  578. #else
  579.                   _beginthread (NewsThread, NULL, 8192, (PVOID)Data);
  580. #endif
  581.                }
  582.             }
  583.          }
  584.  
  585.          // Socket initialisation for servers
  586.          if (Telnet != NULL && TelnetInit == FALSE) {
  587.             if (Telnet->Initialize (23) == TRUE) {
  588.                Log->Write ("+Telnet Server started on port 23");
  589.                TelnetInit = TRUE;
  590.             }
  591.          }
  592.          if (Ftp != NULL && FtpInit == FALSE) {
  593.             if (Ftp->Initialize (121) == TRUE) {
  594.                Log->Write ("+FTP Server started on port 121");
  595.                FtpInit = TRUE;
  596.             }
  597.          }
  598.          if (Web != NULL && WebInit == FALSE) {
  599.             if (Web->Initialize (80) == TRUE) {
  600.                Log->Write ("+HTTP Server started on port 80");
  601.                WebInit = TRUE;
  602.             }
  603.          }
  604.          if (Pop != NULL && PopInit == FALSE) {
  605.             if (Pop->Initialize (110) == TRUE) {
  606.                Log->Write ("+POP3 Server started on port 110");
  607.                PopInit = TRUE;
  608.             }
  609.          }
  610.          if (News != NULL && NewsInit == FALSE) {
  611.             if (News->Initialize (119) == TRUE) {
  612.                Log->Write ("+NNTP Server started on port 119");
  613.                NewsInit = TRUE;
  614.             }
  615.          }
  616.          break;
  617.       }
  618.  
  619.       case WM_SIZE:
  620. #if defined(__OS2__)
  621.          WinSetWindowPos (WinWindowFromID (hwnd, 101), NULLHANDLE, 0, 0, SHORT1FROMMP (mp2), SHORT2FROMMP (mp2), SWP_SIZE|SWP_SHOW);
  622. #elif defined(__NT__)
  623.          MoveWindow (hwndMainList, 0, 0, LOWORD (lParam), HIWORD (lParam), TRUE);
  624. #endif
  625.          break;
  626.  
  627. #if defined(__OS2__)
  628.       case WM_ERASEBACKGROUND:
  629.          return ((MRESULT)TRUE);
  630. #endif
  631.  
  632.       case WM_COMMAND:
  633. #if defined(__OS2__)
  634.          switch (SHORT1FROMMP (mp1)) {
  635. #elif defined(__NT__)
  636.          switch (wParam) {
  637. #endif
  638.             case 206:      // Global / Internet Options
  639. #if defined(__OS2__)
  640. //               if ((USHORT)WinDlgBox (HWND_DESKTOP, hwnd, InternetDlgProc, NULLHANDLE, 23, NULL) == TRUE)
  641. #elif defined(__NT__)
  642. //               if (Win95DialogBox (hinst, "INTERNET", hwnd, (DLGPROC)InternetDlgProc) == TRUE)
  643. #endif
  644.                   Cfg->Save ();
  645.                break;
  646.          }
  647.          break;
  648.  
  649. #if defined(__OS2__)
  650.       case WM_CONTROL:
  651.          break;
  652. #endif
  653.  
  654. #if defined(__OS2__)
  655.       case WM_CLOSE:
  656. #elif defined(__NT__)
  657.       case WM_DESTROY:
  658. #endif
  659.          if (Telnet != NULL) {
  660.             Telnet->ClosePort ();
  661.             delete Telnet;
  662.          }
  663.          if (Ftp != NULL) {
  664.             Ftp->ClosePort ();
  665.             delete Ftp;
  666.          }
  667.          if (Web != NULL) {
  668.             Web->ClosePort ();
  669.             delete Web;
  670.          }
  671.          if (Pop != NULL) {
  672.             Pop->ClosePort ();
  673.             delete Pop;
  674.          }
  675.          if (News != NULL) {
  676.             News->ClosePort ();
  677.             delete News;
  678.          }
  679.          if (Log != NULL) {
  680.             Log->Write (":End");
  681.             Log->WriteBlank ();
  682.             delete Log;
  683.          }
  684. #if defined(__NT__)
  685.          PostQuitMessage (0);
  686. #endif
  687.          break;
  688.    }
  689.  
  690. #if defined(__OS2__)
  691.    return (WinDefWindowProc (hwnd, msg, mp1, mp2));
  692. #elif defined(__NT__)
  693.    return (DefWindowProc (hwnd, msg, wParam, lParam));
  694. #endif
  695. }
  696.  
  697. #if defined(__OS2__)
  698. MRESULT EXPENTRY DummyDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  699. #elif defined(__NT__)
  700. LRESULT CALLBACK DummyDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  701. #endif
  702. {
  703.    switch (msg) {
  704. #if defined(__OS2__)
  705.       case WM_INITDLG:
  706. #elif defined(__NT__)
  707.       case WM_CREATE:
  708. #endif
  709.          break;
  710.  
  711. #if defined(__OS2__)
  712.       case WM_CONTROL:
  713.          return (0);
  714. #endif
  715.  
  716.       case WM_COMMAND:
  717.          return (0);
  718.    }
  719.  
  720. #if defined(__OS2__)
  721.    return (WinDefDlgProc (hwnd, msg, mp1, mp2));
  722. #elif defined(__NT__)
  723.    return (0);
  724. #endif
  725. }
  726.  
  727. #if defined(__OS2__)
  728. MRESULT EXPENTRY FtpDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  729. #elif defined(__NT__)
  730. LRESULT CALLBACK FtpDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  731. #endif
  732. {
  733.    CHAR Temp[64];
  734.  
  735.    switch (msg) {
  736.       case WM_INITDLG:
  737.          BM_SetCheck (hwnd, 101, Cfg->FtpServer);
  738.          sprintf (Temp, "%u", Cfg->FtpPort);
  739.          SetDlgItemText (hwnd, 103, Temp);
  740.          break;
  741.  
  742.       case WM_CONTROL:
  743.          return (0);
  744.  
  745.       case WM_COMMAND:
  746.          return (0);
  747.    }
  748.  
  749.    return (WinDefDlgProc (hwnd, msg, mp1, mp2));
  750. }
  751.  
  752. #if defined(__OS2__)
  753. MRESULT EXPENTRY ServerWinProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  754. #elif defined(__NT__)
  755. LRESULT CALLBACK ServerWinProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  756. #endif
  757. {
  758.    switch (msg) {
  759.       case WM_CREATE: {
  760. #if defined(__OS2__)
  761.          ULONG style, page;
  762.          HWND hwndCtl;
  763.  
  764.          style = BKS_SOLIDBIND|BKS_BACKPAGESTR|BKS_MAJORTABTOP|BKS_SQUARETABS|BKS_TABTEXTCENTER|BKS_STATUSTEXTLEFT;
  765.          if ((hwndCtl = WinCreateWindow (hwnd, WC_NOTEBOOK, NULL, style|WS_VISIBLE, 0, 0, 0, 0, hwnd, HWND_TOP, 101, NULL, NULL)) != NULL) {
  766.             WinSendMsg (hwndCtl, BKM_SETDIMENSIONS, MPFROM2SHORT (80, 24), MPFROMSHORT (BKA_MAJORTAB));
  767.             WinSendMsg (hwndCtl, BKM_SETDIMENSIONS, MPFROM2SHORT (0, 0), MPFROMSHORT (BKA_MINORTAB));
  768.             WinSendMsg (hwndCtl, BKM_SETNOTEBOOKCOLORS, MPFROMLONG (SYSCLR_DIALOGBACKGROUND), MPFROMLONG (BKA_BACKGROUNDPAGECOLORINDEX));
  769.             WinSendMsg (hwndCtl, BKM_SETNOTEBOOKCOLORS, MPFROMLONG (SYSCLR_DIALOGBACKGROUND), MPFROMLONG (BKA_BACKGROUNDMAJORCOLORINDEX));
  770.  
  771.             page = (ULONG)WinSendMsg (hwndCtl, BKM_INSERTPAGE, 0L, MPFROM2SHORT (BKA_MAJOR, BKA_LAST));
  772.             WinSendMsg (hwndCtl, BKM_SETTABTEXT, (MPARAM)page, MPFROMP ("BBS"));
  773.             hwndBBS = WinLoadDlg (hwndCtl, hwndCtl, DummyDlgProc, NULLHANDLE, 301, NULL);
  774.             WinSendMsg (hwndCtl, BKM_SETPAGEWINDOWHWND, MPFROMLONG (page), MPFROMHWND (hwndBBS));
  775.  
  776.             page = (ULONG)WinSendMsg (hwndCtl, BKM_INSERTPAGE, 0L, MPFROM2SHORT (BKA_MAJOR, BKA_LAST));
  777.             WinSendMsg (hwndCtl, BKM_SETTABTEXT, (MPARAM)page, MPFROMP ("FTP"));
  778.             hwndFTP = WinLoadDlg (hwndCtl, hwndCtl, DummyDlgProc, NULLHANDLE, 302, NULL);
  779.             WinSendMsg (hwndCtl, BKM_SETPAGEWINDOWHWND, MPFROMLONG (page), MPFROMHWND (hwndFTP));
  780.  
  781.             page = (ULONG)WinSendMsg (hwndCtl, BKM_INSERTPAGE, 0L, MPFROM2SHORT (BKA_MAJOR, BKA_LAST));
  782.             WinSendMsg (hwndCtl, BKM_SETTABTEXT, (MPARAM)page, MPFROMP ("Mail"));
  783.             hwndMail = WinLoadDlg (hwndCtl, hwndCtl, DummyDlgProc, NULLHANDLE, 303, NULL);
  784.             WinSendMsg (hwndCtl, BKM_SETPAGEWINDOWHWND, MPFROMLONG (page), MPFROMHWND (hwndMail));
  785.  
  786.             page = (ULONG)WinSendMsg (hwndCtl, BKM_INSERTPAGE, 0L, MPFROM2SHORT (BKA_MAJOR, BKA_LAST));
  787.             WinSendMsg (hwndCtl, BKM_SETTABTEXT, (MPARAM)page, MPFROMP ("News"));
  788.             hwndNews = WinLoadDlg (hwndCtl, hwndCtl, DummyDlgProc, NULLHANDLE, 304, NULL);
  789.             WinSendMsg (hwndCtl, BKM_SETPAGEWINDOWHWND, MPFROMLONG (page), MPFROMHWND (hwndNews));
  790.  
  791.             page = (ULONG)WinSendMsg (hwndCtl, BKM_INSERTPAGE, 0L, MPFROM2SHORT (BKA_MAJOR, BKA_LAST));
  792.             WinSendMsg (hwndCtl, BKM_SETTABTEXT, (MPARAM)page, MPFROMP ("Web"));
  793.             hwndWeb = WinLoadDlg (hwndCtl, hwndCtl, DummyDlgProc, NULLHANDLE, 305, NULL);
  794.             WinSendMsg (hwndCtl, BKM_SETPAGEWINDOWHWND, MPFROMLONG (page), MPFROMHWND (hwndWeb));
  795.          }
  796.  
  797.          WinPostMsg (hwnd, WM_USER, 0L, 0L);
  798. #elif defined(__NT__)
  799.          PROPSHEETPAGE psp[1];
  800.          PROPSHEETHEADER psh;
  801.  
  802.          psp[0].dwSize = sizeof (PROPSHEETPAGE);
  803.          psp[0].dwFlags = PSP_USETITLE;
  804.          psp[0].hInstance = hinst;
  805.          psp[0].pszTemplate = MAKEINTRESOURCE (0);
  806.          psp[0].pszIcon = NULL;
  807.          psp[0].pfnDlgProc = NULL;
  808.          psp[0].pszTitle = "BBS";
  809.          psp[0].lParam = 0;
  810.  
  811.          psh.dwSize = sizeof (PROPSHEETHEADER);
  812.          psh.dwFlags = PSH_PROPSHEETPAGE;
  813.          psh.hwndParent = hwnd;
  814.          psh.hInstance = hinst;
  815.          psh.pszIcon = NULL;
  816.          psh.pszCaption = (LPSTR)"Trackbar Properties";
  817.          psh.nPages = sizeof (psp) / sizeof (PROPSHEETPAGE);
  818.          psh.ppsp = (LPCPROPSHEETPAGE)psp;
  819.  
  820.          PropertySheet (&psh);
  821. #endif
  822.          break;
  823.       }
  824.  
  825.       case WM_SIZE:
  826. #if defined(__OS2__)
  827.          WinSetWindowPos (WinWindowFromID (hwnd, 101), NULLHANDLE, 0, 0, SHORT1FROMMP (mp2), SHORT2FROMMP (mp2), SWP_SIZE|SWP_SHOW);
  828. #elif defined(__NT__)
  829. #endif
  830.          break;
  831.  
  832. #if defined(__OS2__)
  833.       case WM_ERASEBACKGROUND:
  834.          return ((MRESULT)TRUE);
  835. #endif
  836.  
  837. #if defined(__OS2__)
  838.       case WM_CONTROL:
  839.          break;
  840. #endif
  841.  
  842. #if defined(__OS2__)
  843.       case WM_CLOSE:
  844. #elif defined(__NT__)
  845.       case WM_DESTROY:
  846. #endif
  847. #if defined(__NT__)
  848.          PostQuitMessage (0);
  849. #endif
  850.          break;
  851.    }
  852.  
  853. #if defined(__OS2__)
  854.    return (WinDefWindowProc (hwnd, msg, mp1, mp2));
  855. #elif defined(__NT__)
  856.    return (DefWindowProc (hwnd, msg, wParam, lParam));
  857. #endif
  858. }
  859.  
  860. #if defined(__OS2__)
  861. void main (int argc, char *argv[])
  862. {
  863.    int i, x, y, dx, dy;
  864.    HMQ hmq;
  865.    QMSG qmsg;
  866.    CHAR Title[64], *Config = NULL, *Channel = NULL;
  867.    ULONG flFrame;
  868.    RECTL rc;
  869.  
  870.    for (i = 1; i < argc; i++) {
  871.       if (Config == NULL)
  872.          Config = argv[i];
  873.       else if (Channel == NULL)
  874.          Channel = argv[i];
  875.    }
  876.  
  877.    if ((Cfg = new TConfig) != NULL) {
  878.       Cfg->TaskNumber = 1;
  879.       if (Cfg->Load (Config, Channel) == FALSE)
  880.          Cfg->Default ();
  881.    }
  882.  
  883.    if ((hab = WinInitialize (0)) != 0) {
  884.       if ((hmq = WinCreateMsgQueue (hab, 0)) != 0) {
  885.          WinRegisterClass (hab, "SERVER_WINDOW", ServerWinProc, CS_CLIPCHILDREN|CS_SIZEREDRAW|CS_MOVENOTIFY, 0);
  886.  
  887.          flFrame = (FCF_TASKLIST|FCF_TITLEBAR|FCF_SYSMENU|FCF_MINMAX|FCF_SIZEBORDER|FCF_NOBYTEALIGN);
  888.          if ((hwndMainFrame = WinCreateStdWindow (HWND_DESKTOP, 0, &flFrame, "SERVER_WINDOW", NULL, 0, NULLHANDLE, 256, &hwndMainClient)) != NULLHANDLE) {
  889.             sprintf (Title, "%s Internet Server %s", NAME, VERSION);
  890.             WinSetWindowText (hwndMainFrame, Title);
  891.  
  892.             WinQueryWindowRect (HWND_DESKTOP, &rc);
  893.             dx = 480;
  894.             if ((rc.xRight - rc.xLeft) < dx)
  895.                dx = rc.xRight - rc.xLeft;
  896.             dy = 374;
  897.             if ((rc.yTop - rc.yBottom) < dy)
  898.                dy = rc.yTop - rc.yBottom;
  899.  
  900.             x = ((rc.xRight - rc.xLeft) - dx) / 2;
  901.             y = ((rc.yTop - rc.yBottom) - dy) / 2;
  902.  
  903.             WinSetWindowPos (hwndMainFrame, NULLHANDLE, x, y, dx, dy, SWP_SIZE|SWP_MOVE|SWP_SHOW|SWP_ACTIVATE);
  904.  
  905.             while (WinGetMsg (hab, &qmsg, NULLHANDLE, 0, 0))
  906.                WinDispatchMsg (hab, &qmsg);
  907.  
  908.             WinDestroyWindow (hwndMainFrame);
  909.          }
  910.  
  911.          WinDestroyMsgQueue (hmq);
  912.       }
  913.  
  914.       WinTerminate (hab);
  915.    }
  916. }
  917. #elif defined(__NT__)
  918. int PASCAL WinMain (HINSTANCE hinstCurrent, HINSTANCE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow)
  919. {
  920.    CHAR Title[64];
  921.    MSG msg;
  922.    WNDCLASS wc;
  923.  
  924.    lpszCmdLine = lpszCmdLine;
  925.  
  926.    if (hinstPrevious == NULL) {
  927.       wc.style         = 0;
  928.       wc.lpfnWndProc   = ServerWinProc;
  929.       wc.cbClsExtra    = 0;
  930.       wc.cbWndExtra    = 0;
  931.       wc.hInstance     = hinstCurrent;
  932.       wc.hIcon         = NULL;
  933.       wc.hCursor       = LoadCursor (NULL, IDC_ARROW);
  934.       wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
  935.       wc.lpszMenuName  = NULL;
  936.       wc.lpszClassName = "SERVER_WINDOW";
  937.  
  938.       if (!RegisterClass (&wc))
  939.          return (FALSE);
  940.    }
  941.  
  942.    hinst = hinstCurrent;
  943.    msg.wParam = FALSE;
  944.  
  945.    sprintf (Title, "%s Internet Server v%s%s", NAME, VERSION, "");
  946.    if ((hwndMainClient = CreateWindowEx (WS_EX_OVERLAPPEDWINDOW, "SERVER_WINDOW", Title, WS_OVERLAPPEDWINDOW, 170, 240, 400, 200, NULL, NULL, hinstCurrent, NULL)) != NULL) {
  947.       ShowWindow (hwndMainClient, nCmdShow);
  948.  
  949.       while (GetMessage (&msg, NULL, 0, 0)) {
  950.          TranslateMessage (&msg);
  951.          DispatchMessage (&msg);
  952.       }
  953.    }
  954.  
  955.    return ((int)msg.wParam);
  956. }
  957. #endif
  958.  
  959. /*
  960. #if defined(__OS2__)
  961. void main (int argc, char *argv[])
  962. {
  963.    int i;
  964.    USHORT Task = 1;
  965.    CHAR Title[128], *Config = NULL, *Channel = NULL;
  966.    HMQ hmq;
  967.    QMSG qmsg;
  968.    ULONG flFrame;
  969.    POINTL aptl[2];
  970.  
  971.    Log = NULL;
  972.  
  973.    for (i = 1; i < argc; i++) {
  974.       if (!stricmp (argv[i], "/LINE")) {
  975.          i++;
  976.          Task = (USHORT)atoi (argv[i]);
  977.       }
  978.       else if (Config == NULL)
  979.          Config = argv[i];
  980.       else if (Channel == NULL)
  981.          Channel = argv[i];
  982.    }
  983.  
  984.    if ((Cfg = new TConfig) != NULL) {
  985.       Cfg->TaskNumber = Task;
  986.       if (Cfg->Load (Config, Channel) == FALSE)
  987.          Cfg->Default ();
  988.    }
  989.  
  990.    if ((hab = WinInitialize (0)) != 0) {
  991.       if ((hmq = WinCreateMsgQueue (hab, 0)) != 0) {
  992.          WinRegisterClass (hab, "MAIN_WINDOW", MainWinProc, CS_CLIPCHILDREN|CS_SIZEREDRAW|CS_MOVENOTIFY, 0);
  993.  
  994.          flFrame = (FCF_TASKLIST|FCF_TITLEBAR|FCF_SYSMENU|FCF_MINMAX|FCF_SIZEBORDER|FCF_NOBYTEALIGN|FCF_MENU);
  995.          if ((hwndMainFrame = WinCreateStdWindow (HWND_DESKTOP, 0, &flFrame, "MAIN_WINDOW", NULL, 0, NULLHANDLE, 257, &hwndMainClient)) != NULLHANDLE) {
  996.             sprintf (Title, "%s Internet Server v%s%s", NAME, VERSION, "");
  997.             WinSetWindowText (hwndMainFrame, Title);
  998.  
  999.             aptl[ 0 ].x = 60;
  1000.             aptl[ 0 ].y = 100;
  1001.             aptl[ 1 ].x = 250;
  1002.             aptl[ 1 ].y = 100;
  1003.             WinMapDlgPoints (HWND_DESKTOP, aptl, 2, TRUE);
  1004.             WinSetWindowPos (hwndMainFrame, NULLHANDLE, aptl[0].x, aptl[0].y, aptl[1].x, aptl[1].y, SWP_SIZE|SWP_MOVE|SWP_SHOW|SWP_ACTIVATE);
  1005.  
  1006.             WinStartTimer (hab, hwndMainClient, 1, 50);
  1007.  
  1008.             while (WinGetMsg (hab, &qmsg, NULLHANDLE, 0, 0)) {
  1009.                WinDispatchMsg (hab, &qmsg);
  1010.             }
  1011.  
  1012.             WinStopTimer (hab, hwndMainClient, 1);
  1013.             WinDestroyWindow (hwndMainFrame);
  1014.          }
  1015.  
  1016.          WinDestroyMsgQueue (hmq);
  1017.       }
  1018.       WinTerminate (hab);
  1019.    }
  1020.  
  1021.    if (Cfg != NULL)
  1022.       delete Cfg;
  1023. }
  1024. #elif defined(__NT__)
  1025. int PASCAL WinMain (HINSTANCE hinstCurrent, HINSTANCE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow)
  1026. {
  1027.    USHORT Task = 1;
  1028.    CHAR Title[128], *Config = NULL, *Channel = NULL;
  1029.    MSG msg;
  1030.    WNDCLASS wc;
  1031.  
  1032.    Log = NULL;
  1033.    lpszCmdLine = lpszCmdLine;
  1034.  
  1035.    if ((Cfg = new TConfig) != NULL) {
  1036.       Cfg->TaskNumber = Task;
  1037.       if (Cfg->Load (Config, Channel) == FALSE)
  1038.          Cfg->Default ();
  1039.    }
  1040.  
  1041.    if (hinstPrevious == NULL) {
  1042.       wc.style         = 0;
  1043.       wc.lpfnWndProc   = MainWinProc;
  1044.       wc.cbClsExtra    = 0;
  1045.       wc.cbWndExtra    = 0;
  1046.       wc.hInstance     = hinstCurrent;
  1047.       wc.hIcon         = NULL;
  1048.       wc.hCursor       = LoadCursor (NULL, IDC_ARROW);
  1049.       wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
  1050.       wc.lpszMenuName  = "MENU_1";
  1051.       wc.lpszClassName = "MAIN_WINDOW";
  1052.  
  1053.       if (!RegisterClass (&wc))
  1054.          return (FALSE);
  1055.    }
  1056.  
  1057.    hinst = hinstCurrent;
  1058.    msg.wParam = FALSE;
  1059.  
  1060.    sprintf (Title, "%s Internet Server v%s%s", NAME, VERSION, "");
  1061.    if ((hwndMainClient = CreateWindowEx (WS_EX_OVERLAPPEDWINDOW, "MAIN_WINDOW", Title, WS_OVERLAPPEDWINDOW, 170, 240, 400, 200, NULL, NULL, hinstCurrent, NULL)) != NULL) {
  1062.       ShowWindow (hwndMainClient, nCmdShow);
  1063.  
  1064.       SetTimer (hwndMainClient, 1, 50, NULL);
  1065.  
  1066.       while (GetMessage (&msg, NULL, 0, 0)) {
  1067.          TranslateMessage (&msg);
  1068.          DispatchMessage (&msg);
  1069.       }
  1070.  
  1071.       KillTimer (hwndMainClient, 1);
  1072.    }
  1073.  
  1074.    if (Cfg != NULL)
  1075.       delete Cfg;
  1076.  
  1077.    return ((int)msg.wParam);
  1078. }
  1079. #endif
  1080. */
  1081.  
  1082.