OSDN Git Service

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