OSDN Git Service

Modify documents.
[ffftp/ffftp.git] / ftpproc.c
1 /*=============================================================================\r
2 *\r
3 *                                                               FTPコマンド操作\r
4 *\r
5 ===============================================================================\r
6 / Copyright (C) 1997-2007 Sota. All rights reserved.\r
7 /\r
8 / Redistribution and use in source and binary forms, with or without \r
9 / modification, are permitted provided that the following conditions \r
10 / are met:\r
11 /\r
12 /  1. Redistributions of source code must retain the above copyright \r
13 /     notice, this list of conditions and the following disclaimer.\r
14 /  2. Redistributions in binary form must reproduce the above copyright \r
15 /     notice, this list of conditions and the following disclaimer in the \r
16 /     documentation and/or other materials provided with the distribution.\r
17 /\r
18 / THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR \r
19 / IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES \r
20 / OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \r
21 / IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, \r
22 / INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, \r
23 / BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF \r
24 / USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \r
25 / ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
26 / (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF \r
27 / THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
28 /============================================================================*/\r
29 \r
30 #define  STRICT\r
31 // IPv6対応\r
32 #include <winsock2.h>\r
33 #include <windows.h>\r
34 #include <stdio.h>\r
35 #include <stdlib.h>\r
36 #include <string.h>\r
37 #include <mbstring.h>\r
38 #include <windowsx.h>\r
39 #include <commctrl.h>\r
40 \r
41 #include "common.h"\r
42 #include "resource.h"\r
43 \r
44 #include <htmlhelp.h>\r
45 #include "helpid.h"\r
46 \r
47 // UTF-8対応\r
48 #undef __MBSWRAPPER_H__\r
49 #include "mbswrapper.h"\r
50 \r
51 \r
52 /*===== プロトタイプ =====*/\r
53 \r
54 static int CheckRemoteFile(TRANSPACKET *Pkt, FILELIST *ListList);\r
55 // 64ビット対応\r
56 //static BOOL CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
57 static INT_PTR CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
58 \r
59 static void DispMirrorFiles(FILELIST *Local, FILELIST *Remote);\r
60 static void MirrorDeleteAllLocalDir(FILELIST *Local, TRANSPACKET *Pkt, TRANSPACKET **Base);\r
61 static int CheckLocalFile(TRANSPACKET *Pkt);\r
62 // 64ビット対応\r
63 //static BOOL CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
64 static INT_PTR CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
65 static void RemoveAfterSemicolon(char *Path);\r
66 static void MirrorDeleteAllDir(FILELIST *Remote, TRANSPACKET *Pkt, TRANSPACKET **Base);\r
67 // 64ビット対応\r
68 //static BOOL CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
69 //static BOOL CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
70 static INT_PTR CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
71 static INT_PTR CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
72 static void CountMirrorFiles(HWND hDlg, TRANSPACKET *Pkt);\r
73 static int AskMirrorNoTrn(char *Fname, int Mode);\r
74 static int AskUpLoadFileAttr(char *Fname);\r
75 // 64ビット対応\r
76 //static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
77 static INT_PTR CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
78 #if defined(HAVE_TANDEM)\r
79 static INT_PTR CALLBACK UpDownAsWithExtDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
80 #endif\r
81 static void DeleteAllDir(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDir);\r
82 static void DelNotifyAndDo(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDir);\r
83 // 64ビット対応\r
84 //static BOOL CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
85 //static BOOL CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
86 static INT_PTR CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
87 static INT_PTR CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
88 static void SetAttrToDialog(HWND hWnd, int Attr);\r
89 static int GetAttrFromDialog(HWND hDlg);\r
90 static LRESULT CALLBACK SizeNotifyDlgWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);\r
91 static LRESULT CALLBACK SizeDlgWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);\r
92 static int RenameUnuseableName(char *Fname);\r
93 \r
94 /*===== 外部参照 ====*/\r
95 \r
96 extern HWND hHelpWin;\r
97 \r
98 /* 設定値 */\r
99 extern int FnameCnv;\r
100 extern int RecvMode;\r
101 extern int SendMode;\r
102 extern int MoveMode;\r
103 extern char MirrorNoTrn[MIRROR_LEN+1];\r
104 extern char MirrorNoDel[MIRROR_LEN+1];\r
105 extern int MirrorFnameCnv;\r
106 extern char DefAttrList[DEFATTRLIST_LEN+1];\r
107 extern SIZE MirrorDlgSize;\r
108 extern int VaxSemicolon;\r
109 extern int DebugConsole;\r
110 extern int CancelFlg;\r
111 // ディレクトリ自動作成\r
112 extern int MakeAllDir;\r
113 \r
114 /*===== ローカルなワーク =====*/\r
115 \r
116 static char TmpString[FMAX_PATH+80];            /* テンポラリ */\r
117 #if defined(HAVE_TANDEM)\r
118 static char TmpFileCode[5];             /* テンポラリ */\r
119 #endif\r
120 static int CurWin;                                              /* ウインドウ番号 */\r
121 \r
122 int UpExistMode = EXIST_OVW;            /* アップロードで同じ名前のファイルがある時の扱い方 EXIST_xxx */\r
123 int ExistMode = EXIST_OVW;              /* 同じ名前のファイルがある時の扱い方 EXIST_xxx */\r
124 static int ExistNotify;         /* 確認ダイアログを出すかどうか YES/NO */\r
125 \r
126 static double FileSize;         /* ファイル総容量 */\r
127 \r
128 \r
129 \r
130 /*----- ファイル一覧で指定されたファイルをダウンロードする --------------------\r
131 *\r
132 *       Parameter\r
133 *               int ChName : 名前を変えるかどうか (YES/NO)\r
134 *               int ForceFile : ディレクトリをファイル見なすかどうか (YES/NO)\r
135 *               int All : 全てが選ばれている物として扱うかどうか (YES/NO)\r
136 *\r
137 *       Return Value\r
138 *               なし\r
139 *----------------------------------------------------------------------------*/\r
140 \r
141 // ディレクトリ自動作成\r
142 // ローカル側のパスから必要なフォルダを作成\r
143 int MakeDirFromLocalPath(char* LocalFile)\r
144 {\r
145         TRANSPACKET Pkt;\r
146         char* pDelimiter;\r
147         char* pNext;\r
148         char* Cat;\r
149         int Len;\r
150         char Tmp[FMAX_PATH+1];\r
151         int Make;\r
152         pDelimiter = LocalFile;\r
153         Make = NO;\r
154         while(pNext = strchr(pDelimiter, '\\'))\r
155         {\r
156                 Len = pNext - LocalFile;\r
157                 strncpy(Pkt.LocalFile, LocalFile, Len);\r
158                 Pkt.LocalFile[Len] = '\0';\r
159                 AskLocalCurDir(Tmp, FMAX_PATH);\r
160                 SetYenTail(Tmp);\r
161                 if(strncmp(LocalFile, Tmp, Len + 1) != 0)\r
162                 {\r
163                         Cat = Pkt.LocalFile + (pDelimiter - LocalFile);\r
164                         if(FnameCnv == FNAME_LOWER)\r
165                                 _mbslwr(Cat);\r
166                         else if(FnameCnv == FNAME_UPPER)\r
167                                 _mbsupr(Cat);\r
168                         ReplaceAll(Pkt.LocalFile, '/', '\\');\r
169 \r
170                         strcpy(Pkt.Cmd, "MKD ");\r
171                         strcpy(Pkt.RemoteFile, "");\r
172                         AddTransFileList(&Pkt);\r
173 \r
174                         Make = YES;\r
175                 }\r
176                 pDelimiter = pNext + 1;\r
177         }\r
178         return Make;\r
179 }\r
180 \r
181 void DownLoadProc(int ChName, int ForceFile, int All)\r
182 {\r
183         FILELIST *FileListBase;\r
184         FILELIST *Pos;\r
185         TRANSPACKET Pkt;\r
186 \r
187         // 同時接続対応\r
188         CancelFlg = NO;\r
189 \r
190         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
191         {\r
192                 DisableUserOpe();\r
193 \r
194                 ExistNotify = YES;\r
195 //              KeepTransferDialog(YES);\r
196 \r
197                 FileListBase = NULL;\r
198                 MakeSelectedFileList(WIN_REMOTE, (ForceFile == YES ? NO : YES), All, &FileListBase, &CancelFlg);\r
199 \r
200                 if(AskNoFullPathMode() == YES)\r
201                 {\r
202                         strcpy(Pkt.Cmd, "SETCUR");\r
203                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
204                         AddTransFileList(&Pkt);\r
205                 }\r
206 \r
207                 Pos = FileListBase;\r
208                 while(Pos != NULL)\r
209                 {\r
210                         AskLocalCurDir(Pkt.LocalFile, FMAX_PATH);\r
211                         SetYenTail(Pkt.LocalFile);\r
212                         strcpy(TmpString, Pos->File);\r
213                         if((ChName == NO) || ((ForceFile == NO) && (Pos->Node == NODE_DIR)))\r
214                         {\r
215                                 if(FnameCnv == FNAME_LOWER)\r
216                                         _mbslwr(TmpString);\r
217                                 else if(FnameCnv == FNAME_UPPER)\r
218                                         _mbsupr(TmpString);\r
219                                 RemoveAfterSemicolon(TmpString);\r
220                                 if(RenameUnuseableName(TmpString) == FFFTP_FAIL)\r
221                                         break;\r
222                         }\r
223                         else\r
224                         {\r
225                                 CurWin = WIN_REMOTE;\r
226                                 if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(updown_as_dlg), GetMainHwnd(), UpDownAsDialogCallBack) == YES)\r
227                                 {\r
228                                         if(RenameUnuseableName(TmpString) == FFFTP_FAIL)\r
229                                                 break;\r
230                                 }\r
231                                 else\r
232                                         break;\r
233                         }\r
234                         strcat(Pkt.LocalFile, TmpString);\r
235                         ReplaceAll(Pkt.LocalFile, '/', '\\');\r
236 \r
237                         if((ForceFile == NO) && (Pos->Node == NODE_DIR))\r
238                         {\r
239                                 strcpy(Pkt.Cmd, "MKD ");\r
240                                 strcpy(Pkt.RemoteFile, "");\r
241                                 AddTransFileList(&Pkt);\r
242                         }\r
243                         else if((Pos->Node == NODE_FILE) ||\r
244                                         ((ForceFile == YES) && (Pos->Node == NODE_DIR)))\r
245                         {\r
246                                 if(AskHostType() == HTYPE_ACOS)\r
247                                 {\r
248                                         strcpy(Pkt.RemoteFile, "'");\r
249                                         strcat(Pkt.RemoteFile, AskHostLsName());\r
250                                         strcat(Pkt.RemoteFile, "(");\r
251                                         strcat(Pkt.RemoteFile, Pos->File);\r
252                                         strcat(Pkt.RemoteFile, ")");\r
253                                         strcat(Pkt.RemoteFile, "'");\r
254                                 }\r
255                                 else if(AskHostType() == HTYPE_ACOS_4)\r
256                                 {\r
257                                         strcpy(Pkt.RemoteFile, Pos->File);\r
258                                 }\r
259                                 else\r
260                                 {\r
261                                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
262                                         SetSlashTail(Pkt.RemoteFile);\r
263                                         strcat(Pkt.RemoteFile, Pos->File);\r
264                                         ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
265                                 }\r
266 \r
267                                 strcpy(Pkt.Cmd, "RETR ");\r
268 #if defined(HAVE_TANDEM)\r
269                                 if(AskHostType() == HTYPE_TANDEM) {\r
270                                         if(AskTransferType() != TYPE_X) {\r
271                                                 Pkt.Type = AskTransferType();\r
272                                         } else {\r
273                                                 Pkt.Attr = Pos->Attr;\r
274                                                 if (Pkt.Attr == 101)\r
275                                                         Pkt.Type = TYPE_A;\r
276                                                 else\r
277                                                         Pkt.Type = TYPE_I;\r
278                                         }\r
279                                 } else\r
280 #endif\r
281                                 Pkt.Type = AskTransferTypeAssoc(Pkt.RemoteFile, AskTransferType());\r
282                                 Pkt.Size = Pos->Size;\r
283                                 Pkt.Time = Pos->Time;\r
284                                 Pkt.KanjiCode = AskHostKanjiCode();\r
285                                 // UTF-8対応\r
286                                 Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
287                                 Pkt.KanaCnv = AskHostKanaCnv();\r
288 \r
289                                 Pkt.Mode = CheckLocalFile(&Pkt);        /* Pkt.ExistSize がセットされる */\r
290                                 if(Pkt.Mode == EXIST_ABORT)\r
291                                         break;\r
292                                 else if(Pkt.Mode != EXIST_IGNORE)\r
293                                 // ディレクトリ自動作成\r
294 //                                      AddTransFileList(&Pkt);\r
295                                 {\r
296                                         if(MakeAllDir == YES)\r
297                                                 MakeDirFromLocalPath(Pkt.LocalFile);\r
298                                         AddTransFileList(&Pkt);\r
299                                 }\r
300                         }\r
301                         Pos = Pos->Next;\r
302                 }\r
303 \r
304                 if(AskNoFullPathMode() == YES)\r
305                 {\r
306                         strcpy(Pkt.Cmd, "BACKCUR");\r
307                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
308                         AddTransFileList(&Pkt);\r
309                 }\r
310                 DeleteFileList(&FileListBase);\r
311 \r
312                 // 同時接続対応\r
313 //              strcpy(Pkt.Cmd, "GOQUIT");\r
314 //              AddTransFileList(&Pkt);\r
315 \r
316                 GoForwardTransWindow();\r
317 //              KeepTransferDialog(NO);\r
318 \r
319                 EnableUserOpe();\r
320         }\r
321         return;\r
322 }\r
323 \r
324 \r
325 /*----- 指定されたファイルを一つダウンロードする ------------------------------\r
326 *\r
327 *       Parameter\r
328 *               char *Fname : ファイル名\r
329 *\r
330 *       Return Value\r
331 *               なし\r
332 *----------------------------------------------------------------------------*/\r
333 \r
334 void DirectDownLoadProc(char *Fname)\r
335 {\r
336         TRANSPACKET Pkt;\r
337 \r
338         // 同時接続対応\r
339         CancelFlg = NO;\r
340 \r
341         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
342         {\r
343                 DisableUserOpe();\r
344 \r
345                 ExistNotify = YES;\r
346 //              KeepTransferDialog(YES);\r
347 \r
348                 if(AskNoFullPathMode() == YES)\r
349                 {\r
350                         strcpy(Pkt.Cmd, "SETCUR");\r
351                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
352                         AddTransFileList(&Pkt);\r
353                 }\r
354 \r
355                 if(strlen(Fname) > 0)\r
356                 {\r
357                         AskLocalCurDir(Pkt.LocalFile, FMAX_PATH);\r
358                         SetYenTail(Pkt.LocalFile);\r
359                         strcpy(TmpString, Fname);\r
360                         if(FnameCnv == FNAME_LOWER)\r
361                                 _mbslwr(TmpString);\r
362                         else if(FnameCnv == FNAME_UPPER)\r
363                                 _mbsupr(TmpString);\r
364                         RemoveAfterSemicolon(TmpString);\r
365 \r
366                         if(RenameUnuseableName(TmpString) == FFFTP_SUCCESS)\r
367                         {\r
368                                 strcat(Pkt.LocalFile, TmpString);\r
369                                 ReplaceAll(Pkt.LocalFile, '/', '\\');\r
370 \r
371                                 if(AskHostType() == HTYPE_ACOS)\r
372                                 {\r
373                                         strcpy(Pkt.RemoteFile, "'");\r
374                                         strcat(Pkt.RemoteFile, AskHostLsName());\r
375                                         strcat(Pkt.RemoteFile, "(");\r
376                                         strcat(Pkt.RemoteFile, Fname);\r
377                                         strcat(Pkt.RemoteFile, ")");\r
378                                         strcat(Pkt.RemoteFile, "'");\r
379                                 }\r
380                                 else if(AskHostType() == HTYPE_ACOS_4)\r
381                                 {\r
382                                         strcpy(Pkt.RemoteFile, Fname);\r
383                                 }\r
384                                 else\r
385                                 {\r
386                                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
387                                         SetSlashTail(Pkt.RemoteFile);\r
388                                         strcat(Pkt.RemoteFile, Fname);\r
389                                         ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
390                                 }\r
391 \r
392                                 strcpy(Pkt.Cmd, "RETR-S ");\r
393                                 Pkt.Type = AskTransferTypeAssoc(Pkt.RemoteFile, AskTransferType());\r
394 \r
395                                 /* サイズと日付は転送側スレッドで取得し、セットする */\r
396 \r
397                                 Pkt.KanjiCode = AskHostKanjiCode();\r
398                                 // UTF-8対応\r
399                                 Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
400                                 Pkt.KanaCnv = AskHostKanaCnv();\r
401 \r
402                                 Pkt.Mode = CheckLocalFile(&Pkt);        /* Pkt.ExistSize がセットされる */\r
403                                 if((Pkt.Mode != EXIST_ABORT) && (Pkt.Mode != EXIST_IGNORE))\r
404                                         AddTransFileList(&Pkt);\r
405                         }\r
406                 }\r
407 \r
408                 if(AskNoFullPathMode() == YES)\r
409                 {\r
410                         strcpy(Pkt.Cmd, "BACKCUR");\r
411                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
412                         AddTransFileList(&Pkt);\r
413                 }\r
414 \r
415                 // 同時接続対応\r
416 //              strcpy(Pkt.Cmd, "GOQUIT");\r
417 //              AddTransFileList(&Pkt);\r
418 \r
419                 GoForwardTransWindow();\r
420 //              KeepTransferDialog(NO);\r
421 \r
422                 EnableUserOpe();\r
423         }\r
424         return;\r
425 }\r
426 \r
427 \r
428 /*----- 入力されたファイル名のファイルを一つダウンロードする ------------------\r
429 *\r
430 *       Parameter\r
431 *               なし\r
432 *\r
433 *       Return Value\r
434 *               なし\r
435 *----------------------------------------------------------------------------*/\r
436 \r
437 void InputDownLoadProc(void)\r
438 {\r
439         char Path[FMAX_PATH+1];\r
440         int Tmp;\r
441 \r
442 //      DisableUserOpe();\r
443 \r
444         strcpy(Path, "");\r
445         if(InputDialogBox(downname_dlg, GetMainHwnd(), NULL, Path, FMAX_PATH, &Tmp, IDH_HELP_TOPIC_0000001) == YES)\r
446         {\r
447                 DirectDownLoadProc(Path);\r
448         }\r
449 \r
450 //      EnableUserOpe();\r
451 \r
452         return;\r
453 }\r
454 \r
455 \r
456 /*----- ミラーリングダウンロードを行う ----------------------------------------\r
457 *\r
458 *       Parameter\r
459 *               int Notify : 確認を行うかどうか (YES/NO)\r
460 *\r
461 *       Return Value\r
462 *               なし\r
463 *----------------------------------------------------------------------------*/\r
464 \r
465 void MirrorDownloadProc(int Notify)\r
466 {\r
467         FILELIST *LocalListBase;\r
468         FILELIST *RemoteListBase;\r
469         FILELIST *LocalPos;\r
470         FILELIST *RemotePos;\r
471         TRANSPACKET Pkt;\r
472         TRANSPACKET *Base;\r
473         char Name[FMAX_PATH+1];\r
474         char *Cat;\r
475         int Level;\r
476         int Mode;\r
477 \r
478         // 同時接続対応\r
479         CancelFlg = NO;\r
480 \r
481         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
482         {\r
483                 DisableUserOpe();\r
484 \r
485                 Base = NULL;\r
486 \r
487                 if(Notify == YES)\r
488                         Notify = DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(mirror_down_dlg), GetMainHwnd(), MirrorNotifyCallBack, 0);\r
489                 else\r
490                         Notify = YES;\r
491 \r
492                 if((Notify == YES) || (Notify == YES_LIST))\r
493                 {\r
494                         /*===== ファイルリスト取得 =====*/\r
495 \r
496                         LocalListBase = NULL;\r
497                         MakeSelectedFileList(WIN_LOCAL, YES, YES, &LocalListBase, &CancelFlg);\r
498                         RemoteListBase = NULL;\r
499                         MakeSelectedFileList(WIN_REMOTE, YES, YES, &RemoteListBase, &CancelFlg);\r
500 \r
501                         RemotePos = RemoteListBase;\r
502                         while(RemotePos != NULL)\r
503                         {\r
504                                 RemotePos->Attr = YES;          /* RemotePos->Attrは転送するかどうかのフラグに使用 (YES/NO) */\r
505                                 RemotePos = RemotePos->Next;\r
506                         }\r
507 \r
508                         LocalPos = LocalListBase;\r
509                         while(LocalPos != NULL)\r
510                         {\r
511                                 if(AskMirrorNoTrn(LocalPos->File, 1) == NO)\r
512                                 {\r
513                                         LocalPos->Attr = YES;\r
514                                         LocalPos = LocalPos->Next;\r
515                                 }\r
516                                 else\r
517                                 {\r
518                                         LocalPos->Attr = NO;    /* LocalPos->Attrは削除するかどうかのフラグに使用 (YES/NO) */\r
519 \r
520                                         if(LocalPos->Node == NODE_DIR)\r
521                                         {\r
522                                                 Level = AskDirLevel(LocalPos->File);\r
523                                                 LocalPos = LocalPos->Next;\r
524                                                 while(LocalPos != NULL)\r
525                                                 {\r
526                                                         if((LocalPos->Node == NODE_DIR) &&\r
527                                                            (AskDirLevel(LocalPos->File) <= Level))\r
528                                                         {\r
529                                                                 break;\r
530                                                         }\r
531                                                         LocalPos->Attr = NO;\r
532                                                         LocalPos = LocalPos->Next;\r
533                                                 }\r
534                                         }\r
535                                         else\r
536                                                 LocalPos = LocalPos->Next;\r
537                                 }\r
538                         }\r
539 \r
540                         /*===== ファイルリスト比較 =====*/\r
541 \r
542                         RemotePos = RemoteListBase;\r
543                         while(RemotePos != NULL)\r
544                         {\r
545                                 if(AskMirrorNoTrn(RemotePos->File, 0) == NO)\r
546                                 {\r
547                                         strcpy(Name, RemotePos->File);\r
548 //                                      ReplaceAll(Name, '/', '\\');\r
549 \r
550                                         if(MirrorFnameCnv == YES)\r
551                                                 Mode = COMP_LOWERMATCH;\r
552                                         else\r
553                                                 Mode = COMP_STRICT;\r
554 \r
555                                         if((LocalPos = SearchFileList(Name, LocalListBase, Mode)) != NULL)\r
556                                         {\r
557                                                 if((RemotePos->Node == NODE_DIR) && (LocalPos->Node == NODE_DIR))\r
558                                                 {\r
559                                                         LocalPos->Attr = NO;\r
560                                                         RemotePos->Attr = NO;\r
561                                                 }\r
562                                                 else if((RemotePos->Node == NODE_FILE) && (LocalPos->Node == NODE_FILE))\r
563                                                 {\r
564                                                         LocalPos->Attr = NO;\r
565                                                         if(CompareFileTime(&RemotePos->Time, &LocalPos->Time) <= 0)\r
566                                                                 RemotePos->Attr = NO;\r
567                                                 }\r
568                                         }\r
569                                         RemotePos = RemotePos->Next;\r
570                                 }\r
571                                 else\r
572                                 {\r
573                                         if(RemotePos->Node == NODE_FILE)\r
574                                         {\r
575                                                 RemotePos->Attr = NO;\r
576                                                 RemotePos = RemotePos->Next;\r
577                                         }\r
578                                         else\r
579                                         {\r
580                                                 RemotePos->Attr = NO;\r
581                                                 Level = AskDirLevel(RemotePos->File);\r
582                                                 RemotePos = RemotePos->Next;\r
583                                                 while(RemotePos != NULL)\r
584                                                 {\r
585                                                         if((RemotePos->Node == NODE_DIR) &&\r
586                                                            (AskDirLevel(RemotePos->File) <= Level))\r
587                                                         {\r
588                                                                 break;\r
589                                                         }\r
590                                                         RemotePos->Attr = NO;\r
591                                                         RemotePos = RemotePos->Next;\r
592                                                 }\r
593                                         }\r
594                                 }\r
595                         }\r
596 \r
597                         DispMirrorFiles(LocalListBase, RemoteListBase);\r
598 \r
599                         /*===== 削除/アップロード =====*/\r
600 \r
601                         LocalPos = LocalListBase;\r
602                         while(LocalPos != NULL)\r
603                         {\r
604                                 if((LocalPos->Attr == YES) && (LocalPos->Node == NODE_FILE))\r
605                                 {\r
606                                         AskLocalCurDir(Pkt.LocalFile, FMAX_PATH);\r
607                                         SetYenTail(Pkt.LocalFile);\r
608                                         strcat(Pkt.LocalFile, LocalPos->File);\r
609                                         ReplaceAll(Pkt.LocalFile, '/', '\\');\r
610                                         strcpy(Pkt.RemoteFile, "");\r
611                                         strcpy(Pkt.Cmd, "L-DELE ");\r
612                                         AddTmpTransFileList(&Pkt, &Base);\r
613                                 }\r
614                                 LocalPos = LocalPos->Next;\r
615                         }\r
616                         MirrorDeleteAllLocalDir(LocalListBase, &Pkt, &Base);\r
617 \r
618 \r
619                         RemotePos = RemoteListBase;\r
620                         while(RemotePos != NULL)\r
621                         {\r
622                                 if(RemotePos->Attr == YES)\r
623                                 {\r
624                                         AskLocalCurDir(Pkt.LocalFile, FMAX_PATH);\r
625                                         SetYenTail(Pkt.LocalFile);\r
626                                         Cat = strchr(Pkt.LocalFile, NUL);\r
627                                         strcat(Pkt.LocalFile, RemotePos->File);\r
628 \r
629                                         if(MirrorFnameCnv == YES)\r
630                                                 _mbslwr(Cat);\r
631 \r
632                                         RemoveAfterSemicolon(Cat);\r
633                                         ReplaceAll(Pkt.LocalFile, '/', '\\');\r
634 \r
635                                         if(RemotePos->Node == NODE_DIR)\r
636                                         {\r
637                                                 strcpy(Pkt.RemoteFile, "");\r
638                                                 strcpy(Pkt.Cmd, "L-MKD ");\r
639                                                 AddTmpTransFileList(&Pkt, &Base);\r
640                                         }\r
641                                         else if(RemotePos->Node == NODE_FILE)\r
642                                         {\r
643                                                 AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
644                                                 SetSlashTail(Pkt.RemoteFile);\r
645                                                 strcat(Pkt.RemoteFile, RemotePos->File);\r
646                                                 ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
647 \r
648                                                 strcpy(Pkt.Cmd, "RETR ");\r
649                                                 Pkt.Type = AskTransferTypeAssoc(Pkt.RemoteFile, AskTransferType());\r
650                                                 Pkt.Size = RemotePos->Size;\r
651                                                 Pkt.Time = RemotePos->Time;\r
652 //                                              Pkt.Attr = 0;\r
653                                                 Pkt.KanjiCode = AskHostKanjiCode();\r
654                                                 // UTF-8対応\r
655                                                 Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
656                                                 Pkt.KanaCnv = AskHostKanaCnv();\r
657                                                 Pkt.Mode = EXIST_OVW;\r
658                                                 AddTmpTransFileList(&Pkt, &Base);\r
659                                         }\r
660                                 }\r
661                                 RemotePos = RemotePos->Next;\r
662                         }\r
663 \r
664                         if((Notify == YES) ||\r
665                            (DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(mirrordown_notify_dlg), GetMainHwnd(), MirrorDispListCallBack, (LPARAM)&Base) == YES))\r
666                         {\r
667                                 if(AskNoFullPathMode() == YES)\r
668                                 {\r
669                                         strcpy(Pkt.Cmd, "SETCUR");\r
670                                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
671                                         AddTransFileList(&Pkt);\r
672                                 }\r
673                                 AppendTransFileList(Base);\r
674 \r
675                                 if(AskNoFullPathMode() == YES)\r
676                                 {\r
677                                         strcpy(Pkt.Cmd, "BACKCUR");\r
678                                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
679                                         AddTransFileList(&Pkt);\r
680                                 }\r
681 \r
682                                 // 同時接続対応\r
683 //                              strcpy(Pkt.Cmd, "GOQUIT");\r
684 //                              AddTransFileList(&Pkt);\r
685                         }\r
686                         else\r
687                                 EraseTmpTransFileList(&Base);\r
688 \r
689                         DeleteFileList(&LocalListBase);\r
690                         DeleteFileList(&RemoteListBase);\r
691 \r
692                         GoForwardTransWindow();\r
693                 }\r
694 \r
695                 EnableUserOpe();\r
696         }\r
697         return;\r
698 }\r
699 \r
700 \r
701 /*----- ミラーリングのファイル一覧を表示 --------------------------------------\r
702 *\r
703 *       Parameter\r
704 *               FILELIST *Local : ローカル側\r
705 *               FILELIST *Remote : リモート側\r
706 *\r
707 *       Return Value\r
708 *               なし\r
709 *----------------------------------------------------------------------------*/\r
710 \r
711 static void DispMirrorFiles(FILELIST *Local, FILELIST *Remote)\r
712 {\r
713         char Date[80];\r
714         SYSTEMTIME sTime;\r
715         FILETIME fTime;\r
716 \r
717         if(DebugConsole == YES)\r
718         {\r
719                 DoPrintf("---- MIRROR FILE LIST ----");\r
720                 while(Local != NULL)\r
721                 {\r
722                         FileTimeToLocalFileTime(&Local->Time, &fTime);\r
723                         FileTimeToSystemTime(&fTime, &sTime);\r
724                         sprintf(Date, "%04d/%02d/%02d %02d:%02d:%02d.%04d", \r
725                                 sTime.wYear, sTime.wMonth, sTime.wDay, sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliseconds);\r
726                         DoPrintf("LOCAL  : %s %s [%s] %s", Local->Attr==1?"YES":"NO ", Local->Node==NODE_DIR?"DIR ":"FILE", Date, Local->File);\r
727                         Local = Local->Next;\r
728                 }\r
729                 while(Remote != NULL)\r
730                 {\r
731                         FileTimeToLocalFileTime(&Remote->Time, &fTime);\r
732                         FileTimeToSystemTime(&fTime, &sTime);\r
733                         sprintf(Date, "%04d/%02d/%02d %02d:%02d:%02d.%04d", \r
734                                 sTime.wYear, sTime.wMonth, sTime.wDay, sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliseconds);\r
735                         DoPrintf("REMOTE : %s %s [%s] %s", Remote->Attr==1?"YES":"NO ", Remote->Node==NODE_DIR?"DIR ":"FILE", Date, Remote->File);\r
736                         Remote = Remote->Next;\r
737                 }\r
738                 DoPrintf("---- END ----");\r
739         }\r
740         return;\r
741 }\r
742 \r
743 \r
744 /*----- ミラーリング時のローカル側のフォルダ削除 ------------------------------\r
745 *\r
746 *       Parameter\r
747 *               FILELIST *Local : ファイルリスト\r
748 *               TRANSPACKET *Pkt : \r
749 *               TRANSPACKET **Base : \r
750 *\r
751 *       Return Value\r
752 *               なし\r
753 *----------------------------------------------------------------------------*/\r
754 \r
755 static void MirrorDeleteAllLocalDir(FILELIST *Local, TRANSPACKET *Pkt, TRANSPACKET **Base)\r
756 {\r
757         while(Local != NULL)\r
758         {\r
759                 if(Local->Node == NODE_DIR)\r
760                 {\r
761                         MirrorDeleteAllLocalDir(Local->Next, Pkt, Base);\r
762 \r
763                         if(Local->Attr == YES)\r
764                         {\r
765                                 AskLocalCurDir(Pkt->LocalFile, FMAX_PATH);\r
766                                 SetYenTail(Pkt->LocalFile);\r
767                                 strcat(Pkt->LocalFile, Local->File);\r
768                                 ReplaceAll(Pkt->LocalFile, '/', '\\');\r
769                                 strcpy(Pkt->RemoteFile, "");\r
770                                 strcpy(Pkt->Cmd, "L-RMD ");\r
771                                 AddTmpTransFileList(Pkt, Base);\r
772                         }\r
773                         break;\r
774                 }\r
775                 Local = Local->Next;\r
776         }\r
777         return;\r
778 }\r
779 \r
780 \r
781 /*----- ファイル名のセミコロン以降を取り除く ----------------------------------\r
782 *\r
783 *       Parameter\r
784 *               char *Path : ファイル名\r
785 *\r
786 *       Return Value\r
787 *               なし\r
788 *\r
789 *       Note\r
790 *               Pathの内容が書き換えられる\r
791 *               オプション設定によって処理を切替える\r
792 *----------------------------------------------------------------------------*/\r
793 \r
794 static void RemoveAfterSemicolon(char *Path)\r
795 {\r
796         char *Pos;\r
797 \r
798         if(VaxSemicolon == YES)\r
799         {\r
800                 if((Pos = strchr(Path, ';')) != NULL)\r
801                         *Pos = NUL;\r
802         }\r
803         return;\r
804 }\r
805 \r
806 \r
807 /*----- ローカルに同じ名前のファイルがないかチェック --------------------------\r
808 *\r
809 *       Parameter\r
810 *               TRANSPACKET *Pkt : 転送ファイル情報\r
811 *\r
812 *       Return Value\r
813 *               int 処理方法\r
814 *                       EXIST_OVW/EXIST_RESUME/EXIST_IGNORE\r
815 *\r
816 *       Note\r
817 *               Pkt.ExistSize, ExistMode、ExistNotify が変更される\r
818 *----------------------------------------------------------------------------*/\r
819 \r
820 static int CheckLocalFile(TRANSPACKET *Pkt)\r
821 {\r
822         HANDLE fHnd;\r
823         WIN32_FIND_DATA Find;\r
824         int Ret;\r
825 \r
826         Ret = EXIST_OVW;\r
827         Pkt->ExistSize = 0;\r
828         if(RecvMode != TRANS_OVW)\r
829         {\r
830                 if((fHnd = FindFirstFile(Pkt->LocalFile, &Find)) != INVALID_HANDLE_VALUE)\r
831                 {\r
832                         FindClose(fHnd);\r
833 \r
834                         Pkt->ExistSize = MakeLongLong(Find.nFileSizeHigh, Find.nFileSizeLow);\r
835 \r
836                         if(ExistNotify == YES)\r
837                         {\r
838                                 SoundPlay(SND_ERROR);\r
839                                 if(DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(down_exist_dlg), GetMainHwnd(), DownExistDialogCallBack, (LPARAM)Pkt) == NO)\r
840                                         Ret = EXIST_ABORT;\r
841                                 else\r
842                                         Ret = ExistMode;\r
843                         }\r
844                         else\r
845                                 Ret = ExistMode;\r
846 \r
847                         if(Ret == EXIST_NEW)\r
848                         {\r
849                                 /*ファイル日付チェック */\r
850                                 if(CompareFileTime(&Find.ftLastWriteTime, &Pkt->Time) < 0)\r
851                                         Ret = EXIST_OVW;\r
852                                 else\r
853                                         Ret = EXIST_IGNORE;\r
854                         }\r
855                 }\r
856         }\r
857         return(Ret);\r
858 }\r
859 \r
860 \r
861 /*----- ローカルに同じ名前のファイルがある時の確認ダイアログのコールバック ----\r
862 *\r
863 *       Parameter\r
864 *               HWND hDlg : ウインドウハンドル\r
865 *               UINT message : メッセージ番号\r
866 *               WPARAM wParam : メッセージの WPARAM 引数\r
867 *               LPARAM lParam : メッセージの LPARAM 引数\r
868 *\r
869 *       Return Value\r
870 *               BOOL TRUE/FALSE\r
871 *----------------------------------------------------------------------------*/\r
872 \r
873 // 64ビット対応\r
874 //static BOOL CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
875 static INT_PTR CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
876 {\r
877         static TRANSPACKET *Pkt;\r
878         static const RADIOBUTTON DownExistButton[] = {\r
879                 { DOWN_EXIST_OVW, EXIST_OVW },\r
880                 { DOWN_EXIST_NEW, EXIST_NEW },\r
881                 { DOWN_EXIST_RESUME, EXIST_RESUME },\r
882                 { DOWN_EXIST_IGNORE, EXIST_IGNORE }\r
883         };\r
884         #define DOWNEXISTBUTTONS        (sizeof(DownExistButton)/sizeof(RADIOBUTTON))\r
885 \r
886         switch (iMessage)\r
887         {\r
888                 case WM_INITDIALOG :\r
889                         Pkt = (TRANSPACKET *)lParam;\r
890                         SendDlgItemMessage(hDlg, DOWN_EXIST_NAME, EM_LIMITTEXT, FMAX_PATH, 0);\r
891                         SendDlgItemMessage(hDlg, DOWN_EXIST_NAME, WM_SETTEXT, 0, (LPARAM)Pkt->LocalFile);\r
892 \r
893                         if((Pkt->Type == TYPE_A) || (Pkt->ExistSize <= 0))\r
894                                 EnableWindow(GetDlgItem(hDlg, DOWN_EXIST_RESUME), FALSE);\r
895 \r
896                         SetRadioButtonByValue(hDlg, ExistMode, DownExistButton, DOWNEXISTBUTTONS);\r
897                         return(TRUE);\r
898 \r
899                 case WM_COMMAND :\r
900                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
901                         {\r
902                                 case IDOK_ALL :\r
903                                         ExistNotify = NO;\r
904                                         /* ここに break はない */\r
905 \r
906                                 case IDOK :\r
907                                         ExistMode = AskRadioButtonValue(hDlg, DownExistButton, DOWNEXISTBUTTONS);\r
908                                         SendDlgItemMessage(hDlg, DOWN_EXIST_NAME, WM_GETTEXT, FMAX_PATH, (LPARAM)Pkt->LocalFile);\r
909                                         EndDialog(hDlg, YES);\r
910                                         break;\r
911 \r
912                                 case IDCANCEL :\r
913 //                                      ExistMode = EXIST_ABORT;\r
914                                         EndDialog(hDlg, NO);\r
915                                         break;\r
916 \r
917                                 case IDHELP :\r
918                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000009);\r
919                                         break;\r
920                         }\r
921             return(TRUE);\r
922         }\r
923         return(FALSE);\r
924 }\r
925 \r
926 \r
927 \r
928 \r
929 \r
930 \r
931 /*----- ファイル一覧で指定されたファイルをアップロードする --------------------\r
932 *\r
933 *       Parameter\r
934 *               int ChName : 名前を変えるかどうか (YES/NO)\r
935 *               int All : 全てが選ばれている物として扱うかどうか (YES/NO)\r
936 *\r
937 *       Return Value\r
938 *               なし\r
939 *----------------------------------------------------------------------------*/\r
940 \r
941 // ディレクトリ自動作成\r
942 // リモート側のパスから必要なディレクトリを作成\r
943 int MakeDirFromRemotePath(char* RemoteFile, int FirstAdd)\r
944 {\r
945         TRANSPACKET Pkt;\r
946         TRANSPACKET Pkt1;\r
947         char* pDelimiter;\r
948         char* pNext;\r
949         char* Cat;\r
950         int Len;\r
951         char Tmp[FMAX_PATH+1];\r
952         int Make;\r
953         pDelimiter = RemoteFile;\r
954         Make = NO;\r
955         while(pNext = strchr(pDelimiter, '/'))\r
956         {\r
957                 Len = pNext - RemoteFile;\r
958                 strncpy(Pkt.RemoteFile, RemoteFile, Len);\r
959                 Pkt.RemoteFile[Len] = '\0';\r
960                 AskRemoteCurDir(Tmp, FMAX_PATH);\r
961                 SetSlashTail(Tmp);\r
962                 if(strncmp(RemoteFile, Tmp, Len + 1) != 0)\r
963                 {\r
964                         Cat = Pkt.RemoteFile + (pDelimiter - RemoteFile);\r
965                         if(FnameCnv == FNAME_LOWER)\r
966                                 _mbslwr(Cat);\r
967                         else if(FnameCnv == FNAME_UPPER)\r
968                                 _mbsupr(Cat);\r
969 #if defined(HAVE_TANDEM)\r
970                         Pkt.FileCode = 0;\r
971                         Pkt.PriExt = DEF_PRIEXT;\r
972                         Pkt.SecExt = DEF_SECEXT;\r
973                         Pkt.MaxExt = DEF_MAXEXT;\r
974 #endif\r
975                         ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
976 \r
977                         if(AskHostType() == HTYPE_ACOS)\r
978                         {\r
979                                 strcpy(Pkt.RemoteFile, "'");\r
980                                 strcat(Pkt.RemoteFile, AskHostLsName());\r
981                                 strcat(Pkt.RemoteFile, "(");\r
982                                 strcat(Pkt.RemoteFile, Cat);\r
983                                 strcat(Pkt.RemoteFile, ")");\r
984                                 strcat(Pkt.RemoteFile, "'");\r
985                         }\r
986                         else if(AskHostType() == HTYPE_ACOS_4)\r
987                                 strcpy(Pkt.RemoteFile, Cat);\r
988 \r
989                         if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
990                         {\r
991                                 strcpy(Pkt1.Cmd, "SETCUR");\r
992                                 AskRemoteCurDir(Pkt1.RemoteFile, FMAX_PATH);\r
993                                 AddTransFileList(&Pkt1);\r
994                         }\r
995                         FirstAdd = NO;\r
996                         strcpy(Pkt.Cmd, "MKD ");\r
997                         strcpy(Pkt.LocalFile, "");\r
998                         AddTransFileList(&Pkt);\r
999 \r
1000                         Make = YES;\r
1001                 }\r
1002                 pDelimiter = pNext + 1;\r
1003         }\r
1004         return Make;\r
1005 }\r
1006 \r
1007 void UpLoadListProc(int ChName, int All)\r
1008 {\r
1009         FILELIST *FileListBase;\r
1010         FILELIST *Pos;\r
1011         TRANSPACKET Pkt;\r
1012         TRANSPACKET Pkt1;\r
1013         char *Cat;\r
1014         FILELIST *RemoteList;\r
1015         char Tmp[FMAX_PATH+1];\r
1016         int FirstAdd;\r
1017 \r
1018         // 同時接続対応\r
1019         CancelFlg = NO;\r
1020 \r
1021         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
1022         {\r
1023                 DisableUserOpe();\r
1024 \r
1025                 // ローカル側で選ばれているファイルをFileListBaseに登録\r
1026                 FileListBase = NULL;\r
1027                 MakeSelectedFileList(WIN_LOCAL, YES, All, &FileListBase, &CancelFlg);\r
1028 \r
1029                 // 現在ホスト側のファイル一覧に表示されているものをRemoteListに登録\r
1030                 // 同名ファイルチェック用\r
1031                 RemoteList = NULL;\r
1032                 AddRemoteTreeToFileList(AskCurrentFileListNum(), "", RDIR_NONE, &RemoteList);\r
1033 \r
1034                 FirstAdd = YES;\r
1035                 ExistNotify = YES;\r
1036 \r
1037                 Pos = FileListBase;\r
1038                 while(Pos != NULL)\r
1039                 {\r
1040                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
1041                         SetSlashTail(Pkt.RemoteFile);\r
1042                         Cat = strchr(Pkt.RemoteFile, NUL);\r
1043                         if((ChName == NO) || (Pos->Node == NODE_DIR))\r
1044                         {\r
1045                                 strcat(Pkt.RemoteFile, Pos->File);\r
1046                                 if(FnameCnv == FNAME_LOWER)\r
1047                                         _mbslwr(Cat);\r
1048                                 else if(FnameCnv == FNAME_UPPER)\r
1049                                         _mbsupr(Cat);\r
1050 #if defined(HAVE_TANDEM)\r
1051                                 Pkt.FileCode = 0;\r
1052                                 Pkt.PriExt = DEF_PRIEXT;\r
1053                                 Pkt.SecExt = DEF_SECEXT;\r
1054                                 Pkt.MaxExt = DEF_MAXEXT;\r
1055 #endif\r
1056                         }\r
1057                         else\r
1058                         {\r
1059                                 // 名前を変更する\r
1060                                 strcpy(TmpString, Pos->File);\r
1061                                 CurWin = WIN_LOCAL;\r
1062 #if defined(HAVE_TANDEM)\r
1063                                 strcpy(TmpFileCode, "0"); /* ASCII モードの場合は無視される */\r
1064                                 if(AskHostType() == HTYPE_TANDEM && AskOSS() == NO) {\r
1065                                         if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(updown_as_with_ext_dlg), GetMainHwnd(), UpDownAsWithExtDialogCallBack) == YES) {\r
1066                                                 strcat(Pkt.RemoteFile, TmpString);\r
1067                                                 Pkt.FileCode = atoi(TmpFileCode);\r
1068                                         } else {\r
1069                                                 break;\r
1070                                         }\r
1071                                 } else\r
1072 #endif\r
1073                                 if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(updown_as_dlg), GetMainHwnd(), UpDownAsDialogCallBack) == YES)\r
1074                                         strcat(Pkt.RemoteFile, TmpString);\r
1075                                 else\r
1076                                         break;\r
1077                         }\r
1078                         // バグ修正\r
1079                         AskRemoteCurDir(Tmp, FMAX_PATH);\r
1080                         SetSlashTail(Tmp);\r
1081                         if(strncmp(Pkt.RemoteFile, Tmp, strlen(Tmp)) != 0)\r
1082                         {\r
1083                                 if((Cat = strrchr(Pkt.RemoteFile, '/')) != NULL)\r
1084                                         Cat++;\r
1085                                 else\r
1086                                         Cat = Pkt.RemoteFile;\r
1087                         }\r
1088                         ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
1089 \r
1090                         if(AskHostType() == HTYPE_ACOS)\r
1091                         {\r
1092                                 strcpy(Pkt.RemoteFile, "'");\r
1093                                 strcat(Pkt.RemoteFile, AskHostLsName());\r
1094                                 strcat(Pkt.RemoteFile, "(");\r
1095                                 strcat(Pkt.RemoteFile, Cat);\r
1096                                 strcat(Pkt.RemoteFile, ")");\r
1097                                 strcat(Pkt.RemoteFile, "'");\r
1098                         }\r
1099                         else if(AskHostType() == HTYPE_ACOS_4)\r
1100                                 strcpy(Pkt.RemoteFile, Cat);\r
1101 \r
1102                         if(Pos->Node == NODE_DIR)\r
1103                         {\r
1104                                 // フォルダの場合\r
1105 \r
1106                                 // ホスト側のファイル一覧をRemoteListに登録\r
1107                                 // 同名ファイルチェック用\r
1108                                 if(RemoteList != NULL)\r
1109                                         DeleteFileList(&RemoteList);\r
1110                                 RemoteList = NULL;\r
1111 \r
1112                                 AskRemoteCurDir(Tmp, FMAX_PATH);\r
1113                                 if(DoCWD(Pkt.RemoteFile, NO, NO, NO) == FTP_COMPLETE)\r
1114                                 {\r
1115                                         if(DoDirListCmdSkt("", "", 998, &CancelFlg) == FTP_COMPLETE)\r
1116                                                 AddRemoteTreeToFileList(998, "", RDIR_NONE, &RemoteList);\r
1117                                         DoCWD(Tmp, NO, NO, NO);\r
1118                                 }\r
1119                                 else\r
1120                                 {\r
1121                                         // フォルダを作成\r
1122                                         if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
1123                                         {\r
1124                                                 strcpy(Pkt1.Cmd, "SETCUR");\r
1125                                                 AskRemoteCurDir(Pkt1.RemoteFile, FMAX_PATH);\r
1126                                                 AddTransFileList(&Pkt1);\r
1127                                         }\r
1128                                         FirstAdd = NO;\r
1129                                         strcpy(Pkt.Cmd, "MKD ");\r
1130                                         strcpy(Pkt.LocalFile, "");\r
1131                                         AddTransFileList(&Pkt);\r
1132                                 }\r
1133                         }\r
1134                         else if(Pos->Node == NODE_FILE)\r
1135                         {\r
1136                                 // ファイルの場合\r
1137                                 AskLocalCurDir(Pkt.LocalFile, FMAX_PATH);\r
1138                                 SetYenTail(Pkt.LocalFile);\r
1139                                 strcat(Pkt.LocalFile, Pos->File);\r
1140                                 ReplaceAll(Pkt.LocalFile, '/', '\\');\r
1141 \r
1142                                 strcpy(Pkt.Cmd, "STOR ");\r
1143                                 Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
1144                                 Pkt.Size = 0;\r
1145                                 Pkt.Time = Pos->Time;\r
1146                                 Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
1147                                 Pkt.KanjiCode = AskHostKanjiCode();\r
1148                                 // UTF-8対応\r
1149                                 Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
1150                                 Pkt.KanaCnv = AskHostKanaCnv();\r
1151 #if defined(HAVE_TANDEM)\r
1152                                 if(AskHostType() == HTYPE_TANDEM && AskOSS() == NO) {\r
1153                                         CalcExtentSize(&Pkt, Pos->Size);\r
1154                                 }\r
1155 #endif\r
1156                                 Pkt.Mode = CheckRemoteFile(&Pkt, RemoteList);\r
1157                                 if(Pkt.Mode == EXIST_ABORT)\r
1158                                         break;\r
1159                                 else if(Pkt.Mode != EXIST_IGNORE)\r
1160                                 {\r
1161                                         // ディレクトリ自動作成\r
1162                                         if(MakeAllDir == YES)\r
1163                                         {\r
1164                                                 if(MakeDirFromRemotePath(Pkt.RemoteFile, FirstAdd) == YES)\r
1165                                                         FirstAdd = NO;\r
1166                                         }\r
1167                                         if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
1168                                         {\r
1169                                                 strcpy(Pkt1.Cmd, "SETCUR");\r
1170                                                 AskRemoteCurDir(Pkt1.RemoteFile, FMAX_PATH);\r
1171                                                 AddTransFileList(&Pkt1);\r
1172                                         }\r
1173                                         FirstAdd = NO;\r
1174                                         AddTransFileList(&Pkt);\r
1175                                 }\r
1176                         }\r
1177                         Pos = Pos->Next;\r
1178                 }\r
1179 \r
1180                 if((FirstAdd == NO) && (AskNoFullPathMode() == YES))\r
1181                 {\r
1182                         strcpy(Pkt.Cmd, "BACKCUR");\r
1183                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
1184                         AddTransFileList(&Pkt);\r
1185                 }\r
1186 \r
1187                 if(RemoteList != NULL)\r
1188                         DeleteFileList(&RemoteList);\r
1189 \r
1190                 DeleteFileList(&FileListBase);\r
1191 \r
1192                 // 同時接続対応\r
1193 //              strcpy(Pkt.Cmd, "GOQUIT");\r
1194 //              AddTransFileList(&Pkt);\r
1195 \r
1196                 GoForwardTransWindow();\r
1197 \r
1198                 EnableUserOpe();\r
1199         }\r
1200         return;\r
1201 }\r
1202 \r
1203 \r
1204 /*----- ドラッグ&ドロップで指定されたファイルをアップロードする --------------\r
1205 *\r
1206 *       Parameter\r
1207 *               WPARAM wParam : ドロップされたファイルの情報\r
1208 *\r
1209 *       Return Value\r
1210 *               なし\r
1211 *----------------------------------------------------------------------------*/\r
1212 \r
1213 void UpLoadDragProc(WPARAM wParam)\r
1214 {\r
1215         FILELIST *FileListBase;\r
1216         FILELIST *Pos;\r
1217         TRANSPACKET Pkt;\r
1218         TRANSPACKET Pkt1;\r
1219         char *Cat;\r
1220         FILELIST *RemoteList;\r
1221         char Tmp[FMAX_PATH+1];\r
1222         int FirstAdd;\r
1223         char Cur[FMAX_PATH+1];\r
1224 \r
1225         // 同時接続対応\r
1226         CancelFlg = NO;\r
1227 \r
1228         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
1229         {\r
1230                 DisableUserOpe();\r
1231 \r
1232                 // ローカル側で選ばれているファイルをFileListBaseに登録\r
1233                 FileListBase = NULL;\r
1234                 MakeDroppedFileList(wParam, Cur, &FileListBase);\r
1235 \r
1236                 // 現在ホスト側のファイル一覧に表示されているものをRemoteListに登録\r
1237                 // 同名ファイルチェック用\r
1238                 RemoteList = NULL;\r
1239                 AddRemoteTreeToFileList(AskCurrentFileListNum(), "", RDIR_NONE, &RemoteList);\r
1240 \r
1241                 FirstAdd = YES;\r
1242                 ExistNotify = YES;\r
1243 \r
1244                 Pos = FileListBase;\r
1245                 while(Pos != NULL)\r
1246                 {\r
1247                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
1248                         SetSlashTail(Pkt.RemoteFile);\r
1249                         Cat = strchr(Pkt.RemoteFile, NUL);\r
1250 \r
1251                         strcat(Pkt.RemoteFile, Pos->File);\r
1252                         if(FnameCnv == FNAME_LOWER)\r
1253                                 _mbslwr(Cat);\r
1254                         else if(FnameCnv == FNAME_UPPER)\r
1255                                 _mbsupr(Cat);\r
1256                         ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
1257 #if defined(HAVE_TANDEM)\r
1258                         Pkt.FileCode = 0;\r
1259                         Pkt.PriExt = DEF_PRIEXT;\r
1260                         Pkt.SecExt = DEF_SECEXT;\r
1261                         Pkt.MaxExt = DEF_MAXEXT;\r
1262 #endif\r
1263 \r
1264                         if(AskHostType() == HTYPE_ACOS)\r
1265                         {\r
1266                                 strcpy(Pkt.RemoteFile, "'");\r
1267                                 strcat(Pkt.RemoteFile, AskHostLsName());\r
1268                                 strcat(Pkt.RemoteFile, "(");\r
1269                                 strcat(Pkt.RemoteFile, Cat);\r
1270                                 strcat(Pkt.RemoteFile, ")");\r
1271                                 strcat(Pkt.RemoteFile, "'");\r
1272                         }\r
1273                         else if(AskHostType() == HTYPE_ACOS_4)\r
1274                                 strcpy(Pkt.RemoteFile, Cat);\r
1275 \r
1276                         if(Pos->Node == NODE_DIR)\r
1277                         {\r
1278                                 // フォルダの場合\r
1279 \r
1280                                 // ホスト側のファイル一覧をRemoteListに登録\r
1281                                 // 同名ファイルチェック用\r
1282                                 if(RemoteList != NULL)\r
1283                                         DeleteFileList(&RemoteList);\r
1284                                 RemoteList = NULL;\r
1285 \r
1286                                 AskRemoteCurDir(Tmp, FMAX_PATH);\r
1287                                 if(DoCWD(Pkt.RemoteFile, NO, NO, NO) == FTP_COMPLETE)\r
1288                                 {\r
1289                                         if(DoDirListCmdSkt("", "", 998, &CancelFlg) == FTP_COMPLETE)\r
1290                                                 AddRemoteTreeToFileList(998, "", RDIR_NONE, &RemoteList);\r
1291                                         DoCWD(Tmp, NO, NO, NO);\r
1292                                 }\r
1293                                 else\r
1294                                 {\r
1295                                         if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
1296                                         {\r
1297                                                 strcpy(Pkt1.Cmd, "SETCUR");\r
1298                                                 AskRemoteCurDir(Pkt1.RemoteFile, FMAX_PATH);\r
1299                                                 AddTransFileList(&Pkt1);\r
1300                                         }\r
1301                                         FirstAdd = NO;\r
1302                                         strcpy(Pkt.Cmd, "MKD ");\r
1303                                         strcpy(Pkt.LocalFile, "");\r
1304                                         AddTransFileList(&Pkt);\r
1305                                 }\r
1306                         }\r
1307                         else if(Pos->Node == NODE_FILE)\r
1308                         {\r
1309                                 // ファイルの場合\r
1310                                 strcpy(Pkt.LocalFile, Cur);\r
1311                                 SetYenTail(Pkt.LocalFile);\r
1312                                 strcat(Pkt.LocalFile, Pos->File);\r
1313                                 ReplaceAll(Pkt.LocalFile, '/', '\\');\r
1314 \r
1315                                 strcpy(Pkt.Cmd, "STOR ");\r
1316                                 Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
1317                                 Pkt.Size = 0;\r
1318                                 Pkt.Time = Pos->Time;\r
1319                                 Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
1320                                 Pkt.KanjiCode = AskHostKanjiCode();\r
1321                                 // UTF-8対応\r
1322                                 Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
1323                                 Pkt.KanaCnv = AskHostKanaCnv();\r
1324 #if defined(HAVE_TANDEM)\r
1325                                 if(AskHostType() == HTYPE_TANDEM && AskOSS() == NO) {\r
1326                                         int a = Pos->InfoExist && FINFO_SIZE;\r
1327                                         CalcExtentSize(&Pkt, Pos->Size);\r
1328                                 }\r
1329 #endif\r
1330                                 Pkt.Mode = CheckRemoteFile(&Pkt, RemoteList);\r
1331                                 if(Pkt.Mode == EXIST_ABORT)\r
1332                                         break;\r
1333                                 else if(Pkt.Mode != EXIST_IGNORE)\r
1334                                 {\r
1335                                         // ディレクトリ自動作成\r
1336                                         if(MakeAllDir == YES)\r
1337                                         {\r
1338                                                 if(MakeDirFromRemotePath(Pkt.RemoteFile, FirstAdd) == YES)\r
1339                                                         FirstAdd = NO;\r
1340                                         }\r
1341                                         if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
1342                                         {\r
1343                                                 strcpy(Pkt1.Cmd, "SETCUR");\r
1344                                                 AskRemoteCurDir(Pkt1.RemoteFile, FMAX_PATH);\r
1345                                                 AddTransFileList(&Pkt1);\r
1346                                         }\r
1347                                         FirstAdd = NO;\r
1348                                         AddTransFileList(&Pkt);\r
1349                                 }\r
1350                         }\r
1351                         Pos = Pos->Next;\r
1352                 }\r
1353 \r
1354                 if((FirstAdd == NO) && (AskNoFullPathMode() == YES))\r
1355                 {\r
1356                         strcpy(Pkt.Cmd, "BACKCUR");\r
1357                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
1358                         AddTransFileList(&Pkt);\r
1359                 }\r
1360 \r
1361                 if(RemoteList != NULL)\r
1362                         DeleteFileList(&RemoteList);\r
1363 \r
1364                 DeleteFileList(&FileListBase);\r
1365 \r
1366                 // 同時接続対応\r
1367 //              strcpy(Pkt.Cmd, "GOQUIT");\r
1368 //              AddTransFileList(&Pkt);\r
1369 \r
1370                 GoForwardTransWindow();\r
1371 \r
1372                 EnableUserOpe();\r
1373         }\r
1374         return;\r
1375 }\r
1376 \r
1377 \r
1378 /*----- ミラーリングアップロードを行う ----------------------------------------\r
1379 *\r
1380 *       Parameter\r
1381 *               int Notify : 確認を行うかどうか (YES/NO)\r
1382 *\r
1383 *       Return Value\r
1384 *               なし\r
1385 *----------------------------------------------------------------------------*/\r
1386 \r
1387 void MirrorUploadProc(int Notify)\r
1388 {\r
1389         FILELIST *LocalListBase;\r
1390         FILELIST *RemoteListBase;\r
1391         FILELIST *LocalPos;\r
1392         FILELIST *RemotePos;\r
1393         TRANSPACKET Pkt;\r
1394         TRANSPACKET *Base;\r
1395         char Name[FMAX_PATH+1];\r
1396         char *Cat;\r
1397         int Level;\r
1398         int Mode;\r
1399         SYSTEMTIME TmpStime;\r
1400         FILETIME TmpFtimeL;\r
1401         FILETIME TmpFtimeR;\r
1402 \r
1403         // 同時接続対応\r
1404         CancelFlg = NO;\r
1405 \r
1406         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
1407         {\r
1408                 DisableUserOpe();\r
1409 \r
1410                 Base = NULL;\r
1411 \r
1412                 if(Notify == YES)\r
1413                         Notify = DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(mirror_up_dlg), GetMainHwnd(), MirrorNotifyCallBack, 1);\r
1414                 else\r
1415                         Notify = YES;\r
1416 \r
1417                 if((Notify == YES) || (Notify == YES_LIST))\r
1418                 {\r
1419                         /*===== ファイルリスト取得 =====*/\r
1420 \r
1421                         LocalListBase = NULL;\r
1422                         MakeSelectedFileList(WIN_LOCAL, YES, YES, &LocalListBase, &CancelFlg);\r
1423                         RemoteListBase = NULL;\r
1424                         MakeSelectedFileList(WIN_REMOTE, YES, YES, &RemoteListBase, &CancelFlg);\r
1425 \r
1426                         LocalPos = LocalListBase;\r
1427                         while(LocalPos != NULL)\r
1428                         {\r
1429                                 LocalPos->Attr = YES;           /* LocalPos->Attrは転送するかどうかのフラグに使用 (YES/NO) */\r
1430                                 LocalPos = LocalPos->Next;\r
1431                         }\r
1432 \r
1433                         RemotePos = RemoteListBase;\r
1434                         while(RemotePos != NULL)\r
1435                         {\r
1436                                 if(AskMirrorNoTrn(RemotePos->File, 1) == NO)\r
1437                                 {\r
1438                                         RemotePos->Attr = YES;\r
1439                                         RemotePos = RemotePos->Next;\r
1440                                 }\r
1441                                 else\r
1442                                 {\r
1443                                         RemotePos->Attr = NO;   /* RemotePos->Attrは削除するかどうかのフラグに使用 (YES/NO) */\r
1444 \r
1445                                         if(RemotePos->Node == NODE_DIR)\r
1446                                         {\r
1447                                                 Level = AskDirLevel(RemotePos->File);\r
1448                                                 RemotePos = RemotePos->Next;\r
1449                                                 while(RemotePos != NULL)\r
1450                                                 {\r
1451                                                         if((RemotePos->Node == NODE_DIR) &&\r
1452                                                            (AskDirLevel(RemotePos->File) <= Level))\r
1453                                                         {\r
1454                                                                 break;\r
1455                                                         }\r
1456                                                         RemotePos->Attr = NO;\r
1457                                                         RemotePos = RemotePos->Next;\r
1458                                                 }\r
1459                                         }\r
1460                                         else\r
1461                                                 RemotePos = RemotePos->Next;\r
1462                                 }\r
1463                         }\r
1464 \r
1465                         /*===== ファイルリスト比較 =====*/\r
1466 \r
1467                         LocalPos = LocalListBase;\r
1468                         while(LocalPos != NULL)\r
1469                         {\r
1470                                 if(AskMirrorNoTrn(LocalPos->File, 0) == NO)\r
1471                                 {\r
1472                                         strcpy(Name, LocalPos->File);\r
1473                                         ReplaceAll(Name, '\\', '/');\r
1474 \r
1475                                         if(MirrorFnameCnv == YES)\r
1476                                                 Mode = COMP_LOWERMATCH;\r
1477                                         else\r
1478                                                 Mode = COMP_STRICT;\r
1479 \r
1480                                         if(LocalPos->Node == NODE_DIR)\r
1481                                         {\r
1482                                                 if((RemotePos = SearchFileList(Name, RemoteListBase, Mode)) != NULL)\r
1483                                                 {\r
1484                                                         if(RemotePos->Node == NODE_DIR)\r
1485                                                         {\r
1486                                                                 RemotePos->Attr = NO;\r
1487                                                                 LocalPos->Attr = NO;\r
1488                                                         }\r
1489                                                 }\r
1490                                         }\r
1491                                         else if(LocalPos->Node == NODE_FILE)\r
1492                                         {\r
1493                                                 if((RemotePos = SearchFileList(Name, RemoteListBase, Mode)) != NULL)\r
1494                                                 {\r
1495                                                         if(RemotePos->Node == NODE_FILE)\r
1496                                                         {\r
1497                                                                 FileTimeToLocalFileTime(&LocalPos->Time, &TmpFtimeL);\r
1498                                                                 FileTimeToLocalFileTime(&RemotePos->Time, &TmpFtimeR);\r
1499                                                                 if((RemotePos->InfoExist & FINFO_TIME) == 0)\r
1500                                                                 {\r
1501                                                                         FileTimeToSystemTime(&TmpFtimeL, &TmpStime);\r
1502                                                                         TmpStime.wHour = 0;\r
1503                                                                         TmpStime.wMinute = 0;\r
1504                                                                         TmpStime.wSecond = 0;\r
1505                                                                         TmpStime.wMilliseconds = 0;\r
1506                                                                         SystemTimeToFileTime(&TmpStime, &TmpFtimeL);\r
1507 \r
1508                                                                         FileTimeToSystemTime(&TmpFtimeR, &TmpStime);\r
1509                                                                         TmpStime.wHour = 0;\r
1510                                                                         TmpStime.wMinute = 0;\r
1511                                                                         TmpStime.wSecond = 0;\r
1512                                                                         TmpStime.wMilliseconds = 0;\r
1513                                                                         SystemTimeToFileTime(&TmpStime, &TmpFtimeR);\r
1514                                                                 }\r
1515                                                                 RemotePos->Attr = NO;\r
1516                                                                 if(CompareFileTime(&TmpFtimeL, &TmpFtimeR) <= 0)\r
1517                                                                         LocalPos->Attr = NO;\r
1518                                                         }\r
1519                                                 }\r
1520                                         }\r
1521 \r
1522                                         LocalPos = LocalPos->Next;\r
1523                                 }\r
1524                                 else\r
1525                                 {\r
1526                                         if(LocalPos->Node == NODE_FILE)\r
1527                                         {\r
1528                                                 LocalPos->Attr = NO;\r
1529                                                 LocalPos = LocalPos->Next;\r
1530                                         }\r
1531                                         else\r
1532                                         {\r
1533                                                 LocalPos->Attr = NO;\r
1534                                                 Level = AskDirLevel(LocalPos->File);\r
1535                                                 LocalPos = LocalPos->Next;\r
1536                                                 while(LocalPos != NULL)\r
1537                                                 {\r
1538                                                         if((LocalPos->Node == NODE_DIR) &&\r
1539                                                            (AskDirLevel(LocalPos->File) <= Level))\r
1540                                                         {\r
1541                                                                 break;\r
1542                                                         }\r
1543                                                         LocalPos->Attr = NO;\r
1544                                                         LocalPos = LocalPos->Next;\r
1545                                                 }\r
1546                                         }\r
1547                                 }\r
1548                         }\r
1549 \r
1550                         DispMirrorFiles(LocalListBase, RemoteListBase);\r
1551 \r
1552                         /*===== 削除/アップロード =====*/\r
1553 \r
1554                         RemotePos = RemoteListBase;\r
1555                         while(RemotePos != NULL)\r
1556                         {\r
1557                                 if((RemotePos->Attr == YES) && (RemotePos->Node == NODE_FILE))\r
1558                                 {\r
1559                                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
1560                                         SetSlashTail(Pkt.RemoteFile);\r
1561                                         strcat(Pkt.RemoteFile, RemotePos->File);\r
1562                                         ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
1563                                         strcpy(Pkt.LocalFile, "");\r
1564                                         strcpy(Pkt.Cmd, "R-DELE ");\r
1565                                         AddTmpTransFileList(&Pkt, &Base);\r
1566                                 }\r
1567                                 RemotePos = RemotePos->Next;\r
1568                         }\r
1569                         MirrorDeleteAllDir(RemoteListBase, &Pkt, &Base);\r
1570 \r
1571                         LocalPos = LocalListBase;\r
1572                         while(LocalPos != NULL)\r
1573                         {\r
1574                                 if(LocalPos->Attr == YES)\r
1575                                 {\r
1576                                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
1577                                         SetSlashTail(Pkt.RemoteFile);\r
1578                                         Cat = strchr(Pkt.RemoteFile, NUL);\r
1579                                         strcat(Pkt.RemoteFile, LocalPos->File);\r
1580 \r
1581                                         if(MirrorFnameCnv == YES)\r
1582                                                 _mbslwr(Cat);\r
1583 \r
1584                                         ReplaceAll(Pkt.RemoteFile, '\\', '/');\r
1585 \r
1586                                         if(LocalPos->Node == NODE_DIR)\r
1587                                         {\r
1588                                                 strcpy(Pkt.LocalFile, "");\r
1589                                                 strcpy(Pkt.Cmd, "R-MKD ");\r
1590                                                 AddTmpTransFileList(&Pkt, &Base);\r
1591                                         }\r
1592                                         else if(LocalPos->Node == NODE_FILE)\r
1593                                         {\r
1594                                                 AskLocalCurDir(Pkt.LocalFile, FMAX_PATH);\r
1595                                                 SetYenTail(Pkt.LocalFile);\r
1596                                                 strcat(Pkt.LocalFile, LocalPos->File);\r
1597                                                 ReplaceAll(Pkt.LocalFile, '/', '\\');\r
1598 \r
1599                                                 strcpy(Pkt.Cmd, "STOR ");\r
1600                                                 Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
1601                                                 Pkt.Size = 0;\r
1602                                                 Pkt.Time = LocalPos->Time;\r
1603                                                 Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
1604                                                 Pkt.KanjiCode = AskHostKanjiCode();\r
1605                                                 // UTF-8対応\r
1606                                                 Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
1607                                                 Pkt.KanaCnv = AskHostKanaCnv();\r
1608 #if defined(HAVE_TANDEM)\r
1609                                                 if(AskHostType() == HTYPE_TANDEM && AskOSS() == NO) {\r
1610                                                         CalcExtentSize(&Pkt, LocalPos->Size);\r
1611                                                 }\r
1612 #endif\r
1613                                                 Pkt.Mode = EXIST_OVW;\r
1614                                                 AddTmpTransFileList(&Pkt, &Base);\r
1615                                         }\r
1616                                 }\r
1617                                 LocalPos = LocalPos->Next;\r
1618                         }\r
1619 \r
1620                         if((Notify == YES) ||\r
1621                            (DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(mirror_notify_dlg), GetMainHwnd(), MirrorDispListCallBack, (LPARAM)&Base) == YES))\r
1622                         {\r
1623                                 if(AskNoFullPathMode() == YES)\r
1624                                 {\r
1625                                         strcpy(Pkt.Cmd, "SETCUR");\r
1626                                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
1627                                         AddTransFileList(&Pkt);\r
1628                                 }\r
1629                                 AppendTransFileList(Base);\r
1630 \r
1631                                 if(AskNoFullPathMode() == YES)\r
1632                                 {\r
1633                                         strcpy(Pkt.Cmd, "BACKCUR");\r
1634                                         AskRemoteCurDir(Pkt.RemoteFile, FMAX_PATH);\r
1635                                         AddTransFileList(&Pkt);\r
1636                                 }\r
1637 \r
1638                                 // 同時接続対応\r
1639 //                              strcpy(Pkt.Cmd, "GOQUIT");\r
1640 //                              AddTransFileList(&Pkt);\r
1641                         }\r
1642                         else\r
1643                                 EraseTmpTransFileList(&Base);\r
1644 \r
1645                         DeleteFileList(&LocalListBase);\r
1646                         DeleteFileList(&RemoteListBase);\r
1647 \r
1648                         GoForwardTransWindow();\r
1649                 }\r
1650 \r
1651                 EnableUserOpe();\r
1652         }\r
1653         return;\r
1654 }\r
1655 \r
1656 \r
1657 /*----- ミラーリング時のホスト側のフォルダ削除 --------------------------------\r
1658 *\r
1659 *       Parameter\r
1660 *               FILELIST *Base : ファイルリスト\r
1661 *               TRANSPACKET *Pkt : \r
1662 *               TRANSPACKET **Base : \r
1663 *\r
1664 *       Return Value\r
1665 *               なし\r
1666 *----------------------------------------------------------------------------*/\r
1667 \r
1668 static void MirrorDeleteAllDir(FILELIST *Remote, TRANSPACKET *Pkt, TRANSPACKET **Base)\r
1669 {\r
1670         while(Remote != NULL)\r
1671         {\r
1672                 if(Remote->Node == NODE_DIR)\r
1673                 {\r
1674                         MirrorDeleteAllDir(Remote->Next, Pkt, Base);\r
1675 \r
1676                         if(Remote->Attr == YES)\r
1677                         {\r
1678                                 AskRemoteCurDir(Pkt->RemoteFile, FMAX_PATH);\r
1679                                 SetSlashTail(Pkt->RemoteFile);\r
1680                                 strcat(Pkt->RemoteFile, Remote->File);\r
1681                                 ReplaceAll(Pkt->RemoteFile, '\\', '/');\r
1682                                 strcpy(Pkt->LocalFile, "");\r
1683                                 strcpy(Pkt->Cmd, "R-RMD ");\r
1684                                 AddTmpTransFileList(Pkt, Base);\r
1685                         }\r
1686                         break;\r
1687                 }\r
1688                 Remote = Remote->Next;\r
1689         }\r
1690         return;\r
1691 }\r
1692 \r
1693 \r
1694 /*----- ミラーリングアップロード開始確認ウインドウのコールバック --------------\r
1695 *\r
1696 *       Parameter\r
1697 *               HWND hDlg : ウインドウハンドル\r
1698 *               UINT message : メッセージ番号\r
1699 *               WPARAM wParam : メッセージの WPARAM 引数\r
1700 *               LPARAM lParam : メッセージの LPARAM 引数\r
1701 *\r
1702 *       Return Value\r
1703 *               BOOL TRUE/FALSE\r
1704 *----------------------------------------------------------------------------*/\r
1705 \r
1706 // 64ビット対応\r
1707 //static BOOL CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1708 static INT_PTR CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1709 {\r
1710         static int Mode;\r
1711 \r
1712         switch (iMessage)\r
1713         {\r
1714                 case WM_INITDIALOG :\r
1715                         Mode = lParam;\r
1716                         return(TRUE);\r
1717 \r
1718                 case WM_COMMAND :\r
1719                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
1720                         {\r
1721                                 case IDOK :\r
1722                                         EndDialog(hDlg, YES);\r
1723                                         break;\r
1724 \r
1725                                 case IDCANCEL :\r
1726                                         EndDialog(hDlg, NO);\r
1727                                         break;\r
1728 \r
1729                                 case MIRRORUP_DISP :\r
1730                                         EndDialog(hDlg, YES_LIST);\r
1731                                         break;\r
1732 \r
1733                                 case IDHELP :\r
1734                                         if(Mode == 0)\r
1735                                                 hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000013);\r
1736                                         else\r
1737                                                 hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000012);\r
1738                         }\r
1739             return(TRUE);\r
1740         }\r
1741         return(FALSE);\r
1742 }\r
1743 \r
1744 \r
1745 /*----- ミラーリングアップロード処理内容確認ウインドウのコールバック ----------\r
1746 *\r
1747 *       Parameter\r
1748 *               HWND hDlg : ウインドウハンドル\r
1749 *               UINT message : メッセージ番号\r
1750 *               WPARAM wParam : メッセージの WPARAM 引数\r
1751 *               LPARAM lParam : メッセージの LPARAM 引数\r
1752 *\r
1753 *       Return Value\r
1754 *               BOOL TRUE/FALSE\r
1755 *----------------------------------------------------------------------------*/\r
1756 \r
1757 // 64ビット対応\r
1758 //static BOOL CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1759 static INT_PTR CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1760 {\r
1761         static DIALOGSIZE DlgSize = {\r
1762                 { MIRROR_DEL, MIRROR_SIZEGRIP, -1 },\r
1763                 { IDOK, IDCANCEL, IDHELP, MIRROR_DEL, MIRROR_COPYNUM, MIRROR_MAKENUM, MIRROR_DELNUM, MIRROR_SIZEGRIP, -1 },\r
1764                 { MIRROR_LIST, -1 },\r
1765                 { 0, 0 },\r
1766                 { 0, 0 }\r
1767         };\r
1768 \r
1769         static TRANSPACKET **Base;\r
1770         TRANSPACKET *Pos;\r
1771         char Tmp[FMAX_PATH+1+6];\r
1772         int Num;\r
1773         int *List;\r
1774 \r
1775         switch (iMessage)\r
1776         {\r
1777                 case WM_INITDIALOG :\r
1778                         Base = (TRANSPACKET **)lParam;\r
1779                         Pos = *Base;\r
1780                         while(Pos != NULL)\r
1781                         {\r
1782                                 strcpy(Tmp, "");\r
1783                                 if((strncmp(Pos->Cmd, "R-DELE", 6) == 0) ||\r
1784                                    (strncmp(Pos->Cmd, "R-RMD", 5) == 0))\r
1785                                         sprintf(Tmp, MSGJPN052, Pos->RemoteFile);\r
1786                                 else if(strncmp(Pos->Cmd, "R-MKD", 5) == 0)\r
1787                                         sprintf(Tmp, MSGJPN053, Pos->RemoteFile);\r
1788                                 else if(strncmp(Pos->Cmd, "STOR", 4) == 0)\r
1789                                         sprintf(Tmp, MSGJPN054, Pos->RemoteFile);\r
1790                                 else if((strncmp(Pos->Cmd, "L-DELE", 6) == 0) ||\r
1791                                                 (strncmp(Pos->Cmd, "L-RMD", 5) == 0))\r
1792                                         sprintf(Tmp, MSGJPN055, Pos->LocalFile);\r
1793                                 else if(strncmp(Pos->Cmd, "L-MKD", 5) == 0)\r
1794                                         sprintf(Tmp, MSGJPN056, Pos->LocalFile);\r
1795                                 else if(strncmp(Pos->Cmd, "RETR", 4) == 0)\r
1796                                         sprintf(Tmp, MSGJPN057, Pos->LocalFile);\r
1797 \r
1798                                 if(strlen(Tmp) > 0)\r
1799                                         SendDlgItemMessage(hDlg, MIRROR_LIST, LB_ADDSTRING, 0, (LPARAM)Tmp);\r
1800                                 Pos = Pos->Next;\r
1801                         }\r
1802                         CountMirrorFiles(hDlg, *Base);\r
1803                         DlgSizeInit(hDlg, &DlgSize, &MirrorDlgSize);\r
1804                         EnableWindow(GetDlgItem(hDlg, MIRROR_DEL), FALSE);\r
1805                         return(TRUE);\r
1806 \r
1807                 case WM_COMMAND :\r
1808                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
1809                         {\r
1810                                 case IDOK :\r
1811                                         AskDlgSize(hDlg, &DlgSize, &MirrorDlgSize);\r
1812                                         EndDialog(hDlg, YES);\r
1813                                         break;\r
1814 \r
1815                                 case IDCANCEL :\r
1816                                         AskDlgSize(hDlg, &DlgSize, &MirrorDlgSize);\r
1817                                         EndDialog(hDlg, NO);\r
1818                                         break;\r
1819 \r
1820                                 case MIRROR_DEL :\r
1821                                         Num = SendDlgItemMessage(hDlg, MIRROR_LIST, LB_GETSELCOUNT, 0, 0);\r
1822                                         if((List = malloc(Num * sizeof(int))) != NULL)\r
1823                                         {\r
1824                                                 Num = SendDlgItemMessage(hDlg, MIRROR_LIST, LB_GETSELITEMS, Num, (LPARAM)List);\r
1825                                                 for(Num--; Num >= 0; Num--)\r
1826                                                 {\r
1827                                                         if(RemoveTmpTransFileListItem(Base, List[Num]) == FFFTP_SUCCESS)\r
1828                                                                 SendDlgItemMessage(hDlg, MIRROR_LIST, LB_DELETESTRING, List[Num], 0);\r
1829                                                         else\r
1830                                                                 MessageBeep(-1);\r
1831                                                 }\r
1832                                                 free(List);\r
1833                                                 CountMirrorFiles(hDlg, *Base);\r
1834                                         }\r
1835                                         break;\r
1836 \r
1837                                 case MIRROR_LIST :\r
1838                                         switch(GET_WM_COMMAND_CMD(wParam, lParam))\r
1839                                         {\r
1840                                                 case LBN_SELCHANGE :\r
1841                                                         if(SendDlgItemMessage(hDlg, MIRROR_LIST, LB_GETSELCOUNT, 0, 0) > 0)\r
1842                                                                 EnableWindow(GetDlgItem(hDlg, MIRROR_DEL), TRUE);\r
1843                                                         else\r
1844                                                                 EnableWindow(GetDlgItem(hDlg, MIRROR_DEL), FALSE);\r
1845                                                         break;\r
1846                                         }\r
1847                                         break;\r
1848 \r
1849                                 case IDHELP :\r
1850                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000012);\r
1851                         }\r
1852             return(TRUE);\r
1853 \r
1854                 case WM_SIZING :\r
1855                         DlgSizeChange(hDlg, &DlgSize, (RECT *)lParam, (int)wParam);\r
1856                     return(TRUE);\r
1857         }\r
1858         return(FALSE);\r
1859 }\r
1860 \r
1861 \r
1862 /*----- ミラーリングで転送/削除するファイルの数を数えダイアログに表示---------\r
1863 *\r
1864 *       Parameter\r
1865 *               HWND hWnd : \r
1866 *               TRANSPACKET *Pkt : \r
1867 *\r
1868 *       Return Value\r
1869 *               なし\r
1870 *----------------------------------------------------------------------------*/\r
1871 \r
1872 static void CountMirrorFiles(HWND hDlg, TRANSPACKET *Pkt)\r
1873 {\r
1874         char Tmp[80];\r
1875         int Del;\r
1876         int Make;\r
1877         int Copy;\r
1878 \r
1879         Del = 0;\r
1880         Make = 0;\r
1881         Copy = 0;\r
1882         while(Pkt != NULL)\r
1883         {\r
1884                 if((strncmp(Pkt->Cmd, "R-DELE", 6) == 0) ||\r
1885                    (strncmp(Pkt->Cmd, "R-RMD", 5) == 0) ||\r
1886                    (strncmp(Pkt->Cmd, "L-DELE", 6) == 0) ||\r
1887                    (strncmp(Pkt->Cmd, "L-RMD", 5) == 0))\r
1888                 {\r
1889                         Del += 1;\r
1890                 }\r
1891                 else if((strncmp(Pkt->Cmd, "R-MKD", 5) == 0) ||\r
1892                                 (strncmp(Pkt->Cmd, "L-MKD", 5) == 0))\r
1893                 {\r
1894                         Make += 1;\r
1895                 }\r
1896                 else if((strncmp(Pkt->Cmd, "STOR", 4) == 0) ||\r
1897                                 (strncmp(Pkt->Cmd, "RETR", 4) == 0))\r
1898                 {\r
1899                         Copy += 1;\r
1900                 }\r
1901                 Pkt = Pkt->Next;\r
1902         }\r
1903 \r
1904         if(Copy != 0)\r
1905                 sprintf(Tmp, MSGJPN058, Copy);\r
1906         else\r
1907                 sprintf(Tmp, MSGJPN059);\r
1908         SendDlgItemMessage(hDlg, MIRROR_COPYNUM, WM_SETTEXT, 0, (LPARAM)Tmp);\r
1909 \r
1910         if(Make != 0)\r
1911                 sprintf(Tmp, MSGJPN060, Make);\r
1912         else\r
1913                 sprintf(Tmp, MSGJPN061);\r
1914         SendDlgItemMessage(hDlg, MIRROR_MAKENUM, WM_SETTEXT, 0, (LPARAM)Tmp);\r
1915 \r
1916         if(Del != 0)\r
1917                 sprintf(Tmp, MSGJPN062, Del);\r
1918         else\r
1919                 sprintf(Tmp, MSGJPN063);\r
1920         SendDlgItemMessage(hDlg, MIRROR_DELNUM, WM_SETTEXT, 0, (LPARAM)Tmp);\r
1921 \r
1922         return;\r
1923 }\r
1924 \r
1925 \r
1926 \r
1927 \r
1928 /*----- ミラーリングで転送/削除しないファイルかどうかを返す ------------------\r
1929 *\r
1930 *       Parameter\r
1931 *               char Fname : ファイル名\r
1932 *               int Mode : モード\r
1933 *                       0=転送しないファイル, 1=削除しないファイル\r
1934 *\r
1935 *       Return Value\r
1936 *               int ステータス\r
1937 *                       YES=転送・削除しない/NO\r
1938 *----------------------------------------------------------------------------*/\r
1939 \r
1940 static int AskMirrorNoTrn(char *Fname, int Mode)\r
1941 {\r
1942         int Ret;\r
1943         char *Tbl;\r
1944 \r
1945         Tbl = MirrorNoTrn;\r
1946         if(Mode == 1)\r
1947                 Tbl = MirrorNoDel;\r
1948 \r
1949         Ret = NO;\r
1950         if(StrMultiLen(Tbl) > 0)\r
1951         {\r
1952                 Fname = GetFileName(Fname);\r
1953                 while(*Tbl != NUL)\r
1954                 {\r
1955                         if(CheckFname(Fname, Tbl) == FFFTP_SUCCESS)\r
1956                         {\r
1957                                 Ret = YES;\r
1958                                 break;\r
1959                         }\r
1960                         Tbl += strlen(Tbl) + 1;\r
1961                 }\r
1962         }\r
1963         return(Ret);\r
1964 }\r
1965 \r
1966 \r
1967 /*----- アップロードするファイルの属性を返す ----------------------------------\r
1968 *\r
1969 *       Parameter\r
1970 *               char Fname : ファイル名\r
1971 *\r
1972 *       Return Value\r
1973 *               int 属性 (-1=設定なし)\r
1974 *----------------------------------------------------------------------------*/\r
1975 \r
1976 static int AskUpLoadFileAttr(char *Fname)\r
1977 {\r
1978         int Ret;\r
1979         int Sts;\r
1980         char *Tbl;\r
1981 \r
1982         Tbl = DefAttrList;\r
1983         Fname = GetFileName(Fname);\r
1984         Ret = -1;\r
1985         while(*Tbl != NUL)\r
1986         {\r
1987                 Sts = CheckFname(Fname, Tbl);\r
1988                 Tbl += strlen(Tbl) + 1;\r
1989 \r
1990                 if((Sts == FFFTP_SUCCESS) && (*Tbl != NUL))\r
1991                 {\r
1992                         Ret = xtoi(Tbl);\r
1993                         break;\r
1994                 }\r
1995                 Tbl += strlen(Tbl) + 1;\r
1996         }\r
1997         return(Ret);\r
1998 }\r
1999 \r
2000 \r
2001 /*----- ホストに同じ名前のファイルがないかチェック- ---------------------------a\r
2002 *\r
2003 *       Parameter\r
2004 *               TRANSPACKET *Pkt : 転送ファイル情報\r
2005 *               FILELIST *ListList : \r
2006 *\r
2007 *       Return Value\r
2008 *               int 処理方法\r
2009 *                       EXIST_OVW/EXIST_UNIQUE/EXIST_IGNORE\r
2010 *\r
2011 *       Note\r
2012 *               Pkt.ExistSize, UpExistMode、ExistNotify が変更される\r
2013 *----------------------------------------------------------------------------*/\r
2014 \r
2015 static int CheckRemoteFile(TRANSPACKET *Pkt, FILELIST *ListList)\r
2016 {\r
2017         int Ret;\r
2018 #if defined(HAVE_TANDEM)\r
2019         int Mode;\r
2020 #endif\r
2021         FILELIST *Exist;\r
2022 \r
2023         Ret = EXIST_OVW;\r
2024         Pkt->ExistSize = 0;\r
2025         if(SendMode != TRANS_OVW)\r
2026         {\r
2027 #if defined(HAVE_TANDEM)\r
2028                 /* HP NonStop Server は大文字小文字の区別なし(すべて大文字) */\r
2029                 if(AskHostType() == HTYPE_TANDEM)\r
2030                         Mode = COMP_IGNORE;\r
2031                 else\r
2032                         Mode = COMP_STRICT;\r
2033 \r
2034                 if((Exist = SearchFileList(GetFileName(Pkt->RemoteFile), ListList, Mode)) != NULL)\r
2035 #else\r
2036                 if((Exist = SearchFileList(GetFileName(Pkt->RemoteFile), ListList, COMP_STRICT)) != NULL)\r
2037 #endif\r
2038                 {\r
2039                         Pkt->ExistSize = Exist->Size;\r
2040 \r
2041                         if(ExistNotify == YES)\r
2042                         {\r
2043                                 SoundPlay(SND_ERROR);\r
2044                                 if(DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(up_exist_dlg), GetMainHwnd(), UpExistDialogCallBack, (LPARAM)Pkt) == NO)\r
2045                                         Ret = EXIST_ABORT;\r
2046                                 else\r
2047                                         Ret = UpExistMode;\r
2048                         }\r
2049                         else\r
2050                                 Ret = UpExistMode;\r
2051 \r
2052                         if(Ret == EXIST_NEW)\r
2053                         {\r
2054                                 /*ファイル日付チェック */\r
2055                                 if(CompareFileTime(&Exist->Time, &Pkt->Time) < 0)\r
2056                                         Ret = EXIST_OVW;\r
2057                                 else\r
2058                                         Ret = EXIST_IGNORE;\r
2059                         }\r
2060                 }\r
2061         }\r
2062         return(Ret);\r
2063 }\r
2064 \r
2065 \r
2066 /*----- ホストに同じ名前のファイルがある時の確認ダイアログのコールバック ------\r
2067 *\r
2068 *       Parameter\r
2069 *               HWND hDlg : ウインドウハンドル\r
2070 *               UINT message : メッセージ番号\r
2071 *               WPARAM wParam : メッセージの WPARAM 引数\r
2072 *               LPARAM lParam : メッセージの LPARAM 引数\r
2073 *\r
2074 *       Return Value\r
2075 *               BOOL TRUE/FALSE\r
2076 *----------------------------------------------------------------------------*/\r
2077 \r
2078 // 64ビット対応\r
2079 //static BOOL CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2080 static INT_PTR CALLBACK UpExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2081 {\r
2082         static TRANSPACKET *Pkt;\r
2083         static const RADIOBUTTON UpExistButton[] = {\r
2084                 { UP_EXIST_OVW, EXIST_OVW },\r
2085                 { UP_EXIST_NEW, EXIST_NEW },\r
2086                 { UP_EXIST_RESUME, EXIST_RESUME },\r
2087                 { UP_EXIST_UNIQUE, EXIST_UNIQUE },\r
2088                 { UP_EXIST_IGNORE, EXIST_IGNORE }\r
2089         };\r
2090         #define UPEXISTBUTTONS  (sizeof(UpExistButton)/sizeof(RADIOBUTTON))\r
2091 \r
2092         switch (iMessage)\r
2093         {\r
2094                 case WM_INITDIALOG :\r
2095                         Pkt = (TRANSPACKET *)lParam;\r
2096                         SendDlgItemMessage(hDlg, UP_EXIST_NAME, EM_LIMITTEXT, FMAX_PATH, 0);\r
2097                         SendDlgItemMessage(hDlg, UP_EXIST_NAME, WM_SETTEXT, 0, (LPARAM)Pkt->RemoteFile);\r
2098 \r
2099                         if((Pkt->Type == TYPE_A) || (Pkt->ExistSize <= 0))\r
2100                                 EnableWindow(GetDlgItem(hDlg, UP_EXIST_RESUME), FALSE);\r
2101 \r
2102                         SetRadioButtonByValue(hDlg, UpExistMode, UpExistButton, UPEXISTBUTTONS);\r
2103                         return(TRUE);\r
2104 \r
2105                 case WM_COMMAND :\r
2106                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
2107                         {\r
2108                                 case IDOK_ALL :\r
2109                                         ExistNotify = NO;\r
2110                                         /* ここに break はない */\r
2111 \r
2112                                 case IDOK :\r
2113                                         UpExistMode = AskRadioButtonValue(hDlg, UpExistButton, UPEXISTBUTTONS);\r
2114                                         SendDlgItemMessage(hDlg, UP_EXIST_NAME, WM_GETTEXT, FMAX_PATH, (LPARAM)Pkt->RemoteFile);\r
2115                                         EndDialog(hDlg, YES);\r
2116                                         break;\r
2117 \r
2118                                 case IDCANCEL :\r
2119 //                                      Pkt->Abort = ABORT_USER;\r
2120 //                                      UpExistMode = EXIST_IGNORE;\r
2121                                         EndDialog(hDlg, NO);\r
2122                                         break;\r
2123 \r
2124                                 case IDHELP :\r
2125                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000011);\r
2126                                         break;\r
2127                         }\r
2128             return(TRUE);\r
2129         }\r
2130         return(FALSE);\r
2131 }\r
2132 \r
2133 \r
2134 /*----- アップロード/ダウンロードファイル名入力ダイアログのコールバック ------\r
2135 *\r
2136 *       Parameter\r
2137 *               HWND hDlg : ウインドウハンドル\r
2138 *               UINT message : メッセージ番号\r
2139 *               WPARAM wParam : メッセージの WPARAM 引数\r
2140 *               LPARAM lParam : メッセージの LPARAM 引数\r
2141 *\r
2142 *       Return Value\r
2143 *               BOOL TRUE/FALSE\r
2144 *----------------------------------------------------------------------------*/\r
2145 \r
2146 // 64ビット対応\r
2147 //static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2148 static INT_PTR CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2149 {\r
2150         switch (iMessage)\r
2151         {\r
2152                 case WM_INITDIALOG :\r
2153                         if(CurWin == WIN_LOCAL)\r
2154                                 SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN064);\r
2155                         else\r
2156                                 SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN065);\r
2157 \r
2158                         SendDlgItemMessage(hDlg, UPDOWNAS_NEW, EM_LIMITTEXT, FMAX_PATH, 0);\r
2159                         SendDlgItemMessage(hDlg, UPDOWNAS_NEW, WM_SETTEXT, 0, (LPARAM)TmpString);\r
2160                         SendDlgItemMessage(hDlg, UPDOWNAS_TEXT, WM_SETTEXT, 0, (LPARAM)TmpString);\r
2161                         return(TRUE);\r
2162 \r
2163                 case WM_COMMAND :\r
2164                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
2165                         {\r
2166                                 case IDOK :\r
2167                                         SendDlgItemMessage(hDlg, UPDOWNAS_NEW, WM_GETTEXT, FMAX_PATH, (LPARAM)TmpString);\r
2168                                         EndDialog(hDlg, YES);\r
2169                                         break;\r
2170 \r
2171                                 case UPDOWNAS_STOP :\r
2172                                         EndDialog(hDlg, NO_ALL);\r
2173                                         break;\r
2174                         }\r
2175             return(TRUE);\r
2176         }\r
2177         return(FALSE);\r
2178 }\r
2179 \r
2180 \r
2181 #if defined(HAVE_TANDEM)\r
2182 /*----- アップロード/ダウンロードファイル名入力ダイアログのコールバック ------\r
2183 *\r
2184 *       Parameter\r
2185 *               HWND hDlg : ウインドウハンドル\r
2186 *               UINT message : メッセージ番号\r
2187 *               WPARAM wParam : メッセージの WPARAM 引数\r
2188 *               LPARAM lParam : メッセージの LPARAM 引数\r
2189 *\r
2190 *       Return Value\r
2191 *               BOOL TRUE/FALSE\r
2192 *----------------------------------------------------------------------------*/\r
2193 \r
2194 static INT_PTR CALLBACK UpDownAsWithExtDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2195 {\r
2196         switch (iMessage)\r
2197         {\r
2198                 case WM_INITDIALOG :\r
2199                         if(CurWin == WIN_LOCAL)\r
2200                                 SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN064);\r
2201                         else\r
2202                                 SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN065);\r
2203 \r
2204                         SendDlgItemMessage(hDlg, UPDOWNAS_NEW, EM_LIMITTEXT, FMAX_PATH, 0);\r
2205                         SendDlgItemMessage(hDlg, UPDOWNAS_NEW, WM_SETTEXT, 0, (LPARAM)TmpString);\r
2206                         SendDlgItemMessage(hDlg, UPDOWNAS_TEXT, WM_SETTEXT, 0, (LPARAM)TmpString);\r
2207                         SendDlgItemMessage(hDlg, UPDOWNAS_FILECODE, EM_LIMITTEXT, 4, 0);\r
2208                         SendDlgItemMessage(hDlg, UPDOWNAS_FILECODE, WM_SETTEXT, 0, (LPARAM)TmpFileCode);\r
2209 \r
2210                         return(TRUE);\r
2211 \r
2212                 case WM_COMMAND :\r
2213                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
2214                         {\r
2215                                 case IDOK :\r
2216                                         SendDlgItemMessage(hDlg, UPDOWNAS_NEW, WM_GETTEXT, FMAX_PATH, (LPARAM)TmpString);\r
2217                                         SendDlgItemMessage(hDlg, UPDOWNAS_FILECODE, WM_GETTEXT, FMAX_PATH, (LPARAM)TmpFileCode);\r
2218                                         EndDialog(hDlg, YES);\r
2219                                         break;\r
2220 \r
2221                                 case UPDOWNAS_STOP :\r
2222                                         EndDialog(hDlg, NO_ALL);\r
2223                                         break;\r
2224                         }\r
2225             return(TRUE);\r
2226         }\r
2227         return(FALSE);\r
2228 }\r
2229 #endif\r
2230 \r
2231 \r
2232 /*----- ファイル一覧で指定されたファイルを削除する ----------------------------\r
2233 *\r
2234 *       Parameter\r
2235 *               なし\r
2236 *\r
2237 *       Return Value\r
2238 *               なし\r
2239 *----------------------------------------------------------------------------*/\r
2240 \r
2241 void DeleteProc(void)\r
2242 {\r
2243         int Win;\r
2244         FILELIST *FileListBase;\r
2245         FILELIST *Pos;\r
2246         int DelFlg;\r
2247         int Sts;\r
2248         char CurDir[FMAX_PATH+1];\r
2249         char Tmp[FMAX_PATH+1];\r
2250 \r
2251         // 同時接続対応\r
2252         CancelFlg = NO;\r
2253 \r
2254         // デッドロック対策\r
2255         DisableUserOpe();\r
2256         Sts = YES;\r
2257         AskRemoteCurDir(CurDir, FMAX_PATH);\r
2258         FileListBase = NULL;\r
2259         if(GetFocus() == GetLocalHwnd())\r
2260         {\r
2261                 Win = WIN_LOCAL;\r
2262                 MakeSelectedFileList(Win, NO, NO, &FileListBase, &CancelFlg);\r
2263         }\r
2264         else\r
2265         {\r
2266                 Win = WIN_REMOTE;\r
2267                 if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
2268                         MakeSelectedFileList(Win, YES, NO, &FileListBase, &CancelFlg);\r
2269                 else\r
2270                         Sts = NO;\r
2271         }\r
2272 \r
2273         if(Sts == YES)\r
2274         {\r
2275                 // デッドロック対策\r
2276 //              DisableUserOpe();\r
2277 \r
2278                 DelFlg = NO;\r
2279                 Sts = NO;\r
2280                 Pos = FileListBase;\r
2281                 while(Pos != NULL)\r
2282                 {\r
2283                         if(Pos->Node == NODE_FILE)\r
2284                         {\r
2285                                 DelNotifyAndDo(Pos, Win, &Sts, &DelFlg, CurDir);\r
2286                                 if(Sts == NO_ALL)\r
2287                                         break;\r
2288                         }\r
2289                         Pos = Pos->Next;\r
2290                 }\r
2291 \r
2292                 if(Sts != NO_ALL)\r
2293                         DeleteAllDir(FileListBase, Win, &Sts, &DelFlg, CurDir);\r
2294 \r
2295                 if(Win == WIN_REMOTE)\r
2296                 {\r
2297                         AskRemoteCurDir(Tmp, FMAX_PATH);\r
2298                         if(strcmp(Tmp, CurDir) != 0)\r
2299                                 DoCWD(Tmp, NO, NO, NO);\r
2300                 }\r
2301 \r
2302                 DeleteFileList(&FileListBase);\r
2303 \r
2304                 if(DelFlg == YES)\r
2305                 {\r
2306                         if(Win == WIN_LOCAL)\r
2307                                 GetLocalDirForWnd();\r
2308                         else\r
2309                                 GetRemoteDirForWnd(CACHE_REFRESH, &CancelFlg);\r
2310                 }\r
2311 \r
2312                 // デッドロック対策\r
2313 //              EnableUserOpe();\r
2314         }\r
2315         // デッドロック対策\r
2316         EnableUserOpe();\r
2317         return;\r
2318 }\r
2319 \r
2320 \r
2321 /*----- サブディレクトリ以下を全て削除する ------------------------------------\r
2322 *\r
2323 *       Parameter\r
2324 *               FILELIST *Dt : 削除するファイルのリスト\r
2325 *               int Win : ウインドウ番号 (WIN_xxx)\r
2326 *               int *Sw : 操作方法 (YES/NO/YES_ALL/NO_ALL)\r
2327 *               int *Flg : ファイルを削除したかどうかのフラグ (YES/NO)\r
2328 *               char *CurDir : カレントディレクトリ\r
2329 *\r
2330 *       Return Value\r
2331 *               なし\r
2332 *----------------------------------------------------------------------------*/\r
2333 \r
2334 static void DeleteAllDir(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDir)\r
2335 {\r
2336         while(Dt != NULL)\r
2337         {\r
2338                 if(Dt->Node == NODE_DIR)\r
2339                 {\r
2340                         DeleteAllDir(Dt->Next, Win, Sw, Flg, CurDir);\r
2341                         if(*Sw == NO_ALL)\r
2342                                 break;\r
2343 \r
2344                         DelNotifyAndDo(Dt, Win, Sw, Flg, CurDir);\r
2345                         break;\r
2346                 }\r
2347                 Dt = Dt->Next;\r
2348         }\r
2349         return;\r
2350 }\r
2351 \r
2352 \r
2353 /*----- 削除するかどうかの確認と削除実行 --------------------------------------\r
2354 *\r
2355 *       Parameter\r
2356 *               FILELIST *Dt : 削除するファイルのリスト\r
2357 *               int Win : ウインドウ番号 (WIN_xxx)\r
2358 *               int *Sw : 操作方法 (YES/NO/YES_ALL/NO_ALL)\r
2359 *               int *Flg : ファイルを削除したかどうかのフラグ (YES/NO)\r
2360 *               char *CurDir : カレントディレクトリ\r
2361 *\r
2362 *       Return Value\r
2363 *               なし\r
2364 *----------------------------------------------------------------------------*/\r
2365 \r
2366 static void DelNotifyAndDo(FILELIST *Dt, int Win, int *Sw, int *Flg, char *CurDir)\r
2367 {\r
2368         char Path[FMAX_PATH+1];\r
2369 \r
2370         if(Win == WIN_LOCAL)\r
2371         {\r
2372                 AskLocalCurDir(Path, FMAX_PATH);\r
2373                 SetYenTail(Path);\r
2374                 strcat(Path, Dt->File);\r
2375                 ReplaceAll(Path, '/', '\\');\r
2376         }\r
2377         else\r
2378         {\r
2379                 AskRemoteCurDir(Path, FMAX_PATH);\r
2380                 SetSlashTail(Path);\r
2381                 strcat(Path, Dt->File);\r
2382                 ReplaceAll(Path, '\\', '/');\r
2383         }\r
2384 \r
2385         if(*Sw != YES_ALL)\r
2386         {\r
2387                 sprintf(TmpString, "%s", Path);\r
2388 \r
2389                 // ローカルのファイルのパスの最後の'\\'が消えるバグ修正\r
2390 //              if(AskHostType() == HTYPE_VMS)\r
2391                 if(Win == WIN_REMOTE && AskHostType() == HTYPE_VMS)\r
2392                         ReformToVMSstylePathName(TmpString);\r
2393 \r
2394                 CurWin = Win;\r
2395                 *Sw = DialogBox(GetFtpInst(), MAKEINTRESOURCE(delete_dlg), GetMainHwnd(), DeleteDialogCallBack);\r
2396         }\r
2397 \r
2398         if((*Sw == YES) || (*Sw == YES_ALL))\r
2399         {\r
2400                 if(Win == WIN_LOCAL)\r
2401                 {\r
2402                         if(Dt->Node == NODE_FILE)\r
2403                                 DoLocalDELE(Path);\r
2404                         else\r
2405                                 DoLocalRMD(Path);\r
2406                         *Flg = YES;\r
2407                 }\r
2408                 else\r
2409                 {\r
2410                         /* フルパスを使わない時のための処理 */\r
2411                         // 同時接続対応\r
2412 //                      if(ProcForNonFullpath(Path, CurDir, GetMainHwnd(), 0) == FFFTP_FAIL)\r
2413                         if(ProcForNonFullpath(AskCmdCtrlSkt(), Path, CurDir, GetMainHwnd(), &CancelFlg) == FFFTP_FAIL)\r
2414                                 *Sw = NO_ALL;\r
2415 \r
2416                         if(*Sw != NO_ALL)\r
2417                         {\r
2418                                 if(Dt->Node == NODE_FILE)\r
2419                                         DoDELE(Path);\r
2420                                 else\r
2421                                         DoRMD(Path);\r
2422                                 *Flg = YES;\r
2423                         }\r
2424                 }\r
2425         }\r
2426         return;\r
2427 }\r
2428 \r
2429 \r
2430 /*----- ファイル削除ダイアログのコールバック ----------------------------------\r
2431 *\r
2432 *       Parameter\r
2433 *               HWND hDlg : ウインドウハンドル\r
2434 *               UINT message : メッセージ番号\r
2435 *               WPARAM wParam : メッセージの WPARAM 引数\r
2436 *               LPARAM lParam : メッセージの LPARAM 引数\r
2437 *\r
2438 *       Return Value\r
2439 *               BOOL TRUE/FALSE\r
2440 *----------------------------------------------------------------------------*/\r
2441 \r
2442 // 64ビット対応\r
2443 //static BOOL CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2444 static INT_PTR CALLBACK DeleteDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2445 {\r
2446         switch (iMessage)\r
2447         {\r
2448                 case WM_INITDIALOG :\r
2449                         if(CurWin == WIN_LOCAL)\r
2450                                 SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN066);\r
2451                         else\r
2452                                 SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN067);\r
2453                         SendDlgItemMessage(hDlg, DELETE_TEXT, WM_SETTEXT, 0, (LPARAM)TmpString);\r
2454                         return(TRUE);\r
2455 \r
2456                 case WM_COMMAND :\r
2457                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
2458                         {\r
2459                                 case IDOK :\r
2460                                         EndDialog(hDlg, YES);\r
2461                                         break;\r
2462 \r
2463                                 case DELETE_NO :\r
2464                                         EndDialog(hDlg, NO);\r
2465                                         break;\r
2466 \r
2467                                 case DELETE_ALL :\r
2468                                         EndDialog(hDlg, YES_ALL);\r
2469                                         break;\r
2470 \r
2471                                 case IDCANCEL :\r
2472                                         EndDialog(hDlg, NO_ALL);\r
2473                                         break;\r
2474                         }\r
2475             return(TRUE);\r
2476         }\r
2477         return(FALSE);\r
2478 }\r
2479 \r
2480 \r
2481 /*----- ファイル一覧で指定されたファイルの名前を変更する ----------------------\r
2482 *\r
2483 *       Parameter\r
2484 *               なし\r
2485 *\r
2486 *       Return Value\r
2487 *               なし\r
2488 *----------------------------------------------------------------------------*/\r
2489 \r
2490 void RenameProc(void)\r
2491 {\r
2492         int Win;\r
2493         FILELIST *FileListBase;\r
2494         FILELIST *Pos;\r
2495         char New[FMAX_PATH+1];\r
2496         int RenFlg;\r
2497         int Sts;\r
2498 \r
2499         // 同時接続対応\r
2500         CancelFlg = NO;\r
2501 \r
2502         Sts = FFFTP_SUCCESS;\r
2503         if(GetFocus() == GetLocalHwnd())\r
2504                 Win = WIN_LOCAL;\r
2505         else\r
2506         {\r
2507                 Win = WIN_REMOTE;\r
2508                 Sts = CheckClosedAndReconnect();\r
2509         }\r
2510 \r
2511         if(Sts == FFFTP_SUCCESS)\r
2512         {\r
2513                 DisableUserOpe();\r
2514 \r
2515                 FileListBase = NULL;\r
2516                 MakeSelectedFileList(Win, NO, NO, &FileListBase, &CancelFlg);\r
2517 \r
2518                 RenFlg = NO;\r
2519                 Sts = NO;\r
2520                 Pos = FileListBase;\r
2521                 while(Pos != NULL)\r
2522                 {\r
2523                         if((Pos->Node == NODE_FILE) || (Pos->Node == NODE_DIR))\r
2524                         {\r
2525                                 strcpy(TmpString, Pos->File);\r
2526                                 CurWin = Win;\r
2527                                 Sts = DialogBox(GetFtpInst(), MAKEINTRESOURCE(rename_dlg), GetMainHwnd(), RenameDialogCallBack);\r
2528 \r
2529                                 if(Sts == NO_ALL)\r
2530                                         break;\r
2531 \r
2532                                 if((Sts == YES) && (strlen(TmpString) != 0))\r
2533                                 {\r
2534                                         strcpy(New, TmpString);\r
2535                                         if(Win == WIN_LOCAL)\r
2536                                                 DoLocalRENAME(Pos->File, New);\r
2537                                         else\r
2538                                                 DoRENAME(Pos->File, New);\r
2539                                         RenFlg = YES;\r
2540                                 }\r
2541                         }\r
2542                         Pos = Pos->Next;\r
2543                 }\r
2544                 DeleteFileList(&FileListBase);\r
2545 \r
2546                 if(RenFlg == YES)\r
2547                 {\r
2548                         if(Win == WIN_LOCAL)\r
2549                                 GetLocalDirForWnd();\r
2550                         else\r
2551                                 GetRemoteDirForWnd(CACHE_REFRESH, &CancelFlg);\r
2552                 }\r
2553 \r
2554                 EnableUserOpe();\r
2555         }\r
2556         return;\r
2557 }\r
2558 \r
2559 \r
2560 //\r
2561 // リモート側でのファイルの移動(リネーム)を行う\r
2562 //  \r
2563 // RenameProc()をベースに改造。(2007.9.5 yutaka)\r
2564 //\r
2565 void MoveRemoteFileProc(int drop_index)\r
2566 {\r
2567         int Win;\r
2568         FILELIST *FileListBase;\r
2569         FILELIST *Pos;\r
2570         FILELIST Pkt;\r
2571         char New[FMAX_PATH+1];\r
2572         char Old[FMAX_PATH+1];\r
2573         char HostDir[FMAX_PATH+1];\r
2574         int RenFlg;\r
2575         int Sts;\r
2576 \r
2577         // 同時接続対応\r
2578         CancelFlg = NO;\r
2579 \r
2580         if(MoveMode == MOVE_DISABLE)\r
2581         {\r
2582                 return;\r
2583         }\r
2584 \r
2585         AskRemoteCurDir(HostDir, FMAX_PATH);\r
2586 \r
2587         // ドロップ先のフォルダ名を得る\r
2588         GetNodeName(WIN_REMOTE, drop_index, Pkt.File, FMAX_PATH);\r
2589 \r
2590         if(MoveMode == MOVE_DLG)\r
2591         {\r
2592                 if(DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(move_notify_dlg), GetRemoteHwnd(), ExeEscTextDialogProc, (LPARAM)Pkt.File) == NO)\r
2593                 {\r
2594                         return;\r
2595                 }\r
2596         }\r
2597 \r
2598         Sts = FFFTP_SUCCESS;\r
2599 #if 0\r
2600         if(GetFocus() == GetLocalHwnd())\r
2601                 Win = WIN_LOCAL;\r
2602         else\r
2603         {\r
2604                 Win = WIN_REMOTE;\r
2605                 Sts = CheckClosedAndReconnect();\r
2606         }\r
2607 #else\r
2608                 Win = WIN_REMOTE;\r
2609                 Sts = CheckClosedAndReconnect();\r
2610 #endif\r
2611 \r
2612         if(Sts == FFFTP_SUCCESS)\r
2613         {\r
2614                 DisableUserOpe();\r
2615 \r
2616                 FileListBase = NULL;\r
2617                 MakeSelectedFileList(Win, NO, NO, &FileListBase, &CancelFlg);\r
2618 \r
2619                 RenFlg = NO;\r
2620                 Sts = NO;\r
2621                 Pos = FileListBase;\r
2622                 while(Pos != NULL)\r
2623                 {\r
2624                         if((Pos->Node == NODE_FILE) || (Pos->Node == NODE_DIR))\r
2625                         {\r
2626                                 strcpy(TmpString, Pos->File);\r
2627                                 CurWin = Win;\r
2628 #if 0\r
2629                                 Sts = DialogBox(GetFtpInst(), MAKEINTRESOURCE(rename_dlg), GetMainHwnd(), RenameDialogCallBack);\r
2630 \r
2631                                 if(Sts == NO_ALL)\r
2632                                         break;\r
2633 #else\r
2634                                 Sts = YES;\r
2635 #endif\r
2636 \r
2637                                 if((Sts == YES) && (strlen(TmpString) != 0))\r
2638                                 {\r
2639                                         // パスの設定(local)\r
2640                                         strncpy_s(Old, sizeof(Old), HostDir, _TRUNCATE);\r
2641                                         strncat_s(Old, sizeof(Old), "/", _TRUNCATE);\r
2642                                         strncat_s(Old, sizeof(Old), Pos->File, _TRUNCATE);\r
2643 \r
2644                                         // パスの設定(remote)\r
2645                                         strncpy_s(New, sizeof(New), HostDir, _TRUNCATE);\r
2646                                         strncat_s(New, sizeof(New), "/", _TRUNCATE);\r
2647                                         strncat_s(New, sizeof(New), Pkt.File, _TRUNCATE);\r
2648                                         strncat_s(New, sizeof(New), "/", _TRUNCATE);\r
2649                                         strncat_s(New, sizeof(New), Pos->File, _TRUNCATE);\r
2650 \r
2651                                         if(Win == WIN_LOCAL)\r
2652                                                 DoLocalRENAME(Old, New);\r
2653                                         else\r
2654                                                 DoRENAME(Old, New);\r
2655                                         RenFlg = YES;\r
2656                                 }\r
2657                         }\r
2658                         Pos = Pos->Next;\r
2659                 }\r
2660                 DeleteFileList(&FileListBase);\r
2661 \r
2662                 if(RenFlg == YES)\r
2663                 {\r
2664                         if(Win == WIN_LOCAL) {\r
2665                                 GetLocalDirForWnd();\r
2666                         } else {\r
2667                                 GetRemoteDirForWnd(CACHE_REFRESH, &CancelFlg);\r
2668 \r
2669                                 strncpy_s(New, sizeof(New), HostDir, _TRUNCATE);\r
2670                                 strncat_s(New, sizeof(New), "/", _TRUNCATE);\r
2671                                 strncat_s(New, sizeof(New), Pkt.File, _TRUNCATE);\r
2672                                 DoCWD(New, YES, YES, YES);\r
2673                                 GetRemoteDirForWnd(CACHE_REFRESH, &CancelFlg);\r
2674                         }\r
2675                 }\r
2676 \r
2677                 EnableUserOpe();\r
2678         }\r
2679         return;\r
2680 }\r
2681 \r
2682 \r
2683 \r
2684 /*----- 新ファイル名入力ダイアログのコールバック ------------------------------\r
2685 *\r
2686 *       Parameter\r
2687 *               HWND hDlg : ウインドウハンドル\r
2688 *               UINT message : メッセージ番号\r
2689 *               WPARAM wParam : メッセージの WPARAM 引数\r
2690 *               LPARAM lParam : メッセージの LPARAM 引数\r
2691 *\r
2692 *       Return Value\r
2693 *               BOOL TRUE/FALSE\r
2694 *----------------------------------------------------------------------------*/\r
2695 \r
2696 // 64ビット対応\r
2697 //static BOOL CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2698 static INT_PTR CALLBACK RenameDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2699 {\r
2700         switch (iMessage)\r
2701         {\r
2702                 case WM_INITDIALOG :\r
2703                         if(CurWin == WIN_LOCAL)\r
2704                                 SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN068);\r
2705                         else\r
2706                                 SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)MSGJPN069);\r
2707                         SendDlgItemMessage(hDlg, RENAME_NEW, EM_LIMITTEXT, FMAX_PATH, 0);\r
2708                         SendDlgItemMessage(hDlg, RENAME_NEW, WM_SETTEXT, 0, (LPARAM)TmpString);\r
2709                         SendDlgItemMessage(hDlg, RENAME_TEXT, WM_SETTEXT, 0, (LPARAM)TmpString);\r
2710                         return(TRUE);\r
2711 \r
2712                 case WM_COMMAND :\r
2713                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
2714                         {\r
2715                                 case IDOK :\r
2716                                         SendDlgItemMessage(hDlg, RENAME_NEW, WM_GETTEXT, FMAX_PATH, (LPARAM)TmpString);\r
2717                                         EndDialog(hDlg, YES);\r
2718                                         break;\r
2719 \r
2720                                 case IDCANCEL :\r
2721                                         EndDialog(hDlg, NO);\r
2722                                         break;\r
2723 \r
2724                                 case RENAME_STOP :\r
2725                                         EndDialog(hDlg, NO_ALL);\r
2726                                         break;\r
2727                         }\r
2728             return(TRUE);\r
2729         }\r
2730         return(FALSE);\r
2731 }\r
2732 \r
2733 \r
2734 /*----- 新しいディレクトリを作成する ------------------------------------------\r
2735 *\r
2736 *       Parameter\r
2737 *               なし\r
2738 *\r
2739 *       Return Value\r
2740 *               なし\r
2741 *----------------------------------------------------------------------------*/\r
2742 \r
2743 void MkdirProc(void)\r
2744 {\r
2745         int Sts;\r
2746         int Win;\r
2747         char Path[FMAX_PATH+1];\r
2748         char *Title;\r
2749         int Tmp;\r
2750 \r
2751         // 同時接続対応\r
2752         CancelFlg = NO;\r
2753 \r
2754         if(GetFocus() == GetLocalHwnd())\r
2755         {\r
2756                 Win = WIN_LOCAL;\r
2757                 Title = MSGJPN070;\r
2758         }\r
2759         else\r
2760         {\r
2761                 Win = WIN_REMOTE;\r
2762                 Title = MSGJPN071;\r
2763         }\r
2764 \r
2765         strcpy(Path, "");\r
2766         Sts = InputDialogBox(mkdir_dlg, GetMainHwnd(), Title, Path, FMAX_PATH+1, &Tmp, IDH_HELP_TOPIC_0000001);\r
2767 \r
2768         if((Sts == YES) && (strlen(Path) != 0))\r
2769         {\r
2770                 if(Win&