OSDN Git Service

Enlarge buffers for replies on transferring files.
[ffftp/ffftp.git] / toolmenu.c
index a9d56f1..217e2c9 100644 (file)
@@ -28,6 +28,8 @@
 /============================================================================*/\r
 \r
 #define  STRICT\r
+// IPv6対応\r
+#include <winsock2.h>\r
 #include <windows.h>\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
@@ -37,7 +39,8 @@
 #include <windowsx.h>\r
 #include <commctrl.h>\r
 #include <stdarg.h>\r
-#include <winsock.h>\r
+// IPv6対応\r
+//#include <winsock.h>\r
 \r
 #include "common.h"\r
 #include "resource.h"\r
@@ -140,11 +143,13 @@ static TBBUTTON TbarDataMain[] = {
        { 20, MENU_L_KNJ_EUC, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
        { 21, MENU_L_KNJ_JIS, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
        { 28, MENU_L_KNJ_UTF8N, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
+       { 29, MENU_L_KNJ_UTF8BOM, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
        { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
        { 27, MENU_KNJ_SJIS, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
        { 20, MENU_KNJ_EUC, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
        { 21, MENU_KNJ_JIS, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
        { 28, MENU_KNJ_UTF8N, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
+       { 29, MENU_KNJ_UTF8BOM, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
        { 22, MENU_KNJ_NONE, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
        { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
        { 23, MENU_KANACNV, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0 },\r
@@ -195,8 +200,8 @@ static const int HideMenus[] = {
        MENU_HELP,                      MENU_HELP_TROUBLE,      MENU_ABOUT,\r
        MENU_REGINIT,\r
        MENU_TEXT,                      MENU_BINARY,            MENU_AUTO,\r
-       MENU_KNJ_SJIS,          MENU_KNJ_EUC,           MENU_KNJ_JIS,           MENU_KNJ_UTF8N,         MENU_KNJ_NONE,\r
-       MENU_L_KNJ_SJIS,        MENU_L_KNJ_EUC,         MENU_L_KNJ_JIS,         MENU_L_KNJ_UTF8N,\r
+       MENU_KNJ_SJIS,          MENU_KNJ_EUC,           MENU_KNJ_JIS,           MENU_KNJ_UTF8N,         MENU_KNJ_UTF8BOM,       MENU_KNJ_NONE,\r
+       MENU_L_KNJ_SJIS,        MENU_L_KNJ_EUC,         MENU_L_KNJ_JIS,         MENU_L_KNJ_UTF8N,       MENU_L_KNJ_UTF8BOM,\r
        MENU_KANACNV,\r
        MENU_LOCAL_UPDIR,       MENU_LOCAL_CHDIR,\r
        MENU_REMOTE_UPDIR,      MENU_REMOTE_CHDIR,\r
@@ -247,7 +252,9 @@ int MakeToolBarWindow(HWND hWnd, HINSTANCE hInst)
        if(hWndTbarMain != NULL)\r
        {\r
                /* 2007/09/21 sunasunamix  ここから *********************/\r
-               pOldTbarMainProc = (WNDPROC)SetWindowLong(hWndTbarMain, GWL_WNDPROC, (DWORD)CountermeasureTbarMainProc);\r
+               // 64ビット対応\r
+//             pOldTbarMainProc = (WNDPROC)SetWindowLong(hWndTbarMain, GWL_WNDPROC, (DWORD)CountermeasureTbarMainProc);\r
+               pOldTbarMainProc = (WNDPROC)SetWindowLongPtr(hWndTbarMain, GWLP_WNDPROC, (LONG_PTR)CountermeasureTbarMainProc);\r
                /********************************************* ここまで */\r
 \r
                GetClientRect(hWnd, &Rect1);\r
@@ -272,7 +279,9 @@ int MakeToolBarWindow(HWND hWnd, HINSTANCE hInst)
        if(hWndTbarLocal != NULL)\r
        {\r
                /* 2007/09/21 sunasunamix  ここから *********************/\r
-               pOldTbarLocalProc = (WNDPROC)SetWindowLong(hWndTbarLocal, GWL_WNDPROC, (DWORD)CountermeasureTbarLocalProc);\r
+               // 64ビット対応\r
+//             pOldTbarLocalProc = (WNDPROC)SetWindowLong(hWndTbarLocal, GWL_WNDPROC, (DWORD)CountermeasureTbarLocalProc);\r
+               pOldTbarLocalProc = (WNDPROC)SetWindowLongPtr(hWndTbarLocal, GWLP_WNDPROC, (LONG_PTR)CountermeasureTbarLocalProc);\r
                /********************************************* ここまで */\r
 \r
                MoveWindow(hWndTbarLocal, 0, TOOLWIN_HEIGHT, LocalWidth, TOOLWIN_HEIGHT, FALSE);\r
@@ -297,7 +306,9 @@ int MakeToolBarWindow(HWND hWnd, HINSTANCE hInst)
                        /* エディットコントロールを探す */\r
                        hWndDirLocalEdit = GetWindow(hWndDirLocal, GW_CHILD);\r
                        if(hWndDirLocalEdit != NULL)\r
-                               HistEditBoxProcPtr = (WNDPROC)SetWindowLong(hWndDirLocalEdit, GWL_WNDPROC, (LONG)HistEditBoxWndProc);\r
+                               // 64ビット対応\r
+//                             HistEditBoxProcPtr = (WNDPROC)SetWindowLong(hWndDirLocalEdit, GWL_WNDPROC, (LONG)HistEditBoxWndProc);\r
+                               HistEditBoxProcPtr = (WNDPROC)SetWindowLongPtr(hWndDirLocalEdit, GWLP_WNDPROC, (LONG_PTR)HistEditBoxWndProc);\r
 \r
                        SendMessage(hWndDirLocal, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE, 0));\r
                        SendMessage(hWndDirLocal, CB_LIMITTEXT, FMAX_PATH, 0);\r
@@ -335,7 +346,9 @@ int MakeToolBarWindow(HWND hWnd, HINSTANCE hInst)
        if(hWndTbarRemote != NULL)\r
        {\r
                /* 2007/09/21 sunasunamix  ここから *********************/\r
-               pOldTbarRemoteProc = (WNDPROC)SetWindowLong(hWndTbarRemote, GWL_WNDPROC, (DWORD)CountermeasureTbarRemoteProc);\r
+               // 64ビット対応\r
+//             pOldTbarRemoteProc = (WNDPROC)SetWindowLong(hWndTbarRemote, GWL_WNDPROC, (DWORD)CountermeasureTbarRemoteProc);\r
+               pOldTbarRemoteProc = (WNDPROC)SetWindowLongPtr(hWndTbarRemote, GWLP_WNDPROC, (LONG_PTR)CountermeasureTbarRemoteProc);\r
                /********************************************* ここまで */\r
 \r
                MoveWindow(hWndTbarRemote, LocalWidth + SepaWidth, TOOLWIN_HEIGHT, RemoteWidth, TOOLWIN_HEIGHT, FALSE);\r
@@ -354,7 +367,9 @@ int MakeToolBarWindow(HWND hWnd, HINSTANCE hInst)
                        /* エディットコントロールを探す */\r
                        hWndDirRemoteEdit = GetWindow(hWndDirRemote, GW_CHILD);\r
                        if(hWndDirRemoteEdit != NULL)\r
-                               HistEditBoxProcPtr = (WNDPROC)SetWindowLong(hWndDirRemoteEdit, GWL_WNDPROC, (LONG)HistEditBoxWndProc);\r
+                               // 64ビット対応\r
+//                             HistEditBoxProcPtr = (WNDPROC)SetWindowLong(hWndDirRemoteEdit, GWL_WNDPROC, (LONG)HistEditBoxWndProc);\r
+                               HistEditBoxProcPtr = (WNDPROC)SetWindowLongPtr(hWndDirRemoteEdit, GWLP_WNDPROC, (LONG_PTR)HistEditBoxWndProc);\r
 \r
                        SendMessage(hWndDirRemote, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE, 0));\r
                        SendMessage(hWndDirRemote, CB_LIMITTEXT, FMAX_PATH, 0);\r
@@ -1028,6 +1043,10 @@ void SetHostKanjiCode(int Type)
                        TmpHostKanjiCode = KANJI_UTF8N;\r
                        break;\r
 \r
+               case MENU_KNJ_UTF8BOM :\r
+                       TmpHostKanjiCode = KANJI_UTF8BOM;\r
+                       break;\r
+\r
                default :\r
                        TmpHostKanjiCode = KANJI_NOCNV;\r
                        break;\r
@@ -1068,6 +1087,10 @@ void DispHostKanjiCode(void)
                        SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_UTF8N, MAKELONG(TRUE, 0));\r
                        break;\r
 \r
+               case KANJI_UTF8BOM :\r
+                       SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_UTF8BOM, MAKELONG(TRUE, 0));\r
+                       break;\r
+\r
                default :\r
                        SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_NONE, MAKELONG(TRUE, 0));\r
                        break;\r
@@ -1110,6 +1133,7 @@ void HideHostKanjiButton(void)
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_EUC, MAKELONG(FALSE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_JIS, MAKELONG(FALSE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8N, MAKELONG(FALSE, 0));\r
+                       SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8BOM, MAKELONG(FALSE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_NONE, MAKELONG(FALSE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));\r
                        break;\r
@@ -1119,6 +1143,7 @@ void HideHostKanjiButton(void)
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_EUC, MAKELONG(TRUE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_JIS, MAKELONG(TRUE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8N, MAKELONG(TRUE, 0));\r
+                       SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8BOM, MAKELONG(TRUE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_NONE, MAKELONG(TRUE, 0));\r
 //                     if(TmpHostKanjiCode != KANJI_NOCNV)\r
 //                             SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));\r
@@ -1179,6 +1204,10 @@ void SetLocalKanjiCode(int Type)
                case MENU_L_KNJ_UTF8N :\r
                        TmpLocalKanjiCode = KANJI_UTF8N;\r
                        break;\r
+\r
+               case MENU_L_KNJ_UTF8BOM :\r
+                       TmpLocalKanjiCode = KANJI_UTF8BOM;\r
+                       break;\r
        }\r
        DispLocalKanjiCode();\r
        HideLocalKanjiButton();\r
@@ -1205,6 +1234,10 @@ void DispLocalKanjiCode(void)
                case KANJI_UTF8N :\r
                        SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_UTF8N, MAKELONG(TRUE, 0));\r
                        break;\r
+\r
+               case KANJI_UTF8BOM :\r
+                       SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_UTF8BOM, MAKELONG(TRUE, 0));\r
+                       break;\r
        }\r
        return;\r
 }\r
@@ -1224,6 +1257,7 @@ void HideLocalKanjiButton(void)
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_EUC, MAKELONG(FALSE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_JIS, MAKELONG(FALSE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8N, MAKELONG(FALSE, 0));\r
+                       SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8BOM, MAKELONG(FALSE, 0));\r
                        break;\r
 \r
                default :\r
@@ -1231,6 +1265,7 @@ void HideLocalKanjiButton(void)
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_EUC, MAKELONG(TRUE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_JIS, MAKELONG(TRUE, 0));\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8N, MAKELONG(TRUE, 0));\r
+                       SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8BOM, MAKELONG(TRUE, 0));\r
                        // 現在カナ変換はShift_JIS、JIS、EUC間でのみ機能する\r
                        SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));\r
                        switch(TmpHostKanjiCode)\r
@@ -1811,9 +1846,18 @@ void RemoteRbuttonMenu(int Pos)
                AppendMenu(hMenu, MF_STRING | Flg1, MENU_DOWNLOAD_ALL, MSGJPN266);\r
                AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_DELETE, MSGJPN267);\r
                AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_RENAME, MSGJPN268);\r
+#if defined(HAVE_TANDEM)\r
+               /* HP NonStop Server では CHMOD の仕様が異なるため使用不可 */\r
+               if (AskRealHostType() != HTYPE_TANDEM)\r
+#endif\r
                AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_CHMOD, MSGJPN269);\r
                AppendMenu(hMenu, MF_STRING | Flg1, MENU_MKDIR, MSGJPN270);\r
                AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_URL_COPY, MSGJPN271);\r
+#if defined(HAVE_TANDEM)\r
+               /* OSS モードのときに表示されるように AskRealHostType() を使用する */\r
+               if (AskRealHostType() == HTYPE_TANDEM)\r
+                       AppendMenu(hMenu, MF_STRING | Flg1, MENU_SWITCH_OSS, MSGJPN2001);\r
+#endif\r
                AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);\r
                AppendMenu(hMenu, MF_STRING | Flg1, MENU_FILESIZE, MSGJPN272);\r
                AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);\r
@@ -1874,7 +1918,9 @@ static LRESULT CALLBACK CountermeasureTbarMainProc(HWND hWnd,UINT uMessage,WPARA
 {\r
        switch (uMessage) {\r
        case WM_DESTROY :\r
-               SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarMainProc);\r
+               // 64ビット対応\r
+//             SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarMainProc);\r
+               SetWindowLongPtr(hWnd,GWLP_WNDPROC,(LONG_PTR)pOldTbarMainProc);\r
                break;\r
        case WM_RBUTTONDBLCLK :\r
        case WM_RBUTTONDOWN :\r
@@ -1891,7 +1937,9 @@ static LRESULT CALLBACK CountermeasureTbarLocalProc(HWND hWnd,UINT uMessage,WPAR
 {\r
        switch (uMessage) {\r
        case WM_DESTROY :\r
-               SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarLocalProc);\r
+               // 64ビット対応\r
+//             SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarLocalProc);\r
+               SetWindowLongPtr(hWnd,GWLP_WNDPROC,(LONG_PTR)pOldTbarLocalProc);\r
                break;\r
        case WM_RBUTTONDBLCLK :\r
        case WM_RBUTTONDOWN :\r
@@ -1908,7 +1956,9 @@ static LRESULT CALLBACK CountermeasureTbarRemoteProc(HWND hWnd,UINT uMessage,WPA
 {\r
        switch (uMessage) {\r
        case WM_DESTROY :\r
-               SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarRemoteProc);\r
+               // 64ビット対応\r
+//             SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarRemoteProc);\r
+               SetWindowLongPtr(hWnd,GWLP_WNDPROC,(LONG_PTR)pOldTbarRemoteProc);\r
                break;\r
        case WM_RBUTTONDBLCLK :\r
        case WM_RBUTTONDOWN :\r