OSDN Git Service

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