• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Loweynet


Commit MetaInfo

修訂dde921b07347803f285758b271dacfa456c4149a (tree)
時間2017-10-28 21:08:11
作者s_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Fix bugs of transfer routine.
Add codes for exporting host settings to WinSCP.

Change Summary

差異

Binary files a/FFFTP_Eng_Release/FFFTP.exe and b/FFFTP_Eng_Release/FFFTP.exe differ
Binary files a/FFFTP_Eng_Release_64/FFFTP.exe and b/FFFTP_Eng_Release_64/FFFTP.exe differ
--- /dev/null
+++ b/Package/make_update.bat
@@ -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Žž‚ɍĐڑ±‚Å‚«‚È‚¢ê‡‚ª‚ ‚éƒoƒO‚ðC³‚µ‚Ü‚µ‚½B\nØ’fŽž‚Ƀtƒ@ƒCƒ‹‚Ì“]‘—‘Ò‚¿‚ª‰ðœ‚³‚ê‚È‚¢ƒoƒO‚ðC³‚µ‚Ü‚µ‚½B\n“]‘—’†‚Ì‹­§I—¹‚ª‹@”\‚µ‚È‚¢ê‡‚ª‚ ‚éƒoƒO‚ðC³‚µ‚Ü‚µ‚½B\n“]‘—’†‚Ì‹­§I—¹‚ª‹@”\‚µ‚È‚¢ê‡‚ª‚ ‚éƒoƒO‚ðC³‚µ‚Ü‚µ‚½B\nŽóM’†Ž~‚ðƒNƒŠƒbƒN‚µ‚½Œã‚Ì‹““®‚ª‚¨‚©‚µ‚­‚È‚éƒoƒO‚ð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+
Binary files a/Release/FFFTP.exe and b/Release/FFFTP.exe differ
Binary files a/Release_64/FFFTP.exe and b/Release_64/FFFTP.exe differ
--- a/common.h
+++ b/common.h
@@ -72,16 +72,16 @@
7272 //#define PROGRAM_VERSION_NUM 1972 /* バージョン */
7373 // 64ビット対応
7474 #ifdef _WIN64
75-#define VER_STR "1.99a-20170924 64bit"
75+#define VER_STR "1.99a-20171028 64bit"
7676 #else
77-#define VER_STR "1.99a-20170924"
77+#define VER_STR "1.99a-20171028"
7878 #endif
7979 #define VER_NUM 1990 /* 設定バージョン */
8080 #define PROGRAM_VERSION_NUM 1990 /* バージョン */
8181 // ソフトウェア自動更新
8282 // リリースバージョンはリリース予定年(10進数4桁)+月(2桁)+日(2桁)+通し番号(0スタート2桁)とする
8383 // 2014年7月31日中の30個目のリリースは2014073129
84-#define RELEASE_VERSION_NUM 2017092400 /* リリースバージョン */
84+#define RELEASE_VERSION_NUM 2017102800 /* リリースバージョン */
8585
8686
8787 // SourceForge.JPによるフォーク
@@ -121,6 +121,9 @@
121121 #define WM_ADDPORTMAPPING (WM_USER+9)
122122 #define WM_REMOVEPORTMAPPING (WM_USER+10)
123123
124+// 同時接続対応
125+#define WM_RECONNECTSOCKET (WM_USER+11)
126+
124127 /*===== ホスト番号 =====*/
125128 /* ホスト番号は 0~ の値を取る */
126129
@@ -1698,6 +1701,7 @@ void ReformVMSDirName(char *DirName, int Flg);
16981701 void NoopProc(int Force);
16991702 // 同時接続対応
17001703 void AbortRecoveryProc(void);
1704+void ReconnectProc(void);
17011705
17021706 /*===== local.c =====*/
17031707
@@ -1759,6 +1763,8 @@ int ChangeFnameLocal2Remote(char *Fname, int Max);
17591763
17601764 int MakeTransferThread(void);
17611765 void CloseTransferThread(void);
1766+// 同時接続対応
1767+void AbortAllTransfer();
17621768 int AddTmpTransFileList(TRANSPACKET *Pkt, TRANSPACKET **Base);
17631769 void EraseTmpTransFileList(TRANSPACKET **Base);
17641770 int RemoveTmpTransFileListItem(TRANSPACKET **Base, int Num);
@@ -1865,6 +1871,8 @@ int IsIniAvailable();
18651871 int ReadSettingsVersion();
18661872 // FileZilla XML形式エクスポート対応
18671873 void SaveSettingsToFileZillaXml();
1874+// WinSCP INI形式エクスポート対応
1875+void SaveSettingsToWinSCPIni();
18681876
18691877 /*===== lvtips.c =====*/
18701878
--- a/connect.c
+++ b/connect.c
@@ -1208,10 +1208,17 @@ int ReConnectCmdSkt(void)
12081208 // if(CmdCtrlSocket != TrnCtrlSocket)
12091209 // do_closesocket(TrnCtrlSocket);
12101210 // TrnCtrlSocket = INVALID_SOCKET;
1211- if(CmdCtrlSocket == TrnCtrlSocket)
1212- TrnCtrlSocket = INVALID_SOCKET;
12131211
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+ }
12151222
12161223 // 同時接続対応
12171224 // TrnCtrlSocket = CmdCtrlSocket;
@@ -1427,6 +1434,9 @@ void DisconnectProc(void)
14271434
14281435 //SetTaskMsg("############### Disconnect Cmd=%x, Trn=%x", CmdCtrlSocket,TrnCtrlSocket);
14291436
1437+ // 同時接続対応
1438+ AbortAllTransfer();
1439+
14301440 if((CmdCtrlSocket != INVALID_SOCKET) && (CmdCtrlSocket != TrnCtrlSocket))
14311441 {
14321442 // 同時接続対応
--- a/ftpproc.c
+++ b/ftpproc.c
@@ -3882,9 +3882,9 @@ void NoopProc(int Force)
38823882 // 同時接続対応
38833883 void AbortRecoveryProc(void)
38843884 {
3885- CancelFlg = NO;
38863885 if(AskConnecting() == YES && AskUserOpeDisabled() == NO)
38873886 {
3887+ CancelFlg = NO;
38883888 if(AskReuseCmdSkt() == NO || AskShareProh() == YES || AskTransferNow() == NO)
38893889 {
38903890 if(AskErrorReconnect() == YES)
@@ -3901,3 +3901,16 @@ void AbortRecoveryProc(void)
39013901 return;
39023902 }
39033903
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+
--- a/getput.c
+++ b/getput.c
@@ -249,7 +249,8 @@ void CloseTransferThread(void)
249249 for(i = 0; i < MAX_DATA_CONNECTION; i++)
250250 Canceled[i] = YES;
251251 ClearAll = YES;
252- ForceAbort = YES;
252+ // 同時接続対応
253+// ForceAbort = YES;
253254
254255 fTransferThreadExit = TRUE;
255256 // 同時接続対応
@@ -279,6 +280,22 @@ void CloseTransferThread(void)
279280 }
280281
281282
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+
282299 /*----- 転送するファイル情報をリストに追加する --------------------------------
283300 *
284301 * Parameter
@@ -721,8 +738,6 @@ static ULONG WINAPI TransferThread(void *Dummy)
721738 static int Up;
722739 int DelNotify;
723740 int ThreadCount;
724- SOCKET CmdSkt;
725- SOCKET NewCmdSkt;
726741 SOCKET TrnSkt;
727742 RECT WndRect;
728743 int i;
@@ -738,8 +753,6 @@ static ULONG WINAPI TransferThread(void *Dummy)
738753 // 同時接続対応
739754 // ソケットは各転送スレッドが管理
740755 ThreadCount = (int)Dummy;
741- CmdSkt = INVALID_SOCKET;
742- NewCmdSkt = INVALID_SOCKET;
743756 TrnSkt = INVALID_SOCKET;
744757 LastError = NO;
745758 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST);
@@ -777,16 +790,29 @@ static ULONG WINAPI TransferThread(void *Dummy)
777790 if(TransPacketBase == NULL)
778791 GoExit = YES;
779792 }
780- NewCmdSkt = AskCmdCtrlSkt();
781793 if(AskReuseCmdSkt() == YES && ThreadCount == 0)
782794 {
783795 if(TransPacketBase && ThreadCount < AskMaxThreadCount())
784796 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+ }
785811 }
786812 else
787813 {
788814 // セッションあたりの転送量制限対策
789- if(AskErrorReconnect() == YES && LastError == YES)
815+ if(TrnSkt != INVALID_SOCKET && AskErrorReconnect() == YES && LastError == YES)
790816 {
791817 ReleaseMutex(hListAccMutex);
792818 DoQUIT(TrnSkt, &Canceled[ThreadCount]);
@@ -799,10 +825,10 @@ static ULONG WINAPI TransferThread(void *Dummy)
799825 Sleep(1);
800826 }
801827 }
802- if(TransPacketBase && NewCmdSkt != INVALID_SOCKET && ThreadCount < AskMaxThreadCount())
828+ if(TransPacketBase && AskConnecting() == YES && ThreadCount < AskMaxThreadCount())
803829 {
804830 ReleaseMutex(hListAccMutex);
805- if(TrnSkt == INVALID_SOCKET || NewCmdSkt != CmdSkt)
831+ if(TrnSkt == INVALID_SOCKET)
806832 ReConnectTrnSkt(&TrnSkt, &Canceled[ThreadCount]);
807833 else
808834 CheckClosedAndReconnectTrnSkt(&TrnSkt, &Canceled[ThreadCount]);
@@ -812,7 +838,7 @@ static ULONG WINAPI TransferThread(void *Dummy)
812838 // 同時ログイン数制限に引っかかった可能性あり
813839 // 負荷を下げるために約10秒間待機
814840 i = 1000;
815- while(NewCmdSkt != CmdSkt && i > 0)
841+ while(i > 0)
816842 {
817843 BackgrndMessageProc();
818844 Sleep(10);
@@ -833,7 +859,7 @@ static ULONG WINAPI TransferThread(void *Dummy)
833859 {
834860 // 同時ログイン数制限対策
835861 // 60秒間使用されなければログアウト
836- if(timeGetTime() - LastUsed > 60000 || NewCmdSkt == INVALID_SOCKET)
862+ if(timeGetTime() - LastUsed > 60000 || AskConnecting() == NO)
837863 {
838864 ReleaseMutex(hListAccMutex);
839865 DoQUIT(TrnSkt, &Canceled[ThreadCount]);
@@ -849,7 +875,6 @@ static ULONG WINAPI TransferThread(void *Dummy)
849875 }
850876 }
851877 }
852- CmdSkt = NewCmdSkt;
853878 LastError = NO;
854879 // if(TransPacketBase != NULL)
855880 if(TrnSkt != INVALID_SOCKET && NextTransPacketBase != NULL)
--- a/main.c
+++ b/main.c
@@ -2087,6 +2087,11 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
20872087 SetEvent(((REMOVEPORTMAPPINGDATA*)lParam)->h);
20882088 break;
20892089
2090+ // 同時接続対応
2091+ case WM_RECONNECTSOCKET :
2092+ ReconnectProc();
2093+ break;
2094+
20902095 case WM_PAINT :
20912096 BeginPaint(hWnd, (LPPAINTSTRUCT) &ps);
20922097 EndPaint(hWnd, (LPPAINTSTRUCT) &ps);
--- a/mesg-eng.h
+++ b/mesg-eng.h
@@ -363,6 +363,7 @@
363363 #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.")
364364 #define MSGJPN363 _Tu8("Your version is already up-to-date.", "Your version is already up-to-date.")
365365 #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.")
366367 #if defined(HAVE_TANDEM)
367368 #define MSGJPN2000 _Tu8("NonStop Server", "NonStop Server")
368369 #define MSGJPN2001 _Tu8("OSS<->GUARDIAN Switch(&O)", "OSS<->GUARDIAN Switch(&O)")
--- a/mesg-jpn.h
+++ b/mesg-jpn.h
@@ -363,6 +363,7 @@
363363 #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.")
364364 #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.")
365365 #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.")
366367 #if defined(HAVE_TANDEM)
367368 #define MSGJPN2000 _Tu8("NonStop Server", "NonStop Server")
368369 #define MSGJPN2001 _Tu8("OSS<->GUARDIAN 切り替え(&O)", "OSS<->GUARDIAN \xE5\x88\x87\xE3\x82\x8A\xE6\x9B\xBF\xE3\x81\x88(&O)")
--- a/registry.c
+++ b/registry.c
@@ -4032,3 +4032,283 @@ void SaveSettingsToFileZillaXml()
40324032 }
40334033 }
40344034
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+