OSDN Git Service

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