Keith & Koep FTP-Server Modification
A modified version of the standard ftp-server is available. This supports loading and running custom actions out of a DLL, when a FTP-Server transaction has finished or is about to start.
The DLL to load by the ftp-server is specified by:
[HKEY_LOCAL_MACHINE\Comm\FTPD] CustomActionDll="<name of custom dll>"
It should export the following functions:
void OpenConnection( void);
This function gets called when a ftp-session is established.
void CloseConnection( void);
This function gets called when a ftp-session is closed.
void UploadFile( WCHAR *file);
This function gets called, just before a file gets uploaded to the ftp-server. This could be used to backup files, before they get overwritten.
void UploadFileDone( WCHAR *file);
This function gets called after the upload completed successfully. In the sample implementation it executes the file, if it is named update.bat or update.exe.
void DownloadFile( WCHAR *file);
This function gets called, just before a file is downloaded by a ftp-client. This could be used to generate the content of this file or to tell the application to release this file.
void DownloadFileDone( WCHAR *file);
This function gets called after a file has been downloaded by a ftp-client. This could be used to log file-downloads.
*) The *file parameter of the last functions contains the whole filename including path.
Calling a Batch/Exe without a DLL
[HKEY_LOCAL_MACHINE\Comm\FTPD] "CustomBatchOnReceive"="<name of custom.bat>"
If a custom.bat is registered. FTPD directly processes this batch if it was received.
[HKEY_LOCAL_MACHINE\Comm\FTPD] "CustomExeOnReceive"="<name of custom.exe>"
If a custom.exe is registered. FTPD directly processes this executable if it was received.
[HKEY_LOCAL_MACHINE\Comm\FTPD] "BatchExeDeleteAfter"=dword:mask // default 3 = (DELETE_BATCH=1)|(DELETE_EXE=2)
This Mask sets wether *.BAT *.EXE *.DLL are deleted after execution. If bit 0 is set, FTPD deletes the executed batch file. If Bit 1 is set FTPD deletes the executed *.exe file.
Download
Sample FTPCustomAction-Solution: ftpcustomaction.zip
If you build your own Windows Embedded CE images ask Keith&Koep support for the patched ftpd.