OSDN Git Service

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