Click here to Skip to main content
12,358,696 members (63,058 online)
Click here to Skip to main content

Stats

403.3K views
25.5K downloads
163 bookmarked
Posted

A Complete FTP Server

, 30 May 2005
This article presents a fully functional implementation of a FTP server.
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif //_WIN32\r\n"
    "#include ""res\\FTPServer.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""         // Standard components\r\n"
    "#endif\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_FTPSERVER           ICON    DISCARDABLE     "res\\ftp.ico"
IDI_USER                ICON    DISCARDABLE     "res\\user.ico"
IDI_LOG                 ICON    DISCARDABLE     "res\\icon2.ico"
IDI_ONLINE_USERS        ICON    DISCARDABLE     "res\\users.ico"
IDI_LED_RED             ICON    DISCARDABLE     "res\\led_red.ico"
IDI_LED_OFF             ICON    DISCARDABLE     "res\\led_off.ico"
IDI_LED_GREEN           ICON    DISCARDABLE     "res\\led_gree.ico"
IDI_FOLDER              ICON    DISCARDABLE     "res\\folder.ico"
IDI_STATISTICS          ICON    DISCARDABLE     "res\\statistics.ico"
IDI_CONFIGURATION       ICON    DISCARDABLE     "res\\configur.ico"
IDI_USERACCOUNTS        ICON    DISCARDABLE     "res\\useracco.ico"
IDI_ADD                 ICON    DISCARDABLE     "res\\add.ico"
IDI_DEL                 ICON    DISCARDABLE     "res\\del.ico"
IDI_EDIT                ICON    DISCARDABLE     "res\\edit.ico"
IDI_UPDATE              ICON    DISCARDABLE     "res\\update.ico"
IDI_DELUSER             ICON    DISCARDABLE     "res\\deluser.ico"
IDI_INTERNET            ICON    DISCARDABLE     "res\\internet.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_APPLICATION DIALOGEX 0, 0, 400, 250
STYLE DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | 
    WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "Quick 'n Easy FTP Server Lite"
MENU IDR_MAINMENU
FONT 8, "MS Sans Serif"
BEGIN
    CONTROL         "List1",IDC_OUTLOOKBAR,"SysListView32",LVS_SINGLESEL | 
                    LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,2,4,66,244
    CONTROL         "",IDC_STATIC1,"Static",SS_ETCHEDHORZ,0,0,400,1
    CONTROL         "",IDC_INFOBAR,"Static",SS_GRAYRECT | SS_NOTIFY,71,4,327,
                    14
    CONTROL         "",IDC_DIALOG_AREA,"Static",SS_GRAYFRAME | NOT 
                    WS_VISIBLE,71,23,327,226,WS_EX_TRANSPARENT
END

IDD_PROPPAGE_TRACE DIALOG DISCARDABLE  0, 0, 280, 162
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
    LISTBOX         IDC_TRACE,0,0,279,161,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | 
                    WS_TABSTOP
END

IDD_PROPPAGE_ONLINE DIALOG DISCARDABLE  0, 0, 280, 162
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
    CONTROL         "List1",IDC_ONLINE_USERS,"SysListView32",LVS_REPORT | 
                    LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,0,0,279,161
END

IDD_PROPPAGE_CONFIGURATION DIALOG DISCARDABLE  0, 0, 275, 197
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
    LTEXT           "FTP Port:",IDC_STATIC,3,7,31,12,SS_CENTERIMAGE
    EDITTEXT        IDC_PORT,75,7,50,12,ES_AUTOHSCROLL | ES_NUMBER
    LTEXT           "Max.Connections:",IDC_STATIC,3,23,58,12,SS_CENTERIMAGE
    EDITTEXT        IDC_MAX_USERS,75,23,50,12,ES_AUTOHSCROLL | ES_NUMBER
    LTEXT           "Connection Timeout:",IDC_STATIC,3,39,66,12,
                    SS_CENTERIMAGE
    EDITTEXT        IDC_TIMEOUT,75,39,50,12,ES_AUTOHSCROLL | ES_NUMBER
    LTEXT           "Welcome Message:",IDC_STATIC,3,55,64,12,SS_CENTERIMAGE
    EDITTEXT        IDC_WELCOME_MSG,75,55,194,12,ES_AUTOHSCROLL
    LTEXT           "Goodbye Message:",IDC_STATIC,3,71,62,12,SS_CENTERIMAGE
    EDITTEXT        IDC_GOODBYE_MSG,75,71,194,12,ES_AUTOHSCROLL
    CONTROL         "Launch FTP Server at windows startup",
                    IDC_LAUNCH_ON_STARTUP,"Button",BS_AUTOCHECKBOX | 
                    WS_TABSTOP,75,90,139,10
    CONTROL         "Startup minimized in systemtray",IDC_START_IN_TRAY,
                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,103,113,10
    CONTROL         "Automatically activate server at startup",
                    IDC_AUTOACTIVATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
                    75,116,137,10
    PUSHBUTTON      "&Apply",IDC_APPLY,219,176,50,14
    LTEXT           "minutes.",IDC_STATIC,130,39,27,12,SS_CENTERIMAGE
END

IDD_ABOUT DIALOG DISCARDABLE  0, 0, 234, 178
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | 
    WS_SYSMENU
CAPTION "About Quick 'n Easy FTP Server Lite"
FONT 8, "MS Sans Serif"
BEGIN
    LTEXT           "Static",IDC_STARWARS,0,0,233,177,SS_NOTIFY
END

IDD_PROPPAGE_STATISTICS DIALOG DISCARDABLE  0, 0, 280, 162
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
    CONTROL         "List1",IDC_STATISTICS,"SysListView32",LVS_REPORT | 
                    LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | 
                    WS_TABSTOP,0,0,279,161
END

IDD_ADD_USER DIALOG DISCARDABLE  0, 0, 186, 69
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add User"
FONT 8, "MS Sans Serif"
BEGIN
    EDITTEXT        IDC_NAME,6,23,174,12,ES_AUTOHSCROLL
    DEFPUSHBUTTON   "&OK",IDOK,5,48,50,14
    PUSHBUTTON      "&Cancel",IDCANCEL,130,48,50,14
    LTEXT           "Enter a username:",IDC_STATIC,6,10,58,8
END

IDD_PROPPAGE_ACCOUNTS DIALOG DISCARDABLE  0, 0, 305, 197
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
    CONTROL         "List1",IDC_USERS,"SysListView32",LVS_REPORT | 
                    LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | 
                    WS_BORDER | WS_TABSTOP,0,0,103,174
    PUSHBUTTON      "&Add...",IDC_ADD_USER,0,179,50,14
    PUSHBUTTON      "&Edit...",IDC_EDIT_USER,53,179,50,14
    PUSHBUTTON      "&De&lete",IDC_DEL_USER,107,179,50,14
    PUSHBUTTON      "&Save",IDC_UPDATE,255,179,50,14
    CONTROL         "Disable A&ccount",IDC_DISABLE_ACCOUNT,"Button",
                    BS_AUTOCHECKBOX | WS_TABSTOP,110,0,68,10
    EDITTEXT        IDC_PASSWORD,148,15,97,12,ES_PASSWORD | ES_AUTOHSCROLL
    EDITTEXT        IDC_HOME_DIRECTORY,148,32,157,12,ES_AUTOHSCROLL
    PUSHBUTTON      "&Browse...",IDC_BROWSE,148,48,50,14
    LTEXT           "Permissions for home directory:",IDC_STATIC,110,70,98,8
    CONTROL         "Allow Download",IDC_DOWNLOAD,"Button",BS_AUTOCHECKBOX | 
                    WS_TABSTOP,110,82,67,10
    CONTROL         "Allow Upload",IDC_UPLOAD,"Button",BS_AUTOCHECKBOX | 
                    WS_TABSTOP,110,94,57,10
    CONTROL         "Allow Delete",IDC_DELETE,"Button",BS_AUTOCHECKBOX | 
                    WS_TABSTOP,110,106,55,10
    CONTROL         "Allow Create Directory",IDC_CREATE_DIR,"Button",
                    BS_AUTOCHECKBOX | WS_TABSTOP,110,118,85,10
    LTEXT           "Password:",IDC_STATIC,110,15,36,12,SS_CENTERIMAGE
    LTEXT           "Home :",IDC_STATIC,110,32,24,12,SS_CENTERIMAGE
END


#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x9L
#else
 FILEFLAGS 0x8L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "Programmed by Pablo\0"
            VALUE "CompanyName", "Pablo Software Solutions\0"
            VALUE "FileDescription", "FTPServer MFC Application\0"
            VALUE "FileVersion", "1, 0, 0, 0\0"
            VALUE "InternalName", "FTPServer\0"
            VALUE "LegalCopyright", "Copyright (C) 2005\0"
            VALUE "LegalTrademarks", "http://www.pablosoftwaresolutions.com\0"
            VALUE "OriginalFilename", "FTPServer.EXE\0"
            VALUE "PrivateBuild", "Version 1.00\0"
            VALUE "ProductName", "FTPServer Application\0"
            VALUE "ProductVersion", "1, 0, 0, 0\0"
            VALUE "SpecialBuild", "\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

#endif    // !_MAC


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_APPLICATION, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 393
        TOPMARGIN, 7
        BOTTOMMARGIN, 243
    END

    IDD_PROPPAGE_TRACE, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 273
        TOPMARGIN, 7
        BOTTOMMARGIN, 155
    END

    IDD_PROPPAGE_ONLINE, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 273
        TOPMARGIN, 7
        BOTTOMMARGIN, 155
    END

    IDD_PROPPAGE_CONFIGURATION, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 268
        TOPMARGIN, 7
        BOTTOMMARGIN, 190
    END

    IDD_ABOUT, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 227
        TOPMARGIN, 7
        BOTTOMMARGIN, 171
    END

    IDD_PROPPAGE_STATISTICS, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 273
        TOPMARGIN, 7
        BOTTOMMARGIN, 155
    END

    IDD_ADD_USER, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 179
        TOPMARGIN, 7
        BOTTOMMARGIN, 62
    END

    IDD_PROPPAGE_ACCOUNTS, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 298
        TOPMARGIN, 7
        BOTTOMMARGIN, 190
    END
END
#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

IDR_POPUP_MENU MENU DISCARDABLE 
BEGIN
    POPUP "popup"
    BEGIN
        MENUITEM "About...",                    ID_APP_ABOUT
        MENUITEM SEPARATOR
        MENUITEM "Configuration...",            ID_APP_SHOW
        MENUITEM SEPARATOR
        MENUITEM "Start Server",                ID_SERVER_START
        MENUITEM "Stop Server",                 ID_SERVER_STOP
        MENUITEM SEPARATOR
        MENUITEM "Shutdown Server",             ID_APP_EXIT
    END
END

IDR_MAINMENU MENU DISCARDABLE 
BEGIN
    POPUP "&Server"
    BEGIN
        MENUITEM "&Start",                      ID_SERVER_START
        MENUITEM "S&top",                       ID_SERVER_STOP
        MENUITEM SEPARATOR
        MENUITEM "E&xit",                       ID_SERVER_EXIT
    END
    POPUP "&View"
    BEGIN
        MENUITEM "Server &Trace",               IDC_VIEW_TRACE
        MENUITEM "&User Accounts",              IDC_VIEW_USERACCOUNTS
        MENUITEM "&Configuration",              IDC_VIEW_CONFIGURATION
        MENUITEM "&Online Users",               IDC_VIEW_ONLINE_USERS
        MENUITEM "St&atistics",                 IDC_VIEW_STATISTICS
    END
    POPUP "&Help"
    BEGIN
        MENUITEM "&Check for Updates...",       ID_HELP_GETLATESTVERSION
        MENUITEM SEPARATOR
        MENUITEM "&About...",                   ID_HELP_ABOUT
    END
END

IDR_INFOBARMENU MENU DISCARDABLE 
BEGIN
    POPUP "infobar"
    BEGIN
        MENUITEM "Server Trace",                IDC_VIEW_TRACE
        MENUITEM "User Accounts",               IDC_VIEW_USERACCOUNTS
        MENUITEM "Configuration",               IDC_VIEW_CONFIGURATION
        MENUITEM "Online Users",                IDC_VIEW_ONLINE_USERS
        MENUITEM "Statistics",                  IDC_VIEW_STATISTICS
    END
END

IDR_TRACE_MENU MENU DISCARDABLE 
BEGIN
    POPUP "trace"
    BEGIN
        MENUITEM "&Clear",                      ID_TRACE_CLEAR
    END
END

IDR_ONLINE_MENU MENU DISCARDABLE 
BEGIN
    POPUP "online"
    BEGIN
        MENUITEM "Kick User(s)",                IDC_KICK_USER
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//

IDR_TOOLBAR1 TOOLBAR DISCARDABLE  16, 15
BEGIN
    BUTTON      ID_SERVER_START
    BUTTON      ID_SERVER_STOP
    SEPARATOR
    BUTTON      ID_HELP_ABOUT
END


/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDR_TOOLBAR1            BITMAP  DISCARDABLE     "res\\toolbar1.bmp"

/////////////////////////////////////////////////////////////////////////////
//
// 24
//

1                       24      DISCARDABLE     "res\\xptheme.bin"

/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_ABOUTBOX            "&About FTPServer..."
    IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed."
END

STRINGTABLE DISCARDABLE 
BEGIN
    ID_INDICATOR_DATA_RECEIVED "0 bytes received"
    ID_INDICATOR_ONLINELED  " "
    ID_INDICATOR_OFFLINELED " "
    ID_INDICATOR_DATA_SEND  "0 bytes sent"
END

STRINGTABLE DISCARDABLE 
BEGIN
    ID_SERVER_START         "Start FTP Server\nStart FTP Server"
    ID_SERVER_STOP          "Stop FTP Server\nStop FTP Server"
    ID_HELP_ABOUT           "Aboutbox\nAboutbox"
    ID_USER_ACCOUNTS        "Add/Edit User Accounts\nAdd/Edit User Accounts"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDC_USERS               "Edit User Accounts\nEdit User Accounts"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDC_ABOUT               "Aboutbox\nAboutbox"
    ID_ACCOUNT_WIZARD       "User Account Wizard\nUser Account Wizard"
END

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\FTPServer.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"         // Standard components
#endif

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Pablo van der Meer
Web Developer
Netherlands Netherlands
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160621.1 | Last Updated 30 May 2005
Article Copyright 2002 by Pablo van der Meer
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid