OSDN Git Service

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