OSDN Git Service

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