OSDN Git Service

Fix bugs of automatic detection for Kanji code of filenames.
[ffftp/ffftp.git] / main.c
diff --git a/main.c b/main.c
index ad6e890..79d3709 100644 (file)
--- a/main.c
+++ b/main.c
@@ -135,12 +135,20 @@ HWND hHelpWin = NULL;
 /* 設定値 */\r
 int WinPosX = CW_USEDEFAULT;\r
 int WinPosY = 0;\r
-int WinWidth = 630;\r
-int WinHeight = 393;\r
-int LocalWidth = 309;\r
-int TaskHeight = 50;\r
-int LocalTabWidth[4] = { 120, 90, 60, 37 };\r
-int RemoteTabWidth[6] = { 120, 90, 60, 37, 60, 60 };\r
+// 機能が増えたためサイズ変更\r
+// VGAサイズに収まるようになっていたのをSVGAサイズに引き上げ\r
+//int WinWidth = 630;\r
+//int WinHeight = 393;\r
+//int LocalWidth = 309;\r
+//int TaskHeight = 50;\r
+//int LocalTabWidth[4] = { 120, 90, 60, 37 };\r
+//int RemoteTabWidth[6] = { 120, 90, 60, 37, 60, 60 };\r
+int WinWidth = 790;\r
+int WinHeight = 513;\r
+int LocalWidth = 389;\r
+int TaskHeight = 100;\r
+int LocalTabWidth[4] = { 160, 110, 60, 37 };\r
+int RemoteTabWidth[6] = { 160, 110, 60, 37, 60, 60 };\r
 char UserMailAdrs[USER_MAIL_LEN+1] = { "who@example.com" };\r
 char ViewerName[VIEWERS][FMAX_PATH+1] = { { "notepad" }, { "" }, { "" } };\r
 HFONT ListFont = NULL;\r
@@ -210,8 +218,6 @@ int MirUpDelNotify = YES;
 int MirDownDelNotify = YES; \r
 int FolderAttr = NO;\r
 int FolderAttrNum = 777;\r
-// 同時接続対応\r
-int MaxThreadCount = 1;\r
 // 暗号化通信対応\r
 BYTE CertificateCacheHash[MAX_CERT_CACHE_HASH][20];\r
 \r
@@ -504,7 +510,7 @@ static int InitApp(LPSTR lpszCmdLine, int cmdShow)
                                        DispWindowTitle();\r
                                        // SourceForge.JPによるフォーク\r
 //                                     SetTaskMsg("FFFTP Ver." VER_STR " Copyright(C) 1997-2010 Sota & cooperators.");\r
-                                       SetTaskMsg("FFFTP Ver." VER_STR " Copyright(C) 1997-2010 Sota & cooperators.\r\nCopyright (C) 2011 FFFTP Project (Hiromichi Matsushima, Suguru Kawamoto, IWAMOTO Kouichi, vitamin0x, unarist, raido).");\r
+                                       SetTaskMsg("FFFTP Ver." VER_STR " Copyright(C) 1997-2010 Sota & cooperators.\r\nCopyright (C) 2011 FFFTP Project (Hiromichi Matsushima, Suguru Kawamoto, IWAMOTO Kouichi, vitamin0x, unarist, Asami, fortran90, tomo1192).");\r
 \r
                                        if(ForceIni)\r
                                                SetTaskMsg("%s%s", MSGJPN283, IniPath);\r
@@ -832,6 +838,10 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
        switch (message)\r
        {\r
                case WM_COMMAND :\r
+                       // 同時接続対応\r
+                       // 中断後に受信バッファに応答が残っていると次のコマンドの応答が正しく処理できない\r
+                       if(CancelFlg == YES)\r
+                               RemoveReceivedData(AskCmdCtrlSkt());\r
                        switch(LOWORD(wParam))\r
                        {\r
                                case MENU_CONNECT :\r
@@ -1144,6 +1154,7 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
                                case MENU_KNJ_EUC :\r
                                case MENU_KNJ_JIS :\r
                                case MENU_KNJ_UTF8N :\r
+                               case MENU_KNJ_UTF8BOM :\r
                                case MENU_KNJ_NONE :\r
                                        SetHostKanjiCode(LOWORD(wParam));\r
                                        break;\r
@@ -1152,6 +1163,7 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
                                case MENU_L_KNJ_EUC :\r
                                case MENU_L_KNJ_JIS :\r
                                case MENU_L_KNJ_UTF8N :\r
+                               case MENU_L_KNJ_UTF8BOM :\r
                                        SetLocalKanjiCode(LOWORD(wParam));\r
                                        break;\r
 \r
@@ -1216,7 +1228,9 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
                                        break;\r
 \r
                                case MENU_HELP_TROUBLE :\r
-                                       ShellExecute(NULL, "open", MYWEB_URL, NULL, ".", SW_SHOW);\r
+                                       // 任意のコードが実行されるバグ修正\r
+//                                     ShellExecute(NULL, "open", MYWEB_URL, NULL, ".", SW_SHOW);\r
+                                       ShellExecute(NULL, "open", MYWEB_URL, NULL, NULL, SW_SHOW);\r
                                        break;\r
 \r
                                case MENU_BMARK_ADD :\r
@@ -1442,6 +1456,10 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
                                                        lpttt->lpszText = MSGJPN308;\r
                                                        break;\r
 \r
+                                               case MENU_KNJ_UTF8BOM :\r
+                                                       lpttt->lpszText = MSGJPN330;\r
+                                                       break;\r
+\r
                                                case MENU_KNJ_NONE :\r
                                                        lpttt->lpszText = MSGJPN173;\r
                                                        break;\r
@@ -1462,6 +1480,10 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
                                                        lpttt->lpszText = MSGJPN312;\r
                                                        break;\r
 \r
+                                               case MENU_L_KNJ_UTF8BOM :\r
+                                                       lpttt->lpszText = MSGJPN331;\r
+                                                       break;\r
+\r
                                                case MENU_KANACNV :\r
                                                        lpttt->lpszText = MSGJPN174;\r
                                                        break;\r
@@ -2147,6 +2169,11 @@ static void ChangeDir(int Win, char *Path)
        char Local[FMAX_PATH+1];\r
        char Remote[FMAX_PATH+1];\r
 \r
+       // 同時接続対応\r
+       CancelFlg = NO;\r
+\r
+       // デッドロック対策\r
+       DisableUserOpe();\r
        Sync = AskSyncMoveMode();\r
        if(Sync == YES)\r
        {\r
@@ -2178,6 +2205,8 @@ static void ChangeDir(int Win, char *Path)
                                GetRemoteDirForWnd(CACHE_NORMAL, &CancelFlg);\r
                }\r
        }\r
+       // デッドロック対策\r
+       EnableUserOpe();\r
        return;\r
 }\r
 \r
@@ -2444,7 +2473,10 @@ void ExecViewer(char *Fname, int App)
 \r
        AskLocalCurDir(CurDir, FMAX_PATH);\r
 \r
-       if((App == -1) && (FindExecutable(Fname, NULL, AssocProg) > (HINSTANCE)32))\r
+       // 任意のコードが実行されるバグ修正\r
+       // 拡張子が無いと補完されるため\r
+//     if((App == -1) && (FindExecutable(Fname, NULL, AssocProg) > (HINSTANCE)32))\r
+       if((App == -1) && strrchr(Fname, '.') > strrchr(Fname, '\\') && (FindExecutable(Fname, NULL, AssocProg) > (HINSTANCE)32))\r
        {\r
                DoPrintf("ShellExecute - %s", Fname);\r
                ShellExecute(NULL, "open", Fname, NULL, CurDir, SW_SHOW);\r