Loweynet
Revisão | 97d837ae7875002eed1b1a6993f51e3eaf0933d5 (tree) |
---|---|
Hora | 2018-01-01 16:59:31 |
Autor | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Add options to add Zone Identifier to downloaded files.
@@ -1461,6 +1461,7 @@ BEGIN | ||
1461 | 1461 | CONTROL "EUC",TRMODE4_EUC_CNV,"Button",BS_AUTORADIOBUTTON,12,45,41,10 |
1462 | 1462 | CONTROL "UTF-8",TRMODE4_UTF8N_CNV,"Button",BS_AUTORADIOBUTTON,12,57,41,10 |
1463 | 1463 | CONTROL "UTF-8 BOM",TRMODE4_UTF8BOM_CNV,"Button",BS_AUTORADIOBUTTON,12,69,81,10 |
1464 | + CONTROL "C^[lbg©çüèµ½àÌƵÄt@CÉîñðtÁ·é(&I)",TRMODE4_MARK_INTERNET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,96,196,10 | |
1464 | 1465 | END |
1465 | 1466 | |
1466 | 1467 | opt_disp2_dlg DIALOG 0, 0, 211, 155 |
@@ -474,6 +474,7 @@ | ||
474 | 474 | #define TRMODE_LISTERROR 1228 |
475 | 475 | #define MIRROR_NO_TRANSFER 1229 |
476 | 476 | #define HSET_NO_PASV_ADRS 1230 |
477 | +#define TRMODE4_MARK_INTERNET 1231 | |
477 | 478 | #define MENU_END 40001 |
478 | 479 | #define MENU_EXIT 40001 |
479 | 480 | #define MENU_CONNECT 40003 |
@@ -667,7 +668,7 @@ | ||
667 | 668 | #ifndef APSTUDIO_READONLY_SYMBOLS |
668 | 669 | #define _APS_NEXT_RESOURCE_VALUE 200 |
669 | 670 | #define _APS_NEXT_COMMAND_VALUE 40183 |
670 | -#define _APS_NEXT_CONTROL_VALUE 1231 | |
671 | +#define _APS_NEXT_CONTROL_VALUE 1232 | |
671 | 672 | #define _APS_NEXT_SYMED_VALUE 101 |
672 | 673 | #endif |
673 | 674 | #endif |
@@ -1502,6 +1502,7 @@ BEGIN | ||
1502 | 1502 | CONTROL "EUC",TRMODE4_EUC_CNV,"Button",BS_AUTORADIOBUTTON,12,45,41,10 |
1503 | 1503 | CONTROL "UTF-8",TRMODE4_UTF8N_CNV,"Button",BS_AUTORADIOBUTTON,12,57,41,10 |
1504 | 1504 | 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 | |
1505 | 1506 | END |
1506 | 1507 | |
1507 | 1508 | opt_disp2_dlg DIALOG 0, 0, 211, 155 |
@@ -474,6 +474,7 @@ | ||
474 | 474 | #define TRMODE_LISTERROR 1228 |
475 | 475 | #define MIRROR_NO_TRANSFER 1229 |
476 | 476 | #define HSET_NO_PASV_ADRS 1230 |
477 | +#define TRMODE4_MARK_INTERNET 1231 | |
477 | 478 | #define MENU_END 40001 |
478 | 479 | #define MENU_EXIT 40001 |
479 | 480 | #define MENU_CONNECT 40003 |
@@ -667,7 +668,7 @@ | ||
667 | 668 | #ifndef APSTUDIO_READONLY_SYMBOLS |
668 | 669 | #define _APS_NEXT_RESOURCE_VALUE 200 |
669 | 670 | #define _APS_NEXT_COMMAND_VALUE 40183 |
670 | -#define _APS_NEXT_CONTROL_VALUE 1231 | |
671 | +#define _APS_NEXT_CONTROL_VALUE 1232 | |
671 | 672 | #define _APS_NEXT_SYMED_VALUE 101 |
672 | 673 | #endif |
673 | 674 | #endif |
@@ -128,6 +128,9 @@ | ||
128 | 128 | // 同時接続対応 |
129 | 129 | #define WM_RECONNECTSOCKET (WM_USER+11) |
130 | 130 | |
131 | +// ゾーンID設定追加 | |
132 | +#define WM_MARKFILEASDOWNLOADEDFROMINTERNET (WM_USER+12) | |
133 | + | |
131 | 134 | /*===== ホスト番号 =====*/ |
132 | 135 | /* ホスト番号は 0~ の値を取る */ |
133 | 136 |
@@ -1386,6 +1389,14 @@ typedef struct | ||
1386 | 1389 | int Port; |
1387 | 1390 | } REMOVEPORTMAPPINGDATA; |
1388 | 1391 | |
1392 | +// ゾーンID設定追加 | |
1393 | +typedef struct | |
1394 | +{ | |
1395 | + int r; | |
1396 | + HANDLE h; | |
1397 | + char* Fname; | |
1398 | +} MARKFILEASDOWNLOADEDFROMINTERNETDATA; | |
1399 | + | |
1389 | 1400 | /*================================================= |
1390 | 1401 | * プロトタイプ |
1391 | 1402 | *=================================================*/ |
@@ -1794,6 +1805,11 @@ int CheckPathViolation(TRANSPACKET *packet); | ||
1794 | 1805 | LONGLONG AskTransferSizeLeft(void); |
1795 | 1806 | LONGLONG AskTransferSizeTotal(void); |
1796 | 1807 | int AskTransferErrorDisplay(void); |
1808 | +// ゾーンID設定追加 | |
1809 | +int LoadZoneID(); | |
1810 | +void FreeZoneID(); | |
1811 | +int IsZoneIDLoaded(); | |
1812 | +int MarkFileAsDownloadedFromInternet(char* Fname); | |
1797 | 1813 | |
1798 | 1814 | /*===== codecnv.c =====*/ |
1799 | 1815 |
@@ -113,7 +113,7 @@ extern int MakeAllDir; | ||
113 | 113 | // ファイル一覧バグ修正 |
114 | 114 | extern int AbortOnListError; |
115 | 115 | // ミラーリング設定追加 |
116 | -extern int MirrorNoTransferContents; | |
116 | +extern int MirrorNoTransferContents; | |
117 | 117 | // タイムスタンプのバグ修正 |
118 | 118 | extern int DispTimeSeconds; |
119 | 119 |
@@ -41,6 +41,9 @@ | ||
41 | 41 | #include <string.h> |
42 | 42 | #include <mbstring.h> |
43 | 43 | #include <time.h> |
44 | +// ゾーンID設定追加 | |
45 | +#undef _WIN32_IE | |
46 | +#define _WIN32_IE _WIN32_IE_IE60SP2 | |
44 | 47 | // IPv6対応 |
45 | 48 | //#include <winsock.h> |
46 | 49 | #include <winsock2.h> |
@@ -176,6 +179,9 @@ static int TransferErrorNotify = NO; | ||
176 | 179 | static LONGLONG TransferSizeLeft = 0; |
177 | 180 | static LONGLONG TransferSizeTotal = 0; |
178 | 181 | static int TransferErrorDisplay = 0; |
182 | +// ゾーンID設定追加 | |
183 | +IZoneIdentifier* pZoneIdentifier; | |
184 | +IPersistFile* pPersistFile; | |
179 | 185 | |
180 | 186 | /*===== 外部参照 =====*/ |
181 | 187 |
@@ -192,6 +198,8 @@ extern int FolderAttrNum; | ||
192 | 198 | extern int SendQuit; |
193 | 199 | // 自動切断対策 |
194 | 200 | extern time_t LastDataConnectionTime; |
201 | +// ゾーンID設定追加 | |
202 | +extern int MarkAsInternet; | |
195 | 203 | |
196 | 204 | |
197 | 205 | /*----- ファイル転送スレッドを起動する ---------------------------------------- |
@@ -959,9 +967,12 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
959 | 967 | // ミラーリング設定追加 |
960 | 968 | if(Pos->NoTransfer == NO) |
961 | 969 | { |
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); | |
965 | 976 | } |
966 | 977 | |
967 | 978 | // ミラーリング設定追加 |
@@ -993,9 +1004,9 @@ static ULONG WINAPI TransferThread(void *Dummy) | ||
993 | 1004 | // ミラーリング設定追加 |
994 | 1005 | if(Pos->NoTransfer == NO) |
995 | 1006 | { |
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; | |
999 | 1010 | } |
1000 | 1011 | |
1001 | 1012 | // ホスト側の日時設定 |
@@ -4527,3 +4538,77 @@ int AskTransferErrorDisplay(void) | ||
4527 | 4538 | return(TransferErrorDisplay); |
4528 | 4539 | } |
4529 | 4540 | |
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 | + |
@@ -294,6 +294,8 @@ int AbortOnListError = YES; | ||
294 | 294 | int MirrorNoTransferContents = NO; |
295 | 295 | // FireWall設定追加 |
296 | 296 | int FwallNoSaveUser = NO; |
297 | +// ゾーンID設定追加 | |
298 | +int MarkAsInternet = NO; | |
297 | 299 | |
298 | 300 | |
299 | 301 |
@@ -416,6 +418,8 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi | ||
416 | 418 | LoadUPnP(); |
417 | 419 | // タスクバー進捗表示 |
418 | 420 | LoadTaskbarList3(); |
421 | + // ゾーンID設定追加 | |
422 | + LoadZoneID(); | |
419 | 423 | |
420 | 424 | // UTF-8対応 |
421 | 425 | LoadUnicodeNormalizationDll(); |
@@ -524,6 +528,8 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi | ||
524 | 528 | #ifdef USE_OPENSSL |
525 | 529 | FreeOpenSSL(); |
526 | 530 | #endif |
531 | + // ゾーンID設定追加 | |
532 | + FreeZoneID(); | |
527 | 533 | // タスクバー進捗表示 |
528 | 534 | FreeTaskbarList3(); |
529 | 535 | // UPnP対応 |
@@ -2117,6 +2123,12 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA | ||
2117 | 2123 | ReconnectProc(); |
2118 | 2124 | break; |
2119 | 2125 | |
2126 | + // ゾーンID設定追加 | |
2127 | + case WM_MARKFILEASDOWNLOADEDFROMINTERNET : | |
2128 | + ((MARKFILEASDOWNLOADEDFROMINTERNETDATA*)lParam)->r = MarkFileAsDownloadedFromInternet(((MARKFILEASDOWNLOADEDFROMINTERNETDATA*)lParam)->Fname); | |
2129 | + SetEvent(((MARKFILEASDOWNLOADEDFROMINTERNETDATA*)lParam)->h); | |
2130 | + break; | |
2131 | + | |
2120 | 2132 | case WM_PAINT : |
2121 | 2133 | BeginPaint(hWnd, (LPPAINTSTRUCT) &ps); |
2122 | 2134 | EndPaint(hWnd, (LPPAINTSTRUCT) &ps); |
@@ -2746,6 +2758,9 @@ void DoubleClickProc(int Win, int Mode, int App) | ||
2746 | 2758 | // 同時接続対応 |
2747 | 2759 | CancelFlg = NO; |
2748 | 2760 | Sts = DoDownload(AskCmdCtrlSkt(), &MainTransPkt, NO, &CancelFlg); |
2761 | + // ゾーンID設定追加 | |
2762 | + if(MarkAsInternet == YES && IsZoneIDLoaded() == YES) | |
2763 | + MarkFileAsDownloadedFromInternet(Remote); | |
2749 | 2764 | // } |
2750 | 2765 | } |
2751 | 2766 |
@@ -195,9 +195,11 @@ extern int AutoCheckForUptatesInterval; | ||
195 | 195 | // ファイル一覧バグ修正 |
196 | 196 | extern int AbortOnListError; |
197 | 197 | // ミラーリング設定追加 |
198 | -extern int MirrorNoTransferContents; | |
198 | +extern int MirrorNoTransferContents; | |
199 | 199 | // FireWall設定追加 |
200 | -extern int FwallNoSaveUser; | |
200 | +extern int FwallNoSaveUser; | |
201 | +// ゾーンID設定追加 | |
202 | +extern int MarkAsInternet; | |
201 | 203 | |
202 | 204 | |
203 | 205 | /*----- オプションのプロパティシート ------------------------------------------ |
@@ -825,6 +827,14 @@ static INT_PTR CALLBACK Trmode4SettingProc(HWND hDlg, UINT message, WPARAM wPara | ||
825 | 827 | { |
826 | 828 | case WM_INITDIALOG : |
827 | 829 | 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 | + } | |
828 | 838 | |
829 | 839 | return(TRUE); |
830 | 840 |
@@ -835,6 +845,9 @@ static INT_PTR CALLBACK Trmode4SettingProc(HWND hDlg, UINT message, WPARAM wPara | ||
835 | 845 | case PSN_APPLY : |
836 | 846 | SetLocalKanjiCodeImm(AskRadioButtonValue(hDlg, KanjiButton, KANJIBUTTONS)); |
837 | 847 | SaveLocalKanjiCode(); |
848 | + // ゾーンID設定追加 | |
849 | + if(IsZoneIDLoaded()) | |
850 | + MarkAsInternet = SendDlgItemMessage(hDlg, TRMODE4_MARK_INTERNET, BM_GETCHECK, 0, 0); | |
838 | 851 | break; |
839 | 852 | |
840 | 853 | case PSN_RESET : |
@@ -240,9 +240,11 @@ extern time_t LastAutoCheckForUpdates; | ||
240 | 240 | // ファイル一覧バグ修正 |
241 | 241 | extern int AbortOnListError; |
242 | 242 | // ミラーリング設定追加 |
243 | -extern int MirrorNoTransferContents; | |
243 | +extern int MirrorNoTransferContents; | |
244 | 244 | // FireWall設定追加 |
245 | -extern int FwallNoSaveUser; | |
245 | +extern int FwallNoSaveUser; | |
246 | +// ゾーンID設定追加 | |
247 | +extern int MarkAsInternet; | |
246 | 248 | |
247 | 249 | /*----- マスタパスワードの設定 ---------------------------------------------- |
248 | 250 | * |
@@ -865,6 +867,8 @@ void SaveRegistry(void) | ||
865 | 867 | WriteIntValueToReg(hKey4, "MirNoTransfer", MirrorNoTransferContents); |
866 | 868 | // FireWall設定追加 |
867 | 869 | WriteIntValueToReg(hKey4, "FwallShared", FwallNoSaveUser); |
870 | + // ゾーンID設定追加 | |
871 | + WriteIntValueToReg(hKey4, "MarkDFile", MarkAsInternet); | |
868 | 872 | } |
869 | 873 | CloseSubKey(hKey4); |
870 | 874 | } |
@@ -1462,6 +1466,8 @@ int LoadRegistry(void) | ||
1462 | 1466 | ReadIntValueFromReg(hKey4, "MirNoTransfer", &MirrorNoTransferContents); |
1463 | 1467 | // FireWall設定追加 |
1464 | 1468 | ReadIntValueFromReg(hKey4, "FwallShared", &FwallNoSaveUser); |
1469 | + // ゾーンID設定追加 | |
1470 | + ReadIntValueFromReg(hKey4, "MarkDFile", &MarkAsInternet); | |
1465 | 1471 | |
1466 | 1472 | CloseSubKey(hKey4); |
1467 | 1473 | } |