OSDN Git Service

afd2e4e50a01ffc999f58670aa67c689232db2ed
[ffftp/ffftp.git] / hostman.c
1 /*=============================================================================\r
2 *\r
3 *                                                               ホスト一覧\r
4 *\r
5 ===============================================================================\r
6 / Copyright (C) 1997-2007 Sota. All rights reserved.\r
7 /\r
8 / Redistribution and use in source and binary forms, with or without \r
9 / modification, are permitted provided that the following conditions \r
10 / are met:\r
11 /\r
12 /  1. Redistributions of source code must retain the above copyright \r
13 /     notice, this list of conditions and the following disclaimer.\r
14 /  2. Redistributions in binary form must reproduce the above copyright \r
15 /     notice, this list of conditions and the following disclaimer in the \r
16 /     documentation and/or other materials provided with the distribution.\r
17 /\r
18 / THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR \r
19 / IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES \r
20 / OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \r
21 / IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, \r
22 / INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, \r
23 / BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF \r
24 / USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \r
25 / ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
26 / (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF \r
27 / THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
28 /============================================================================*/\r
29 \r
30 #define STRICT\r
31 // IPv6対応\r
32 #include <winsock2.h>\r
33 #include <windows.h>\r
34 #include <stdio.h>\r
35 #include <stdlib.h>\r
36 #include <string.h>\r
37 #include <commctrl.h>\r
38 #include <windowsx.h>\r
39 \r
40 #include "common.h"\r
41 #include "resource.h"\r
42 \r
43 #include <htmlhelp.h>\r
44 #include "helpid.h"\r
45 \r
46 // UTF-8対応\r
47 #undef __MBSWRAPPER_H__\r
48 #include "mbswrapper.h"\r
49 \r
50 \r
51 /*===== プロトタイプ =====*/\r
52 \r
53 static BOOL CALLBACK SelectHostProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);\r
54 static LRESULT CALLBACK HostListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
55 static HOSTLISTDATA *GetNextNode(HOSTLISTDATA *Pos);\r
56 static int GetNodeLevel(int Num);\r
57 static int GetNodeLevelByData(HOSTLISTDATA *Data);\r
58 static int GetNodeNumByData(HOSTLISTDATA *Data);\r
59 static HOSTLISTDATA *GetNodeByNum(int Num);\r
60 static int SetNodeLevelAll(void);\r
61 static int UpdateHostToList(int Num, HOSTDATA *Set);\r
62 static int DelHostFromList(int Num);\r
63 static int DeleteChildAndNext(HOSTLISTDATA *Pos);\r
64 static void SendAllHostNames(HWND hWnd, int Cur);\r
65 static int IsNodeGroup(int Num);\r
66 static int DispHostSetDlg(HWND hDlg);\r
67 static BOOL CALLBACK MainSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
68 static BOOL CALLBACK AdvSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
69 static BOOL CALLBACK CodeSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
70 static BOOL CALLBACK DialupSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
71 static BOOL CALLBACK Adv2SettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
72 // 暗号化通信対応\r
73 static BOOL CALLBACK CryptSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
74 // 同時接続対応\r
75 static BOOL CALLBACK Adv3SettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
76 \r
77 /*===== 外部参照 =====*/\r
78 \r
79 extern HWND hHelpWin;\r
80 \r
81 /* 設定値 */\r
82 extern char UserMailAdrs[USER_MAIL_LEN+1];\r
83 extern HFONT ListFont;\r
84 extern char DefaultLocalPath[FMAX_PATH+1];\r
85 extern int ConnectAndSet;\r
86 extern SIZE HostDlgSize;\r
87 \r
88 /*===== ローカルなワーク =====*/\r
89 \r
90 static int Hosts = 0;                                           /* ホスト数 */\r
91 static int ConnectingHost;                                      /* 接続中のホスト */\r
92 static int CurrentHost;                                         /* カーソル位置のホスト */\r
93 static HOSTLISTDATA *HostListTop = NULL;        /* ホスト一覧データ */\r
94 static HOSTDATA TmpHost;                                        /* ホスト情報コピー用 */\r
95 static int Apply;                                                       /* プロパティシートでOKを押したフラグ */\r
96 static WNDPROC HostListProcPtr;\r
97 \r
98 \r
99 \r
100 /*----- ホスト一覧ウインドウ --------------------------------------------------\r
101 *\r
102 *       Parameter\r
103 *               int Type : ダイアログのタイプ (DLG_TYPE_xxx)\r
104 *\r
105 *       Return Value\r
106 *               ステータス (YES=実行/NO=取消)\r
107 *----------------------------------------------------------------------------*/\r
108 \r
109 int SelectHost(int Type)\r
110 {\r
111         int Sts;\r
112         int Dlg;\r
113 \r
114         Dlg = hostconnect_dlg;\r
115         if((ConnectAndSet == YES) || (Type == DLG_TYPE_SET))\r
116                 Dlg = hostlist_dlg;\r
117 \r
118         Sts = DialogBox(GetFtpInst(), MAKEINTRESOURCE(Dlg), GetMainHwnd(), SelectHostProc);\r
119 \r
120         /* ホスト設定を保存 */\r
121         SetNodeLevelAll();\r
122         SaveRegistory();\r
123 \r
124         return(Sts);\r
125 }\r
126 \r
127 \r
128 /*----- ホスト一覧ウインドウのコールバック ------------------------------------\r
129 *\r
130 *       Parameter\r
131 *               HWND hDlg : ウインドウハンドル\r
132 *               UINT message : メッセージ番号\r
133 *               WPARAM wParam : メッセージの WPARAM 引数\r
134 *               LPARAM lParam : メッセージの LPARAM 引数\r
135 *\r
136 *       Return Value\r
137 *               BOOL TRUE/FALSE\r
138 *----------------------------------------------------------------------------*/\r
139 \r
140 static BOOL CALLBACK SelectHostProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
141 {\r
142         static DIALOGSIZE DlgSize = {\r
143                 { HOST_NEW, HOST_FOLDER, HOST_SET, HOST_COPY, HOST_DEL, HOST_DOWN, HOST_UP, IDHELP, HOST_SIZEGRIP, -1 },\r
144                 { IDOK, IDCANCEL, HOST_SIZEGRIP, -1 },\r
145                 { HOST_LIST, -1 },\r
146                 { 0, 0 },\r
147                 { 0, 0 }\r
148         };\r
149         static HIMAGELIST hImage;\r
150         HTREEITEM hItem;\r
151         TV_ITEM Item;\r
152         int Level1;\r
153         int Level2;\r
154         HOSTLISTDATA *Data1;\r
155         HOSTLISTDATA *Data2;\r
156         // UTF-8対応\r
157 //      NM_TREEVIEW *tView;\r
158         NM_TREEVIEWW *tView;\r
159         HTREEITEM tViewPos;\r
160         TV_HITTESTINFO HitInfo;\r
161 \r
162         switch (message)\r
163         {\r
164                 case WM_INITDIALOG :\r
165                         /* TreeViewでのダブルクリックをつかまえるため */\r
166                         HostListProcPtr = (WNDPROC)SetWindowLong(GetDlgItem(hDlg, HOST_LIST), GWL_WNDPROC, (LONG)HostListWndProc);\r
167 \r
168 \r
169 //              SetClassLong(hDlg, GCL_HICON, (LONG)LoadIcon(GetFtpInst(), MAKEINTRESOURCE(ffftp)));\r
170 \r
171                         if(AskConnecting() == YES)\r
172                         {\r
173                                 /* 接続中は「変更」のみ許可 */\r
174                                 EnableWindow(GetDlgItem(hDlg, HOST_NEW), FALSE);\r
175                                 EnableWindow(GetDlgItem(hDlg, HOST_FOLDER), FALSE);\r
176                                 EnableWindow(GetDlgItem(hDlg, HOST_COPY), FALSE);\r
177                                 EnableWindow(GetDlgItem(hDlg, HOST_DEL), FALSE);\r
178                                 EnableWindow(GetDlgItem(hDlg, HOST_DOWN), FALSE);\r
179                                 EnableWindow(GetDlgItem(hDlg, HOST_UP), FALSE);\r
180                         }\r
181                         if(ListFont != NULL)\r
182                                 SendDlgItemMessage(hDlg, HOST_LIST, WM_SETFONT, (WPARAM)ListFont, MAKELPARAM(TRUE, 0));\r
183                         hImage = ImageList_LoadBitmap(GetFtpInst(), MAKEINTRESOURCE(hlist_bmp), 16, 8, RGB(255,0,0));\r
184                         SendDlgItemMessage(hDlg, HOST_LIST, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImage);\r
185                         CurrentHost = 0;\r
186                         if(ConnectingHost >= 0)\r
187                                 CurrentHost = ConnectingHost;\r
188                         SendAllHostNames(GetDlgItem(hDlg, HOST_LIST), CurrentHost);\r
189                         DlgSizeInit(hDlg, &DlgSize, &HostDlgSize);\r
190                     return(TRUE);\r
191 \r
192                 case WM_COMMAND :\r
193                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
194                         {\r
195                                 case IDOK :\r
196                                         if((hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0)) != NULL)\r
197                                         {\r
198                                                 Item.hItem = hItem;\r
199                                                 Item.mask = TVIF_PARAM;\r
200                                                 SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
201                                                 CurrentHost = Item.lParam;\r
202                                                 ConnectingHost = CurrentHost;\r
203                                                 AskDlgSize(hDlg, &DlgSize, &HostDlgSize);\r
204                                                 ImageList_Destroy(hImage);\r
205                                                 EndDialog(hDlg, YES);\r
206                                                 break;\r
207                                         }\r
208                                         /* ここにbreakはない */\r
209 \r
210                                 case IDCANCEL :\r
211                                         AskDlgSize(hDlg, &DlgSize, &HostDlgSize);\r
212                                         ImageList_Destroy(hImage);\r
213                                         EndDialog(hDlg, NO);\r
214                                         break;\r
215 \r
216                                 case HOST_NEW :\r
217                                         CopyDefaultHost(&TmpHost);\r
218                                         if(DispHostSetDlg(hDlg) == YES)\r
219                                         {\r
220                                                 if((hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0)) != NULL)\r
221                                                 {\r
222                                                         Item.hItem = hItem;\r
223                                                         Item.mask = TVIF_PARAM;\r
224                                                         SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
225 \r
226                                                         TmpHost.Level = GetNodeLevel(Item.lParam);\r
227                                                         Level1 = Item.lParam + 1;\r
228                                                         CurrentHost = Level1;\r
229                                                 }\r
230                                                 else\r
231                                                 {\r
232                                                         TmpHost.Level = 0;\r
233                                                         Level1 = -1;\r
234                                                         CurrentHost = Hosts;\r
235                                                 }\r
236                                                 AddHostToList(&TmpHost, Level1, SET_LEVEL_SAME);\r
237                                                 SendAllHostNames(GetDlgItem(hDlg, HOST_LIST), CurrentHost);\r
238                                         }\r
239                                         break;\r
240 \r
241                                 case HOST_FOLDER :\r
242                                         CopyDefaultHost(&TmpHost);\r
243                                         if(InputDialogBox(group_dlg, hDlg, NULL, TmpHost.HostName, HOST_NAME_LEN+1, &Level1, IDH_HELP_TOPIC_0000001) == YES)\r
244                                         {\r
245                                                 if((hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0)) != NULL)\r
246                                                 {\r
247                                                         Item.hItem = hItem;\r
248                                                         Item.mask = TVIF_PARAM;\r
249                                                         SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
250 \r
251                                                         TmpHost.Level = GetNodeLevel(Item.lParam) | SET_LEVEL_GROUP ;\r
252                                                         Level1 = Item.lParam + 1;\r
253                                                         CurrentHost = Level1;\r
254                                                 }\r
255                                                 else\r
256                                                 {\r
257                                                         TmpHost.Level = 0 | SET_LEVEL_GROUP;\r
258                                                         Level1 = -1;\r
259                                                         CurrentHost = Hosts;\r
260                                                 }\r
261                                                 AddHostToList(&TmpHost, Level1, SET_LEVEL_SAME);\r
262                                                 SendAllHostNames(GetDlgItem(hDlg, HOST_LIST), CurrentHost);\r
263                                         }\r
264                                         break;\r
265 \r
266                                 case HOST_SET :\r
267                                         if((hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0)) != NULL)\r
268                                         {\r
269                                                 Item.hItem = hItem;\r
270                                                 Item.mask = TVIF_PARAM;\r
271                                                 SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
272                                                 CurrentHost = Item.lParam;\r
273 \r
274                                                 CopyHostFromList(CurrentHost, &TmpHost);\r
275                                                 Level1 = IsNodeGroup(CurrentHost);\r
276                                                 if(((Level1 == NO) && (DispHostSetDlg(hDlg) == YES)) ||\r
277                                                    ((Level1 == YES) && (InputDialogBox(group_dlg, hDlg, NULL, TmpHost.HostName, HOST_NAME_LEN+1, &Level1, IDH_HELP_TOPIC_0000001) == YES)))\r
278                                                 {\r
279                                                         UpdateHostToList(CurrentHost, &TmpHost);\r
280                                                         SendAllHostNames(GetDlgItem(hDlg, HOST_LIST), CurrentHost);\r
281                                                 }\r
282                                         }\r
283                                         break;\r
284 \r
285                                 case HOST_COPY :\r
286                                         if((hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0)) != NULL)\r
287                                         {\r
288                                                 Item.hItem = hItem;\r
289                                                 Item.mask = TVIF_PARAM;\r
290                                                 SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
291                                                 CurrentHost = Item.lParam;\r
292 \r
293                                                 CopyHostFromList(CurrentHost, &TmpHost);\r
294                                                 strcpy(TmpHost.BookMark, "\0");\r
295                                                 CurrentHost++;\r
296                                                 AddHostToList(&TmpHost, CurrentHost, SET_LEVEL_SAME);\r
297                                                 SendAllHostNames(GetDlgItem(hDlg, HOST_LIST), CurrentHost);\r
298                                         }\r
299                                         break;\r
300 \r
301                                 case HOST_DEL :\r
302                                         if((hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0)) != NULL)\r
303                                         {\r
304                                                 Item.hItem = hItem;\r
305                                                 Item.mask = TVIF_PARAM;\r
306                                                 SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
307                                                 CurrentHost = Item.lParam;\r
308                                                 Level1 = IsNodeGroup(CurrentHost);\r
309 \r
310                                                 if(((Level1 == YES) && (DialogBox(GetFtpInst(), MAKEINTRESOURCE(groupdel_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)) ||\r
311                                                    ((Level1 == NO) && (DialogBox(GetFtpInst(), MAKEINTRESOURCE(hostdel_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)))\r
312                                                 {\r
313                                                         DelHostFromList(CurrentHost);\r
314                                                         if(CurrentHost >= Hosts)\r
315                                                                 CurrentHost = max1(0, Hosts-1);\r
316                                                         SendAllHostNames(GetDlgItem(hDlg, HOST_LIST), CurrentHost);\r
317                                                 }\r
318                                         }\r
319                                         break;\r
320 \r
321                                 case HOST_UP :\r
322                                         if((hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0)) != NULL)\r
323                                         {\r
324                                                 Item.hItem = hItem;\r
325                                                 Item.mask = TVIF_PARAM;\r
326                                                 SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
327                                                 CurrentHost = Item.lParam;\r
328 \r
329                                                 if(CurrentHost > 0)\r
330                                                 {\r
331                                                         Data1 = HostListTop;\r
332                                                         for(Level1 = CurrentHost; Level1 > 0; Level1--)\r
333                                                                 Data1 = GetNextNode(Data1);\r
334                                                         Level1 = GetNodeLevel(CurrentHost);\r
335 \r
336                                                         Data2 = HostListTop;\r
337                                                         for(Level2 = CurrentHost-1; Level2 > 0; Level2--)\r
338                                                                 Data2 = GetNextNode(Data2);\r
339                                                         Level2 = GetNodeLevel(CurrentHost-1);\r
340 \r
341                                                         if((Level1 == Level2) && (Data2->Set.Level & SET_LEVEL_GROUP))\r
342                                                         {\r
343                                                                 //Data2のchildへ\r
344                                                                 if(Data1->Next != NULL)\r
345                                                                         Data1->Next->Prev = Data1->Prev;\r
346                                                                 if(Data1->Prev != NULL)\r
347                                                                         Data1->Prev->Next = Data1->Next;\r
348                                                                 if((Data1->Parent != NULL) && (Data1->Parent->Child == Data1))\r
349                                                                         Data1->Parent->Child = Data1->Next;\r
350                                                                 if((Data1->Parent == NULL) && (HostListTop == Data1))\r
351                                                                         HostListTop = Data1->Next;\r
352 \r
353                                                                 Data1->Next = Data2->Child;\r
354                                                                 Data1->Prev = NULL;\r
355                                                                 Data1->Parent = Data2;\r
356                                                                 Data2->Child = Data1;\r
357                                                         }\r
358                                                         else if(Level1 < Level2)\r
359                                                         {\r
360                                                                 //Data1のPrevのChildのNextの末尾へ\r
361                                                                 Data2 = Data1->Prev->Child;\r
362                                                                 while(Data2->Next != NULL)\r
363                                                                         Data2 = Data2->Next;\r
364 \r
365                                                                 if(Data1->Next != NULL)\r
366                                                                         Data1->Next->Prev = Data1->Prev;\r
367                                                                 if(Data1->Prev != NULL)\r
368                                                                         Data1->Prev->Next = Data1->Next;\r
369                                                                 if((Data1->Parent != NULL) && (Data1->Parent->Child == Data1))\r
370                                                                         Data1->Parent->Child = Data1->Next;\r
371                                                                 if((Data1->Parent == NULL) && (HostListTop == Data1))\r
372                                                                         HostListTop = Data1->Next;\r
373 \r
374                                                                 Data2->Next = Data1;\r
375                                                                 Data1->Prev = Data2;\r
376                                                                 Data1->Next = NULL;\r
377                                                                 Data1->Parent = Data2->Parent;\r
378                                                         }\r
379                                                         else\r
380                                                         {\r
381                                                                 //Data2のprevへ\r
382                                                                 if(Data1->Next != NULL)\r
383                                                                         Data1->Next->Prev = Data1->Prev;\r
384                                                                 if(Data1->Prev != NULL)\r
385                                                                         Data1->Prev->Next = Data1->Next;\r
386                                                                 if((Data1->Parent != NULL) && (Data1->Parent->Child == Data1))\r
387                                                                         Data1->Parent->Child = Data1->Next;\r
388                                                                 if((Data1->Parent == NULL) && (HostListTop == Data1))\r
389                                                                         HostListTop = Data1->Next;\r
390 \r
391                                                                 if(Data2->Prev != NULL)\r
392                                                                         Data2->Prev->Next = Data1;\r
393                                                                 Data1->Prev = Data2->Prev;\r
394                                                                 Data2->Prev = Data1;\r
395                                                                 Data1->Next = Data2;\r
396                                                                 Data1->Parent = Data2->Parent;\r
397 \r
398                                                                 if((Data1->Parent != NULL) && (Data1->Parent->Child == Data2))\r
399                                                                         Data1->Parent->Child = Data1;\r
400                                                                 if((Data1->Parent == NULL) && (HostListTop == Data2))\r
401                                                                         HostListTop = Data1;\r
402                                                         }\r
403 \r
404                                                         CurrentHost = GetNodeNumByData(Data1);\r
405                                                         SendAllHostNames(GetDlgItem(hDlg, HOST_LIST), CurrentHost);\r
406                                                 }\r
407                                         }\r
408                                         break;\r
409 \r
410                                 case HOST_DOWN :\r
411                                         if((hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0)) != NULL)\r
412                                         {\r
413                                                 Item.hItem = hItem;\r
414                                                 Item.mask = TVIF_PARAM;\r
415                                                 SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
416                                                 CurrentHost = Item.lParam;\r
417 \r
418                                                 Data1 = HostListTop;\r
419                                                 for(Level1 = CurrentHost; Level1 > 0; Level1--)\r
420                                                         Data1 = GetNextNode(Data1);\r
421                                                 Level1 = GetNodeLevel(CurrentHost);\r
422 \r
423                                                 Data2 = NULL;\r
424                                                 Level2 = SET_LEVEL_SAME;\r
425                                                 if(CurrentHost < Hosts-1)\r
426                                                 {\r
427                                                         Data2 = HostListTop;\r
428                                                         for(Level2 = CurrentHost+1; Level2 > 0; Level2--)\r
429                                                                 Data2 = GetNextNode(Data2);\r
430                                                         Level2 = GetNodeLevel(CurrentHost+1);\r
431 \r
432                                                         if(Level1 < Level2)\r
433                                                         {\r
434                                                                 if(Data1->Next != NULL)\r
435                                                                 {\r
436                                                                         //Data2 = Data1のNext\r
437                                                                         Data2 = Data1->Next;\r
438                                                                         Level2 = GetNodeLevelByData(Data2);\r
439                                                                 }\r
440                                                                 else if(Data1->Parent != NULL)\r
441                                                                 {\r
442                                                                         Data2 = NULL;\r
443                                                                         Level2 = SET_LEVEL_SAME;\r
444                                                                 }\r
445                                                         }\r
446                                                 }\r
447 \r
448                                                 if(((Data2 == NULL) && (Level1 > 0)) ||\r
449                                                    (Level1 > Level2))\r
450                                                 {\r
451                                                         //Data1のParentのNextへ\r
452                                                         Data2 = Data1->Parent;\r
453 \r
454                                                         if(Data1->Next != NULL)\r
455                                                                 Data1->Next->Prev = Data1->Prev;\r
456                                                         if(Data1->Prev != NULL)\r
457                                                                 Data1->Prev->Next = Data1->Next;\r
458                                                         if((Data1->Parent != NULL) && (Data1->Parent->Child == Data1))\r
459                                                                 Data1->Parent->Child = Data1->Next;\r
460                                                         if((Data1->Parent == NULL) && (HostListTop == Data1))\r
461                                                                 HostListTop = Data1->Next;\r
462 \r
463                                                         if(Data2->Next != NULL)\r
464                                                                 Data2->Next->Prev = Data1;\r
465                                                         Data1->Next = Data2->Next;\r
466                                                         Data2->Next = Data1;\r
467                                                         Data1->Prev = Data2;\r
468                                                         Data1->Parent = Data2->Parent;\r
469 \r
470                                                         if((Data1->Parent != NULL) && (Data1->Parent->Child == Data1))\r
471                                                                 Data1->Parent->Child = Data2;\r
472                                                         if((Data1->Parent == NULL) && (HostListTop == Data1))\r
473                                                                 HostListTop = Data2;\r
474                                                 }\r
475                                                 else if(Level1 == Level2)\r
476                                                 {\r
477                                                         if(Data2->Set.Level & SET_LEVEL_GROUP)\r
478                                                         {\r
479                                                                 //Data2のChildへ\r
480                                                                 if(Data1->Next != NULL)\r
481                                                                         Data1->Next->Prev = Data1->Prev;\r
482                                                                 if(Data1->Prev != NULL)\r
483                                                                         Data1->Prev->Next = Data1->Next;\r
484                                                                 if((Data1->Parent != NULL) && (Data1->Parent->Child == Data1))\r
485                                                                         Data1->Parent->Child = Data1->Next;\r
486                                                                 if((Data1->Parent == NULL) && (HostListTop == Data1))\r
487                                                                         HostListTop = Data1->Next;\r
488 \r
489                                                                 if(Data2->Child != NULL)\r
490                                                                         Data2->Child->Prev = Data1;\r
491                                                                 Data1->Next = Data2->Child;\r
492                                                                 Data1->Prev = NULL;\r
493                                                                 Data1->Parent = Data2;\r
494                                                                 Data2->Child = Data1;\r
495                                                         }\r
496                                                         else\r
497                                                         {\r
498                                                                 //Data2のNextへ\r
499                                                                 if(Data1->Next != NULL)\r
500                                                                         Data1->Next->Prev = Data1->Prev;\r
501                                                                 if(Data1->Prev != NULL)\r
502                                                                         Data1->Prev->Next = Data1->Next;\r
503                                                                 if((Data1->Parent != NULL) && (Data1->Parent->Child == Data1))\r
504                                                                         Data1->Parent->Child = Data1->Next;\r
505                                                                 if((Data1->Parent == NULL) && (HostListTop == Data1))\r
506                                                                         HostListTop = Data1->Next;\r
507 \r
508                                                                 if(Data2->Next != NULL)\r
509                                                                         Data2->Next->Prev = Data1;\r
510                                                                 Data1->Next = Data2->Next;\r
511                                                                 Data2->Next = Data1;\r
512                                                                 Data1->Prev = Data2;\r
513                                                                 Data1->Parent = Data2->Parent;\r
514 \r
515                                                                 if((Data1->Parent != NULL) && (Data1->Parent->Child == Data1))\r
516                                                                         Data1->Parent->Child = Data2;\r
517                                                                 if((Data1->Parent == NULL) && (HostListTop == Data1))\r
518                                                                         HostListTop = Data2;\r
519                                                         }\r
520                                                 }\r
521 \r
522                                                 CurrentHost = GetNodeNumByData(Data1);\r
523                                                 SendAllHostNames(GetDlgItem(hDlg, HOST_LIST), CurrentHost);\r
524                                         }\r
525                                         break;\r
526 \r
527                                 case HOST_LIST :\r
528                                         if(HIWORD(wParam) == LBN_DBLCLK)\r
529                                                 PostMessage(hDlg, WM_COMMAND, MAKEWORD(IDOK, 0), 0);\r
530                                         break;\r
531 \r
532                                 case IDHELP :\r
533                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000027);\r
534                                         break;\r
535                         }\r
536                         SetFocus(GetDlgItem(hDlg, HOST_LIST));\r
537                         return(TRUE);\r
538 \r
539                 case WM_SIZING :\r
540                         DlgSizeChange(hDlg, &DlgSize, (RECT *)lParam, (int)wParam);\r
541                     return(TRUE);\r
542 \r
543                 case WM_SELECT_HOST :\r
544                         HitInfo.pt.x = LOWORD(lParam);\r
545                         HitInfo.pt.y = HIWORD(lParam);\r
546                         HitInfo.flags = TVHT_ONITEM;\r
547                         hItem = (HTREEITEM)SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETNEXTITEM, TVGN_CARET, 0);\r
548                         HitInfo.hItem = hItem;\r
549                         if((HTREEITEM)SendMessage(GetDlgItem(hDlg, HOST_LIST), TVM_HITTEST, 0, (LPARAM)&HitInfo) == hItem)\r
550                         {\r
551                                 if(IsWindowEnabled(GetDlgItem(hDlg, IDOK)) == TRUE)\r
552                                         PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);\r
553                         }\r
554                         break;\r
555 \r
556                 case WM_NOTIFY:\r
557                         // UTF-8対応\r
558 //                      tView = (NM_TREEVIEW FAR *)lParam;\r
559                         tView = (NM_TREEVIEWW FAR *)lParam;\r
560                         switch(tView->hdr.idFrom)\r
561                         {\r
562                                 case HOST_LIST :\r
563                                         tViewPos = tView->itemNew.hItem;\r
564                                         hItem = tView->itemNew.hItem;\r
565                                         switch(tView->hdr.code)\r
566                                         {\r
567                                                 // UTF-8対応\r
568 //                                              case TVN_SELCHANGED :\r
569                                                 case TVN_SELCHANGEDW :\r
570                                                         /* フォルダが選ばれたときは接続、コピーボタンは禁止 */\r
571                                                         Item.hItem = hItem;\r
572                                                         Item.mask = TVIF_PARAM;\r
573                                                         SendDlgItemMessage(hDlg, HOST_LIST, TVM_GETITEM, TVGN_CARET, (LPARAM)&Item);\r
574                                                         if(IsNodeGroup(Item.lParam) == YES)\r
575                                                         {\r
576                                                                 EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);\r
577                                                                 EnableWindow(GetDlgItem(hDlg, HOST_COPY), FALSE);\r
578                                                         }\r
579                                                         else\r
580                                                         {\r
581                                                                 EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);\r
582                                                                 if(AskConnecting() == NO)\r
583                                                                         EnableWindow(GetDlgItem(hDlg, HOST_COPY), TRUE);\r
584                                                         }\r
585                                                         break;\r
586                                         }\r
587                                         break;\r
588                         }\r
589                         break;\r
590         }\r
591     return(FALSE);\r
592 }\r
593 \r
594 \r
595 /*----- ホスト一覧TreeViewのメッセージ処理 ------------------------------------\r
596 *\r
597 *       Parameter\r
598 *               HWND hWnd : ウインドウハンドル\r
599 *               UINT message  : メッセージ番号\r
600 *               WPARAM wParam : メッセージの WPARAM 引数\r
601 *               LPARAM lParam : メッセージの LPARAM 引数\r
602 *\r
603 *       Return Value\r
604 *               メッセージに対応する戻り値\r
605 *----------------------------------------------------------------------------*/\r
606 \r
607 static LRESULT CALLBACK HostListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
608 {\r
609         switch (message)\r
610         {\r
611                 case WM_LBUTTONDBLCLK :\r
612                         PostMessage(GetParent(hWnd), WM_SELECT_HOST, 0, lParam);\r
613                         break;\r
614         }\r
615         return(CallWindowProc(HostListProcPtr, hWnd, message, wParam, lParam));\r
616 }\r
617 \r
618 \r
619 /*----- 次の設定番号のノードを返す --------------------------------------------\r
620 *\r
621 *       Parameter\r
622 *               HOSTLISTDATA *Pos : ノードデータ\r
623 *\r
624 *       Return Value\r
625 *               HOSTLISTDATA *次のノード\r
626 *                       NULL=次はない\r
627 *----------------------------------------------------------------------------*/\r
628 \r
629 static HOSTLISTDATA *GetNextNode(HOSTLISTDATA *Pos)\r
630 {\r
631         HOSTLISTDATA *Ret;\r
632 \r
633         Ret = NULL;\r
634         if(Pos->Child != NULL)\r
635                 Ret = Pos->Child;\r
636         else\r
637         {\r
638                 if(Pos->Next != NULL)\r
639                         Ret = Pos->Next;\r
640                 else\r
641                 {\r
642                         while(Pos->Parent != NULL)\r
643                         {\r
644                                 Pos = Pos->Parent;\r
645                                 if(Pos->Next != NULL)\r
646                                 {\r
647                                         Ret = Pos->Next;\r
648                                         break;\r
649                                 }\r
650                         }\r
651                 }\r
652         }\r
653         return(Ret);\r
654 }\r
655 \r
656 \r
657 /*----- ノードのレベル数を返す(設定番号指定) --------------------------------\r
658 *\r
659 *       Parameter\r
660 *               int Num : 設定値号番号\r
661 *\r
662 *       Return Value\r
663 *               int レベル数 (-1=設定がない)\r
664 *----------------------------------------------------------------------------*/\r
665 \r
666 static int GetNodeLevel(int Num)\r
667 {\r
668         int Ret;\r
669         HOSTLISTDATA *Pos;\r
670 \r
671         Ret = -1;\r
672         if((Num >= 0) && (Num < Hosts))\r
673         {\r
674                 Pos = GetNodeByNum(Num);\r
675                 Ret = 0;\r
676                 while(Pos->Parent != NULL)\r
677                 {\r
678                         Pos = Pos->Parent;\r
679                         Ret++;\r
680                 }\r
681         }\r
682         return(Ret);\r
683 }\r
684 \r
685 \r
686 /*----- ノードのレベル数を返す(ノードデータ指定)-----------------------------\r
687 *\r
688 *       Parameter\r
689 *               HOSTLISTDATA *Data : 設定値\r
690 *\r
691 *       Return Value\r
692 *               int レベル数\r
693 *----------------------------------------------------------------------------*/\r
694 \r
695 static int GetNodeLevelByData(HOSTLISTDATA *Data)\r
696 {\r
697         int Ret;\r
698 \r
699         Ret = 0;\r
700         while(Data->Parent != NULL)\r
701         {\r
702                 Data = Data->Parent;\r
703                 Ret++;\r
704         }\r
705         return(Ret);\r
706 }\r
707 \r
708 \r
709 /*----- ノードの設定番号を返す ------------------------------------------------\r
710 *\r
711 *       Parameter\r
712 *               HOSTLISTDATA *Data : 設定値\r
713 *\r
714 *       Return Value\r
715 *               int 設定番号\r
716 *----------------------------------------------------------------------------*/\r
717 \r
718 static int GetNodeNumByData(HOSTLISTDATA *Data)\r
719 {\r
720         int Ret;\r
721         HOSTLISTDATA *Pos;\r
722 \r
723         Ret = 0;\r
724         Pos = HostListTop;\r
725         while(Pos != Data)\r
726         {\r
727                 Pos = GetNextNode(Pos);\r
728                 Ret++;\r
729         }\r
730         return(Ret);\r
731 }\r
732 \r
733 \r
734 /*----- 指定番号のノードを返す ------------------------------------------------\r
735 *\r
736 *       Parameter\r
737 *               int Num : 設定番号\r
738 *\r
739 *       Return Value\r
740 *               HOSTLISTDATA * : 設定値\r
741 *----------------------------------------------------------------------------*/\r
742 \r
743 static HOSTLISTDATA *GetNodeByNum(int Num)\r
744 {\r
745         HOSTLISTDATA *Pos;\r
746 \r
747         Pos = HostListTop;\r
748         for(; Num > 0; Num--)\r
749                 Pos = GetNextNode(Pos);\r
750 \r
751         return(Pos);\r
752 }\r
753 \r
754 \r
755 /*----- 設定値リストの各ノードのレベル番号をセット ----------------------------\r
756 *\r
757 *       Parameter\r
758 *               int Num : 設定番号\r
759 *\r
760 *       Return Value\r
761 *               HOSTLISTDATA * : 設定値\r
762 *----------------------------------------------------------------------------*/\r
763 \r
764 static int SetNodeLevelAll(void)\r
765 {\r
766         HOSTLISTDATA *Pos;\r
767         int i;\r
768 \r
769         Pos = HostListTop;\r
770         for(i = 0; i < Hosts; i++)\r
771         {\r
772                 Pos->Set.Level &= ~SET_LEVEL_MASK;\r
773                 Pos->Set.Level |= GetNodeLevelByData(Pos);\r
774                 Pos = GetNextNode(Pos);\r
775         }\r
776         return(FFFTP_SUCCESS);\r
777 }\r
778 \r
779 \r
780 /*----- 設定値リストに追加 ----------------------------------------------------\r
781 *\r
782 *       Parameter\r
783 *               HOSTDATA *Set : 追加する設定値\r
784 *               int Pos : 追加する位置 (0~ : -1=最後)\r
785 *               int Level : レベル数 (SET_LEVEL_SAME=追加位置のものと同レベル)\r
786 *\r
787 *       Return Value\r
788 *               int ステータス\r
789 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
790 *----------------------------------------------------------------------------*/\r
791 \r
792 int AddHostToList(HOSTDATA *Set, int Pos, int Level)\r
793 {\r
794         int Sts;\r
795         HOSTLISTDATA *New;\r
796         HOSTLISTDATA *Last;\r
797         int Cur;\r
798 \r
799         Sts = FFFTP_FAIL;\r
800         if((Pos >= -1) && (Pos <= Hosts))\r
801         {\r
802                 if(Pos == -1)\r
803                         Pos = Hosts;\r
804                 Level &= SET_LEVEL_MASK;\r
805 \r
806                 if((New = malloc(sizeof(HOSTLISTDATA))) != NULL)\r
807                 {\r
808                         memcpy(&New->Set, Set, sizeof(HOSTDATA));\r
809                         New->Next = NULL;\r
810                         New->Prev = NULL;\r
811                         New->Child = NULL;\r
812                         New->Parent = NULL;\r
813 \r
814                         if(HostListTop == NULL)\r
815                         {\r
816                                 if(Pos == 0)\r
817                                         HostListTop = New;\r
818                         }\r
819                         else\r
820                         {\r
821                                 if(Pos == 0)\r
822                                 {\r
823                                         New->Next = HostListTop;\r
824                                         HostListTop = New;\r
825                                 }\r
826                                 else\r
827                                 {\r
828                                         Cur = GetNodeLevel(Pos-1);\r
829                                         Last = HostListTop;\r
830                                         for(Pos--; Pos > 0; Pos--)\r
831                                                 Last = GetNextNode(Last);\r
832                                         if((Level != SET_LEVEL_SAME) && (Level > Cur))\r
833                                         {\r
834                                                 New->Next = Last->Child;\r
835                                                 New->Parent = Last;\r
836                                                 Last->Child = New;\r
837                                                 if(New->Next != NULL)\r
838                                                         New->Next->Prev = New;\r
839                                         }\r
840                                         else\r
841                                         {\r
842                                                 if((Level >= 0) && (Level < SET_LEVEL_SAME))\r
843                                                 {\r
844                                                         for(; Level < Cur; Cur--)\r
845                                                                 Last = Last->Parent;\r
846                                                 }\r
847                                                 New->Prev = Last;\r
848                                                 New->Next = Last->Next;\r
849                                                 New->Parent = Last->Parent;\r
850                                                 Last->Next = New;\r
851                                                 if(New->Next != NULL)\r
852                                                         New->Next->Prev = New;\r
853                                         }\r
854                                 }\r
855                         }\r
856                         Hosts++;\r
857                         Sts = FFFTP_SUCCESS;\r
858                 }\r
859         }\r
860         return(Sts);\r
861 }\r
862 \r
863 \r
864 /*----- 設定値リストを更新する ------------------------------------------------\r
865 *\r
866 *       Parameter\r
867 *               int Num : 設定値号番号\r
868 *               HOSTDATA *Set : 設定値をコピーするワーク\r
869 *\r
870 *       Return Value\r
871 *               int ステータス\r
872 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
873 *----------------------------------------------------------------------------*/\r
874 \r
875 static int UpdateHostToList(int Num, HOSTDATA *Set)\r
876 {\r
877         int Sts;\r
878         HOSTLISTDATA *Pos;\r
879 \r
880         Sts = FFFTP_FAIL;\r
881         if((Num >= 0) && (Num < Hosts))\r
882         {\r
883                 Pos = GetNodeByNum(Num);\r
884                 memcpy(&Pos->Set, Set, sizeof(HOSTDATA));\r
885                 Sts = FFFTP_SUCCESS;\r
886         }\r
887         return(Sts);\r
888 }\r
889 \r
890 \r
891 /*----- 設定値リストから削除 --------------------------------------------------\r
892 *\r
893 *       Parameter\r
894 *               int Num : 削除する番号\r
895 *\r
896 *       Return Value\r
897 *               int ステータス\r
898 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
899 *----------------------------------------------------------------------------*/\r
900 \r
901 static int DelHostFromList(int Num)\r
902 {\r
903         int Sts;\r
904         HOSTLISTDATA *Pos;\r
905 \r
906         Sts = FFFTP_FAIL;\r
907         if((Num >= 0) && (Num < Hosts))\r
908         {\r
909                 if(Num == 0)\r
910                 {\r
911                         Pos = HostListTop;\r
912                         if(Pos->Child != NULL)\r
913                                 DeleteChildAndNext(Pos->Child);\r
914                         HostListTop = Pos->Next;\r
915                 }\r
916                 else\r
917                 {\r
918                         Pos = GetNodeByNum(Num);\r
919                         if(Pos->Child != NULL)\r
920                                 DeleteChildAndNext(Pos->Child);\r
921 \r
922                         if(Pos->Next != NULL)\r
923                                 Pos->Next->Prev = Pos->Prev;\r
924                         if(Pos->Prev != NULL)\r
925                                 Pos->Prev->Next = Pos->Next;\r
926                         if((Pos->Parent != NULL) && (Pos->Parent->Child == Pos))\r
927                                 Pos->Parent->Child = Pos->Next;\r
928                 }\r
929                 free(Pos);\r
930                 Hosts--;\r
931                 Sts = FFFTP_SUCCESS;\r
932         }\r
933         return(Sts);\r
934 }\r
935 \r
936 \r
937 /*----- 設定値リストからノードデータを削除 ------------------------------------\r
938 *\r
939 *       Parameter\r
940 *               HOSTLISTDATA *Pos : 削除するノード\r
941 *\r
942 *       Return Value\r
943 *               int ステータス\r
944 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
945 *\r
946 *       Note\r
947 *               Pos->Next, Pos->Childの全てのノードを削除する\r
948 *----------------------------------------------------------------------------*/\r
949 \r
950 static int DeleteChildAndNext(HOSTLISTDATA *Pos)\r
951 {\r
952         HOSTLISTDATA *Next;\r
953 \r
954         while(Pos != NULL)\r
955         {\r
956                 if(Pos->Child != NULL)\r
957                         DeleteChildAndNext(Pos->Child);\r
958 \r
959                 Next = Pos->Next;\r
960                 free(Pos);\r
961                 Hosts--;\r
962                 Pos = Next;\r
963         }\r
964         return(FFFTP_SUCCESS);\r
965 }\r
966 \r
967 \r
968 /*----- 設定値リストから設定値を取り出す --------------------------------------\r
969 *\r
970 *       Parameter\r
971 *               int Num : 設定値号番号\r
972 *               HOSTDATA *Set : 設定値をコピーするワーク\r
973 *\r
974 *       Return Value\r
975 *               int ステータス\r
976 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
977 *\r
978 *       Note\r
979 *               現在ホストに接続中の時は、CopyHostFromListInConnect() を使う事\r
980 *----------------------------------------------------------------------------*/\r
981 \r
982 int CopyHostFromList(int Num, HOSTDATA *Set)\r
983 {\r
984         int Sts;\r
985         HOSTLISTDATA *Pos;\r
986 \r
987         Sts = FFFTP_FAIL;\r
988         if((Num >= 0) && (Num < Hosts))\r
989         {\r
990                 Pos = GetNodeByNum(Num);\r
991                 memcpy(Set, &Pos->Set, sizeof(HOSTDATA));\r
992                 Sts = FFFTP_SUCCESS;\r
993         }\r
994         return(Sts);\r
995 }\r
996 \r
997 \r
998 /*----- 設定値リストから設定値を取り出す --------------------------------------\r
999 *\r
1000 *       Parameter\r
1001 *               int Num : 設定値号番号\r
1002 *               HOSTDATA *Set : 設定値をコピーするワーク\r
1003 *\r
1004 *       Return Value\r
1005 *               int ステータス\r
1006 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
1007 *\r
1008 *       Note\r
1009 *               現在ホストに接続中の時に使う\r
1010 *----------------------------------------------------------------------------*/\r
1011 \r
1012 int CopyHostFromListInConnect(int Num, HOSTDATA *Set)\r
1013 {\r
1014         int Sts;\r
1015         HOSTLISTDATA *Pos;\r
1016 \r
1017         Sts = FFFTP_FAIL;\r
1018         if((Num >= 0) && (Num < Hosts))\r
1019         {\r
1020                 Pos = GetNodeByNum(Num);\r
1021                 strcpy(Set->ChmodCmd, Pos->Set.ChmodCmd);\r
1022                 Set->Port = Pos->Set.Port;\r
1023                 Set->Anonymous = Pos->Set.Anonymous;\r
1024                 Set->KanjiCode = Pos->Set.KanjiCode;\r
1025                 Set->KanaCnv = Pos->Set.KanaCnv;\r
1026                 Set->NameKanjiCode = Pos->Set.NameKanjiCode;\r
1027                 Set->NameKanaCnv = Pos->Set.NameKanaCnv;\r
1028                 Set->Pasv = Pos->Set.Pasv;\r
1029                 Set->FireWall = Pos->Set.FireWall;\r
1030                 Set->ListCmdOnly = Pos->Set.ListCmdOnly;\r
1031                 Set->UseNLST_R = Pos->Set.UseNLST_R;\r
1032                 Set->LastDir = Pos->Set.LastDir;\r
1033                 Set->TimeZone = Pos->Set.TimeZone;\r
1034                 // 暗号化通信対応\r
1035                 Set->UseNoEncryption = Pos->Set.UseNoEncryption;\r
1036                 Set->UseFTPES = Pos->Set.UseFTPES;\r
1037                 Set->UseFTPIS = Pos->Set.UseFTPIS;\r
1038                 Set->UseSFTP = Pos->Set.UseSFTP;\r
1039                 // 同時接続対応\r
1040                 Set->MaxThreadCount = Pos->Set.MaxThreadCount;\r
1041                 Set->ReuseCmdSkt = Pos->Set.ReuseCmdSkt;\r
1042                 // MLSD対応\r
1043                 Set->UseMLSD = Pos->Set.UseMLSD;\r
1044                 // IPv6対応\r
1045                 Set->NetType = Pos->Set.NetType;\r
1046                 // 自動切断対策\r
1047                 Set->NoopInterval = Pos->Set.NoopInterval;\r
1048                 // 再転送対応\r
1049                 Set->TransferErrorMode = Pos->Set.TransferErrorMode;\r
1050                 Set->TransferErrorNotify = Pos->Set.TransferErrorNotify;\r
1051                 Sts = FFFTP_SUCCESS;\r
1052         }\r
1053         return(Sts);\r
1054 }\r
1055 \r
1056 \r
1057 /*----- 設定値リストのブックマークを更新 --------------------------------------\r
1058 *\r
1059 *       Parameter\r
1060 *               int Num : 設定値号番号\r
1061 *               char *Bmask : ブックマーク文字列\r
1062 *               int Len : ブックマーク文字列の長さ\r
1063 *\r
1064 *       Return Value\r
1065 *               int ステータス\r
1066 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
1067 *----------------------------------------------------------------------------*/\r
1068 \r
1069 int SetHostBookMark(int Num, char *Bmask, int Len)\r
1070 {\r
1071         int Sts;\r
1072         HOSTLISTDATA *Pos;\r
1073 \r
1074         Sts = FFFTP_FAIL;\r
1075         if((Num >= 0) && (Num < Hosts))\r
1076         {\r
1077                 Pos = GetNodeByNum(Num);\r
1078                 memcpy(Pos->Set.BookMark, Bmask, Len);\r
1079                 Sts = FFFTP_SUCCESS;\r
1080         }\r
1081         return(Sts);\r
1082 }\r
1083 \r
1084 \r
1085 /*----- 設定値リストのブックマーク文字列を返す --------------------------------\r
1086 *\r
1087 *       Parameter\r
1088 *               int Num : 設定値号番号\r
1089 *\r
1090 *       Return Value\r
1091 *               char *ブックマーク文字列\r
1092 *----------------------------------------------------------------------------*/\r
1093 \r
1094 char *AskHostBookMark(int Num)\r
1095 {\r
1096         char *Ret;\r
1097         HOSTLISTDATA *Pos;\r
1098 \r
1099         Ret = NULL;\r
1100         if((Num >= 0) && (Num < Hosts))\r
1101         {\r
1102                 Pos = GetNodeByNum(Num);\r
1103                 Ret = Pos->Set.BookMark;\r
1104         }\r
1105         return(Ret);\r
1106 }\r
1107 \r
1108 \r
1109 /*----- 設定値リストのディレクトリを更新 --------------------------------------\r
1110 *\r
1111 *       Parameter\r
1112 *               int Num : 設定値号番号\r
1113 *               char *LocDir : ローカルのディレクトリ\r
1114 *               char *HostDir : ホストのディレクトリ\r
1115 *\r
1116 *       Return Value\r
1117 *               int ステータス\r
1118 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
1119 *----------------------------------------------------------------------------*/\r
1120 \r
1121 int SetHostDir(int Num, char *LocDir, char *HostDir)\r
1122 {\r
1123         int Sts;\r
1124         HOSTLISTDATA *Pos;\r
1125 \r
1126         Sts = FFFTP_FAIL;\r
1127         if((Num >= 0) && (Num < Hosts))\r
1128         {\r
1129                 Pos = GetNodeByNum(Num);\r
1130                 strcpy(Pos->Set.LocalInitDir, LocDir);\r
1131                 strcpy(Pos->Set.RemoteInitDir, HostDir);\r
1132                 Sts = FFFTP_SUCCESS;\r
1133         }\r
1134         return(Sts);\r
1135 }\r
1136 \r
1137 \r
1138 /*----- 設定値リストのパスワードを更新 ----------------------------------------\r
1139 *\r
1140 *       Parameter\r
1141 *               int Num : 設定値号番号\r
1142 *               char *Pass : パスワード\r
1143 *\r
1144 *       Return Value\r
1145 *               int ステータス\r
1146 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
1147 *----------------------------------------------------------------------------*/\r
1148 \r
1149 int SetHostPassword(int Num, char *Pass)\r
1150 {\r
1151         int Sts;\r
1152         HOSTLISTDATA *Pos;\r
1153 \r
1154         Sts = FFFTP_FAIL;\r
1155         if((Num >= 0) && (Num < Hosts))\r
1156         {\r
1157                 Pos = GetNodeByNum(Num);\r
1158                 strcpy(Pos->Set.PassWord, Pass);\r
1159                 Sts = FFFTP_SUCCESS;\r
1160         }\r
1161         return(Sts);\r
1162 }\r
1163 \r
1164 \r
1165 /*----- 指定の設定名を持つ設定の番号を返す ------------------------------------\r
1166 *\r
1167 *       Parameter\r
1168 *               char *Name : 設定名\r
1169 *\r
1170 *       Return Value\r
1171 *               int 設定番号 (0~)\r
1172 *                       -1=見つからない\r
1173 *----------------------------------------------------------------------------*/\r
1174 \r
1175 int SearchHostName(char *Name)\r
1176 {\r
1177         int Ret;\r
1178         int i;\r
1179         HOSTLISTDATA *Pos;\r
1180 \r
1181         Ret = -1;\r
1182         Pos = HostListTop;\r
1183         for(i = 0; i < Hosts; i++)\r
1184         {\r
1185                 if(strcmp(Name, Pos->Set.HostName) == 0)\r
1186                 {\r
1187                         Ret = i;\r
1188                         break;\r
1189                 }\r
1190                 Pos = GetNextNode(Pos);\r
1191         }\r
1192         return(Ret);\r
1193 }\r
1194 \r
1195 \r
1196 /*----- 設定値リストのソート方法を更新 ----------------------------------------\r
1197 *\r
1198 *       Parameter\r
1199 *               int Num : 設定値号番号\r
1200 *               int LFSort : ローカルのファイルのソート方法\r
1201 *               int LDSort : ローカルのフォルダのソート方法\r
1202 *               int RFSort : リモートのファイルのソート方法\r
1203 *               int RDSort : リモートのフォルダのソート方法\r
1204 *\r
1205 *       Return Value\r
1206 *               int ステータス\r
1207 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
1208 *----------------------------------------------------------------------------*/\r
1209 \r
1210 int SetHostSort(int Num, int LFSort, int LDSort, int RFSort, int RDSort)\r
1211 {\r
1212         int Sts;\r
1213         HOSTLISTDATA *Pos;\r
1214 \r
1215         Sts = FFFTP_FAIL;\r
1216         if((Num >= 0) && (Num < Hosts))\r
1217         {\r
1218                 Pos = GetNodeByNum(Num);\r
1219                 Pos->Set.Sort = LFSort * 0x1000000 | LDSort * 0x10000 | RFSort * 0x100 | RDSort;\r
1220                 Sts = FFFTP_SUCCESS;\r
1221         }\r
1222         return(Sts);\r
1223 }\r
1224 \r
1225 \r
1226 /*----- 登録されているソート方法を分解する ------------------------------------\r
1227 *\r
1228 *       Parameter\r
1229 *               ulong Sort : ソート方法 \r
1230 *               int *LFSort : ローカルのファイルのソート方法を格納するワーク\r
1231 *               int *LDSort : ローカルのフォルダのソート方法を格納するワーク\r
1232 *               int *RFSort : リモートのファイルのソート方法を格納するワーク\r
1233 *               int *RDSort : リモートのフォルダのソート方法を格納するワーク\r
1234 *\r
1235 *       Return Value\r
1236 *               なし\r
1237 *----------------------------------------------------------------------------*/\r
1238 \r
1239 void DecomposeSortType(ulong Sort, int *LFSort, int *LDSort, int *RFSort, int *RDSort)\r
1240 {\r
1241         *LFSort = (int)((Sort / 0x1000000) & 0xFF);\r
1242         *LDSort = (int)((Sort / 0x10000) & 0xFF);\r
1243         *RFSort = (int)((Sort / 0x100) & 0xFF);\r
1244         *RDSort = (int)(Sort & 0xFF);\r
1245         return;\r
1246 }\r
1247 \r
1248 \r
1249 /*----- 現在接続中の設定番号を返す --------------------------------------------\r
1250 *\r
1251 *       Parameter\r
1252 *               なし\r
1253 *\r
1254 *       Return Value\r
1255 *               int 設定番号\r
1256 *----------------------------------------------------------------------------*/\r
1257 \r
1258 int AskCurrentHost(void)\r
1259 {\r
1260         return(ConnectingHost);\r
1261 }\r
1262 \r
1263 \r
1264 /*----- 現在接続中の設定番号をセットする --------------------------------------\r
1265 *\r
1266 *       Parameter\r
1267 *               int Num : 設定番号\r
1268 *\r
1269 *       Return Value\r
1270 *               なし\r
1271 *----------------------------------------------------------------------------*/\r
1272 \r
1273 void SetCurrentHost(int Num)\r
1274 {\r
1275         ConnectingHost = Num;\r
1276         return;\r
1277 }\r
1278 \r
1279 \r
1280 /*----- デフォルト設定値を取り出す --------------------------------------------\r
1281 *\r
1282 *       Parameter\r
1283 *               HOSTDATA *Set : 設定値をコピーするワーク\r
1284 *\r
1285 *       Return Value\r
1286 *               なし\r
1287 *----------------------------------------------------------------------------*/\r
1288 \r
1289 void CopyDefaultHost(HOSTDATA *Set)\r
1290 {\r
1291         Set->Level = 0;\r
1292         strcpy(Set->HostName, "");\r
1293         strcpy(Set->HostAdrs, "");\r
1294         strcpy(Set->UserName, "");\r
1295         strcpy(Set->PassWord, "");\r
1296         strcpy(Set->Account, "");\r
1297         strcpy(Set->LocalInitDir, DefaultLocalPath);\r
1298         strcpy(Set->RemoteInitDir, "");\r
1299         memcpy(Set->BookMark, "\0\0", 2);\r
1300         strcpy(Set->ChmodCmd, CHMOD_CMD_NOR);\r
1301         strcpy(Set->LsName, LS_FNAME);\r
1302         strcpy(Set->InitCmd, "");\r
1303         Set->Port = PORT_NOR;\r
1304         Set->Anonymous = NO;\r
1305         Set->KanjiCode = KANJI_NOCNV;\r
1306         Set->KanaCnv = YES;\r
1307         Set->NameKanjiCode = KANJI_NOCNV;\r
1308         // UTF-8対応\r
1309         Set->CurNameKanjiCode = KANJI_NOCNV;\r
1310         Set->NameKanaCnv = NO;\r
1311         Set->Pasv = YES;\r
1312         Set->FireWall = NO;\r
1313         Set->ListCmdOnly = YES;\r
1314         Set->UseNLST_R = YES;\r
1315         Set->LastDir = NO;\r
1316         Set->TimeZone = 9;                              /* GMT+9 (JST) */\r
1317         Set->HostType = HTYPE_AUTO;\r
1318         Set->SyncMove = NO;\r
1319         Set->NoFullPath = NO;\r
1320         Set->Sort = SORT_NOTSAVED;\r
1321         Set->Security = SECURITY_AUTO;\r
1322         Set->Dialup = NO;\r
1323         Set->DialupAlways = NO;\r
1324         Set->DialupNotify = YES;\r
1325         strcpy(Set->DialEntry, "");\r
1326         // 暗号化通信対応\r
1327         Set->CryptMode = CRYPT_NONE;\r
1328         Set->UseNoEncryption = YES;\r
1329         Set->UseFTPES = YES;\r
1330         Set->UseFTPIS = YES;\r
1331         Set->UseSFTP = YES;\r
1332         strcpy(Set->PrivateKey, "");\r
1333         // 同時接続対応\r
1334         Set->MaxThreadCount = 1;\r
1335         Set->ReuseCmdSkt = NO;\r
1336         // MLSD対応\r
1337         Set->Feature = 0;\r
1338         Set->UseMLSD = YES;\r
1339         // IPv6対応\r
1340         Set->NetType = NTYPE_AUTO;\r
1341         Set->CurNetType = NTYPE_AUTO;\r
1342         // 自動切断対策\r
1343         Set->NoopInterval = 0;\r
1344         // 再転送対応\r
1345         Set->TransferErrorMode = EXIST_OVW;\r
1346         Set->TransferErrorNotify = YES;\r
1347         return;\r
1348 }\r
1349 \r
1350 \r
1351 /*----- 設定名一覧をウィンドウに送る ------------------------------------------\r
1352 *\r
1353 *       Parameter\r
1354 *               HWND hWnd : ウインドウハンドル\r
1355 *               int Cur : \r
1356 *\r
1357 *       Return Value\r
1358 *               なし\r
1359 *----------------------------------------------------------------------------*/\r
1360 \r
1361 static void SendAllHostNames(HWND hWnd, int Cur)\r
1362 {\r
1363         int i;\r
1364         HOSTLISTDATA *Pos;\r
1365         TV_INSERTSTRUCT tvIns;\r
1366         HTREEITEM hItem;\r
1367         HTREEITEM hItemCur;\r
1368         HTREEITEM *Level;\r
1369         int CurLevel;\r
1370 \r
1371         hItemCur = NULL;\r
1372 \r
1373         /* ちらつくので再描画禁止 */\r
1374         SendMessage(hWnd, WM_SETREDRAW, (WPARAM)FALSE, 0);\r
1375 \r
1376         SendMessage(hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT);         /* 全てを削除 */\r
1377 \r
1378         if((Level = malloc(sizeof(HTREEITEM*) * Hosts + 1)) != NULL)\r
1379         {\r
1380                 Pos = HostListTop;\r
1381                 for(i = 0; i < Hosts; i++)\r
1382                 {\r
1383                         if(Pos->Set.Level & SET_LEVEL_GROUP)\r
1384                         {\r
1385                                 tvIns.item.iImage = 0;\r
1386                                 tvIns.item.iSelectedImage = 0;\r
1387                         }\r
1388                         else\r
1389                         {\r
1390                                 tvIns.item.iImage = 2;\r
1391                                 tvIns.item.iSelectedImage = 2;\r
1392                         }\r
1393 \r
1394                         CurLevel = GetNodeLevel(i);\r
1395                         if(CurLevel == 0)\r
1396                                 tvIns.hParent = TVI_ROOT;\r
1397                         else\r
1398                                 tvIns.hParent = Level[CurLevel - 1];\r
1399 \r
1400                         tvIns.hInsertAfter = TVI_LAST;\r
1401                         tvIns.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN;\r
1402         //              tvIns.item.hItem = 0;\r
1403         //              tvIns.item.state = 0;\r
1404         //              tvIns.item.stateMask = 0;\r
1405                         tvIns.item.pszText = Pos->Set.HostName;\r
1406                         tvIns.item.cchTextMax = 0;\r
1407                         tvIns.item.cChildren = 1;\r
1408                         tvIns.item.lParam = i;\r
1409                         hItem = (HTREEITEM)SendMessage(hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvIns);\r
1410 \r
1411                         if(Pos->Set.Level & SET_LEVEL_GROUP)\r
1412                                 Level[CurLevel] = hItem;\r
1413 \r
1414 //                      DoPrintf("%d = %x", i, hItem);\r
1415                         if(i == Cur)\r
1416                         {\r
1417                                 hItemCur = hItem;\r
1418                         }\r
1419                         Pos = GetNextNode(Pos);\r
1420                 }\r
1421                 free(Level);\r
1422         }\r
1423 \r
1424         /* 再描画 */\r
1425         SendMessage(hWnd, WM_SETREDRAW, (WPARAM)TRUE, 0);\r
1426 \r
1427         if(hItemCur != NULL)\r
1428         {\r
1429                 SendMessage(hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItemCur);\r
1430 //              SendMessage(hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItemCur);\r
1431         }\r
1432         UpdateWindow(hWnd);\r
1433 \r
1434         return;\r
1435 }\r
1436 \r
1437 \r
1438 /*----- 設定値がグループかどうかを返す ----------------------------------------\r
1439 *\r
1440 *       Parameter\r
1441 *               int Num : 設定値号番号\r
1442 *\r
1443 *       Return Value\r
1444 *               int グループかどうか\r
1445 *                       YES/NO/-1=設定値がない\r
1446 *----------------------------------------------------------------------------*/\r
1447 \r
1448 static int IsNodeGroup(int Num)\r
1449 {\r
1450         int Ret;\r
1451         HOSTLISTDATA *Pos;\r
1452 \r
1453         Ret = -1;\r
1454         if((Num >= 0) && (Num < Hosts))\r
1455         {\r
1456                 Pos = GetNodeByNum(Num);\r
1457                 Ret = (Pos->Set.Level & SET_LEVEL_GROUP) ? YES : NO;\r
1458         }\r
1459         return(Ret);\r
1460 }\r
1461 \r
1462 \r
1463 /*----- WS_FTP.INIからのインポート --------------------------------------------\r
1464 *\r
1465 *       Parameter\r
1466 *               なし\r
1467 *\r
1468 *       Return Value\r
1469 *               なし\r
1470 *----------------------------------------------------------------------------*/\r
1471 \r
1472 void ImportFromWSFTP(void)\r
1473 {\r
1474         FILE *Strm;\r
1475         char Buf[FMAX_PATH+1];\r
1476         HOSTDATA Host;\r
1477         int InHost;\r
1478 \r
1479         strcpy(Buf, "WS_FTP.INI");\r
1480         if(SelectFile(GetMainHwnd(), Buf, MSGJPN126, MSGJPN276, NULL, OFN_FILEMUSTEXIST, 0) == TRUE)\r
1481         {\r
1482                 if((Strm = fopen(Buf, "rt")) != NULL)\r
1483                 {\r
1484                         InHost = NO;\r
1485                         while(fgets(Buf, FMAX_PATH, Strm) != NULL)\r
1486                         {\r
1487                                 if(Buf[0] == '[')\r
1488                                 {\r
1489                                         if(InHost == YES)\r
1490                                         {\r
1491                                                 AddHostToList(&Host, -1, 0);\r
1492                                                 InHost = NO;\r
1493                                         }\r
1494                                         if(_stricmp(Buf, "[_config_]\n") != 0)\r
1495                                         {\r
1496                                                 CopyDefaultHost(&Host);\r
1497 \r
1498                                                 *(Buf + strlen(Buf) - 2) = NUL;\r
1499                                                 memset(Host.HostName, NUL, HOST_NAME_LEN+1);\r
1500                                                 strncpy(Host.HostName, Buf+1, HOST_NAME_LEN);\r
1501                                                 InHost = YES;\r
1502                                         }\r
1503                                 }\r
1504                                 else if(InHost == YES)\r
1505                                 {\r
1506                                         FormatIniString(Buf);\r
1507 \r
1508                                         if(_strnicmp(Buf, "HOST=", 5) == 0)\r
1509                                         {\r
1510                                                 memset(Host.HostAdrs, NUL, HOST_ADRS_LEN+1);\r
1511                                                 strncpy(Host.HostAdrs, Buf+5, HOST_ADRS_LEN);\r
1512                                         }\r
1513                                         else if(_strnicmp(Buf, "UID=", 4) == 0)\r
1514                                         {\r
1515                                                 memset(Host.UserName, NUL, USER_NAME_LEN+1);\r
1516                                                 strncpy(Host.UserName, Buf+4, USER_NAME_LEN);\r
1517                                                 if(strcmp(Host.UserName, "anonymous") == 0)\r
1518                                                         strcpy(Host.PassWord, UserMailAdrs);\r
1519                                         }\r
1520                                         else if(_strnicmp(Buf, "LOCDIR=", 7) == 0)\r
1521                                         {\r
1522                                                 memset(Host.LocalInitDir, NUL, INIT_DIR_LEN+1);\r
1523                                                 strncpy(Host.LocalInitDir, Buf+7, INIT_DIR_LEN);\r
1524                                         }\r
1525                                         else if(_strnicmp(Buf, "DIR=", 4) == 0)\r
1526                                         {\r
1527                                                 memset(Host.RemoteInitDir, NUL, INIT_DIR_LEN+1);\r
1528                                                 strncpy(Host.RemoteInitDir, Buf+4, INIT_DIR_LEN);\r
1529                                         }\r
1530                                         else if(_strnicmp(Buf, "PASVMODE=", 9) == 0)\r
1531                                                 Host.Pasv = (atoi(Buf+9) == 0) ? 0 : 1;\r
1532                                         else if(_strnicmp(Buf, "FIREWALL=", 9) == 0)\r
1533                                                 Host.FireWall = (atoi(Buf+9) == 0) ? 0 : 1;\r
1534                                 }\r
1535                         }\r
1536 \r
1537                         if(InHost == YES)\r
1538                                 AddHostToList(&Host, -1, 0);\r
1539                         fclose(Strm);\r
1540                 }\r
1541         }\r
1542         return;\r
1543 }\r
1544 \r
1545 \r
1546 \r
1547 /*----- ホスト設定のプロパティシート ------------------------------------------\r
1548 *\r
1549 *       Parameter\r
1550 *               HWND hDlg : 親ウインドウのハンドル\r
1551 *\r
1552 *       Return Value\r
1553 *               なし\r
1554 *----------------------------------------------------------------------------*/\r
1555 \r
1556 static int DispHostSetDlg(HWND hDlg)\r
1557 {\r
1558         // SFTP、FTPES、FTPIS対応\r
1559         // 同時接続対応\r
1560 //      PROPSHEETPAGE psp[5];\r
1561         PROPSHEETPAGE psp[7];\r
1562         PROPSHEETHEADER psh;\r
1563 \r
1564         // 変数が未初期化のバグ修正\r
1565         memset(&psp, 0, sizeof(psp));\r
1566         memset(&psh, 0, sizeof(psh));\r
1567 \r
1568         psp[0].dwSize = sizeof(PROPSHEETPAGE);\r
1569         psp[0].dwFlags = PSP_USETITLE | PSP_HASHELP;\r
1570         psp[0].hInstance = GetFtpInst();\r
1571         psp[0].pszTemplate = MAKEINTRESOURCE(hset_main_dlg);\r
1572         psp[0].pszIcon = NULL;\r
1573         psp[0].pfnDlgProc = MainSettingProc;\r
1574         psp[0].pszTitle = MSGJPN127;\r
1575         psp[0].lParam = 0;\r
1576         psp[0].pfnCallback = NULL;\r
1577 \r
1578         psp[1].dwSize = sizeof(PROPSHEETPAGE);\r
1579         psp[1].dwFlags = PSP_USETITLE | PSP_HASHELP;\r
1580         psp[1].hInstance = GetFtpInst();\r
1581         psp[1].pszTemplate = MAKEINTRESOURCE(hset_adv_dlg);\r
1582         psp[1].pszIcon = NULL;\r
1583         psp[1].pfnDlgProc = AdvSettingProc;\r
1584         psp[1].pszTitle = MSGJPN128;\r
1585         psp[1].lParam = 0;\r
1586         psp[1].pfnCallback = NULL;\r
1587 \r
1588         psp[2].dwSize = sizeof(PROPSHEETPAGE);\r
1589         psp[2].dwFlags = PSP_USETITLE | PSP_HASHELP;\r
1590         psp[2].hInstance = GetFtpInst();\r
1591         psp[2].pszTemplate = MAKEINTRESOURCE(hset_code_dlg);\r
1592         psp[2].pszIcon = NULL;\r
1593         psp[2].pfnDlgProc = CodeSettingProc;\r
1594         psp[2].pszTitle = MSGJPN129;\r
1595         psp[2].lParam = 0;\r
1596         psp[2].pfnCallback = NULL;\r
1597 \r
1598         psp[3].dwSize = sizeof(PROPSHEETPAGE);\r
1599         psp[3].dwFlags = PSP_USETITLE | PSP_HASHELP;\r
1600         psp[3].hInstance = GetFtpInst();\r
1601         psp[3].pszTemplate = MAKEINTRESOURCE(hset_dialup_dlg);\r
1602         psp[3].pszIcon = NULL;\r
1603         psp[3].pfnDlgProc = DialupSettingProc;\r
1604         psp[3].pszTitle = MSGJPN130;\r
1605         psp[3].lParam = 0;\r
1606         psp[3].pfnCallback = NULL;\r
1607 \r
1608         psp[4].dwSize = sizeof(PROPSHEETPAGE);\r
1609         psp[4].dwFlags = PSP_USETITLE | PSP_HASHELP;\r
1610         psp[4].hInstance = GetFtpInst();\r
1611         psp[4].pszTemplate = MAKEINTRESOURCE(hset_adv2_dlg);\r
1612         psp[4].pszIcon = NULL;\r
1613         psp[4].pfnDlgProc = Adv2SettingProc;\r
1614         psp[4].pszTitle = MSGJPN131;\r
1615         psp[4].lParam = 0;\r
1616         psp[4].pfnCallback = NULL;\r
1617 \r
1618         // SFTP、FTPES、FTPIS対応\r
1619         psp[5].dwSize = sizeof(PROPSHEETPAGE);\r
1620         psp[5].dwFlags = PSP_USETITLE | PSP_HASHELP;\r
1621         psp[5].hInstance = GetFtpInst();\r
1622         psp[5].pszTemplate = MAKEINTRESOURCE(hset_crypt_dlg);\r
1623         psp[5].pszIcon = NULL;\r
1624         psp[5].pfnDlgProc = CryptSettingProc;\r
1625         psp[5].pszTitle = MSGJPN313;\r
1626         psp[5].lParam = 0;\r
1627         psp[5].pfnCallback = NULL;\r
1628 \r
1629         // 同時接続対応\r
1630         psp[6].dwSize = sizeof(PROPSHEETPAGE);\r
1631         psp[6].dwFlags = PSP_USETITLE | PSP_HASHELP;\r
1632         psp[6].hInstance = GetFtpInst();\r
1633         psp[6].pszTemplate = MAKEINTRESOURCE(hset_adv3_dlg);\r
1634         psp[6].pszIcon = NULL;\r
1635         psp[6].pfnDlgProc = Adv3SettingProc;\r
1636         psp[6].pszTitle = MSGJPN320;\r
1637         psp[6].lParam = 0;\r
1638         psp[6].pfnCallback = NULL;\r
1639 \r
1640         psh.dwSize = sizeof(PROPSHEETHEADER);\r
1641         psh.dwFlags = PSH_HASHELP | PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE;\r
1642         psh.hwndParent = hDlg;\r
1643         psh.hInstance = GetFtpInst();\r
1644         psh.pszIcon = NULL;\r
1645         psh.pszCaption = MSGJPN132;\r
1646         psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);\r
1647         psh.nStartPage = 0;\r
1648         psh.ppsp = (LPCPROPSHEETPAGE)&psp;\r
1649         psh.pfnCallback = NULL;\r
1650 \r
1651         Apply = NO;\r
1652         PropertySheet(&psh);\r
1653 \r
1654         return(Apply);\r
1655 }\r
1656 \r
1657 \r
1658 /*----- 基本設定ウインドウのコールバック --------------------------------------\r
1659 *\r
1660 *       Parameter\r
1661 *               HWND hDlg : ウインドウハンドル\r
1662 *               UINT message : メッセージ番号\r
1663 *               WPARAM wParam : メッセージの WPARAM 引数\r
1664 *               LPARAM lParam : メッセージの LPARAM 引数\r
1665 *\r
1666 *       Return Value\r
1667 *               BOOL TRUE/FALSE\r
1668 *----------------------------------------------------------------------------*/\r
1669 \r
1670 static BOOL CALLBACK MainSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1671 {\r
1672         long wStyle;\r
1673         char Tmp[FMAX_PATH+1];\r
1674         NMHDR *pnmhdr;\r
1675 \r
1676         switch (iMessage)\r
1677         {\r
1678                 case WM_INITDIALOG :\r
1679                         SendDlgItemMessage(hDlg, HSET_HOST, EM_LIMITTEXT, HOST_NAME_LEN, 0);\r
1680                         SendDlgItemMessage(hDlg, HSET_ADRS, EM_LIMITTEXT, HOST_ADRS_LEN, 0);\r
1681                         SendDlgItemMessage(hDlg, HSET_USER, EM_LIMITTEXT, USER_NAME_LEN, 0);\r
1682                         SendDlgItemMessage(hDlg, HSET_PASS, EM_LIMITTEXT, PASSWORD_LEN, 0);\r
1683                         SendDlgItemMessage(hDlg, HSET_LOCAL, EM_LIMITTEXT, INIT_DIR_LEN, 0);\r
1684                         SendDlgItemMessage(hDlg, HSET_REMOTE, EM_LIMITTEXT, INIT_DIR_LEN, 0);\r
1685                         SendDlgItemMessage(hDlg, HSET_HOST, WM_SETTEXT, 0, (LPARAM)TmpHost.HostName);\r
1686                         SendDlgItemMessage(hDlg, HSET_ADRS, WM_SETTEXT, 0, (LPARAM)TmpHost.HostAdrs);\r
1687                         SendDlgItemMessage(hDlg, HSET_USER, WM_SETTEXT, 0, (LPARAM)TmpHost.UserName);\r
1688                         SendDlgItemMessage(hDlg, HSET_PASS, WM_SETTEXT, 0, (LPARAM)TmpHost.PassWord);\r
1689                         SendDlgItemMessage(hDlg, HSET_LOCAL, WM_SETTEXT, 0, (LPARAM)TmpHost.LocalInitDir);\r
1690                         SendDlgItemMessage(hDlg, HSET_REMOTE, WM_SETTEXT, 0, (LPARAM)TmpHost.RemoteInitDir);\r
1691                         SendDlgItemMessage(hDlg, HSET_ANONYMOUS, BM_SETCHECK, TmpHost.Anonymous, 0);\r
1692                         SendDlgItemMessage(hDlg, HSET_LASTDIR, BM_SETCHECK, TmpHost.LastDir, 0);\r
1693                         if(AskConnecting() == NO)\r
1694                                 EnableWindow(GetDlgItem(hDlg, HSET_REMOTE_CUR), FALSE);\r
1695                         return(TRUE);\r
1696 \r
1697                 case WM_NOTIFY:\r
1698                         pnmhdr = (NMHDR FAR *)lParam;\r
1699                         switch(pnmhdr->code)\r
1700                         {\r
1701                                 case PSN_APPLY :\r
1702                                         SendDlgItemMessage(hDlg, HSET_HOST, WM_GETTEXT, HOST_NAME_LEN+1, (LPARAM)TmpHost.HostName);\r
1703                                         SendDlgItemMessage(hDlg, HSET_ADRS, WM_GETTEXT, HOST_ADRS_LEN+1, (LPARAM)TmpHost.HostAdrs);\r
1704                                         RemoveTailingSpaces(TmpHost.HostAdrs);\r
1705                                         SendDlgItemMessage(hDlg, HSET_USER, WM_GETTEXT, USER_NAME_LEN+1, (LPARAM)TmpHost.UserName);\r
1706                                         SendDlgItemMessage(hDlg, HSET_PASS, WM_GETTEXT, PASSWORD_LEN+1, (LPARAM)TmpHost.PassWord);\r
1707                                         SendDlgItemMessage(hDlg, HSET_LOCAL, WM_GETTEXT, INIT_DIR_LEN+1, (LPARAM)TmpHost.LocalInitDir);\r
1708                                         SendDlgItemMessage(hDlg, HSET_REMOTE, WM_GETTEXT, INIT_DIR_LEN+1, (LPARAM)TmpHost.RemoteInitDir);\r
1709                                         TmpHost.Anonymous = SendDlgItemMessage(hDlg, HSET_ANONYMOUS, BM_GETCHECK, 0, 0);\r
1710                                         TmpHost.LastDir = SendDlgItemMessage(hDlg, HSET_LASTDIR, BM_GETCHECK, 0, 0);\r
1711                                         if((strlen(TmpHost.HostName) == 0) && (strlen(TmpHost.HostAdrs) > 0))\r
1712                                         {\r
1713                                                 memset(TmpHost.HostName, NUL, HOST_NAME_LEN+1);\r
1714                                                 strncpy(TmpHost.HostName, TmpHost.HostAdrs, HOST_NAME_LEN);\r
1715                                         }\r
1716                                         else if((strlen(TmpHost.HostName) > 0) && (strlen(TmpHost.HostAdrs) == 0))\r
1717                                         {\r
1718                                                 memset(TmpHost.HostAdrs, NUL, HOST_ADRS_LEN+1);\r
1719                                                 strncpy(TmpHost.HostAdrs, TmpHost.HostName, HOST_ADRS_LEN);\r
1720                                         }\r
1721                                         Apply = YES;\r
1722                                         break;\r
1723 \r
1724                                 case PSN_RESET :\r
1725                                         break;\r
1726 \r
1727                                 case PSN_HELP :\r
1728                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000028);\r
1729                                         break;\r
1730                         }\r
1731                         break;\r
1732 \r
1733                 case WM_COMMAND :\r
1734                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
1735                         {\r
1736                                 case HSET_LOCAL_BR :\r
1737                                         if(SelectDir(hDlg, TmpHost.LocalInitDir, INIT_DIR_LEN) == TRUE)\r
1738                                                 SendDlgItemMessage(hDlg, HSET_LOCAL, WM_SETTEXT, 0, (LPARAM)TmpHost.LocalInitDir);\r
1739                                         break;\r
1740 \r
1741                                 case HSET_REMOTE_CUR :\r
1742                                                 AskRemoteCurDir(Tmp, FMAX_PATH);\r
1743                                                 SendDlgItemMessage(hDlg, HSET_REMOTE, WM_SETTEXT, 0, (LPARAM)Tmp);\r
1744                                         break;\r
1745 \r
1746                                 case HSET_ANONYMOUS :\r
1747                                         if(SendDlgItemMessage(hDlg, HSET_ANONYMOUS, BM_GETCHECK, 0, 0) == 1)\r
1748                                         {\r
1749                                                 SendDlgItemMessage(hDlg, HSET_USER, WM_SETTEXT, 0, (LPARAM)"anonymous");\r
1750                                                 wStyle = GetWindowLong(GetDlgItem(hDlg, HSET_PASS), GWL_STYLE);\r
1751                                                 wStyle &= ~ES_PASSWORD;\r
1752                                                 SetWindowLong(GetDlgItem(hDlg, HSET_PASS), GWL_STYLE, wStyle);\r
1753                                                 SendDlgItemMessage(hDlg, HSET_PASS, WM_SETTEXT, 0, (LPARAM)UserMailAdrs);\r
1754                                         }\r
1755                                         else\r
1756                                         {\r
1757                                                 SendDlgItemMessage(hDlg, HSET_USER, WM_SETTEXT, 0, (LPARAM)"");\r
1758                                                 wStyle = GetWindowLong(GetDlgItem(hDlg, HSET_PASS), GWL_STYLE);\r
1759                                                 wStyle |= ES_PASSWORD;\r
1760                                                 SetWindowLong(GetDlgItem(hDlg, HSET_PASS), GWL_STYLE, wStyle);\r
1761                                                 SendDlgItemMessage(hDlg, HSET_PASS, WM_SETTEXT, 0, (LPARAM)"");\r
1762                                         }\r
1763                                         break;\r
1764                         }\r
1765             return(TRUE);\r
1766         }\r
1767         return(FALSE);\r
1768 }\r
1769 \r
1770 \r
1771 /*----- 拡張設定ウインドウのコールバック --------------------------------------\r
1772 *\r
1773 *       Parameter\r
1774 *               HWND hDlg : ウインドウハンドル\r
1775 *               UINT message : メッセージ番号\r
1776 *               WPARAM wParam : メッセージの WPARAM 引数\r
1777 *               LPARAM lParam : メッセージの LPARAM 引数\r
1778 *\r
1779 *       Return Value\r
1780 *               BOOL TRUE/FALSE\r
1781 *----------------------------------------------------------------------------*/\r
1782 \r
1783 static BOOL CALLBACK AdvSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1784 {\r
1785         NMHDR *pnmhdr;\r
1786         char Tmp[20];\r
1787         int i;\r
1788 \r
1789         switch (iMessage)\r
1790         {\r
1791                 case WM_INITDIALOG :\r
1792                         SendDlgItemMessage(hDlg, HSET_PORT, EM_LIMITTEXT, 5, 0);\r
1793                         sprintf(Tmp, "%d", TmpHost.Port);\r
1794                         SendDlgItemMessage(hDlg, HSET_PORT, WM_SETTEXT, 0, (LPARAM)Tmp);\r
1795                         SendDlgItemMessage(hDlg, HSET_ACCOUNT, EM_LIMITTEXT, ACCOUNT_LEN, 0);\r
1796                         SendDlgItemMessage(hDlg, HSET_ACCOUNT, WM_SETTEXT, 0, (LPARAM)TmpHost.Account);\r
1797                         SendDlgItemMessage(hDlg, HSET_PASV, BM_SETCHECK, TmpHost.Pasv, 0);\r
1798                         SendDlgItemMessage(hDlg, HSET_FIREWALL, BM_SETCHECK, TmpHost.FireWall, 0);\r
1799                         SendDlgItemMessage(hDlg, HSET_SYNCMOVE, BM_SETCHECK, TmpHost.SyncMove, 0);\r
1800                         for(i = -12; i <= 12; i++)\r
1801                         {\r
1802                                 if(i == 0)\r
1803                                         sprintf(Tmp, "GMT");\r
1804                                 else if(i == 9)\r
1805                                         sprintf(Tmp, MSGJPN133, i);\r
1806                                 else\r
1807                                         sprintf(Tmp, "GMT%+02d:00", i);\r
1808                                 SendDlgItemMessage(hDlg, HSET_TIMEZONE, CB_ADDSTRING, 0, (LPARAM)Tmp);\r
1809                         }\r
1810                         SendDlgItemMessage(hDlg, HSET_TIMEZONE, CB_SETCURSEL, TmpHost.TimeZone+12, 0);\r
1811 \r
1812                         SendDlgItemMessage(hDlg, HSET_SECURITY, CB_ADDSTRING, 0, (LPARAM)MSGJPN134);\r
1813                         SendDlgItemMessage(hDlg, HSET_SECURITY, CB_ADDSTRING, 0, (LPARAM)MSGJPN135);\r
1814                         SendDlgItemMessage(hDlg, HSET_SECURITY, CB_ADDSTRING, 0, (LPARAM)MSGJPN136);\r
1815                         SendDlgItemMessage(hDlg, HSET_SECURITY, CB_ADDSTRING, 0, (LPARAM)MSGJPN137);\r
1816                         SendDlgItemMessage(hDlg, HSET_SECURITY, CB_ADDSTRING, 0, (LPARAM)MSGJPN138);\r
1817                         SendDlgItemMessage(hDlg, HSET_SECURITY, CB_SETCURSEL, TmpHost.Security, 0);\r
1818                         SendDlgItemMessage(hDlg, HSET_INITCMD, EM_LIMITTEXT, INITCMD_LEN, 0);\r
1819                         SendDlgItemMessage(hDlg, HSET_INITCMD, WM_SETTEXT, 0, (LPARAM)TmpHost.InitCmd);\r
1820                         // IPv6対応\r
1821                         SendDlgItemMessage(hDlg, HSET_NETTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN332);\r
1822                         SendDlgItemMessage(hDlg, HSET_NETTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN333);\r
1823                         SendDlgItemMessage(hDlg, HSET_NETTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN334);\r
1824                         SendDlgItemMessage(hDlg, HSET_NETTYPE, CB_SETCURSEL, TmpHost.NetType, 0);\r
1825                         return(TRUE);\r
1826 \r
1827                 case WM_NOTIFY:\r
1828                         pnmhdr = (NMHDR FAR *)lParam;\r
1829                         switch(pnmhdr->code)\r
1830                         {\r
1831                                 case PSN_APPLY :\r
1832                                         TmpHost.Pasv = SendDlgItemMessage(hDlg, HSET_PASV, BM_GETCHECK, 0, 0);\r
1833                                         TmpHost.FireWall = SendDlgItemMessage(hDlg, HSET_FIREWALL, BM_GETCHECK, 0, 0);\r
1834                                         TmpHost.SyncMove = SendDlgItemMessage(hDlg, HSET_SYNCMOVE, BM_GETCHECK, 0, 0);\r
1835                                         SendDlgItemMessage(hDlg, HSET_PORT, WM_GETTEXT, 5+1, (LPARAM)Tmp);\r
1836                                         TmpHost.Port = atoi(Tmp);\r
1837                                         SendDlgItemMessage(hDlg, HSET_ACCOUNT, WM_GETTEXT, ACCOUNT_LEN+1, (LPARAM)TmpHost.Account);\r
1838                                         TmpHost.TimeZone = SendDlgItemMessage(hDlg, HSET_TIMEZONE, CB_GETCURSEL, 0, 0) - 12;\r
1839                                         TmpHost.Security = SendDlgItemMessage(hDlg, HSET_SECURITY, CB_GETCURSEL, 0, 0);\r
1840                                         SendDlgItemMessage(hDlg, HSET_INITCMD, WM_GETTEXT, INITCMD_LEN+1, (LPARAM)TmpHost.InitCmd);\r
1841                                         // IPv6対応\r
1842                                         TmpHost.NetType = SendDlgItemMessage(hDlg, HSET_NETTYPE, CB_GETCURSEL, 0, 0);\r
1843                                         Apply = YES;\r
1844                                         break;\r
1845 \r
1846                                 case PSN_RESET :\r
1847                                         break;\r
1848 \r
1849                                 case PSN_HELP :\r
1850                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000029);\r
1851                                         break;\r
1852                         }\r
1853                         break;\r
1854 \r
1855                 case WM_COMMAND :\r
1856                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
1857                         {\r
1858                                 case HSET_PORT_NOR :\r
1859                                         sprintf(Tmp, "%d", PORT_NOR);\r
1860                                         SendDlgItemMessage(hDlg, HSET_PORT, WM_SETTEXT, 0, (LPARAM)Tmp);\r
1861                                         break;\r
1862                         }\r
1863                         return(TRUE);\r
1864         }\r
1865         return(FALSE);\r
1866 }\r
1867 \r
1868 \r
1869 /*----- 文字コード設定ウインドウのコールバック --------------------------------\r
1870 *\r
1871 *       Parameter\r
1872 *               HWND hDlg : ウインドウハンドル\r
1873 *               UINT message : メッセージ番号\r
1874 *               WPARAM wParam : メッセージの WPARAM 引数\r
1875 *               LPARAM lParam : メッセージの LPARAM 引数\r
1876 *\r
1877 *       Return Value\r
1878 *               BOOL TRUE/FALSE\r
1879 *----------------------------------------------------------------------------*/\r
1880 \r
1881 static BOOL CALLBACK CodeSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1882 {\r
1883         NMHDR *pnmhdr;\r
1884 \r
1885         // UTF-8対応\r
1886         static const RADIOBUTTON KanjiButton[] = {\r
1887                 { HSET_NO_CNV, KANJI_NOCNV },\r
1888                 { HSET_SJIS_CNV, KANJI_SJIS },\r
1889                 { HSET_JIS_CNV, KANJI_JIS },\r
1890                 { HSET_EUC_CNV, KANJI_EUC },\r
1891                 { HSET_UTF8N_CNV, KANJI_UTF8N },\r
1892                 { HSET_UTF8BOM_CNV, KANJI_UTF8BOM }\r
1893         };\r
1894         #define KANJIBUTTONS    (sizeof(KanjiButton)/sizeof(RADIOBUTTON))\r
1895 \r
1896         static const RADIOBUTTON NameKanjiButton[] = {\r
1897                 { HSET_FN_AUTO_CNV, KANJI_AUTO },\r
1898                 { HSET_FN_SJIS_CNV, KANJI_SJIS },\r
1899                 { HSET_FN_JIS_CNV, KANJI_JIS },\r
1900                 { HSET_FN_EUC_CNV, KANJI_EUC },\r
1901                 { HSET_FN_SMH_CNV, KANJI_SMB_HEX },\r
1902                 { HSET_FN_SMC_CNV, KANJI_SMB_CAP },\r
1903                 { HSET_FN_UTF8N_CNV, KANJI_UTF8N }              // UTF-8対応\r
1904         };\r
1905         #define NAMEKANJIBUTTONS        (sizeof(NameKanjiButton)/sizeof(RADIOBUTTON))\r
1906 \r
1907         switch (iMessage)\r
1908         {\r
1909                 case WM_INITDIALOG :\r
1910                         SetRadioButtonByValue(hDlg, TmpHost.KanjiCode, KanjiButton, KANJIBUTTONS);\r
1911                         SendDlgItemMessage(hDlg, HSET_HANCNV, BM_SETCHECK, TmpHost.KanaCnv, 0);\r
1912                         SetRadioButtonByValue(hDlg, TmpHost.NameKanjiCode, NameKanjiButton, NAMEKANJIBUTTONS);\r
1913                         SendDlgItemMessage(hDlg, HSET_FN_HANCNV, BM_SETCHECK, TmpHost.NameKanaCnv, 0);\r
1914                         return(TRUE);\r
1915 \r
1916                 case WM_NOTIFY:\r
1917                         pnmhdr = (NMHDR FAR *)lParam;\r
1918                         switch(pnmhdr->code)\r
1919                         {\r
1920                                 case PSN_APPLY :\r
1921                                         TmpHost.KanjiCode = AskRadioButtonValue(hDlg, KanjiButton, KANJIBUTTONS);\r
1922                                         TmpHost.KanaCnv = SendDlgItemMessage(hDlg, HSET_HANCNV, BM_GETCHECK, 0, 0);\r
1923                                         TmpHost.NameKanjiCode = AskRadioButtonValue(hDlg, NameKanjiButton, NAMEKANJIBUTTONS);\r
1924                                         TmpHost.NameKanaCnv = SendDlgItemMessage(hDlg, HSET_FN_HANCNV, BM_GETCHECK, 0, 0);\r
1925                                         Apply = YES;\r
1926                                         break;\r
1927 \r
1928                                 case PSN_RESET :\r
1929                                         break;\r
1930 \r
1931                                 case PSN_HELP :\r
1932                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000030);\r
1933                                         break;\r
1934                         }\r
1935                         break;\r
1936 \r
1937                 case WM_COMMAND :\r
1938                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
1939                         {\r
1940                                 case HSET_SJIS_CNV :\r
1941                                 case HSET_JIS_CNV :\r
1942                                 case HSET_EUC_CNV :\r
1943                                         EnableWindow(GetDlgItem(hDlg, HSET_HANCNV), TRUE);\r
1944                                         break;\r
1945 \r
1946                                 // UTF-8対応\r
1947                                 case HSET_NO_CNV :\r
1948                                 case HSET_UTF8N_CNV :\r
1949                                 case HSET_UTF8BOM_CNV :\r
1950                                         EnableWindow(GetDlgItem(hDlg, HSET_HANCNV), FALSE);\r
1951                                         break;\r
1952 \r
1953                                 case HSET_FN_JIS_CNV :\r
1954                                 case HSET_FN_EUC_CNV :\r
1955                                         EnableWindow(GetDlgItem(hDlg, HSET_FN_HANCNV), TRUE);\r
1956                                         break;\r
1957 \r
1958                                 case HSET_FN_AUTO_CNV :\r
1959                                 case HSET_FN_SJIS_CNV :\r
1960                                 case HSET_FN_SMH_CNV :\r
1961                                 case HSET_FN_SMC_CNV :\r
1962                                 case HSET_FN_UTF8N_CNV :        // UTF-8対応\r
1963                                         EnableWindow(GetDlgItem(hDlg, HSET_FN_HANCNV), FALSE);\r
1964                                         break;\r
1965                         }\r
1966                         return(TRUE);\r
1967         }\r
1968         return(FALSE);\r
1969 }\r
1970 \r
1971 \r
1972 /*----- ダイアルアップ設定ウインドウのコールバック ----------------------------\r
1973 *\r
1974 *       Parameter\r
1975 *               HWND hDlg : ウインドウハンドル\r
1976 *               UINT message : メッセージ番号\r
1977 *               WPARAM wParam : メッセージの WPARAM 引数\r
1978 *               LPARAM lParam : メッセージの LPARAM 引数\r
1979 *\r
1980 *       Return Value\r
1981 *               BOOL TRUE/FALSE\r
1982 *----------------------------------------------------------------------------*/\r
1983 \r
1984 static BOOL CALLBACK DialupSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
1985 {\r
1986         NMHDR *pnmhdr;\r
1987 \r
1988         switch (iMessage)\r
1989         {\r
1990                 case WM_INITDIALOG :\r
1991                         SendDlgItemMessage(hDlg, HSET_DIALUP, BM_SETCHECK, TmpHost.Dialup, 0);\r
1992                         SendDlgItemMessage(hDlg, HSET_DIALUSETHIS, BM_SETCHECK, TmpHost.DialupAlways, 0);\r
1993                         SendDlgItemMessage(hDlg, HSET_DIALNOTIFY, BM_SETCHECK, TmpHost.DialupNotify, 0);\r
1994                         if(AskRasUsable() == NO)\r
1995                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALUP), FALSE);\r
1996                         if((TmpHost.DialupAlways == NO) || (AskRasUsable() == NO))\r
1997                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALNOTIFY), FALSE);\r
1998                         if((TmpHost.Dialup == NO) || (AskRasUsable() == NO))\r
1999                         {\r
2000                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALENTRY), FALSE);\r
2001                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALUSETHIS), FALSE);\r
2002                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALNOTIFY), FALSE);\r
2003                         }\r
2004                         SetRasEntryToComboBox(hDlg, HSET_DIALENTRY, TmpHost.DialEntry);\r
2005                         return(TRUE);\r
2006 \r
2007                 case WM_NOTIFY:\r
2008                         pnmhdr = (NMHDR FAR *)lParam;\r
2009                         switch(pnmhdr->code)\r
2010                         {\r
2011                                 case PSN_APPLY :\r
2012                                         TmpHost.Dialup = SendDlgItemMessage(hDlg, HSET_DIALUP, BM_GETCHECK, 0, 0);\r
2013                                         TmpHost.DialupAlways = SendDlgItemMessage(hDlg, HSET_DIALUSETHIS, BM_GETCHECK, 0, 0);\r
2014                                         TmpHost.DialupNotify = SendDlgItemMessage(hDlg, HSET_DIALNOTIFY, BM_GETCHECK, 0, 0);\r
2015                                         SendDlgItemMessage(hDlg, HSET_DIALENTRY, WM_GETTEXT, RAS_NAME_LEN+1, (LPARAM)TmpHost.DialEntry);\r
2016                                         Apply = YES;\r
2017                                         break;\r
2018 \r
2019                                 case PSN_RESET :\r
2020                                         break;\r
2021 \r
2022                                 case PSN_HELP :\r
2023                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000031);\r
2024                                         break;\r
2025                         }\r
2026                         break;\r
2027 \r
2028                 case WM_COMMAND :\r
2029                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
2030                         {\r
2031                                 case HSET_DIALUP :\r
2032                                         if(SendDlgItemMessage(hDlg, HSET_DIALUP, BM_GETCHECK, 0, 0) == 0)\r
2033                                         {\r
2034                                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALENTRY), FALSE);\r
2035                                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALUSETHIS), FALSE);\r
2036                                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALNOTIFY), FALSE);\r
2037                                                 break;\r
2038                                         }\r
2039                                         else\r
2040                                         {\r
2041                                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALENTRY), TRUE);\r
2042                                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALUSETHIS), TRUE);\r
2043                                         }\r
2044                                         /* ここにbreakはない */\r
2045 \r
2046                                 case HSET_DIALUSETHIS :\r
2047                                         if(SendDlgItemMessage(hDlg, HSET_DIALUSETHIS, BM_GETCHECK, 0, 0) == 0)\r
2048                                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALNOTIFY), FALSE);\r
2049                                         else\r
2050                                                 EnableWindow(GetDlgItem(hDlg, HSET_DIALNOTIFY), TRUE);\r
2051                                         break;\r
2052                         }\r
2053                         return(TRUE);\r
2054         }\r
2055         return(FALSE);\r
2056 }\r
2057 \r
2058 \r
2059 /*----- 高度設定ウインドウのコールバック --------------------------------------\r
2060 *\r
2061 *       Parameter\r
2062 *               HWND hDlg : ウインドウハンドル\r
2063 *               UINT message : メッセージ番号\r
2064 *               WPARAM wParam : メッセージの WPARAM 引数\r
2065 *               LPARAM lParam : メッセージの LPARAM 引数\r
2066 *\r
2067 *       Return Value\r
2068 *               BOOL TRUE/FALSE\r
2069 *----------------------------------------------------------------------------*/\r
2070 \r
2071 static BOOL CALLBACK Adv2SettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2072 {\r
2073         NMHDR *pnmhdr;\r
2074         int Num;\r
2075 \r
2076         switch (iMessage)\r
2077         {\r
2078                 case WM_INITDIALOG :\r
2079                         SendDlgItemMessage(hDlg, HSET_CHMOD_CMD, EM_LIMITTEXT, CHMOD_CMD_LEN, 0);\r
2080                         SendDlgItemMessage(hDlg, HSET_CHMOD_CMD, WM_SETTEXT, 0, (LPARAM)TmpHost.ChmodCmd);\r
2081                         SendDlgItemMessage(hDlg, HSET_LS_FNAME, EM_LIMITTEXT, NLST_NAME_LEN, 0);\r
2082                         SendDlgItemMessage(hDlg, HSET_LS_FNAME, WM_SETTEXT, 0, (LPARAM)TmpHost.LsName);\r
2083                         SendDlgItemMessage(hDlg, HSET_LISTCMD, BM_SETCHECK, TmpHost.ListCmdOnly, 0);\r
2084                         if(TmpHost.ListCmdOnly == YES)\r
2085                                 EnableWindow(GetDlgItem(hDlg, HSET_NLST_R), FALSE);\r
2086                         // MLSD対応\r
2087                         else\r
2088                                 EnableWindow(GetDlgItem(hDlg, HSET_MLSDCMD), FALSE);\r
2089                         SendDlgItemMessage(hDlg, HSET_MLSDCMD, BM_SETCHECK, TmpHost.UseMLSD, 0);\r
2090                         SendDlgItemMessage(hDlg, HSET_NLST_R, BM_SETCHECK, TmpHost.UseNLST_R, 0);\r
2091                         SendDlgItemMessage(hDlg, HSET_FULLPATH, BM_SETCHECK, TmpHost.NoFullPath, 0);\r
2092                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN139);\r
2093                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN140);\r
2094                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN141);\r
2095                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN142);\r
2096                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN143);\r
2097                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN144);\r
2098                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN289);\r
2099                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_ADDSTRING, 0, (LPARAM)MSGJPN295);\r
2100                         SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_SETCURSEL, TmpHost.HostType, 0);\r
2101                         if(TmpHost.HostType == 2)\r
2102                         {\r
2103                                 EnableWindow(GetDlgItem(hDlg, HSET_NLST_R), FALSE);\r
2104                                 EnableWindow(GetDlgItem(hDlg, HSET_LISTCMD), FALSE);\r
2105                                 EnableWindow(GetDlgItem(hDlg, HSET_FULLPATH), FALSE);\r
2106                         }\r
2107                         return(TRUE);\r
2108 \r
2109                 case WM_NOTIFY:\r
2110                         pnmhdr = (NMHDR FAR *)lParam;\r
2111                         switch(pnmhdr->code)\r
2112                         {\r
2113                                 case PSN_APPLY :\r
2114                                         SendDlgItemMessage(hDlg, HSET_CHMOD_CMD, WM_GETTEXT, CHMOD_CMD_LEN+1, (LPARAM)TmpHost.ChmodCmd);\r
2115                                         SendDlgItemMessage(hDlg, HSET_LS_FNAME, WM_GETTEXT, NLST_NAME_LEN+1, (LPARAM)TmpHost.LsName);\r
2116                                         TmpHost.ListCmdOnly = SendDlgItemMessage(hDlg, HSET_LISTCMD, BM_GETCHECK, 0, 0);\r
2117                                         // MLSD対応\r
2118                                         TmpHost.UseMLSD = SendDlgItemMessage(hDlg, HSET_MLSDCMD, BM_GETCHECK, 0, 0);\r
2119                                         TmpHost.UseNLST_R = SendDlgItemMessage(hDlg, HSET_NLST_R, BM_GETCHECK, 0, 0);\r
2120                                         TmpHost.NoFullPath = SendDlgItemMessage(hDlg, HSET_FULLPATH, BM_GETCHECK, 0, 0);\r
2121                                         TmpHost.HostType = SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_GETCURSEL, 0, 0);\r
2122                                         Apply = YES;\r
2123                                         break;\r
2124 \r
2125                                 case PSN_RESET :\r
2126                                         break;\r
2127 \r
2128                                 case PSN_HELP :\r
2129                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000032);\r
2130                                         break;\r
2131                         }\r
2132                         break;\r
2133 \r
2134                 case WM_COMMAND :\r
2135                         switch(GET_WM_COMMAND_ID(wParam, lParam))\r
2136                         {\r
2137                                 case HSET_CHMOD_NOR :\r
2138                                         SendDlgItemMessage(hDlg, HSET_CHMOD_CMD, WM_SETTEXT, 0, (LPARAM)CHMOD_CMD_NOR);\r
2139                                         break;\r
2140 \r
2141                                 case HSET_LS_FNAME_NOR :\r
2142                                         SendDlgItemMessage(hDlg, HSET_LS_FNAME, WM_SETTEXT, 0, (LPARAM)LS_FNAME);\r
2143                                         break;\r
2144 \r
2145                                 case HSET_LISTCMD :\r
2146                                         if(SendDlgItemMessage(hDlg, HSET_LISTCMD, BM_GETCHECK, 0, 0) == 0)\r
2147                                                 // MLSD対応\r
2148 //                                              EnableWindow(GetDlgItem(hDlg, HSET_NLST_R), TRUE);\r
2149                                         {\r
2150                                                 EnableWindow(GetDlgItem(hDlg, HSET_MLSDCMD), FALSE);\r
2151                                                 EnableWindow(GetDlgItem(hDlg, HSET_NLST_R), TRUE);\r
2152                                         }\r
2153                                         else\r
2154                                                 // MLSD対応\r
2155 //                                              EnableWindow(GetDlgItem(hDlg, HSET_NLST_R), FALSE);\r
2156                                         {\r
2157                                                 EnableWindow(GetDlgItem(hDlg, HSET_MLSDCMD), TRUE);\r
2158                                                 EnableWindow(GetDlgItem(hDlg, HSET_NLST_R), FALSE);\r
2159                                         }\r
2160                                         break;\r
2161 \r
2162                                 case HSET_HOSTTYPE :\r
2163                                         Num = SendDlgItemMessage(hDlg, HSET_HOSTTYPE, CB_GETCURSEL, 0, 0);\r
2164                                         if(Num == 2)\r
2165                                         {\r
2166                                                 EnableWindow(GetDlgItem(hDlg, HSET_NLST_R), FALSE);\r
2167                                                 EnableWindow(GetDlgItem(hDlg, HSET_LISTCMD), FALSE);\r
2168                                                 EnableWindow(GetDlgItem(hDlg, HSET_FULLPATH), FALSE);\r
2169                                         }\r
2170                                         else\r
2171                                         {\r
2172                                                 EnableWindow(GetDlgItem(hDlg, HSET_NLST_R), TRUE);\r
2173                                                 EnableWindow(GetDlgItem(hDlg, HSET_LISTCMD), TRUE);\r
2174                                                 EnableWindow(GetDlgItem(hDlg, HSET_FULLPATH), TRUE);\r
2175                                         }\r
2176                                         break;\r
2177                         }\r
2178                         return(TRUE);\r
2179         }\r
2180         return(FALSE);\r
2181 }\r
2182 \r
2183 \r
2184 // 暗号化通信対応\r
2185 static BOOL CALLBACK CryptSettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2186 {\r
2187         NMHDR *pnmhdr;\r
2188 //      int Num;\r
2189 \r
2190         switch (iMessage)\r
2191         {\r
2192                 case WM_INITDIALOG :\r
2193                         SendDlgItemMessage(hDlg, HSET_NO_ENCRYPTION, BM_SETCHECK, TmpHost.UseNoEncryption, 0);\r
2194                         if(IsOpenSSLLoaded())\r
2195                         {\r
2196                                 SendDlgItemMessage(hDlg, HSET_FTPES, BM_SETCHECK, TmpHost.UseFTPES, 0);\r
2197                                 SendDlgItemMessage(hDlg, HSET_FTPIS, BM_SETCHECK, TmpHost.UseFTPIS, 0);\r
2198                         }\r
2199                         else\r
2200                         {\r
2201                                 SendDlgItemMessage(hDlg, HSET_FTPES, BM_SETCHECK, BST_UNCHECKED, 0);\r
2202                                 EnableWindow(GetDlgItem(hDlg, HSET_FTPES), FALSE);\r
2203                                 SendDlgItemMessage(hDlg, HSET_FTPIS, BM_SETCHECK, BST_UNCHECKED, 0);\r
2204                                 EnableWindow(GetDlgItem(hDlg, HSET_FTPIS), FALSE);\r
2205                         }\r
2206                         SendDlgItemMessage(hDlg, HSET_SFTP, BM_SETCHECK, TmpHost.UseSFTP, 0);\r
2207                         SendDlgItemMessage(hDlg, HSET_PRIVATE_KEY, WM_SETTEXT, 0, (LPARAM)TmpHost.PrivateKey);\r
2208                         // TODO: SFTP対応\r
2209                         SendDlgItemMessage(hDlg, HSET_SFTP, BM_SETCHECK, BST_UNCHECKED, 0);\r
2210                         EnableWindow(GetDlgItem(hDlg, HSET_SFTP), FALSE);\r
2211                         EnableWindow(GetDlgItem(hDlg, PKEY_FILE_BR), FALSE);\r
2212                         EnableWindow(GetDlgItem(hDlg, HSET_PRIVATE_KEY), FALSE);\r
2213                         return(TRUE);\r
2214 \r
2215                 case WM_NOTIFY:\r
2216                         pnmhdr = (NMHDR FAR *)lParam;\r
2217                         switch(pnmhdr->code)\r
2218                         {\r
2219                                 case PSN_APPLY :\r
2220                                         TmpHost.UseNoEncryption = SendDlgItemMessage(hDlg, HSET_NO_ENCRYPTION, BM_GETCHECK, 0, 0);\r
2221                                         if(IsOpenSSLLoaded())\r
2222                                         {\r
2223                                                 TmpHost.UseFTPES = SendDlgItemMessage(hDlg, HSET_FTPES, BM_GETCHECK, 0, 0);\r
2224                                                 TmpHost.UseFTPIS = SendDlgItemMessage(hDlg, HSET_FTPIS, BM_GETCHECK, 0, 0);\r
2225                                         }\r
2226                                         // TODO: SFTP対応\r
2227 //                                      TmpHost.UseSFTP = SendDlgItemMessage(hDlg, HSET_SFTP, BM_GETCHECK, 0, 0);\r
2228                                         SendDlgItemMessage(hDlg, HSET_PRIVATE_KEY, WM_GETTEXT, PRIVATE_KEY_LEN+1, (LPARAM)TmpHost.PrivateKey);\r
2229                                         Apply = YES;\r
2230                                         break;\r
2231 \r
2232                                 case PSN_RESET :\r
2233                                         break;\r
2234 \r
2235                                 case PSN_HELP :\r
2236                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000065);\r
2237                                         break;\r
2238                         }\r
2239                         break;\r
2240         }\r
2241         return(FALSE);\r
2242 }\r
2243 \r
2244 // 同時接続対応\r
2245 static BOOL CALLBACK Adv3SettingProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)\r
2246 {\r
2247         NMHDR *pnmhdr;\r
2248 //      int Num;\r
2249 \r
2250         // UTF-8対応\r
2251         static const RADIOBUTTON KanjiButton[] = {\r
2252                 { HSET_NO_CNV, KANJI_NOCNV },\r
2253                 { HSET_SJIS_CNV, KANJI_SJIS },\r
2254                 { HSET_JIS_CNV, KANJI_JIS },\r
2255                 { HSET_EUC_CNV, KANJI_EUC },\r
2256                 { HSET_UTF8N_CNV, KANJI_UTF8N },\r
2257                 { HSET_UTF8BOM_CNV, KANJI_UTF8BOM }\r
2258         };\r
2259         #define KANJIBUTTONS    (sizeof(KanjiButton)/sizeof(RADIOBUTTON))\r
2260 \r
2261         switch (iMessage)\r
2262         {\r
2263                 case WM_INITDIALOG :\r
2264                         SendDlgItemMessage(hDlg, HSET_THREAD_COUNT, EM_LIMITTEXT, (WPARAM)1, 0);\r
2265                         SetDecimalText(hDlg, HSET_THREAD_COUNT, TmpHost.MaxThreadCount);\r
2266                         SendDlgItemMessage(hDlg, HSET_THREAD_COUNT_SPN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(MAX_DATA_CONNECTION, 1));\r
2267                         SendDlgItemMessage(hDlg, HSET_REUSE_SOCKET, BM_SETCHECK, TmpHost.ReuseCmdSkt, 0);\r
2268                         SendDlgItemMessage(hDlg, HSET_NOOP_INTERVAL, EM_LIMITTEXT, (WPARAM)3, 0);\r
2269                         SetDecimalText(hDlg, HSET_NOOP_INTERVAL, TmpHost.NoopInterval);\r
2270                         SendDlgItemMessage(hDlg, HSET_NOOP_INTERVAL_SPN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(300, 0));\r
2271                         SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_ADDSTRING, 0, (LPARAM)MSGJPN335);\r
2272                         SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_ADDSTRING, 0, (LPARAM)MSGJPN336);\r
2273                         SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_ADDSTRING, 0, (LPARAM)MSGJPN337);\r
2274                         SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_ADDSTRING, 0, (LPARAM)MSGJPN338);\r
2275                         if(TmpHost.TransferErrorNotify == YES)\r
2276                                 SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_SETCURSEL, 0, 0);\r
2277                         else if(TmpHost.TransferErrorMode == EXIST_OVW)\r
2278                                 SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_SETCURSEL, 1, 0);\r
2279                         else if(TmpHost.TransferErrorMode == EXIST_RESUME)\r
2280                                 SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_SETCURSEL, 2, 0);\r
2281                         else if(TmpHost.TransferErrorMode == EXIST_IGNORE)\r
2282                                 SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_SETCURSEL, 3, 0);\r
2283                         else\r
2284                                 SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_SETCURSEL, 0, 0);\r
2285                         return(TRUE);\r
2286 \r
2287                 case WM_NOTIFY:\r
2288                         pnmhdr = (NMHDR FAR *)lParam;\r
2289                         switch(pnmhdr->code)\r
2290                         {\r
2291                                 case PSN_APPLY :\r
2292                                         TmpHost.MaxThreadCount = GetDecimalText(hDlg, HSET_THREAD_COUNT);\r
2293                                         CheckRange2(&TmpHost.MaxThreadCount, MAX_DATA_CONNECTION, 1);\r
2294                                         TmpHost.ReuseCmdSkt = SendDlgItemMessage(hDlg, HSET_REUSE_SOCKET, BM_GETCHECK, 0, 0);\r
2295                                         TmpHost.NoopInterval = GetDecimalText(hDlg, HSET_NOOP_INTERVAL);\r
2296                                         CheckRange2(&TmpHost.NoopInterval, 300, 0);\r
2297                                         switch(SendDlgItemMessage(hDlg, HSET_ERROR_MODE, CB_GETCURSEL, 0, 0))\r
2298                                         {\r
2299                                         case 0:\r
2300                                                 TmpHost.TransferErrorMode = EXIST_OVW;\r
2301                                                 TmpHost.TransferErrorNotify = YES;\r
2302                                                 break;\r
2303                                         case 1:\r
2304                                                 TmpHost.TransferErrorMode = EXIST_OVW;\r
2305                                                 TmpHost.TransferErrorNotify = NO;\r
2306                                                 break;\r
2307                                         case 2:\r
2308                                                 TmpHost.TransferErrorMode = EXIST_RESUME;\r
2309                                                 TmpHost.TransferErrorNotify = NO;\r
2310                                                 break;\r
2311                                         case 3:\r
2312                                                 TmpHost.TransferErrorMode = EXIST_IGNORE;\r
2313                                                 TmpHost.TransferErrorNotify = NO;\r
2314                                                 break;\r
2315                                         }\r
2316                                         Apply = YES;\r
2317                                         break;\r
2318 \r
2319                                 case PSN_RESET :\r
2320                                         break;\r
2321 \r
2322                                 case PSN_HELP :\r
2323                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000066);\r
2324                                         break;\r
2325                         }\r
2326                         break;\r
2327         }\r
2328         return(FALSE);\r
2329 }\r
2330 \r
2331 // 暗号化通信対応\r
2332 // ホストの暗号化設定を更新\r
2333 int SetHostExcryption(int Num, int UseNoEncryption, int UseFTPES, int UseFTPIS, int UseSFTP)\r
2334 {\r
2335         int Sts;\r
2336         HOSTLISTDATA *Pos;\r
2337 \r
2338         Sts = FFFTP_FAIL;\r
2339         if((Num >= 0) && (Num < Hosts))\r
2340         {\r
2341                 Pos = GetNodeByNum(Num);\r
2342                 Pos->Set.UseNoEncryption = UseNoEncryption;\r
2343                 Pos->Set.UseFTPES = UseFTPES;\r
2344                 Pos->Set.UseFTPIS = UseFTPIS;\r
2345                 Pos->Set.UseSFTP = UseSFTP;\r
2346                 Sts = FFFTP_SUCCESS;\r
2347         }\r
2348         return(Sts);\r
2349 }\r
2350 \r