OSDN Git Service

Enlarge buffers for replies on transferring files.
[ffftp/ffftp.git] / filelist.c
index c3de027..94e02ac 100644 (file)
@@ -83,8 +83,12 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA
 static void AddDispFileList(FLISTANCHOR *Anchor, char *Name, FILETIME *Time, LONGLONG Size, int Attr, int Type, int Link, char *Owner, int InfoExist, int Win);\r
 static void EraseDispFileList(FLISTANCHOR *Anchor);\r
 static void DispFileList2View(HWND hWnd, FLISTANCHOR *Anchor);\r
-static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, FILETIME *Time, int Attr, char *Owner, int Link, int InfoExist);\r
-static BOOL CALLBACK SelectDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+// ファイルアイコン表示対応\r
+//static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, FILETIME *Time, int Attr, char *Owner, int Link, int InfoExist);\r
+static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, FILETIME *Time, int Attr, char *Owner, int Link, int InfoExist, int ImageId);\r
+// 64ビット対応\r
+//static BOOL CALLBACK SelectDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK SelectDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
 static void DispListList(FILELIST *Pos, char *Title);\r
 static void MakeRemoteTree1(char *Path, char *Cur, FILELIST **Base, int *CancelCheckWork);\r
 static void MakeRemoteTree2(char *Path, char *Cur, FILELIST **Base, int *CancelCheckWork);\r
@@ -108,7 +112,9 @@ static int GetHourAndMinute(char *Str, WORD *Hour, WORD *Minute);
 static int GetVMSdate(char *Str, WORD *Year, WORD *Month, WORD *Day);\r
 static int CheckSpecialDirName(char *Fname);\r
 static int AskFilterStr(char *Fname, int Type);\r
-static BOOL CALLBACK FilterWndProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+// 64ビット対応\r
+//static BOOL CALLBACK FilterWndProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
+static INT_PTR CALLBACK FilterWndProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
 static int atoi_n(const char *Str, int Len);\r
 \r
 /*===== 外部参照 =====*/\r
@@ -185,7 +191,9 @@ int MakeListWin(HWND hWnd, HINSTANCE hInst)
 \r
        if(hWndListLocal != NULL)\r
        {\r
-               LocalProcPtr = (WNDPROC)SetWindowLong(hWndListLocal, GWL_WNDPROC, (LONG)LocalWndProc);\r
+               // 64ビット対応\r
+//             LocalProcPtr = (WNDPROC)SetWindowLong(hWndListLocal, GWL_WNDPROC, (LONG)LocalWndProc);\r
+               LocalProcPtr = (WNDPROC)SetWindowLongPtr(hWndListLocal, GWLP_WNDPROC, (LONG_PTR)LocalWndProc);\r
 \r
            Tmp = SendMessage(hWndListLocal, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);\r
            Tmp |= LVS_EX_FULLROWSELECT;\r
@@ -234,7 +242,9 @@ int MakeListWin(HWND hWnd, HINSTANCE hInst)
 \r
        if(hWndListRemote != NULL)\r
        {\r
-               RemoteProcPtr = (WNDPROC)SetWindowLong(hWndListRemote, GWL_WNDPROC, (LONG)RemoteWndProc);\r
+               // 64ビット対応\r
+//             RemoteProcPtr = (WNDPROC)SetWindowLong(hWndListRemote, GWL_WNDPROC, (LONG)RemoteWndProc);\r
+               RemoteProcPtr = (WNDPROC)SetWindowLongPtr(hWndListRemote, GWLP_WNDPROC, (LONG_PTR)RemoteWndProc);\r
 \r
            Tmp = SendMessage(hWndListRemote, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);\r
            Tmp |= LVS_EX_FULLROWSELECT;\r
@@ -436,9 +446,11 @@ static void doTransferRemoteFile(void)
        int CancelFlg = NO;\r
        char LocDir[FMAX_PATH+1];\r
        char TmpDir[FMAX_PATH+1];\r
-       char buf[32];\r
+       // 環境依存の不具合対策\r
+//     char buf[32];\r
        int i;\r
-       DWORD pid;\r
+       // 環境依存の不具合対策\r
+//     DWORD pid;\r
 \r
        // すでにリモートから転送済みなら何もしない。(2007.9.3 yutaka)\r
        if (remoteFileListBase != NULL)\r
@@ -454,10 +466,15 @@ static void doTransferRemoteFile(void)
 \r
        // アプリを多重起動してもコンフリクトしないように、テンポラリフォルダ名にプロセスID\r
        // を付加する。(2007.9.13 yutaka)\r
-       GetTempPath(sizeof(TmpDir), TmpDir);\r
-       pid = GetCurrentProcessId();\r
-       _snprintf_s(buf, sizeof(buf), _TRUNCATE, "ffftp%d", pid);\r
-       strncat_s(TmpDir, sizeof(TmpDir), buf, _TRUNCATE);\r
+       // 環境依存の不具合対策\r
+//     GetTempPath(sizeof(TmpDir), TmpDir);\r
+//     pid = GetCurrentProcessId();\r
+//     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "ffftp%d", pid);\r
+//     strncat_s(TmpDir, sizeof(TmpDir), buf, _TRUNCATE);\r
+       GetAppTempPath(TmpDir);\r
+       _mkdir(TmpDir);\r
+       SetYenTail(TmpDir);\r
+       strcat(TmpDir, "file");\r
        _mkdir(TmpDir);\r
 #if 0\r
        if (TmpDir[strlen(TmpDir) - 1] == '\\') {\r
@@ -769,6 +786,9 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA
                        return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
 \r
                case WM_DROPFILES :\r
+                       // 同時接続対応\r
+                       if(AskUserOpeDisabled() == YES)\r
+                               break;\r
                        // ドラッグ中は処理しない。ドラッグ後にWM_LBUTTONDOWNが飛んでくるため、そこで処理する。\r
                        if (Dragging == YES) \r
                                return (FALSE);\r
@@ -801,6 +821,9 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA
                                hCsrDrg = LoadCursor(NULL, IDC_ARROW);\r
                                SetCursor(hCsrDrg);\r
 \r
+                               // 同時接続対応\r
+                               if(AskUserOpeDisabled() == YES)\r
+                                       break;\r
                                Point.x = (long)(short)LOWORD(lParam);\r
                                Point.y = (long)(short)HIWORD(lParam);\r
                                ClientToScreen(hWnd, &Point);\r
@@ -881,6 +904,11 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA
  \r
                                        } \r
  \r
+#if defined(HAVE_TANDEM)\r
+                                       if(FileListBaseNoExpand == NULL)\r
+                                               pf = FileListBase;\r
+                                       else\r
+#endif\r
                                        pf = FileListBaseNoExpand;\r
                                        for (filenum = 0; pf ; filenum++) {\r
                                                pf = pf->Next;\r
@@ -1123,32 +1151,50 @@ void GetListTabWidth(void)
 \r
 void SetListViewType(void)\r
 {\r
-       long lStyle;\r
+       // 64ビット対応\r
+//     long lStyle;\r
+       LONG_PTR lStyle;\r
 \r
        switch(ListType)\r
        {\r
                case LVS_LIST :\r
-                       lStyle = GetWindowLong(GetLocalHwnd(), GWL_STYLE);\r
+                       // 64ビット対応\r
+//                     lStyle = GetWindowLong(GetLocalHwnd(), GWL_STYLE);\r
+                       lStyle = GetWindowLongPtr(GetLocalHwnd(), GWL_STYLE);\r
                        lStyle &= ~(LVS_REPORT | LVS_LIST);\r
                        lStyle |= LVS_LIST;\r
-                       SetWindowLong(GetLocalHwnd(), GWL_STYLE, lStyle);\r
+                       // 64ビット対応\r
+//                     SetWindowLong(GetLocalHwnd(), GWL_STYLE, lStyle);\r
+                       SetWindowLongPtr(GetLocalHwnd(), GWL_STYLE, lStyle);\r
 \r
-                       lStyle = GetWindowLong(GetRemoteHwnd(), GWL_STYLE);\r
+                       // 64ビット対応\r
+//                     lStyle = GetWindowLong(GetRemoteHwnd(), GWL_STYLE);\r
+                       lStyle = GetWindowLongPtr(GetRemoteHwnd(), GWL_STYLE);\r
                        lStyle &= ~(LVS_REPORT | LVS_LIST);\r
                        lStyle |= LVS_LIST;\r
-                       SetWindowLong(GetRemoteHwnd(), GWL_STYLE, lStyle);\r
+                       // 64ビット対応\r
+//                     SetWindowLong(GetRemoteHwnd(), GWL_STYLE, lStyle);\r
+                       SetWindowLongPtr(GetRemoteHwnd(), GWL_STYLE, lStyle);\r
                        break;\r
 \r
                default :\r
-                       lStyle = GetWindowLong(GetLocalHwnd(), GWL_STYLE);\r
+                       // 64ビット対応\r
+//                     lStyle = GetWindowLong(GetLocalHwnd(), GWL_STYLE);\r
+                       lStyle = GetWindowLongPtr(GetLocalHwnd(), GWL_STYLE);\r
                        lStyle &= ~(LVS_REPORT | LVS_LIST);\r
                        lStyle |= LVS_REPORT;\r
-                       SetWindowLong(GetLocalHwnd(), GWL_STYLE, lStyle);\r
+                       // 64ビット対応\r
+//                     SetWindowLong(GetLocalHwnd(), GWL_STYLE, lStyle);\r
+                       SetWindowLongPtr(GetLocalHwnd(), GWL_STYLE, lStyle);\r
 \r
-                       lStyle = GetWindowLong(GetRemoteHwnd(), GWL_STYLE);\r
+                       // 64ビット対応\r
+//                     lStyle = GetWindowLong(GetRemoteHwnd(), GWL_STYLE);\r
+                       lStyle = GetWindowLongPtr(GetRemoteHwnd(), GWL_STYLE);\r
                        lStyle &= ~(LVS_REPORT | LVS_LIST);\r
                        lStyle |= LVS_REPORT;\r
-                       SetWindowLong(GetRemoteHwnd(), GWL_STYLE, lStyle);\r
+                       // 64ビット対応\r
+//                     SetWindowLong(GetRemoteHwnd(), GWL_STYLE, lStyle);\r
+                       SetWindowLongPtr(GetRemoteHwnd(), GWL_STYLE, lStyle);\r
                        break;\r
        }\r
        return;\r
@@ -1285,6 +1331,57 @@ void GetRemoteDirForWnd(int Mode, int *CancelCheckWork)
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
+// ファイルアイコン表示対応\r
+void RefreshIconImageList(FLISTANCHOR *Anchor)\r
+{\r
+       HBITMAP hBitmap;\r
+       int ImageId;\r
+       FILELIST *Pos;\r
+       int i;\r
+       char Cur[FMAX_PATH+1];\r
+       SHFILEINFO FileInfo;\r
+       SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL);\r
+       ShowWindow(hWndListLocal, SW_SHOW);\r
+       SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL);\r
+       ShowWindow(hWndListRemote, SW_SHOW);\r
+       ImageList_Destroy(ListImg);\r
+       ListImg = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR24, 0, 1);\r
+       hBitmap = LoadBitmap(GetFtpInst(), MAKEINTRESOURCE(dirattr_bmp));\r
+       ImageList_AddMasked(ListImg, hBitmap, RGB(255,0,0));\r
+       DeleteObject(hBitmap);\r
+       ImageId = 0;\r
+       Pos = Anchor->Top;\r
+       for(i = 0; i < Anchor->Files; i++)\r
+       {\r
+               Pos->ImageId = -1;\r
+               if(AskDispFileIcon() == YES)\r
+               {\r
+                       if(Pos->Node == NODE_DRIVE)\r
+                               strcpy(Cur, Pos->File);\r
+                       else\r
+                       {\r
+                               AskLocalCurDir(Cur, FMAX_PATH);\r
+                               SetYenTail(Cur);\r
+                               strcat(Cur, Pos->File);\r
+                       }\r
+                       if(SHGetFileInfoM(Cur, 0, &FileInfo, sizeof(SHFILEINFO), SHGFI_SMALLICON | SHGFI_ICON) != 0)\r
+                       {\r
+                               if(ImageList_AddIcon(ListImg, FileInfo.hIcon) >= 0)\r
+                               {\r
+                                       Pos->ImageId = ImageId;\r
+                                       ImageId++;\r
+                               }\r
+                               DestroyIcon(FileInfo.hIcon);\r
+                       }\r
+               }\r
+               Pos = Pos->Next;\r
+       }\r
+       SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg);\r
+       ShowWindow(hWndListLocal, SW_SHOW);\r
+       SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg);\r
+       ShowWindow(hWndListRemote, SW_SHOW);\r
+}\r
+\r
 void GetLocalDirForWnd(void)\r
 {\r
        HANDLE fHnd;\r
@@ -1353,6 +1450,8 @@ void GetLocalDirForWnd(void)
                }\r
        }\r
 \r
+       // ファイルアイコン表示対応\r
+       RefreshIconImageList(&Anchor);\r
        DispFileList2View(GetLocalHwnd(), &Anchor);\r
        EraseDispFileList(&Anchor);\r
 \r
@@ -1419,6 +1518,11 @@ static void AddDispFileList(FLISTANCHOR *Anchor, char *Name, FILETIME *Time, LON
                        {\r
                                if((((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
                                        ((Cmp = _mbsicmp(GetFileExt(Name), GetFileExt(Pos->File))) < 0)) ||\r
+#if defined(HAVE_TANDEM)\r
+                                  ((AskHostType() == HTYPE_TANDEM) &&\r
+                                   ((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
+                                       ((Cmp = Attr - Pos->Attr) < 0)) ||\r
+#endif\r
                                   (((Sort & SORT_MASK_ORD) == SORT_SIZE) &&\r
                                        ((Cmp = Size - Pos->Size) < 0)) ||\r
                                   (((Sort & SORT_MASK_ORD) == SORT_DATE) &&\r
@@ -1437,6 +1541,11 @@ static void AddDispFileList(FLISTANCHOR *Anchor, char *Name, FILETIME *Time, LON
                        {\r
                                if((((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
                                        ((Cmp = _mbsicmp(GetFileExt(Name), GetFileExt(Pos->File))) > 0)) ||\r
+#if defined(HAVE_TANDEM)\r
+                                  ((AskHostType() == HTYPE_TANDEM) &&\r
+                                   ((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
+                                       ((Cmp = Attr - Pos->Attr) > 0)) ||\r
+#endif\r
                                   (((Sort & SORT_MASK_ORD) == SORT_SIZE) &&\r
                                        ((Cmp = Size - Pos->Size) > 0)) ||\r
                                   (((Sort & SORT_MASK_ORD) == SORT_DATE) &&\r
@@ -1532,7 +1641,9 @@ static void DispFileList2View(HWND hWnd, FLISTANCHOR *Anchor)
        Pos = Anchor->Top;\r
        for(i = 0; i < Anchor->Files; i++)\r
        {\r
-               AddListView(hWnd, -1, Pos->File, Pos->Node, Pos->Size, &Pos->Time, Pos->Attr, Pos->Owner, Pos->Link, Pos->InfoExist);\r
+               // ファイルアイコン表示対応\r
+//             AddListView(hWnd, -1, Pos->File, Pos->Node, Pos->Size, &Pos->Time, Pos->Attr, Pos->Owner, Pos->Link, Pos->InfoExist);\r
+               AddListView(hWnd, -1, Pos->File, Pos->Node, Pos->Size, &Pos->Time, Pos->Attr, Pos->Owner, Pos->Link, Pos->InfoExist, Pos->ImageId);\r
                Pos = Pos->Next;\r
        }\r
 \r
@@ -1562,7 +1673,9 @@ static void DispFileList2View(HWND hWnd, FLISTANCHOR *Anchor)
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, FILETIME *Time, int Attr, char *Owner, int Link, int InfoExist)\r
+// ファイルアイコン表示対応\r
+//static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, FILETIME *Time, int Attr, char *Owner, int Link, int InfoExist)\r
+static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, FILETIME *Time, int Attr, char *Owner, int Link, int InfoExist, int ImageId)\r
 {\r
        LV_ITEM LvItem;\r
        char Tmp[20];\r
@@ -1581,6 +1694,9 @@ static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size,
                LvItem.iImage = Type;\r
        else\r
                LvItem.iImage = 4;\r
+       // ファイルアイコン表示対応\r
+       if(hWnd == GetLocalHwnd() && ImageId >= 0)\r
+               LvItem.iImage = 5 + ImageId;\r
        LvItem.iItem = SendMessage(hWnd, LVM_INSERTITEM, 0, (LPARAM)&LvItem);\r
 \r
        /* 日付/時刻 */\r
@@ -1610,6 +1726,12 @@ static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size,
        LvItem.mask = LVIF_TEXT;\r
        LvItem.iItem = Pos;\r
        LvItem.iSubItem = 3;\r
+#if defined(HAVE_TANDEM)\r
+       if (AskHostType() == HTYPE_TANDEM) {\r
+               _itoa_s(Attr, Tmp, sizeof(Tmp), 10);\r
+               LvItem.pszText = Tmp;\r
+       } else\r
+#endif\r
        LvItem.pszText = GetFileExt(Name);\r
        LvItem.iItem = SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&LvItem);\r
 \r
@@ -1617,7 +1739,11 @@ static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size,
        {\r
                /* 属性 */\r
                strcpy(Tmp, "");\r
+#if defined(HAVE_TANDEM)\r
+               if((InfoExist & FINFO_ATTR) && (AskHostType() != HTYPE_TANDEM))\r
+#else\r
                if(InfoExist & FINFO_ATTR)\r
+#endif\r
                        AttrValue2String(Attr, Tmp);\r
                LvItem.mask = LVIF_TEXT;\r
                LvItem.iItem = Pos;\r
@@ -1798,7 +1924,9 @@ void SelectFileInList(HWND hWnd, int Type)
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK SelectDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK SelectDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK SelectDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        switch (iMessage)\r
        {\r
@@ -2240,6 +2368,13 @@ int GetNodeSize(int Win, int Pos, LONGLONG *Buf)
        SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&LvItem);\r
        *Buf = -1;\r
        Ret = NO;\r
+#if defined(HAVE_TANDEM)\r
+       if(AskHostType() == HTYPE_TANDEM) {\r
+               RemoveComma(Tmp);\r
+               *Buf = _atoi64(Tmp);\r
+               Ret = YES;\r
+       } else\r
+#endif\r
        if(strlen(Tmp) > 0)\r
        {\r
                RemoveComma(Tmp);\r
@@ -2274,12 +2409,22 @@ int GetNodeAttr(int Win, int Pos, int *Buf)
        {\r
                LvItem.mask = LVIF_TEXT;\r
                LvItem.iItem = Pos;\r
+#if defined(HAVE_TANDEM)\r
+               if(AskHostType() == HTYPE_TANDEM)\r
+                       LvItem.iSubItem = 3;\r
+               else\r
+#endif\r
                LvItem.iSubItem = 4;\r
                LvItem.pszText = Tmp;\r
                LvItem.cchTextMax = 20;\r
                SendMessage(GetRemoteHwnd(), LVM_GETITEM, 0, (LPARAM)&LvItem);\r
                if(strlen(Tmp) > 0)\r
                {\r
+#if defined(HAVE_TANDEM)\r
+                       if(AskHostType() == HTYPE_TANDEM)\r
+                               *Buf = atoi(Tmp);\r
+                       else\r
+#endif\r
                        *Buf = AttrString2Value(Tmp);\r
                        Ret = YES;\r
                }\r
@@ -2582,10 +2727,19 @@ void MakeDroppedFileList(WPARAM wParam, char *Cur, FILELIST **Base)
                        strcpy(Pkt.File, GetFileName(Name));\r
 \r
                        memset(&Pkt.Time, 0, sizeof(FILETIME));\r
+#if defined(HAVE_TANDEM)\r
+                       /* Guardian スペースへのアップロードのためにサイズが必要 */\r
+                       Pkt.Size = 0;\r
+                       Pkt.InfoExist = 0;\r
+#endif\r
                        if((fHnd = FindFirstFile(Name, &Find)) != INVALID_HANDLE_VALUE)\r
                        {\r
                                FindClose(fHnd);\r
                                Pkt.Time = Find.ftLastWriteTime;\r
+#if defined(HAVE_TANDEM)\r
+                               Pkt.Size = MakeLongLong(Find.nFileSizeHigh, Find.nFileSizeLow);\r
+                               Pkt.InfoExist |= (FINFO_TIME | FINFO_DATE | FINFO_SIZE);\r
+#endif\r
                        }\r
                        AddFileList(&Pkt, Base);\r
                }\r
@@ -3298,6 +3452,21 @@ static int AnalizeFileInfo(char *Str)
                                        }\r
                                }\r
 \r
+                               // linux-ftpd\r
+                               if((Ret == LIST_UNKNOWN) &&\r
+                                  (FindField(Str, Tmp, 7+Add1, NO) == FFFTP_SUCCESS))\r
+                               {\r
+                                       if((FindField(Str, Tmp, 5, NO) == FFFTP_SUCCESS) &&\r
+                                          (CheckYYYYMMDDformat(Tmp, NUL) != 0))\r
+                                       {\r
+                                               if((FindField(Str, Tmp, 6, NO) == FFFTP_SUCCESS) &&\r
+                                                  (CheckHHMMformat(Tmp) == YES))\r
+                                               {\r
+                                                       Ret = LIST_UNIX_16;\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
                                if((Ret != LIST_UNKNOWN) && (Flag1 == YES))\r
                                        Ret |= LIST_MELCOM;\r
                        }\r
@@ -3601,6 +3770,20 @@ static int AnalizeFileInfo(char *Str)
                                }\r
                        }\r
                }\r
+#if defined(HAVE_TANDEM)\r
+               /* 以下のフォーマットをチェック */\r
+               /* LIST_TANDEM */\r
+\r
+               /* OSS の場合は自動判別可能のため Ret == LIST_UNKNOWN のチェックは後 */\r
+               if(AskRealHostType() == HTYPE_TANDEM) {\r
+                       if(Ret == LIST_UNKNOWN) {\r
+                               SetOSS(NO);\r
+                               Ret = LIST_TANDEM;\r
+                       } else {\r
+                               SetOSS(YES);\r
+                       }\r
+               }\r
+#endif\r
 \r
                // MLSD対応\r
                if(Ret == LIST_UNKNOWN)\r
@@ -3932,6 +4115,8 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size,
 \r
        /* まずクリアしておく */\r
        Ret = NODE_NONE;\r
+       // バグ対策\r
+       memset(Fname, NUL, FMAX_PATH+1);\r
        *Size = -1;\r
        *Attr = 0;\r
        *Link = NO;\r
@@ -4607,6 +4792,142 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size,
                        }\r
                        break;\r
 \r
+#if defined(HAVE_TANDEM)\r
+               case LIST_TANDEM :\r
+                       *InfoExist |= (FINFO_TIME | FINFO_DATE | FINFO_SIZE | FINFO_ATTR);\r
+                       /* Open 中だったらずらす */\r
+                       if(FindField(Str, Buf, 1, NO) != FFFTP_SUCCESS)\r
+                               break;\r
+                       if (!strncmp(Buf, "O", 1)) {\r
+                               offs = 1;\r
+                       }\r
+                       /* 日付 */\r
+                       if(FindField(Str, Buf, 3 + offs, NO) != FFFTP_SUCCESS)\r
+                               break;\r
+                       if (Buf[1] == '-') {  /* 日付が 1桁 */\r
+                               sTime.wYear = Assume1900or2000(atoi(Buf + 6));\r
+                               Buf[5] = 0;\r
+                               GetMonth(Buf+2, &sTime.wMonth, &sTime.wDay);    /* wDayは常に0 */\r
+                               sTime.wDay = atoi(Buf);\r
+                               sTime.wDayOfWeek = 0;\r
+                       } else {\r
+                               sTime.wYear = Assume1900or2000(atoi(Buf + 7));\r
+                               Buf[6] = 0;\r
+                               GetMonth(Buf+3, &sTime.wMonth, &sTime.wDay);    /* wDayは常に0 */\r
+                               sTime.wDay = atoi(Buf);\r
+                               sTime.wDayOfWeek = 0;\r
+                       }\r
+                       /* 時刻 */\r
+                       FindField(Str, Buf, 4 + offs, NO);\r
+                       sTime.wHour = atoi(Buf);\r
+                       sTime.wMinute = atoi(Buf+3);\r
+                       sTime.wSecond = atoi(Buf+6);\r
+                       sTime.wMilliseconds = 0;\r
+                       SystemTimeToFileTime(&sTime, Time);\r
+                       SpecificLocalFileTime2FileTime(Time, AskHostTimeZone());\r
+\r
+                       /* 属性 セキュリティではなく FileCode を保存する */\r
+                       FindField(Str, Buf, 1 + offs, NO);\r
+                       *Attr = atoi(Buf);\r
+                       /* サイズ */\r
+                       FindField(Str, Buf, 2 + offs, NO);\r
+                       *Size = _atoi64(Buf);\r
+                       /* オーナ名 */\r
+                       if(FindField(Str, Buf, 5 + offs, NO) == FFFTP_SUCCESS) {\r
+                               if(strncmp(Buf, "Owner", sizeof("Owner"))) {\r
+                                       memset(Owner, NUL, OWNER_NAME_LEN+1);\r
+                                       strncpy(Owner, Buf, OWNER_NAME_LEN);\r
+                                       /* 通常は 255,255 だが、20, 33 などにも対応する */\r
+                                       /* 最後の文字が , だったら後ろとつなげる */\r
+                                       if (Buf[strlen(Buf)-1] == ',') {\r
+                                               FindField(Str, Buf, 6 + offs, NO);\r
+                                               strncat(Owner, Buf, OWNER_NAME_LEN - strlen(Buf));\r
+                                       }\r
+                                       /* ファイル名 */\r
+                                       if(FindField(Str, Fname, 0, NO) == FFFTP_SUCCESS) {\r
+                                               Ret = NODE_FILE;\r
+                                       }\r
+                               }\r
+                       }\r
+                       break;\r
+#endif\r
+\r
+                       // MLSD対応\r
+                       // 以下の形式に対応\r
+                       // fact1=value1;fact2=value2;fact3=value3; filename\r\n\r
+                       // 不完全な実装のホストが存在するため以下の形式も許容\r
+                       // fact1=value1;fact2=value2;fact3=value3 filename\r\n\r
+                       // fact1=value1;fact2=value2;fact3=value3;filename\r\n\r
+               case LIST_MLSD:\r
+                       {\r
+                               int i = 0;\r
+                               char StrBuf[(FMAX_PATH * 2) + 1];\r
+                               char Fact[FMAX_PATH + 1];\r
+                               char Name[FMAX_PATH + 1];\r
+                               char Value[FMAX_PATH + 1];\r
+                               char* pFileName;\r
+                               strncpy(StrBuf, Str, FMAX_PATH * 2);\r
+                               StrBuf[FMAX_PATH * 2] = '\0';\r
+                               if((pFileName = strstr(StrBuf, "; ")) != NULL)\r
+                               {\r
+                                       *pFileName = '\0';\r
+                                       pFileName += 2;\r
+                               }\r
+                               else if((pFileName = strchr(StrBuf, ' ')) != NULL)\r
+                               {\r
+                                       *pFileName = '\0';\r
+                                       pFileName++;\r
+                               }\r
+                               else if((pFileName = strrchr(StrBuf, ';')) != NULL)\r
+                               {\r
+                                       *pFileName = '\0';\r
+                                       pFileName++;\r
+                               }\r
+                               if(pFileName != NULL)\r
+                                       strcpy(Fname, pFileName);\r
+                               while(FindField2(StrBuf, Fact, ';', i, NO) == FFFTP_SUCCESS)\r
+                               {\r
+                                       if(FindField2(Fact, Name, '=', 0, NO) == FFFTP_SUCCESS && FindField2(Fact, Value, '=', 1, NO) == FFFTP_SUCCESS)\r
+                                       {\r
+                                               if(_stricmp(Name, "type") == 0)\r
+                                               {\r
+                                                       if(_stricmp(Value, "dir") == 0)\r
+                                                               Ret = NODE_DIR;\r
+                                                       else if(_stricmp(Value, "file") == 0)\r
+                                                               Ret = NODE_FILE;\r
+                                               }\r
+                                               else if(_stricmp(Name, "size") == 0)\r
+                                               {\r
+                                                       *Size = _atoi64(Value);\r
+                                                       *InfoExist |= FINFO_SIZE;\r
+                                               }\r
+                                               else if(_stricmp(Name, "modify") == 0)\r
+                                               {\r
+                                                       sTime.wYear = atoi_n(Value, 4);\r
+                                                       sTime.wMonth = atoi_n(Value + 4, 2);\r
+                                                       sTime.wDay = atoi_n(Value + 6, 2);\r
+                                                       sTime.wHour = atoi_n(Value + 8, 2);\r
+                                                       sTime.wMinute = atoi_n(Value + 10, 2);\r
+                                                       sTime.wSecond = atoi_n(Value + 12, 2);\r
+                                                       sTime.wMilliseconds = 0;\r
+                                                       SystemTimeToFileTime(&sTime, Time);\r
+                                                       // 時刻はGMT\r
+//                                                     SpecificLocalFileTime2FileTime(Time, AskHostTimeZone());\r
+                                                       *InfoExist |= FINFO_DATE | FINFO_TIME;\r
+                                               }\r
+                                               else if(_stricmp(Name, "UNIX.mode") == 0)\r
+                                               {\r
+                                                       *Attr = strtol(Value, NULL, 16);\r
+                                                       *InfoExist |= FINFO_ATTR;\r
+                                               }\r
+                                               else if(_stricmp(Name, "UNIX.owner") == 0)\r
+                                                       strcpy(Owner, Value);\r
+                                       }\r
+                                       i++;\r
+                               }\r
+                       }\r
+                       break;\r
+\r
                case LIST_UNIX_10 :\r
                case LIST_UNIX_11 :\r
                case LIST_UNIX_12 :\r
@@ -4636,6 +4957,8 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size,
                case LIST_UNIX_75 :\r
 // MELCOMはビットフラグになっている\r
 //             case LIST_MELCOM :\r
+               // linux-ftpd\r
+               case LIST_UNIX_16 :\r
                default:\r
                        /* offsはサイズの位置, offs=0はカラム4 */\r
                        offs = 0;\r
@@ -4670,6 +4993,16 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size,
 \r
                        /* offs2は時間(もしくは年)の位置 */\r
                        offs2 = 0;\r
+                       // linux-ftpd\r
+//                     if((ListType == LIST_UNIX_11) ||\r
+//                        (ListType == LIST_UNIX_13) ||\r
+//                        (ListType == LIST_UNIX_21) ||\r
+//                        (ListType == LIST_UNIX_23) ||\r
+//                        (ListType == LIST_UNIX_51) ||\r
+//                        (ListType == LIST_UNIX_61) ||\r
+//                        (ListType == LIST_UNIX_63) ||\r
+//                        (ListType == LIST_UNIX_71) ||\r
+//                        (ListType == LIST_UNIX_73))\r
                        if((ListType == LIST_UNIX_11) ||\r
                           (ListType == LIST_UNIX_13) ||\r
                           (ListType == LIST_UNIX_21) ||\r
@@ -4678,7 +5011,8 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size,
                           (ListType == LIST_UNIX_61) ||\r
                           (ListType == LIST_UNIX_63) ||\r
                           (ListType == LIST_UNIX_71) ||\r
-                          (ListType == LIST_UNIX_73))\r
+                          (ListType == LIST_UNIX_73) ||\r
+                          (ListType == LIST_UNIX_16))\r
                                offs2 = -1;\r
 \r
                        /* offs3はオーナ名の位置 */\r
@@ -4756,6 +5090,16 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size,
                                        if(GetHourAndMinute(Buf, &sTime.wHour, &sTime.wMinute) == FFFTP_SUCCESS)\r
                                                *InfoExist |= FINFO_TIME;\r
                                }\r
+                               // linux-ftpd\r
+                               else if(CheckYYYYMMDDformat(Buf, NUL) != 0)\r
+                               {\r
+                                       sTime.wYear = atoi(Buf);\r
+                                       sTime.wMonth = atoi(Buf+5);\r
+                                       sTime.wDay = atoi(Buf+8);\r
+                                       FindField(Str, Buf, 7+offs+offs2, NO);\r
+                                       if(GetHourAndMinute(Buf, &sTime.wHour, &sTime.wMinute) == FFFTP_SUCCESS)\r
+                                               *InfoExist |= FINFO_TIME;\r
+                               }\r
                                else\r
                                {\r
                                        GetMonth(Buf, &sTime.wMonth, &sTime.wDay);\r
@@ -4849,56 +5193,6 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size,
                                        Ret = NODE_NONE;\r
                        }\r
                        break;\r
-\r
-                       // MLSD対応\r
-               case LIST_MLSD:\r
-                       {\r
-                               int i = 0;\r
-                               char Tmp[FMAX_PATH + 1];\r
-                               char Name[FMAX_PATH + 1];\r
-                               char Value[FMAX_PATH + 1];\r
-                               while(FindField2(Str, Tmp, ';', i, NO) == FFFTP_SUCCESS)\r
-                               {\r
-                                       if(i >= 1 && strncmp(Tmp, " ", 1) == 0)\r
-                                               strcpy(Fname, strstr(Str, "; ") + 2);\r
-                                       else if(FindField2(Tmp, Name, '=', 0, NO) == FFFTP_SUCCESS && FindField2(Tmp, Value, '=', 1, NO) == FFFTP_SUCCESS)\r
-                                       {\r
-                                               if(_stricmp(Name, "type") == 0)\r
-                                               {\r
-                                                       if(_stricmp(Value, "dir") == 0)\r
-                                                               Ret = NODE_DIR;\r
-                                                       else if(_stricmp(Value, "file") == 0)\r
-                                                               Ret = NODE_FILE;\r
-                                               }\r
-                                               else if(_stricmp(Name, "size") == 0)\r
-                                               {\r
-                                                       *Size = _atoi64(Value);\r
-                                                       *InfoExist |= FINFO_SIZE;\r
-                                               }\r
-                                               else if(_stricmp(Name, "modify") == 0)\r
-                                               {\r
-                                                       sTime.wYear = atoi_n(Value, 4);\r
-                                                       sTime.wMonth = atoi_n(Value + 4, 2);\r
-                                                       sTime.wDay = atoi_n(Value + 6, 2);\r
-                                                       sTime.wHour = atoi_n(Value + 8, 2);\r
-                                                       sTime.wMinute = atoi_n(Value + 10, 2);\r
-                                                       sTime.wSecond = atoi_n(Value + 12, 2);\r
-                                                       SystemTimeToFileTime(&sTime, Time);\r
-//                                                     SpecificLocalFileTime2FileTime(Time, AskHostTimeZone());\r
-                                                       *InfoExist |= FINFO_DATE | FINFO_TIME;\r
-                                               }\r
-                                               else if(_stricmp(Name, "UNIX.mode") == 0)\r
-                                               {\r
-                                                       *Attr = strtol(Value, NULL, 16);\r
-                                                       *InfoExist |= FINFO_ATTR;\r
-                                               }\r
-                                               else if(_stricmp(Name, "UNIX.owner") == 0)\r
-                                                       strcpy(Owner, Value);\r
-                                       }\r
-                                       i++;\r
-                               }\r
-                       }\r
-                       break;\r
        }\r
 \r
        // UTF-8対応\r
@@ -5414,7 +5708,9 @@ void SetFilter(int *CancelCheckWork)
 *              BOOL TRUE/FALSE\r
 *----------------------------------------------------------------------------*/\r
 \r
-static BOOL CALLBACK FilterWndProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+// 64ビット対応\r
+//static BOOL CALLBACK FilterWndProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
+static INT_PTR CALLBACK FilterWndProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
 {\r
        switch (iMessage)\r
        {\r