Internet選項裡的自定義安全每一項,都將為最低安全標准 [cpp] struct _Code { char* m_code; int m_data[4]; char* alter; } Code[] = { {"2004", {0,0,0,0}, "運行未Authenticode簽名組件"}, {"2007", {0,0,1,0}, "帶有清單的權限組件"}, {"2400", {0,0,0,0}, "XAML浏覽器應用程序"}, {"2401", {0,0,0,0}, "XPS文檔"}, {"2402", {0,0,0,0}, "松散XAML"}, {"2001", {0,0,0,0}, "運行已用Authenticode簽名組件"}, {"2201", {0,0,0,0}, "Active控件自動提示"}, {"1405", {0,0,0,0}, "對標記為可安全執行腳本的Active控件執行腳本"}, {"1201", {0,0,0,0}, "對沒有標記為安全的Active控件進行初始化和腳本"}, {"2000", {0,0,0,0}, "二進制腳本和行為"}, {"120B", {3,0,0,0}, "僅允許經過批准的域在未經提示的情況下使用ActiveX"}, {"2702", {0,0,0,0}, "允許ActiveX篩選"}, {"1209", {0,0,0,0}, "允許Scriptlet"}, {"1208", {0,0,0,0}, "允許運行以前未使用的ActiveX控件而不提示"}, {"1004", {0,0,0,0}, "下載未簽名的Active控件"}, {"1001", {0,0,0,0}, "下載已簽名的Active控件"}, {"1200", {0,0,0,0}, "運行Active控件和插件"}, {"120A", {0,0,0,0}, "在沒有使用外部媒體播放機的網頁上顯示視頻和動畫"}, {"1C00", {0,0,3,0}, "Java 權限"}, {"1402", {0,0,0,0}, "Java小程序腳本"}, {"1400", {0,0,0,0}, "活動腳本"}, {"1409", {0,0,0,0}, "啟用 XSS 篩選器"}, {"1407", {0,0,0,0}, "允許通過腳本進行粘貼操作(或者 允許通過粘貼板進行編程訪問)"}, {"2103", {0,0,0,0}, "允許狀態欄通過腳本更新"}, {"2105", {0,0,0,0}, "允許網站使用腳本窗口提示獲得信息"}, {"1606", {0,0,0,0}, "持續使用用戶數據"}, {"160A", {0,0,0,0}, "將文件上載到服務器時包含本地目錄路徑"}, {"2100", {0,0,0,0}, "基於內容打開文件而不是基於文件擴展名"}, {"1806", {0,0,0,0}, "加載應用程序和不安全文件"}, {"1406", {0,0,0,0}, "跨域訪問數據源"}, {"1607", {0,0,0,0}, "跨域浏覽子框架"}, {"2301", {3,0,0,0}, "使用 SmartScreen 篩選器"}, {"1A04", {0,0,0,0}, "沒有證書或者只有一個證書時客戶端不進行證書選擇"}, {"1E05", {0,0,3,0}, "軟件頻道權限"}, {"1809", {3,0,0,0}, "使用彈出窗口阻止程序"}, {"1601", {0,0,0,0}, "提交非加密表單數據"}, {"1802", {0,0,0,0}, "拖放或粘貼或復制文件"}, {"1609", {0,0,0,0}, "顯示混合內容"}, {"1206", {0,0,0,0}, "允許Internet Explore Webbrowser控件的腳本"}, {"1608", {0,0,0,0}, "允許META REFRESH"}, {"2300", {0,0,0,0}, "允許網頁為活動內容使用受限制的協議"}, {"2102", {0,0,0,0}, "允許由腳本初始化的窗口,沒有大小和位置限制"}, {"1804", {0,0,0,0}, "在IFRAME中加載程序和文件"}, {"2101", {0,0,0,0}, "在低權web內容區域中的網站可以導航到此區域"}, {"2104", {0,0,0,0}, "允許網站打開沒有地址或狀態欄的窗口"}, {"1800", {0,0,0,0}, "桌面組件的安裝"}, {"2600", {0,0,0,0}, "啟用 .NET Framework 安裝程序"}, {"1803", {0,0,0,0}, "文件下載"}, {"2200", {0,0,0,0}, "文件下載自動提示"}, {"1604", {0,0,0,0}, "字體下載"}, {"1A00", {0,0,0,0}, "登錄"}, {"CurrentLevel",{0,0,1,0},"安全級別"}, {NULL, NULL, NULL} }; BOOL CIEDlg::IEPolice() { for(int m=0; m<4; m++) { CString m_location = "SOFTWARE\\MICROSOFT\\WINDOWS\\CURRENTVERSION\\INTERNET SETTINGS\\ZONES\\"; CString m_m; m_m.Format("%d", m); m_location += m_m; //定義有關的 hKEY, 在程序的最後要關閉。 HKEY hKEY; //hKEY,KEY_WRITE表示以寫的方式打開。 long ret=(::RegOpenKeyEx(HKEY_CURRENT_USER,m_location, 0, KEY_WRITE, &hKEY)); if(ret!=ERROR_SUCCESS) { AfxMessageBox("錯誤: 無法打開有關注冊表鍵!"); return false; } DWORD type=REG_DWORD; DWORD len_Data = REG_DWORD; for(int i=0; Code[i].m_code != NULL; i++) { LPBYTE Data = new BYTE[4]; for(int j=0; j<4; j++) { *(Data+j) = Code[i].m_data[j]; } long ret1=::RegSetValueEx(hKEY, Code[i].m_code, NULL, type, Data, len_Data); if(ret1!=ERROR_SUCCESS) { AfxMessageBox(strcat("錯誤: 無法修改有關注冊表信息:",Code[i].alter)); return false; } } RegCloseKey(hKEY); } return true; }