OSDN Git Service

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