telnetd.cpp
上传用户:wsk323
上传日期:2007-01-05
资源大小:403k
文件大小:3k
- /*---------------------------------------------------------------------------
- Copyright: E. Brady Trexler
- Creation: March 1998, skeleton generated by Borland C++ Builder.
- Description: The main project file. If created as a WindowsNT Service,
- by defining SERVICE when building, a TDCService is
- instantiated and handles the command line. TDCService is a
- class written by
- Daniel Carey -- whawke@multipro.com
- http://users.multipro.com/whawke
-
- I basically used his code and altered the Run routine, as
- he suggests.
- If not used as a service, this basically starts a telnet
- server that will run on Windows95, albeit very dangerously,
- as no user validation is performed.
- The telnet server is implemented in VTTelnetDaemon.
- Legal issues: Copyright (C) 1998 by E. Brady Trexler
- This software is provided 'as-is', without any express or
- implied warranty. In no event will the author be held liable
- for any damages arising from the use of this software.
- Permission is granted to anyone to use this software for any
- purpose, excluding commercial applications, and to alter it
- and redistribute it freely, subject to the following
- restrictions:
- 1. The origin of this software must not be misrepresented,
- you must not claim that you wrote the original software.
- If you use this software in a product, an acknowledgment
- in the product documentation would be appreciated but is
- not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
- Updates:
- ---------------------------------------------------------------------------*/
- #include <condefs.h>
- #pragma hdrstop
- #include "tdcservice.h"
- #include "VTTelnetSession.h"
- #include "VTTelnetDaemon.h"
- //---------------------------------------------------------------------------
- USEUNIT("tdcservice.cpp");
- USEUNIT("VTTelnetDaemon.cpp");
- USERC("tdcservmsg.rc");
- USEUNIT("VTTelnetSession.cpp");
- USERES("telnetd.res");
- //---------------------------------------------------------------------------
- #pragma argsused
- int main(int argc, char **argv)
- {
- #ifdef SERVICE
- TDCService tsvc("VTrex Telnet Daemon");
- if (!tsvc.ParseStandardArgs(argc, argv)) {
- tsvc.StartService();
- }
- return tsvc.m_Status.dwWin32ExitCode;
- #else
- Application->Initialize();
- //create a TVTDaemon, which listens at the telnet port
- VTDaemon = new TVTDaemon(Application);
- while (VTDaemon) {
- // these next lines are crazy -- because we don't want it to terminate
- // but all we need is one message to be sent, which Terminate() does,
- // and in this context, handling that message does not close the app.
- Application->Terminate();
- Sleep(50);
- Application->HandleMessage();
- }
- return 0;
- #endif
- }