/* ftp32api.h ftp32.dll - ftp libarary compatible to Common Archiver Project(http://www.csdinc.co.jp/archiver/) - by Yoshioka Tsuneo -----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----- Author: Yoshioka Tsuneo(QWF00133@nifty.ne.jp) Welcome any e-mail to me(-: If you can, please send only one email to me that you use this file/program. You can copy,edit,re-distribute this file for any purpose FREE! You can use this file as PDS(Public Domain Software). You can send bugs,hope,etc.. to me with no fee. You can take support service with charging a fee. please consult to me. Thank you for use my program. -----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----- */ #ifndef __FTP32API_H #define __FTP32API_H #include "windows.h" #define FTP32_DLL_VERSION 10 #ifndef FNAME_MAX32 #define FNAME_MAX32 512 #endif typedef HGLOBAL HARCHIVE; typedef HGLOBAL HARC; /*********common struct definitaion*********/ #ifndef ARC_DECSTRACT #define ARC_DECSTRACT #ifdef WIN32 #if defined(__BORLANDC__) #pragma option -a- #else #pragma pack(1) #endif #endif typedef struct { DWORD dwOriginalSize; /* file size */ DWORD dwCompressedSize; /* file size compressed(ignored)*/ DWORD dwCRC; /* checksum/CRC (ignored)*/ UINT uFlag; /* process result */ UINT uOSType; /* OS */ /* 0: MS-DOS 2: UNIX 5: OS/2 10: Other */ WORD wRatio; /* compress ratio(permili) */ WORD wDate; /* date */ /* ------------------------------------------------------------------ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 || 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ------------------------------------------------------------------ | year from 1980 | Month | Day of Month | ------------------------------------------------------------------ */ WORD wTime; /* time */ /* ------------------------------------------------------------------ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 || 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ------------------------------------------------------------------ | hour | minutes | Second / 2 | ------------------------------------------------------------------ */ char szFileName[FNAME_MAX32 + 1];/* file name */ char dummy1[3]; char szAttribute[8]; /* attribute */ /* szAttribute[0]= (attr & FA_ARCH) ? 'A' : '-'; // Archive szAttribute[1]= (attr & FA_SYSTEM) ? 'S' : '-'; // System szAttribute[2]= (attr & FA_HIDDEN) ? 'H' : '-'; // Hide szAttribute[3]= (attr & FA_RDONLY) ? 'R' : '-'; // Read Only szAttribute[4]='\0'; */ char szMode[8]; /* mode */ } INDIVIDUALINFO, *LPINDIVIDUALINFO; typedef struct { DWORD dwFileSize; DWORD dwWriteSize; char szSourceFileName[FNAME_MAX32 + 1]; char dummy1[3]; char szDestFileName[FNAME_MAX32 + 1]; char dummy[3]; } EXTRACTINGINFO, *LPEXTRACTINGINFO; typedef struct { EXTRACTINGINFO exinfo; DWORD dwCompressedSize; DWORD dwCRC; UINT uOSType; WORD wRatio; WORD wDate; WORD wTime; char szAttribute[8]; char szMode[8]; } EXTRACTINGINFOEX, *LPEXTRACTINGINFOEX; #ifdef WIN32 #if !defined(__BORLANDC__) # pragma pack() #else # pragma option -a. #endif #endif #endif /* ARC_DECSTRACT */ /**********************************************/ #if !defined(__BORLANDC__) #define _export #endif #ifdef __cplusplus extern "C" { #endif /* Ftp() Execute Ftp Command Usage: ftp32 -[axtpl] ftp://[user:pass@]host[:port]/path [files...] commands: a: Add ex) -a ftp://username:password@hp.vector.co.jp/authors/XXXXXX index.html x: Extract ex) -x ftp://ftp.iij.ad.jp/pub/RFC rfc2000.txt t: Check p: Print to output buffer ex) -p ftp://ftp.iij.ad.jp/pub/RFC/rfc2000.txt l: List ex) -l ftp://ftp.iij.ad.jp/ options: -i: Don't display dialog window. supoprt response file. both file and "file" format support. command result output is output to "szOutput". (buffer size must<= wSize). */ int WINAPI _export Ftp(const HWND hWnd,LPCSTR szCmdLine,LPSTR szOutput,const DWORD wSize); /* Get Version Info times 100 ex) 100 => ver1.00 , 1=> ver0.01 */ WORD WINAPI _export FtpGetVersion(VOID); BOOL WINAPI _export FtpGetRunning(VOID); BOOL WINAPI _export FtpGetBackGroundMode(VOID); BOOL WINAPI _export FtpSetBackGroundMode(const BOOL bBackGroundMode); /* NOT IMPREMENTED NOW */ BOOL WINAPI _export FtpGetCursorMode(VOID); /* NOT IMPREMENTED NOW */ BOOL WINAPI _export FtpSetCursorMode(const BOOL bCursorMode); /* NOT IMPREMENTED NOW */ WORD WINAPI _export FtpGetCursorInterval(VOID); /* NOT IMPREMENTED NOW */ BOOL WINAPI _export FtpSetCursorInterval(const WORD wInterval); /* check URL is correct? (iMode:ignored) */ BOOL WINAPI _export FtpCheckArchive(LPCSTR szFileName,const int iMode); #if !defined(CHECKARCHIVE_RAPID) #define CHECKARCHIVE_RAPID 0 /* easy & first*/ #define CHECKARCHIVE_BASIC 1 /* standard */ #define CHECKARCHIVE_FULLCRC 2 /* perfect */ #endif /* display configration dialog (iMode:ignored now) */ BOOL WINAPI _export FtpConfigDialog(const HWND hwnd,LPSTR szOption,const int iMode); #if !defined(UNPACK_CONFIG_MODE) #define UNPACK_CONFIG_MODE 1 #define PACK_CONFIG_MODE 2 #endif /* Support of Not API. ex) FtpQueryFunctionList(ISARG_GET_VERSION) */ BOOL WINAPI _export FtpQueryFunctionList(const int iFunction); /**/ #if !defined(ISARC_FUNCTION_START) #define ISARC_FUNCTION_START 0 #define ISARC 0 #define ISARC_GET_VERSION 1 #define ISARC_GET_CURSOR_INTERVAL 2 #define ISARC_SET_CURSOR_INTERVAL 3 #define ISARC_GET_BACK_GROUND_MODE 4 #define ISARC_SET_BACK_GROUND_MODE 5 #define ISARC_GET_CURSOR_MODE 6 #define ISARC_SET_CURSOR_MODE 7 #define ISARC_GET_RUNNING 8 #define ISARC_CHECK_ARCHIVE 16 #define ISARC_CONFIG_DIALOG 17 #define ISARC_GET_FILE_COUNT 18 #define ISARC_QUERY_FUNCTION_LIST 19 #define ISARC_HOUT 20 #define ISARC_STRUCTOUT 21 #define ISARC_GET_ARC_FILE_INFO 22 #define ISARC_OPEN_ARCHIVE 23 #define ISARC_CLOSE_ARCHIVE 24 #define ISARC_FIND_FIRST 25 #define ISARC_FIND_NEXT 26 #define ISARC_EXTRACT 27 #define ISARC_ADD 28 #define ISARC_MOVE 29 #define ISARC_DELETE 30 #define ISARC_GET_ARC_FILE_NAME 40 #define ISARC_GET_ARC_FILE_SIZE 41 #define ISARC_GET_ARC_ORIGINAL_SIZE 42 #define ISARC_GET_ARC_COMPRESSED_SIZE 43 #define ISARC_GET_ARC_RATIO 44 #define ISARC_GET_ARC_DATE 45 #define ISARC_GET_ARC_TIME 46 #define ISARC_GET_ARC_OS_TYPE 47 #define ISARC_GET_ARC_IS_SFX_FILE 48 #define ISARC_GET_FILE_NAME 57 #define ISARC_GET_ORIGINAL_SIZE 58 #define ISARC_GET_COMPRESSED_SIZE 59 #define ISARC_GET_RATIO 60 #define ISARC_GET_DATE 61 #define ISARC_GET_TIME 62 #define ISARC_GET_CRC 63 #define ISARC_GET_ATTRIBUTE 64 #define ISARC_GET_OS_TYPE 65 #define ISARC_GET_METHOD 66 #define ISARC_GET_WRITE_TIME 67 #define ISARC_GET_CREATE_TIME 68 #define ISARC_GET_ACCESS_TIME 69 #define ISARC_FUNCTION_END 69 #endif /* ISARC_FUNCTION_START */ /* File Number of directory. szArcFile = URL */ int WINAPI _export FtpGetFileCount(LPCSTR szArcFile); /* Open Specified FTP Path(=szFileName). URL must specify direcoty URL. (dwMode:ignored)*/ /* URL: ftp://[user:pass@]host[:port]/path */ HARC WINAPI _export FtpOpenArchive(const HWND hWnd,LPCSTR szFileName,const DWORD dwMode); int WINAPI _export FtpCloseArchive(HARC harc); /* Get files' informations of directory */ /* ex) INDIVIDUALINFO info; HARC harc; int ret; harc = FtpOpenArchive(hwnd,"ftp://ftp.iij.ad.jp/pub/",0); if(harc==NULL) ERROR; ret = FtpFindFirst(harc,"",&info); while(ret!=-1){ PRINT_OUT(&info); // or FtpGetFileName etc... ret = FtpFindNext(harc,&info); } FtpCloseArchive(harc); */ int WINAPI _export FtpFindFirst(HARC harc,LPCSTR szWildName,LPINDIVIDUALINFO lpSubInfo); int WINAPI _export FtpFindNext(HARC harc,LPINDIVIDUALINFO lpSubInfo); /* open each file */ /* rwmode: combination of "r"(get),"w"(put),"b"(binary),"t"(text) */ int WINAPI _export FtpOpenFile(HARC harc,LPCSTR szFileName,LPCSTR rwmode,DWORD dwMode); int WINAPI _export FtpRead(HARC harc,char *buff,int len); int WINAPI _export FtpWrite(HARC harc,const char *buff,int len); int WINAPI _export FtpCloseFile(HARC harc); int WINAPI _export FtpExtract(HARC harc,LPCSTR remotefn,LPCSTR localfn,DWORD dwMode); int WINAPI _export FtpAdd(HARC harc,LPCSTR remotefn,LPCSTR localfn,DWORD dwMode); int WINAPI _export FtpMove(HARC harc,LPCSTR from,LPCSTR to,DWORD dwMode); int WINAPI _export FtpDelete(HARC harc,LPCSTR szFileName,DWORD dwMode); int WINAPI _export FtpMkDir(HARC harc,LPCSTR szFileName,DWORD dwMode); int WINAPI _export FtpRmDir(HARC harc,LPCSTR szFileName,DWORD dwMode); int WINAPI _export FtpRestart(HARC harc,int pos); int WINAPI _export FtpSetResumeGetMode(HARC harc,int onoff); /* cancel each command (mode is ignored,must be 0)*/ int WINAPI _export FtpCancel(HARC harc,DWORD dwMode); int WINAPI _export FtpSetCallbackMsgFunc(HARC harc,int (WINAPI * callbackmsgfunc)(char *msg,char *param),void *param); /* directory information */ int WINAPI _export FtpGetArcFileName(HARC harc,LPSTR lpBuffer,const int nSize); DWORD WINAPI _export FtpGetArcFileSize(HARC harc); DWORD WINAPI _export FtpGetArcOriginalSize(HARC harc); DWORD WINAPI _export FtpGetArcCompressedSize(HARC harc); WORD WINAPI _export FtpGetArcRatio(HARC harc); WORD WINAPI _export FtpGetArcDate(HARC harc); WORD WINAPI _export FtpGetArcTime(HARC harc); UINT WINAPI _export FtpGetArcOSType(HARC harc); /* file information of current FindFirst/FindNext*/ int WINAPI _export FtpGetFileName(HARC harc,LPSTR lpBuffer,const int nSize); int WINAPI _export FtpGetMethod(HARC harc,LPSTR lpBuffer,const int nSize);/* "-ftp- */ DWORD WINAPI _export FtpGetOriginalSize(HARC harc); DWORD WINAPI _export FtpGetCompressedSize(HARC harc); /* = OriginalSize */ WORD WINAPI _export FtpGetRatio(HARC harc); /* always 1000 (100%) */ WORD WINAPI _export FtpGetDate(HARC harc); WORD WINAPI _export FtpGetTime(HARC harc); DWORD WINAPI _export FtpGetWriteTime(HARC harc); DWORD WINAPI _export FtpGetAccessTime(HARC harc); DWORD WINAPI _export FtpGetCreateTime(HARC harc); DWORD WINAPI _export FtpGetCRC(HARC harc); int WINAPI _export FtpGetAttribute(HARC harc); /* AND of attributes(FA_RDONLY,FA_HIDDEN,FA_SYSTEM,FA_LABEL,FA_DIREC,FA_ARCH) */ UINT WINAPI _export FtpGetOSType(HARC harc); /* added by ftp32 */ int WINAPI _export FtpGetLinkName(HARC harc,LPSTR lpbuffer,const int nSize); int WINAPI _export FtpGetUserName(HARC harc,LPSTR lpbuffer,const int nSize); int WINAPI _export FtpGetGroupName(HARC harc,LPSTR lpbuffer,const int nSize); DWORD WINAPI _export FtpGetFileMode(HARC harc); /* mode/0:active 1:passive 2:auto select(passive->active) */ BOOL WINAPI _export FtpSetDataConnectionMode(HARC harc,const int mode); /* NOT IMPREMENTED*/ int WINAPI _export FtpIsSFXFile(HARC harc); #ifndef WM_ARCEXTRACT #define WM_ARCEXTRACT "wm_arcextract" #define ARCEXTRACT_BEGIN 0 /* Begin Processing */ #define ARCEXTRACT_INPROCESS 1 /* Processing */ #define ARCEXTRACT_END 2 /* End Processing */ #define ARCEXTRACT_OPEN 3 /* Begin of Each file */ #define ARCEXTRACT_COPY 4 /* copy from work file */ typedef BOOL CALLBACK ARCHIVERPROC(HWND hWnd,UINT uMsg,UINT nState,LPEXTRACTINGINFOEX lpEis); typedef ARCHIVERPROC *LPARCHIVERPROC; /* NOT IMPREMENTED NOW */ BOOL WINAPI _export FtpSetOwnerWindow(const HWND hwnd); /* NOT IMPREMENTED NOW */ BOOL WINAPI _export FtpClearOwnerWindow(VOID); /* NOT IMPREMENTED NOW */ BOOL WINAPI _export FtpSetOwnerWindowEx(HWND hWnd,LPARCHIVERPROC lpArcProc); /* NOT IMPREMENTED NOW */ BOOL WINAPI _export FtpKillOwnerWindowEx(HWND hWnd); #endif #if !defined(EXTRACT_FOUND_FILE) /* MODE (for OpenArchive) */ #define M_INIT_FILE_USE 0x00000001L #define M_REGARDLESS_INIT_FILE 0x00000002L #define M_NOT_USE_TIME_STAMP 0x00000008L #define M_EXTRACT_REPLACE_FILE 0x00000010L #define M_EXTRACT_NEW_FILE 0x00000020L #define M_EXTRACT_UPDATE_FILE 0x00000040L #define M_CHECK_ALL_PATH 0x00000100L #define M_CHECK_FILENAME_ONLY 0x00000200L #define M_USE_DRIVE_LETTER 0x00001000L #define M_NOT_USE_DRIVE_LETTER 0x00002000L #define M_INQUIRE_DIRECTORY 0x00004000L #define M_NOT_INQUIRE_DIRECTORY 0x00008000L #define M_INQUIRE_WRITE 0x00010000L #define M_NOT_INQUIRE_WRITE 0x00020000L #define M_REGARD_E_COMMAND 0x00100000L #define M_REGARD_X_COMMAND 0x00200000L #define M_ERROR_MESSAGE_ON 0x00400000L #define M_ERROR_MESSAGE_OFF 0x00800000L #define M_BAR_WINDOW_ON 0x01000000L #define M_BAR_WINDOW_OFF 0x02000000L #define M_RECOVERY_ON 0x08000000L /* 破損ヘッダの読み飛ばし */ #define EXTRACT_FOUND_FILE 0x40000000L #define EXTRACT_NAMED_FILE 0x80000000L #endif /* EXTRACT_FOUND_FILE */ #ifndef FA_RDONLY /* Attribute */ #define FA_RDONLY 0x01 /* Read only attribute */ #define FA_HIDDEN 0x02 /* Hidden file */ #define FA_SYSTEM 0x04 /* System file */ #define FA_LABEL 0x08 /* Volume label */ #define FA_DIREC 0x10 /* Directory */ #define FA_ARCH 0x20 /* Archive */ #endif #ifdef __cplusplus } #endif #if !defined(ERROR_START) #define ERROR_START 0x8000 /* WARNING */ #define ERROR_DISK_SPACE 0x8005 #define ERROR_READ_ONLY 0x8006 #define ERROR_USER_SKIP 0x8007 #define ERROR_UNKNOWN_TYPE 0x8008 #define ERROR_METHOD 0x8009 #define ERROR_PASSWORD_FILE 0x800A #define ERROR_VERSION 0x800B #define ERROR_FILE_CRC 0x800C #define ERROR_FILE_OPEN 0x800D #define ERROR_MORE_FRESH 0x800E #define ERROR_NOT_EXIST 0x800F #define ERROR_ALREADY_EXIST 0x8010 #define ERROR_TOO_MANY_FILES 0x8011 /* ERROR */ /*#define ERROR_DIRECTORY 0x8012*/ #define ERROR_MAKEDIRECTORY 0x8012 #define ERROR_CANNOT_WRITE 0x8013 #define ERROR_HUFFMAN_CODE 0x8014 #define ERROR_COMMENT_HEADER 0x8015 #define ERROR_HEADER_CRC 0x8016 #define ERROR_HEADER_BROKEN 0x8017 #define ERROR_ARCHIVE_FILE_OPEN 0x8018 /*#define ERROR_ARC_FILE_OPEN ERROR_ARCHIVE_FILE_OPEN */ #define ERROR_NOT_ARC_FILE 0x8019 /*#define ERROR_NOT_ARCHIVE_FILE ERROR_NOT_ARC_FILE */ #define ERROR_CANNOT_READ 0x801A #define ERROR_FILE_STYLE 0x801B #define ERROR_COMMAND_NAME 0x801C #define ERROR_MORE_HEAP_MEMORY 0x801D #define ERROR_ENOUGH_MEMORY 0x801E #if !defined(ERROR_ALREADY_RUNNING) #define ERROR_ALREADY_RUNNING 0x801F #endif #define ERROR_USER_CANCEL 0x8020 #define ERROR_HARC_ISNOT_OPENED 0x8021 #define ERROR_NOT_SEARCH_MODE 0x8022 #define ERROR_NOT_SUPPORT 0x8023 #define ERROR_TIME_STAMP 0x8024 /*#define ERROR_NULL_POINTER 0x8025*/ /*#define ERROR_ILLEGAL_PARAMETER 0x8026*/ #define ERROR_TMP_OPEN 0x8025 #define ERROR_LONG_FILE_NAME 0x8026 #define ERROR_ARC_READ_ONLY 0x8027 #define ERROR_SAME_NAME_FILE 0x8028 #define ERROR_NOT_FIND_ARC_FILE 0x8029 #define ERROR_RESPONSE_READ 0x802A #define ERROR_NOT_FILENAME 0x802B #define ERROR_END ERROR_NOT_FILENAME #endif /* ERROR_START */ #endif /* FTP32_H */