MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / GetZoneProtectedModeSetting

Method GetZoneProtectedModeSetting

cpp/iedriver/BrowserFactory.cpp:1466–1512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1464}
1465
1466int BrowserFactory::GetZoneProtectedModeSetting(const HKEY key_handle,
1467 const std::wstring& zone_subkey_name) {
1468 LOG(TRACE) << "Entering BrowserFactory::GetZoneProtectedModeSetting";
1469
1470 int protected_mode_value = 3;
1471 HKEY subkey_handle;
1472 if (ERROR_SUCCESS == ::RegOpenKeyEx(key_handle,
1473 zone_subkey_name.c_str(),
1474 0,
1475 KEY_QUERY_VALUE,
1476 &subkey_handle)) {
1477 DWORD value = 0;
1478 DWORD value_length = sizeof(DWORD);
1479 if (ERROR_SUCCESS == ::RegQueryValueEx(subkey_handle,
1480 IE_PROTECTED_MODE_SETTING_VALUE_NAME,
1481 NULL,
1482 NULL,
1483 reinterpret_cast<LPBYTE>(&value),
1484 &value_length)) {
1485 LOG(DEBUG) << "Found Protected Mode setting value of "
1486 << value << " for zone " << LOGWSTRING(zone_subkey_name);
1487 protected_mode_value = value;
1488 } else {
1489 LOG(DEBUG) << "RegQueryValueEx failed for getting Protected Mode setting for a zone: "
1490 << LOGWSTRING(zone_subkey_name);
1491 }
1492 ::RegCloseKey(subkey_handle);
1493 } else {
1494 // The REG_DWORD value doesn't exist, so we have to return the default
1495 // value, which is "on" for the Internet and Restricted Sites zones and
1496 // is "on" for the Local Intranet zone in IE7 only (the default was
1497 // changed to "off" for Local Intranet in IE8), and "off" everywhere
1498 // else.
1499 // Note that a value of 0 in the registry value indicates that Protected
1500 // Mode is "on" for that zone; a value of 3 indicates that Protected Mode
1501 // is "off" for that zone.
1502 if (zone_subkey_name == ZONE_INTERNET ||
1503 zone_subkey_name == ZONE_RESTRICTED_SITES ||
1504 (zone_subkey_name == ZONE_LOCAL_INTRANET && this->ie_major_version_ == 7)) {
1505 protected_mode_value = 0;
1506 }
1507 LOG(DEBUG) << "Protected Mode zone setting value does not exist for zone "
1508 << LOGWSTRING(zone_subkey_name) << ". Using default value of "
1509 << protected_mode_value;
1510 }
1511 return protected_mode_value;
1512}
1513
1514bool BrowserFactory::IsWindowsVersionOrGreater(unsigned short major_version,
1515 unsigned short minor_version,

Callers 1

Calls 1

LOGClass · 0.50

Tested by

no test coverage detected