Loweynet
修訂 | dde921b07347803f285758b271dacfa456c4149a (tree) |
---|---|
時間 | 2017-10-28 21:08:11 |
作者 | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Fix bugs of transfer routine.
Add codes for exporting host settings to WinSCP.
@@ -0,0 +1,88 @@ | ||
1 | +REM; | |
2 | +REM; This is batch-file to prepare for creating FFFTP update. | |
3 | +REM; Please run in "ffftp\Package" directory. | |
4 | +REM; | |
5 | + | |
6 | +call installer_config.bat | |
7 | + | |
8 | +set PRIVATE_KEY=private.pem | |
9 | +set /p PRIVATE_KEY_PW=Password: | |
10 | +set PREFIX_JPN=update.jpn.file. | |
11 | +set PREFIX_ENG=update.eng.file. | |
12 | +set PREFIX_AMD64_JPN=update.amd64.jpn.file. | |
13 | +set PREFIX_AMD64_ENG=update.amd64.eng.file. | |
14 | +set DESC_JPN="]¸sÉÄÚ±Å«È¢êª éoOðC³µÜµ½B\nØfÉt@CÌ]Ò¿ªð³êÈ¢oOðC³µÜµ½B\n]̧I¹ª@\µÈ¢êª éoOðC³µÜµ½B\n]̧I¹ª@\µÈ¢êª éoOðC³µÜµ½B\nóM~ðNbNµ½ãÌ®ª¨©µÈéoOðC³µÜµ½B" | |
15 | +set DESC_ENG="Fixed bugs that sometimes it cannot reconnect after transfer failure.\nFixed bugs that the queue of file transfer is not released on disconnection.\nFixed bugs that sometimes Force Exit does not work while transfer.\nFixed bugs that the behavior is strange after clicking Stop button." | |
16 | +set DESC_AMD64_JPN=%DESC_JPN% | |
17 | +set DESC_AMD64_ENG=%DESC_ENG% | |
18 | + | |
19 | +set DIR_UPDATE=update | |
20 | +set DIR_ZIP_JPN=%DIR_UPDATE%\jpn\file | |
21 | +set DIR_ZIP_ENG=%DIR_UPDATE%\eng\file | |
22 | +set AMD64_DIR_ZIP_JPN=%DIR_UPDATE%\amd64\jpn\file | |
23 | +set AMD64_DIR_ZIP_ENG=%DIR_UPDATE%\amd64\eng\file | |
24 | + | |
25 | +REM; copy Japanese files | |
26 | +mkdir %DIR_ZIP_JPN% | |
27 | +copy /Y %BIN_JPN% %DIR_ZIP_JPN% | |
28 | +copy /Y %HTMLHELP% %DIR_ZIP_JPN% | |
29 | +copy /Y %DIR_JPN_DOC%\*.txt %DIR_ZIP_JPN% | |
30 | +copy /Y %DIR_DIST%\*.dll %DIR_ZIP_JPN% | |
31 | +copy /Y %DIR_DIST%\*.manifest %DIR_ZIP_JPN% | |
32 | +copy /Y %DIR_DIST%\*.pem %DIR_ZIP_JPN% | |
33 | + | |
34 | +REM; copy English files | |
35 | +mkdir %DIR_ZIP_ENG% | |
36 | +copy /Y %BIN_ENG% %DIR_ZIP_ENG% | |
37 | +copy /Y %DIR_ENG_DOC%\*.txt %DIR_ZIP_ENG% | |
38 | +copy /Y %DIR_DIST%\*.dll %DIR_ZIP_ENG% | |
39 | +copy /Y %DIR_DIST%\*.manifest %DIR_ZIP_ENG% | |
40 | +copy /Y %DIR_DIST%\*.pem %DIR_ZIP_ENG% | |
41 | + | |
42 | +REM; copy Japanese files | |
43 | +mkdir %AMD64_DIR_ZIP_JPN% | |
44 | +copy /Y %BIN_AMD64_JPN% %AMD64_DIR_ZIP_JPN% | |
45 | +copy /Y %HTMLHELP% %AMD64_DIR_ZIP_JPN% | |
46 | +copy /Y %DIR_JPN_DOC%\*.txt %AMD64_DIR_ZIP_JPN% | |
47 | +copy /Y %DIR_DIST%\amd64\*.dll %AMD64_DIR_ZIP_JPN% | |
48 | +copy /Y %DIR_DIST%\amd64\*.manifest %AMD64_DIR_ZIP_JPN% | |
49 | +copy /Y %DIR_DIST%\*.pem %AMD64_DIR_ZIP_JPN% | |
50 | + | |
51 | +REM; copy English files | |
52 | +mkdir %AMD64_DIR_ZIP_ENG% | |
53 | +copy /Y %BIN_AMD64_ENG% %AMD64_DIR_ZIP_ENG% | |
54 | +copy /Y %DIR_ENG_DOC%\*.txt %AMD64_DIR_ZIP_ENG% | |
55 | +copy /Y %DIR_DIST%\amd64\*.dll %AMD64_DIR_ZIP_ENG% | |
56 | +copy /Y %DIR_DIST%\amd64\*.manifest %AMD64_DIR_ZIP_ENG% | |
57 | +copy /Y %DIR_DIST%\*.pem %AMD64_DIR_ZIP_ENG% | |
58 | + | |
59 | +"%cd%\%DIR_ZIP_JPN%\FFFTP.exe" --build-software-update "%cd%\%PRIVATE_KEY%" "%PRIVATE_KEY_PW%" "/dl/ffftp/%PREFIX_JPN%" "%cd%\%DIR_UPDATE%\update.jpn.hash" "%cd%\%DIR_UPDATE%\update.jpn.list" %DESC_JPN% | |
60 | +"%cd%\%DIR_ZIP_ENG%\FFFTP.exe" --build-software-update "%cd%\%PRIVATE_KEY%" "%PRIVATE_KEY_PW%" "/dl/ffftp/%PREFIX_ENG%" "%cd%\%DIR_UPDATE%\update.eng.hash" "%cd%\%DIR_UPDATE%\update.eng.list" %DESC_ENG% | |
61 | +"%cd%\%AMD64_DIR_ZIP_JPN%\FFFTP.exe" --build-software-update "%cd%\%PRIVATE_KEY%" "%PRIVATE_KEY_PW%" "/dl/ffftp/%PREFIX_AMD64_JPN%" "%cd%\%DIR_UPDATE%\update.amd64.jpn.hash" "%cd%\%DIR_UPDATE%\update.amd64.jpn.list" %DESC_AMD64_JPN% | |
62 | +"%cd%\%AMD64_DIR_ZIP_ENG%\FFFTP.exe" --build-software-update "%cd%\%PRIVATE_KEY%" "%PRIVATE_KEY_PW%" "/dl/ffftp/%PREFIX_AMD64_ENG%" "%cd%\%DIR_UPDATE%\update.amd64.eng.hash" "%cd%\%DIR_UPDATE%\update.amd64.eng.list" %DESC_AMD64_ENG% | |
63 | + | |
64 | +pushd %DIR_ZIP_JPN% | |
65 | +for %%i in (*) do ren %%i %PREFIX_JPN%%%i | |
66 | +popd | |
67 | +pushd %DIR_ZIP_ENG% | |
68 | +for %%i in (*) do ren %%i %PREFIX_ENG%%%i | |
69 | +popd | |
70 | +pushd %AMD64_DIR_ZIP_JPN% | |
71 | +for %%i in (*) do ren %%i %PREFIX_AMD64_JPN%%%i | |
72 | +popd | |
73 | +pushd %AMD64_DIR_ZIP_ENG% | |
74 | +for %%i in (*) do ren %%i %PREFIX_AMD64_ENG%%%i | |
75 | +popd | |
76 | + | |
77 | +pushd %DIR_UPDATE% | |
78 | +for /d %%i in (*) do call :sub0 "%%~i" | |
79 | +popd | |
80 | +exit /b | |
81 | +:sub0 | |
82 | +pushd "%~1" | |
83 | +for /d %%i in (*) do call :sub0 "%%~i" | |
84 | +for %%i in (*) do move "%%~i" "..\%%~i" | |
85 | +popd | |
86 | +rd "%~1" | |
87 | +exit /b | |
88 | + |
@@ -72,16 +72,16 @@ | ||
72 | 72 | //#define PROGRAM_VERSION_NUM 1972 /* バージョン */ |
73 | 73 | // 64ビット対応 |
74 | 74 | #ifdef _WIN64 |
75 | -#define VER_STR "1.99a-20170924 64bit" | |
75 | +#define VER_STR "1.99a-20171028 64bit" | |
76 | 76 | #else |
77 | -#define VER_STR "1.99a-20170924" | |
77 | +#define VER_STR "1.99a-20171028" | |
78 | 78 | #endif |
79 | 79 | #define VER_NUM 1990 /* 設定バージョン */ |
80 | 80 | #define PROGRAM_VERSION_NUM 1990 /* バージョン */ |
81 | 81 | // ソフトウェア自動更新 |
82 | 82 | // リリースバージョンはリリース予定年(10進数4桁)+月(2桁)+日(2桁)+通し番号(0スタート2桁)とする |
83 | 83 | // 2014年7月31日中の30個目のリリースは2014073129 |
84 | -#define RELEASE_VERSION_NUM 2017092400 /* リリースバージョン */ | |
84 | +#define RELEASE_VERSION_NUM 2017102800 /* リリースバージョン */ | |
85 | 85 | |
86 | 86 | |
87 | 87 | // SourceForge.JPによるフォーク |
@@ -121,6 +121,9 @@ | ||
121 | 121 | #define WM_ADDPORTMAPPING (WM_USER+9) |
122 | 122 | #define WM_REMOVEPORTMAPPING (WM_USER+10) |
123 | 123 | |
124 | +// 同時接続対応 | |
125 | +#define WM_RECONNECTSOCKET (WM_USER+11) | |
126 | + | |
124 | 127 | /*===== ホスト番号 =====*/ |
125 | 128 | /* ホスト番号は 0~ の値を取る */ |
126 | 129 |
@@ -1698,6 +1701,7 @@ void ReformVMSDirName(char *DirName, int Flg); | ||
1698 | 1701 | void NoopProc(int Force); |
1699 | 1702 | // 同時接続対応 |
1700 | 1703 | void AbortRecoveryProc(void); |
1704 | +void ReconnectProc(void); | |
1701 | 1705 | |
1702 | 1706 | /*===== local.c =====*/ |
1703 | 1707 |
@@ -1759,6 +1763,8 @@ int ChangeFnameLocal2Remote(char *Fname, int Max); | ||
1759 | 1763 | |
1760 | 1764 | int MakeTransferThread(void); |
1761 | 1765 | void CloseTransferThread(void); |
1766 | +// 同時接続対応 | |
1767 | +void AbortAllTransfer(); | |
1762 | 1768 | int AddTmpTransFileList(TRANSPACKET *Pkt, TRANSPACKET **Base); |
1763 | 1769 | void EraseTmpTransFileList(TRANSPACKET **Base); |
1764 | 1770 | int RemoveTmpTransFileListItem(TRANSPACKET **Base, int Num); |
@@ -1865,6 +1871,8 @@ int IsIniAvailable(); | ||
1865 | 1871 | int ReadSettingsVersion(); |
1866 | 1872 | // FileZilla XML形式エクスポート対応 |
1867 | 1873 | void SaveSettingsToFileZillaXml(); |
1874 | +// WinSCP INI形式エクスポート対応 | |
1875 | +void SaveSettingsToWinSCPIni(); | |
1868 | 1876 | |
1869 | 1877 | /*===== lvtips.c =====*/ |
1870 | 1878 |
@@ -1208,10 +1208,17 @@ int ReConnectCmdSkt(void) | ||
1208 | 1208 | // if(CmdCtrlSocket != TrnCtrlSocket) |
1209 | 1209 | // do_closesocket(TrnCtrlSocket); |
1210 | 1210 | // TrnCtrlSocket = INVALID_SOCKET; |
1211 | - if(CmdCtrlSocket == TrnCtrlSocket) | |
1212 | - TrnCtrlSocket = INVALID_SOCKET; | |
1213 | 1211 | |
1214 | - Sts = ReConnectSkt(&CmdCtrlSocket); | |
1212 | + // 同時接続対応 | |
1213 | +// Sts = ReConnectSkt(&CmdCtrlSocket); | |
1214 | + if(AskShareProh() == YES && AskTransferNow() == YES) | |
1215 | + SktShareProh(); | |
1216 | + else | |
1217 | + { | |
1218 | + if(CmdCtrlSocket == TrnCtrlSocket) | |
1219 | + TrnCtrlSocket = INVALID_SOCKET; | |
1220 | + Sts = ReConnectSkt(&CmdCtrlSocket); | |
1221 | + } | |
1215 | 1222 | |
1216 | 1223 | // 同時接続対応 |
1217 | 1224 | // TrnCtrlSocket = CmdCtrlSocket; |
@@ -1427,6 +1434,9 @@ void DisconnectProc(void) | ||
1427 | 1434 | |
1428 | 1435 | //SetTaskMsg("############### Disconnect Cmd=%x, Trn=%x", CmdCtrlSocket,TrnCtrlSocket); |
1429 | 1436 | |
1437 | + // 同時接続対応 | |
1438 | + AbortAllTransfer(); | |
1439 | + | |
1430 | 1440 | if((CmdCtrlSocket != INVALID_SOCKET) && (CmdCtrlSocket != TrnCtrlSocket)) |
1431 | 1441 | { |
1432 | 1442 | // 同時接続対応 |
@@ -3882,9 +3882,9 @@ void NoopProc(int Force) | ||
3882 | 3882 | // 同時接続対応 |
3883 | 3883 | void AbortRecoveryProc(void) |
3884 | 3884 | { |
3885 | - CancelFlg = NO; | |
3886 | 3885 | if(AskConnecting() == YES && AskUserOpeDisabled() == NO) |
3887 | 3886 | { |
3887 | + CancelFlg = NO; | |
3888 | 3888 | if(AskReuseCmdSkt() == NO || AskShareProh() == YES || AskTransferNow() == NO) |
3889 | 3889 | { |
3890 | 3890 | if(AskErrorReconnect() == YES) |
@@ -3901,3 +3901,16 @@ void AbortRecoveryProc(void) | ||
3901 | 3901 | return; |
3902 | 3902 | } |
3903 | 3903 | |
3904 | +void ReconnectProc(void) | |
3905 | +{ | |
3906 | + if(AskConnecting() == YES && AskUserOpeDisabled() == NO) | |
3907 | + { | |
3908 | + CancelFlg = NO; | |
3909 | + DisableUserOpe(); | |
3910 | + ReConnectCmdSkt(); | |
3911 | + GetRemoteDirForWnd(CACHE_REFRESH, &CancelFlg); | |
3912 | + EnableUserOpe(); | |
3913 | + } | |
3914 | + return; | |
3915 | +} | |
3916 | + |
@@ -249,7 +249,8 @@ void CloseTransferThread(void) | ||
249 | 249 | for(i = 0; i < MAX_DATA_CONNECTION; i++) |
250 | 250 | Canceled[i] = YES; |
251 | 251 | ClearAll = YES; |
252 | - ForceAbort = YES; | |
252 | + // 同時接続対応 | |
253 | +// ForceAbort = YES; | |
253 | 254 | |
254 | 255 | fTransferThreadExit = TRUE; |
255 | 256 | // 同時接続対応 |
@@ -279,6 +280,22 @@ void CloseTransferThread(void) | ||
279 | 280 | } |
280 | 281 | |
281 | 282 | |
283 | +// 同時接続対応 | |
284 | +void AbortAllTransfer() | |
285 | +{ | |
286 | + int i; | |
287 | + while(TransPacketBase != NULL) | |
288 | + { | |
289 | + for(i = 0; i < MAX_DATA_CONNECTION; i++) | |
290 | + Canceled[i] = YES; | |
291 | + ClearAll = YES; | |
292 | + if(BackgrndMessageProc() == YES) | |
293 | + break; | |
294 | + Sleep(10); | |
295 | + } | |
296 | + ClearAll = NO; | |
297 | +} | |
298 | + | |
282 | 299 | /*----- 転送するファイル情報をリストに追加する -------------------------------- |
283 | 300 | * |
284 | 301 | * Parameter |
@@ -721,8 +738,6 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
721 | 738 | static int Up; |
722 | 739 | int DelNotify; |
723 | 740 | int ThreadCount; |
724 | - SOCKET CmdSkt; | |
725 | - SOCKET NewCmdSkt; | |
726 | 741 | SOCKET TrnSkt; |
727 | 742 | RECT WndRect; |
728 | 743 | int i; |
@@ -738,8 +753,6 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
738 | 753 | // 同時接続対応 |
739 | 754 | // ソケットは各転送スレッドが管理 |
740 | 755 | ThreadCount = (int)Dummy; |
741 | - CmdSkt = INVALID_SOCKET; | |
742 | - NewCmdSkt = INVALID_SOCKET; | |
743 | 756 | TrnSkt = INVALID_SOCKET; |
744 | 757 | LastError = NO; |
745 | 758 | SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST); |
@@ -777,16 +790,29 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
777 | 790 | if(TransPacketBase == NULL) |
778 | 791 | GoExit = YES; |
779 | 792 | } |
780 | - NewCmdSkt = AskCmdCtrlSkt(); | |
781 | 793 | if(AskReuseCmdSkt() == YES && ThreadCount == 0) |
782 | 794 | { |
783 | 795 | if(TransPacketBase && ThreadCount < AskMaxThreadCount()) |
784 | 796 | TrnSkt = AskTrnCtrlSkt(); |
797 | + // セッションあたりの転送量制限対策 | |
798 | + if(TrnSkt != INVALID_SOCKET && AskErrorReconnect() == YES && LastError == YES) | |
799 | + { | |
800 | + ReleaseMutex(hListAccMutex); | |
801 | + PostMessage(GetMainHwnd(), WM_RECONNECTSOCKET, 0, 0); | |
802 | + Sleep(100); | |
803 | + TrnSkt = INVALID_SOCKET; | |
804 | +// WaitForSingleObject(hListAccMutex, INFINITE); | |
805 | + while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT) | |
806 | + { | |
807 | + BackgrndMessageProc(); | |
808 | + Sleep(1); | |
809 | + } | |
810 | + } | |
785 | 811 | } |
786 | 812 | else |
787 | 813 | { |
788 | 814 | // セッションあたりの転送量制限対策 |
789 | - if(AskErrorReconnect() == YES && LastError == YES) | |
815 | + if(TrnSkt != INVALID_SOCKET && AskErrorReconnect() == YES && LastError == YES) | |
790 | 816 | { |
791 | 817 | ReleaseMutex(hListAccMutex); |
792 | 818 | DoQUIT(TrnSkt, &Canceled[ThreadCount]); |
@@ -799,10 +825,10 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
799 | 825 | Sleep(1); |
800 | 826 | } |
801 | 827 | } |
802 | - if(TransPacketBase && NewCmdSkt != INVALID_SOCKET && ThreadCount < AskMaxThreadCount()) | |
828 | + if(TransPacketBase && AskConnecting() == YES && ThreadCount < AskMaxThreadCount()) | |
803 | 829 | { |
804 | 830 | ReleaseMutex(hListAccMutex); |
805 | - if(TrnSkt == INVALID_SOCKET || NewCmdSkt != CmdSkt) | |
831 | + if(TrnSkt == INVALID_SOCKET) | |
806 | 832 | ReConnectTrnSkt(&TrnSkt, &Canceled[ThreadCount]); |
807 | 833 | else |
808 | 834 | CheckClosedAndReconnectTrnSkt(&TrnSkt, &Canceled[ThreadCount]); |
@@ -812,7 +838,7 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
812 | 838 | // 同時ログイン数制限に引っかかった可能性あり |
813 | 839 | // 負荷を下げるために約10秒間待機 |
814 | 840 | i = 1000; |
815 | - while(NewCmdSkt != CmdSkt && i > 0) | |
841 | + while(i > 0) | |
816 | 842 | { |
817 | 843 | BackgrndMessageProc(); |
818 | 844 | Sleep(10); |
@@ -833,7 +859,7 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
833 | 859 | { |
834 | 860 | // 同時ログイン数制限対策 |
835 | 861 | // 60秒間使用されなければログアウト |
836 | - if(timeGetTime() - LastUsed > 60000 || NewCmdSkt == INVALID_SOCKET) | |
862 | + if(timeGetTime() - LastUsed > 60000 || AskConnecting() == NO) | |
837 | 863 | { |
838 | 864 | ReleaseMutex(hListAccMutex); |
839 | 865 | DoQUIT(TrnSkt, &Canceled[ThreadCount]); |
@@ -849,7 +875,6 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
849 | 875 | } |
850 | 876 | } |
851 | 877 | } |
852 | - CmdSkt = NewCmdSkt; | |
853 | 878 | LastError = NO; |
854 | 879 | // if(TransPacketBase != NULL) |
855 | 880 | if(TrnSkt != INVALID_SOCKET && NextTransPacketBase != NULL) |
@@ -2087,6 +2087,11 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA | ||
2087 | 2087 | SetEvent(((REMOVEPORTMAPPINGDATA*)lParam)->h); |
2088 | 2088 | break; |
2089 | 2089 | |
2090 | + // 同時接続対応 | |
2091 | + case WM_RECONNECTSOCKET : | |
2092 | + ReconnectProc(); | |
2093 | + break; | |
2094 | + | |
2090 | 2095 | case WM_PAINT : |
2091 | 2096 | BeginPaint(hWnd, (LPPAINTSTRUCT) &ps); |
2092 | 2097 | EndPaint(hWnd, (LPPAINTSTRUCT) &ps); |
@@ -363,6 +363,7 @@ | ||
363 | 363 | #define MSGJPN362 _Tu8("Failed to update the software.\nCannot connect to the server or the data is corrupted.", "Failed to update the software.\nCannot connect to the server or the data is corrupted.") |
364 | 364 | #define MSGJPN363 _Tu8("Your version is already up-to-date.", "Your version is already up-to-date.") |
365 | 365 | #define MSGJPN364 _Tu8("Preparing for the software update has been completed.\nIt will be applied on exit.", "Preparing for the software update has been completed.\nIt will be applied on exit.") |
366 | +#define MSGJPN365 _Tu8("The all settings will be lost after loading an INI file newly created with this feature into WinSCP.\nPlease choose an existing WinSCP.ini if you already use WinSCP and want to migrate hosts settings only.", "The all settings will be lost after loading an INI file newly created with this feature into WinSCP.\nPlease choose an existing WinSCP.ini if you already use WinSCP and want to migrate hosts settings only.") | |
366 | 367 | #if defined(HAVE_TANDEM) |
367 | 368 | #define MSGJPN2000 _Tu8("NonStop Server", "NonStop Server") |
368 | 369 | #define MSGJPN2001 _Tu8("OSS<->GUARDIAN Switch(&O)", "OSS<->GUARDIAN Switch(&O)") |
@@ -363,6 +363,7 @@ | ||
363 | 363 | #define MSGJPN362 _Tu8("ソフトウェアの更新に失敗しました.\nサーバーに接続できないかデータが破損しています.", "\xE3\x82\xBD\xE3\x83\x95\xE3\x83\x88\xE3\x82\xA6\xE3\x82\xA7\xE3\x82\xA2\xE3\x81\xAE\xE6\x9B\xB4\xE6\x96\xB0\xE3\x81\xAB\xE5\xA4\xB1\xE6\x95\x97\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x97\xE3\x81\x9F.\n\xE3\x82\xB5\xE3\x83\xBC\xE3\x83\x90\xE3\x83\xBC\xE3\x81\xAB\xE6\x8E\xA5\xE7\xB6\x9A\xE3\x81\xA7\xE3\x81\x8D\xE3\x81\xAA\xE3\x81\x84\xE3\x81\x8B\xE3\x83\x87\xE3\x83\xBC\xE3\x82\xBF\xE3\x81\x8C\xE7\xA0\xB4\xE6\x90\x8D\xE3\x81\x97\xE3\x81\xA6\xE3\x81\x84\xE3\x81\xBE\xE3\x81\x99.") |
364 | 364 | #define MSGJPN363 _Tu8("お使いのバージョンはすでに最新です.", "\xE3\x81\x8A\xE4\xBD\xBF\xE3\x81\x84\xE3\x81\xAE\xE3\x83\x90\xE3\x83\xBC\xE3\x82\xB8\xE3\x83\xA7\xE3\x83\xB3\xE3\x81\xAF\xE3\x81\x99\xE3\x81\xA7\xE3\x81\xAB\xE6\x9C\x80\xE6\x96\xB0\xE3\x81\xA7\xE3\x81\x99.") |
365 | 365 | #define MSGJPN364 _Tu8("ソフトウェアの更新の準備が完了しました.\nFFFTPの終了時に更新が適用されます.", "\xE3\x82\xBD\xE3\x83\x95\xE3\x83\x88\xE3\x82\xA6\xE3\x82\xA7\xE3\x82\xA2\xE3\x81\xAE\xE6\x9B\xB4\xE6\x96\xB0\xE3\x81\xAE\xE6\xBA\x96\xE5\x82\x99\xE3\x81\x8C\xE5\xAE\x8C\xE4\xBA\x86\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x97\xE3\x81\x9F.\nFFFTP\xE3\x81\xAE\xE7\xB5\x82\xE4\xBA\x86\xE6\x99\x82\xE3\x81\xAB\xE6\x9B\xB4\xE6\x96\xB0\xE3\x81\x8C\xE9\x81\xA9\xE7\x94\xA8\xE3\x81\x95\xE3\x82\x8C\xE3\x81\xBE\xE3\x81\x99.") |
366 | +#define MSGJPN365 _Tu8("この機能で新規作成したINIファイルをWinSCPで読み込むと全ての設定が失われます.\nすでにWinSCPをお使いでありホストの設定のみ移行したい場合は既存のWinSCP.iniを選択してください.", "\xE3\x81\x93\xE3\x81\xAE\xE6\xA9\x9F\xE8\x83\xBD\xE3\x81\xA7\xE6\x96\xB0\xE8\xA6\x8F\xE4\xBD\x9C\xE6\x88\x90\xE3\x81\x97\xE3\x81\x9FINI\xE3\x83\x95\xE3\x82\xA1\xE3\x82\xA4\xE3\x83\xAB\xE3\x82\x92WinSCP\xE3\x81\xA7\xE8\xAA\xAD\xE3\x81\xBF\xE8\xBE\xBC\xE3\x82\x80\xE3\x81\xA8\xE5\x85\xA8\xE3\x81\xA6\xE3\x81\xAE\xE8\xA8\xAD\xE5\xAE\x9A\xE3\x81\x8C\xE5\xA4\xB1\xE3\x82\x8F\xE3\x82\x8C\xE3\x81\xBE\xE3\x81\x99.\n\xE3\x81\x99\xE3\x81\xA7\xE3\x81\xABWinSCP\xE3\x82\x92\xE3\x81\x8A\xE4\xBD\xBF\xE3\x81\x84\xE3\x81\xA7\xE3\x81\x82\xE3\x82\x8A\xE3\x83\x9B\xE3\x82\xB9\xE3\x83\x88\xE3\x81\xAE\xE8\xA8\xAD\xE5\xAE\x9A\xE3\x81\xAE\xE3\x81\xBF\xE7\xA7\xBB\xE8\xA1\x8C\xE3\x81\x97\xE3\x81\x9F\xE3\x81\x84\xE5\xA0\xB4\xE5\x90\x88\xE3\x81\xAF\xE6\x97\xA2\xE5\xAD\x98\xE3\x81\xAEWinSCP.ini\xE3\x82\x92\xE9\x81\xB8\xE6\x8A\x9E\xE3\x81\x97\xE3\x81\xA6\xE3\x81\x8F\xE3\x81\xA0\xE3\x81\x95\xE3\x81\x84.") | |
366 | 367 | #if defined(HAVE_TANDEM) |
367 | 368 | #define MSGJPN2000 _Tu8("NonStop Server", "NonStop Server") |
368 | 369 | #define MSGJPN2001 _Tu8("OSS<->GUARDIAN 切り替え(&O)", "OSS<->GUARDIAN \xE5\x88\x87\xE3\x82\x8A\xE6\x9B\xBF\xE3\x81\x88(&O)") |
@@ -4032,3 +4032,283 @@ void SaveSettingsToFileZillaXml() | ||
4032 | 4032 | } |
4033 | 4033 | } |
4034 | 4034 | |
4035 | +// WinSCP INI形式エクスポート対応 | |
4036 | +void WriteWinSCPString(FILE* f, const char* s) | |
4037 | +{ | |
4038 | + const char* p; | |
4039 | + p = s; | |
4040 | + while(*p != '\0') | |
4041 | + { | |
4042 | + if(*p & 0x80) | |
4043 | + { | |
4044 | + p = NULL; | |
4045 | + break; | |
4046 | + } | |
4047 | + p++; | |
4048 | + } | |
4049 | + if(!p) | |
4050 | + fputs("%EF%BB%BF", f); | |
4051 | + while(*s != '\0') | |
4052 | + { | |
4053 | + switch(*s) | |
4054 | + { | |
4055 | + case '\t': | |
4056 | + case '\n': | |
4057 | + case '\r': | |
4058 | + case ' ': | |
4059 | + case '%': | |
4060 | + case '*': | |
4061 | + case '?': | |
4062 | + case '\\': | |
4063 | + fprintf(f, "%%%02X", *s & 0xff); | |
4064 | + break; | |
4065 | + default: | |
4066 | + if(*s & 0x80) | |
4067 | + fprintf(f, "%%%02X", *s & 0xff); | |
4068 | + else | |
4069 | + fputc(*s, f); | |
4070 | + break; | |
4071 | + } | |
4072 | + s++; | |
4073 | + } | |
4074 | +} | |
4075 | + | |
4076 | +void WriteWinSCPPassword(FILE* f, const char* UserName, const char* HostName, const char* Password) | |
4077 | +{ | |
4078 | + char Tmp[256]; | |
4079 | + strcpy(Tmp, UserName); | |
4080 | + strcat(Tmp, HostName); | |
4081 | + strcat(Tmp, Password); | |
4082 | + fprintf(f, "%02X", ~(0xff ^ 0xa3) & 0xff); | |
4083 | + fprintf(f, "%02X", ~(0x00 ^ 0xa3) & 0xff); | |
4084 | + fprintf(f, "%02X", ~((unsigned char)strlen(Tmp) ^ 0xa3) & 0xff); | |
4085 | + fprintf(f, "%02X", ~(0x00 ^ 0xa3) & 0xff); | |
4086 | + Password = Tmp; | |
4087 | + while(*Password != '\0') | |
4088 | + { | |
4089 | + fprintf(f, "%02X", ~(*Password ^ 0xa3) & 0xff); | |
4090 | + Password++; | |
4091 | + } | |
4092 | +} | |
4093 | + | |
4094 | +void SaveSettingsToWinSCPIni() | |
4095 | +{ | |
4096 | + char Fname[FMAX_PATH+1]; | |
4097 | + FILE* f; | |
4098 | + TIME_ZONE_INFORMATION tzi; | |
4099 | + char HostPath[FMAX_PATH+1]; | |
4100 | + int Level; | |
4101 | + int i; | |
4102 | + HOSTDATA Host; | |
4103 | + char Tmp[FMAX_PATH+1]; | |
4104 | + char* p1; | |
4105 | + MessageBox(GetMainHwnd(), MSGJPN365, "FFFTP", MB_OK); | |
4106 | + strcpy(Fname, "WinSCP.ini"); | |
4107 | + if(SelectFile(GetMainHwnd(), Fname, MSGJPN286, MSGJPN288, "ini", OFN_EXTENSIONDIFFERENT | OFN_OVERWRITEPROMPT, 1) == TRUE) | |
4108 | + { | |
4109 | + if((f = fopen(Fname, "at")) != NULL) | |
4110 | + { | |
4111 | + GetTimeZoneInformation(&tzi); | |
4112 | + strcpy(HostPath, ""); | |
4113 | + Level = 0; | |
4114 | + i = 0; | |
4115 | + while(CopyHostFromList(i, &Host) == FFFTP_SUCCESS) | |
4116 | + { | |
4117 | + while((Host.Level & SET_LEVEL_MASK) < Level) | |
4118 | + { | |
4119 | + if((p1 = strrchr(HostPath, '/')) != NULL) | |
4120 | + *p1 = '\0'; | |
4121 | + if((p1 = strrchr(HostPath, '/')) != NULL) | |
4122 | + p1++; | |
4123 | + else | |
4124 | + p1 = HostPath; | |
4125 | + *p1 = '\0'; | |
4126 | + Level--; | |
4127 | + } | |
4128 | + if(Host.Level & SET_LEVEL_GROUP) | |
4129 | + { | |
4130 | + strcat(HostPath, Host.HostName); | |
4131 | + strcat(HostPath, "/"); | |
4132 | + Level++; | |
4133 | + } | |
4134 | + else | |
4135 | + { | |
4136 | + fputs("[Sessions\\", f); | |
4137 | + strcpy(Tmp, HostPath); | |
4138 | + strcat(Tmp, Host.HostName); | |
4139 | + WriteWinSCPString(f, Tmp); | |
4140 | + fputs("]\n", f); | |
4141 | + fputs("HostName=", f); | |
4142 | + WriteWinSCPString(f, Host.HostAdrs); | |
4143 | + fputs("\n", f); | |
4144 | + fprintf(f, "PortNumber=%d\n", Host.Port); | |
4145 | + switch(Host.NetType) | |
4146 | + { | |
4147 | + case NTYPE_AUTO: | |
4148 | + break; | |
4149 | + case NTYPE_IPV4: | |
4150 | + fprintf(f, "AddressFamily=%s\n", "1"); | |
4151 | + break; | |
4152 | + case NTYPE_IPV6: | |
4153 | + fprintf(f, "AddressFamily=%s\n", "2"); | |
4154 | + break; | |
4155 | + default: | |
4156 | + break; | |
4157 | + } | |
4158 | + fputs("UserName=", f); | |
4159 | + WriteWinSCPString(f, Host.UserName); | |
4160 | + fputs("\n", f); | |
4161 | + fprintf(f, "FSProtocol=%s\n", "5"); | |
4162 | + fputs("LocalDirectory=", f); | |
4163 | + WriteWinSCPString(f, Host.LocalInitDir); | |
4164 | + fputs("\n", f); | |
4165 | + fputs("RemoteDirectory=", f); | |
4166 | + WriteWinSCPString(f, Host.RemoteInitDir); | |
4167 | + fputs("\n", f); | |
4168 | + if(Host.SyncMove == YES) | |
4169 | + fprintf(f, "SynchronizeBrowsing=%s\n", "1"); | |
4170 | + else | |
4171 | + fprintf(f, "SynchronizeBrowsing=%s\n", "0"); | |
4172 | + fputs("PostLoginCommands=", f); | |
4173 | + WriteWinSCPString(f, Host.InitCmd); | |
4174 | + fputs("\n", f); | |
4175 | + if(Host.FireWall == YES) | |
4176 | + { | |
4177 | + switch(FwallType) | |
4178 | + { | |
4179 | + case FWALL_NONE: | |
4180 | + break; | |
4181 | + case FWALL_FU_FP_SITE: | |
4182 | + break; | |
4183 | + case FWALL_FU_FP_USER: | |
4184 | + break; | |
4185 | + case FWALL_USER: | |
4186 | + break; | |
4187 | + case FWALL_OPEN: | |
4188 | + break; | |
4189 | + case FWALL_SOCKS4: | |
4190 | + fprintf(f, "ProxyMethod=%s\n", "1"); | |
4191 | + break; | |
4192 | + case FWALL_SOCKS5_NOAUTH: | |
4193 | + break; | |
4194 | + case FWALL_SOCKS5_USER: | |
4195 | + fprintf(f, "ProxyMethod=%s\n", "2"); | |
4196 | + break; | |
4197 | + case FWALL_FU_FP: | |
4198 | + break; | |
4199 | + case FWALL_SIDEWINDER: | |
4200 | + break; | |
4201 | + default: | |
4202 | + break; | |
4203 | + } | |
4204 | + fputs("ProxyHost=", f); | |
4205 | + WriteWinSCPString(f, FwallHost); | |
4206 | + fputs("\n", f); | |
4207 | + fprintf(f, "ProxyPort=%d\n", FwallPort); | |
4208 | + fputs("ProxyUsername=", f); | |
4209 | + WriteWinSCPString(f, FwallUser); | |
4210 | + fputs("\n", f); | |
4211 | + } | |
4212 | + switch(Host.NameKanjiCode) | |
4213 | + { | |
4214 | + case KANJI_SJIS: | |
4215 | + fprintf(f, "Utf=%s\n", "0"); | |
4216 | + break; | |
4217 | + case KANJI_JIS: | |
4218 | + // 非対応 | |
4219 | + break; | |
4220 | + case KANJI_EUC: | |
4221 | + // 非対応 | |
4222 | + break; | |
4223 | + case KANJI_SMB_HEX: | |
4224 | + // 非対応 | |
4225 | + break; | |
4226 | + case KANJI_SMB_CAP: | |
4227 | + // 非対応 | |
4228 | + break; | |
4229 | + case KANJI_UTF8N: | |
4230 | + fprintf(f, "Utf=%s\n", "1"); | |
4231 | + break; | |
4232 | + case KANJI_UTF8HFSX: | |
4233 | + // 非対応 | |
4234 | + break; | |
4235 | + default: | |
4236 | + break; | |
4237 | + } | |
4238 | + if(Host.Pasv == YES) | |
4239 | + fprintf(f, "FtpPasvMode=%s\n", "1"); | |
4240 | + else | |
4241 | + fprintf(f, "FtpPasvMode=%s\n", "0"); | |
4242 | + if(Host.ListCmdOnly == YES && Host.UseMLSD == NO) | |
4243 | + fprintf(f, "FtpUseMlsd=%s\n", "0"); | |
4244 | + fputs("FtpAccount=", f); | |
4245 | + WriteWinSCPString(f, Host.Account); | |
4246 | + fputs("\n", f); | |
4247 | + if(Host.NoopInterval > 0) | |
4248 | + fprintf(f, "FtpPingInterval=%d\n", Host.NoopInterval); | |
4249 | + else | |
4250 | + fprintf(f, "FtpPingType=%s\n", "0"); | |
4251 | + if(Host.UseNoEncryption == YES) | |
4252 | + fprintf(f, "Ftps=%s\n", "0"); | |
4253 | + else if(Host.UseFTPES == YES) | |
4254 | + fprintf(f, "Ftps=%s\n", "3"); | |
4255 | + else if(Host.UseFTPIS == YES) | |
4256 | + fprintf(f, "Ftps=%s\n", "1"); | |
4257 | + else | |
4258 | + fprintf(f, "Ftps=%s\n", "0"); | |
4259 | + if(Host.FireWall == YES) | |
4260 | + { | |
4261 | + switch(FwallType) | |
4262 | + { | |
4263 | + case FWALL_NONE: | |
4264 | + break; | |
4265 | + case FWALL_FU_FP_SITE: | |
4266 | + fprintf(f, "FtpProxyLogonType=%s\n", "1"); | |
4267 | + break; | |
4268 | + case FWALL_FU_FP_USER: | |
4269 | + fprintf(f, "FtpProxyLogonType=%s\n", "2"); | |
4270 | + break; | |
4271 | + case FWALL_USER: | |
4272 | + fprintf(f, "FtpProxyLogonType=%s\n", "5"); | |
4273 | + break; | |
4274 | + case FWALL_OPEN: | |
4275 | + fprintf(f, "FtpProxyLogonType=%s\n", "3"); | |
4276 | + break; | |
4277 | + case FWALL_SOCKS4: | |
4278 | + break; | |
4279 | + case FWALL_SOCKS5_NOAUTH: | |
4280 | + break; | |
4281 | + case FWALL_SOCKS5_USER: | |
4282 | + break; | |
4283 | + case FWALL_FU_FP: | |
4284 | + break; | |
4285 | + case FWALL_SIDEWINDER: | |
4286 | + break; | |
4287 | + default: | |
4288 | + break; | |
4289 | + } | |
4290 | + } | |
4291 | + if(Host.NoWeakEncryption == YES) | |
4292 | + fprintf(f, "MinTlsVersion=%s\n", "10"); | |
4293 | + else | |
4294 | + fprintf(f, "MinTlsVersion=%s\n", "3"); | |
4295 | + fputs("Password=", f); | |
4296 | + WriteWinSCPPassword(f, Host.UserName, Host.HostAdrs, Host.PassWord); | |
4297 | + fputs("\n", f); | |
4298 | + if(Host.FireWall == YES) | |
4299 | + { | |
4300 | + fputs("ProxyPasswordEnc=", f); | |
4301 | + WriteWinSCPPassword(f, FwallUser, FwallHost, FwallPass); | |
4302 | + fputs("\n", f); | |
4303 | + } | |
4304 | + fputs("\n", f); | |
4305 | + } | |
4306 | + i++; | |
4307 | + } | |
4308 | + fclose(f); | |
4309 | + } | |
4310 | + else | |
4311 | + MessageBox(GetMainHwnd(), MSGJPN357, "FFFTP", MB_OK | MB_ICONERROR); | |
4312 | + } | |
4313 | +} | |
4314 | + |