• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

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

FFFTPのソースコードです。


コミットメタ情報

リビジョン97d837ae7875002eed1b1a6993f51e3eaf0933d5 (tree)
日時2018-01-01 16:59:31
作者s_kawamoto <s_kawamoto@user...>
コミッターs_kawamoto

ログメッセージ

Add options to add Zone Identifier to downloaded files.

変更サマリ

差分

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
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/Resource/FFFTP.rc
+++ b/Resource/FFFTP.rc
@@ -1461,6 +1461,7 @@ BEGIN
14611461 CONTROL "EUC",TRMODE4_EUC_CNV,"Button",BS_AUTORADIOBUTTON,12,45,41,10
14621462 CONTROL "UTF-8",TRMODE4_UTF8N_CNV,"Button",BS_AUTORADIOBUTTON,12,57,41,10
14631463 CONTROL "UTF-8 BOM",TRMODE4_UTF8BOM_CNV,"Button",BS_AUTORADIOBUTTON,12,69,81,10
1464+ CONTROL "インターネットから入手したものとしてファイルに情報を付加する(&I)",TRMODE4_MARK_INTERNET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,96,196,10
14641465 END
14651466
14661467 opt_disp2_dlg DIALOG 0, 0, 211, 155
--- a/Resource/resource.h
+++ b/Resource/resource.h
@@ -474,6 +474,7 @@
474474 #define TRMODE_LISTERROR 1228
475475 #define MIRROR_NO_TRANSFER 1229
476476 #define HSET_NO_PASV_ADRS 1230
477+#define TRMODE4_MARK_INTERNET 1231
477478 #define MENU_END 40001
478479 #define MENU_EXIT 40001
479480 #define MENU_CONNECT 40003
@@ -667,7 +668,7 @@
667668 #ifndef APSTUDIO_READONLY_SYMBOLS
668669 #define _APS_NEXT_RESOURCE_VALUE 200
669670 #define _APS_NEXT_COMMAND_VALUE 40183
670-#define _APS_NEXT_CONTROL_VALUE 1231
671+#define _APS_NEXT_CONTROL_VALUE 1232
671672 #define _APS_NEXT_SYMED_VALUE 101
672673 #endif
673674 #endif
--- a/Resource_eng/ffftp.rc
+++ b/Resource_eng/ffftp.rc
@@ -1502,6 +1502,7 @@ BEGIN
15021502 CONTROL "EUC",TRMODE4_EUC_CNV,"Button",BS_AUTORADIOBUTTON,12,45,41,10
15031503 CONTROL "UTF-8",TRMODE4_UTF8N_CNV,"Button",BS_AUTORADIOBUTTON,12,57,41,10
15041504 CONTROL "UTF-8 BOM",TRMODE4_UTF8BOM_CNV,"Button",BS_AUTORADIOBUTTON,12,69,81,10
1505+ CONTROL "Add information to files as obtained from the &Internet",TRMODE4_MARK_INTERNET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,96,196,10
15051506 END
15061507
15071508 opt_disp2_dlg DIALOG 0, 0, 211, 155
--- a/Resource_eng/resource.h
+++ b/Resource_eng/resource.h
@@ -474,6 +474,7 @@
474474 #define TRMODE_LISTERROR 1228
475475 #define MIRROR_NO_TRANSFER 1229
476476 #define HSET_NO_PASV_ADRS 1230
477+#define TRMODE4_MARK_INTERNET 1231
477478 #define MENU_END 40001
478479 #define MENU_EXIT 40001
479480 #define MENU_CONNECT 40003
@@ -667,7 +668,7 @@
667668 #ifndef APSTUDIO_READONLY_SYMBOLS
668669 #define _APS_NEXT_RESOURCE_VALUE 200
669670 #define _APS_NEXT_COMMAND_VALUE 40183
670-#define _APS_NEXT_CONTROL_VALUE 1231
671+#define _APS_NEXT_CONTROL_VALUE 1232
671672 #define _APS_NEXT_SYMED_VALUE 101
672673 #endif
673674 #endif
--- a/src/common.h
+++ b/src/common.h
@@ -128,6 +128,9 @@
128128 // 同時接続対応
129129 #define WM_RECONNECTSOCKET (WM_USER+11)
130130
131+// ゾーンID設定追加
132+#define WM_MARKFILEASDOWNLOADEDFROMINTERNET (WM_USER+12)
133+
131134 /*===== ホスト番号 =====*/
132135 /* ホスト番号は 0~ の値を取る */
133136
@@ -1386,6 +1389,14 @@ typedef struct
13861389 int Port;
13871390 } REMOVEPORTMAPPINGDATA;
13881391
1392+// ゾーンID設定追加
1393+typedef struct
1394+{
1395+ int r;
1396+ HANDLE h;
1397+ char* Fname;
1398+} MARKFILEASDOWNLOADEDFROMINTERNETDATA;
1399+
13891400 /*=================================================
13901401 * プロトタイプ
13911402 *=================================================*/
@@ -1794,6 +1805,11 @@ int CheckPathViolation(TRANSPACKET *packet);
17941805 LONGLONG AskTransferSizeLeft(void);
17951806 LONGLONG AskTransferSizeTotal(void);
17961807 int AskTransferErrorDisplay(void);
1808+// ゾーンID設定追加
1809+int LoadZoneID();
1810+void FreeZoneID();
1811+int IsZoneIDLoaded();
1812+int MarkFileAsDownloadedFromInternet(char* Fname);
17971813
17981814 /*===== codecnv.c =====*/
17991815
--- a/src/ftpproc.c
+++ b/src/ftpproc.c
@@ -113,7 +113,7 @@ extern int MakeAllDir;
113113 // ファイル一覧バグ修正
114114 extern int AbortOnListError;
115115 // ミラーリング設定追加
116-extern int MirrorNoTransferContents;
116+extern int MirrorNoTransferContents;
117117 // タイムスタンプのバグ修正
118118 extern int DispTimeSeconds;
119119
--- a/src/getput.c
+++ b/src/getput.c
@@ -41,6 +41,9 @@
4141 #include <string.h>
4242 #include <mbstring.h>
4343 #include <time.h>
44+// ゾーンID設定追加
45+#undef _WIN32_IE
46+#define _WIN32_IE _WIN32_IE_IE60SP2
4447 // IPv6対応
4548 //#include <winsock.h>
4649 #include <winsock2.h>
@@ -176,6 +179,9 @@ static int TransferErrorNotify = NO;
176179 static LONGLONG TransferSizeLeft = 0;
177180 static LONGLONG TransferSizeTotal = 0;
178181 static int TransferErrorDisplay = 0;
182+// ゾーンID設定追加
183+IZoneIdentifier* pZoneIdentifier;
184+IPersistFile* pPersistFile;
179185
180186 /*===== 外部参照 =====*/
181187
@@ -192,6 +198,8 @@ extern int FolderAttrNum;
192198 extern int SendQuit;
193199 // 自動切断対策
194200 extern time_t LastDataConnectionTime;
201+// ゾーンID設定追加
202+extern int MarkAsInternet;
195203
196204
197205 /*----- ファイル転送スレッドを起動する ----------------------------------------
@@ -959,9 +967,12 @@ static ULONG WINAPI TransferThread(void *Dummy)
959967 // ミラーリング設定追加
960968 if(Pos->NoTransfer == NO)
961969 {
962- Sts = DoDownload(TrnSkt, Pos, NO, &Canceled[Pos->ThreadCount]) / 100;
963- if(Sts != FTP_COMPLETE)
964- LastError = YES;
970+ Sts = DoDownload(TrnSkt, Pos, NO, &Canceled[Pos->ThreadCount]) / 100;
971+ if(Sts != FTP_COMPLETE)
972+ LastError = YES;
973+ // ゾーンID設定追加
974+ if(MarkAsInternet == YES && IsZoneIDLoaded() == YES)
975+ MarkFileAsDownloadedFromInternet(Pos->LocalFile);
965976 }
966977
967978 // ミラーリング設定追加
@@ -993,9 +1004,9 @@ static ULONG WINAPI TransferThread(void *Dummy)
9931004 // ミラーリング設定追加
9941005 if(Pos->NoTransfer == NO)
9951006 {
996- Sts = DoUpload(TrnSkt, Pos) / 100;
997- if(Sts != FTP_COMPLETE)
998- LastError = YES;
1007+ Sts = DoUpload(TrnSkt, Pos) / 100;
1008+ if(Sts != FTP_COMPLETE)
1009+ LastError = YES;
9991010 }
10001011
10011012 // ホスト側の日時設定
@@ -4527,3 +4538,77 @@ int AskTransferErrorDisplay(void)
45274538 return(TransferErrorDisplay);
45284539 }
45294540
4541+// ゾーンID設定追加
4542+int LoadZoneID()
4543+{
4544+ int Sts;
4545+ Sts = FFFTP_FAIL;
4546+ if(IsMainThread())
4547+ {
4548+ if(CoCreateInstance(&CLSID_PersistentZoneIdentifier, NULL, CLSCTX_ALL, &IID_IZoneIdentifier, (void**)&pZoneIdentifier) == S_OK)
4549+ {
4550+ if(pZoneIdentifier->lpVtbl->SetId(pZoneIdentifier, URLZONE_INTERNET) == S_OK)
4551+ {
4552+ if(pZoneIdentifier->lpVtbl->QueryInterface(pZoneIdentifier, &IID_IPersistFile, (void**)&pPersistFile) == S_OK)
4553+ Sts = FFFTP_SUCCESS;
4554+ }
4555+ }
4556+ }
4557+ return Sts;
4558+}
4559+
4560+void FreeZoneID()
4561+{
4562+ if(IsMainThread())
4563+ {
4564+ if(pPersistFile != NULL)
4565+ pPersistFile->lpVtbl->Release(pPersistFile);
4566+ pPersistFile = NULL;
4567+ if(pZoneIdentifier != NULL)
4568+ pZoneIdentifier->lpVtbl->Release(pZoneIdentifier);
4569+ pZoneIdentifier = NULL;
4570+ }
4571+}
4572+
4573+int IsZoneIDLoaded()
4574+{
4575+ int Sts;
4576+ Sts = NO;
4577+ if(pZoneIdentifier != NULL && pPersistFile != NULL)
4578+ Sts = YES;
4579+ return Sts;
4580+}
4581+
4582+int MarkFileAsDownloadedFromInternet(char* Fname)
4583+{
4584+ int Sts;
4585+ WCHAR Tmp1[FMAX_PATH+1];
4586+ BSTR Tmp2;
4587+ MARKFILEASDOWNLOADEDFROMINTERNETDATA Data;
4588+ Sts = FFFTP_FAIL;
4589+ if(IsMainThread())
4590+ {
4591+ MtoW(Tmp1, FMAX_PATH, Fname, -1);
4592+ if((Tmp2 = SysAllocString(Tmp1)) != NULL)
4593+ {
4594+ if(pPersistFile->lpVtbl->Save(pPersistFile, Tmp2, FALSE) == S_OK)
4595+ Sts = FFFTP_SUCCESS;
4596+ SysFreeString(Tmp2);
4597+ }
4598+ }
4599+ else
4600+ {
4601+ if(Data.h = CreateEvent(NULL, TRUE, FALSE, NULL))
4602+ {
4603+ Data.Fname = Fname;
4604+ if(PostMessage(GetMainHwnd(), WM_MARKFILEASDOWNLOADEDFROMINTERNET, 0, (LPARAM)&Data))
4605+ {
4606+ if(WaitForSingleObject(Data.h, INFINITE) == WAIT_OBJECT_0)
4607+ Sts = Data.r;
4608+ }
4609+ CloseHandle(Data.h);
4610+ }
4611+ }
4612+ return Sts;
4613+}
4614+
--- a/src/main.c
+++ b/src/main.c
@@ -294,6 +294,8 @@ int AbortOnListError = YES;
294294 int MirrorNoTransferContents = NO;
295295 // FireWall設定追加
296296 int FwallNoSaveUser = NO;
297+// ゾーンID設定追加
298+int MarkAsInternet = NO;
297299
298300
299301
@@ -416,6 +418,8 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
416418 LoadUPnP();
417419 // タスクバー進捗表示
418420 LoadTaskbarList3();
421+ // ゾーンID設定追加
422+ LoadZoneID();
419423
420424 // UTF-8対応
421425 LoadUnicodeNormalizationDll();
@@ -524,6 +528,8 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
524528 #ifdef USE_OPENSSL
525529 FreeOpenSSL();
526530 #endif
531+ // ゾーンID設定追加
532+ FreeZoneID();
527533 // タスクバー進捗表示
528534 FreeTaskbarList3();
529535 // UPnP対応
@@ -2117,6 +2123,12 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
21172123 ReconnectProc();
21182124 break;
21192125
2126+ // ゾーンID設定追加
2127+ case WM_MARKFILEASDOWNLOADEDFROMINTERNET :
2128+ ((MARKFILEASDOWNLOADEDFROMINTERNETDATA*)lParam)->r = MarkFileAsDownloadedFromInternet(((MARKFILEASDOWNLOADEDFROMINTERNETDATA*)lParam)->Fname);
2129+ SetEvent(((MARKFILEASDOWNLOADEDFROMINTERNETDATA*)lParam)->h);
2130+ break;
2131+
21202132 case WM_PAINT :
21212133 BeginPaint(hWnd, (LPPAINTSTRUCT) &ps);
21222134 EndPaint(hWnd, (LPPAINTSTRUCT) &ps);
@@ -2746,6 +2758,9 @@ void DoubleClickProc(int Win, int Mode, int App)
27462758 // 同時接続対応
27472759 CancelFlg = NO;
27482760 Sts = DoDownload(AskCmdCtrlSkt(), &MainTransPkt, NO, &CancelFlg);
2761+ // ゾーンID設定追加
2762+ if(MarkAsInternet == YES && IsZoneIDLoaded() == YES)
2763+ MarkFileAsDownloadedFromInternet(Remote);
27492764 // }
27502765 }
27512766
--- a/src/option.c
+++ b/src/option.c
@@ -195,9 +195,11 @@ extern int AutoCheckForUptatesInterval;
195195 // ファイル一覧バグ修正
196196 extern int AbortOnListError;
197197 // ミラーリング設定追加
198-extern int MirrorNoTransferContents;
198+extern int MirrorNoTransferContents;
199199 // FireWall設定追加
200-extern int FwallNoSaveUser;
200+extern int FwallNoSaveUser;
201+// ゾーンID設定追加
202+extern int MarkAsInternet;
201203
202204
203205 /*----- オプションのプロパティシート ------------------------------------------
@@ -825,6 +827,14 @@ static INT_PTR CALLBACK Trmode4SettingProc(HWND hDlg, UINT message, WPARAM wPara
825827 {
826828 case WM_INITDIALOG :
827829 SetRadioButtonByValue(hDlg, AskLocalKanjiCode(), KanjiButton, KANJIBUTTONS);
830+ // ゾーンID設定追加
831+ if(IsZoneIDLoaded())
832+ SendDlgItemMessage(hDlg, TRMODE4_MARK_INTERNET, BM_SETCHECK, MarkAsInternet, 0);
833+ else
834+ {
835+ SendDlgItemMessage(hDlg, TRMODE4_MARK_INTERNET, BM_SETCHECK, BST_UNCHECKED, 0);
836+ EnableWindow(GetDlgItem(hDlg, TRMODE4_MARK_INTERNET), FALSE);
837+ }
828838
829839 return(TRUE);
830840
@@ -835,6 +845,9 @@ static INT_PTR CALLBACK Trmode4SettingProc(HWND hDlg, UINT message, WPARAM wPara
835845 case PSN_APPLY :
836846 SetLocalKanjiCodeImm(AskRadioButtonValue(hDlg, KanjiButton, KANJIBUTTONS));
837847 SaveLocalKanjiCode();
848+ // ゾーンID設定追加
849+ if(IsZoneIDLoaded())
850+ MarkAsInternet = SendDlgItemMessage(hDlg, TRMODE4_MARK_INTERNET, BM_GETCHECK, 0, 0);
838851 break;
839852
840853 case PSN_RESET :
--- a/src/registry.c
+++ b/src/registry.c
@@ -240,9 +240,11 @@ extern time_t LastAutoCheckForUpdates;
240240 // ファイル一覧バグ修正
241241 extern int AbortOnListError;
242242 // ミラーリング設定追加
243-extern int MirrorNoTransferContents;
243+extern int MirrorNoTransferContents;
244244 // FireWall設定追加
245-extern int FwallNoSaveUser;
245+extern int FwallNoSaveUser;
246+// ゾーンID設定追加
247+extern int MarkAsInternet;
246248
247249 /*----- マスタパスワードの設定 ----------------------------------------------
248250 *
@@ -865,6 +867,8 @@ void SaveRegistry(void)
865867 WriteIntValueToReg(hKey4, "MirNoTransfer", MirrorNoTransferContents);
866868 // FireWall設定追加
867869 WriteIntValueToReg(hKey4, "FwallShared", FwallNoSaveUser);
870+ // ゾーンID設定追加
871+ WriteIntValueToReg(hKey4, "MarkDFile", MarkAsInternet);
868872 }
869873 CloseSubKey(hKey4);
870874 }
@@ -1462,6 +1466,8 @@ int LoadRegistry(void)
14621466 ReadIntValueFromReg(hKey4, "MirNoTransfer", &MirrorNoTransferContents);
14631467 // FireWall設定追加
14641468 ReadIntValueFromReg(hKey4, "FwallShared", &FwallNoSaveUser);
1469+ // ゾーンID設定追加
1470+ ReadIntValueFromReg(hKey4, "MarkDFile", &MarkAsInternet);
14651471
14661472 CloseSubKey(hKey4);
14671473 }