OSDN Git Service

Modify documents.
[ffftp/ffftp.git] / main.c
1 /*=============================================================================\r
2 *\r
3 *                                                                       FFFTP\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 <mbstring.h>\r
38 #include <malloc.h>\r
39 #include <windowsx.h>\r
40 #include <commctrl.h>\r
41 #include <stdarg.h>\r
42 // IPv6対応\r
43 //#include <winsock.h>\r
44 \r
45 #include "common.h"\r
46 #include "resource.h"\r
47 #include "aes.h"\r
48 // 暗号化通信対応\r
49 #include "sha.h"\r
50 \r
51 #include <htmlhelp.h>\r
52 #include "helpid.h"\r
53 \r
54 // UTF-8対応\r
55 #undef __MBSWRAPPER_H__\r
56 #include "mbswrapper.h"\r
57 \r
58 \r
59 #define RESIZE_OFF              0               /* ウインドウの区切り位置変更していない */\r
60 #define RESIZE_ON               1               /* ウインドウの区切り位置変更中 */\r
61 #define RESIZE_PREPARE  2               /* ウインドウの区切り位置変更の準備 */\r
62 \r
63 #define RESIZE_HPOS             0               /* ローカル-ホスト間の区切り位置変更 */\r
64 #define RESIZE_VPOS             1               /* リスト-タスク間の区切り位置の変更 */\r
65 \r
66 \r
67 /*===== プロトタイプ =====*/\r
68 \r
69 static int InitApp(LPSTR lpszCmdLine, int cmdShow);\r
70 static int MakeAllWindows(int cmdShow);\r
71 static void DeleteAllObject(void);\r
72 static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
73 static void StartupProc(char *Cmd);\r
74 static int AnalyzeComLine(char *Str, int *AutoConnect, int *CmdOption, char *unc, int Max);\r
75 static int CheckIniFileName(char *Str, char *Ini);\r
76 static int CheckMasterPassword(char *Str, char *Ini);\r
77 static int GetTokenAfterOption(char *Str, char *Result, const char* Opt1, const char* Opt2 );\r
78 static char *GetToken(char *Str, char *Buf);\r
79 static void ExitProc(HWND hWnd);\r
80 static void ChangeDir(int Win, char *Path);\r
81 static void ResizeWindowProc(void);\r
82 static void CalcWinSize(void);\r
83 // static void AskWindowPos(HWND hWnd);\r
84 static void CheckResizeFrame(WPARAM Keys, int x, int y);\r
85 static void DispDirInfo(void);\r
86 static void DeleteAlltempFile(void);\r
87 // 64ビット対応\r
88 //static BOOL CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);\r
89 static INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);\r
90 static int EnterMasterPasswordAndSet( int Res, HWND hWnd );\r
91 \r
92 /*===== ローカルなワーク =====*/\r
93 \r
94 static const char FtpClassStr[] = "FFFTPWin";\r
95 \r
96 static HINSTANCE hInstFtp;\r
97 static HWND hWndFtp = NULL;\r
98 static HWND hWndCurFocus = NULL;\r
99 \r
100 static HACCEL Accel;\r
101 static HBRUSH RootColorBrush = NULL;\r
102 \r
103 static int Resizing = RESIZE_OFF;\r
104 static int ResizePos;\r
105 static HCURSOR hCursor;\r
106 \r
107 int ClientWidth;\r
108 static int ClientHeight;\r
109 int SepaWidth;\r
110 int RemoteWidth;\r
111 int ListHeight;\r
112 \r
113 static TEMPFILELIST *TempFiles = NULL;\r
114 \r
115 static int SaveExit = YES;\r
116 static int AutoExit = NO;\r
117 \r
118 static char HelpPath[FMAX_PATH+1];\r
119 static char IniPath[FMAX_PATH+1];\r
120 static int ForceIni = NO;\r
121 \r
122 TRANSPACKET MainTransPkt;               /* ファイル転送用パケット */\r
123                                                                 /* これを使って転送を行うと、ツールバーの転送 */\r
124                                                                 /* 中止ボタンで中止できる */\r
125 \r
126 char TitleHostName[HOST_ADRS_LEN+1];\r
127 char FilterStr[FILTER_EXT_LEN+1] = { "*" };\r
128 \r
129 int CancelFlg;\r
130 \r
131 // 外部アプリケーションへドロップ後にローカル側のファイル一覧に作業フォルダが表示されるバグ対策\r
132 //static int SuppressRefresh = 0;\r
133 int SuppressRefresh = 0;\r
134 \r
135 static DWORD dwCookie;\r
136 \r
137 // 暗号化通信対応\r
138 static char SSLRootCAFilePath[FMAX_PATH+1];\r
139 // マルチコアCPUの特定環境下でファイル通信中にクラッシュするバグ対策\r
140 static DWORD MainThreadId;\r
141 // ポータブル版判定\r
142 static char PortableFilePath[FMAX_PATH+1];\r
143 static int PortableVersion;\r
144 // ローカル側自動更新\r
145 HANDLE ChangeNotification = INVALID_HANDLE_VALUE;\r
146 \r
147 \r
148 /*===== グローバルなワーク =====*/\r
149 \r
150 HWND hHelpWin = NULL;\r
151 \r
152 /* 設定値 */\r
153 int WinPosX = CW_USEDEFAULT;\r
154 int WinPosY = 0;\r
155 // 機能が増えたためサイズ変更\r
156 // VGAサイズに収まるようになっていたのをSVGAサイズに引き上げ\r
157 //int WinWidth = 630;\r
158 //int WinHeight = 393;\r
159 //int LocalWidth = 309;\r
160 //int TaskHeight = 50;\r
161 //int LocalTabWidth[4] = { 120, 90, 60, 37 };\r
162 //int RemoteTabWidth[6] = { 120, 90, 60, 37, 60, 60 };\r
163 int WinWidth = 790;\r
164 int WinHeight = 513;\r
165 int LocalWidth = 389;\r
166 int TaskHeight = 100;\r
167 int LocalTabWidth[4] = { 160, 110, 60, 37 };\r
168 int RemoteTabWidth[6] = { 160, 110, 60, 37, 60, 60 };\r
169 char UserMailAdrs[USER_MAIL_LEN+1] = { "who@example.com" };\r
170 char ViewerName[VIEWERS][FMAX_PATH+1] = { { "notepad" }, { "" }, { "" } };\r
171 HFONT ListFont = NULL;\r
172 LOGFONT ListLogFont;\r
173 int LocalFileSort = SORT_NAME;\r
174 int LocalDirSort = SORT_NAME;\r
175 int RemoteFileSort = SORT_NAME;\r
176 int RemoteDirSort = SORT_NAME;\r
177 int TransMode = TYPE_X;\r
178 int ConnectOnStart = YES;\r
179 int DebugConsole = NO;\r
180 int SaveWinPos = NO;\r
181 // アスキーモード判別の改良\r
182 //char AsciiExt[ASCII_EXT_LEN+1] = { "*.txt\0*.html\0*.htm\0*.cgi\0*.pl\0" };\r
183 char AsciiExt[ASCII_EXT_LEN+1] = { "*.txt\0*.html\0*.htm\0*.cgi\0*.pl\0*.js\0*.vbs\0*.css\0*.rss\0*.rdf\0*.xml\0*.xhtml\0*.xht\0*.shtml\0*.shtm\0*.sh\0*.py\0*.rb\0*.properties\0*.sql\0*.asp\0*.aspx\0*.php\0*.htaccess\0" };\r
184 int RecvMode = TRANS_DLG;\r
185 int SendMode = TRANS_DLG;\r
186 int MoveMode = MOVE_DLG;\r
187 int ListType = LVS_REPORT;\r
188 // LISTのキャッシュを無効にする(リモートのディレクトリの表示が更新されないバグ対策)\r
189 //int CacheEntry = 10;\r
190 int CacheEntry = -10;\r
191 int CacheSave = NO;\r
192 char DefaultLocalPath[FMAX_PATH+1] = { "" };\r
193 int SaveTimeStamp = YES;\r
194 int FindMode = 0;\r
195 int DotFile = YES;\r
196 int DclickOpen = YES;\r
197 int ConnectAndSet = YES;\r
198 SOUNDFILE Sound[SOUND_TYPES] = { { NO, "" }, { NO, "" }, { NO, "" } };\r
199 int FnameCnv = FNAME_NOCNV;\r
200 int TimeOut = 90;\r
201 int RmEOF = NO;\r
202 int RegType = REGTYPE_REG;\r
203 char FwallHost[HOST_ADRS_LEN+1] = { "" };\r
204 char FwallUser[USER_NAME_LEN+1] = { "" };\r
205 char FwallPass[PASSWORD_LEN+1] = { "" };\r
206 int FwallPort = PORT_NOR;\r
207 int FwallType = 1;\r
208 int FwallDefault = NO;\r
209 int FwallSecurity = SECURITY_AUTO;\r
210 int FwallResolv = NO;\r
211 int FwallLower = NO;\r
212 int FwallDelimiter = '@';\r
213 // ルータ対策\r
214 //int PasvDefault = NO;\r
215 int PasvDefault = YES;\r
216 char MirrorNoTrn[MIRROR_LEN+1] = { "*.bak\0" };\r
217 char MirrorNoDel[MIRROR_LEN+1] = { "" };\r
218 int MirrorFnameCnv = NO;\r
219 int SplitVertical = YES;\r
220 int RasClose = NO;\r
221 int RasCloseNotify = YES;\r
222 int FileHist = 5;\r
223 char DefAttrList[DEFATTRLIST_LEN+1] = { "" };\r
224 SIZE HostDlgSize = { -1, -1 };\r
225 SIZE BmarkDlgSize = { -1, -1 };\r
226 SIZE MirrorDlgSize = { -1, -1 };\r
227 int Sizing = SW_RESTORE;\r
228 int SortSave = NO;\r
229 char TmpPath[FMAX_PATH+1];\r
230 int QuickAnonymous = YES;\r
231 int PassToHist = YES;\r
232 int VaxSemicolon = NO;\r
233 int SendQuit = NO;\r
234 int NoRasControl = NO;\r
235 int SuppressSave = NO;\r
236 int DispIgnoreHide = NO;\r
237 int DispDrives = NO;\r
238 int MirUpDelNotify = YES; \r
239 int MirDownDelNotify = YES; \r
240 int FolderAttr = NO;\r
241 int FolderAttrNum = 777;\r
242 // 暗号化通信対応\r
243 BYTE CertificateCacheHash[MAX_CERT_CACHE_HASH][20];\r
244 BYTE SSLRootCAFileHash[20];\r
245 // ファイルアイコン表示対応\r
246 int DispFileIcon = NO;\r
247 // ディレクトリ自動作成\r
248 int MakeAllDir = YES;\r
249 \r
250 \r
251 \r
252 \r
253 \r
254 /*----- メインルーチン --------------------------------------------------------\r
255 *\r
256 *       Parameter\r
257 *               HINSTANCE hInstance : このアプリケーションのこのインスタンスのハンドル\r
258 *               HINSTANCE hPrevInstance : このアプリケーションの直前のインスタンスのハンドル\r
259 *               LPSTR lpszCmdLine : アプリケーションが起動したときのコマンドラインをさすロングポインタ\r
260 *               int cmdShow : 最初に表示するウインドウの形式。\r
261 *\r
262 *       Return Value\r
263 *               int 最後のメッセージのwParam\r
264 *----------------------------------------------------------------------------*/\r
265 \r
266 int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int cmdShow)\r
267 {\r
268     MSG Msg;\r
269         int Ret;\r
270         BOOL Sts;\r
271 \r
272         // プロセス保護\r
273 #ifdef ENABLE_PROCESS_PROTECTION\r
274         {\r
275                 DWORD ProtectLevel;\r
276                 char* pCommand;\r
277                 char Option[FMAX_PATH+1];\r
278                 ProtectLevel = PROCESS_PROTECTION_NONE;\r
279                 pCommand = lpszCmdLine;\r
280                 while(pCommand = GetToken(pCommand, Option))\r
281                 {\r
282                         if(strcmp(Option, "--protect") == 0)\r
283                         {\r
284                                 ProtectLevel = PROCESS_PROTECTION_DEFAULT;\r
285                                 break;\r
286                         }\r
287                         else if(strcmp(Option, "--protect-high") == 0)\r
288                         {\r
289                                 ProtectLevel = PROCESS_PROTECTION_HIGH;\r
290                                 break;\r
291                         }\r
292                         else if(strcmp(Option, "--protect-medium") == 0)\r
293                         {\r
294                                 ProtectLevel = PROCESS_PROTECTION_MEDIUM;\r
295                                 break;\r
296                         }\r
297                         else if(strcmp(Option, "--protect-low") == 0)\r
298                         {\r
299                                 ProtectLevel = PROCESS_PROTECTION_LOW;\r
300                                 break;\r
301                         }\r
302                 }\r
303                 if(ProtectLevel != PROCESS_PROTECTION_NONE)\r
304                 {\r
305                         SetProcessProtectionLevel(ProtectLevel);\r
306                         if(!InitializeLoadLibraryHook())\r
307                         {\r
308                                 MessageBox(NULL, MSGJPN321, "FFFTP", MB_OK | MB_ICONERROR);\r
309                                 return 0;\r
310                         }\r
311 #ifndef _DEBUG\r
312                         if(IsDebuggerPresent())\r
313                         {\r
314                                 MessageBox(NULL, MSGJPN322, "FFFTP", MB_OK | MB_ICONERROR);\r
315                                 return 0;\r
316                         }\r
317 #endif\r
318                         if(!UnloadUntrustedModule())\r
319                         {\r
320                                 MessageBox(NULL, MSGJPN323, "FFFTP", MB_OK | MB_ICONERROR);\r
321                                 return 0;\r
322                         }\r
323 #ifndef _DEBUG\r
324                         if(RestartProtectedProcess(" --restart"))\r
325                                 return 0;\r
326 #endif\r
327                         if(!EnableLoadLibraryHook(TRUE))\r
328                         {\r
329                                 MessageBox(NULL, MSGJPN324, "FFFTP", MB_OK | MB_ICONERROR);\r
330                                 return 0;\r
331                         }\r
332                 }\r
333                 else\r
334                         InitializeLoadLibraryHook();\r
335         }\r
336 #endif\r
337 \r
338         // マルチコアCPUの特定環境下でファイル通信中にクラッシュするバグ対策\r
339 #ifdef DISABLE_MULTI_CPUS\r
340         SetProcessAffinityMask(GetCurrentProcess(), 1);\r
341 #endif\r
342         MainThreadId = GetCurrentThreadId();\r
343 \r
344         // yutaka\r
345         if(OleInitialize(NULL) != S_OK){\r
346                 MessageBox(NULL, MSGJPN298, "FFFTP", MB_OK | MB_ICONERROR);\r
347                 return 0;\r
348         }\r
349 \r
350         InitCommonControls();\r
351 \r
352         // FTPS対応\r
353 #ifdef USE_OPENSSL\r
354         LoadOpenSSL();\r
355 #endif\r
356 \r
357         Ret = FALSE;\r
358         hWndFtp = NULL;\r
359         hInstFtp = hInstance;\r
360         if(InitApp(lpszCmdLine, cmdShow) == FFFTP_SUCCESS)\r
361         {\r
362                 for(;;)\r
363                 {\r
364                         Sts = GetMessage(&Msg, NULL, 0, 0);\r
365                         if((Sts == 0) || (Sts == -1))\r
366                                 break;\r
367 \r
368                         // 64ビット対応\r
369 //                      if(!HtmlHelp(NULL, NULL, HH_PRETRANSLATEMESSAGE, (DWORD)&Msg))\r
370                         if(!HtmlHelp(NULL, NULL, HH_PRETRANSLATEMESSAGE, (DWORD_PTR)&Msg))\r
371                         { \r
372                                 /* ディレクトリ名の表示コンボボックスでBSやRETが効くように */\r
373                                 /* コンボボックス内ではアクセラレータを無効にする */\r
374                                 if((Msg.hwnd == GetLocalHistEditHwnd()) ||\r
375                                    (Msg.hwnd == GetRemoteHistEditHwnd()) ||\r
376                                    ((hHelpWin != NULL) && (GetAncestor(Msg.hwnd, GA_ROOT) == hHelpWin)) ||\r
377                                    GetHideUI() == YES ||\r
378                                    (TranslateAccelerator(hWndFtp, Accel, &Msg) == 0))\r
379                                 {\r
380                                         TranslateMessage(&Msg);\r
381                                         DispatchMessage(&Msg);\r
382                                 }\r
383                         }\r
384                 }\r
385                 Ret = Msg.wParam;\r
386         }\r
387     UnregisterClass(FtpClassStr, hInstFtp);\r
388         // FTPS対応\r
389 #ifdef USE_OPENSSL\r
390         FreeOpenSSL();\r
391 #endif\r
392         OleUninitialize();\r
393         return(Ret);\r
394 }\r
395 \r
396 \r
397 /*----- アプリケーションの初期設定 --------------------------------------------\r
398 *\r
399 *       Parameter\r
400 *               HINSTANCE hInstance : このアプリケーションのこのインスタンスのハンドル\r
401 *               HINSTANCE hPrevInstance : このアプリケーションの直前のインスタンスのハンドル\r
402 *               LPSTR lpszCmdLine : アプリケーションが起動したときのコマンドラインをさすロングポインタ\r
403 *               int cmdShow : 最初に表示するウインドウの形式。\r
404 *\r
405 *       Return Value\r
406 *               int ステータス\r
407 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
408 *----------------------------------------------------------------------------*/\r
409 \r
410 static int InitApp(LPSTR lpszCmdLine, int cmdShow)\r
411 {\r
412         int sts;\r
413         int Err;\r
414         WSADATA WSAData;\r
415         char PwdBuf[FMAX_PATH+1];\r
416         int useDefautPassword = 0; /* 警告文表示用 */\r
417         int masterpass;\r
418         // ポータブル版判定\r
419         int ImportPortable;\r
420 \r
421         sts = FFFTP_FAIL;\r
422 \r
423         aes_init();\r
424         srand(GetTickCount());\r
425         \r
426         // 64ビット対応\r
427 //      HtmlHelp(NULL, NULL, HH_INITIALIZE, (DWORD)&dwCookie);\r
428         HtmlHelp(NULL, NULL, HH_INITIALIZE, (DWORD_PTR)&dwCookie);\r
429 \r
430         SaveUpdateBellInfo();\r
431 \r
432         if((Err = WSAStartup((WORD)0x0202, &WSAData)) != 0)\r
433                 MessageBox(NULL, ReturnWSError(Err), "FFFTP - Startup", MB_OK);\r
434         else\r
435         {\r
436                 Accel = LoadAccelerators(hInstFtp, MAKEINTRESOURCE(ffftp_accel));\r
437 \r
438                 // 環境依存の不具合対策\r
439 //              GetTempPath(FMAX_PATH, TmpPath);\r
440                 GetAppTempPath(TmpPath);\r
441                 _mkdir(TmpPath);\r
442                 SetYenTail(TmpPath);\r
443 \r
444                 GetModuleFileName(NULL, HelpPath, FMAX_PATH);\r
445                 strcpy(GetFileName(HelpPath), "ffftp.chm");\r
446 \r
447                 if(CheckIniFileName(lpszCmdLine, IniPath) == 0)\r
448                 {\r
449                         GetModuleFileName(NULL, IniPath, FMAX_PATH);\r
450                         strcpy(GetFileName(IniPath), "ffftp.ini");\r
451                 }\r
452                 else\r
453                 {\r
454                         ForceIni = YES;\r
455                         RegType = REGTYPE_INI;\r
456                 }\r
457                 // ポータブル版判定\r
458                 GetModuleFileName(NULL, PortableFilePath, FMAX_PATH);\r
459                 strcpy(GetFileName(PortableFilePath), "portable");\r
460                 CheckPortableVersion();\r
461                 ImportPortable = NO;\r
462                 if(PortableVersion == YES)\r
463                 {\r
464                         ForceIni = YES;\r
465                         RegType = REGTYPE_INI;\r
466                         if(IsRegAvailable() == YES && IsIniAvailable() == NO)\r
467                         {\r
468                                 if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(ini_from_reg_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
469                                 {\r
470                                         ImportPortable = YES;\r
471                                         ForceIni = NO;\r
472                                         RegType = REGTYPE_REG;\r
473                                 }\r
474                         }\r
475                 }\r
476 \r
477 //              AllocConsole();\r
478 \r
479                 /* 2010.02.01 genta マスターパスワードを入力させる\r
480                   -z オプションがあるときは最初だけスキップ\r
481                   -z オプションがないときは,デフォルトパスワードをまず試す\r
482                   LoadRegistry()する\r
483                   パスワードが不一致なら再入力するか尋ねる.\r
484                   (破損していた場合はさせない)\r
485                 */\r
486                 if( CheckMasterPassword(lpszCmdLine, PwdBuf))\r
487                 {\r
488                         SetMasterPassword( PwdBuf );\r
489                         useDefautPassword = 0;\r
490                 }\r
491                 else {\r
492                         /* パスワード指定無し */\r
493                         SetMasterPassword( NULL );\r
494                         /* この場では表示できないのでフラグだけ立てておく*/\r
495                         useDefautPassword = 2;\r
496                 }\r
497 \r
498                 /* パスワードチェックのみ実施 */\r
499                 masterpass = 1;\r
500                 while( ValidateMasterPassword() == YES &&\r
501                                 GetMasterPasswordStatus() == PASSWORD_UNMATCH ){\r
502                         \r
503                         if( useDefautPassword != 2 ){\r
504                                 /* 再トライするか確認 */\r
505                                 if( MessageBox(NULL, MSGJPN304, "FFFTP", MB_YESNO | MB_ICONEXCLAMATION) == IDNO ){\r
506                                         useDefautPassword = 0; /* 不一致なので,もはやデフォルトかどうかは分からない */\r
507                                         break;\r
508                                 }\r
509                         }\r
510                         \r
511                         /* 再入力させる*/\r
512                         masterpass = EnterMasterPasswordAndSet(masterpasswd_dlg, NULL);\r
513                         if( masterpass == 2 ){\r
514                                 useDefautPassword = 1;\r
515                         }\r
516                         else if( masterpass == 0 ){\r
517                                 SaveExit = NO;\r
518                                 break;\r
519                         }\r
520                         else {\r
521                                 useDefautPassword = 0;\r
522                         }\r
523                 }\r
524                 \r
525                 if(masterpass != 0)\r
526                 {\r
527                         LoadRegistry();\r
528 \r
529                         // ポータブル版判定\r
530                         if(ImportPortable == YES)\r
531                         {\r
532                                 ForceIni = YES;\r
533                                 RegType = REGTYPE_INI;\r
534                         }\r
535 \r
536                         // 暗号化通信対応\r
537                         SetSSLTimeoutCallback(TimeOut * 1000, SSLTimeoutCallback);\r
538                         SetSSLConfirmCallback(SSLConfirmCallback);\r
539                         GetModuleFileName(NULL, SSLRootCAFilePath, FMAX_PATH);\r
540                         strcpy(GetFileName(SSLRootCAFilePath), "ssl.pem");\r
541                         LoadSSLRootCAFile();\r
542 \r
543                         LoadJre();\r
544                         if(NoRasControl == NO)\r
545                                 LoadRasLib();\r
546                         LoadKernelLib();\r
547 \r
548                         //タイマの精度を改善\r
549                         timeBeginPeriod(1);\r
550 \r
551                         CountPrevFfftpWindows();\r
552 \r
553                         if(MakeAllWindows(cmdShow) == FFFTP_SUCCESS)\r
554                         {\r
555                                 hWndCurFocus = GetLocalHwnd();\r
556 \r
557                                 if(strlen(DefaultLocalPath) > 0)\r
558                                         SetCurrentDirectory(DefaultLocalPath);\r
559 \r
560                                 SetSortTypeImm(LocalFileSort, LocalDirSort, RemoteFileSort, RemoteDirSort);\r
561                                 SetTransferTypeImm(TransMode);\r
562                                 DispTransferType();\r
563                                 SetHostKanaCnvImm(YES);\r
564                                 SetHostKanjiCodeImm(KANJI_NOCNV);\r
565                                 // 本当はローカルのデフォルトをUTF-8にしたいが旧バージョンとの互換性のためShift_JISに設定\r
566 //                              SetLocalKanjiCodeImm(KANJI_UTF8N);\r
567                                 SetLocalKanjiCodeImm(KANJI_SJIS);\r
568                                 DispListType();\r
569                                 DispDotFileMode();\r
570                                 DispSyncMoveMode();\r
571 \r
572                                 MakeCacheBuf(CacheEntry);\r
573                                 if(CacheSave == YES)\r
574                                         LoadCache();\r
575 \r
576                                 if(MakeTransferThread() == FFFTP_SUCCESS)\r
577                                 {\r
578                                         DoPrintf("DEBUG MESSAGE ON ! ##");\r
579 \r
580                                         DispWindowTitle();\r
581                                         // SourceForge.JPによるフォーク\r
582 //                                      SetTaskMsg("FFFTP Ver." VER_STR " Copyright(C) 1997-2010 Sota & cooperators.");\r
583                                         SetTaskMsg("FFFTP Ver." VER_STR " Copyright(C) 1997-2010 Sota & cooperators.\r\nCopyright (C) 2011-2012 FFFTP Project (Hiromichi Matsushima, Suguru Kawamoto, IWAMOTO Kouichi, vitamin0x, unarist, Asami, fortran90, tomo1192, Yuji Tanaka, Moriguchi Hirokazu).");\r
584 \r
585                                         if(ForceIni)\r
586                                                 SetTaskMsg("%s%s", MSGJPN283, IniPath);\r
587 \r
588                                         if(IsFolderExist(TmpPath) == NO)\r
589                                         {\r
590                                                 SetTaskMsg(MSGJPN152, TmpPath);\r
591                                                 GetTempPath(FMAX_PATH, TmpPath);\r
592                                                 SetTaskMsg(MSGJPN153, TmpPath);\r
593                                         }\r
594 \r
595                                         DoPrintf("Tmp =%s", TmpPath);\r
596                                         DoPrintf("Help=%s", HelpPath);\r
597 \r
598                                         DragAcceptFiles(GetRemoteHwnd(), TRUE);\r
599                                         DragAcceptFiles(GetLocalHwnd(), TRUE);\r
600 \r
601                                         SetAllHistoryToMenu();\r
602                                         GetLocalDirForWnd();\r
603                                         MakeButtonsFocus();\r
604                                         DispTransferFiles();\r
605 \r
606                                         StartupProc(lpszCmdLine);\r
607                                         sts = FFFTP_SUCCESS;\r
608 \r
609                                         /* セキュリティ警告文の表示 */\r
610                                         if( useDefautPassword ){\r
611                                                 SetTaskMsg(MSGJPN300);\r
612                                         }\r
613                                         \r
614                                         /* パスワード不一致警告文の表示 */\r
615                                         switch( GetMasterPasswordStatus() ){\r
616                                         case PASSWORD_UNMATCH:\r
617                                                 SetTaskMsg(MSGJPN301);\r
618                                                 break;\r
619                                         case BAD_PASSWORD_HASH:\r
620                                                 SetTaskMsg(MSGJPN302);\r
621                                                 break;\r
622                                         default:\r
623                                                 break;\r
624                                         }\r
625                                 }\r
626                         }\r
627                 }\r
628         }\r
629 \r
630         // 暗号化通信対応\r
631 #ifdef USE_OPENSSL\r
632         if(IsOpenSSLLoaded())\r
633                 SetTaskMsg(MSGJPN318);\r
634         else\r
635                 SetTaskMsg(MSGJPN319);\r
636 #endif\r
637 \r
638         if(sts == FFFTP_FAIL)\r
639                 DeleteAllObject();\r
640 \r
641         return(sts);\r
642 }\r
643 \r
644 \r
645 /*----- ウインドウを作成する --------------------------------------------------\r
646 *\r
647 *       Parameter\r
648 *               int cmdShow : 最初に表示するウインドウの形式。\r
649 *\r
650 *       Return Value\r
651 *               int ステータス\r
652 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
653 *----------------------------------------------------------------------------*/\r
654 \r
655 static int MakeAllWindows(int cmdShow)\r
656 {\r
657         RECT Rect1;\r
658         RECT Rect2;\r
659         WNDCLASSEX wClass;\r
660         int Sts;\r
661         int StsTask;\r
662         int StsSbar;\r
663         int StsTbar;\r
664         int StsList;\r
665         int StsLvtips;\r
666         int StsSocket;\r
667 \r
668         /*===== メインウインドウ =====*/\r
669 \r
670         RootColorBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));\r
671 \r
672         wClass.cbSize = sizeof(WNDCLASSEX);\r
673         wClass.style         = 0;\r
674         wClass.lpfnWndProc   = FtpWndProc;\r
675         wClass.cbClsExtra    = 0;\r
676         wClass.cbWndExtra    = 0;\r
677         wClass.hInstance     = hInstFtp;\r
678         wClass.hIcon         = LoadIcon(hInstFtp, MAKEINTRESOURCE(ffftp));\r
679         wClass.hCursor       = NULL;\r
680         wClass.hbrBackground = RootColorBrush;\r
681         wClass.lpszMenuName  = (LPSTR)MAKEINTRESOURCE(main_menu);\r
682         wClass.lpszClassName = FtpClassStr;\r
683         wClass.hIconSm       = NULL;\r
684         RegisterClassEx(&wClass);\r
685 \r
686         if(SaveWinPos == NO)\r
687         {\r
688                 WinPosX = CW_USEDEFAULT;\r
689                 WinPosY = 0;\r
690         }\r
691         hWndFtp = CreateWindow(FtpClassStr, "FFFTP",\r
692                                 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,\r
693                                 WinPosX, WinPosY, WinWidth, WinHeight,\r
694                                 HWND_DESKTOP, 0, hInstFtp, NULL);\r
695 \r
696         if(hWndFtp != NULL)\r
697         {\r
698                 SystemParametersInfo(SPI_GETWORKAREA, 0, &Rect1, 0);\r
699                 GetWindowRect(hWndFtp, &Rect2);\r
700                 if(Rect2.bottom > Rect1.bottom)\r
701                 {\r
702                         Rect2.top = max1(0, Rect2.top - (Rect2.bottom - Rect1.bottom));\r
703                         MoveWindow(hWndFtp, Rect2.left, Rect2.top, WinWidth, WinHeight, FALSE);\r
704                 }\r
705 \r
706                 /*===== ステイタスバー =====*/\r
707 \r
708                 StsSbar = MakeStatusBarWindow(hWndFtp, hInstFtp);\r
709 \r
710                 CalcWinSize();\r
711 \r
712                 /*===== ツールバー =====*/\r
713 \r
714                 StsTbar = MakeToolBarWindow(hWndFtp, hInstFtp);\r
715 \r
716                 /*===== ファイルリストウインドウ =====*/\r
717 \r
718                 StsList = MakeListWin(hWndFtp, hInstFtp);\r
719 \r
720                 /*==== タスクウインドウ ====*/\r
721 \r
722                 StsTask = MakeTaskWindow(hWndFtp, hInstFtp);\r
723 \r
724                 if((cmdShow != SW_MINIMIZE) && (cmdShow != SW_SHOWMINIMIZED) && (cmdShow != SW_SHOWMINNOACTIVE) &&\r
725                    (Sizing == SW_MAXIMIZE))\r
726                         cmdShow = SW_MAXIMIZE;\r
727 \r
728                 ShowWindow(hWndFtp, cmdShow);\r
729 \r
730                 /*==== ソケットウインドウ ====*/\r
731 \r
732                 StsSocket = MakeSocketWin(hWndFtp, hInstFtp);\r
733 \r
734                 StsLvtips = InitListViewTips(hWndFtp, hInstFtp);\r
735         }\r
736 \r
737         Sts = FFFTP_SUCCESS;\r
738         if((hWndFtp == NULL) ||\r
739            (StsTbar == FFFTP_FAIL) ||\r
740            (StsList == FFFTP_FAIL) ||\r
741            (StsSbar == FFFTP_FAIL) ||\r
742            (StsTask == FFFTP_FAIL) ||\r
743            (StsLvtips == FFFTP_FAIL) ||\r
744            (StsSocket == FFFTP_FAIL))\r
745         {\r
746                 Sts = FFFTP_FAIL;\r
747         }\r
748 \r
749         if(Sts == FFFTP_SUCCESS)\r
750                 SetListViewType();\r
751 \r
752         return(Sts);\r
753 }\r
754 \r
755 \r
756 /*----- ウインドウのタイトルを表示する ----------------------------------------\r
757 *\r
758 *       Parameter\r
759 *               なし\r
760 *\r
761 *       Return Value\r
762 *               なし\r
763 *----------------------------------------------------------------------------*/\r
764 \r
765 void DispWindowTitle(void)\r
766 {\r
767         char Tmp[HOST_ADRS_LEN+FILTER_EXT_LEN+20];\r
768 \r
769         if(AskConnecting() == YES)\r
770                 sprintf(Tmp, "%s (%s) - FFFTP", TitleHostName, FilterStr);\r
771         else\r
772                 sprintf(Tmp, "FFFTP (%s)", FilterStr);\r
773 \r
774         SetWindowText(GetMainHwnd(), Tmp);\r
775         return;\r
776 }\r
777 \r
778 \r
779 /*----- 全てのオブジェクトを削除 ----------------------------------------------\r
780 *\r
781 *       Parameter\r
782 *               なし\r
783 *\r
784 *       Return Value\r
785 *               なし\r
786 *----------------------------------------------------------------------------*/\r
787 \r
788 static void DeleteAllObject(void)\r
789 {\r
790         DeleteCacheBuf();\r
791 \r
792 //move to WM_DESTROY\r
793         WSACleanup();\r
794 \r
795 //test システム任せ\r
796 //      if(ListFont != NULL)\r
797 //              DeleteObject(ListFont);\r
798 //      if(RootColorBrush != NULL)\r
799 //              DeleteObject(RootColorBrush);\r
800 \r
801 //test システム任せ\r
802 //      DeleteListViewTips();\r
803 //      DeleteListWin();\r
804 //      DeleteStatusBarWindow();\r
805 //      DeleteTaskWindow();\r
806 //      DeleteToolBarWindow();\r
807 //      DeleteSocketWin();\r
808 \r
809 //move to WM_DESTROY\r
810         if(hWndFtp != NULL)\r
811                 DestroyWindow(hWndFtp);\r
812 \r
813         ReleaseJre();\r
814         ReleaseRasLib();\r
815         ReleaseKernelLib();\r
816 \r
817         return;\r
818 }\r
819 \r
820 \r
821 /*----- メインウインドウのウインドウハンドルを返す ----------------------------\r
822 *\r
823 *       Parameter\r
824 *               なし\r
825 *\r
826 *       Return Value\r
827 *               HWND ウインドウハンドル\r
828 *----------------------------------------------------------------------------*/\r
829 \r
830 HWND GetMainHwnd(void)\r
831 {\r
832         return(hWndFtp);\r
833 }\r
834 \r
835 \r
836 /*----- 現在フォーカスがあるウインドウのウインドウハンドルを返す --------------\r
837 *\r
838 *       Parameter\r
839 *               なし\r
840 *\r
841 *       Return Value\r
842 *               HWND ウインドウハンドル\r
843 *----------------------------------------------------------------------------*/\r
844 \r
845 HWND GetFocusHwnd(void)\r
846 {\r
847         return(hWndCurFocus);\r
848 }\r
849 \r
850 \r
851 /*----- 現在フォーカスがあるウインドウのをセットする --------------------------\r
852 *\r
853 *       Parameter\r
854 *               HWND hWnd : ウインドウハンドル\r
855 *\r
856 *       Return Value\r
857 *               なし\r
858 *----------------------------------------------------------------------------*/\r
859 \r
860 void SetFocusHwnd(HWND hWnd)\r
861 {\r
862         hWndCurFocus = hWnd;\r
863         return;\r
864 }\r
865 \r
866 \r
867 /*----- プログラムのインスタンスを返す ----------------------------------------\r
868 *\r
869 *       Parameter\r
870 *               なし\r
871 *\r
872 *       Return Value\r
873 *               HINSTANCE インスタンス\r
874 *----------------------------------------------------------------------------*/\r
875 \r
876 HINSTANCE GetFtpInst(void)\r
877 {\r
878         return(hInstFtp);\r
879 }\r
880 \r
881 \r
882 /*----- メインウインドウのメッセージ処理 --------------------------------------\r
883 *\r
884 *       Parameter\r
885 *               HWND hWnd : ウインドウハンドル\r
886 *               UINT message  : メッセージ番号\r
887 *               WPARAM wParam : メッセージの WPARAM 引数\r
888 *               LPARAM lParam : メッセージの LPARAM 引数\r
889 *\r
890 *       Return Value\r
891 *               メッセージに対応する戻り値\r
892 *----------------------------------------------------------------------------*/\r
893 \r
894 static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
895 {\r
896         PAINTSTRUCT ps;\r
897         LPTOOLTIPTEXT lpttt;\r
898         // UTF-8対応\r
899         LPTOOLTIPTEXTW wlpttt;\r
900         RECT Rect;\r
901 \r
902         int TmpTransType;\r
903 \r
904         switch (message)\r
905         {\r
906                 // ローカル側自動更新\r
907                 case WM_CREATE :\r
908                         SetTimer(hWnd, 1, 1000, NULL);\r
909                         break;\r
910 \r
911                 // ローカル側自動更新\r
912                 // 自動切断対策\r
913                 case WM_TIMER :\r
914                         switch(wParam)\r
915                         {\r
916                         case 1:\r
917                                 if(WaitForSingleObject(ChangeNotification, 0) == WAIT_OBJECT_0)\r
918                                 {\r
919                                         if(AskUserOpeDisabled() == NO)\r
920                                         {\r
921                                                 FILELIST* Base;\r
922                                                 FindNextChangeNotification(ChangeNotification);\r
923                                                 Base = NULL;\r
924                                                 MakeSelectedFileList(WIN_LOCAL, NO, NO, &Base, &CancelFlg);\r
925                                                 GetLocalDirForWnd();\r
926                                                 SelectFileInList(GetLocalHwnd(), SELECT_LIST, Base);\r
927                                         }\r
928                                 }\r
929                                 break;\r
930                         case 2:\r
931                                 NoopProc();\r
932                                 break;\r
933                         }\r
934                         break;\r
935 \r
936                 case WM_COMMAND :\r
937                         // 同時接続対応\r
938                         // 中断後に受信バッファに応答が残っていると次のコマンドの応答が正しく処理できない\r
939                         if(CancelFlg == YES)\r
940                                 RemoveReceivedData(AskCmdCtrlSkt());\r
941                         switch(LOWORD(wParam))\r
942                         {\r
943                                 case MENU_CONNECT :\r
944                                         // 自動切断対策\r
945                                         KillTimer(hWnd, 2);\r
946                                         ConnectProc(DLG_TYPE_CON, -1);\r
947                                         // 自動切断対策\r
948                                         if(AskNoopInterval() > 0)\r
949                                                 SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);\r
950                                         break;\r
951 \r
952                                 case MENU_CONNECT_NUM :\r
953                                         // 自動切断対策\r
954                                         KillTimer(hWnd, 2);\r
955                                         ConnectProc(DLG_TYPE_CON, (int)lParam);\r
956                                         // 自動切断対策\r
957                                         if(AskNoopInterval() > 0)\r
958                                                 SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);\r
959                                         if(AskConnecting() == YES)\r
960                                         {\r
961                                                 if(HIWORD(wParam) & OPT_MIRROR)\r
962                                                 {\r
963                                                         if(HIWORD(wParam) & OPT_FORCE)\r
964                                                                 MirrorUploadProc(NO);\r
965                                                         else\r
966                                                                 MirrorUploadProc(YES);\r
967                                                 }\r
968                                                 else if(HIWORD(wParam) & OPT_MIRRORDOWN)\r
969                                                 {\r
970                                                         if(HIWORD(wParam) & OPT_FORCE)\r
971                                                                 MirrorDownloadProc(NO);\r
972                                                         else\r
973                                                                 MirrorDownloadProc(YES);\r
974                                                 }\r
975                                         }\r
976                                         break;\r
977 \r
978                                 case MENU_SET_CONNECT :\r
979                                         // 自動切断対策\r
980                                         KillTimer(hWnd, 2);\r
981                                         ConnectProc(DLG_TYPE_SET, -1);\r
982                                         // 自動切断対策\r
983                                         if(AskNoopInterval() > 0)\r
984                                                 SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);\r
985                                         break;\r
986 \r
987                                 case MENU_QUICK :\r
988                                         // 自動切断対策\r
989                                         KillTimer(hWnd, 2);\r
990                                         QuickConnectProc();\r
991                                         // 自動切断対策\r
992                                         if(AskNoopInterval() > 0)\r
993                                                 SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);\r
994                                         break;\r
995 \r
996                                 case MENU_DISCONNECT :\r
997                                         if(AskTryingConnect() == YES)\r
998                                                 CancelFlg = YES;\r
999                                         else if(AskConnecting() == YES)\r
1000                                         {\r
1001                                                 SaveBookMark();\r
1002                                                 SaveCurrentSetToHost();\r
1003                                                 DisconnectProc();\r
1004                                         }\r
1005                                         break;\r
1006 \r
1007                                 case MENU_HIST_1 :\r
1008                                 case MENU_HIST_2 :\r
1009                                 case MENU_HIST_3 :\r
1010                                 case MENU_HIST_4 :\r
1011                                 case MENU_HIST_5 :\r
1012                                 case MENU_HIST_6 :\r
1013                                 case MENU_HIST_7 :\r
1014                                 case MENU_HIST_8 :\r
1015                                 case MENU_HIST_9 :\r
1016                                 case MENU_HIST_10 :\r
1017                                 case MENU_HIST_11 :\r
1018                                 case MENU_HIST_12 :\r
1019                                 case MENU_HIST_13 :\r
1020                                 case MENU_HIST_14 :\r
1021                                 case MENU_HIST_15 :\r
1022                                 case MENU_HIST_16 :\r
1023                                 case MENU_HIST_17 :\r
1024                                 case MENU_HIST_18 :\r
1025                                 case MENU_HIST_19 :\r
1026                                 case MENU_HIST_20 :\r
1027                                         // 自動切断対策\r
1028                                         KillTimer(hWnd, 2);\r
1029                                         HistoryConnectProc(LOWORD(wParam));\r
1030                                         // 自動切断対策\r
1031                                         if(AskNoopInterval() > 0)\r
1032                                                 SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);\r
1033                                         break;\r
1034 \r
1035                                 case MENU_UPDIR :\r
1036                                         if(hWndCurFocus == GetLocalHwnd())\r
1037                                                 PostMessage(hWnd, WM_COMMAND, MAKEWPARAM(MENU_LOCAL_UPDIR, 0), 0);\r
1038                                         else\r
1039                                                 PostMessage(hWnd, WM_COMMAND, MAKEWPARAM(MENU_REMOTE_UPDIR, 0), 0);\r
1040                                         break;\r
1041 \r
1042                                 case MENU_DCLICK :\r
1043                                         if(hWndCurFocus == GetLocalHwnd())\r
1044                                                 // ローカルフォルダを開く\r
1045 //                                              DoubleClickProc(WIN_LOCAL, YES, -1);\r
1046                                                 DoubleClickProc(WIN_LOCAL, NO, -1);\r
1047                                         else\r
1048                                         {\r
1049                                                 SuppressRefresh = 1;\r
1050                                                 // ローカルフォルダを開く\r
1051 //                                              DoubleClickProc(WIN_REMOTE, YES, -1);\r
1052                                                 DoubleClickProc(WIN_REMOTE, NO, -1);\r
1053                                                 SuppressRefresh = 0;\r
1054                                         }\r
1055                                         break;\r
1056 \r
1057                                 // ローカルフォルダを開く\r
1058                                 case MENU_OPEN :\r
1059                                         if(hWndCurFocus == GetLocalHwnd())\r
1060                                                 DoubleClickProc(WIN_LOCAL, YES, -1);\r
1061                                         else\r
1062                                         {\r
1063                                                 SuppressRefresh = 1;\r
1064                                                 DoubleClickProc(WIN_REMOTE, YES, -1);\r
1065                                                 SuppressRefresh = 0;\r
1066                                         }\r
1067                                         break;\r
1068 \r
1069                                 case MENU_OPEN1 :\r
1070                                         if(hWndCurFocus == GetLocalHwnd())\r
1071                                                 DoubleClickProc(WIN_LOCAL, YES, 0);\r
1072                                         else\r
1073                                         {\r
1074                                                 SuppressRefresh = 1;\r
1075                                                 DoubleClickProc(WIN_REMOTE, YES, 0);\r
1076                                                 SuppressRefresh = 0;\r
1077                                         }\r
1078                                         break;\r
1079 \r
1080                                 case MENU_OPEN2 :\r
1081                                         if(hWndCurFocus == GetLocalHwnd())\r
1082                                                 DoubleClickProc(WIN_LOCAL, YES, 1);\r
1083                                         else\r
1084                                         {\r
1085                                                 SuppressRefresh = 1;\r
1086                                                 DoubleClickProc(WIN_REMOTE, YES, 1);\r
1087                                                 SuppressRefresh = 0;\r
1088                                         }\r
1089                                         break;\r
1090 \r
1091                                 case MENU_OPEN3 :\r
1092                                         if(hWndCurFocus == GetLocalHwnd())\r
1093                                                 DoubleClickProc(WIN_LOCAL, YES, 2);\r
1094                                         else\r
1095                                         {\r
1096                                                 SuppressRefresh = 1;\r
1097                                                 DoubleClickProc(WIN_REMOTE, YES, 2);\r
1098                                                 SuppressRefresh = 0;\r
1099                                         }\r
1100                                         break;\r
1101 \r
1102                                 case MENU_REMOTE_UPDIR :\r
1103                                         // デッドロック対策\r
1104                                         if(AskUserOpeDisabled() == YES)\r
1105                                                 break;\r
1106                                         SuppressRefresh = 1;\r
1107                                         SetCurrentDirAsDirHist();\r
1108                                         ChangeDir(WIN_REMOTE, "..");\r
1109                                         SuppressRefresh = 0;\r
1110                                         break;\r
1111 \r
1112                                 case MENU_LOCAL_UPDIR :\r
1113                                         // デッドロック対策\r
1114                                         if(AskUserOpeDisabled() == YES)\r
1115                                                 break;\r
1116                                         SetCurrentDirAsDirHist();\r
1117                                         ChangeDir(WIN_LOCAL, "..");\r
1118                                         break;\r
1119 \r
1120                                 case MENU_REMOTE_CHDIR :\r
1121                                         SuppressRefresh = 1;\r
1122                                         SetCurrentDirAsDirHist();\r
1123                                         ChangeDirDirectProc(WIN_REMOTE);\r
1124                                         SuppressRefresh = 0;\r
1125                                         break;\r
1126 \r
1127                                 case MENU_LOCAL_CHDIR :\r
1128                                         SetCurrentDirAsDirHist();\r
1129                                         ChangeDirDirectProc(WIN_LOCAL);\r
1130                                         break;\r
1131 \r
1132                                 case MENU_DOWNLOAD :\r
1133                                         SetCurrentDirAsDirHist();\r
1134                                         DownloadProc(NO, NO, NO);\r
1135                                         break;\r
1136 \r
1137                                 case MENU_DOWNLOAD_AS :\r
1138                                         SetCurrentDirAsDirHist();\r
1139                                         DownloadProc(YES, NO, NO);\r
1140                                         break;\r
1141 \r
1142                                 case MENU_DOWNLOAD_AS_FILE :\r
1143                                         SetCurrentDirAsDirHist();\r
1144                                         DownloadProc(NO, YES, NO);\r
1145                                         break;\r
1146 \r
1147                                 case MENU_DOWNLOAD_ALL :\r
1148                                         SetCurrentDirAsDirHist();\r
1149                                         DownloadProc(NO, NO, YES);\r
1150                                         break;\r
1151 \r
1152                                 case MENU_DOWNLOAD_NAME :\r
1153                                         SetCurrentDirAsDirHist();\r
1154                                         InputDownloadProc();\r
1155                                         break;\r
1156 \r
1157                                 case MENU_UPLOAD :\r
1158                                         SetCurrentDirAsDirHist();\r
1159                                         UploadListProc(NO, NO);\r
1160                                         break;\r
1161 \r
1162                                 case MENU_UPLOAD_AS :\r
1163                                         SetCurrentDirAsDirHist();\r
1164                                         UploadListProc(YES, NO);\r
1165                                         break;\r
1166 \r
1167                                 case MENU_UPLOAD_ALL :\r
1168                                         SetCurrentDirAsDirHist();\r
1169                                         UploadListProc(NO, YES);\r
1170                                         break;\r
1171 \r
1172                                 case MENU_MIRROR_UPLOAD :\r
1173                                         SetCurrentDirAsDirHist();\r
1174                                         MirrorUploadProc(YES);\r
1175                                         break;\r
1176 \r
1177                                 case MENU_MIRROR_DOWNLOAD :\r
1178                                         SetCurrentDirAsDirHist();\r
1179                                         MirrorDownloadProc(YES);\r
1180                                         break;\r
1181 \r
1182                                 case MENU_FILESIZE :\r
1183                                         SetCurrentDirAsDirHist();\r
1184                                         CalcFileSizeProc();\r
1185                                         break;\r
1186 \r
1187                                 case MENU_DELETE :\r
1188                                         SuppressRefresh = 1;\r
1189                                         SetCurrentDirAsDirHist();\r
1190                                         DeleteProc();\r
1191                                         SuppressRefresh = 0;\r
1192                                         break;\r
1193 \r
1194                                 case MENU_RENAME :\r
1195                                         SuppressRefresh = 1;\r
1196                                         SetCurrentDirAsDirHist();\r
1197                                         RenameProc();\r
1198                                         SuppressRefresh = 0;\r
1199                                         break;\r
1200 \r
1201                                 case MENU_MKDIR :\r
1202                                         SuppressRefresh = 1;\r
1203                                         SetCurrentDirAsDirHist();\r
1204                                         MkdirProc();\r
1205                                         SuppressRefresh = 0;\r
1206                                         break;\r
1207 \r
1208                                 case MENU_CHMOD :\r
1209                                         SuppressRefresh = 1;\r
1210                                         ChmodProc();\r
1211                                         SuppressRefresh = 0;\r
1212                                         break;\r
1213 \r
1214                                 case MENU_SOMECMD :\r
1215                                         SuppressRefresh = 1;\r
1216                                         SomeCmdProc();\r
1217                                         SuppressRefresh = 0;\r
1218                                         break;\r
1219 \r
1220                                 case MENU_OPTION :\r
1221                                         SetOption(0);\r
1222                                         if(ListFont != NULL)\r
1223                                         {\r
1224                                                 SendMessage(GetLocalHwnd(), WM_SETFONT, (WPARAM)ListFont, MAKELPARAM(TRUE, 0));\r
1225                                                 SendMessage(GetRemoteHwnd(), WM_SETFONT, (WPARAM)ListFont, MAKELPARAM(TRUE, 0));\r
1226                                                 SendMessage(GetTaskWnd(), WM_SETFONT, (WPARAM)ListFont, MAKELPARAM(TRUE, 0));\r
1227                                         }\r
1228                                         GetLocalDirForWnd();\r
1229                                         DispTransferType();\r
1230                                         CheckHistoryNum(0);\r
1231                                         SetAllHistoryToMenu();\r
1232                                         // 暗号化通信対応\r
1233                                         SetSSLTimeoutCallback(TimeOut * 1000, SSLTimeoutCallback);\r
1234                                         break;\r
1235 \r
1236                                 case MENU_FILTER :\r
1237                                         // 同時接続対応\r
1238                                         CancelFlg = NO;\r
1239                                         SetFilter(&CancelFlg);\r
1240                                         break;\r
1241 \r
1242                                 case MENU_SORT :\r
1243                                         if(SortSetting() == YES)\r
1244                                         {\r
1245                                                 // 同時接続対応\r
1246                                                 CancelFlg = NO;\r
1247                                                 LocalFileSort = AskSortType(ITEM_LFILE);\r
1248                                                 LocalDirSort = AskSortType(ITEM_LDIR);\r
1249                                                 RemoteFileSort = AskSortType(ITEM_RFILE);\r
1250                                                 RemoteDirSort = AskSortType(ITEM_RDIR);\r
1251                                                 ReSortDispList(WIN_LOCAL, &CancelFlg);\r
1252                                                 ReSortDispList(WIN_REMOTE, &CancelFlg);\r
1253                                         }\r
1254                                         break;\r
1255 \r
1256                                 case MENU_EXIT :\r
1257                                         PostMessage(hWnd, WM_CLOSE, 0, 0L);\r
1258                                         break;\r
1259 \r
1260                                 case MENU_AUTO_EXIT :\r
1261                                         if(AutoExit == YES)\r
1262                                                 PostMessage(hWnd, WM_CLOSE, 0, 0L);\r
1263                                         break;\r
1264 \r
1265                                 case MENU_ABOUT :\r
1266                                         DialogBox(hInstFtp, MAKEINTRESOURCE(about_dlg), hWnd, AboutDialogProc);\r
1267                                         break;\r
1268 \r
1269                                 case MENU_TEXT :\r
1270                                 case MENU_BINARY :\r
1271                                 case MENU_AUTO :\r
1272                                         SetTransferType(LOWORD(wParam));\r
1273                                         DispTransferType();\r
1274                                         break;\r
1275 \r
1276                                 case MENU_XFRMODE :\r
1277                                         switch(AskTransferType())\r
1278                                         {\r
1279                                                 case TYPE_A :\r
1280                                                         TmpTransType = MENU_BINARY;\r
1281                                                         break;\r
1282 \r
1283                                                 case TYPE_I :\r
1284                                                         TmpTransType = MENU_AUTO;\r
1285                                                         break;\r
1286 \r
1287                                                 default :\r
1288                                                         TmpTransType = MENU_TEXT;\r
1289                                                         break;\r
1290                                         }\r
1291                                         SetTransferType(TmpTransType);\r
1292                                         DispTransferType();\r
1293                                         break;\r
1294 \r
1295                                 // UTF-8対応\r
1296                                 case MENU_KNJ_SJIS :\r
1297                                 case MENU_KNJ_EUC :\r
1298                                 case MENU_KNJ_JIS :\r
1299                                 case MENU_KNJ_UTF8N :\r
1300                                 case MENU_KNJ_UTF8BOM :\r
1301                                 case MENU_KNJ_NONE :\r
1302                                         SetHostKanjiCode(LOWORD(wParam));\r
1303                                         break;\r
1304 \r
1305                                 case MENU_L_KNJ_SJIS :\r
1306                                 case MENU_L_KNJ_EUC :\r
1307                                 case MENU_L_KNJ_JIS :\r
1308                                 case MENU_L_KNJ_UTF8N :\r
1309                                 case MENU_L_KNJ_UTF8BOM :\r
1310                                         SetLocalKanjiCode(LOWORD(wParam));\r
1311                                         break;\r
1312 \r
1313                                 case MENU_KANACNV :\r
1314                                         SetHostKanaCnv();\r
1315                                         break;\r
1316 \r
1317                                 case MENU_REFRESH :\r
1318                                         // デッドロック対策\r
1319                                         if(AskUserOpeDisabled() == YES)\r
1320                                                 break;\r
1321                                         // 同時接続対応\r
1322                                         CancelFlg = NO;\r
1323                                         SuppressRefresh = 1;\r
1324                                         GetLocalDirForWnd();\r
1325                                         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
1326                                                 GetRemoteDirForWnd(CACHE_REFRESH, &CancelFlg);\r
1327                                         SuppressRefresh = 0;\r
1328                                         break;\r
1329 \r
1330                                 case MENU_LIST :\r
1331                                         ListType = LVS_LIST;\r
1332                                         DispListType();\r
1333                                         SetListViewType();\r
1334                                         break;\r
1335 \r
1336                                 case MENU_REPORT :\r
1337                                         ListType = LVS_REPORT;\r
1338                                         DispListType();\r
1339                                         SetListViewType();\r
1340                                         break;\r
1341 \r
1342                                 case REFRESH_LOCAL :\r
1343                                         // デッドロック対策\r
1344                                         if(AskUserOpeDisabled() == YES)\r
1345                                                 break;\r
1346                                         GetLocalDirForWnd();\r
1347                                         break;\r
1348 \r
1349                                 case REFRESH_REMOTE :\r
1350                                         // デッドロック対策\r
1351                                         if(AskUserOpeDisabled() == YES)\r
1352                                                 break;\r
1353                                         // 同時接続対応\r
1354                                         CancelFlg = NO;\r
1355                                         SuppressRefresh = 1;\r
1356                                         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
1357                                                 GetRemoteDirForWnd(CACHE_REFRESH, &CancelFlg);\r
1358                                         SuppressRefresh = 0;\r
1359                                         break;\r
1360 \r
1361                                 case COMBO_LOCAL :\r
1362                                 case COMBO_REMOTE :\r
1363                                         SuppressRefresh = 1;\r
1364                                         if(HIWORD(wParam) == CBN_SELCHANGE)\r
1365                                         {\r
1366                                                 SetCurrentDirAsDirHist();\r
1367                                                 ChangeDirComboProc((HWND)lParam);\r
1368                                         }\r
1369                                         else if(HIWORD(wParam) != CBN_CLOSEUP)\r
1370                                         {\r
1371                                                 MakeButtonsFocus();\r
1372                                                 SuppressRefresh = 0;\r
1373                                                 return(0);\r
1374                                         }\r
1375                                         SuppressRefresh = 0;\r
1376                                         break;\r
1377 \r
1378                                 case MENU_HELP :\r
1379                                         hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000001);\r
1380                                         break;\r
1381 \r
1382                                 case MENU_HELP_TROUBLE :\r
1383                                         // 任意のコードが実行されるバグ修正\r
1384 //                                      ShellExecute(NULL, "open", MYWEB_URL, NULL, ".", SW_SHOW);\r
1385                                         ShellExecute(NULL, "open", MYWEB_URL, NULL, NULL, SW_SHOW);\r
1386                                         break;\r
1387 \r
1388                                 case MENU_BMARK_ADD :\r
1389                                         AddCurDirToBookMark(WIN_REMOTE);\r
1390                                         break;\r
1391 \r
1392                                 case MENU_BMARK_ADD_LOCAL :\r
1393                                         AddCurDirToBookMark(WIN_LOCAL);\r
1394                                         break;\r
1395 \r
1396                                 case MENU_BMARK_ADD_BOTH :\r
1397                                         AddCurDirToBookMark(WIN_BOTH);\r
1398                                         break;\r
1399 \r
1400                                 case MENU_BMARK_EDIT :\r
1401                                         EditBookMark();\r
1402                                         break;\r
1403 \r
1404                                 case MENU_SELECT_ALL :\r
1405                                         // ローカル側自動更新\r
1406 //                                      SelectFileInList(hWndCurFocus, SELECT_ALL);\r
1407                                         SelectFileInList(hWndCurFocus, SELECT_ALL, NULL);\r
1408                                         break;\r
1409 \r
1410                                 case MENU_SELECT :\r
1411                                         // ローカル側自動更新\r
1412 //                                      SelectFileInList(hWndCurFocus, SELECT_REGEXP);\r
1413                                         SelectFileInList(hWndCurFocus, SELECT_REGEXP, NULL);\r
1414                                         break;\r
1415 \r
1416                                 case MENU_FIND :\r
1417                                         FindFileInList(hWndCurFocus, FIND_FIRST);\r
1418                                         break;\r
1419 \r
1420                                 case MENU_FINDNEXT :\r
1421                                         FindFileInList(hWndCurFocus, FIND_NEXT);\r
1422                                         break;\r
1423 \r
1424                                 case MENU_DOTFILE :\r
1425                                         // デッドロック対策\r
1426                                         if(AskUserOpeDisabled() == YES)\r
1427                                                 break;\r
1428                                         // 同時接続対応\r
1429                                         CancelFlg = NO;\r
1430                                         DotFile ^= 1;\r
1431                                         DispDotFileMode();\r
1432                                         GetLocalDirForWnd();\r
1433                                         GetRemoteDirForWnd(CACHE_LASTREAD, &CancelFlg);\r
1434                                         break;\r
1435 \r
1436                                 case MENU_SYNC :\r
1437                                         ToggleSyncMoveMode();\r
1438                                         break;\r
1439 \r
1440                                 case MENU_IMPORT_WS :\r
1441                                         ImportFromWSFTP();\r
1442                                         break;\r
1443 \r
1444                                 case MENU_REGSAVE :\r
1445                                         GetListTabWidth();\r
1446                                         SaveRegistry();\r
1447                                         SaveSettingsToFile();\r
1448                                         break;\r
1449 \r
1450                                 case MENU_REGLOAD :\r
1451                                         if(LoadSettingsFromFile() == YES)\r
1452                                         {\r
1453                                                 MessageBox(hWnd, MSGJPN292, "FFFTP", MB_OK);\r
1454                                                 SaveExit = NO;\r
1455                                                 PostMessage(hWnd, WM_CLOSE, 0, 0L);\r
1456                                         }\r
1457                                         break;\r
1458 \r
1459                                 case MENU_REGINIT :\r
1460                                         if(DialogBox(hInstFtp, MAKEINTRESOURCE(reginit_dlg), hWnd, ExeEscDialogProc) == YES)\r
1461                                         {\r
1462                                                 ClearRegistry();\r
1463                                                 // ポータブル版判定\r
1464                                                 ClearIni();\r
1465                                                 SaveExit = NO;\r
1466                                                 PostMessage(hWnd, WM_CLOSE, 0, 0L);\r
1467                                         }\r
1468                                         break;\r
1469                                 case MENU_CHANGEPASSWD: /* 2010.01.31 genta */\r
1470                                         if( GetMasterPasswordStatus() != PASSWORD_OK )\r
1471                                         {\r
1472                                                 /* 強制的に設定するか確認 */\r
1473                                                 if( DialogBox(hInstFtp, MAKEINTRESOURCE(forcepasschange_dlg), hWnd, ExeEscDialogProc) != YES){\r
1474                                                         break;\r
1475                                                 }\r
1476                                                 // セキュリティ強化\r
1477                                                 if(EnterMasterPasswordAndSet(newmasterpasswd_dlg, hWnd) != 0)\r
1478                                                         SetTaskMsg(MSGJPN303);\r
1479                                         }\r
1480                                         // セキュリティ強化\r
1481 //                                      if( EnterMasterPasswordAndSet( newmasterpasswd_dlg, hWnd ) != 0 ){\r
1482 //                                              SetTaskMsg( MSGJPN303 );\r
1483 //                                      }\r
1484                                         else if(GetMasterPasswordStatus() == PASSWORD_OK)\r
1485                                         {\r
1486                                                 char Password[MAX_PASSWORD_LEN + 1];\r
1487                                                 GetMasterPassword(Password);\r
1488                                                 SetMasterPassword(NULL);\r
1489                                                 while(ValidateMasterPassword() == YES && GetMasterPasswordStatus() == PASSWORD_UNMATCH)\r
1490                                                 {\r
1491                                                         if(EnterMasterPasswordAndSet(masterpasswd_dlg, NULL) == 0)\r
1492                                                                 break;\r
1493                                                 }\r
1494                                                 if(GetMasterPasswordStatus() == PASSWORD_OK && EnterMasterPasswordAndSet(newmasterpasswd_dlg, hWnd) != 0)\r
1495                                                 {\r
1496                                                         SetTaskMsg(MSGJPN303);\r
1497                                                         SaveRegistry();\r
1498                                                 }\r
1499                                                 else\r
1500                                                 {\r
1501                                                         SetMasterPassword(Password);\r
1502                                                         ValidateMasterPassword();\r
1503                                                 }\r
1504                                         }\r
1505                                         break;\r
1506 \r
1507                                 case MENU_DIRINFO :\r
1508                                         DispDirInfo();\r
1509                                         break;\r
1510 \r
1511                                 case MENU_TASKINFO :\r
1512                                         DispTaskMsg();\r
1513                                         break;\r
1514 \r
1515                                 case MENU_ABORT :\r
1516                                         CancelFlg = YES;\r
1517                                         if(AskTryingConnect() == NO)\r
1518                                                 MainTransPkt.Abort = ABORT_USER;\r
1519                                         break;\r
1520 \r
1521                                 case MENU_OTPCALC :\r
1522                                         OtpCalcTool();\r
1523                                         break;\r
1524 \r
1525                                 case MENU_URL_COPY :\r
1526                                         CopyURLtoClipBoard();\r
1527                                         break;\r
1528 \r
1529                                 case MENU_APPKEY :\r
1530                                         EraseListViewTips();\r
1531                                         if(hWndCurFocus == GetRemoteHwnd())\r
1532                                                 RemoteRbuttonMenu(1);\r
1533                                         else if(hWndCurFocus == GetLocalHwnd())\r
1534                                                 LocalRbuttonMenu(1);\r
1535                                         break;\r
1536 \r
1537 #if defined(HAVE_TANDEM)\r
1538                                 case MENU_SWITCH_OSS :\r
1539                                         SwitchOSSProc();\r
1540                                         break;\r
1541 #endif\r
1542 \r
1543                                 default :\r
1544                                         if((LOWORD(wParam) >= MENU_BMARK_TOP) &&\r
1545                                            (LOWORD(wParam) < MENU_BMARK_TOP+100))\r
1546                                         {\r
1547                                                 ChangeDirBmarkProc(LOWORD(wParam));\r
1548                                         }\r
1549                                         break;\r
1550                         }\r
1551 // 常にホストかローカルへフォーカスを移動\r
1552 //                      SetFocus(hWndCurFocus);\r
1553                         MakeButtonsFocus();\r
1554                         break;\r
1555 \r
1556                 case WM_NOTIFY :\r
1557                         switch(((LPNMHDR)lParam)->code)\r
1558                         {\r
1559                                 /* ツールチップコントロールメッセージの処理 */\r
1560                                 // UTF-8対応\r
1561 //                              case TTN_NEEDTEXT:\r
1562                                 case TTN_NEEDTEXTW:\r
1563                                         lpttt = (LPTOOLTIPTEXT)lParam;\r
1564                                         // UTF-8対応\r
1565                                         // lptttは単なる警告回避用\r
1566                                         wlpttt = (LPTOOLTIPTEXTW)lParam;\r
1567                                         lpttt->hinst = hInstFtp;\r
1568                                         switch(lpttt->hdr.idFrom)\r
1569                                         {\r
1570                                                 case MENU_CONNECT :\r
1571                                                         lpttt->lpszText = MSGJPN154;\r
1572                                                         break;\r
1573 \r
1574                                                 case MENU_QUICK :\r
1575                                                         lpttt->lpszText = MSGJPN155;\r
1576                                                         break;\r
1577 \r
1578                                                 case MENU_DISCONNECT :\r
1579                                                         lpttt->lpszText = MSGJPN156;\r
1580                                                         break;\r
1581 \r
1582                                                 case MENU_DOWNLOAD :\r
1583                                                         lpttt->lpszText = MSGJPN157;\r
1584                                                         break;\r
1585 #if defined(HAVE_TANDEM)\r
1586                                                 case MENU_DOWNLOAD_AS :\r
1587                                                         lpttt->lpszText = MSGJPN065;\r
1588                                                         break;\r
1589 \r
1590                                                 case MENU_UPLOAD_AS :\r
1591                                                         lpttt->lpszText = MSGJPN064;\r
1592                                                         break;\r
1593 #endif\r
1594                                                 case MENU_UPLOAD :\r
1595                                                         lpttt->lpszText = MSGJPN158;\r
1596                                                         break;\r
1597 \r
1598                                                 case MENU_MIRROR_UPLOAD :\r
1599                                                         lpttt->lpszText = MSGJPN159;\r
1600                                                         break;\r
1601 \r
1602                                                 case MENU_DELETE :\r
1603                                                         lpttt->lpszText = MSGJPN160;\r
1604                                                         break;\r
1605 \r
1606                                                 case MENU_RENAME :\r
1607                                                         lpttt->lpszText = MSGJPN161;\r
1608                                                         break;\r
1609 \r
1610                                                 case MENU_MKDIR :\r
1611                                                         lpttt->lpszText = MSGJPN162;\r
1612                                                         break;\r
1613 \r
1614                                                 case MENU_LOCAL_UPDIR :\r
1615                                                 case MENU_REMOTE_UPDIR :\r
1616                                                         lpttt->lpszText = MSGJPN163;\r
1617                                                         break;\r
1618 \r
1619                                                 case MENU_LOCAL_CHDIR :\r
1620                                                 case MENU_REMOTE_CHDIR :\r
1621                                                         lpttt->lpszText = MSGJPN164;\r
1622                                                         break;\r
1623 \r
1624                                                 case MENU_TEXT :\r
1625                                                         lpttt->lpszText = MSGJPN165;\r
1626                                                         break;\r
1627 \r
1628                                                 case MENU_BINARY :\r
1629                                                         lpttt->lpszText = MSGJPN166;\r
1630                                                         break;\r
1631 \r
1632                                                 case MENU_AUTO :\r
1633                                                         lpttt->lpszText = MSGJPN167;\r
1634                                                         break;\r
1635 \r
1636                                                 case MENU_REFRESH :\r
1637                                                         lpttt->lpszText = MSGJPN168;\r
1638                                                         break;\r
1639 \r
1640                                                 case MENU_LIST :\r
1641                                                         lpttt->lpszText = MSGJPN169;\r
1642                                                         break;\r
1643 \r
1644                                                 case MENU_REPORT :\r
1645                                                         lpttt->lpszText = MSGJPN170;\r
1646                                                         break;\r
1647 \r
1648                                                 case MENU_KNJ_SJIS :\r
1649                                                         lpttt->lpszText = MSGJPN307;\r
1650                                                         break;\r
1651 \r
1652                                                 case MENU_KNJ_EUC :\r
1653                                                         lpttt->lpszText = MSGJPN171;\r
1654                                                         break;\r
1655 \r
1656                                                 case MENU_KNJ_JIS :\r
1657                                                         lpttt->lpszText = MSGJPN172;\r
1658                                                         break;\r
1659 \r
1660                                                 case MENU_KNJ_UTF8N :\r
1661                                                         lpttt->lpszText = MSGJPN308;\r
1662                                                         break;\r
1663 \r
1664                                                 case MENU_KNJ_UTF8BOM :\r
1665                                                         lpttt->lpszText = MSGJPN330;\r
1666                                                         break;\r
1667 \r
1668                                                 case MENU_KNJ_NONE :\r
1669                                                         lpttt->lpszText = MSGJPN173;\r
1670                                                         break;\r
1671 \r
1672                                                 case MENU_L_KNJ_SJIS :\r
1673                                                         lpttt->lpszText = MSGJPN309;\r
1674                                                         break;\r
1675 \r
1676                                                 case MENU_L_KNJ_EUC :\r
1677                                                         lpttt->lpszText = MSGJPN310;\r
1678                                                         break;\r
1679 \r
1680                                                 case MENU_L_KNJ_JIS :\r
1681                                                         lpttt->lpszText = MSGJPN311;\r
1682                                                         break;\r
1683 \r
1684                                                 case MENU_L_KNJ_UTF8N :\r
1685                                                         lpttt->lpszText = MSGJPN312;\r
1686                                                         break;\r
1687 \r
1688                                                 case MENU_L_KNJ_UTF8BOM :\r
1689                                                         lpttt->lpszText = MSGJPN331;\r
1690                                                         break;\r
1691 \r
1692                                                 case MENU_KANACNV :\r
1693                                                         lpttt->lpszText = MSGJPN174;\r
1694                                                         break;\r
1695 \r
1696                                                 case MENU_SYNC :\r
1697                                                         lpttt->lpszText = MSGJPN175;\r
1698                                                         break;\r
1699 \r
1700                                                 case MENU_ABORT :\r
1701                                                         lpttt->lpszText = MSGJPN176;\r
1702                                                         break;\r
1703                                         }\r
1704                                         // UTF-8対応\r
1705                                         // UTF-8からUTF-16 LEへ変換\r
1706                                         {\r
1707                                                 static wchar_t StringBufferUTF16[1024];\r
1708                                                 if(lpttt->lpszText)\r
1709                                                 {\r
1710                                                         MtoW(StringBufferUTF16, sizeof(StringBufferUTF16)/ sizeof(wchar_t), lpttt->lpszText, -1);\r
1711                                                         wlpttt->lpszText = StringBufferUTF16;\r
1712                                                 }\r
1713                                         }\r
1714                                         break;\r
1715 \r
1716                                 case LVN_COLUMNCLICK :\r
1717                                         if(((NMHDR *)lParam)->hwndFrom == GetLocalHwnd())\r
1718                                         {\r
1719                                                 // 同時接続対応\r
1720                                                 CancelFlg = NO;\r
1721                                                 SetSortTypeByColumn(WIN_LOCAL, ((NM_LISTVIEW *)lParam)->iSubItem);\r
1722                                                 ReSortDispList(WIN_LOCAL, &CancelFlg);\r
1723                                         }\r
1724                                         else if(((NMHDR *)lParam)->hwndFrom == GetRemoteHwnd())\r
1725                                         {\r
1726                                                 if(((NM_LISTVIEW *)lParam)->iSubItem != 4)\r
1727                                                 {\r
1728                                                         // 同時接続対応\r
1729                                                         CancelFlg = NO;\r
1730                                                         SetSortTypeByColumn(WIN_REMOTE, ((NM_LISTVIEW *)lParam)->iSubItem);\r
1731                                                         ReSortDispList(WIN_REMOTE, &CancelFlg);\r
1732                                                 }\r
1733                                         }\r
1734                                         SetFocus(hWndCurFocus);\r
1735                                         break;\r
1736 \r
1737                                 case LVN_ITEMCHANGED :\r
1738                                         DispSelectedSpace();\r
1739                                         MakeButtonsFocus();\r
1740                                         break;\r
1741                         }\r
1742                         break;\r
1743 \r
1744                 case WM_SIZE :\r
1745                         Sizing = SW_RESTORE;\r
1746                         if(wParam == SIZE_RESTORED)\r
1747                         {\r
1748                                 ResizeWindowProc();\r
1749                                 GetWindowRect(hWnd, &Rect);\r
1750                                 WinPosX = Rect.left;\r
1751                                 WinPosY = Rect.top;\r
1752                         }\r
1753                         else if(wParam == SIZE_MAXIMIZED)\r
1754                         {\r
1755                                 Sizing = SW_MAXIMIZE;\r
1756                                 ResizeWindowProc();\r
1757                         }\r
1758                         else\r
1759                                 return(DefWindowProc(hWnd, message, wParam, lParam));\r
1760                         break;\r
1761 \r
1762                 case WM_MOVING :\r
1763                         WinPosX = ((RECT *)lParam)->left;\r
1764                         WinPosY = ((RECT *)lParam)->top;\r
1765                         return(DefWindowProc(hWnd, message, wParam, lParam));\r
1766 \r
1767                 case WM_SETFOCUS :\r
1768                         SetFocus(hWndCurFocus);\r
1769                         break;\r
1770 \r
1771                 case WM_LBUTTONDOWN :\r
1772                 case WM_LBUTTONUP :\r
1773                 case WM_MOUSEMOVE :\r
1774                         CheckResizeFrame(wParam, LOWORD(lParam), HIWORD(lParam));\r
1775                         break;\r
1776 \r
1777                 case WM_CHANGE_COND :\r
1778                         DispTransferFiles();\r
1779                         break;\r
1780 \r
1781                 case WM_REFRESH_LOCAL_FLG :\r
1782                         // 外部アプリケーションへドロップ後にローカル側のファイル一覧に作業フォルダが表示されるバグ対策\r
1783 //                      PostMessage(hWnd,  WM_COMMAND, MAKEWPARAM(REFRESH_LOCAL, 0), 0);\r
1784                         if(SuppressRefresh == 0)\r
1785                                 PostMessage(hWnd,  WM_COMMAND, MAKEWPARAM(REFRESH_LOCAL, 0), 0);\r
1786                         break;\r
1787 \r
1788                 case WM_REFRESH_REMOTE_FLG :\r
1789                         if(SuppressRefresh == 0)\r
1790                                 PostMessage(hWnd,  WM_COMMAND, MAKEWPARAM(REFRESH_REMOTE, 0), 0);\r
1791                         break;\r
1792 \r
1793                 case WM_PAINT :\r
1794                     BeginPaint(hWnd, (LPPAINTSTRUCT) &ps);\r
1795                     EndPaint(hWnd, (LPPAINTSTRUCT) &ps);\r
1796                         break;\r
1797 \r
1798                 case WM_DESTROY :\r
1799                         // ローカル側自動更新\r
1800                         KillTimer(hWnd, 1);\r
1801                         if(ChangeNotification != INVALID_HANDLE_VALUE)\r
1802                                 FindCloseChangeNotification(ChangeNotification);\r
1803 //                      WSACleanup();\r
1804 //                      DestroyWindow(hWndFtp);\r
1805                         PostQuitMessage(0);\r
1806                         break;\r
1807 \r
1808                 case WM_QUERYENDSESSION :\r
1809                         ExitProc(hWnd);\r
1810                         return(TRUE);\r
1811 \r
1812                 case WM_CLOSE :\r
1813                         if((AskTransferNow() == NO) ||\r
1814                            (DialogBox(hInstFtp, MAKEINTRESOURCE(exit_dlg), hWnd, ExeEscDialogProc) == YES))\r
1815                         {\r
1816                                 ExitProc(hWnd);\r
1817                                 return(DefWindowProc(hWnd, message, wParam, lParam));\r
1818                         }\r
1819                         break;\r
1820 \r
1821                 default :\r
1822                         return(DefWindowProc(hWnd, message, wParam, lParam));\r
1823         }\r
1824     return(0L);\r
1825 }\r
1826 \r
1827 \r
1828 /*----- プログラム開始時の処理 ------------------------------------------------\r
1829 *\r
1830 *       Parameter\r
1831 *               char *Cmd : コマンドライン文字列\r
1832 *\r
1833 *       Return Value\r
1834 *               なし\r
1835 *----------------------------------------------------------------------------*/\r
1836 \r
1837 static void StartupProc(char *Cmd)\r
1838 {\r
1839         int Sts;\r
1840         int AutoConnect;\r
1841         int CmdOption;\r
1842         int Kanji;\r
1843         int Kana;\r
1844         int FnameKanji;\r
1845         int TrMode;\r
1846         char unc[FMAX_PATH+1];\r
1847 \r
1848         Sts = AnalyzeComLine(Cmd, &AutoConnect, &CmdOption, unc, FMAX_PATH);\r
1849 \r
1850         TrMode = TYPE_DEFAULT;\r
1851         Kanji = KANJI_NOCNV;\r
1852         FnameKanji = KANJI_NOCNV;\r
1853         Kana = YES;\r
1854         if(CmdOption & OPT_ASCII)\r
1855                 TrMode = TYPE_A;\r
1856         if(CmdOption & OPT_BINARY)\r
1857                 TrMode = TYPE_I;\r
1858         if(CmdOption & OPT_EUC)\r
1859                 Kanji = KANJI_EUC;\r
1860         if(CmdOption & OPT_JIS)\r
1861                 Kanji = KANJI_JIS;\r
1862         if(CmdOption & OPT_EUC_NAME)\r
1863                 FnameKanji = KANJI_EUC;\r
1864         if(CmdOption & OPT_JIS_NAME)\r
1865                 FnameKanji = KANJI_JIS;\r
1866         if(CmdOption & OPT_KANA)\r
1867                 Kana = NO;\r
1868 \r
1869         if(CmdOption & OPT_QUIT)\r
1870                 AutoExit = YES;\r
1871 \r
1872         if(CmdOption & OPT_SAVEOFF)\r
1873                 SuppressSave = YES;\r
1874         if(CmdOption & OPT_SAVEON)\r
1875                 SuppressSave = NO;\r
1876 \r
1877         // UTF-8対応\r
1878         if(CmdOption & OPT_SJIS)\r
1879                 Kanji = KANJI_SJIS;\r
1880         if(CmdOption & OPT_UTF8N)\r
1881                 Kanji = KANJI_UTF8N;\r
1882         if(CmdOption & OPT_UTF8BOM)\r
1883                 Kanji = KANJI_UTF8BOM;\r
1884         if(CmdOption & OPT_SJIS_NAME)\r
1885                 FnameKanji = KANJI_SJIS;\r
1886         if(CmdOption & OPT_UTF8N_NAME)\r
1887                 FnameKanji = KANJI_UTF8N;\r
1888 \r
1889         if(Sts == 0)\r
1890         {\r
1891                 if(ConnectOnStart == YES)\r
1892                         PostMessage(hWndFtp, WM_COMMAND, MAKEWPARAM(MENU_CONNECT, 0), 0);\r
1893         }\r
1894         else if(Sts == 1)\r
1895         {\r
1896                 DirectConnectProc(unc, Kanji, Kana, FnameKanji, TrMode);\r
1897         }\r
1898         else if(Sts == 2)\r
1899         {\r
1900                 PostMessage(hWndFtp, WM_COMMAND, MAKEWPARAM(MENU_CONNECT_NUM, CmdOption), (LPARAM)AutoConnect);\r
1901         }\r
1902         return;\r
1903 }\r
1904 \r
1905 \r
1906 /*----- コマンドラインを解析 --------------------------------------------------\r
1907 *\r
1908 *       Parameter\r
1909 *               char *Str : コマンドライン文字列\r
1910 *               int *AutoConnect : 接続ホスト番号を返すワーク\r
1911 *               int *CmdOption : オプションを返すワーク\r
1912 *               char *unc : uncを返すワーク\r
1913 *               int Max : uncの最大長\r
1914 *\r
1915 *       Return Value\r
1916 *               int ステータス\r
1917 *                       0=指定なし、1=URL指定、2=設定名指定、-1=エラー\r
1918 *\r
1919 *       Note\r
1920 *               -m      --mirror\r
1921 *               -d      --mirrordown\r
1922 *               -f      --force\r
1923 *               -q      --quit\r
1924 *               -s      --set\r
1925 *               -h      --help\r
1926 *               -e      --euc\r
1927 *               -j      --jis\r
1928 *               -a      --ascii\r
1929 *               -b      --binary\r
1930 *               -x      --auto\r
1931 *               -k      --kana\r
1932 *               -u      --eucname\r
1933 *               -i      --jisname\r
1934 *               -n  --ini               (CheckIniFileNameで検索)\r
1935 *                       --saveoff\r
1936 *                       --saveon\r
1937 *               -z      --mpasswd       (CheckMasterPasswordで検索)  2010.01.30 genta 追加\r
1938 *----------------------------------------------------------------------------*/\r
1939 \r
1940 static int AnalyzeComLine(char *Str, int *AutoConnect, int *CmdOption, char *unc, int Max)\r
1941 {\r
1942         int Ret;\r
1943         char Tmp[FMAX_PATH+1];\r
1944 \r
1945         *AutoConnect = -1;\r
1946         *CmdOption = 0;\r
1947 \r
1948         Ret = 0;\r
1949         memset(unc, NUL, Max+1);\r
1950 \r
1951         while((Ret != -1) && ((Str = GetToken(Str, Tmp)) != NULL))\r
1952         {\r
1953                 if(Tmp[0] == '-')\r
1954                 {\r
1955                         _strlwr(Tmp);\r
1956                         if((strcmp(&Tmp[1], "m") == 0) || (strcmp(&Tmp[1], "-mirror") == 0))\r
1957                                 *CmdOption |= OPT_MIRROR;\r
1958                         else if((strcmp(&Tmp[1], "d") == 0) || (strcmp(&Tmp[1], "-mirrordown") == 0))\r
1959                                 *CmdOption |= OPT_MIRRORDOWN;\r
1960                         // 廃止予定\r
1961 //                      else if((strcmp(&Tmp[1], "e") == 0) || (strcmp(&Tmp[1], "-euc") == 0))\r
1962 //                              *CmdOption |= OPT_EUC;\r
1963 //                      else if((strcmp(&Tmp[1], "j") == 0) || (strcmp(&Tmp[1], "-jis") == 0))\r
1964 //                              *CmdOption |= OPT_JIS;\r
1965                         else if((strcmp(&Tmp[1], "eu") == 0) || (strcmp(&Tmp[1], "e") == 0) || (strcmp(&Tmp[1], "-euc") == 0))\r
1966                                 *CmdOption |= OPT_EUC;\r
1967                         else if((strcmp(&Tmp[1], "ji") == 0) || (strcmp(&Tmp[1], "j") == 0) || (strcmp(&Tmp[1], "-jis") == 0))\r
1968                                 *CmdOption |= OPT_JIS;\r
1969                         else if((strcmp(&Tmp[1], "a") == 0) || (strcmp(&Tmp[1], "-ascii") == 0))\r
1970                                 *CmdOption |= OPT_ASCII;\r
1971                         else if((strcmp(&Tmp[1], "b") == 0) || (strcmp(&Tmp[1], "-binary") == 0))\r
1972                                 *CmdOption |= OPT_BINARY;\r
1973                         else if((strcmp(&Tmp[1], "x") == 0) || (strcmp(&Tmp[1], "-auto") == 0))\r
1974                                 *CmdOption |= OPT_AUTO;\r
1975                         else if((strcmp(&Tmp[1], "f") == 0) || (strcmp(&Tmp[1], "-force") == 0))\r
1976                                 *CmdOption |= OPT_FORCE;\r
1977                         else if((strcmp(&Tmp[1], "q") == 0) || (strcmp(&Tmp[1], "-quit") == 0))\r
1978                                 *CmdOption |= OPT_QUIT;\r
1979                         else if((strcmp(&Tmp[1], "k") == 0) || (strcmp(&Tmp[1], "-kana") == 0))\r
1980                                 *CmdOption |= OPT_KANA;\r
1981                         // 廃止予定\r
1982 //                      else if((strcmp(&Tmp[1], "u") == 0) || (strcmp(&Tmp[1], "-eucname") == 0))\r
1983 //                              *CmdOption |= OPT_EUC_NAME;\r
1984 //                      else if((strcmp(&Tmp[1], "i") == 0) || (strcmp(&Tmp[1], "-jisname") == 0))\r
1985 //                              *CmdOption |= OPT_JIS_NAME;\r
1986                         else if((strcmp(&Tmp[1], "eun") == 0) || (strcmp(&Tmp[1], "u") == 0) || (strcmp(&Tmp[1], "-eucname") == 0))\r
1987                                 *CmdOption |= OPT_EUC_NAME;\r
1988                         else if((strcmp(&Tmp[1], "jin") == 0) || (strcmp(&Tmp[1], "i") == 0) || (strcmp(&Tmp[1], "-jisname") == 0))\r
1989                                 *CmdOption |= OPT_JIS_NAME;\r
1990                         else if((strcmp(&Tmp[1], "n") == 0) || (strcmp(&Tmp[1], "-ini") == 0))\r
1991                         {\r
1992                                 if((Str = GetToken(Str, Tmp)) == NULL)\r
1993                                 {\r
1994                                         SetTaskMsg(MSGJPN282);\r
1995                                         Ret = -1;\r
1996                                 }\r
1997                         }\r
1998                         else if(strcmp(&Tmp[1], "-saveoff") == 0)\r
1999                                 *CmdOption |= OPT_SAVEOFF;\r
2000                         else if(strcmp(&Tmp[1], "-saveon") == 0)\r
2001                                 *CmdOption |= OPT_SAVEON;\r
2002                         else if((strcmp(&Tmp[1], "z") == 0) || (strcmp(&Tmp[1], "-mpasswd") == 0))\r
2003                         {       /* 2010.01.30 genta : Add master password option */\r
2004                                 if((Str = GetToken(Str, Tmp)) == NULL)\r
2005                                 {\r
2006                                         SetTaskMsg(MSGJPN299);\r
2007                                         Ret = -1;\r
2008                                 }\r
2009                         }\r
2010                         else if((strcmp(&Tmp[1], "s") == 0) || (strcmp(&Tmp[1], "-set") == 0))\r
2011                         {\r
2012                                 if(Ret == 0)\r
2013                                 {\r
2014                                         if((Str = GetToken(Str, Tmp)) != NULL)\r
2015                                         {\r
2016                                                 if((*AutoConnect = SearchHostName(Tmp)) != -1)\r
2017                                                         Ret = 2;\r
2018                                                 else\r
2019                                                 {\r
2020                                                         SetTaskMsg(MSGJPN177, Tmp);\r
2021                                                         Ret = -1;\r
2022                                                 }\r
2023                                         }\r
2024                                         else\r
2025                                         {\r
2026                                                 SetTaskMsg(MSGJPN178);\r
2027                                                 Ret = -1;\r
2028                                         }\r
2029                                 }\r
2030                                 else\r
2031                                 {\r
2032                                         SetTaskMsg(MSGJPN179);\r
2033                                         Ret = -1;\r
2034                                 }\r
2035                         }\r
2036                         else if((strcmp(&Tmp[1], "h") == 0) || (strcmp(&Tmp[1], "-help") == 0))\r
2037                         {\r
2038                                 hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000024);\r
2039                         }\r
2040                         // プロセス保護\r
2041 #ifdef ENABLE_PROCESS_PROTECTION\r
2042                         else if(strcmp(Tmp, "--restart") == 0)\r
2043                         {\r
2044                         }\r
2045                         else if(strcmp(Tmp, "--protect") == 0)\r
2046                         {\r
2047                         }\r
2048                         else if(strcmp(Tmp, "--protect-high") == 0)\r
2049                         {\r
2050                         }\r
2051                         else if(strcmp(Tmp, "--protect-medium") == 0)\r
2052                         {\r
2053                         }\r
2054                         else if(strcmp(Tmp, "--protect-low") == 0)\r
2055                         {\r
2056                         }\r
2057 #endif\r
2058                         // UTF-8対応\r
2059                         else if((strcmp(&Tmp[1], "sj") == 0) || (strcmp(&Tmp[1], "-sjis") == 0))\r
2060                                 *CmdOption |= OPT_SJIS;\r
2061                         else if((strcmp(&Tmp[1], "u8") == 0) || (strcmp(&Tmp[1], "-utf8") == 0))\r
2062                                 *CmdOption |= OPT_UTF8N;\r
2063                         else if((strcmp(&Tmp[1], "8b") == 0) || (strcmp(&Tmp[1], "-utf8bom") == 0))\r
2064                                 *CmdOption |= OPT_UTF8BOM;\r
2065                         else if((strcmp(&Tmp[1], "sjn") == 0) || (strcmp(&Tmp[1], "-sjisname") == 0))\r
2066                                 *CmdOption |= OPT_SJIS_NAME;\r
2067                         else if((strcmp(&Tmp[1], "u8n") == 0) || (strcmp(&Tmp[1], "-utf8name") == 0))\r
2068                                 *CmdOption |= OPT_UTF8N_NAME;\r
2069                         else\r
2070                         {\r
2071                                 SetTaskMsg(MSGJPN180, Tmp);\r
2072                                 Ret = -1;\r
2073                         }\r
2074                 }\r
2075                 else\r
2076                 {\r
2077                         if(Ret == 0)\r
2078                         {\r
2079                                 strncpy(unc, Tmp, Max);\r
2080                                 Ret = 1;\r
2081                         }\r
2082                         else\r
2083                         {\r
2084                                 SetTaskMsg(MSGJPN181);\r
2085                                 Ret = -1;\r
2086                         }\r
2087                 }\r
2088         }\r
2089         return(Ret);\r
2090 }\r
2091 \r
2092 \r
2093 /*----- INIファイルのパス名の指定をチェック ------------------------------------\r
2094 *\r
2095 *       Parameter\r
2096 *               char *Str : コマンドライン文字列\r
2097 *               char *Ini : iniファイル名を返すワーク\r
2098 *\r
2099 *       Return Value\r
2100 *               int ステータス\r
2101 *                       0=指定なし、1=あり\r
2102 *\r
2103 *       Note\r
2104 *               -n  --ini\r
2105 *----------------------------------------------------------------------------*/\r
2106 \r
2107 static int CheckIniFileName(char *Str, char *Ini)\r
2108 {\r
2109         return GetTokenAfterOption( Str, Ini, "n", "-ini" );\r
2110 }\r
2111 \r
2112 /* マスターパスワードの指定をチェック */\r
2113 static int CheckMasterPassword(char *Str, char *Ini)\r
2114 {\r
2115         return GetTokenAfterOption( Str, Ini, "z", "-mpasswd" );\r
2116 }\r
2117 \r
2118 /*----- オプションの後ろのトークンを取り出す ------------------------------------\r
2119 *\r
2120 *       Parameter\r
2121 *               char *Str : コマンドライン文字列\r
2122 *               char *Result : 取り出した文字列を格納するワーク\r
2123 *               const char* Opt1, *Opt2: オプション文字列(2つ)\r
2124 *\r
2125 *       Return Value\r
2126 *               int ステータス\r
2127 *                       0=指定なし、1=あり\r
2128 *\r
2129 *       Note\r
2130 *               2010.01.30 genta マスターパスワード取り出しのため共通化\r
2131 *----------------------------------------------------------------------------*/\r
2132 static int GetTokenAfterOption(char *Str, char *Result, const char* Opt1, const char* Opt2 )\r
2133 {\r
2134         int Ret = 0;\r
2135         char Tmp[FMAX_PATH+1];\r
2136 \r
2137         Result[0] = NUL;\r
2138         while((Str = GetToken(Str, Tmp)) != NULL)\r
2139         {\r
2140                 if(Tmp[0] == '-')\r
2141                 {\r
2142                         _strlwr(Tmp);\r
2143                         if((strcmp(&Tmp[1], Opt1) == 0) || (strcmp(&Tmp[1], Opt2) == 0))\r
2144                         {\r
2145                                 if((Str = GetToken(Str, Result)) != NULL)\r
2146                                         Ret = 1;\r
2147                                 break;\r
2148                         }\r
2149                 }\r
2150         }\r
2151         return(Ret);\r
2152 }\r
2153 \r
2154 /*----- トークンを返す --------------------------------------------------------\r
2155 *\r
2156 *       Parameter\r
2157 *               char *Str : 文字列\r
2158 *               char *Buf : 文字列を返すバッファ\r
2159 *\r
2160 *       Return Value\r
2161 *               char *返したトークンの末尾\r
2162 *                       NULL=終わり\r
2163 *----------------------------------------------------------------------------*/\r
2164 \r
2165 static char *GetToken(char *Str, char *Buf)\r
2166 {\r
2167         int InQuote;\r
2168 \r
2169         while(*Str != NUL)\r
2170         {\r
2171                 if((*Str != ' ') && (*Str != '\t'))\r
2172                         break;\r
2173                 Str++;\r
2174         }\r
2175 \r
2176         if(*Str != NUL)\r
2177         {\r
2178                 InQuote = 0;\r
2179                 while(*Str != NUL)\r
2180                 {\r
2181                         if(*Str == 0x22)\r
2182                                 InQuote = !InQuote;\r
2183                         else\r
2184                         {\r
2185                                 if(((*Str == ' ') || (*Str == '\t')) &&\r
2186                                    (InQuote == 0))\r
2187                                 {\r
2188                                         break;\r
2189                                 }\r
2190                                 *Buf++ = *Str;\r
2191                         }\r
2192                         Str++;\r
2193                 }\r
2194         }\r
2195         else\r
2196                 Str = NULL;\r
2197 \r
2198         *Buf = NUL;\r
2199 \r
2200         return(Str);\r
2201 }\r
2202 \r
2203 \r
2204 /*----- プログラム終了時の処理 ------------------------------------------------\r
2205 *\r
2206 *       Parameter\r
2207 *               HWND hWnd : ウインドウハンドル\r
2208 *\r
2209 *       Return Value\r
2210 *               なし\r
2211 *----------------------------------------------------------------------------*/\r
2212 \r
2213 static void ExitProc(HWND hWnd)\r
2214 {\r
2215         // 環境依存の不具合対策\r
2216         char Tmp[FMAX_PATH+1];\r
2217 \r
2218         CancelFlg = YES;\r
2219 \r
2220         CloseTransferThread();\r
2221 \r
2222         if(SaveExit == YES)\r
2223         {\r
2224                 SaveBookMark();\r
2225                 SaveCurrentSetToHost();\r
2226         }\r
2227         DeleteAlltempFile();\r
2228 \r
2229 //      WSACancelBlockingCall();\r
2230         DisconnectProc();\r
2231 //      CloseTransferThread();\r
2232 \r
2233         if(SaveExit == YES)\r
2234         {\r
2235                 GetListTabWidth();\r
2236                 SaveRegistry();\r
2237                 // ポータブル版判定\r
2238                 if(RegType == REGTYPE_REG)\r
2239                         ClearIni();\r
2240 \r
2241                 if((CacheEntry > 0) && (CacheSave == YES))\r
2242                         SaveCache();\r
2243                 else\r
2244                         DeleteCache();\r
2245         }\r
2246         else\r
2247                 DeleteCache();\r
2248 \r
2249         // 環境依存の不具合対策\r
2250         GetAppTempPath(Tmp);\r
2251         SetYenTail(Tmp);\r
2252         strcat(Tmp, "file");\r
2253         _rmdir(Tmp);\r
2254         GetAppTempPath(Tmp);\r
2255         _rmdir(Tmp);\r
2256 \r
2257         if(RasClose == YES)\r
2258         {\r
2259                 DisconnectRas(RasCloseNotify);\r
2260         }\r
2261         DeleteAllObject();\r
2262         HtmlHelp(NULL, NULL, HH_UNINITIALIZE, dwCookie); \r
2263         return;\r
2264 }\r
2265 \r
2266 \r
2267 /*----- ファイル名をダブルクリックしたときの処理 ------------------------------\r
2268 *\r
2269 *       Parameter\r
2270 *               int Win : ウインドウ番号 (WIN_xxx)\r
2271 *               int Mode : 常に「開く」動作をするかどうか (YES/NO)\r
2272 *               int App : アプリケーション番号(-1=関連づけ優先)\r
2273 *\r
2274 *       Return Value\r
2275 *               なし\r
2276 *----------------------------------------------------------------------------*/\r
2277 \r
2278 void DoubleClickProc(int Win, int Mode, int App)\r
2279 {\r
2280         int Pos;\r
2281         int Type;\r
2282         char Local[FMAX_PATH+1];\r
2283         char Remote[FMAX_PATH+1];\r
2284         char Tmp[FMAX_PATH+1];\r
2285         int Sts;\r
2286         int UseDiffViewer;\r
2287 \r
2288         if(AskUserOpeDisabled() == NO)\r
2289         {\r
2290                 SetCurrentDirAsDirHist();\r
2291                 if(GetSelectedCount(Win) == 1)\r
2292                 {\r
2293                         if((Pos = GetFirstSelected(Win, NO)) != -1)\r
2294                         {\r
2295                                 GetNodeName(Win, Pos, Tmp, FMAX_PATH);\r
2296                                 Type = GetNodeType(Win, Pos);\r
2297 \r
2298                                 if(Win == WIN_LOCAL)\r
2299                                 {\r
2300                                         // ローカルフォルダを開く\r
2301 //                                      if((App != -1) || (Type == NODE_FILE))\r
2302                                         if((App != -1) || (Type == NODE_FILE) || (Mode == YES))\r
2303                                         {\r
2304                                                 if((DclickOpen == YES) || (Mode == YES))\r
2305                                                 {\r
2306                                                         AskLocalCurDir(Local, FMAX_PATH);\r
2307                                                         ReplaceAll(Local, '/', '\\');\r
2308                                                         SetYenTail(Local);\r
2309                                                         strcat(Local, Tmp);\r
2310                                                         ExecViewer(Local, App);\r
2311                                                 }\r
2312                                                 else\r
2313                                                         PostMessage(hWndFtp, WM_COMMAND, MAKEWPARAM(MENU_UPLOAD, 0), 0);\r
2314                                         }\r
2315                                         else\r
2316                                                 ChangeDir(WIN_LOCAL, Tmp);\r
2317                                 }\r
2318                                 else if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
2319                                 {\r
2320                                         if((App != -1) || (Type == NODE_FILE))\r
2321                                         {\r
2322                                                 if((DclickOpen == YES) || (Mode == YES))\r
2323                                                 {\r
2324                                                         // ビューワ2、3のパスが "d " で始まっていたら差分ビューア使用\r
2325                                                         if ((App == 1 || App == 2) && strncmp(ViewerName[App], "d ", 2) == 0)\r
2326                                                                 UseDiffViewer = YES;\r
2327                                                         else\r
2328                                                                 UseDiffViewer = NO;\r
2329 \r
2330                                                         strcpy(Remote, TmpPath);\r
2331                                                         SetYenTail(Remote);\r
2332                                                         // 環境依存の不具合対策\r
2333                                                         strcat(Remote, "file");\r
2334                                                         _mkdir(Remote);\r
2335                                                         SetYenTail(Remote);\r
2336                                                         if (UseDiffViewer == YES) {\r
2337                                                                 strcat(Remote, "remote.");\r
2338                                                         }\r
2339                                                         strcat(Remote, Tmp);\r
2340 \r
2341                                                         if(AskTransferNow() == YES)\r
2342                                                                 SktShareProh();\r
2343 \r
2344         //                                              MainTransPkt.ctrl_skt = AskCmdCtrlSkt();\r
2345                                                         strcpy(MainTransPkt.Cmd, "RETR ");\r
2346                                                         if(AskHostType() == HTYPE_ACOS)\r
2347                                                         {\r
2348                                                                 strcpy(MainTransPkt.RemoteFile, "'");\r
2349                                                                 strcat(MainTransPkt.RemoteFile, AskHostLsName());\r
2350                                                                 strcat(MainTransPkt.RemoteFile, "(");\r
2351                                                                 strcat(MainTransPkt.RemoteFile, Tmp);\r
2352                                                                 strcat(MainTransPkt.RemoteFile, ")");\r
2353                                                                 strcat(MainTransPkt.RemoteFile, "'");\r
2354                                                         }\r
2355                                                         else if(AskHostType() == HTYPE_ACOS_4)\r
2356                                                         {\r
2357                                                                 strcpy(MainTransPkt.RemoteFile, Tmp);\r
2358                                                         }\r
2359                                                         else\r
2360                                                         {\r
2361                                                                 strcpy(MainTransPkt.RemoteFile, Tmp);\r
2362                                                         }\r
2363                                                         strcpy(MainTransPkt.LocalFile, Remote);\r
2364                                                         MainTransPkt.Type = AskTransferTypeAssoc(MainTransPkt.RemoteFile, AskTransferType());\r
2365                                                         MainTransPkt.Size = 1;\r
2366                                                         MainTransPkt.KanjiCode = AskHostKanjiCode();\r
2367                                                         MainTransPkt.KanjiCodeDesired = AskLocalKanjiCode();\r
2368                                                         MainTransPkt.KanaCnv = AskHostKanaCnv();\r
2369                                                         MainTransPkt.Mode = EXIST_OVW;\r
2370                                                         MainTransPkt.ExistSize = 0;\r
2371                                                         MainTransPkt.hWndTrans = NULL;\r
2372                                                         MainTransPkt.Next = NULL;\r
2373 \r
2374                                                         DisableUserOpe();\r
2375 \r
2376                                                         /* 不正なパスを検出 */\r
2377                                                         if(CheckPathViolation(&MainTransPkt) == NO)\r
2378                                                         {\r
2379 //                                                              if((Sts = DoDownload(AskCmdCtrlSkt(), &MainTransPkt, NO)) == 429)\r
2380 //                                                              {\r
2381 //                                                                      ReConnectCmdSkt();\r
2382                                                                         // 同時接続対応\r
2383                                                                         CancelFlg = NO;\r
2384                                                                         Sts = DoDownload(AskCmdCtrlSkt(), &MainTransPkt, NO, &CancelFlg);\r
2385 //                                                              }\r
2386                                                         }\r
2387 \r
2388                                                         EnableUserOpe();\r
2389 \r
2390                                                         AddTempFileList(Remote);\r
2391                                                         if(Sts/100 == FTP_COMPLETE) {\r
2392                                                                 if (UseDiffViewer == YES) {\r
2393                                                                         AskLocalCurDir(Local, FMAX_PATH);\r
2394                                                                         ReplaceAll(Local, '/', '\\');\r
2395                                                                         SetYenTail(Local);\r
2396                                                                         strcat(Local, Tmp);\r
2397                                                                         ExecViewer2(Local, Remote, App);\r
2398                                                                 } else {\r
2399                                                                         ExecViewer(Remote, App);\r
2400                                                                 }\r
2401                                                         }\r
2402                                                 }\r
2403                                                 else\r
2404                                                         PostMessage(hWndFtp, WM_COMMAND, MAKEWPARAM(MENU_DOWNLOAD, 0), 0);\r
2405                                         }\r
2406                                         else\r
2407                                                 ChangeDir(WIN_REMOTE, Tmp);\r
2408                                 }\r
2409                         }\r
2410                 }\r
2411                 MakeButtonsFocus();\r
2412         }\r
2413         return;\r
2414 }\r
2415 \r
2416 \r
2417 /*----- フォルダの移動 --------------------------------------------------------\r
2418 *\r
2419 *       Parameter\r
2420 *               int Win : ウインドウ番号 (WIN_xxx)\r
2421 *               char *Path : 移動先のパス名\r
2422 *\r
2423 *       Return Value\r
2424 *               なし\r
2425 *\r
2426 *       Note\r
2427 *               フォルダ同時移動の処理も行う\r
2428 *----------------------------------------------------------------------------*/\r
2429 \r
2430 static void ChangeDir(int Win, char *Path)\r
2431 {\r
2432         int Sync;\r
2433         char Local[FMAX_PATH+1];\r
2434         char Remote[FMAX_PATH+1];\r
2435 \r
2436         // 同時接続対応\r
2437         CancelFlg = NO;\r
2438 \r
2439         // デッドロック対策\r
2440         DisableUserOpe();\r
2441         Sync = AskSyncMoveMode();\r
2442         if(Sync == YES)\r
2443         {\r
2444                 if(strcmp(Path, "..") == 0)\r
2445                 {\r
2446                         AskLocalCurDir(Local, FMAX_PATH);\r
2447                         AskRemoteCurDir(Remote, FMAX_PATH);\r
2448                         if(strcmp(GetFileName(Local), GetFileName(Remote)) != 0)\r
2449                                 Sync = NO;\r
2450                 }\r
2451         }\r
2452 \r
2453         if((Win == WIN_LOCAL) || (Sync == YES))\r
2454         {\r
2455                 if(DoLocalCWD(Path) == FFFTP_SUCCESS)\r
2456                         GetLocalDirForWnd();\r
2457         }\r
2458 \r
2459         if((Win == WIN_REMOTE) || (Sync == YES))\r
2460         {\r
2461                 if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
2462                 {\r
2463 #if defined(HAVE_OPENVMS)\r
2464                         /* OpenVMSの場合、".DIR;?"を取る */\r
2465                         if (AskHostType() == HTYPE_VMS)\r
2466                                 ReformVMSDirName(Path, TRUE);\r
2467 #endif\r
2468                         if(DoCWD(Path, YES, NO, YES) < FTP_RETRY)\r
2469                                 GetRemoteDirForWnd(CACHE_NORMAL, &CancelFlg);\r
2470                 }\r
2471         }\r
2472         // デッドロック対策\r
2473         EnableUserOpe();\r
2474         return;\r
2475 }\r
2476 \r
2477 \r
2478 /*----- ウインドウのサイズ変更の処理 ------------------------------------------\r
2479 *\r
2480 *       Parameter\r
2481 *               なし\r
2482 *\r
2483 *       Return Value\r
2484 *               なし\r
2485 *----------------------------------------------------------------------------*/\r
2486 \r
2487 static void ResizeWindowProc(void)\r
2488 {\r
2489 #if 0\r
2490         RECT Rect;\r
2491         int RemotePosX;\r
2492 \r
2493         GetClientRect(hWndFtp, &Rect);\r
2494         SendMessage(GetSbarWnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(Rect.right, Rect.bottom));\r
2495 \r
2496         CalcWinSize();\r
2497         SetWindowPos(GetMainTbarWnd(), 0, 0, 0, WinWidth, TOOLWIN_HEIGHT, SWP_NOACTIVATE | SWP_NOZORDER);\r
2498 \r
2499         SetWindowPos(GetLocalTbarWnd(), 0, 0, TOOLWIN_HEIGHT, LocalWidth, TOOLWIN_HEIGHT, SWP_NOACTIVATE | SWP_NOZORDER);\r
2500         SendMessage(GetLocalTbarWnd(), TB_GETITEMRECT, 3, (LPARAM)&Rect);\r
2501         SetWindowPos(GetLocalHistHwnd(), 0, Rect.right, Rect.top, LocalWidth - Rect.right, 200, SWP_NOACTIVATE | SWP_NOZORDER);\r
2502         SetWindowPos(GetLocalHwnd(), 0, 0, TOOLWIN_HEIGHT*2, LocalWidth, ListHeight, SWP_NOACTIVATE | SWP_NOZORDER);\r
2503 \r
2504         RemotePosX = LocalWidth + SepaWidth;\r
2505         if(SplitVertical == YES)\r
2506                 RemotePosX = 0;\r
2507 \r
2508         SetWindowPos(GetRemoteTbarWnd(), 0, RemotePosX, TOOLWIN_HEIGHT, RemoteWidth, TOOLWIN_HEIGHT, SWP_NOACTIVATE | SWP_NOZORDER);\r
2509         SendMessage(GetRemoteTbarWnd(), TB_GETITEMRECT, 3, (LPARAM)&Rect);\r
2510         SetWindowPos(GetRemoteHistHwnd(), 0, Rect.right, Rect.top, RemoteWidth - Rect.right, 200, SWP_NOACTIVATE | SWP_NOZORDER);\r
2511         SetWindowPos(GetRemoteHwnd(), 0, RemotePosX, TOOLWIN_HEIGHT*2, RemoteWidth, ListHeight, SWP_NOACTIVATE | SWP_NOZORDER);\r
2512 \r
2513         SetWindowPos(GetTaskWnd(), 0, 0, TOOLWIN_HEIGHT*2+ListHeight+SepaWidth, ClientWidth, TaskHeight, SWP_NOACTIVATE | SWP_NOZORDER);\r
2514 #else\r
2515         RECT Rect;\r
2516 \r
2517         GetClientRect(hWndFtp, &Rect);\r
2518         SendMessage(GetSbarWnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(Rect.right, Rect.bottom));\r
2519 \r
2520         CalcWinSize();\r
2521         SetWindowPos(GetMainTbarWnd(), 0, 0, 0, Rect.right, TOOLWIN_HEIGHT, SWP_NOACTIVATE | SWP_NOZORDER);\r
2522         SetWindowPos(GetLocalTbarWnd(), 0, 0, TOOLWIN_HEIGHT, LocalWidth, TOOLWIN_HEIGHT, SWP_NOACTIVATE | SWP_NOZORDER);\r
2523         SetWindowPos(GetRemoteTbarWnd(), 0, LocalWidth + SepaWidth, TOOLWIN_HEIGHT, RemoteWidth, TOOLWIN_HEIGHT, SWP_NOACTIVATE | SWP_NOZORDER);\r
2524         SendMessage(GetLocalTbarWnd(), TB_GETITEMRECT, 3, (LPARAM)&Rect);\r
2525         SetWindowPos(GetLocalHistHwnd(), 0, Rect.right, Rect.top, LocalWidth - Rect.right, 200, SWP_NOACTIVATE | SWP_NOZORDER);\r
2526         SendMessage(GetRemoteTbarWnd(), TB_GETITEMRECT, 3, (LPARAM)&Rect);\r
2527         SetWindowPos(GetRemoteHistHwnd(), 0, Rect.right, Rect.top, RemoteWidth - Rect.right, 200, SWP_NOACTIVATE | SWP_NOZORDER);\r
2528         SetWindowPos(GetLocalHwnd(), 0, 0, TOOLWIN_HEIGHT*2, LocalWidth, ListHeight, SWP_NOACTIVATE | SWP_NOZORDER);\r
2529         SetWindowPos(GetRemoteHwnd(), 0, LocalWidth + SepaWidth, TOOLWIN_HEIGHT*2, RemoteWidth, ListHeight, SWP_NOACTIVATE | SWP_NOZORDER);\r
2530         SetWindowPos(GetTaskWnd(), 0, 0, TOOLWIN_HEIGHT*2+ListHeight+SepaWidth, ClientWidth, TaskHeight, SWP_NOACTIVATE | SWP_NOZORDER);\r
2531 #endif\r
2532 \r
2533         return;\r
2534 }\r
2535 \r
2536 \r
2537 /*----- ウインドウの各部分のサイズを計算する ----------------------------------\r
2538 *\r
2539 *       Parameter\r
2540 *               なし\r
2541 *\r
2542 *       Return Value\r
2543 *               なし\r
2544 *----------------------------------------------------------------------------*/\r
2545 \r
2546 static void CalcWinSize(void)\r
2547 {\r
2548         RECT Rect;\r
2549 \r
2550         GetWindowRect(hWndFtp, &Rect);\r
2551 \r
2552         if(Sizing != SW_MAXIMIZE)\r
2553         {\r
2554                 WinWidth = Rect.right - Rect.left;\r
2555                 WinHeight = Rect.bottom - Rect.top;\r
2556         }\r
2557 \r
2558         GetClientRect(hWndFtp, &Rect);\r
2559 \r
2560         ClientWidth = Rect.right;\r
2561         ClientHeight = Rect.bottom;\r
2562 \r
2563         SepaWidth = 4;\r
2564         LocalWidth = max1(0, min1(LocalWidth, ClientWidth - SepaWidth));\r
2565         RemoteWidth = max1(0, ClientWidth - LocalWidth - SepaWidth);\r
2566 //      TaskHeight = min1(TaskHeight, max1(0, ClientHeight - TOOLWIN_HEIGHT * 2 - SepaWidth));\r
2567 \r
2568         GetClientRect(GetSbarWnd(), &Rect);\r
2569 \r
2570         ListHeight = max1(0, ClientHeight - TOOLWIN_HEIGHT * 2 - TaskHeight - SepaWidth - Rect.bottom);\r
2571 \r
2572         return;\r
2573 }\r
2574 \r
2575 \r
2576 #if 0\r
2577 /*----- ウインドウの表示位置を取得する ----------------------------------------\r
2578 *\r
2579 *       Parameter\r
2580 *               HWND hWnd : ウインドウハンドル\r
2581 *\r
2582 *       Return Value\r
2583 *               なし\r
2584 *----------------------------------------------------------------------------*/\r
2585 \r
2586 static void AskWindowPos(HWND hWnd)\r
2587 {\r
2588         WINDOWPLACEMENT WinPlace;\r
2589 \r
2590         WinPlace.length = sizeof(WINDOWPLACEMENT);\r
2591         GetWindowPlacement(hWnd, &WinPlace);\r
2592         WinPosX = WinPlace.rcNormalPosition.left;\r
2593         WinPosY = WinPlace.rcNormalPosition.top;\r
2594 \r
2595         return;\r
2596 }\r
2597 #endif\r
2598 \r
2599 \r
2600 /*----- ディレクトリリストとファイルリストの境界変更処理 ----------------------\r
2601 *\r
2602 *       Parameter\r
2603 *               WPARAM Keys : WM_MOUSEMOVEなどのWPARAMの値\r
2604 *               int x : マウスカーソルのX座標\r
2605 *               int y : マウスカーソルのY座標\r
2606 *\r
2607 *       Return Value\r
2608 *               なし\r
2609 *----------------------------------------------------------------------------*/\r
2610 \r
2611 static void CheckResizeFrame(WPARAM Keys, int x, int y)\r
2612 {\r
2613         RECT Rect;\r
2614         RECT Rect1;\r
2615 \r
2616         if((Resizing == RESIZE_OFF) && (Keys == 0))\r
2617         {\r
2618                 if((x >= LocalWidth) && (x <= LocalWidth + SepaWidth) &&\r
2619                    (y > TOOLWIN_HEIGHT) && (y < (TOOLWIN_HEIGHT * 2 + ListHeight)))\r
2620                 {\r
2621                         /* 境界位置変更用カーソルに変更 */\r
2622                         SetCapture(hWndFtp);\r
2623                         hCursor = LoadCursor(hInstFtp, MAKEINTRESOURCE(resize_lr_csr));\r
2624                         SetCursor(hCursor);\r
2625                         Resizing = RESIZE_PREPARE;\r
2626                         ResizePos = RESIZE_HPOS;\r
2627                 }\r
2628                 else if((y >= TOOLWIN_HEIGHT*2+ListHeight) && (y <= TOOLWIN_HEIGHT*2+ListHeight+SepaWidth))\r
2629                 {\r
2630                         /* 境界位置変更用カーソルに変更 */\r
2631                         SetCapture(hWndFtp);\r
2632                         hCursor = LoadCursor(hInstFtp, MAKEINTRESOURCE(resize_ud_csr));\r
2633                         SetCursor(hCursor);\r
2634                         Resizing = RESIZE_PREPARE;\r
2635                         ResizePos = RESIZE_VPOS;\r
2636                 }\r
2637         }\r
2638         else if(Resizing == RESIZE_PREPARE)\r
2639         {\r
2640                 if(Keys & MK_LBUTTON)\r
2641                 {\r
2642                         /* 境界位置変更開始 */\r
2643                         Resizing = RESIZE_ON;\r
2644                         GetWindowRect(hWndFtp, &Rect);\r
2645                         GetClientRect(GetSbarWnd(), &Rect1);\r
2646                         Rect.left += GetSystemMetrics(SM_CXFRAME);\r
2647                         Rect.right -= GetSystemMetrics(SM_CXFRAME);\r
2648                         Rect.top += TOOLWIN_HEIGHT*2 + GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME);\r
2649                         Rect.bottom -= GetSystemMetrics(SM_CYFRAME) + Rect1.bottom;\r
2650                         ClipCursor(&Rect);\r
2651                 }\r
2652                 else\r
2653                 {\r
2654                         if(((ResizePos == RESIZE_HPOS) &&\r
2655                                 ((x < LocalWidth) || (x > LocalWidth + SepaWidth) ||\r
2656                                  (y <= TOOLWIN_HEIGHT) || (y >= (TOOLWIN_HEIGHT * 2 + ListHeight)))) ||\r
2657                            ((ResizePos == RESIZE_VPOS) &&\r
2658                                 ((y < TOOLWIN_HEIGHT*2+ListHeight) || (y > TOOLWIN_HEIGHT*2+ListHeight+SepaWidth))))\r
2659                         {\r
2660                                 /* 元のカーソルに戻す */\r
2661                                 ReleaseCapture();\r
2662                                 hCursor = LoadCursor(NULL, IDC_ARROW);\r
2663                                 SetCursor(hCursor);\r
2664                                 Resizing = RESIZE_OFF;\r
2665                         }\r
2666                 }\r
2667         }\r
2668         else if(Resizing == RESIZE_ON)\r
2669         {\r
2670                 if(ResizePos == RESIZE_HPOS)\r
2671                         LocalWidth = x;\r
2672                 else\r
2673                 {\r
2674                         GetClientRect(hWndFtp, &Rect);\r
2675                         GetClientRect(GetSbarWnd(), &Rect1);\r
2676                         TaskHeight = max1(0, Rect.bottom - y - Rect1.bottom);\r
2677                 }\r
2678                 ResizeWindowProc();\r
2679 \r
2680                 if((Keys & MK_LBUTTON) == 0)\r
2681                 {\r
2682                         /* 境界位置変更終了 */\r
2683                         ReleaseCapture();\r
2684                         ClipCursor(NULL);\r
2685                         hCursor = LoadCursor(NULL, IDC_ARROW);\r
2686                         SetCursor(hCursor);\r
2687                         Resizing = RESIZE_OFF;\r
2688                 }\r
2689         }\r
2690         return;\r
2691 }\r
2692 \r
2693 \r
2694 /*----- ファイル一覧情報をビューワで表示 --------------------------------------\r