OSDN Git Service

initial commit from 1.97b zip archive
[ffftp/ffftp.git] / filelist.c
1 /*=============================================================================\r
2 *\r
3 *                                                               \83t\83@\83C\83\8b\88ê\97\97\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 _WIN32_WINNT    0x400\r
31 \r
32 #define STRICT\r
33 #include <windows.h>\r
34 #include <stdio.h>\r
35 #include <stdlib.h>\r
36 #include <string.h>\r
37 #include <ctype.h>\r
38 #include <time.h>\r
39 #include <mbstring.h>\r
40 #include <malloc.h>\r
41 #include <windowsx.h>\r
42 #include <commctrl.h>\r
43 #include <sys/types.h>\r
44 #include <sys/stat.h>\r
45 #include <direct.h>\r
46 \r
47 #include "common.h"\r
48 #include "resource.h"\r
49 \r
50 #include <htmlhelp.h>\r
51 #include "helpid.h"\r
52 \r
53 #include <shlobj.h>\r
54 #include "OleDragDrop.h"\r
55 #include "common.h"\r
56 \r
57 #define BUF_SIZE                256\r
58 #define CF_CNT 2\r
59 #define WM_DRAGDROP             (WM_APP + 100)\r
60 #define WM_GETDATA              (WM_APP + 101)\r
61 #define WM_DRAGOVER             (WM_APP + 102)\r
62 \r
63 \r
64 /*===== \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\83\8a\83X\83g\97p\83X\83g\83\89\83N\83`\83\83 =====*/\r
65 \r
66 typedef struct {\r
67         FILELIST *Top;                  /* \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª */\r
68         int Files;                              /* \83t\83@\83C\83\8b\82Ì\90\94 */\r
69 } FLISTANCHOR;\r
70 \r
71 /*===== \83v\83\8d\83g\83^\83C\83v =====*/\r
72 \r
73 static LRESULT CALLBACK LocalWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
74 static LRESULT CALLBACK RemoteWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
75 static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
76 static void AddDispFileList(FLISTANCHOR *Anchor, char *Name, FILETIME *Time, LONGLONG Size, int Attr, int Type, int Link, char *Owner, int InfoExist, int Win);\r
77 static void EraseDispFileList(FLISTANCHOR *Anchor);\r
78 static void DispFileList2View(HWND hWnd, FLISTANCHOR *Anchor);\r
79 static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, FILETIME *Time, int Attr, char *Owner, int Link, int InfoExist);\r
80 static BOOL CALLBACK SelectDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
81 static void DispListList(FILELIST *Pos, char *Title);\r
82 static void MakeRemoteTree1(char *Path, char *Cur, FILELIST **Base, int *CancelCheckWork);\r
83 static void MakeRemoteTree2(char *Path, char *Cur, FILELIST **Base, int *CancelCheckWork);\r
84 static void CopyTmpListToFileList(FILELIST **Base, FILELIST *List);\r
85 static int GetListOneLine(char *Buf, int Max, FILE *Fd);\r
86 static int MakeDirPath(char *Str, int ListType, char *Path, char *Dir);\r
87 static void MakeLocalTree(char *Path, FILELIST **Base);\r
88 static void AddFileList(FILELIST *Pkt, FILELIST **Base);\r
89 static int AnalizeFileInfo(char *Str);\r
90 static int CheckUnixType(char *Str, char *Tmp, int Add1, int Add2, int Day);\r
91 static int CheckHHMMformat(char *Str);\r
92 static int CheckYYMMDDformat(char *Str, char Sym, int Dig3);\r
93 static int CheckYYYYMMDDformat(char *Str, char Sym);\r
94 static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size, FILETIME *Time, int *Attr, char *Owner, int *Link, int *InfoExist);\r
95 static int FindField(char *Str, char *Buf, int Num, int ToLast);\r
96 static void GetMonth(char *Str, WORD *Month, WORD *Day);\r
97 static int GetYearMonthDay(char *Str, WORD *Year, WORD *Month, WORD *Day);\r
98 static int GetHourAndMinute(char *Str, WORD *Hour, WORD *Minute);\r
99 static int GetVMSdate(char *Str, WORD *Year, WORD *Month, WORD *Day);\r
100 static int CheckSpecialDirName(char *Fname);\r
101 static int AskFilterStr(char *Fname, int Type);\r
102 static BOOL CALLBACK FilterWndProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
103 static int atoi_n(const char *Str, int Len);\r
104 \r
105 /*===== \8aO\95\94\8eQ\8fÆ =====*/\r
106 \r
107 extern int SepaWidth;\r
108 extern int RemoteWidth;\r
109 extern int ListHeight;\r
110 extern char FilterStr[FILTER_EXT_LEN+1];\r
111 extern HWND hHelpWin;\r
112 \r
113 /* \90Ý\92è\92l */\r
114 extern int LocalWidth;\r
115 extern int LocalTabWidth[4];\r
116 extern int RemoteTabWidth[6];\r
117 extern char UserMailAdrs[USER_MAIL_LEN+1];\r
118 extern HFONT ListFont;\r
119 extern int ListType;\r
120 extern int FindMode;\r
121 extern int DotFile;\r
122 extern int DispIgnoreHide;\r
123 extern int DispDrives;\r
124 extern int MoveMode;\r
125 \r
126 /*===== \83\8d\81[\83J\83\8b\82È\83\8f\81[\83N =====*/\r
127 \r
128 static HWND hWndListLocal = NULL;\r
129 static HWND hWndListRemote = NULL;\r
130 \r
131 static WNDPROC LocalProcPtr;\r
132 static WNDPROC RemoteProcPtr;\r
133 \r
134 static HIMAGELIST ListImg = NULL;\r
135 \r
136 static char FindStr[40+1] = { "*" };            /* \8c\9f\8dõ\95\8e\9a\97ñ */\r
137 static int IgnoreNew = NO;\r
138 static int IgnoreOld = NO;\r
139 static int IgnoreExist = NO;\r
140 \r
141 static int Dragging = NO;\r
142 \r
143 static int StratusMode;                 /* 0=\83t\83@\83C\83\8b, 1=\83f\83B\83\8c\83N\83g\83\8a, 2=\83\8a\83\93\83N */\r
144 \r
145 \r
146 // \83\8a\83\82\81[\83g\83t\83@\83C\83\8b\83\8a\83X\83g (2007.9.3 yutaka)\r
147 static FILELIST *remoteFileListBase;\r
148 static FILELIST *remoteFileListBaseNoExpand;\r
149 static char remoteFileDir[FMAX_PATH + 1];\r
150 \r
151 \r
152 /*----- \83t\83@\83C\83\8b\83\8a\83X\83g\83E\83C\83\93\83h\83E\82ð\8dì\90¬\82·\82é ------------------------------------\r
153 *\r
154 *       Parameter\r
155 *               HWND hWnd : \90e\83E\83C\83\93\83h\83E\82Ì\83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
156 *               HINSTANCE hInst : \83C\83\93\83X\83^\83\93\83X\83n\83\93\83h\83\8b\r
157 *\r
158 *       Return Value\r
159 *               int \83X\83e\81[\83^\83X\r
160 *                       SUCCESS/FAIL\r
161 *----------------------------------------------------------------------------*/\r
162 \r
163 int MakeListWin(HWND hWnd, HINSTANCE hInst)\r
164 {\r
165         int Sts;\r
166         LV_COLUMN LvCol;\r
167         long Tmp;\r
168 \r
169         /*===== \83\8d\81[\83J\83\8b\91¤\82Ì\83\8a\83X\83g\83r\83\85\81[ =====*/\r
170 \r
171         hWndListLocal = CreateWindowEx(/*WS_EX_STATICEDGE*/WS_EX_CLIENTEDGE,\r
172                         WC_LISTVIEWA, NULL,\r
173                         WS_CHILD | /*WS_BORDER | */LVS_REPORT | LVS_SHOWSELALWAYS,\r
174                         0, TOOLWIN_HEIGHT*2, LocalWidth, ListHeight,\r
175                         GetMainHwnd(), (HMENU)1500, hInst, NULL);\r
176 \r
177         if(hWndListLocal != NULL)\r
178         {\r
179                 LocalProcPtr = (WNDPROC)SetWindowLong(hWndListLocal, GWL_WNDPROC, (LONG)LocalWndProc);\r
180 \r
181             Tmp = SendMessage(hWndListLocal, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);\r
182             Tmp |= LVS_EX_FULLROWSELECT;\r
183             SendMessage(hWndListLocal, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)Tmp);\r
184 \r
185                 if(ListFont != NULL)\r
186                         SendMessage(hWndListLocal, WM_SETFONT, (WPARAM)ListFont, MAKELPARAM(TRUE, 0));\r
187 \r
188                 ListImg = ImageList_LoadBitmap(hInst, MAKEINTRESOURCE(dirattr_bmp), 16, 9, RGB(255,0,0));\r
189                 SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg);\r
190                 ShowWindow(hWndListLocal, SW_SHOW);\r
191 \r
192                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;\r
193                 LvCol.cx = LocalTabWidth[0];\r
194                 LvCol.pszText = MSGJPN038;\r
195                 LvCol.iSubItem = 0;\r
196                 SendMessage(hWndListLocal, LVM_INSERTCOLUMN, 0, (LPARAM)&LvCol);\r
197 \r
198                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;\r
199                 LvCol.cx = LocalTabWidth[1];\r
200                 LvCol.pszText = MSGJPN039;\r
201                 LvCol.iSubItem = 1;\r
202                 SendMessage(hWndListLocal, LVM_INSERTCOLUMN, 1, (LPARAM)&LvCol);\r
203 \r
204                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT;\r
205                 LvCol.fmt = LVCFMT_RIGHT;\r
206                 LvCol.cx = LocalTabWidth[2];\r
207                 LvCol.pszText = MSGJPN040;\r
208                 LvCol.iSubItem = 2;\r
209                 SendMessage(hWndListLocal, LVM_INSERTCOLUMN, 2, (LPARAM)&LvCol);\r
210 \r
211                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;\r
212                 LvCol.cx = LocalTabWidth[3];\r
213                 LvCol.pszText = MSGJPN041;\r
214                 LvCol.iSubItem = 3;\r
215                 SendMessage(hWndListLocal, LVM_INSERTCOLUMN, 3, (LPARAM)&LvCol);\r
216         }\r
217 \r
218         /*===== \83z\83X\83g\91¤\82Ì\83\8a\83X\83g\83r\83\85\81[ =====*/\r
219 \r
220         hWndListRemote = CreateWindowEx(/*WS_EX_STATICEDGE*/WS_EX_CLIENTEDGE,\r
221                         WC_LISTVIEWA, NULL,\r
222                         WS_CHILD | /*WS_BORDER | */LVS_REPORT | LVS_SHOWSELALWAYS,\r
223                         LocalWidth + SepaWidth, TOOLWIN_HEIGHT*2, RemoteWidth, ListHeight,\r
224                         GetMainHwnd(), (HMENU)1500, hInst, NULL);\r
225 \r
226         if(hWndListRemote != NULL)\r
227         {\r
228                 RemoteProcPtr = (WNDPROC)SetWindowLong(hWndListRemote, GWL_WNDPROC, (LONG)RemoteWndProc);\r
229 \r
230             Tmp = SendMessage(hWndListRemote, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);\r
231             Tmp |= LVS_EX_FULLROWSELECT;\r
232             SendMessage(hWndListRemote, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)Tmp);\r
233 \r
234                 if(ListFont != NULL)\r
235                         SendMessage(hWndListRemote, WM_SETFONT, (WPARAM)ListFont, MAKELPARAM(TRUE, 0));\r
236 \r
237                 SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg);\r
238                 ShowWindow(hWndListRemote, SW_SHOW);\r
239 \r
240                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;\r
241                 LvCol.cx = RemoteTabWidth[0];\r
242                 LvCol.pszText = MSGJPN042;\r
243                 LvCol.iSubItem = 0;\r
244                 SendMessage(hWndListRemote, LVM_INSERTCOLUMN, 0, (LPARAM)&LvCol);\r
245 \r
246                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;\r
247                 LvCol.cx = RemoteTabWidth[1];\r
248                 LvCol.pszText = MSGJPN043;\r
249                 LvCol.iSubItem = 1;\r
250                 SendMessage(hWndListRemote, LVM_INSERTCOLUMN, 1, (LPARAM)&LvCol);\r
251 \r
252                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT;\r
253                 LvCol.fmt = LVCFMT_RIGHT;\r
254                 LvCol.cx = RemoteTabWidth[2];\r
255                 LvCol.pszText = MSGJPN044;\r
256                 LvCol.iSubItem = 2;\r
257                 SendMessage(hWndListRemote, LVM_INSERTCOLUMN, 2, (LPARAM)&LvCol);\r
258 \r
259                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;\r
260                 LvCol.cx = RemoteTabWidth[3];\r
261                 LvCol.pszText = MSGJPN045;\r
262                 LvCol.iSubItem = 3;\r
263                 SendMessage(hWndListRemote, LVM_INSERTCOLUMN, 3, (LPARAM)&LvCol);\r
264 \r
265                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;\r
266                 LvCol.cx = RemoteTabWidth[4];\r
267                 LvCol.pszText = MSGJPN046;\r
268                 LvCol.iSubItem = 4;\r
269                 SendMessage(hWndListRemote, LVM_INSERTCOLUMN, 4, (LPARAM)&LvCol);\r
270 \r
271                 LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;\r
272                 LvCol.cx = RemoteTabWidth[5];\r
273                 LvCol.pszText = MSGJPN047;\r
274                 LvCol.iSubItem = 5;\r
275                 SendMessage(hWndListRemote, LVM_INSERTCOLUMN, 5, (LPARAM)&LvCol);\r
276         }\r
277 \r
278         Sts = SUCCESS;\r
279         if((hWndListLocal == NULL) ||\r
280            (hWndListRemote == NULL))\r
281         {\r
282                 Sts = FAIL;\r
283         }\r
284         return(Sts);\r
285 }\r
286 \r
287 \r
288 /*----- \83t\83@\83C\83\8b\83\8a\83X\83g\83E\83C\83\93\83h\83E\82ð\8dí\8f\9c ----------------------------------------\r
289 *\r
290 *       Parameter\r
291 *               \82È\82µ\r
292 *\r
293 *       Return Value\r
294 *               \82È\82µ\r
295 *----------------------------------------------------------------------------*/\r
296 \r
297 void DeleteListWin(void)\r
298 {\r
299 //      if(ListImg != NULL)\r
300 //              ImageList_Destroy(ListImg);\r
301         if(hWndListLocal != NULL)\r
302                 DestroyWindow(hWndListLocal);\r
303         if(hWndListRemote != NULL)\r
304                 DestroyWindow(hWndListRemote);\r
305         return;\r
306 }\r
307 \r
308 \r
309 /*----- \83\8d\81[\83J\83\8b\91¤\82Ì\83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\82ð\95Ô\82· ------------------\r
310 *\r
311 *       Parameter\r
312 *               \82È\82µ\r
313 *\r
314 *       Return Value\r
315 *               HWND \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
316 *----------------------------------------------------------------------------*/\r
317 \r
318 HWND GetLocalHwnd(void)\r
319 {\r
320         return(hWndListLocal);\r
321 }\r
322 \r
323 \r
324 /*----- \83z\83X\83g\91¤\82Ì\83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\82ð\95Ô\82· --------------------\r
325 *\r
326 *       Parameter\r
327 *               \82È\82µ\r
328 *\r
329 *       Return Value\r
330 *               HWND \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
331 *----------------------------------------------------------------------------*/\r
332 \r
333 HWND GetRemoteHwnd(void)\r
334 {\r
335         return(hWndListRemote);\r
336 }\r
337 \r
338 \r
339 /*----- \83\8d\81[\83J\83\8b\91¤\82Ì\83t\83@\83C\83\8b\83\8a\83X\83g\83E\83C\83\93\83h\83E\82Ì\83\81\83b\83Z\81[\83W\8f\88\97\9d ------------------\r
340 *\r
341 *       Parameter\r
342 *               HWND hWnd : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
343 *               UINT message  : \83\81\83b\83Z\81[\83W\94Ô\8d\86\r
344 *               WPARAM wParam : \83\81\83b\83Z\81[\83W\82Ì WPARAM \88ø\90\94\r
345 *               LPARAM lParam : \83\81\83b\83Z\81[\83W\82Ì LPARAM \88ø\90\94\r
346 *\r
347 *       Return Value\r
348 *               \83\81\83b\83Z\81[\83W\82É\91Î\89\9e\82·\82é\96ß\82è\92l\r
349 *----------------------------------------------------------------------------*/\r
350 \r
351 static LRESULT CALLBACK LocalWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
352 {\r
353         return(FileListCommonWndProc(hWnd, message, wParam, lParam));\r
354 }\r
355 \r
356 \r
357 /*----- \83z\83X\83g\91¤\82Ì\83t\83@\83C\83\8b\83\8a\83X\83g\83E\83C\83\93\83h\83E\82Ì\83\81\83b\83Z\81[\83W\8f\88\97\9d --------------------\r
358 *\r
359 *       Parameter\r
360 *               HWND hWnd : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
361 *               UINT message  : \83\81\83b\83Z\81[\83W\94Ô\8d\86\r
362 *               WPARAM wParam : \83\81\83b\83Z\81[\83W\82Ì WPARAM \88ø\90\94\r
363 *               LPARAM lParam : \83\81\83b\83Z\81[\83W\82Ì LPARAM \88ø\90\94\r
364 *\r
365 *       Return Value\r
366 *               \83\81\83b\83Z\81[\83W\82É\91Î\89\9e\82·\82é\96ß\82è\92l\r
367 *----------------------------------------------------------------------------*/\r
368 \r
369 static LRESULT CALLBACK RemoteWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
370 {\r
371         return(FileListCommonWndProc(hWnd, message, wParam, lParam));\r
372 }\r
373 \r
374 \r
375 // \83_\83C\83A\83\8d\83O\83v\83\8d\83V\81[\83W\83\83\r
376 static BOOL CALLBACK doOleDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)\r
377 {\r
378 #define TIMER_ID     (100)      // \8dì\90¬\82·\82é\83^\83C\83}\82Ì\8e¯\95ÊID\r
379 #define TIMER_ELAPSE (100)       // WM_TIMER\82Ì\94­\90\8aÔ\8au\r
380         MSG message;\r
381 \r
382         switch( msg ){\r
383         case WM_INITDIALOG:  // \83_\83C\83A\83\8d\83O\83{\83b\83N\83X\82ª\8dì\90¬\82³\82ê\82½\82Æ\82«\r
384                 SetTimer( hDlg, TIMER_ID, 0, NULL);\r
385                 return TRUE;\r
386 \r
387         case WM_TIMER:\r
388                 ShowWindow(hDlg, SW_HIDE);  // \83_\83C\83A\83\8d\83O\82Í\89B\82·\r
389 \r
390                 if (wp != TIMER_ID)\r
391                         break;\r
392 \r
393                 if (PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) {\r
394                                 TranslateMessage(&message);\r
395                                 DispatchMessage(&message);\r
396 \r
397                 } else {\r
398                         if (AskTransferNow() == NO) {\r
399                                 EndDialog( hDlg, 0 );\r
400                                 return TRUE;\r
401                         }\r
402                 }\r
403 \r
404                 SetTimer( hDlg, TIMER_ID, TIMER_ELAPSE, NULL );\r
405                 return TRUE;\r
406 \r
407         case WM_COMMAND:     // \83_\83C\83A\83\8d\83O\83{\83b\83N\83X\93à\82Ì\89½\82©\82ª\91I\91ð\82³\82ê\82½\82Æ\82«\r
408                 switch( LOWORD( wp ) ){\r
409 //              case IDOK:       // \81uOK\81v\83{\83^\83\93\82ª\91I\91ð\82³\82ê\82½\r
410                 case IDCANCEL:   // \81u\83L\83\83\83\93\83Z\83\8b\81v\83{\83^\83\93\82ª\91I\91ð\82³\82ê\82½\r
411                         // \83_\83C\83A\83\8d\83O\83{\83b\83N\83X\82ð\8fÁ\82·\r
412                         EndDialog( hDlg, 0 );\r
413                         break;\r
414                 }\r
415                 return TRUE;\r
416         }\r
417 \r
418         return FALSE;  // DefWindowProc()\82Å\82Í\82È\82­\81AFALSE\82ð\95Ô\82·\82±\82Æ\81I\r
419 #undef TIMER_ID     \r
420 #undef TIMER_ELAPSE \r
421 }\r
422 \r
423 \r
424 static void doTransferRemoteFile(void)\r
425 {\r
426         FILELIST *FileListBase, *FileListBaseNoExpand, *pf;\r
427         int CancelFlg = NO;\r
428         char LocDir[FMAX_PATH+1];\r
429         char TmpDir[FMAX_PATH+1];\r
430         char buf[32];\r
431         int i;\r
432         DWORD pid;\r
433 \r
434         // \82·\82Å\82É\83\8a\83\82\81[\83g\82©\82ç\93]\91\97\8dÏ\82Ý\82È\82ç\89½\82à\82µ\82È\82¢\81B(2007.9.3 yutaka)\r
435         if (remoteFileListBase != NULL)\r
436                 return;\r
437 \r
438         FileListBase = NULL;\r
439         MakeSelectedFileList(WIN_REMOTE, YES, NO, &FileListBase, &CancelFlg);\r
440         FileListBaseNoExpand = NULL;\r
441         MakeSelectedFileList(WIN_REMOTE, NO, NO, &FileListBaseNoExpand, &CancelFlg);\r
442 \r
443         // set temporary folder\r
444         AskLocalCurDir(LocDir, FMAX_PATH);\r
445 \r
446         // \83A\83v\83\8a\82ð\91½\8fd\8bN\93®\82µ\82Ä\82à\83R\83\93\83t\83\8a\83N\83g\82µ\82È\82¢\82æ\82¤\82É\81A\83e\83\93\83|\83\89\83\8a\83t\83H\83\8b\83_\96¼\82É\83v\83\8d\83Z\83XID\r
447         // \82ð\95t\89Á\82·\82é\81B(2007.9.13 yutaka)\r
448         GetTempPath(sizeof(TmpDir), TmpDir);\r
449         pid = GetCurrentProcessId();\r
450         _snprintf_s(buf, sizeof(buf), _TRUNCATE, "ffftp%d", pid);\r
451         strncat_s(TmpDir, sizeof(TmpDir), buf, _TRUNCATE);\r
452         _mkdir(TmpDir);\r
453 #if 0\r
454         if (TmpDir[strlen(TmpDir) - 1] == '\\') {\r
455                 TmpDir[strlen(TmpDir) - 1] = '\0';\r
456         }\r
457 #endif\r
458 \r
459         // \8aù\91\82Ì\83t\83@\83C\83\8b\82ð\8dí\8f\9c\82·\82é\r
460         for (pf = FileListBase ; pf ; pf = pf->Next) {\r
461                 char fn[FMAX_PATH+1];\r
462 \r
463                 strncpy_s(fn, sizeof(fn), TmpDir, _TRUNCATE);\r
464                 strncat_s(fn, sizeof(fn), "\\", _TRUNCATE);\r
465                 strncat_s(fn, sizeof(fn), pf->File, _TRUNCATE);\r
466 \r
467                 remove(fn);\r
468         }\r
469 \r
470         // \83_\83E\83\93\83\8d\81[\83h\90æ\82ð\83e\83\93\83|\83\89\83\8a\82É\90Ý\92è\r
471         SetLocalDirHist(TmpDir);\r
472 \r
473         // FFFTP\82É\83_\83E\83\93\83\8d\81[\83h\97v\8b\81\82ð\8fo\82µ\81A\83_\83E\83\93\83\8d\81[\83h\82Ì\8a®\97¹\82ð\91Ò\82Â\81B\r
474         PostMessage(GetMainHwnd(), WM_COMMAND, MAKEWPARAM(MENU_DOWNLOAD, 0), 0);\r
475 \r
476         for (i = 0 ; i < 10 ; i++) {\r
477                 MSG msg;\r
478 \r
479                 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {\r
480                         TranslateMessage(&msg);\r
481                         DispatchMessage(&msg);\r
482 \r
483                 } else {\r
484                         // \93]\91\97\83X\83\8c\83b\83h\82ª\93®\82«\8fo\82µ\82½\82ç\94²\82¯\82é\81B\r
485                         if (AskTransferNow() == YES)\r
486                                 break;\r
487                 }\r
488 \r
489                 Sleep(10);\r
490         }\r
491 \r
492         // OLE D&D\92\86\82É\83\81\83C\83\93\83E\83B\83\93\83h\83E\82ð\83\86\81[\83U\82É\91\80\8dì\82³\82¹\82é\82Æ\81A\82¨\82©\82µ\82­\82È\82é\82Ì\82Å\81A\r
493         // \89B\82µ\83\82\81[\83_\83\8b\83_\83C\83A\83\8d\83O\82ð\8dì\82é\81B\r
494         // (2007.9.11 yutaka)\r
495         DialogBox(GetFtpInst(), MAKEINTRESOURCE(IDD_OLEDRAG), GetMainHwnd(), (DLGPROC)doOleDlgProc);\r
496 \r
497         // \83_\83E\83\93\83\8d\81[\83h\90æ\82ð\8c³\82É\96ß\82·\r
498         SetLocalDirHist(LocDir);\r
499         SetCurrentDirAsDirHist();\r
500 \r
501         remoteFileListBase = FileListBase;  // \82 \82Æ\82Å\83t\83\8a\81[\82·\82é\82±\82Æ\r
502         remoteFileListBaseNoExpand = FileListBaseNoExpand;  // \82 \82Æ\82Å\83t\83\8a\81[\82·\82é\82±\82Æ\r
503         strncpy_s(remoteFileDir, sizeof(remoteFileDir), TmpDir, _TRUNCATE);\r
504 \r
505 #if 0\r
506         // add temporary list\r
507         if (remoteFileListBase != NULL) {\r
508                 FILELIST *pf = remoteFileListBase;\r
509                 char fn[FMAX_PATH + 1];\r
510                 while (pf) {\r
511                         strncpy_s(fn, sizeof(fn), remoteFileDir, _TRUNCATE);\r
512                         strncat_s(fn, sizeof(fn), "\\", _TRUNCATE);\r
513                         strncat_s(fn, sizeof(fn), pf->File, _TRUNCATE);\r
514                         AddTempFileList(fn);\r
515                         pf = pf->Next;\r
516                 }\r
517         }\r
518 #endif\r
519 }\r
520 \r
521 \r
522 int isDirectory(char *fn)\r
523 {\r
524         struct _stat buf;\r
525 \r
526         if (_stat(fn, &buf) == 0) {\r
527                 if (buf.st_mode & _S_IFDIR) { // is directory\r
528                         return 1;\r
529                 }\r
530         }\r
531         return 0;\r
532 }\r
533 \r
534 // \83e\83\93\83|\83\89\83\8a\82Ì\83t\83@\83C\83\8b\82¨\82æ\82Ñ\83t\83H\83\8b\83_\82ð\8dí\8f\9c\82·\82é\81B\r
535 void doDeleteRemoteFile(void)\r
536 {\r
537         if (remoteFileListBase != NULL) {\r
538 #if 0\r
539                 int dirs = 0;\r
540                 int i, count;\r
541                 FILELIST *pf = remoteFileListBase;\r
542                 char fn[FMAX_PATH + 1];\r
543                 while (pf) {\r
544                         strncpy_s(fn, sizeof(fn), remoteFileDir, _TRUNCATE);\r
545                         strncat_s(fn, sizeof(fn), "\\", _TRUNCATE);\r
546                         strncat_s(fn, sizeof(fn), pf->File, _TRUNCATE);\r
547                         if (isDirectory(fn)) {\r
548                                 dirs++;\r
549                         } else {\r
550                                 remove(fn);\r
551                         }\r
552                         pf = pf->Next;\r
553                 }\r
554 \r
555                 count = 0;\r
556                 for (i = 0 ; i < 1000 ; i++) {\r
557                         pf = remoteFileListBase;\r
558                         while (pf) {\r
559                                 strncpy_s(fn, sizeof(fn), remoteFileDir, _TRUNCATE);\r
560                                 strncat_s(fn, sizeof(fn), "\\", _TRUNCATE);\r
561                                 strncat_s(fn, sizeof(fn), pf->File, _TRUNCATE);\r
562                                 if (isDirectory(fn)) {\r
563                                         if (_rmdir(fn) == 0) { // \83f\83B\83\8c\83N\83g\83\8a\82ð\8fÁ\82¹\82½\82ç\83J\83E\83\93\83g\83A\83b\83v\r
564                                                 count++;\r
565                                                 if (count >= dirs)  // \82·\82×\82Ä\8fÁ\82¹\82½\82ç\8fI\82í\82è\r
566                                                         goto skip;\r
567                                         }\r
568                                 }\r
569                                 pf = pf->Next;\r
570                         }\r
571                 }\r
572 skip:\r
573                 _rmdir(remoteFileDir);  // \8e©\95ª\82Å\8dì\82Á\82½\83f\83B\83\8c\83N\83g\83\8a\82à\8fÁ\82·\r
574 #else\r
575                 SHFILEOPSTRUCT FileOp = { NULL, FO_DELETE, remoteFileDir, NULL, \r
576                         FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI, \r
577                         FALSE, NULL, NULL };    \r
578                 SHFileOperation(&FileOp);\r
579 #endif\r
580 \r
581                 DeleteFileList(&remoteFileListBase);\r
582                 remoteFileListBase = NULL;\r
583         }\r
584 \r
585         if (remoteFileListBaseNoExpand != NULL) {\r
586                 DeleteFileList(&remoteFileListBaseNoExpand);\r
587                 remoteFileListBaseNoExpand = NULL;\r
588         }\r
589 }\r
590 \r
591 \r
592 // yutaka\r
593 // cf. http://www.nakka.com/lib/\r
594 /* \83h\83\8d\83b\83v\83t\83@\83C\83\8b\82Ì\8dì\90¬ */\r
595 static HDROP APIPRIVATE CreateDropFileMem(char **FileName,int cnt,BOOL fWide)\r
596 {\r
597         HDROP hDrop;\r
598         LPDROPFILES lpDropFile;\r
599         wchar_t wbuf[BUF_SIZE];\r
600         int flen = 0;\r
601         int i;\r
602         \r
603         if(fWide == TRUE){\r
604                 /* \83\8f\83C\83h\83L\83\83\83\89 */\r
605                 for(i = 0;i < cnt;i++){\r
606                         MultiByteToWideChar(CP_ACP,0,FileName[i],-1,wbuf,BUF_SIZE);\r
607                         flen += (wcslen(wbuf) + 1) * sizeof(wchar_t);\r
608                 }\r
609                 flen++;\r
610         }else{\r
611                 /* \83}\83\8b\83`\83o\83C\83g */\r
612                 for(i = 0;i < cnt;i++){\r
613                         flen += lstrlen(FileName[i]) + 1;\r
614                 }\r
615         }\r
616 \r
617         hDrop = (HDROP)GlobalAlloc(GHND,sizeof(DROPFILES) + flen + 1);\r
618         if (hDrop == NULL){\r
619                 return NULL;\r
620         }\r
621 \r
622         lpDropFile = (LPDROPFILES) GlobalLock(hDrop);\r
623         lpDropFile->pFiles = sizeof(DROPFILES);         /* \83t\83@\83C\83\8b\96¼\82Ì\83\8a\83X\83g\82Ü\82Å\82Ì\83I\83t\83Z\83b\83g */\r
624         lpDropFile->pt.x = 0;\r
625         lpDropFile->pt.y = 0;\r
626         lpDropFile->fNC = FALSE;\r
627         lpDropFile->fWide = fWide;                                      /* \83\8f\83C\83h\83L\83\83\83\89\82Ì\8fê\8d\87\82Í TRUE */\r
628 \r
629         /* \8d\\91¢\91Ì\82Ì\8cã\82ë\82É\83t\83@\83C\83\8b\96¼\82Ì\83\8a\83X\83g\82ð\83R\83s\81[\82·\82é\81B(\83t\83@\83C\83\8b\96¼\0\83t\83@\83C\83\8b\96¼\0\83t\83@\83C\83\8b\96¼\0\0) */\r
630         if(fWide == TRUE){\r
631                 /* \83\8f\83C\83h\83L\83\83\83\89 */\r
632                 wchar_t *buf;\r
633 \r
634                 buf = (wchar_t *)(&lpDropFile[1]);\r
635                 for(i = 0;i < cnt;i++){\r
636                         MultiByteToWideChar(CP_ACP,0,FileName[i],-1,wbuf,BUF_SIZE);\r
637                         wcscpy(buf,wbuf);\r
638                         buf += wcslen(wbuf) + 1;\r
639                 }\r
640         }else{\r
641                 /* \83}\83\8b\83`\83o\83C\83g */\r
642                 char *buf;\r
643 \r
644                 buf = (char *)(&lpDropFile[1]);\r
645                 for(i = 0;i < cnt;i++){\r
646                         lstrcpy(buf,FileName[i]);\r
647                         buf += lstrlen(FileName[i]) + 1;\r
648                 }\r
649         }\r
650 \r
651         GlobalUnlock(hDrop);\r
652         return(hDrop);\r
653 }\r
654 \r
655 \r
656 // OLE D&D\82ð\8aJ\8en\82·\82é \r
657 // (2007.8.30 yutaka)\r
658 static void doDragDrop(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
659 {\r
660         UINT cf[CF_CNT];\r
661         POINT pt;\r
662         int ret;\r
663 \r
664         // \83e\83\93\83|\83\89\83\8a\82ð\82«\82ê\82¢\82É\82·\82é (2007.9.3 yutaka)\r
665         doDeleteRemoteFile();\r
666 \r
667         /* \83h\83\89\83b\83O&\83h\83\8d\83b\83v\82Ì\8aJ\8en */\r
668         cf[0] = CF_HDROP;\r
669         cf[1] = CF_HDROP;       /* \83t\83@\83C\83\8b */\r
670         if((ret = OLE_IDropSource_Start(hWnd,WM_GETDATA, WM_DRAGOVER, cf,1,DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK)) == DROPEFFECT_MOVE){\r
671         }\r
672 \r
673         // \83h\83\8d\83b\83v\90æ\82Ì\83A\83v\83\8a\82É WM_LBUTTONUP \82ð\94ò\82Î\82·\81B\r
674         GetCursorPos(&pt);\r
675         ScreenToClient(hWnd, &pt);\r
676         PostMessage(hWnd,WM_LBUTTONUP,0,MAKELPARAM(pt.x,pt.y));\r
677 }\r
678 \r
679 \r
680 \r
681 /*----- \83t\83@\83C\83\8b\88ê\97\97\83E\83C\83\93\83h\83E\82Ì\8b¤\92Ê\83\81\83b\83Z\81[\83W\8f\88\97\9d ----------------------------\r
682 *\r
683 *       Parameter\r
684 *               HWND hWnd : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
685 *               UINT message  : \83\81\83b\83Z\81[\83W\94Ô\8d\86\r
686 *               WPARAM wParam : \83\81\83b\83Z\81[\83W\82Ì WPARAM \88ø\90\94\r
687 *               LPARAM lParam : \83\81\83b\83Z\81[\83W\82Ì LPARAM \88ø\90\94\r
688 *\r
689 *       Return Value\r
690 *               \83\81\83b\83Z\81[\83W\82É\91Î\89\9e\82·\82é\96ß\82è\92l\r
691 *----------------------------------------------------------------------------*/\r
692 \r
693 static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
694 {\r
695         POINT Point;\r
696         HWND hWndPnt;\r
697         HWND hWndParent;\r
698         static HCURSOR hCsrDrg;\r
699         static HCURSOR hCsrNoDrg;\r
700         static POINT DragPoint;\r
701         static HWND hWndDragStart;\r
702         static int RemoteDropFileIndex = -1;\r
703         int Win;\r
704         HWND hWndDst;\r
705         WNDPROC ProcPtr;\r
706         HWND hWndHistEdit;\r
707 \r
708         Win = WIN_LOCAL;\r
709         hWndDst = hWndListRemote;\r
710         ProcPtr = LocalProcPtr;\r
711         hWndHistEdit = GetLocalHistEditHwnd();\r
712         if(hWnd == hWndListRemote)\r
713         {\r
714                 Win = WIN_REMOTE;\r
715                 hWndDst = hWndListLocal;\r
716                 ProcPtr = RemoteProcPtr;\r
717                 hWndHistEdit = GetRemoteHistEditHwnd();\r
718         }\r
719 \r
720         switch (message)\r
721         {\r
722         case WM_SYSKEYDOWN:\r
723                         if (wParam == 'D') {    // Alt+D\r
724                                 SetFocus(hWndHistEdit);\r
725                                 break;\r
726                         }\r
727                         EraseListViewTips();\r
728                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
729 \r
730         case WM_KEYDOWN:\r
731                         if(wParam == 0x09)\r
732                         {\r
733                                 SetFocus(hWndDst);\r
734                                 break;\r
735                         }\r
736                         EraseListViewTips();\r
737                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
738 \r
739                 case WM_SETFOCUS :\r
740                         SetFocusHwnd(hWnd);\r
741                         MakeButtonsFocus();\r
742                         DispCurrentWindow(Win);\r
743                         DispSelectedSpace();\r
744                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
745 \r
746                 case WM_KILLFOCUS :\r
747                         EraseListViewTips();\r
748                         MakeButtonsFocus();\r
749                         DispCurrentWindow(-1);\r
750                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
751 \r
752                 case WM_DROPFILES :\r
753                         // \83h\83\89\83b\83O\92\86\82Í\8f\88\97\9d\82µ\82È\82¢\81B\83h\83\89\83b\83O\8cã\82ÉWM_LBUTTONDOWN\82ª\94ò\82ñ\82Å\82­\82é\82½\82ß\81A\82»\82±\82Å\8f\88\97\9d\82·\82é\81B\r
754                         if (Dragging == YES) \r
755                                 return (FALSE);\r
756 \r
757                         if(hWnd == hWndListRemote)\r
758                         {\r
759                                 if(AskConnecting() == YES)\r
760                                         UpLoadDragProc(wParam);\r
761                         }\r
762                         else if(hWnd == hWndListLocal)\r
763                         {\r
764                                 ChangeDirDropFileProc(wParam);\r
765                         }\r
766                         break;\r
767 \r
768                 case WM_LBUTTONDOWN :\r
769                         EraseListViewTips();\r
770                         SetFocus(hWnd);\r
771                         DragPoint.x = LOWORD(lParam);\r
772                         DragPoint.y = HIWORD(lParam);\r
773                         hWndDragStart = hWnd;\r
774                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
775                         break;\r
776 \r
777                 case WM_LBUTTONUP :\r
778                         if(Dragging == YES)\r
779                         {\r
780                                 Dragging = NO;\r
781                                 ReleaseCapture();\r
782                                 hCsrDrg = LoadCursor(NULL, IDC_ARROW);\r
783                                 SetCursor(hCsrDrg);\r
784 \r
785                                 Point.x = (long)(short)LOWORD(lParam);\r
786                                 Point.y = (long)(short)HIWORD(lParam);\r
787                                 ClientToScreen(hWnd, &Point);\r
788                                 hWndPnt = WindowFromPoint(Point);\r
789                                 if(hWndPnt == hWndDst)  // local <-> remote \r
790                                 {\r
791                                         if(hWndPnt == hWndListRemote) {\r
792                                                 PostMessage(GetMainHwnd(), WM_COMMAND, MAKEWPARAM(MENU_UPLOAD, 0), 0);\r
793                                         } else if(hWndPnt == hWndListLocal) {\r
794                                                 PostMessage(GetMainHwnd(), WM_COMMAND, MAKEWPARAM(MENU_DOWNLOAD, 0), 0);\r
795                                         }\r
796                                 } else { // \93¯\88ê\83E\83B\83\93\83h\83E\93à\82Ì\8fê\8d\87 (yutaka)\r
797                                         if (hWndDragStart == hWndListRemote && hWndPnt == hWndListRemote) {\r
798                                                 // remote <-> remote\82Ì\8fê\8d\87\82Í\81A\83T\81[\83o\82Å\82Ì\83t\83@\83C\83\8b\82Ì\88Ú\93®\82ð\8ds\82¤\81B(2007.9.5 yutaka)\r
799                                                 if (RemoteDropFileIndex != -1) {\r
800                                                         ListView_SetItemState(hWnd, RemoteDropFileIndex, 0, LVIS_DROPHILITED);\r
801                                                         MoveRemoteFileProc(RemoteDropFileIndex);\r
802                                                 }\r
803 \r
804                                         }\r
805 \r
806                                 }\r
807                         }\r
808                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
809 \r
810                 case WM_DRAGDROP:  \r
811                         // OLE D&D\82ð\8aJ\8en\82·\82é (yutaka)\r
812                         doDragDrop(hWnd, message, wParam, lParam);\r
813                         return (TRUE);\r
814                         break;\r
815  \r
816                 case WM_GETDATA:  // \83t\83@\83C\83\8b\82Ì\83p\83X\82ðD&D\90æ\82Ì\83A\83v\83\8a\82Ö\95Ô\82· (yutaka)\r
817                         switch(wParam)\r
818                         {\r
819                         case CF_HDROP:          /* \83t\83@\83C\83\8b */\r
820                                 {\r
821                                         OSVERSIONINFO os_info;\r
822                                         BOOL NTFlag = FALSE;\r
823                                         char **FileNameList;\r
824                                         int filelen;\r
825                                         int i, j, filenum = 0;\r
826  \r
827                                         FILELIST *FileListBase, *FileListBaseNoExpand, *pf;\r
828                                         int CancelFlg = NO;\r
829                                         char LocDir[FMAX_PATH+1];\r
830                                         char *PathDir;\r
831  \r
832                                         // \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
833                                         if (hWndDragStart == hWndListLocal) {\r
834                                                 AskLocalCurDir(LocDir, FMAX_PATH);\r
835                                                 PathDir = LocDir;\r
836  \r
837                                                 FileListBase = NULL;\r
838                                                 MakeSelectedFileList(WIN_LOCAL, YES, NO, &FileListBase, &CancelFlg);                    \r
839  \r
840                                         } else if (hWndDragStart == hWndListRemote) {\r
841                                                 GetCursorPos(&Point);\r
842                                                 hWndPnt = WindowFromPoint(Point);\r
843                                                 hWndParent = GetParent(hWndPnt);\r
844                                                 if (hWndPnt == hWndListRemote || hWndPnt == hWndListLocal ||\r
845                                                         hWndParent == hWndListRemote || hWndParent == hWndListLocal) {\r
846                                                         FileListBase = NULL;\r
847  \r
848                                                 } else {\r
849                                                         // \91I\91ð\82³\82ê\82Ä\82¢\82é\83\8a\83\82\81[\83g\83t\83@\83C\83\8b\82Ì\83\8a\83X\83g\83A\83b\83v\r
850                                                         // \82±\82Ì\83^\83C\83~\83\93\83O\82Å\83\8a\83\82\81[\83g\82©\82ç\83\8d\81[\83J\83\8b\82Ì\88ê\8e\9e\83t\83H\83\8b\83_\82Ö\83_\83E\83\93\83\8d\81[\83h\82·\82é\r
851                                                         // (2007.8.31 yutaka)\r
852                                                         doTransferRemoteFile();\r
853                                                         PathDir = remoteFileDir;\r
854                                                         FileListBase = remoteFileListBase;\r
855                                                         FileListBaseNoExpand = remoteFileListBaseNoExpand;\r
856                                                 }\r
857  \r
858                                         } \r
859  \r
860                                         pf = FileListBaseNoExpand;\r
861                                         for (filenum = 0; pf ; filenum++) {\r
862                                                 pf = pf->Next;\r
863                                         }\r
864                                         // \83t\83@\83C\83\8b\82ª\96¢\91I\91ð\82Ì\8fê\8d\87\82Í\89½\82à\82µ\82È\82¢\81B(yutaka)\r
865                                         if (filenum <= 0) {\r
866                                                 *((HANDLE *)lParam) = NULL;\r
867                                                 return (FALSE);\r
868                                         }\r
869                                         \r
870                                         /* \83t\83@\83C\83\8b\96¼\82Ì\94z\97ñ\82ð\8dì\90¬\82·\82é */\r
871                                         FileNameList = (char **)GlobalAlloc(GPTR,sizeof(char *) * filenum);\r
872                                         if(FileNameList == NULL){\r
873                                                 abort();\r
874                                         }\r
875                                         pf = FileListBaseNoExpand;\r
876                                         for (j = 0; pf ; j++) {\r
877                                                 filelen = strlen(PathDir) + 1 + strlen(pf->File) + 1;\r
878                                                 FileNameList[j] = (char *)GlobalAlloc(GPTR, filelen);\r
879                                                 strncpy_s(FileNameList[j], filelen, PathDir, _TRUNCATE);\r
880                                                 strncat_s(FileNameList[j], filelen, "\\", _TRUNCATE);\r
881                                                 strncat_s(FileNameList[j], filelen, pf->File, _TRUNCATE);\r
882                                                 pf = pf->Next;\r
883 #if 0\r
884                                                 if (FileListBase->Node == NODE_DIR) { \r
885                                                         // \83t\83H\83\8b\83_\82ð\92Í\82ñ\82¾\8fê\8d\87\82Í\82»\82ê\88È\8d~\93W\8aJ\82µ\82È\82¢\r
886                                                         filenum = 1;\r
887                                                         break;\r
888                                                 }\r
889 #endif\r
890                                         }\r
891                                         \r
892                                         os_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);\r
893                                         GetVersionEx(&os_info);\r
894                                         if(os_info.dwPlatformId == VER_PLATFORM_WIN32_NT){\r
895                                                 NTFlag = TRUE;\r
896                                         }\r
897  \r
898                                         /* \83h\83\8d\83b\83v\83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\8dì\90¬ */\r
899                                         /* NT\82Ì\8fê\8d\87\82ÍUNICODE\82É\82È\82é\82æ\82¤\82É\82·\82é */\r
900                                         *((HANDLE *)lParam) = CreateDropFileMem(FileNameList, filenum, NTFlag);\r
901  \r
902                                         /* \83t\83@\83C\83\8b\96¼\82Ì\94z\97ñ\82ð\89ð\95ú\82·\82é */\r
903                                         for (i = 0; i < filenum ; i++) {\r
904                                                 GlobalFree(FileNameList[i]);\r
905                                         }\r
906                                         GlobalFree(FileNameList);\r
907  \r
908                                         if (hWndDragStart == hWndListLocal) {\r
909                                                 DeleteFileList(&FileListBase);\r
910                                         } else {\r
911                                                 // \82 \82Æ\82Å\83t\83@\83C\83\8b\8dí\8f\9c\82µ\82Ä\83t\83\8a\81[\82·\82é\r
912                                         }\r
913  \r
914                                         return (TRUE);\r
915                                 }\r
916                                 break;\r
917  \r
918                         default:\r
919                                 *((HANDLE *)lParam) = NULL;\r
920                                 break;\r
921                         }\r
922  \r
923                         break;\r
924 \r
925                 case WM_DRAGOVER:\r
926                         {\r
927                                 LVHITTESTINFO hi;\r
928                                 int Node, index;\r
929                                 static int prev_index = -1;\r
930 \r
931                                 // \93¯\88ê\83E\83B\83\93\83h\83E\93à\82Å\82ÌD&D\82Í\83\8a\83\82\81[\83g\91¤\82Ì\82Ý\r
932                                 if (Win != WIN_REMOTE)\r
933                                         break;\r
934 \r
935                                 if(MoveMode == MOVE_DISABLE)\r
936                                         break;\r
937 \r
938                                 memset(&hi, 0, sizeof(hi));\r
939 \r
940                                 GetCursorPos(&Point);\r
941                                 hWndPnt = WindowFromPoint(Point);\r
942                                 ScreenToClient(hWnd, &Point);\r
943 \r
944                                 hi.pt = Point;\r
945 \r
946                                 // \88È\91O\82Ì\91I\91ð\82ð\8fÁ\82·\r
947                                 ListView_SetItemState(hWnd, prev_index, 0, LVIS_DROPHILITED);\r
948                                 RemoteDropFileIndex = -1;\r
949 \r
950                                 if ((hWndPnt == hWndListRemote) && (ListView_HitTest(hWnd, &hi) != -1)) {\r
951                                         if (hi.flags == LVHT_ONITEMLABEL) { // The position is over a list-view item's text.\r
952                                         \r
953                                                 index = hi.iItem;\r
954                                                 prev_index = index;\r
955                                                 Node = GetNodeType(Win, index);\r
956                                                 if (Node == NODE_DIR) {\r
957                                                         ListView_SetItemState(hWnd, index, LVIS_DROPHILITED, LVIS_DROPHILITED);\r
958                                                         RemoteDropFileIndex = index;\r
959                                                 }\r
960                                         }\r
961                                 } \r
962 \r
963                         }\r
964                         break;\r
965 \r
966                 case WM_RBUTTONDOWN :\r
967                         /* \82±\82±\82Å\83t\83@\83C\83\8b\82ð\91I\82Ô */\r
968                         CallWindowProc(ProcPtr, hWnd, message, wParam, lParam);\r
969 \r
970                         EraseListViewTips();\r
971                         SetFocus(hWnd);\r
972                         if(hWnd == hWndListRemote)\r
973                                 RemoteRbuttonMenu(0);\r
974                         else if(hWnd == hWndListLocal)\r
975                                 LocalRbuttonMenu(0);\r
976                         break;\r
977 \r
978                 case WM_LBUTTONDBLCLK :\r
979                         DoubleClickProc(Win, NO, -1);\r
980                         break;\r
981 \r
982                 case WM_MOUSEMOVE :\r
983                         if(wParam == MK_LBUTTON)\r
984                         {\r
985                                 if((Dragging == NO) && \r
986                                    (hWnd == hWndDragStart) &&\r
987                                    (AskConnecting() == YES) &&\r
988                                    (SendMessage(hWnd, LVM_GETSELECTEDCOUNT, 0, 0) > 0) &&\r
989                                    ((abs((short)LOWORD(lParam) - DragPoint.x) > 5) ||\r
990                                         (abs((short)HIWORD(lParam) - DragPoint.y) > 5)))\r
991                                 {\r
992                                         SetCapture(hWnd);\r
993                                         Dragging = YES;\r
994                                         hCsrDrg = LoadCursor(GetFtpInst(), MAKEINTRESOURCE(drag_csr));\r
995                                         hCsrNoDrg = LoadCursor(GetFtpInst(), MAKEINTRESOURCE(nodrop_csr));\r
996                                         SetCursor(hCsrDrg);\r
997                                 }\r
998                                 else if(Dragging == YES)\r
999                                 {\r
1000                                         Point.x = (long)(short)LOWORD(lParam);\r
1001                                         Point.y = (long)(short)HIWORD(lParam);\r
1002                                         ClientToScreen(hWnd, &Point);\r
1003                                         hWndPnt = WindowFromPoint(Point);\r
1004                                         if((hWndPnt == hWndListRemote) || (hWndPnt == hWndListLocal))\r
1005                                                 SetCursor(hCsrDrg);\r
1006                                         else {\r
1007                                                 // \83}\83E\83X\83|\83C\83\93\83^\82Ì\81~\95\\8e¦\82ð\82â\82ß\82é (yutaka)\r
1008 #if 0\r
1009                                                 SetCursor(hCsrNoDrg);\r
1010 #endif\r
1011                                         }\r
1012 \r
1013                                         // OLE D&D\82Ì\8aJ\8en\82ð\8ew\8e¦\82·\82é\r
1014                                         PostMessage(hWnd, WM_DRAGDROP, MAKEWPARAM(wParam, lParam), 0);\r
1015 \r
1016                                 }\r
1017                                 else\r
1018                                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
1019                         }\r
1020                         else\r
1021                         {\r
1022                                 CheckTipsDisplay(hWnd, lParam);\r
1023                                 return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
1024                         }\r
1025                         break;\r
1026 \r
1027                 case WM_MOUSEWHEEL :\r
1028                         if(Dragging == NO)\r
1029                         {\r
1030                 short zDelta = (short)HIWORD(wParam);\r
1031 \r
1032                                 EraseListViewTips();\r
1033                                 Point.x = (short)LOWORD(lParam);\r
1034                                 Point.y = (short)HIWORD(lParam);\r
1035                                 hWndPnt = WindowFromPoint(Point);\r
1036 \r
1037                                 if((wParam & MAKEWPARAM(MK_SHIFT, 0)) && \r
1038                                    ((hWndPnt == hWndListRemote) ||\r
1039                                         (hWndPnt == hWndListLocal) || \r
1040                                         (hWndPnt == GetTaskWnd())))\r
1041                                 {\r
1042                                         PostMessage(hWndPnt, WM_VSCROLL, zDelta > 0 ? MAKEWPARAM(SB_PAGEUP, 0) : MAKEWPARAM(SB_PAGEDOWN, 0), 0);\r
1043 //                                      PostMessage(hWndPnt, WM_VSCROLL, MAKEWPARAM(SB_ENDSCROLL, 0), 0);\r
1044                                 }\r
1045                                 else if(hWndPnt == hWnd)\r
1046                                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
1047                                 else if((hWndPnt == hWndDst) || (hWndPnt == GetTaskWnd()))\r
1048                                         PostMessage(hWndPnt, message, wParam, lParam);\r
1049                         }\r
1050                         break;\r
1051 \r
1052                 default :\r
1053                         return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));\r
1054         }\r
1055     return(0L);\r
1056 }\r
1057 \r
1058 \r
1059 /*----- \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\83^\83u\95\9d\82ð\8eæ\93¾\82·\82é --------------------------------------\r
1060 *\r
1061 *       Parameter\r
1062 *               \82È\82µ\r
1063 *\r
1064 *       Return Value\r
1065 *               \82È\82µ\r
1066 *----------------------------------------------------------------------------*/\r
1067 \r
1068 void GetListTabWidth(void)\r
1069 {\r
1070         LV_COLUMN LvCol;\r
1071         int i;\r
1072 \r
1073         for(i = 0; i <= 3; i++)\r
1074         {\r
1075                 LvCol.mask = LVCF_WIDTH;\r
1076                 if(SendMessage(hWndListLocal, LVM_GETCOLUMN, i, (LPARAM)&LvCol) == TRUE)\r
1077                         LocalTabWidth[i] = LvCol.cx;\r
1078         }\r
1079 \r
1080         for(i = 0; i <= 5; i++)\r
1081         {\r
1082                 LvCol.mask = LVCF_WIDTH;\r
1083                 if(SendMessage(hWndListRemote, LVM_GETCOLUMN, i, (LPARAM)&LvCol) == TRUE)\r
1084                         RemoteTabWidth[i] = LvCol.cx;\r
1085         }\r
1086         return;\r
1087 }\r
1088 \r
1089 \r
1090 /*----- \83t\83@\83C\83\8b\88ê\97\97\95û\96@\82É\82µ\82½\82ª\82Á\82Ä\83\8a\83X\83g\83r\83\85\81[\82ð\90Ý\92è\82·\82é --------------------\r
1091 *\r
1092 *       Parameter\r
1093 *               \82È\82µ\r
1094 *\r
1095 *       Return Value\r
1096 *               \82È\82µ\r
1097 *----------------------------------------------------------------------------*/\r
1098 \r
1099 void SetListViewType(void)\r
1100 {\r
1101         long lStyle;\r
1102 \r
1103         switch(ListType)\r
1104         {\r
1105                 case LVS_LIST :\r
1106                         lStyle = GetWindowLong(GetLocalHwnd(), GWL_STYLE);\r
1107                         lStyle &= ~(LVS_REPORT | LVS_LIST);\r
1108                         lStyle |= LVS_LIST;\r
1109                         SetWindowLong(GetLocalHwnd(), GWL_STYLE, lStyle);\r
1110 \r
1111                         lStyle = GetWindowLong(GetRemoteHwnd(), GWL_STYLE);\r
1112                         lStyle &= ~(LVS_REPORT | LVS_LIST);\r
1113                         lStyle |= LVS_LIST;\r
1114                         SetWindowLong(GetRemoteHwnd(), GWL_STYLE, lStyle);\r
1115                         break;\r
1116 \r
1117                 default :\r
1118                         lStyle = GetWindowLong(GetLocalHwnd(), GWL_STYLE);\r
1119                         lStyle &= ~(LVS_REPORT | LVS_LIST);\r
1120                         lStyle |= LVS_REPORT;\r
1121                         SetWindowLong(GetLocalHwnd(), GWL_STYLE, lStyle);\r
1122 \r
1123                         lStyle = GetWindowLong(GetRemoteHwnd(), GWL_STYLE);\r
1124                         lStyle &= ~(LVS_REPORT | LVS_LIST);\r
1125                         lStyle |= LVS_REPORT;\r
1126                         SetWindowLong(GetRemoteHwnd(), GWL_STYLE, lStyle);\r
1127                         break;\r
1128         }\r
1129         return;\r
1130 }\r
1131 \r
1132 \r
1133 /*----- \83z\83X\83g\91¤\82Ì\83t\83@\83C\83\8b\88ê\97\97\83E\83C\83\93\83h\83E\82É\83t\83@\83C\83\8b\96¼\82ð\83Z\83b\83g ------------------\r
1134 *\r
1135 *       Parameter\r
1136 *               int Mode : \83L\83\83\83b\83V\83\85\83\82\81[\83h (CACHE_xxx)\r
1137 *\r
1138 *       Return Value\r
1139 *               \82È\82µ\r
1140 *----------------------------------------------------------------------------*/\r
1141 \r
1142 void GetRemoteDirForWnd(int Mode, int *CancelCheckWork)\r
1143 {\r
1144         FILE *fd;\r
1145         LONGLONG Size;\r
1146         char Str[FMAX_PATH+1];\r
1147         char Buf[FMAX_PATH+1];\r
1148         FILETIME Time;\r
1149         int Attr;\r
1150         int Type;\r
1151         int ListType;\r
1152         int Num;\r
1153         FLISTANCHOR Anchor;\r
1154         char Owner[OWNER_NAME_LEN+1];\r
1155         int Link;\r
1156         int InfoExist;\r
1157 \r
1158 //#pragma aaa\r
1159 //DoPrintf("===== GetRemoteDirForWnd");\r
1160 \r
1161         Anchor.Top = NULL;\r
1162         Anchor.Files = 0;\r
1163 \r
1164         if(AskConnecting() == YES)\r
1165         {\r
1166 //              SetCursor(LoadCursor(NULL, IDC_WAIT));\r
1167                 DisableUserOpe();\r
1168 \r
1169                 AskRemoteCurDir(Buf, FMAX_PATH);\r
1170                 SetRemoteDirHist(Buf);\r
1171 \r
1172                 Type = FTP_COMPLETE;\r
1173                 if(Mode != CACHE_LASTREAD)\r
1174                 {\r
1175 \r
1176                         if((Num = AskCached(Buf)) == -1)\r
1177                         {\r
1178                                 Num = AskFreeCache();\r
1179                                 Mode = CACHE_REFRESH;\r
1180                         }\r
1181 \r
1182                         if(Mode == CACHE_REFRESH)\r
1183                         {\r
1184                                 if((Type = DoDirListCmdSkt("", "", Num, CancelCheckWork)) == FTP_COMPLETE)\r
1185                                         SetCache(Num, Buf);\r
1186                                 else\r
1187                                         ClearCache(Num);\r
1188                         }\r
1189                 }\r
1190                 else\r
1191                         Num = AskCurrentFileListNum();\r
1192 \r
1193                 if(Type == FTP_COMPLETE)\r
1194                 {\r
1195                         SetCurrentFileListNum(Num);\r
1196                         MakeCacheFileName(Num, Buf);\r
1197                         if((fd = fopen(Buf, "rb"))!=NULL)\r
1198                         {\r
1199                                 ListType = LIST_UNKNOWN;\r
1200 \r
1201                                 while(GetListOneLine(Str, FMAX_PATH, fd) == SUCCESS)\r
1202                                 {\r
1203                                         if((ListType = AnalizeFileInfo(Str)) != LIST_UNKNOWN)\r
1204                                         {\r
1205                                                 if((Type = ResolvFileInfo(Str, ListType, Buf, &Size, &Time, &Attr, Owner, &Link, &InfoExist)) != NODE_NONE)\r
1206                                                 {\r
1207                                                         if(AskFilterStr(Buf, Type) == YES)\r
1208                                                         {\r
1209                                                                 if((DotFile == YES) || (Buf[0] != '.'))\r
1210                                                                 {\r
1211                                                                         AddDispFileList(&Anchor, Buf, &Time, Size, Attr, Type, Link, Owner, InfoExist, WIN_REMOTE);\r
1212                                                                 }\r
1213                                                         }\r
1214                                                 }\r
1215                                         }\r
1216                                 }\r
1217                                 fclose(fd);\r
1218 \r
1219                                 DispFileList2View(GetRemoteHwnd(), &Anchor);\r
1220                                 EraseDispFileList(&Anchor);\r
1221 \r
1222                                 // \90æ\93ª\82Ì\83A\83C\83e\83\80\82ð\91I\91ð\r
1223                                 ListView_SetItemState(GetRemoteHwnd(), 0, LVIS_FOCUSED, LVIS_FOCUSED);\r
1224                         }\r
1225                         else\r
1226                         {\r
1227                                 SetTaskMsg(MSGJPN048);\r
1228                                 SendMessage(GetRemoteHwnd(), LVM_DELETEALLITEMS, 0, 0);\r
1229                         }\r
1230                 }\r
1231                 else\r
1232                 {\r
1233 #if defined(HAVE_OPENVMS)\r
1234                         /* OpenVMS\82Ì\8fê\8d\87\8bó\83f\83B\83\8c\83N\83g\83\8a\88Ú\93®\82Ì\8e\9e\82É\8fo\82é\82Ì\82Å\81A\83\81\83b\83Z\81[\83W\82¾\82¯\8fo\82³\82È\82¢\r
1235                          * \82æ\82¤\82É\82·\82é(VIEW\82Í\83N\83\8a\83A\82µ\82Ä\97Ç\82¢) */\r
1236                         if (AskHostType() != HTYPE_VMS)\r
1237 #endif\r
1238                         SetTaskMsg(MSGJPN049);\r
1239                         SendMessage(GetRemoteHwnd(), LVM_DELETEALLITEMS, 0, 0);\r
1240                 }\r
1241 \r
1242 //              SetCursor(LoadCursor(NULL, IDC_ARROW));\r
1243                 EnableUserOpe();\r
1244 \r
1245         }\r
1246 \r
1247 //#pragma aaa\r
1248 //DoPrintf("===== GetRemoteDirForWnd Done");\r
1249 \r
1250         return;\r
1251 }\r
1252 \r
1253 \r
1254 /*----- \83\8d\81[\83J\83\8b\91¤\82Ì\83t\83@\83C\83\8b\88ê\97\97\83E\83C\83\93\83h\83E\82É\83t\83@\83C\83\8b\96¼\82ð\83Z\83b\83g ----------------\r
1255 *\r
1256 *       Parameter\r
1257 *               \82È\82µ\r
1258 *\r
1259 *       Return Value\r
1260 *               \82È\82µ\r
1261 *----------------------------------------------------------------------------*/\r
1262 \r
1263 void GetLocalDirForWnd(void)\r
1264 {\r
1265         HANDLE fHnd;\r
1266         WIN32_FIND_DATA Find;\r
1267         char Scan[FMAX_PATH+1];\r
1268         char *Pos;\r
1269         char Buf[10];\r
1270         FILETIME Time;\r
1271         FLISTANCHOR Anchor;\r
1272         DWORD NoDrives;\r
1273         int Tmp;\r
1274 \r
1275         Anchor.Top = NULL;\r
1276         Anchor.Files = 0;\r
1277 \r
1278         DoLocalPWD(Scan);\r
1279         SetLocalDirHist(Scan);\r
1280         DispLocalFreeSpace(Scan);\r
1281 \r
1282         /* \83f\83B\83\8c\83N\83g\83\8a\81^\83t\83@\83C\83\8b */\r
1283 \r
1284         SetYenTail(Scan);\r
1285         strcat(Scan, "*");\r
1286         if((fHnd = FindFirstFileAttr(Scan, &Find, DispIgnoreHide)) != INVALID_HANDLE_VALUE)\r
1287         {\r
1288                 do\r
1289                 {\r
1290                         if((strcmp(Find.cFileName, ".") != 0) &&\r
1291                            (strcmp(Find.cFileName, "..") != 0))\r
1292                         {\r
1293                                 if((DotFile == YES) || (Find.cFileName[0] != '.'))\r
1294                                 {\r
1295                                         if(Find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)\r
1296                                                 AddDispFileList(&Anchor, Find.cFileName, &Find.ftLastWriteTime, MakeLongLong(Find.nFileSizeHigh, Find.nFileSizeLow), 0, NODE_DIR, NO, "", FINFO_ALL, WIN_LOCAL);\r
1297                                         else\r
1298                                         {\r
1299                                                 if(AskFilterStr(Find.cFileName, NODE_FILE) == YES)\r
1300                                                 {\r
1301                                                         AddDispFileList(&Anchor, Find.cFileName, &Find.ftLastWriteTime, MakeLongLong(Find.nFileSizeHigh, Find.nFileSizeLow), 0, NODE_FILE, NO, "", FINFO_ALL, WIN_LOCAL);\r
1302                                                 }\r
1303                                         }\r
1304                                 }\r
1305                         }\r
1306                 }\r
1307                 while(FindNextFileAttr(fHnd, &Find, DispIgnoreHide) == TRUE);\r
1308                 FindClose(fHnd);\r
1309         }\r
1310 \r
1311         /* \83h\83\89\83C\83u */\r
1312         if(DispDrives)\r
1313         {\r
1314                 GetLogicalDriveStrings(FMAX_PATH, Scan);\r
1315                 NoDrives = LoadHideDriveListRegistory();\r
1316 \r
1317                 Pos = Scan;\r
1318                 while(*Pos != NUL)\r
1319                 {\r
1320                         Tmp = toupper(*Pos) - 'A';\r
1321                         if((NoDrives & (0x00000001 << Tmp)) == 0)\r
1322                         {\r
1323                                 sprintf(Buf, "%s", Pos);\r
1324                                 memset(&Time, 0, sizeof(FILETIME));\r
1325                                 AddDispFileList(&Anchor, Buf, &Time, 0, 0, NODE_DRIVE, NO, "", FINFO_ALL, WIN_LOCAL);\r
1326                         }\r
1327                         Pos = strchr(Pos, NUL) + 1;\r
1328                 }\r
1329         }\r
1330 \r
1331         DispFileList2View(GetLocalHwnd(), &Anchor);\r
1332         EraseDispFileList(&Anchor);\r
1333 \r
1334         // \90æ\93ª\82Ì\83A\83C\83e\83\80\82ð\91I\91ð\r
1335         ListView_SetItemState(GetLocalHwnd(), 0, LVIS_FOCUSED, LVIS_FOCUSED);\r
1336 \r
1337         return;\r
1338 }\r
1339 \r
1340 \r
1341 /*----- \83t\83@\83C\83\8b\8fî\95ñ\82ð\83t\83@\83C\83\8b\88ê\97\97\97p\83\8a\83X\83g\82É\93o\98^\82·\82é --------------------------\r
1342 *\r
1343 *       Parameter\r
1344 *               FLISTANCHOR *Anchor : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
1345 *               char *Name : \83t\83@\83C\83\8b\96¼\r
1346 *               FILETIME *Time : \93ú\95t\r
1347 *               LONGLONG Size : \83T\83C\83Y\r
1348 *               int Attr : \91®\90«\r
1349 *               int Type : \83^\83C\83v (NODE_xxxx)\r
1350 *               int Link : \83\8a\83\93\83N\82©\82Ç\82¤\82© (YES/NO)\r
1351 *               char *Owner : \83I\81[\83i\96¼\r
1352 *               int InfoExist : \8fî\95ñ\82ª\82 \82é\82©\82Ç\82¤\82© (FINFO_xxx)\r
1353 *               int Win : \83E\83B\83\93\83h\83E\94Ô\8d\86 (WIN_xxxx)\r
1354 *\r
1355 *       Return Value\r
1356 *               \82È\82µ\r
1357 *----------------------------------------------------------------------------*/\r
1358 \r
1359 static void AddDispFileList(FLISTANCHOR *Anchor, char *Name, FILETIME *Time, LONGLONG Size, int Attr, int Type, int Link, char *Owner, int InfoExist, int Win)\r
1360 {\r
1361         int i;\r
1362         FILELIST *Pos;\r
1363         FILELIST *Prev;\r
1364         FILELIST *New;\r
1365         int FileSort;\r
1366         int DirSort;\r
1367         int Sort;\r
1368         LONGLONG Cmp;\r
1369 \r
1370         FileSort = AskSortType(ITEM_LFILE);\r
1371         DirSort = AskSortType(ITEM_LDIR);\r
1372         if(Win == WIN_REMOTE)\r
1373         {\r
1374                 FileSort = AskSortType(ITEM_RFILE);\r
1375                 DirSort = AskSortType(ITEM_RDIR);\r
1376         }\r
1377 \r
1378         Pos = Anchor->Top;\r
1379         for(i = 0; i < Anchor->Files; i++)\r
1380         {\r
1381                 if((Type == NODE_DIR) && (Pos->Node == NODE_FILE))\r
1382                         break;\r
1383                 if((Type == NODE_FILE) && (Pos->Node == NODE_DRIVE))\r
1384                         break;\r
1385 \r
1386                 if(Type == Pos->Node)\r
1387                 {\r
1388                         if(Type == NODE_DIR)\r
1389                                 Sort = DirSort;\r
1390                         else\r
1391                                 Sort = FileSort;\r
1392 \r
1393                         if((Sort & SORT_GET_ORD) == SORT_ASCENT)\r
1394                         {\r
1395                                 if((((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
1396                                         ((Cmp = _mbsicmp(GetFileExt(Name), GetFileExt(Pos->File))) < 0)) ||\r
1397                                    (((Sort & SORT_MASK_ORD) == SORT_SIZE) &&\r
1398                                         ((Cmp = Size - Pos->Size) < 0)) ||\r
1399                                    (((Sort & SORT_MASK_ORD) == SORT_DATE) &&\r
1400                                         ((Cmp = CompareFileTime(Time, &Pos->Time)) < 0)))\r
1401                                 {\r
1402                                         break;\r
1403                                 }\r
1404 \r
1405                                 if(((Sort & SORT_MASK_ORD) == SORT_NAME) || (Cmp == 0))\r
1406                                 {\r
1407                                         if(_mbsicmp(Name, Pos->File) < 0)\r
1408                                                 break;\r
1409                                 }\r
1410                         }\r
1411                         else\r
1412                         {\r
1413                                 if((((Sort & SORT_MASK_ORD) == SORT_EXT) &&\r
1414                                         ((Cmp = _mbsicmp(GetFileExt(Name), GetFileExt(Pos->File))) > 0)) ||\r
1415                                    (((Sort & SORT_MASK_ORD) == SORT_SIZE) &&\r
1416                                         ((Cmp = Size - Pos->Size) > 0)) ||\r
1417                                    (((Sort & SORT_MASK_ORD) == SORT_DATE) &&\r
1418                                         ((Cmp = CompareFileTime(Time, &Pos->Time)) > 0)))\r
1419                                 {\r
1420                                         break;\r
1421                                 }\r
1422 \r
1423                                 if(((Sort & SORT_MASK_ORD) == SORT_NAME) || (Cmp == 0))\r
1424                                 {\r
1425                                         if(_mbsicmp(Name, Pos->File) > 0)\r
1426                                                 break;\r
1427                                 }\r
1428                         }\r
1429                 }\r
1430                 Prev = Pos;\r
1431                 Pos = Pos->Next;\r
1432         }\r
1433 \r
1434         if((New = malloc(sizeof(FILELIST))) != NULL)\r
1435         {\r
1436                 strcpy(New->File, Name);\r
1437                 New->Node = Type;\r
1438                 New->Link = Link;\r
1439                 New->Size = Size;\r
1440                 New->Attr = Attr;\r
1441                 New->Time = *Time;\r
1442                 strcpy(New->Owner, Owner);\r
1443                 New->InfoExist = InfoExist;\r
1444 \r
1445                 if(Pos == Anchor->Top)\r
1446                 {\r
1447                         New->Next = Anchor->Top;\r
1448                         Anchor->Top = New;\r
1449                 }\r
1450                 else\r
1451                 {\r
1452                         New->Next = Prev->Next;\r
1453                         Prev->Next = New;\r
1454                 }\r
1455                 Anchor->Files += 1;\r
1456         }\r
1457         return;\r
1458 }\r
1459 \r
1460 \r
1461 /*----- \83t\83@\83C\83\8b\88ê\97\97\97p\83\8a\83X\83g\82ð\83N\83\8a\83A\82·\82é --------------------------------------\r
1462 *\r
1463 *       Parameter\r
1464 *               FLISTANCHOR *Anchor : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
1465 *\r
1466 *       Return Value\r
1467 *               \82È\82µ\r
1468 *----------------------------------------------------------------------------*/\r
1469 \r
1470 static void EraseDispFileList(FLISTANCHOR *Anchor)\r
1471 {\r
1472         FILELIST *Pos;\r
1473         FILELIST *Next;\r
1474         int i;\r
1475 \r
1476         Pos = Anchor->Top;\r
1477         for(i = 0; i < Anchor->Files; i++)\r
1478         {\r
1479                 Next = Pos->Next;\r
1480                 free(Pos);\r
1481                 Pos = Next;\r
1482         }\r
1483         Anchor->Files = 0;\r
1484         Anchor->Top = NULL;\r
1485         return;\r
1486 }\r
1487 \r
1488 \r
1489 /*----- \83t\83@\83C\83\8b\88ê\97\97\97p\83\8a\83X\83g\82Ì\93à\97e\82ð\83t\83@\83C\83\8b\88ê\97\97\83E\83C\83\93\83h\83E\82É\83Z\83b\83g ------------\r
1490 *\r
1491 *       Parameter\r
1492 *               HWND hWnd : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
1493 *               FLISTANCHOR *Anchor : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
1494 *\r
1495 *       Return Value\r
1496 *               \82È\82µ\r
1497 *----------------------------------------------------------------------------*/\r
1498 \r
1499 static void DispFileList2View(HWND hWnd, FLISTANCHOR *Anchor)\r
1500 {\r
1501         int i;\r
1502         FILELIST *Pos;\r
1503 \r
1504         SendMessage(hWnd, WM_SETREDRAW, (WPARAM)FALSE, 0);\r
1505         SendMessage(hWnd, LVM_DELETEALLITEMS, 0, 0);\r
1506 \r
1507         Pos = Anchor->Top;\r
1508         for(i = 0; i < Anchor->Files; i++)\r
1509         {\r
1510                 AddListView(hWnd, -1, Pos->File, Pos->Node, Pos->Size, &Pos->Time, Pos->Attr, Pos->Owner, Pos->Link, Pos->InfoExist);\r
1511                 Pos = Pos->Next;\r
1512         }\r
1513 \r
1514         SendMessage(hWnd, WM_SETREDRAW, (WPARAM)TRUE, 0);\r
1515         UpdateWindow(hWnd);\r
1516 \r
1517         DispSelectedSpace();\r
1518         return;\r
1519 }\r
1520 \r
1521 \r
1522 /*----- \83t\83@\83C\83\8b\88ê\97\97\83E\83C\83\93\83h\83E\81i\83\8a\83X\83g\83r\83\85\81[\81j\82É\92Ç\89Á --------------------------\r
1523 *\r
1524 *       Parameter\r
1525 *               HWND hWnd : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
1526 *               int Pos : \91}\93ü\88Ê\92u\r
1527 *               char *Name : \96¼\91O\r
1528 *               int Type : \83^\83C\83v (NIDE_xxxx)\r
1529 *               LONGLONG Size : \83T\83C\83Y\r
1530 *               FILETIME *Time : \93ú\95t\r
1531 *               int Attr : \91®\90«\r
1532 *               char Owner : \83I\81[\83i\96¼\r
1533 *               int Link : \83\8a\83\93\83N\82©\82Ç\82¤\82©\r
1534 *               int InfoExist : \8fî\95ñ\82ª\82 \82é\82©\82Ç\82¤\82© (FINFO_xxx)\r
1535 *\r
1536 *       Return Value\r
1537 *               \82È\82µ\r
1538 *----------------------------------------------------------------------------*/\r
1539 \r
1540 static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, FILETIME *Time, int Attr, char *Owner, int Link, int InfoExist)\r
1541 {\r
1542         LV_ITEM LvItem;\r
1543         char Tmp[20];\r
1544 \r
1545         if(Pos == -1)\r
1546                 Pos = SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0);\r
1547 \r
1548         /* \83A\83C\83R\83\93/\83t\83@\83C\83\8b\96¼ */\r
1549         LvItem.mask = LVIF_TEXT | LVIF_IMAGE;\r
1550         LvItem.iItem = Pos;\r
1551         LvItem.iSubItem = 0;\r
1552         LvItem.pszText = Name;\r
1553         if((Type == NODE_FILE) && (AskTransferTypeAssoc(Name, TYPE_X) == TYPE_I))\r
1554                 Type = 3;\r
1555         if(Link == NO)\r
1556                 LvItem.iImage = Type;\r
1557         else\r
1558                 LvItem.iImage = 4;\r
1559         LvItem.iItem = SendMessage(hWnd, LVM_INSERTITEM, 0, (LPARAM)&LvItem);\r
1560 \r
1561         /* \93ú\95t/\8e\9e\8d\8f */\r
1562         FileTime2TimeString(Time, Tmp, DISPFORM_LEGACY, InfoExist);\r
1563         LvItem.mask = LVIF_TEXT;\r
1564         LvItem.iItem = Pos;\r
1565         LvItem.iSubItem = 1;\r
1566         LvItem.pszText = Tmp;\r
1567         LvItem.iItem = SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&LvItem);\r
1568 \r
1569         /* \83T\83C\83Y */\r
1570         if(Type == NODE_DIR)\r
1571                 strcpy(Tmp, "<DIR>");\r
1572         else if(Type == NODE_DRIVE)\r
1573                 strcpy(Tmp, "<DRIVE>");\r
1574         else if(Size >= 0)\r
1575                 MakeNumString(Size, Tmp, TRUE);\r
1576         else\r
1577                 strcpy(Tmp, "");\r
1578         LvItem.mask = LVIF_TEXT;\r
1579         LvItem.iItem = Pos;\r
1580         LvItem.iSubItem = 2;\r
1581         LvItem.pszText = Tmp;\r
1582         LvItem.iItem = SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&LvItem);\r
1583 \r
1584         /* \8ag\92£\8eq */\r
1585         LvItem.mask = LVIF_TEXT;\r
1586         LvItem.iItem = Pos;\r
1587         LvItem.iSubItem = 3;\r
1588         LvItem.pszText = GetFileExt(Name);\r
1589         LvItem.iItem = SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&LvItem);\r
1590 \r
1591         if(hWnd == GetRemoteHwnd())\r
1592         {\r
1593                 /* \91®\90« */\r
1594                 strcpy(Tmp, "");\r
1595                 if(InfoExist & FINFO_ATTR)\r
1596                         AttrValue2String(Attr, Tmp);\r
1597                 LvItem.mask = LVIF_TEXT;\r
1598                 LvItem.iItem = Pos;\r
1599                 LvItem.iSubItem = 4;\r
1600                 LvItem.pszText = Tmp;\r
1601                 LvItem.iItem = SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&LvItem);\r
1602 \r
1603                 /* \83I\81[\83i\96¼ */\r
1604                 LvItem.mask = LVIF_TEXT;\r
1605                 LvItem.iItem = Pos;\r
1606                 LvItem.iSubItem = 5;\r
1607                 LvItem.pszText = Owner;\r
1608                 LvItem.iItem = SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&LvItem);\r
1609         }\r
1610         return;\r
1611 }\r
1612 \r
1613 \r
1614 /*----- \83t\83@\83C\83\8b\96¼\88ê\97\97\83E\83C\83\93\83h\83E\82ð\83\\81[\83g\82µ\92¼\82· --------------------------------\r
1615 *\r
1616 *       Parameter\r
1617 *               int Win : \83E\83B\83\93\83h\83E\94Ô\8d\86 (WIN_xxxx)\r
1618 *\r
1619 *       Return Value\r
1620 *               \82È\82µ\r
1621 *----------------------------------------------------------------------------*/\r
1622 \r
1623 void ReSortDispList(int Win, int *CancelCheckWork)\r
1624 {\r
1625         if(Win == WIN_REMOTE)\r
1626                 GetRemoteDirForWnd(CACHE_LASTREAD, CancelCheckWork);\r
1627         else\r
1628                 GetLocalDirForWnd();\r
1629         return;\r
1630 }\r
1631 \r
1632 \r
1633 /*----- \83t\83@\83C\83\8b\88ê\97\97\83E\83C\83\93\83h\83E\82Ì\83t\83@\83C\83\8b\82ð\91I\91ð\82·\82é ----------------------------\r
1634 *\r
1635 *       Parameter\r
1636 *               HWND hWnd : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
1637 *               int Type : \91I\91ð\95û\96@ (SELECT_xxx)\r
1638 *\r
1639 *       Return Value\r
1640 *               \82È\82µ\r
1641 *----------------------------------------------------------------------------*/\r
1642 \r
1643 void SelectFileInList(HWND hWnd, int Type)\r
1644 {\r
1645         int Win;\r
1646         int WinDst;\r
1647         int i;\r
1648         int Num;\r
1649         char RegExp[FMAX_PATH+1];\r
1650         char Name[FMAX_PATH+1];\r
1651         LV_ITEM LvItem;\r
1652         int CsrPos;\r
1653         FILETIME Time1;\r
1654         FILETIME Time2;\r
1655         int Find;\r
1656 \r
1657         Win = WIN_LOCAL;\r
1658         WinDst = WIN_REMOTE;\r
1659         if(hWnd == GetRemoteHwnd())\r
1660         {\r
1661                 Win = WIN_REMOTE;\r
1662                 WinDst = WIN_LOCAL;\r
1663         }\r
1664 \r
1665         Num = GetItemCount(Win);\r
1666         switch(Type)\r
1667         {\r
1668                 case SELECT_ALL :\r
1669                         LvItem.state = 0;\r
1670                         if(GetSelectedCount(Win) <= 1)\r
1671                                 LvItem.state = LVIS_SELECTED;\r
1672                         for(i = 0; i < Num; i++)\r
1673                         {\r
1674                                 if(GetNodeType(Win, i) != NODE_DRIVE)\r
1675                                 {\r
1676                                         LvItem.mask = LVIF_STATE;\r
1677                                         LvItem.iItem = i;\r
1678                                         LvItem.stateMask = LVIS_SELECTED;\r
1679                                         LvItem.iSubItem = 0;\r
1680                                         SendMessage(hWnd, LVM_SETITEMSTATE, i, (LPARAM)&LvItem);\r
1681                                 }\r
1682                         }\r
1683                         break;\r
1684 \r
1685                 case SELECT_REGEXP :\r
1686                         if(((Win == WIN_LOCAL) &&\r
1687                                 (DialogBox(GetFtpInst(), MAKEINTRESOURCE(sel_local_dlg), hWnd, SelectDialogCallBack) == YES)) ||\r
1688                            ((Win == WIN_REMOTE) &&\r
1689                                 (DialogBox(GetFtpInst(), MAKEINTRESOURCE(sel_remote_dlg), hWnd, SelectDialogCallBack) == YES)))\r
1690                         {\r
1691                                 strcpy(RegExp, FindStr);\r
1692 //                              if(FindMode == 0)\r
1693 //                                      WildCard2RegExp(RegExp);\r
1694 \r
1695                                 _mbslwr(RegExp);\r
1696                                 if((FindMode == 0) || (JreCompileStr(RegExp) == TRUE))\r
1697                                 {\r
1698                                         CsrPos = -1;\r
1699                                         for(i = 0; i < Num; i++)\r
1700                                         {\r
1701                                                 GetNodeName(Win, i, Name, FMAX_PATH);\r
1702                                                 Find = FindNameNode(WinDst, Name);\r
1703 \r
1704                                                 _mbslwr(Name);\r
1705                                                 LvItem.state = 0;\r
1706                                                 if(GetNodeType(Win, i) != NODE_DRIVE)\r
1707                                                 {\r
1708                                                         if(((FindMode == 0) && (CheckFname(Name, RegExp) == SUCCESS)) ||\r
1709                                                            ((FindMode != 0) && (JreGetStrMatchInfo(Name, 0) != NULL)))\r
1710                                                         {\r
1711                                                                 LvItem.state = LVIS_SELECTED;\r
1712 \r
1713                                                                 if(Find >= 0)\r
1714                                                                 {\r
1715                                                                         if(IgnoreExist == YES)\r
1716                                                                                 LvItem.state = 0;\r
1717 \r
1718                                                                         if((LvItem.state != 0) && (IgnoreNew == YES))\r
1719                                                                         {\r
1720                                                                                 GetNodeTime(Win, i, &Time1);\r
1721                                                                                 GetNodeTime(WinDst, Find, &Time2);\r
1722                                                                                 if(CompareFileTime(&Time1, &Time2) > 0)\r
1723                                                                                         LvItem.state = 0;\r
1724                                                                         }\r
1725 \r
1726                                                                         if((LvItem.state != 0) && (IgnoreOld == YES))\r
1727                                                                         {\r
1728                                                                                 GetNodeTime(Win, i, &Time1);\r
1729                                                                                 GetNodeTime(WinDst, Find, &Time2);\r
1730                                                                                 if(CompareFileTime(&Time1, &Time2) < 0)\r
1731                                                                                         LvItem.state = 0;\r
1732                                                                         }\r
1733                                                                 }\r
1734                                                         }\r
1735                                                 }\r
1736 \r
1737                                                 if((LvItem.state != 0) && (CsrPos == -1))\r
1738                                                         CsrPos = i;\r
1739 \r
1740                                                 LvItem.mask = LVIF_STATE;\r
1741                                                 LvItem.iItem = i;\r
1742                                                 LvItem.stateMask = LVIS_SELECTED;\r
1743                                                 LvItem.iSubItem = 0;\r
1744                                                 SendMessage(hWnd, LVM_SETITEMSTATE, i, (LPARAM)&LvItem);\r
1745                                         }\r
1746                                         if(CsrPos != -1)\r
1747                                         {\r
1748                                                 LvItem.mask = LVIF_STATE;\r
1749                                                 LvItem.iItem = CsrPos;\r
1750                                                 LvItem.state = LVIS_FOCUSED;\r
1751                                                 LvItem.stateMask = LVIS_FOCUSED;\r
1752                                                 LvItem.iSubItem = 0;\r
1753                                                 SendMessage(hWnd, LVM_SETITEMSTATE, CsrPos, (LPARAM)&LvItem);\r
1754                                                 SendMessage(hWnd, LVM_ENSUREVISIBLE, CsrPos, (LPARAM)TRUE);\r
1755                                         }\r
1756                                 }\r
1757                         }\r
1758                         break;\r
1759         }\r
1760         return;\r
1761 }\r
1762 \r
1763 \r
1764 /*----- \91I\91ð\83_\83C\83A\83\8d\83O\82Ì\83R\81[\83\8b\83o\83b\83N ------------------------------------------\r
1765 *\r
1766 *       Parameter\r
1767 *               HWND hDlg : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
1768 *               UINT message : \83\81\83b\83Z\81[\83W\94Ô\8d\86\r
1769 *               WPARAM wParam : \83\81\83b\83Z\81[\83W\82Ì WPARAM \88ø\90\94\r
1770 *               LPARAM lParam : \83\81\83b\83Z\81[\83W\82Ì LPARAM \88ø\90\94\r
1771 *\r
1772 *       Return Value\r
1773 *               BOOL TRUE/FALSE\r
1774 *----------------------------------------------------------------------------*/\r
1775 \r
1776 static BOOL CALLBACK SelectDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1777 {\r
1778         switch (iMessage)\r
1779         {\r
1780                 case WM_INITDIALOG :\r
1781                         SendDlgItemMessage(hDlg, SEL_FNAME, EM_LIMITTEXT, 40, 0);\r
1782                         SendDlgItemMessage(hDlg, SEL_FNAME, WM_SETTEXT, 0, (LPARAM)FindStr);\r
1783                         SendDlgItemMessage(hDlg, SEL_REGEXP, BM_SETCHECK, FindMode, 0);\r
1784                         SendDlgItemMessage(hDlg, SEL_NOOLD, BM_SETCHECK, IgnoreOld, 0);\r
1785                         SendDlgItemMessage(hDlg, SEL_NONEW, BM_SETCHECK, IgnoreNew, 0);\r
1786                         SendDlgItemMessage(hDlg, SEL_NOEXIST, BM_SETCHECK, IgnoreExist, 0);\r
1787                         return(TRUE);\r
1788 \r
1789                 case WM_COMMAND :\r
1790                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
1791                         {\r
1792                                 case IDOK :\r
1793                                         SendDlgItemMessage(hDlg, SEL_FNAME, WM_GETTEXT, 40+1, (LPARAM)FindStr);\r
1794                                         FindMode = SendDlgItemMessage(hDlg, SEL_REGEXP, BM_GETCHECK, 0, 0);\r
1795                                         IgnoreOld = SendDlgItemMessage(hDlg, SEL_NOOLD, BM_GETCHECK, 0, 0);\r
1796                                         IgnoreNew = SendDlgItemMessage(hDlg, SEL_NONEW, BM_GETCHECK, 0, 0);\r
1797                                         IgnoreExist = SendDlgItemMessage(hDlg, SEL_NOEXIST, BM_GETCHECK, 0, 0);\r
1798                                         EndDialog(hDlg, YES);\r
1799                                         break;\r
1800 \r
1801                                 case IDCANCEL :\r
1802                                         EndDialog(hDlg, NO);\r
1803                                         break;\r
1804 \r
1805                                 case IDHELP :\r
1806                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000061);\r
1807                                         break;\r
1808                         }\r
1809             return(TRUE);\r
1810         }\r
1811         return(FALSE);\r
1812 }\r
1813 \r
1814 \r
1815 /*----- \83t\83@\83C\83\8b\88ê\97\97\83E\83C\83\93\83h\83E\82Ì\83t\83@\83C\83\8b\82ð\8c\9f\8dõ\82·\82é ----------------------------\r
1816 *\r
1817 *       Parameter\r
1818 *               HWND hWnd : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
1819 *               int Type : \8c\9f\8dõ\95û\96@ (FIND_xxx)\r
1820 *\r
1821 *       Return Value\r
1822 *               \82È\82µ\r
1823 *----------------------------------------------------------------------------*/\r
1824 \r
1825 void FindFileInList(HWND hWnd, int Type)\r
1826 {\r
1827         int Win;\r
1828         int i;\r
1829         int Num;\r
1830         static char RegExp[FMAX_PATH+1] = { "" };\r
1831         char Name[FMAX_PATH+1];\r
1832         LV_ITEM LvItem;\r
1833         char *Title;\r
1834 \r
1835         Win = WIN_LOCAL;\r
1836         Title = MSGJPN050;\r
1837         if(hWnd == GetRemoteHwnd())\r
1838         {\r
1839                 Win = WIN_REMOTE;\r
1840                 Title = MSGJPN051;\r
1841         }\r
1842 \r
1843         Num = GetItemCount(Win);\r
1844         switch(Type)\r
1845         {\r
1846                 case FIND_FIRST :\r
1847                         if(InputDialogBox(find_dlg, hWnd, Title, FindStr, 40+1, &FindMode, IDH_HELP_TOPIC_0000001) == YES)\r
1848                         {\r
1849                                 strcpy(RegExp, FindStr);\r
1850 //                              if(FindMode == 0)\r
1851 //                                      WildCard2RegExp(RegExp);\r
1852 \r
1853                                 _mbslwr(RegExp);\r
1854                                 if((FindMode == 0) || (JreCompileStr(RegExp) == TRUE))\r
1855                                 {\r
1856                                         for(i = GetCurrentItem(Win)+1; i < Num; i++)\r
1857                                         {\r
1858                                                 GetNodeName(Win, i, Name, FMAX_PATH);\r
1859                                                 _mbslwr(Name);\r
1860 \r
1861                                                 LvItem.state = 0;\r
1862                                                 if(((FindMode == 0) && (CheckFname(Name, RegExp) == SUCCESS)) ||\r
1863                                                    ((FindMode != 0) && (JreGetStrMatchInfo(Name, 0) != NULL)))\r
1864                                                 {\r
1865                                                         LvItem.mask = LVIF_STATE;\r
1866                                                         LvItem.iItem = i;\r
1867                                                         LvItem.state = LVIS_FOCUSED;\r
1868                                                         LvItem.stateMask = LVIS_FOCUSED;\r
1869                                                         LvItem.iSubItem = 0;\r
1870                                                         SendMessage(hWnd, LVM_SETITEMSTATE, i, (LPARAM)&LvItem);\r
1871                                                         SendMessage(hWnd, LVM_ENSUREVISIBLE, i, (LPARAM)TRUE);\r
1872                                                         break;\r
1873                                                 }\r
1874                                         }\r
1875                                 }\r
1876                         }\r
1877                         break;\r
1878 \r
1879                 case FIND_NEXT :\r
1880                         for(i = GetCurrentItem(Win)+1; i < Num; i++)\r
1881                         {\r
1882                                 GetNodeName(Win, i, Name, FMAX_PATH);\r
1883                                 _mbslwr(Name);\r
1884 \r
1885                                 LvItem.state = 0;\r
1886                                 if(((FindMode == 0) && (CheckFname(Name, RegExp) == SUCCESS)) ||\r
1887                                    ((FindMode != 0) && (JreGetStrMatchInfo(Name, 0) != NULL)))\r
1888                                 {\r
1889                                         LvItem.mask = LVIF_STATE;\r
1890                                         LvItem.iItem = i;\r
1891                                         LvItem.state = LVIS_FOCUSED;\r
1892                                         LvItem.stateMask = LVIS_FOCUSED;\r
1893                                         LvItem.iSubItem = 0;\r
1894                                         SendMessage(hWnd, LVM_SETITEMSTATE, i, (LPARAM)&LvItem);\r
1895                                         SendMessage(hWnd, LVM_ENSUREVISIBLE, i, (LPARAM)TRUE);\r
1896                                         break;\r
1897                                 }\r
1898                         }\r
1899                         break;\r
1900         }\r
1901         return;\r
1902 }\r
1903 \r
1904 \r
1905 #if 0\r
1906 /*----- \83\8f\83C\83\8b\83h\83J\81[\83h\82ð\90³\8bK\95\\8c»\82É\95Ï\8a·\82·\82é ------------------------------------\r
1907 *\r
1908 *       Parameter\r
1909 *               char *Str : \95\8e\9a\97ñ\r
1910 *\r
1911 *       Return Value\r
1912 *               \82È\82µ\r
1913 *----------------------------------------------------------------------------*/\r
1914 \r
1915 void WildCard2RegExp(char *Str)\r
1916 {\r
1917         char Tmp[FMAX_PATH+1];\r
1918         char *Org;\r
1919         char *Pos;\r
1920         UINT Ch;\r
1921 \r
1922         Org = Str;\r
1923         Pos = Tmp;\r
1924 \r
1925         *Pos++ = '^';\r
1926         *Pos++ = '(';\r
1927         while(*Str != NUL)\r
1928         {\r
1929                 if(Pos >= Tmp + FMAX_PATH - 3)\r
1930                         break;\r
1931 \r
1932                 Ch = _mbsnextc(Str);\r
1933                 Str = _mbsinc(Str);\r
1934 \r
1935                 if(Ch <= 0x7F)\r
1936                 {\r
1937                         if(strchr("[]()^$.+", Ch) != NULL)\r
1938                         {\r
1939                                 *Pos++ = '\\';\r
1940                                 *Pos++ = Ch;\r
1941                         }\r
1942                         else if(Ch == '*')\r
1943                         {\r
1944                                 *Pos++ = '.';\r
1945                                 *Pos++ = '*';\r
1946                         }\r
1947                         else if(Ch == '?')\r
1948                                 *Pos++ = '.';\r
1949                         else if(Ch == '|')\r
1950                         {\r
1951                                 *Pos++ = '|';\r
1952                         }\r
1953                         else\r
1954                                 *Pos++ = Ch;\r
1955                 }\r
1956                 else\r
1957                 {\r
1958                         _mbsnset(Pos, Ch, 1);\r
1959                         Pos = _mbsinc(Pos);\r
1960                 }\r
1961         }\r
1962         *Pos++ = ')';\r
1963         *Pos++ = '$';\r
1964         *Pos = NUL;\r
1965         strcpy(Org, Tmp);\r
1966 \r
1967         return;\r
1968 }\r
1969 #endif\r
1970 \r
1971 \r
1972 /*----- \83J\81[\83\\83\8b\88Ê\92u\82Ì\83A\83C\83e\83\80\94Ô\8d\86\82ð\95Ô\82· --------------------------------------\r
1973 *\r
1974 *       Parameter\r
1975 *               int Win : \83E\83B\83\93\83h\83E\94Ô\8d\86 (WIN_xxxx)\r
1976 *\r
1977 *       Return Value\r
1978 *               int \83A\83C\83e\83\80\94Ô\8d\86\r
1979 *----------------------------------------------------------------------------*/\r
1980 \r
1981 int GetCurrentItem(int Win)\r
1982 {\r
1983         HWND hWnd;\r
1984         int Ret;\r
1985 \r
1986         hWnd = GetLocalHwnd();\r
1987         if(Win == WIN_REMOTE)\r
1988                 hWnd = GetRemoteHwnd();\r
1989 \r
1990         if((Ret = SendMessage(hWnd, LVM_GETNEXTITEM, -1, MAKELPARAM(LVNI_ALL | LVNI_FOCUSED, 0))) == -1)\r
1991                 Ret = 0;\r
1992 \r
1993         return(Ret);\r
1994 }\r
1995 \r
1996 \r
1997 /*----- \83A\83C\83e\83\80\90\94\82ð\95Ô\82· ------------------------------------------------------\r
1998 *\r
1999 *       Parameter\r
2000 *               int Win : \83E\83B\83\93\83h\83E\94Ô\8d\86 (WIN_xxxx)\r
2001 *\r
2002 *       Return Value\r
2003 *               int \83A\83C\83e\83\80\90\94\r
2004 *----------------------------------------------------------------------------*/\r
2005 \r
2006 int GetItemCount(int Win)\r
2007 {\r
2008         HWND hWnd;\r
2009 \r
2010         hWnd = GetLocalHwnd();\r
2011         if(Win == WIN_REMOTE)\r
2012                 hWnd = GetRemoteHwnd();\r
2013 \r
2014         return(SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0));\r
2015 }\r
2016 \r
2017 \r
2018 /*----- \91I\91ð\82³\82ê\82Ä\82¢\82é\83A\83C\83e\83\80\90\94\82ð\95Ô\82· ----------------------------------------\r
2019 *\r
2020 *       Parameter\r
2021 *               int Win : \83E\83B\83\93\83h\83E\94Ô\8d\86 (WIN_xxxx)\r
2022 *\r
2023 *       Return Value\r
2024 *               int \91I\91ð\82³\82ê\82Ä\82¢\82é\83A\83C\83e\83\80\90\94\r
2025 *----------------------------------------------------------------------------*/\r
2026 \r
2027 int GetSelectedCount(int Win)\r
2028 {\r
2029         HWND hWnd;\r
2030 \r
2031         hWnd = GetLocalHwnd();\r
2032         if(Win == WIN_REMOTE)\r
2033                 hWnd = GetRemoteHwnd();\r
2034 \r
2035         return(SendMessage(hWnd, LVM_GETSELECTEDCOUNT, 0, 0));\r
2036 }\r
2037 \r
2038 \r
2039 /*----- \91I\91ð\82³\82ê\82Ä\82¢\82é\8dÅ\8f\89\82Ì\83A\83C\83e\83\80\94Ô\8d\86\82ð\95Ô\82· --------------------------------\r
2040 *\r
2041 *       Parameter\r
2042 *               int Win : \83E\83B\83\93\83h\83E\94Ô\8d\86 (WIN_xxxx)\r
2043 *               int All : \91I\82Î\82ê\82Ä\82¢\82È\82¢\82à\82Ì\82ð\8aÜ\82ß\82é\r
2044 *\r
2045 *       Return Value\r
2046 *               int \83A\83C\83e\83\80\94Ô\8d\86\r
2047 *                       -1 = \91I\91ð\82³\82ê\82Ä\82¢\82È\82¢\r
2048 *----------------------------------------------------------------------------*/\r
2049 \r
2050 int GetFirstSelected(int Win, int All)\r
2051 {\r
2052         HWND hWnd;\r
2053         int Ope;\r
2054 \r
2055         hWnd = GetLocalHwnd();\r
2056         if(Win == WIN_REMOTE)\r
2057                 hWnd = GetRemoteHwnd();\r
2058 \r
2059         Ope = LVNI_SELECTED;\r
2060         if(All == YES)\r
2061                 Ope = LVNI_ALL;\r
2062 \r
2063         return(SendMessage(hWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)MAKELPARAM(Ope, 0)));\r
2064 }\r
2065 \r
2066 \r
2067 /*----- \91I\91ð\82³\82ê\82Ä\82¢\82é\8e\9f\82Ì\83A\83C\83e\83\80\94Ô\8d\86\82ð\95Ô\82· ----------------------------------\r
2068 *\r
2069 *       Parameter\r
2070 *               int Win : \83E\83B\83\93\83h\83E\94Ô\8d\86 (WIN_xxxx)\r
2071 *               int Pos : \8d¡\82Ì\83A\83C\83e\83\80\94Ô\8d\86\r
2072 *               int All : \91I\82Î\82ê\82Ä\82¢\82È\82¢\82à\82Ì\82à\8aÜ\82ß\82é\r
2073 *\r
2074 *       Return Value\r
2075 *               int \83A\83C\83e\83\80\94Ô\8d\86\r
2076 *                       -1 = \91I\91ð\82³\82ê\82Ä\82¢\82È\82¢\r
2077 *----------------------------------------------------------------------------*/\r
2078 \r
2079 int GetNextSelected(int Win, int Pos, int All)\r
2080 {\r
2081         HWND hWnd;\r
2082         int Ope;\r
2083 \r
2084         hWnd = GetLocalHwnd();\r
2085         if(Win == WIN_REMOTE)\r
2086                 hWnd = GetRemoteHwnd();\r
2087 \r
2088         Ope = LVNI_SELECTED;\r
2089         if(All == YES)\r
2090                 Ope = LVNI_ALL;\r
2091 \r
2092         return(SendMessage(hWnd, LVM_GETNEXTITEM, (WPARAM)Pos, (LPARAM)MAKELPARAM(Ope, 0)));\r
2093 }\r
2094 \r
2095 \r
2096 /*----- \8ew\92è\82³\82ê\82½\96¼\91O\82Ì\83A\83C\83e\83\80\82ð\92T\82· ----------------------------------------\r
2097 *\r
2098 *       Parameter\r
2099 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2100 *               char *Name : \96¼\91O\r
2101 *\r
2102 *       Return Value\r
2103 *               int \83A\83C\83e\83\80\94Ô\8d\86\r
2104 *                       -1=\8c©\82Â\82©\82ç\82È\82©\82Á\82½\r
2105 *----------------------------------------------------------------------------*/\r
2106 \r
2107 int FindNameNode(int Win, char *Name)\r
2108 {\r
2109         LV_FINDINFO FindInfo;\r
2110         HWND hWnd;\r
2111 \r
2112         hWnd = GetLocalHwnd();\r
2113         if(Win == WIN_REMOTE)\r
2114                 hWnd = GetRemoteHwnd();\r
2115 \r
2116         FindInfo.flags = LVFI_STRING;\r
2117         FindInfo.psz = Name;\r
2118         return(SendMessage(hWnd, LVM_FINDITEM, -1, (LPARAM)&FindInfo));\r
2119 }\r
2120 \r
2121 \r
2122 /*----- \8ew\92è\88Ê\92u\82Ì\83A\83C\83e\83\80\82Ì\96¼\91O\82ð\95Ô\82· ----------------------------------------\r
2123 *\r
2124 *       Parameter\r
2125 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2126 *               int Pos : \88Ê\92u\r
2127 *               char *Buf : \96¼\91O\82ð\95Ô\82·\83o\83b\83t\83@\r
2128 *               int Max : \83o\83b\83t\83@\82Ì\83T\83C\83Y\r
2129 *\r
2130 *       Return Value\r
2131 *               \82È\82µ\r
2132 *----------------------------------------------------------------------------*/\r
2133 \r
2134 void GetNodeName(int Win, int Pos, char *Buf, int Max)\r
2135 {\r
2136         HWND hWnd;\r
2137         LV_ITEM LvItem;\r
2138 \r
2139         hWnd = GetLocalHwnd();\r
2140         if(Win == WIN_REMOTE)\r
2141                 hWnd = GetRemoteHwnd();\r
2142 \r
2143         LvItem.mask = LVIF_TEXT;\r
2144         LvItem.iItem = Pos;\r
2145         LvItem.iSubItem = 0;\r
2146         LvItem.pszText = Buf;\r
2147         LvItem.cchTextMax = Max;\r
2148         SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&LvItem);\r
2149         return;\r
2150 }\r
2151 \r
2152 \r
2153 /*----- \8ew\92è\88Ê\92u\82Ì\83A\83C\83e\83\80\82Ì\93ú\95t\82ð\95Ô\82· ----------------------------------------\r
2154 *\r
2155 *       Parameter\r
2156 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2157 *               int Pos : \88Ê\92u\r
2158 *               FILETIME *Buf : \93ú\95t\82ð\95Ô\82·\83o\83b\83t\83@\r
2159 *\r
2160 *       Return Value\r
2161 *               int \83X\83e\81[\83^\83X\r
2162 *                       YES/NO=\93ú\95t\8fî\95ñ\82ª\82È\82©\82Á\82½\r
2163 *----------------------------------------------------------------------------*/\r
2164 \r
2165 int GetNodeTime(int Win, int Pos, FILETIME *Buf)\r
2166 {\r
2167         HWND hWnd;\r
2168         LV_ITEM LvItem;\r
2169         char Tmp[20];\r
2170         int Ret;\r
2171 \r
2172         hWnd = GetLocalHwnd();\r
2173         if(Win == WIN_REMOTE)\r
2174                 hWnd = GetRemoteHwnd();\r
2175 \r
2176         LvItem.mask = LVIF_TEXT;\r
2177         LvItem.iItem = Pos;\r
2178         LvItem.iSubItem = 1;\r
2179         LvItem.pszText = Tmp;\r
2180         LvItem.cchTextMax = 20;\r
2181         SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&LvItem);\r
2182         Ret = TimeString2FileTime(Tmp, Buf);\r
2183         return(Ret);\r
2184 }\r
2185 \r
2186 \r
2187 /*----- \8ew\92è\88Ê\92u\82Ì\83A\83C\83e\83\80\82Ì\83T\83C\83Y\82ð\95Ô\82· --------------------------------------\r
2188 *\r
2189 *       Parameter\r
2190 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2191 *               int Pos : \88Ê\92u\r
2192 *               int *Buf : \83T\83C\83Y\82ð\95Ô\82·\83\8f\81[\83N\r
2193 *\r
2194 *       Return Value\r
2195 *               int \83X\83e\81[\83^\83X\r
2196 *                       YES/NO=\83T\83C\83Y\8fî\95ñ\82ª\82È\82©\82Á\82½\r
2197 *----------------------------------------------------------------------------*/\r
2198 \r
2199 int GetNodeSize(int Win, int Pos, LONGLONG *Buf)\r
2200 {\r
2201         HWND hWnd;\r
2202         LV_ITEM LvItem;\r
2203         char Tmp[40];\r
2204         int Ret;\r
2205 \r
2206         hWnd = GetLocalHwnd();\r
2207         if(Win == WIN_REMOTE)\r
2208                 hWnd = GetRemoteHwnd();\r
2209 \r
2210         LvItem.mask = LVIF_TEXT;\r
2211         LvItem.iItem = Pos;\r
2212         LvItem.iSubItem = 2;\r
2213         LvItem.pszText = Tmp;\r
2214         LvItem.cchTextMax = 20;\r
2215         SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&LvItem);\r
2216         *Buf = -1;\r
2217         Ret = NO;\r
2218         if(strlen(Tmp) > 0)\r
2219         {\r
2220                 RemoveComma(Tmp);\r
2221                 *Buf = _atoi64(Tmp);\r
2222                 Ret = YES;\r
2223         }\r
2224         return(Ret);\r
2225 }\r
2226 \r
2227 \r
2228 /*----- \8ew\92è\88Ê\92u\82Ì\83A\83C\83e\83\80\82Ì\91®\90«\82ð\95Ô\82· ----------------------------------------\r
2229 *\r
2230 *       Parameter\r
2231 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2232 *               int Pos : \88Ê\92u\r
2233 *               int *Buf : \91®\90«\82ð\95Ô\82·\83\8f\81[\83N\r
2234 *\r
2235 *       Return Value\r
2236 *               int \83X\83e\81[\83^\83X\r
2237 *                       YES/NO=\83T\83C\83Y\8fî\95ñ\82ª\82È\82©\82Á\82½\r
2238 *----------------------------------------------------------------------------*/\r
2239 \r
2240 int GetNodeAttr(int Win, int Pos, int *Buf)\r
2241 {\r
2242         LV_ITEM LvItem;\r
2243         char Tmp[20];\r
2244         int Ret;\r
2245 \r
2246         *Buf = 0;\r
2247         Ret = NO;\r
2248         if(Win == WIN_REMOTE)\r
2249         {\r
2250                 LvItem.mask = LVIF_TEXT;\r
2251                 LvItem.iItem = Pos;\r
2252                 LvItem.iSubItem = 4;\r
2253                 LvItem.pszText = Tmp;\r
2254                 LvItem.cchTextMax = 20;\r
2255                 SendMessage(GetRemoteHwnd(), LVM_GETITEM, 0, (LPARAM)&LvItem);\r
2256                 if(strlen(Tmp) > 0)\r
2257                 {\r
2258                         *Buf = AttrString2Value(Tmp);\r
2259                         Ret = YES;\r
2260                 }\r
2261         }\r
2262         return(Ret);\r
2263 }\r
2264 \r
2265 \r
2266 /*----- \8ew\92è\88Ê\92u\82Ì\83A\83C\83e\83\80\82Ì\83^\83C\83v\82ð\95Ô\82· --------------------------------------\r
2267 *\r
2268 *       Parameter\r
2269 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2270 *               int Pos : \88Ê\92u\r
2271 *\r
2272 *       Return Value\r
2273 *               int \83^\83C\83v (NODE_xxx)\r
2274 *----------------------------------------------------------------------------*/\r
2275 \r
2276 int GetNodeType(int Win, int Pos)\r
2277 {\r
2278         char Tmp[20];\r
2279         LV_ITEM LvItem;\r
2280         int Ret;\r
2281         HWND hWnd;\r
2282 \r
2283         hWnd = GetLocalHwnd();\r
2284         if(Win == WIN_REMOTE)\r
2285                 hWnd = GetRemoteHwnd();\r
2286 \r
2287         LvItem.mask = LVIF_TEXT;\r
2288         LvItem.iItem = Pos;\r
2289         LvItem.iSubItem = 2;\r
2290         LvItem.pszText = Tmp;\r
2291         LvItem.cchTextMax = 20;\r
2292         SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&LvItem);\r
2293 \r
2294         if(strcmp(Tmp, "<DIR>") == 0)\r
2295                 Ret = NODE_DIR;\r
2296         else if(strcmp(Tmp, "<DRIVE>") == 0)\r
2297                 Ret = NODE_DRIVE;\r
2298         else\r
2299                 Ret = NODE_FILE;\r
2300 \r
2301         return(Ret);\r
2302 }\r
2303 \r
2304 \r
2305 /*----- \8ew\92è\88Ê\92u\82Ì\83A\83C\83e\83\80\82Ì\83I\81[\83i\96¼\82ð\95Ô\82· ------------------------------------\r
2306 *\r
2307 *       Parameter\r
2308 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2309 *               int Pos : \88Ê\92u\r
2310 *               char *Buf : \83I\81[\83i\96¼\82ð\95Ô\82·\83o\83b\83t\83@\r
2311 *               int Max : \83o\83b\83t\83@\82Ì\83T\83C\83Y\r
2312 *\r
2313 *       Return Value\r
2314 *               \82È\82µ\r
2315 *----------------------------------------------------------------------------*/\r
2316 \r
2317 void GetNodeOwner(int Win, int Pos, char *Buf, int Max)\r
2318 {\r
2319         LV_ITEM LvItem;\r
2320 \r
2321         strcpy(Buf, "");\r
2322         if(Win == WIN_REMOTE)\r
2323         {\r
2324                 LvItem.mask = LVIF_TEXT;\r
2325                 LvItem.iItem = Pos;\r
2326                 LvItem.iSubItem = 5;\r
2327                 LvItem.pszText = Buf;\r
2328                 LvItem.cchTextMax = Max;\r
2329                 SendMessage(GetRemoteHwnd(), LVM_GETITEM, 0, (LPARAM)&LvItem);\r
2330         }\r
2331         return;\r
2332 }\r
2333 \r
2334 \r
2335 /*----- \83z\83X\83g\91¤\82Ì\83t\83@\83C\83\8b\88ê\97\97\83E\83C\83\93\83h\83E\82ð\83N\83\8a\83A ------------------------------\r
2336 *\r
2337 *       Parameter\r
2338 *               \82È\82µ\r
2339 *\r
2340 *       Return Value\r
2341 *               \82È\82µ\r
2342 *----------------------------------------------------------------------------*/\r
2343 \r
2344 void EraseRemoteDirForWnd(void)\r
2345 {\r
2346         SendMessage(GetRemoteHwnd(), LVM_DELETEALLITEMS, 0, 0);\r
2347         SendMessage(GetRemoteHistHwnd(), CB_RESETCONTENT, 0, 0);\r
2348         return;\r
2349 }\r
2350 \r
2351 \r
2352 /*----- \91I\91ð\82³\82ê\82Ä\82¢\82é\83t\83@\83C\83\8b\82Ì\91\8d\83T\83C\83Y\82ð\95Ô\82· --------------------------------\r
2353 *\r
2354 *       Parameter\r
2355 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2356 *\r
2357 *       Return Value\r
2358 *               double \83T\83C\83Y\r
2359 *----------------------------------------------------------------------------*/\r
2360 \r
2361 double GetSelectedTotalSize(int Win)\r
2362 {\r
2363         double Ret;\r
2364         LONGLONG Size;\r
2365         int Pos;\r
2366 \r
2367         Ret = 0;\r
2368         if(GetSelectedCount(Win) > 0)\r
2369         {\r
2370                 Pos = GetFirstSelected(Win, NO);\r
2371                 while(Pos != -1)\r
2372                 {\r
2373                         GetNodeSize(Win, Pos, &Size);\r
2374                         if(Size >= 0)\r
2375                                 Ret += Size;\r
2376                         Pos = GetNextSelected(Win, Pos, NO);\r
2377                 }\r
2378         }\r
2379         return(Ret);\r
2380 }\r
2381 \r
2382 \r
2383 \r
2384 /*===================================================================\r
2385 \r
2386 ===================================================================*/\r
2387 \r
2388 \r
2389 \r
2390 /*----- \83t\83@\83C\83\8b\88ê\97\97\82Å\91I\82Î\82ê\82Ä\82¢\82é\83t\83@\83C\83\8b\82ð\83\8a\83X\83g\82É\93o\98^\82·\82é ------------------\r
2391 *\r
2392 *       Parameter\r
2393 *               int Win : \83E\83C\83\93\83h\83E\94Ô\8d\86 (WIN_xxx)\r
2394 *               int Expand : \83T\83u\83f\83B\83\8c\83N\83g\83\8a\82ð\93W\8aJ\82·\82é (YES/NO)\r
2395 *               int All : \91I\82Î\82ê\82Ä\82¢\82È\82¢\82à\82Ì\82à\82·\82×\82Ä\93o\98^\82·\82é (YES/NO)\r
2396 *               FILELIST **Base : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
2397 *\r
2398 *       Return Value\r
2399 *               \82È\82µ\r
2400 *----------------------------------------------------------------------------*/\r
2401 \r
2402 void MakeSelectedFileList(int Win, int Expand, int All, FILELIST **Base, int *CancelCheckWork)\r
2403 {\r
2404         int Pos;\r
2405         char Name[FMAX_PATH+1];\r
2406         char Cur[FMAX_PATH+1];\r
2407         FILELIST Pkt;\r
2408         int Node;\r
2409         DWORD Attr;\r
2410         int Ignore;\r
2411 \r
2412         if((All == YES) || (GetSelectedCount(Win) > 0))\r
2413         {\r
2414                 /*===== \83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\82Ì\83t\83@\83C\83\8b =====*/\r
2415 \r
2416                 Pos = GetFirstSelected(Win, All);\r
2417                 while(Pos != -1)\r
2418                 {\r
2419                         Node = GetNodeType(Win, Pos);\r
2420                         if((Node == NODE_FILE) ||\r
2421                            ((Expand == NO) && (Node == NODE_DIR)))\r
2422                         {\r
2423                                 Pkt.InfoExist = 0;\r
2424                                 GetNodeName(Win, Pos, Pkt.File, FMAX_PATH);\r
2425                                 if(GetNodeSize(Win, Pos, &Pkt.Size) == YES)\r
2426                                         Pkt.InfoExist |= FINFO_SIZE;\r
2427                                 if(GetNodeAttr(Win, Pos, &Pkt.Attr) == YES)\r
2428                                         Pkt.InfoExist |= FINFO_ATTR;\r
2429                                 if(GetNodeTime(Win, Pos, &Pkt.Time) == YES)\r
2430                                         Pkt.InfoExist |= (FINFO_TIME | FINFO_DATE);\r
2431                                 Pkt.Node = Node;\r
2432 \r
2433                                 Ignore = NO;\r
2434                                 if((DispIgnoreHide == YES) && (Win == WIN_LOCAL))\r
2435                                 {\r
2436                                         AskLocalCurDir(Cur, FMAX_PATH);\r
2437                                         SetYenTail(Cur);\r
2438                                         strcat(Cur, Pkt.File);\r
2439                                         Attr = GetFileAttributes(Cur);\r
2440                                         if((Attr != 0xFFFFFFFF) && (Attr & FILE_ATTRIBUTE_HIDDEN))\r
2441                                                 Ignore = YES;\r
2442                                 }\r
2443 \r
2444                                 if(Ignore == NO)\r
2445                                         AddFileList(&Pkt, Base);\r
2446                         }\r
2447                         Pos = GetNextSelected(Win, Pos, All);\r
2448                 }\r
2449 \r
2450                 if(Expand == YES)\r
2451                 {\r
2452                         /*===== \83f\83B\83\8c\83N\83g\83\8a\83c\83\8a\81[ =====*/\r
2453 \r
2454                         Pos = GetFirstSelected(Win, All);\r
2455                         while(Pos != -1)\r
2456                         {\r
2457                                 if(GetNodeType(Win, Pos) == NODE_DIR)\r
2458                                 {\r
2459                                         GetNodeName(Win, Pos, Name, FMAX_PATH);\r
2460                                         strcpy(Pkt.File, Name);\r
2461                                         ReplaceAll(Pkt.File, '\\', '/');\r
2462 //8/26\r
2463 \r
2464                                         Ignore = NO;\r
2465                                         if((DispIgnoreHide == YES) && (Win == WIN_LOCAL))\r
2466                                         {\r
2467                                                 AskLocalCurDir(Cur, FMAX_PATH);\r
2468                                                 SetYenTail(Cur);\r
2469                                                 strcat(Cur, Pkt.File);\r
2470                                                 ReplaceAll(Cur, '/', '\\');\r
2471                                                 Attr = GetFileAttributes(Cur);\r
2472                                                 if((Attr != 0xFFFFFFFF) && (Attr & FILE_ATTRIBUTE_HIDDEN))\r
2473                                                         Ignore = YES;\r
2474                                         }\r
2475 \r
2476                                         if(Ignore == NO)\r
2477                                         {\r
2478                                                 Pkt.Node = NODE_DIR;\r
2479                                                 Pkt.Attr = 0;\r
2480                                                 Pkt.Size = 0;\r
2481                                                 memset(&Pkt.Time, 0, sizeof(FILETIME));\r
2482                                                 AddFileList(&Pkt, Base);\r
2483 \r
2484                                                 if(Win == WIN_LOCAL)\r
2485                                                         MakeLocalTree(Name, Base);\r
2486                                                 else\r
2487                                                 {\r
2488                                                         AskRemoteCurDir(Cur, FMAX_PATH);\r
2489 \r
2490                                                         if((AskListCmdMode() == NO) &&\r
2491                                                            (AskUseNLST_R() == YES))\r
2492                                                                 MakeRemoteTree1(Name, Cur, Base, CancelCheckWork);\r
2493                                                         else\r
2494                                                                 MakeRemoteTree2(Name, Cur, Base, CancelCheckWork);\r
2495 \r
2496 //DispListList(*Base, "LIST");\r
2497 \r
2498                                                 }\r
2499                                         }\r
2500                                 }\r
2501                                 Pos = GetNextSelected(Win, Pos, All);\r
2502                         }\r
2503                 }\r
2504         }\r
2505         return;\r
2506 }\r
2507 \r
2508 \r
2509 /* \83f\83o\83b\83O\97p */\r
2510 /* \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\93à\97e\82ð\95\\8e¦ */\r
2511 static void DispListList(FILELIST *Pos, char *Title)\r
2512 {\r
2513         DoPrintf("############ %s ############", Title);\r
2514         while(Pos != NULL)\r
2515         {\r
2516                 DoPrintf("%d %s", Pos->Node, Pos->File);\r
2517                 Pos = Pos->Next;\r
2518         }\r
2519         DoPrintf("############ END ############");\r
2520         return;\r
2521 }\r
2522 \r
2523 \r
2524 /*----- Drag&Drop\82³\82ê\82½\83t\83@\83C\83\8b\82ð\83\8a\83X\83g\82É\93o\98^\82·\82é -----------------------------\r
2525 *\r
2526 *       Parameter\r
2527 *               WPARAM wParam : \83h\83\8d\83b\83v\82³\82ê\82½\83t\83@\83C\83\8b\82Ì\8fî\95ñ\r
2528 *               char *Cur : \83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\82ð\95Ô\82·\83o\83b\83t\83@\r
2529 *               FILELIST **Base : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
2530 *\r
2531 *       Return Value\r
2532 *               \82È\82µ\r
2533 *----------------------------------------------------------------------------*/\r
2534 \r
2535 void MakeDroppedFileList(WPARAM wParam, char *Cur, FILELIST **Base)\r
2536 {\r
2537         int Max;\r
2538         int i;\r
2539         char Name[FMAX_PATH+1];\r
2540         char Tmp[FMAX_PATH+1];\r
2541         FILELIST Pkt;\r
2542         HANDLE fHnd;\r
2543         WIN32_FIND_DATA Find;\r
2544 \r
2545         Max = DragQueryFile((HDROP)wParam, 0xFFFFFFFF, NULL, 0);\r
2546 \r
2547         DragQueryFile((HDROP)wParam, 0, Cur, FMAX_PATH);\r
2548         GetUpperDir(Cur);\r
2549 \r
2550         for(i = 0; i < Max; i++)\r
2551         {\r
2552                 DragQueryFile((HDROP)wParam, i, Name, FMAX_PATH);\r
2553 \r
2554                 if((GetFileAttributes(Name) & FILE_ATTRIBUTE_DIRECTORY) == 0)\r
2555                 {\r
2556                         Pkt.Node = NODE_FILE;\r
2557                         strcpy(Pkt.File, GetFileName(Name));\r
2558 \r
2559                         memset(&Pkt.Time, 0, sizeof(FILETIME));\r
2560                         if((fHnd = FindFirstFile(Name, &Find)) != INVALID_HANDLE_VALUE)\r
2561                         {\r
2562                                 FindClose(fHnd);\r
2563                                 Pkt.Time = Find.ftLastWriteTime;\r
2564                         }\r
2565                         AddFileList(&Pkt, Base);\r
2566                 }\r
2567         }\r
2568 \r
2569         GetCurrentDirectory(FMAX_PATH, Tmp);\r
2570         SetCurrentDirectory(Cur);\r
2571         for(i = 0; i < Max; i++)\r
2572         {\r
2573                 DragQueryFile((HDROP)wParam, i, Name, FMAX_PATH);\r
2574 \r
2575                 if(GetFileAttributes(Name) & FILE_ATTRIBUTE_DIRECTORY)\r
2576                 {\r
2577                         Pkt.Node = NODE_DIR;\r
2578                         strcpy(Pkt.File, GetFileName(Name));\r
2579                         AddFileList(&Pkt, Base);\r
2580 \r
2581                         MakeLocalTree(Pkt.File, Base);\r
2582                 }\r
2583         }\r
2584         SetCurrentDirectory(Tmp);\r
2585 \r
2586         DragFinish((HDROP)wParam);\r
2587 \r
2588         return;\r
2589 }\r
2590 \r
2591 \r
2592 /*----- Drag&Drop\82³\82ê\82½\83t\83@\83C\83\8b\82ª\82 \82é\83t\83H\83\8b\83_\82ð\8eæ\93¾\82·\82é -----------------------\r
2593 *\r
2594 *       Parameter\r
2595 *               WPARAM wParam : \83h\83\8d\83b\83v\82³\82ê\82½\83t\83@\83C\83\8b\82Ì\8fî\95ñ\r
2596 *               char *Cur : \83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\82ð\95Ô\82·\83o\83b\83t\83@\r
2597 *\r
2598 *       Return Value\r
2599 *               \82È\82µ\r
2600 *----------------------------------------------------------------------------*/\r
2601 \r
2602 void MakeDroppedDir(WPARAM wParam, char *Cur)\r
2603 {\r
2604         int Max;\r
2605 \r
2606         Max = DragQueryFile((HDROP)wParam, 0xFFFFFFFF, NULL, 0);\r
2607         DragQueryFile((HDROP)wParam, 0, Cur, FMAX_PATH);\r
2608         GetUpperDir(Cur);\r
2609         DragFinish((HDROP)wParam);\r
2610 \r
2611         return;\r
2612 }\r
2613 \r
2614 \r
2615 /*----- \83z\83X\83g\91¤\82Ì\83T\83u\83f\83B\83\8c\83N\83g\83\8a\88È\89º\82Ì\83t\83@\83C\83\8b\82ð\83\8a\83X\83g\82É\93o\98^\82·\82é\81i\82P\81j-------\r
2616 *\r
2617 *       Parameter\r
2618 *               char *Path : \83p\83X\96¼\r
2619 *               char *Cur : \83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\r
2620 *               FILELIST **Base : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
2621 *\r
2622 *       Return Value\r
2623 *               \82È\82µ\r
2624 *\r
2625 *       Note\r
2626 *               NLST -alLR \82ð\8eg\82¤\r
2627 *----------------------------------------------------------------------------*/\r
2628 \r
2629 static void MakeRemoteTree1(char *Path, char *Cur, FILELIST **Base, int *CancelCheckWork)\r
2630 {\r
2631         int Sts;\r
2632 \r
2633         if(DoCWD(Path, NO, NO, NO) == FTP_COMPLETE)\r
2634         {\r
2635                 /* \83T\83u\83t\83H\83\8b\83_\82à\8aÜ\82ß\82½\83\8a\83X\83g\82ð\8eæ\93¾ */\r
2636                 Sts = DoDirListCmdSkt("R", "", 999, CancelCheckWork);   /* NLST -alLR*/\r
2637                 DoCWD(Cur, NO, NO, NO);\r
2638 \r
2639                 if(Sts == FTP_COMPLETE)\r
2640                         AddRemoteTreeToFileList(999, Path, RDIR_NLST, Base);\r
2641         }\r
2642         return;\r
2643 }\r
2644 \r
2645 \r
2646 /*----- \83z\83X\83g\91¤\82Ì\83T\83u\83f\83B\83\8c\83N\83g\83\8a\88È\89º\82Ì\83t\83@\83C\83\8b\82ð\83\8a\83X\83g\82É\93o\98^\82·\82é\81i\82Q\81j-------\r
2647 *\r
2648 *       Parameter\r
2649 *               char *Path : \83p\83X\96¼\r
2650 *               char *Cur : \83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\r
2651 *               FILELIST **Base : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
2652 *\r
2653 *       Return Value\r
2654 *               \82È\82µ\r
2655 *\r
2656 *       Note\r
2657 *               \8ae\83t\83H\83\8b\83_\82É\88Ú\93®\82µ\82Ä\83\8a\83X\83g\82ð\8eæ\93¾\r
2658 *----------------------------------------------------------------------------*/\r
2659 \r
2660 static void MakeRemoteTree2(char *Path, char *Cur, FILELIST **Base, int *CancelCheckWork)\r
2661 {\r
2662         int Sts;\r
2663         FILELIST *CurList;\r
2664         FILELIST *Pos;\r
2665         FILELIST Pkt;\r
2666 \r
2667         /* VAX VMS \82Í CWD xxx/yyy \82Æ\82¢\82¤\8ew\92è\82ª\82Å\82«\82È\82¢\82Ì\82Å      */\r
2668         /* CWD xxx, Cwd yyy \82Æ\95¡\90\94\82É\95ª\82¯\82é                                      */\r
2669         if(AskHostType() != HTYPE_VMS)\r
2670                 Sts = DoCWD(Path, NO, NO, NO);\r
2671         else\r
2672         {\r
2673 #if defined(HAVE_OPENVMS)\r
2674                 /* OpenVMS\82Ì\8fê\8d\87\81A\83f\83B\83\8c\83N\83g\83\8a\88Ú\93®\8e\9e\82Í"HOGE.DIR;1"\82ð"HOGE"\82É\82·\82é */\r
2675                 ReformVMSDirName(Path, TRUE);\r
2676 #endif\r
2677                 Sts = DoCWDStepByStep(Path, Cur);\r
2678         }\r
2679 \r
2680         if(Sts == FTP_COMPLETE)\r
2681         {\r
2682                 Sts = DoDirListCmdSkt("", "", 999, CancelCheckWork);            /* NLST -alL*/\r
2683                 DoCWD(Cur, NO, NO, NO);\r
2684 \r
2685                 if(Sts == FTP_COMPLETE)\r
2686                 {\r
2687                         CurList = NULL;\r
2688                         AddRemoteTreeToFileList(999, Path, RDIR_CWD, &CurList);\r
2689                         CopyTmpListToFileList(Base, CurList);\r
2690 \r
2691                         Pos = CurList;\r
2692                         while(Pos != NULL)\r
2693                         {\r
2694                                 if(Pos->Node == NODE_DIR)\r
2695                                 {\r
2696                                         /* \82Ü\82¸\83f\83B\83\8c\83N\83g\83\8a\96¼\82ð\83Z\83b\83g */\r
2697                                         strcpy(Pkt.File, Pos->File);\r
2698                                         Pkt.Node = NODE_DIR;\r
2699                                         Pkt.Size = 0;\r
2700                                         Pkt.Attr = 0;\r
2701                                         memset(&Pkt.Time, 0, sizeof(FILETIME));\r
2702                                         AddFileList(&Pkt, Base);\r
2703 \r
2704                                         /* \82»\82Ì\83f\83B\83\8c\83N\83g\83\8a\82Ì\92\86\82ð\8c\9f\8dõ */\r
2705                                         MakeRemoteTree2(Pos->File, Cur, Base, CancelCheckWork);\r
2706                                 }\r
2707                                 Pos = Pos->Next;\r
2708                         }\r
2709                         DeleteFileList(&CurList);\r
2710                 }\r
2711         }\r
2712         return;\r
2713 }\r
2714 \r
2715 \r
2716 /*----- \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\93à\97e\82ð\95Ê\82Ì\83t\83@\83C\83\8b\83\8a\83X\83g\82É\83R\83s\81[ ----------------------\r
2717 *\r
2718 *       Parameter\r
2719 *               FILELIST **Base : \83R\83s\81[\90æ\r
2720 *               FILELIST *List : \83R\83s\81[\8c³\r
2721 *\r
2722 *       Return Value\r
2723 *               \82È\82µ\r
2724 *\r
2725 *       Note\r
2726 *               \83R\83s\81[\82·\82é\82Ì\82Í\83t\83@\83C\83\8b\82Ì\8fî\95ñ\82¾\82¯\r
2727 *               \83f\83B\83\8c\83N\83g\83\8a\82Ì\8fî\95ñ\82Í\83R\83s\81[\82µ\82È\82¢\r
2728 *----------------------------------------------------------------------------*/\r
2729 \r
2730 static void CopyTmpListToFileList(FILELIST **Base, FILELIST *List)\r
2731 {\r
2732         while(List != NULL)\r
2733         {\r
2734                 if(List->Node == NODE_FILE)\r
2735                         AddFileList(List, Base);\r
2736 \r
2737                 List = List->Next;\r
2738         }\r
2739         return;\r
2740 }\r
2741 \r
2742 \r
2743 /*----- \83z\83X\83g\91¤\82Ì\83t\83@\83C\83\8b\8fî\95ñ\82ð\83t\83@\83C\83\8b\83\8a\83X\83g\82É\93o\98^ --------------------------\r
2744 *\r
2745 *       Parameter\r
2746 *               int Num : \83e\83\93\83|\83\89\83\8a\83t\83@\83C\83\8b\82Ì\83t\83@\83C\83\8b\96¼\94Ô\8d\86 (_ffftp.???)\r
2747 *               char *Path : \83p\83X\96¼\r
2748 *               int IncDir : \8dÄ\8bA\8c\9f\8dõ\82Ì\95û\96@ (RDIR_xxx)\r
2749 *               FILELIST **Base : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
2750 *\r
2751 *       Return Value\r
2752 *               \82È\82µ\r
2753 *----------------------------------------------------------------------------*/\r
2754 \r
2755 void AddRemoteTreeToFileList(int Num, char *Path, int IncDir, FILELIST **Base)\r
2756 {\r
2757         char Str[FMAX_PATH+1];\r
2758         char Dir[FMAX_PATH+1];\r
2759         char Name[FMAX_PATH+1];\r
2760         LONGLONG Size;\r
2761         FILETIME Time;\r
2762         int Attr;\r
2763         FILELIST Pkt;\r
2764         FILE *fd;\r
2765         int Node;\r
2766         int ListType;\r
2767         char Owner[OWNER_NAME_LEN+1];\r
2768         int Link;\r
2769         int InfoExist;\r
2770 \r
2771         MakeCacheFileName(Num, Str);\r
2772         if((fd = fopen(Str, "rb")) != NULL)\r
2773         {\r
2774                 strcpy(Dir, Path);\r
2775 \r
2776                 ListType = LIST_UNKNOWN;\r
2777 \r
2778                 while(GetListOneLine(Str, FMAX_PATH, fd) == SUCCESS)\r
2779                 {\r
2780                         if((ListType = AnalizeFileInfo(Str)) == LIST_UNKNOWN)\r
2781                         {\r
2782                                 if(MakeDirPath(Str, ListType, Path, Dir) == SUCCESS)\r
2783                                 {\r
2784                                         if(IncDir == RDIR_NLST)\r
2785                                         {\r
2786                                                 strcpy(Pkt.File, Dir);\r
2787                                                 Pkt.Node = NODE_DIR;\r
2788                                                 Pkt.Size = 0;\r
2789                                                 Pkt.Attr = 0;\r
2790                                                 memset(&Pkt.Time, 0, sizeof(FILETIME));\r
2791                                                 AddFileList(&Pkt, Base);\r
2792                                         }\r
2793                                 }\r
2794                         }\r
2795                         else\r
2796                         {\r
2797                                 Node = ResolvFileInfo(Str, ListType, Name, &Size, &Time, &Attr, Owner, &Link, &InfoExist);\r
2798 \r
2799                                 if(AskFilterStr(Name, Node) == YES)\r
2800                                 {\r
2801                                         if((Node == NODE_FILE) ||\r
2802                                            ((IncDir == RDIR_CWD) && (Node == NODE_DIR)))\r
2803                                         {\r
2804                                                 strcpy(Pkt.File, Dir);\r
2805                                                 if(strlen(Pkt.File) > 0)\r
2806                                                         SetSlashTail(Pkt.File);\r
2807                                                 strcat(Pkt.File, Name);\r
2808                                                 Pkt.Node = Node;\r
2809                                                 Pkt.Link = Link;\r
2810                                                 Pkt.Size = Size;\r
2811                                                 Pkt.Attr = Attr;\r
2812                                                 Pkt.Time = Time;\r
2813                                                 Pkt.InfoExist = InfoExist;\r
2814                                                 AddFileList(&Pkt, Base);\r
2815                                         }\r
2816                                 }\r
2817                         }\r
2818                 }\r
2819                 fclose(fd);\r
2820         }\r
2821         return;\r
2822 }\r
2823 \r
2824 \r
2825 /*----- \83t\83@\83C\83\8b\88ê\97\97\8fî\95ñ\82Ì\82P\8ds\82ð\8eæ\93¾ ------------------------------------------\r
2826 *\r
2827 *       Parameter\r
2828 *               char *Buf : \82P\8ds\82Ì\8fî\95ñ\82ð\83Z\83b\83g\82·\82é\83o\83b\83t\83@\r
2829 *               int Max : \8dÅ\91å\95\8e\9a\90\94\r
2830 *               FILE *Fd : \83X\83g\83\8a\81[\83\80\r
2831 *\r
2832 *       Return Value\r
2833 *               int \83X\83e\81[\83^\83X (SUCCESS/FAIL)\r
2834 *\r
2835 *       Note\r
2836 *               VAX VMS\88È\8aO\82Ì\8e\9e\82Í fgets(Buf, Max, Fd) \82Æ\93¯\82\r
2837 *               Vax VMS\82Ì\8e\9e\82Í\81A\95¡\90\94\8ds\82Ì\83t\83@\83C\83\8b\8fî\95ñ\82ð\82P\8ds\82É\82Ü\82Æ\82ß\82é\r
2838 *----------------------------------------------------------------------------*/\r
2839 \r
2840 static int GetListOneLine(char *Buf, int Max, FILE *Fd)\r
2841 {\r
2842         char Tmp[FMAX_PATH+1];\r
2843         int Sts;\r
2844 \r
2845         Sts = FAIL;\r
2846         while((Sts == FAIL) && (fgets(Buf, Max, Fd) != NULL))\r
2847         {\r
2848                 Sts = SUCCESS;\r
2849                 RemoveReturnCode(Buf);\r
2850                 ReplaceAll(Buf, '\x08', ' ');\r
2851 \r
2852                 /* VAX VMS\82Å\82Í\83t\83@\83C\83\8b\8fî\95ñ\82ª\95¡\90\94\8ds\82É\82í\82©\82ê\82Ä\82¢\82é        */\r
2853                 /* \82»\82ê\82ð\82P\8ds\82É\82Ü\82Æ\82ß\82é                                                         */\r
2854                 if(AskHostType() == HTYPE_VMS)\r
2855                 {\r
2856                         if(strchr(Buf, ';') == NULL)    /* \83t\83@\83C\83\8b\96¼\88È\8aO\82Ì\8ds */\r
2857                                 Sts = FAIL;\r
2858                         else\r
2859                         {\r
2860                                 Max -= strlen(Buf);\r
2861                                 while(strchr(Buf, ')') == NULL)\r
2862                                 {\r
2863                                         if(fgets(Tmp, FMAX_PATH, Fd) != NULL)\r
2864                                         {\r
2865                                                 RemoveReturnCode(Tmp);\r
2866                                                 ReplaceAll(Buf, '\x08', ' ');\r
2867                                                 if((int)strlen(Tmp) > Max)\r
2868                                                         Tmp[Max] = NUL;\r
2869                                                 Max -= strlen(Tmp);\r
2870                                                 strcat(Buf, Tmp);\r
2871                                         }\r
2872                                         else\r
2873                                                 break;\r
2874                                 }\r
2875                         }\r
2876                 }\r
2877         }\r
2878 \r
2879 //      DoPrintf("List : %s", Buf);\r
2880 \r
2881         return(Sts);\r
2882 }\r
2883 \r
2884 \r
2885 /*----- \83T\83u\83f\83B\83\8c\83N\83g\83\8a\8fî\95ñ\82Ì\89ð\90Í --------------------------------------------\r
2886 *\r
2887 *       Parameter\r
2888 *               char *Str : \83t\83@\83C\83\8b\8fî\95ñ\81i\82P\8ds\81j\r
2889 *               int ListType : \83\8a\83X\83g\82Ì\83^\83C\83v\r
2890 *               char *Path : \90æ\93ª\82©\82ç\82Ì\83p\83X\96¼\r
2891 *               char *Dir : \83f\83B\83\8c\83N\83g\83\8a\96¼\r
2892 *\r
2893 *       Return Value\r
2894 *               int \83X\83e\81[\83^\83X\r
2895 *                       SUCCESS/FAIL=\83f\83B\83\8c\83N\83g\83\8a\8fî\95ñ\82Å\82È\82¢\r
2896 *----------------------------------------------------------------------------*/\r
2897 \r
2898 static int MakeDirPath(char *Str, int ListType, char *Path, char *Dir)\r
2899 {\r
2900         int Sts;\r
2901 \r
2902         Sts = FAIL;\r
2903         switch(ListType)\r
2904         {\r
2905                 case LIST_ACOS :\r
2906                 case LIST_ACOS_4 :\r
2907                         break;\r
2908 \r
2909                 default:\r
2910                         if(*(Str + strlen(Str) - 1) == ':')             /* \8dÅ\8cã\82ª : \82È\82ç\83T\83u\83f\83B\83\8c\83N\83g\83\8a */\r
2911                         {\r
2912                                 if(strcmp(Str, ".:") != 0)\r
2913                                 {\r
2914                                         if((strncmp(Str, "./", 2) == 0) ||\r
2915                                            (strncmp(Str, ".\\", 2) == 0))\r
2916                                         {\r
2917                                                 Str += 2;\r
2918                                         }\r
2919 \r
2920                                         if(strlen(Str) > 1)\r
2921                                         {\r
2922                                                 strcpy(Dir, Path);\r
2923                                                 SetSlashTail(Dir);\r
2924                                                 strcat(Dir, Str);\r
2925                                                 *(Dir + strlen(Dir) - 1) = NUL;\r
2926 \r
2927                                                 ChangeFnameRemote2Local(Dir, FMAX_PATH);\r
2928 \r
2929                                                 ReplaceAll(Dir, '\\', '/');\r
2930                                         }\r
2931                                 }\r
2932                                 Sts = SUCCESS;\r
2933                         }\r
2934                         break;\r
2935         }\r
2936         return(Sts);\r
2937 }\r
2938 \r
2939 \r
2940 /*----- \83\8d\81[\83J\83\8b\91¤\82Ì\83T\83u\83f\83B\83\8c\83N\83g\83\8a\88È\89º\82Ì\83t\83@\83C\83\8b\82ð\83\8a\83X\83g\82É\93o\98^\82·\82é ----------\r
2941 *\r
2942 *       Parameter\r
2943 *               char *Path : \83p\83X\96¼\r
2944 *               FILELIST **Base : \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\90æ\93ª\r
2945 *\r
2946 *       Return Value\r
2947 *               \82È\82µ\r
2948 *----------------------------------------------------------------------------*/\r
2949 \r
2950 static void MakeLocalTree(char *Path, FILELIST **Base)\r
2951 {\r
2952         char Src[FMAX_PATH+1];\r
2953         HANDLE fHnd;\r
2954         WIN32_FIND_DATA FindBuf;\r
2955         FILELIST Pkt;\r
2956         SYSTEMTIME TmpStime;\r
2957 \r
2958         strcpy(Src, Path);\r
2959         SetYenTail(Src);\r
2960         strcat(Src, "*");\r
2961         ReplaceAll(Src, '/', '\\');\r
2962 \r
2963         if((fHnd = FindFirstFileAttr(Src, &FindBuf, DispIgnoreHide)) != INVALID_HANDLE_VALUE)\r
2964         {\r
2965                 do\r
2966                 {\r
2967                         if((FindBuf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)\r
2968                         {\r
2969                                 if(AskFilterStr(FindBuf.cFileName, NODE_FILE) == YES)\r
2970                                 {\r
2971                                         strcpy(Pkt.File, Path);\r
2972                                         SetSlashTail(Pkt.File);\r
2973                                         strcat(Pkt.File, FindBuf.cFileName);\r
2974                                         ReplaceAll(Pkt.File, '\\', '/');\r
2975                                         Pkt.Node = NODE_FILE;\r
2976                                         Pkt.Size = MakeLongLong(FindBuf.nFileSizeHigh, FindBuf.nFileSizeLow);\r
2977                                         Pkt.Attr = 0;\r
2978                                         Pkt.Time = FindBuf.ftLastWriteTime;\r
2979                                         FileTimeToSystemTime(&Pkt.Time, &TmpStime);\r
2980                                         TmpStime.wSecond = 0;\r
2981                                         TmpStime.wMilliseconds = 0;\r
2982                                         SystemTimeToFileTime(&TmpStime, &Pkt.Time);\r
2983                                         AddFileList(&Pkt, Base);\r
2984                                 }\r
2985                         }\r
2986                 }\r
2987                 while(FindNextFileAttr(fHnd, &FindBuf, DispIgnoreHide) == TRUE);\r
2988                 FindClose(fHnd);\r
2989         }\r
2990 \r
2991         if((fHnd = FindFirstFileAttr(Src, &FindBuf, DispIg