WINFTP A WINSOCKBASED FTP CLIENT FOR WINDOWS 31

WINFTP A WINSOCKBASED FTP CLIENT FOR WINDOWS 31






WinFTP - A WinSock-based FTP Client for Windows 3.1 and Windows/NT.

Written by  :  Santanu Lahiri
Based on    :  WS_FTP & WS_PING by Mr John A. Junod
Release Date:  January 7th, 1993

Please read the installation guide before proceeding with the actual
installation of this software, as there are some incompatibilities
with the original version.

WinFTP is based on the WS_FTP program originally written by Mr John A. 
Junod, for Microsoft Windows 3.1.  In WinFTP, I have added a few features
that I feel would be nice to have in a program of this kind.  I am using 
the FTP engine from WS_FTP, as I believe Mr. Junod has done a really 
superb job on it,  and I give him full credit for that.  I would like 
to take this opportunity to thank him for releasing the source to Public 
Domain.  That has made it possible for me to learn some of the basics 
of WinSock programming from a working source.

I am including the source for the project as part of the release.  
Unfortunately, I do not have the necessary expertise in or access to 
Borland's compiler or environment to make the code portable to either.  
This current version has been compiled with Microsoft Visual C for Windows
and Visual C for Windows NT.  If you adapt this code to Borland's compiler, 
please consider making the source available as Public Domain.  

If you run into any bugs in this release, or would like to see other features,
please let me know at the following address, or simply post on alt.winsock.  
I will attempt to maintain the source, but I can not guarantee a prompt 
turn-around.  If you add to or modify the source, please consider contacting 
me so that I can incorporate the changes as well.

Internet:     [email protected]
BITNET  :     lahiri@ohsthr

Disclaimer.
------------

While I have run this software on several different machines and operating 
systems, and have made an attempt to fix any bugs I've run into, you use 
this software at your own risk.  To the best of my knowledge, the program 
is virus-free and has not exhibited any unusual tendencies to go berserk.  
However, I am not liable for any damages you may incur as a consequence of 
using this software.  

Also, while this release was posted using Ohio State University's
resources, OSU is not responsible for it, nor should it be held liable.  My
development of this software was done independent of my connection to
OSU.

------------------------------------------------------------------------

Now with the pleasantries out of the way, here is a description of the
release itself.  For those of you who had already gotten the previous
release (WS_FTPB.ZIP, not WS_FTP.ZIP), you will need to make some
modifications to your INI file.  These are detailed later.

The INI File Format.
---------------------

The program works on the presumption that it is easier to remember and
understand a descriptive string like "CICA.Indiana Windows File Archive"
rather than the name ftp.cica.indiana.edu.  And the assumption that now
and then we need to log in to the same machine using more than one User
ID.  The concept of a Configuration is that you associate a description
with a combination of Host ID and User ID.  Once a Configuration is
defined, it is unique. 

The .INI File format is given below.  You can supply a Configuration
string to name each configuration.  In this version, the HostType 
values are as follows:

AutoDetect               0

Unix                     1    QVT                      8
IBM VM                   2    IBM/TCP                  9
VMS/Multinet             3    Chameleon               10
VMS/UCX                  4    SuperTCP                11
Ftp Software             5    SI NT FTPD              12
CUTCP/NCSA               6    IBM MVS                 13
NOS                      7    UniSys 5000             14

The following file is a sample WINFTP.INI file.  If you wish to set
up a proper initialization file, you must edit all references to
directories and all passwords.

WIN16:  Copy the WINFTP.INI file into the WINDOWS directory
WIN32:  Copy the WINFTP.INI file into the \WINNT directory

Sample  WINFTP.INI  file:
---------------------------

[WINFTP]
CONFIG=Oakland FTP Service
HOSTNAME=oak.oakland.edu
USERID=anonymous
[email protected]
VIEWER=d:\pfe\pfe32
LogFile=
LogFlag=On
TempDir=D:\TEMP
ConfigNum=20
ViewerCount=6
Retain=0
DblClk=1
AUTOSTART=1
FLAGS=21
CFG0=Oakland FTP Service
CFG1=Monash FTP Archives
CFG2=Biochemistry
CFG3=Cica FTP Archives
CFG4=SunSite Archives

[WINFTP:Viewer]
Viewer1=A,.TXT,D:\PFE\PFE,D:\Docs
Viewer2=I,.ZIP,D:\WIN\WIZ\WIZUNZIP
Viewer3=I,.GIF,D:\WIN\WINGIF\WINGIF,D:\WIN\WINGIF
Viewer4=I,.BMP,D:\WIN\WINGIF\WINGIF,D:\WIN\WINGIF
Viewer5=A,.LST,D:\WIN\GANDER\GANDER
Viewer6=I,.WRI,WRITE

[WINFTP:Oakland FTP Service]
HostName=oak.oakland.edu
UserID=anonymous
[email protected]
HostType=AutoDetect
TimeOut=65
Save=0

[WINFTP:Monash FTP Archives]
HostName=ftp.cc.monash.edu.au
UserID=anonymous
[email protected]
DIR=/pub/win3
HostType=AutoDetect
TimeOut=65
Save=1
DIR1=/pub/win3
DIR2=/pub/win3/access
DIR3=/pub/win3/drivers
DIR4=/pub/win3/drivers/printer
DIR5=/pub/win3/nt

[WINFTP:Biochemistry]
HostName=biochemistry.bioc.cwru.edu
UserID=anonymous
[email protected]
HostType=Unix
TimeOut=65

[WINFTP:Cica FTP Archives]
HostName=ftp.cica.indiana.edu
UserID=anonymous
[email protected]
HostType=AutoDetect
TimeOut=65

[WINFTP:SunSite Archives]
HostName=sunsite.unc.edu
UserID=anonymous
[email protected]
HostType=AutoDetect
TimeOut=65


Description of Dialogs used in WinFTP
======================================================

The HostName Dialog
---------------------

This dialog appears when you wish to connect to a host and click on the
"Connect" button.  Note that the "Save Configuration" option has now been 
replaced by "Save Directories." and has a different functionality to it.
The components of the dialog are:

Config  :  The name assigned to the configuration.  
Host    :  The name of the Remote host you wish to connect to.
UserID  :  User ID you will be logging in with
Passwd  :  Corresponding password
TimeOut :  Time in seconds after which WinFTP will abort the connection.
HostType:  Type of Operating System on the host you are connecting to.

Script  :  Name of a Script file.  Not Implemented yet.  DO NOT USE.
Account :  MiniDisk Password option.  Not implemented yet, DO NOT USE.

Save Password   :  Will save your password as part of your configuration.
Save Directories:  If selected, will save list of visited directories on
                   Close or Exit.

Anonymous Login :  Resets UserID & Passwd fields to appropriate values.
DelCfg  :  Delete Current configuration.
SaveCfg :  Save/Update Current Configuration.
Cancel  :  Cancel the Dialog.
OK      :  Accept Current Configuration & Log in to Host

If a configuration name is not supplied, WinFTP will attempt to create
one when saving a configuration.
         
The host types currently supported are listed above in the .INI file 
section.  If the type of host you are logging into is not available 
in the list, please contact me with a directory listing and I will 
attempt to include it.


The PingHost Dialog
--------------------

This dialog allows you to query a name server or your hosts file for the
InterNet address corresponding to a host, and ping that host if you
wish.  The "Resolve" button performs the DNS query, while the "PingHost"
button pings it.  You can specify the size of the Ping packet, and the
repeat count.

The Ping code draws heavily on the WS_PING program by John Junod.
Both blocking and async ping operations are supported, at least on the
Trumpet stack.

This function is still not quite there, though.  For now, I've only been
able to get it to work with the Trumpet stack, version A17, A18.  It does 
NOT work under Win/NT, or with the FTP Software stack as yet.  It works
with the Trumpet stack only because this stack seems to support the
socket type SOCK_RAW when creating a socket.  Any suggestions as to
using a different socket type or code is welcome.


The Options Dialog
--------------------

Program Options
  Viewer :  Default viewer to use if no association is defined or found.
  EMail  :  Default password for anonymous logins
  TempDir:  Default Directory for temporary files, for viewing purposes.

  AutoConnect:  Hostname Dialog to be displayed on startup?
  RetainFiles:  Leave viewed files on Temporary directory to be cleaned
                up manually.

Viewers
  Type   :  File Extension, such as .TXT, .ZIP, .BMP etc to look for.
  Viewer :  Program to use in order to view the selected file.
  VuDir  :  Directory to use for this viewer.
  
  TransferType:  The type to be used (ASCII or Binary) for downloading 
                 files from remote host prior to viewing.


DoubleClick:  Interpret double-click on a file as a View command or a
              Transfer.
              
FTP Session Options
  Verbose  :  If selected, shows every message being processed.
  Prompt   :  Ask User for file name before transferring files.
  RecvUniq :  Assign Unique File name when receiving files.
  PortCmds :  Internal - Pick Unused port or reuse existing socket.
  Bell     :  Sound bell on transfer
  
Transfer Mode: Default Transfer Mode to use -  ASCII, Binary or L8.


Viewer Support in WinFTP
==================================

I have added Viewer support for various file types.  You do need to
define the viewers, though.  The section in the .INI file labelled

     [WINFTP:Viewer]

has the following format:

ViewerNN=<TransferType>,<FileExtension>,<ViewerName>[,<ViewerDirectory>]

where  TransferType    is A (ASCII) or I (Image/Binary)
       FileExtension   is of the form ".EXT"
       ViewerDirectory is the directory where the file will be viewed

Example:

Viewer1=A,.TXT,D:\PFE\PFE,D:\Docs       
Viewer2=I,.ZIP,D:\WIN\WIZ\WIZUNZIP

If you manually add or delete viewers, you should also update the
ViewerCount variable in the [WINFTP] section

The Viewer type is determined by the file extension, so this may or may not 
work for every type of file. Also, when specifying a viewer, you MUST 
specify the transfer type.  For example, if you wish to view .ZIP files, 
you must set the transfer type to Binary, or the downloaded file will be 
garbage.

Lastly, if there is no viewer defined, the Windows version will attempt
to use the associations defined for the File Manager.  If it does not
find one, it will use the default viewer, with ASCII transfer type.



Modifying the WS_FTP.INI file from the WS_FTPB release
======================================================

For those of you who downloaded the WS_FTPB.ZIP archive, I apologize for
putting you through this inconvenience.  The WS_FTP.INI filename is now
used by the original WS_FTP program, hence I have changed the name of my
application to WinFTP.  You can convert the WS_FTP.INI file created by
my previous release by renaming the file to WINFTP.INI, and replacing
all occurances of WS_FTP in the file by WINFTP using a text editor like
NotePad, or Edit.

I strongly recommend switching over from the WS_FTPB release as there has
been a substantial number of bug fixes in this release of WinFTP.

Release Notes :
==========================================


December 14th, 1993
--------------------------

This release includes a Win16 version of the program as well as a Win32
native application.  The Win32 application was compiled with the Microsoft
Visual C++/NT compiler for a 486 class machine.  I am not sure if it
will also run on a 386.  You are welcome to try it.

Following are some of the features of the software:
----------------------------------------------------

+  Configuration Entry as the base unit for the HostName dialog, and
   the ability to save and delete configurations within the dialog. 
   This allows you to have multiple logins defined for the same host
   using different configuration names.

+  A "Directory History" box for both local and remote sites so that 
   you can pick a directory you have already visited, without having 
   to traverse the entire directory tree.  
   
+  Association of frequently visited directories with each host.  The
   directories are saved along with the configuration, and the next time
   you log in using the same configuration, the History box is
   initialized with this list.  You do need to set a flag for this.

+  File Specification filters.  This will allow you to look for specific 
   file types such as *.txt, or a*.zip in the local and remote hosts.  
   
+  File Viewer support.  You can specify viewers through the Options 
   Dialog and use them to view files at the remote of local host.  If
   no viewer is defined, attempt to use associations from File Manager.
   See the section on Viewer Support for more details.

+  Ability to interpret a double-click on a file name as a View command 
   rather than a file transfer.  You can select the mode from the 
   Options dialog.  This was a request from an user of the Norton
   Desktop software.

+  Message Logging ability.  Select the Flags/Log To File option on
   the Debug window to enable or disable Message Logging.  by default
   the function is disabled.
   
+  Ability to Ping a remote host.  This is available under the Host menu
   item.  See section on PingHost Dialog for details.

Future Enhancements Planned
----------------------------

+  Ability to run scripts.
+  Ability to use MiniDisk Passwords.
+  Ability to perform transfers through firewalls.

The software was tested on a 486 PC Clone with several remote hosts 
using Peter Tattam's Trumpet Winsock A17 & A18 with the internal SLIP 
driver.  The Windows NT version was tested using the Microsoft WinSock
implementation released with the Windows NT SDK, final release.

The Test Host Types were VMS/Multinet, VMS/UCX, QVT/Net 3.94, Ultrix,
IBM MVS and flavors of Unix as found on various FTP sites.


Known Bugs:
-------------

On the Windows NT version, I get an error when I am uploading a file to
the remote host - "Connection reset by peer".  I am trying to track
this.  However, it does not seem to affect the actual upload. 

There is also a resource leak that I have not yet been able to identify.
I believe it may have to do with the way I paint the screen.  But the 
leak is sporadic, and if anyone else notices it, I would like to be 
informed so that I can fix it.  Also any suggestions on tracking it 
is most welcome.



Compiling for Windows Vs Windows NT
------------------------------------------

The source for the program is included in the ZIP file WSFTPSRC.ZIP.  It
is for both environments, except that when compiling under Windows NT,
you need to define the symbol "WIN32".  I have included makefiles for
both Visual C++/Windows and Visual C++/WinNT.  These can serve as a
starting point if you wish to recompile the software.




Version of 01/07/94
==========================================

General Notes
-------------------------------------

This version should be quite a bit more stable than the last
release.  I have received a number of suggestions as to desired
features.  A few have been implemented, others are still waiting.
For those of you who wanted a macro feature, I am sorry, but
this version is not it.  However, some other ideas are in place
and hopefully will prove useful.

Also, this will be the last release with identical code for the 
Windows and Windows NT.  I am reworking the code completely and 
in the next release I would like to take advantage of NT-specific
features such as multithreading and so on.  Don't know how much
time I'll have to devote to that though.  So don't hold your breath.



Bug Fixes:
------------------------------------------------------------

The bug causing WinQVT to choke has been fixed.  Logging out will now 
correctly restore the FTP Server to the Ready state.

A memory overwrite that was causing a random GPF has been fixed.

A bug that prevented more than twenty configurations has been fixed.



Features added this version:
-----------------------------------

+  %Done Bar - This will be displayed on all uploads and on downloads
   where the server sends the file size in bytes to the client. 

+  Zoom Window - Lets you view the messages displayed in the main window
   in a separate window, hopefully with a more readable font.

+  FireWall Info - You can finally specify the Firewall info from the main
   window.  However, this feature is still untried as I do not have access
   to a firewall host.  Located under the "File" menu item.

+  Delete All Dialog - Now you can get around the "Confirm Delete" message
   if you are deleting multiple files.

+  DragDrop Capability - Drag a set of files from the File Manager and drop
   them anywhere on the main window to upload them to the remote host.
   
+  Directory Sort feature for Remote Directory.  In this version you can 
   have the remote directory sorted by name or by date & time if you are
   logging in to an Unix Host.  The sorted directory will be visible 
   using the LongDir command.  Unfortunately, I have not implemented it
   for every host type yet, so for non-Unix hosts you can not do this yet.
   Look under the "View" menu item for this option.
   
   
Menu Layout:
===========================================================================

File              View             Hosts          Script     Zoom     About
  WinFTP Setup      Sort By Name     Ping Host
  LogFile Name      Sort By Date     Host Types
  FireWall Setup    DebugWin
  Commands          SaveDir
     CWD, HELP,     Log To File
     LIST,NLST,
     MKD, QUOTE,
     PWD, RETR,
     RMD, STOR
  Connect
  Disconnect
  Download
  Exit
     
     





Tags: client for, winsockbased, winftp, client, windows