OSDN Git Service

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