OSDN Git Service

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