OSDN Git Service

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