OSDN Git Service

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