OSDN Git Service

Modify documents.
[ffftp/ffftp.git] / ftpproc.c
index 09a5263..e13bc7d 100644 (file)
--- a/ftpproc.c
+++ b/ftpproc.c
@@ -28,6 +28,8 @@
 /============================================================================*/\r
 \r
 #define  STRICT\r
+// IPv6対応\r
+#include <winsock2.h>\r
 #include <windows.h>\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 /*===== プロトタイプ =====*/\r
 \r
 static int CheckRemoteFile(TRANSPACKET *Pkt, FILELIST *ListList);\r
-static BOOL CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+// 64ビット対応\r
+//static BOOL CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
 \r
 static void DispMirrorFiles(FILELIST *Local, FILELIST *Remote);\r
 static void MirrorDeleteAllLocalDir(FILELIST *Local, TRANSPACKET *Pkt, TRANSPACKET **Base);\r
 static int CheckLocalFile(TRANSPACKET *Pkt);\r
-static BOOL CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+// 64ビット対応\r
+//static BOOL CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
 static void RemoveAfterSemicolon(char *Path);\r
 static void MirrorDeleteAllDir(FILELIST *Remote, TRANSPACKET *Pkt, TRANSPACKET **Base);\r
-static BOOL CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
-static BOOL CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+// 64ビット対応\r
+//static BOOL CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+//static BOOL CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
 static void CountMirrorFiles(HWND hDlg, TRANSPACKET *Pkt);\r
 static int AskMirrorNoTrn(char *Fname, int Mode);\r
-static int AskUpLoadFileAttr(char *Fname);\r
-static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static int AskUploadFileAttr(char *Fname);\r
+// 64ビット対応\r
+//static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+#if defined(HAVE_TANDEM)\r
+static INT_PTR CALLBACK UpDownAsWithExtDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+#endif\r
 static void DeleteAllDir(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDir);\r
 static void DelNotifyAndDo(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDir);\r
-static BOOL CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
-static BOOL CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+// 64ビット対応\r
+//static BOOL CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+//static BOOL CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
 static void SetAttrToDialog(HWND hWnd, int Attr);\r
 static int GetAttrFromDialog(HWND hDlg);\r
 static LRESULT CALLBACK SizeNotifyDlgWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);\r
@@ -91,10 +108,15 @@ extern SIZE MirrorDlgSize;
 extern int VaxSemicolon;\r
 extern int DebugConsole;\r
 extern int CancelFlg;\r
+// ディレクトリ自動作成\r
+extern int MakeAllDir;\r
 \r
 /*===== ローカルなワーク =====*/\r
 \r
 static char TmpString[FMAX_PATH+80];           /* テンポラリ */\r
+#if defined(HAVE_TANDEM)\r
+static char TmpFileCode[5];            /* テンポラリ */\r
+#endif\r
 static int CurWin;                                             /* ウインドウ番号 */\r
 \r
 int UpExistMode = EXIST_OVW;           /* アップロードで同じ名前のファイルがある時の扱い方 EXIST_xxx */\r
@@ -116,19 +138,58 @@ static double FileSize;           /* ファイル総容量 */
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-void DownLoadProc(int ChName, int ForceFile, int All)\r
+// ディレクトリ自動作成\r
+// ローカル側のパスから必要なフォルダを作成\r
+int MakeDirFromLocalPath(char* LocalFile, char* Old)\r
+{\r
+       TRANSPACKET Pkt;\r
+       char* pDelimiter;\r
+       char* pNext;\r
+       char* Cat;\r
+       int Len;\r
+       int Make;\r
+       pDelimiter = LocalFile;\r
+       Make = NO;\r
+       while(pNext = strchr(pDelimiter, '\\'))\r
+       {\r
+               Len = pNext - LocalFile;\r
+               strncpy(Pkt.LocalFile, LocalFile, Len);\r
+               Pkt.LocalFile[Len] = '\0';\r
+               if(strncmp(LocalFile, Old, Len + 1) != 0)\r
+               {\r
+                       Cat = Pkt.LocalFile + (pDelimiter - LocalFile);\r
+                       if(FnameCnv == FNAME_LOWER)\r
+                               _mbslwr(Cat);\r
+                       else if(FnameCnv == FNAME_UPPER)\r
+                               _mbsupr(Cat);\r
+                       ReplaceAll(Pkt.LocalFile, '/', '\\');\r
+\r
+                       strcpy(Pkt.Cmd, "MKD ");\r
+                       strcpy(Pkt.RemoteFile, "");\r
+                       AddTransFileList(&Pkt);\r
+\r
+                       Make = YES;\r
+               }\r
+               pDelimiter = pNext + 1;\r
+       }\r
+       return Make;\r
+}\r
+\r
+void DownloadProc(int ChName, int ForceFile, int All)\r
 {\r
        FILELIST *FileListBase;\r
        FILELIST *Pos;\r
        TRANSPACKET Pkt;\r
+       // ディレクトリ自動作成\r
+       char Tmp[FMAX_PATH+1];\r
+\r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
 \r
        if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
        {\r
                DisableUserOpe();\r
 \r
-               // 同時接続対応\r
-               SktShareProh();\r
-\r
                ExistNotify = YES;\r
 //             KeepTransferDialog(YES);\r
 \r
@@ -203,6 +264,19 @@ void DownLoadProc(int ChName, int ForceFile, int All)
                                }\r
 \r
                                strcpy(Pkt.Cmd, "RETR ");\r
+#if defined(HAVE_TANDEM)\r
+                               if(AskHostType() == HTYPE_TANDEM) {\r
+                                       if(AskTransferType() != TYPE_X) {\r
+                                               Pkt.Type = AskTransferType();\r
+                                       } else {\r
+                                               Pkt.Attr = Pos->Attr;\r
+                                               if (Pkt.Attr == 101)\r
+                                                       Pkt.Type = TYPE_A;\r
+                                               else\r
+                                                       Pkt.Type = TYPE_I;\r
+                                       }\r
+                               } else\r
+#endif\r
                                Pkt.Type = AskTransferTypeAssoc(Pkt.RemoteFile, AskTransferType());\r
                                Pkt.Size = Pos->Size;\r
                                Pkt.Time = Pos->Time;\r
@@ -211,11 +285,19 @@ void DownLoadProc(int ChName, int ForceFile, int All)
                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
                                Pkt.KanaCnv = AskHostKanaCnv();\r
 \r
+                               // ディレクトリ自動作成\r
+                               strcpy(Tmp, Pkt.LocalFile);\r
                                Pkt.Mode = CheckLocalFile(&Pkt);        /* Pkt.ExistSize がセットされる */\r
                                if(Pkt.Mode == EXIST_ABORT)\r
                                        break;\r
                                else if(Pkt.Mode != EXIST_IGNORE)\r
+                               // ディレクトリ自動作成\r
+//                                     AddTransFileList(&Pkt);\r
+                               {\r
+                                       if(MakeAllDir == YES)\r
+                                               MakeDirFromLocalPath(Pkt.LocalFile, Tmp);\r
                                        AddTransFileList(&Pkt);\r
+                               }\r
                        }\r
                        Pos = Pos->Next;\r
                }\r
@@ -228,8 +310,9 @@ void DownLoadProc(int ChName, int ForceFile, int All)
                }\r
                DeleteFileList(&FileListBase);\r
 \r
-               strcpy(Pkt.Cmd, "GOQUIT");\r
-               AddTransFileList(&Pkt);\r
+               // 同時接続対応\r
+//             strcpy(Pkt.Cmd, "GOQUIT");\r
+//             AddTransFileList(&Pkt);\r
 \r
                GoForwardTransWindow();\r
 //             KeepTransferDialog(NO);\r
@@ -249,17 +332,17 @@ void DownLoadProc(int ChName, int ForceFile, int All)
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-void DirectDownLoadProc(char *Fname)\r
+void DirectDownloadProc(char *Fname)\r
 {\r
        TRANSPACKET Pkt;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
        {\r
                DisableUserOpe();\r
 \r
-               // 同時接続対応\r
-               SktShareProh();\r
-\r
                ExistNotify = YES;\r
 //             KeepTransferDialog(YES);\r
 \r
@@ -330,8 +413,9 @@ void DirectDownLoadProc(char *Fname)
                        AddTransFileList(&Pkt);\r
                }\r
 \r
-               strcpy(Pkt.Cmd, "GOQUIT");\r
-               AddTransFileList(&Pkt);\r
+               // 同時接続対応\r
+//             strcpy(Pkt.Cmd, "GOQUIT");\r
+//             AddTransFileList(&Pkt);\r
 \r
                GoForwardTransWindow();\r
 //             KeepTransferDialog(NO);\r
@@ -351,7 +435,7 @@ void DirectDownLoadProc(char *Fname)
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-void InputDownLoadProc(void)\r
+void InputDownloadProc(void)\r
 {\r
        char Path[FMAX_PATH+1];\r
        int Tmp;\r
@@ -361,7 +445,7 @@ void InputDownLoadProc(void)
        strcpy(Path, "");\r
        if(InputDialogBox(downname_dlg, GetMainHwnd(), NULL, Path, FMAX_PATH, &Tmp, IDH_HELP_TOPIC_0000001) == YES)\r
        {\r
-               DirectDownLoadProc(Path);\r
+               DirectDownloadProc(Path);\r
        }\r
 \r
 //     EnableUserOpe();\r
@@ -392,13 +476,13 @@ void MirrorDownloadProc(int Notify)
        int Level;\r
        int Mode;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
        {\r
                DisableUserOpe();\r
 \r
-               // 同時接続対応\r
-               SktShareProh();\r
-\r
                Base = NULL;\r
 \r
                if(Notify == YES)\r
@@ -596,8 +680,9 @@ void MirrorDownloadProc(int Notify)
                                        AddTransFileList(&Pkt);\r
                                }\r
 \r
-                               strcpy(Pkt.Cmd, "GOQUIT");\r
-                               AddTransFileList(&Pkt);\r
+                               // 同時接続対応\r
+//                             strcpy(Pkt.Cmd, "GOQUIT");\r
+//                             AddTransFileList(&Pkt);\r
                        }\r
                        else\r
                                EraseTmpTransFileList(&Base);\r
@@ -786,7 +871,9 @@ static int CheckLocalFile(TRANSPACKET *Pkt)
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        static TRANSPACKET *Pkt;\r
        static const RADIOBUTTON DownExistButton[] = {\r
@@ -852,7 +939,70 @@ static BOOL CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wP
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-void UpLoadListProc(int ChName, int All)\r
+// ディレクトリ自動作成\r
+// リモート側のパスから必要なディレクトリを作成\r
+int MakeDirFromRemotePath(char* RemoteFile, char* Old, int FirstAdd)\r
+{\r
+       TRANSPACKET Pkt;\r
+       TRANSPACKET Pkt1;\r
+       char* pDelimiter;\r
+       char* pNext;\r
+       char* Cat;\r
+       int Len;\r
+       int Make;\r
+       pDelimiter = RemoteFile;\r
+       Make = NO;\r
+       while(pNext = strchr(pDelimiter, '/'))\r
+       {\r
+               Len = pNext - RemoteFile;\r
+               strncpy(Pkt.RemoteFile, RemoteFile, Len);\r
+               Pkt.RemoteFile[Len] = '\0';\r
+               if(strncmp(RemoteFile, Old, Len + 1) != 0)\r
+               {\r
+                       Cat = Pkt.RemoteFile + (pDelimiter - RemoteFile);\r
+                       if(FnameCnv == FNAME_LOWER)\r
+                               _mbslwr(Cat);\r
+                       else if(FnameCnv == FNAME_UPPER)\r
+                               _mbsupr(Cat);\r
+#if defined(HAVE_TANDEM)\r
+                       Pkt.FileCode = 0;\r
+                       Pkt.PriExt = DEF_PRIEXT;\r
+                       Pkt.SecExt = DEF_SECEXT;\r
+                       Pkt.MaxExt = DEF_MAXEXT;\r
+#endif\r
+                       ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
+\r
+                       if(AskHostType() == HTYPE_ACOS)\r
+                       {\r
+                               strcpy(Pkt.RemoteFile, "'");\r
+                               strcat(Pkt.RemoteFile, AskHostLsName());\r
+                               strcat(Pkt.RemoteFile, "(");\r
+                               strcat(Pkt.RemoteFile, Cat);\r
+                               strcat(Pkt.RemoteFile, ")");\r
+                               strcat(Pkt.RemoteFile, "'");\r
+                       }\r
+                       else if(AskHostType() == HTYPE_ACOS_4)\r
+                               strcpy(Pkt.RemoteFile, Cat);\r
+\r
+                       if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
+                       {\r
+                               strcpy(Pkt1.Cmd, "SETCUR");\r
+                               AskRemoteCurDir(Pkt1.RemoteFile, FMAX_PATH);\r
+                               AddTransFileList(&Pkt1);\r
+                       }\r
+                       FirstAdd = NO;\r
+                       strcpy(Pkt.Cmd, "MKD ");\r
+                       strcpy(Pkt.LocalFile, "");\r
+                       AddTransFileList(&Pkt);\r
+\r
+                       Make = YES;\r
+               }\r
+               pDelimiter = pNext + 1;\r
+       }\r
+       return Make;\r
+}\r
+\r
+void UploadListProc(int ChName, int All)\r
 {\r
        FILELIST *FileListBase;\r
        FILELIST *Pos;\r
@@ -863,13 +1013,13 @@ void UpLoadListProc(int ChName, int All)
        char Tmp[FMAX_PATH+1];\r
        int FirstAdd;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
        {\r
                DisableUserOpe();\r
 \r
-               // 同時接続対応\r
-               SktShareProh();\r
-\r
                // ローカル側で選ばれているファイルをFileListBaseに登録\r
                FileListBase = NULL;\r
                MakeSelectedFileList(WIN_LOCAL, YES, All, &FileListBase, &CancelFlg);\r
@@ -895,17 +1045,44 @@ void UpLoadListProc(int ChName, int All)
                                        _mbslwr(Cat);\r
                                else if(FnameCnv == FNAME_UPPER)\r
                                        _mbsupr(Cat);\r
+#if defined(HAVE_TANDEM)\r
+                               Pkt.FileCode = 0;\r
+                               Pkt.PriExt = DEF_PRIEXT;\r
+                               Pkt.SecExt = DEF_SECEXT;\r
+                               Pkt.MaxExt = DEF_MAXEXT;\r
+#endif\r
                        }\r
                        else\r
                        {\r
                                // 名前を変更する\r
                                strcpy(TmpString, Pos->File);\r
                                CurWin = WIN_LOCAL;\r
+#if defined(HAVE_TANDEM)\r
+                               strcpy(TmpFileCode, "0"); /* ASCII モードの場合は無視される */\r
+                               if(AskHostType() == HTYPE_TANDEM && AskOSS() == NO) {\r
+                                       if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(updown_as_with_ext_dlg), GetMainHwnd(), UpDownAsWithExtDialogCallBack) == YES) {\r
+                                               strcat(Pkt.RemoteFile, TmpString);\r
+                                               Pkt.FileCode = atoi(TmpFileCode);\r
+                                       } else {\r
+                                               break;\r
+                                       }\r
+                               } else\r
+#endif\r
                                if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(updown_as_dlg), GetMainHwnd(), UpDownAsDialogCallBack) == YES)\r
                                        strcat(Pkt.RemoteFile, TmpString);\r
                                else\r
                                        break;\r
                        }\r
+                       // バグ修正\r
+                       AskRemoteCurDir(Tmp, FMAX_PATH);\r
+                       SetSlashTail(Tmp);\r
+                       if(strncmp(Pkt.RemoteFile, Tmp, strlen(Tmp)) != 0)\r
+                       {\r
+                               if((Cat = strrchr(Pkt.RemoteFile, '/')) != NULL)\r
+                                       Cat++;\r
+                               else\r
+                                       Cat = Pkt.RemoteFile;\r
+                       }\r
                        ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
 \r
                        if(AskHostType() == HTYPE_ACOS)\r
@@ -964,16 +1141,29 @@ void UpLoadListProc(int ChName, int All)
                                Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
                                Pkt.Size = 0;\r
                                Pkt.Time = Pos->Time;\r
-                               Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
+                               Pkt.Attr = AskUploadFileAttr(Pkt.RemoteFile);\r
                                Pkt.KanjiCode = AskHostKanjiCode();\r
                                // UTF-8対応\r
                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
                                Pkt.KanaCnv = AskHostKanaCnv();\r
+#if defined(HAVE_TANDEM)\r
+                               if(AskHostType() == HTYPE_TANDEM && AskOSS() == NO) {\r
+                                       CalcExtentSize(&Pkt, Pos->Size);\r
+                               }\r
+#endif\r
+                               // ディレクトリ自動作成\r
+                               strcpy(Tmp, Pkt.RemoteFile);\r
                                Pkt.Mode = CheckRemoteFile(&Pkt, RemoteList);\r
                                if(Pkt.Mode == EXIST_ABORT)\r
                                        break;\r
                                else if(Pkt.Mode != EXIST_IGNORE)\r
                                {\r
+                                       // ディレクトリ自動作成\r
+                                       if(MakeAllDir == YES)\r
+                                       {\r
+                                               if(MakeDirFromRemotePath(Pkt.RemoteFile, Tmp, FirstAdd) == YES)\r
+                                                       FirstAdd = NO;\r
+                                       }\r
                                        if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
                                        {\r
                                                strcpy(Pkt1.Cmd, "SETCUR");\r
@@ -999,8 +1189,9 @@ void UpLoadListProc(int ChName, int All)
 \r
                DeleteFileList(&FileListBase);\r
 \r
-               strcpy(Pkt.Cmd, "GOQUIT");\r
-               AddTransFileList(&Pkt);\r
+               // 同時接続対応\r
+//             strcpy(Pkt.Cmd, "GOQUIT");\r
+//             AddTransFileList(&Pkt);\r
 \r
                GoForwardTransWindow();\r
 \r
@@ -1019,7 +1210,7 @@ void UpLoadListProc(int ChName, int All)
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-void UpLoadDragProc(WPARAM wParam)\r
+void UploadDragProc(WPARAM wParam)\r
 {\r
        FILELIST *FileListBase;\r
        FILELIST *Pos;\r
@@ -1031,13 +1222,13 @@ void UpLoadDragProc(WPARAM wParam)
        int FirstAdd;\r
        char Cur[FMAX_PATH+1];\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
        {\r
                DisableUserOpe();\r
 \r
-               // 同時接続対応\r
-               SktShareProh();\r
-\r
                // ローカル側で選ばれているファイルをFileListBaseに登録\r
                FileListBase = NULL;\r
                MakeDroppedFileList(wParam, Cur, &FileListBase);\r
@@ -1063,6 +1254,12 @@ void UpLoadDragProc(WPARAM wParam)
                        else if(FnameCnv == FNAME_UPPER)\r
                                _mbsupr(Cat);\r
                        ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
+#if defined(HAVE_TANDEM)\r
+                       Pkt.FileCode = 0;\r
+                       Pkt.PriExt = DEF_PRIEXT;\r
+                       Pkt.SecExt = DEF_SECEXT;\r
+                       Pkt.MaxExt = DEF_MAXEXT;\r
+#endif\r
 \r
                        if(AskHostType() == HTYPE_ACOS)\r
                        {\r
@@ -1119,16 +1316,30 @@ void UpLoadDragProc(WPARAM wParam)
                                Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
                                Pkt.Size = 0;\r
                                Pkt.Time = Pos->Time;\r
-                               Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
+                               Pkt.Attr = AskUploadFileAttr(Pkt.RemoteFile);\r
                                Pkt.KanjiCode = AskHostKanjiCode();\r
                                // UTF-8対応\r
                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
                                Pkt.KanaCnv = AskHostKanaCnv();\r
+#if defined(HAVE_TANDEM)\r
+                               if(AskHostType() == HTYPE_TANDEM && AskOSS() == NO) {\r
+                                       int a = Pos->InfoExist && FINFO_SIZE;\r
+                                       CalcExtentSize(&Pkt, Pos->Size);\r
+                               }\r
+#endif\r
+                               // ディレクトリ自動作成\r
+                               strcpy(Tmp, Pkt.RemoteFile);\r
                                Pkt.Mode = CheckRemoteFile(&Pkt, RemoteList);\r
                                if(Pkt.Mode == EXIST_ABORT)\r
                                        break;\r
                                else if(Pkt.Mode != EXIST_IGNORE)\r
                                {\r
+                                       // ディレクトリ自動作成\r
+                                       if(MakeAllDir == YES)\r
+                                       {\r
+                                               if(MakeDirFromRemotePath(Pkt.RemoteFile, Tmp, FirstAdd) == YES)\r
+                                                       FirstAdd = NO;\r
+                                       }\r
                                        if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
                                        {\r
                                                strcpy(Pkt1.Cmd, "SETCUR");\r
@@ -1154,8 +1365,9 @@ void UpLoadDragProc(WPARAM wParam)
 \r
                DeleteFileList(&FileListBase);\r
 \r
-               strcpy(Pkt.Cmd, "GOQUIT");\r
-               AddTransFileList(&Pkt);\r
+               // 同時接続対応\r
+//             strcpy(Pkt.Cmd, "GOQUIT");\r
+//             AddTransFileList(&Pkt);\r
 \r
                GoForwardTransWindow();\r
 \r
@@ -1190,13 +1402,13 @@ void MirrorUploadProc(int Notify)
        FILETIME TmpFtimeL;\r
        FILETIME TmpFtimeR;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
        {\r
                DisableUserOpe();\r
 \r
-               // 同時接続対応\r
-               SktShareProh();\r
-\r
                Base = NULL;\r
 \r
                if(Notify == YES)\r
@@ -1390,11 +1602,16 @@ void MirrorUploadProc(int Notify)
                                                Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
                                                Pkt.Size = 0;\r
                                                Pkt.Time = LocalPos->Time;\r
-                                               Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
+                                               Pkt.Attr = AskUploadFileAttr(Pkt.RemoteFile);\r
                                                Pkt.KanjiCode = AskHostKanjiCode();\r
                                                // UTF-8対応\r
                                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
                                                Pkt.KanaCnv = AskHostKanaCnv();\r
+#if defined(HAVE_TANDEM)\r
+                                               if(AskHostType() == HTYPE_TANDEM && AskOSS() == NO) {\r
+                                                       CalcExtentSize(&Pkt, LocalPos->Size);\r
+                                               }\r
+#endif\r
                                                Pkt.Mode = EXIST_OVW;\r
                                                AddTmpTransFileList(&Pkt, &Base);\r
                                        }\r
@@ -1420,8 +1637,9 @@ void MirrorUploadProc(int Notify)
                                        AddTransFileList(&Pkt);\r
                                }\r
 \r
-                               strcpy(Pkt.Cmd, "GOQUIT");\r
-                               AddTransFileList(&Pkt);\r
+                               // 同時接続対応\r
+//                             strcpy(Pkt.Cmd, "GOQUIT");\r
+//                             AddTransFileList(&Pkt);\r
                        }\r
                        else\r
                                EraseTmpTransFileList(&Base);\r
@@ -1487,7 +1705,9 @@ static void MirrorDeleteAllDir(FILELIST *Remote, TRANSPACKET *Pkt, TRANSPACKET *
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        static int Mode;\r
 \r
@@ -1536,7 +1756,9 @@ static BOOL CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wPara
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        static DIALOGSIZE DlgSize = {\r
                { MIRROR_DEL, MIRROR_SIZEGRIP, -1 },\r
@@ -1753,7 +1975,7 @@ static int AskMirrorNoTrn(char *Fname, int Mode)
 *              int 属性 (-1=設定なし)\r
 *----------------------------------------------------------------------------*/\r
 \r
-static int AskUpLoadFileAttr(char *Fname)\r
+static int AskUploadFileAttr(char *Fname)\r
 {\r
        int Ret;\r
        int Sts;\r
@@ -1795,13 +2017,26 @@ static int AskUpLoadFileAttr(char *Fname)
 static int CheckRemoteFile(TRANSPACKET *Pkt, FILELIST *ListList)\r
 {\r
        int Ret;\r
+#if defined(HAVE_TANDEM)\r
+       int Mode;\r
+#endif\r
        FILELIST *Exist;\r
 \r
        Ret = EXIST_OVW;\r
        Pkt->ExistSize = 0;\r
        if(SendMode != TRANS_OVW)\r
        {\r
+#if defined(HAVE_TANDEM)\r
+               /* HP NonStop Server は大文字小文字の区別なし(すべて大文字) */\r
+               if(AskHostType() == HTYPE_TANDEM)\r
+                       Mode = COMP_IGNORE;\r
+               else\r
+                       Mode = COMP_STRICT;\r
+\r
+               if((Exist = SearchFileList(GetFileName(Pkt->RemoteFile), ListList, Mode)) != NULL)\r
+#else\r
                if((Exist = SearchFileList(GetFileName(Pkt->RemoteFile), ListList, COMP_STRICT)) != NULL)\r
+#endif\r
                {\r
                        Pkt->ExistSize = Exist->Size;\r
 \r
@@ -1842,7 +2077,9 @@ static int CheckRemoteFile(TRANSPACKET *Pkt, FILELIST *ListList)
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        static TRANSPACKET *Pkt;\r
        static const RADIOBUTTON UpExistButton[] = {\r
@@ -1908,7 +2145,55 @@ static BOOL CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wPar
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+{\r
+       switch (iMessage)\r
+       {\r
+               case WM_INITDIALOG :\r
+                       if(CurWin == WIN_LOCAL)\r
+                               SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN064);\r
+                       else\r
+                               SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN065);\r
+\r
+                       SendDlgItemMessage(hDlg, UPDOWNAS_NEW, EM_LIMITTEXT, FMAX_PATH, 0);\r
+                       SendDlgItemMessage(hDlg, UPDOWNAS_NEW, WM_SETTEXT, 0, (LPARAM)TmpString);\r
+                       SendDlgItemMessage(hDlg, UPDOWNAS_TEXT, WM_SETTEXT, 0, (LPARAM)TmpString);\r
+                       return(TRUE);\r
+\r
+               case WM_COMMAND :\r
+                       switch(GET_WM_COMMAND_ID(wParam, lParam))\r
+                       {\r
+                               case IDOK :\r
+                                       SendDlgItemMessage(hDlg, UPDOWNAS_NEW, WM_GETTEXT, FMAX_PATH, (LPARAM)TmpString);\r
+                                       EndDialog(hDlg, YES);\r
+                                       break;\r
+\r
+                               case UPDOWNAS_STOP :\r
+                                       EndDialog(hDlg, NO_ALL);\r
+                                       break;\r
+                       }\r
+            return(TRUE);\r
+       }\r
+       return(FALSE);\r
+}\r
+\r
+\r
+#if defined(HAVE_TANDEM)\r
+/*----- アップロード/ダウンロードファイル名入力ダイアログのコールバック ------\r
+*\r
+*      Parameter\r
+*              HWND hDlg : ウインドウハンドル\r
+*              UINT message : メッセージ番号\r
+*              WPARAM wParam : メッセージの WPARAM 引数\r
+*              LPARAM lParam : メッセージの LPARAM 引数\r
+*\r
+*      Return Value\r
+*              BOOL TRUE/FALSE\r
+*----------------------------------------------------------------------------*/\r
+\r
+static INT_PTR CALLBACK UpDownAsWithExtDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        switch (iMessage)\r
        {\r
@@ -1921,6 +2206,9 @@ static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wPa
                        SendDlgItemMessage(hDlg, UPDOWNAS_NEW, EM_LIMITTEXT, FMAX_PATH, 0);\r
                        SendDlgItemMessage(hDlg, UPDOWNAS_NEW, WM_SETTEXT, 0, (LPARAM)TmpString);\r
                        SendDlgItemMessage(hDlg, UPDOWNAS_TEXT, WM_SETTEXT, 0, (LPARAM)TmpString);\r
+                       SendDlgItemMessage(hDlg, UPDOWNAS_FILECODE, EM_LIMITTEXT, 4, 0);\r
+                       SendDlgItemMessage(hDlg, UPDOWNAS_FILECODE, WM_SETTEXT, 0, (LPARAM)TmpFileCode);\r
+\r
                        return(TRUE);\r
 \r
                case WM_COMMAND :\r
@@ -1928,6 +2216,7 @@ static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wPa
                        {\r
                                case IDOK :\r
                                        SendDlgItemMessage(hDlg, UPDOWNAS_NEW, WM_GETTEXT, FMAX_PATH, (LPARAM)TmpString);\r
+                                       SendDlgItemMessage(hDlg, UPDOWNAS_FILECODE, WM_GETTEXT, FMAX_PATH, (LPARAM)TmpFileCode);\r
                                        EndDialog(hDlg, YES);\r
                                        break;\r
 \r
@@ -1939,6 +2228,7 @@ static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wPa
        }\r
        return(FALSE);\r
 }\r
+#endif\r
 \r
 \r
 /*----- ファイル一覧で指定されたファイルを削除する ----------------------------\r
@@ -1960,6 +2250,9 @@ void DeleteProc(void)
        char CurDir[FMAX_PATH+1];\r
        char Tmp[FMAX_PATH+1];\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        // デッドロック対策\r
        DisableUserOpe();\r
        Sts = YES;\r
@@ -2095,7 +2388,9 @@ static void DelNotifyAndDo(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDi
        {\r
                sprintf(TmpString, "%s", Path);\r
 \r
-               if(AskHostType() == HTYPE_VMS)\r
+               // ローカルのファイルのパスの最後の'\\'が消えるバグ修正\r
+//             if(AskHostType() == HTYPE_VMS)\r
+               if(Win == WIN_REMOTE && AskHostType() == HTYPE_VMS)\r
                        ReformToVMSstylePathName(TmpString);\r
 \r
                CurWin = Win;\r
@@ -2115,7 +2410,9 @@ static void DelNotifyAndDo(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDi
                else\r
                {\r
                        /* フルパスを使わない時のための処理 */\r
-                       if(ProcForNonFullpath(Path, CurDir, GetMainHwnd(), 0) == FFFTP_FAIL)\r
+                       // 同時接続対応\r
+//                     if(ProcForNonFullpath(Path, CurDir, GetMainHwnd(), 0) == FFFTP_FAIL)\r
+                       if(ProcForNonFullpath(AskCmdCtrlSkt(), Path, CurDir, GetMainHwnd(), &CancelFlg) == FFFTP_FAIL)\r
                                *Sw = NO_ALL;\r
 \r
                        if(*Sw != NO_ALL)\r
@@ -2144,7 +2441,9 @@ static void DelNotifyAndDo(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDi
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        switch (iMessage)\r
        {\r
@@ -2199,6 +2498,9 @@ void RenameProc(void)
        int RenFlg;\r
        int Sts;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        Sts = FFFTP_SUCCESS;\r
        if(GetFocus() == GetLocalHwnd())\r
                Win = WIN_LOCAL;\r
@@ -2274,6 +2576,9 @@ void MoveRemoteFileProc(int drop_index)
        int RenFlg;\r
        int Sts;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(MoveMode == MOVE_DISABLE)\r
        {\r
                return;\r
@@ -2390,7 +2695,9 @@ void MoveRemoteFileProc(int drop_index)
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        switch (iMessage)\r
        {\r
@@ -2443,6 +2750,9 @@ void MkdirProc(void)
        char *Title;\r
        int Tmp;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(GetFocus() == GetLocalHwnd())\r
        {\r
                Win = WIN_LOCAL;\r
@@ -2495,6 +2805,9 @@ void ChangeDirComboProc(HWND hWnd)
        char Tmp[FMAX_PATH+1];\r
        int i;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if((i = SendMessage(hWnd, CB_GETCURSEL, 0, 0)) != CB_ERR)\r
        {\r
                SendMessage(hWnd, CB_GETLBTEXT, i, (LPARAM)Tmp);\r
@@ -2536,6 +2849,9 @@ void ChangeDirBmarkProc(int MarkID)
        char Remote[FMAX_PATH+1];\r
        int Sts;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        Sts = AskBookMarkText(MarkID, Local, Remote, FMAX_PATH+1);\r
        if((Sts == BMARK_TYPE_LOCAL) || (Sts == BMARK_TYPE_BOTH))\r
        {\r
@@ -2575,6 +2891,9 @@ void ChangeDirDirectProc(int Win)
        char *Title;\r
        int Tmp;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(Win == WIN_LOCAL)\r
                Title = MSGJPN072;\r
        else\r
@@ -2651,6 +2970,9 @@ void ChmodProc(void)
        char *BufTmp;\r
        int BufLen;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(GetFocus() == GetRemoteHwnd())\r
        {\r
                if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
@@ -2729,7 +3051,9 @@ void ChmodProc(void)
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-BOOL CALLBACK ChmodDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//BOOL CALLBACK ChmodDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+INT_PTR CALLBACK ChmodDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        char Str[5];\r
        static char *Buf;\r
@@ -2874,6 +3198,9 @@ void SomeCmdProc(void)
        int Tmp;\r
        FILELIST *FileListBase;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if(GetFocus() == GetRemoteHwnd())\r
        {\r
                if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
@@ -2890,7 +3217,9 @@ void SomeCmdProc(void)
 \r
                        if(InputDialogBox(somecmd_dlg, GetMainHwnd(), NULL, Cmd, 81, &Tmp, IDH_HELP_TOPIC_0000023) == YES)\r
                        {\r
-                               DoQUOTE(Cmd);\r
+                               // 同時接続対応\r
+                               //DoQUOTE(Cmd);\r
+                               DoQUOTE(AskCmdCtrlSkt(), Cmd, &CancelFlg);\r
                        }\r
                        EnableUserOpe();\r
                }\r
@@ -2918,6 +3247,9 @@ void CalcFileSizeProc(void)
        int All;\r
        int Sts;\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
        if((All = DialogBox(GetFtpInst(), MAKEINTRESOURCE(filesize_notify_dlg), GetMainHwnd(), SizeNotifyDlgWndProc)) != NO_ALL)\r
        {\r
                Sts = FFFTP_SUCCESS;\r
@@ -3141,7 +3473,9 @@ void CopyURLtoClipBoard(void)
 *                      Path にファイル名のみ残す。(パス名は消す)\r
 *----------------------------------------------------------------------------*/\r
 \r
-int ProcForNonFullpath(char *Path, char *CurDir, HWND hWnd, int Type)\r
+// 同時接続対応\r
+//int ProcForNonFullpath(char *Path, char *CurDir, HWND hWnd, int Type)\r
+int ProcForNonFullpath(SOCKET cSkt, char *Path, char *CurDir, HWND hWnd, int *CancelCheckWork)\r
 {\r
        int Sts;\r
        int Cmd;\r
@@ -3163,12 +3497,12 @@ int ProcForNonFullpath(char *Path, char *CurDir, HWND hWnd, int Type)
 \r
                if(strcmp(Tmp, CurDir) != 0)\r
                {\r
-                       if(Type == 0)\r
-                               Cmd = CommandProcCmd(NULL, "CWD %s", Tmp);\r
-                       else\r
-                               // 同時接続対応\r
+                       // 同時接続対応\r
+//                     if(Type == 0)\r
+//                             Cmd = CommandProcCmd(NULL, "CWD %s", Tmp);\r
+//                     else\r
 //                             Cmd = CommandProcTrn(NULL, "CWD %s", Tmp);\r
-                               Cmd = CommandProcTrn((SOCKET)(Type - 1), NULL, "CWD %s", Tmp);\r
+                       Cmd = CommandProcTrn(cSkt, NULL, CancelCheckWork, "CWD %s", Tmp);\r
 \r
                        if(Cmd/100 != FTP_COMPLETE)\r
                        {\r
@@ -3323,3 +3657,20 @@ static int RenameUnuseableName(char *Fname)
 }\r
 \r
 \r
+// 自動切断対策\r
+// NOOPコマンドでは効果が無いホストが多いためLISTコマンドを使用\r
+void NoopProc(void)\r
+{\r
+       int CancelCheckWork;\r
+       CancelCheckWork = NO;\r
+       if(AskConnecting() == YES && AskUserOpeDisabled() == NO)\r
+       {\r
+               if(AskReuseCmdSkt() == NO || AskShareProh() == YES)\r
+               {\r
+                       DisableUserOpe();\r
+                       DoDirListCmdSkt("", "", 999, &CancelCheckWork);\r
+                       EnableUserOpe();\r
+               }\r
+       }\r
+}\r
+\r