Skip to content

Commit

Permalink
Correcting IE driver build process to create executables runnable on …
Browse files Browse the repository at this point in the history
…Windows XP

Fixes issue #936.
  • Loading branch information
jimevans committed Aug 17, 2015
1 parent 26b6d70 commit 3d35c1c
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 34 deletions.
34 changes: 29 additions & 5 deletions cpp/iedriver/BrowserFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <sddl.h>
#include <shlguid.h>
#include <shlobj.h>
#include <VersionHelpers.h>
#include <WinInet.h>
#include "FileUtilities.h"
#include "logging.h"
Expand Down Expand Up @@ -64,7 +63,7 @@ void BrowserFactory::Initialize(BrowserFactorySettings settings) {
void BrowserFactory::ClearCache() {
LOG(TRACE) << "Entering BrowserFactory::ClearCache";
if (this->clear_cache_) {
if (::IsWindowsVistaOrGreater()) {
if (IsWindowsVistaOrGreater()) {
LOG(DEBUG) << "Clearing cache with low mandatory integrity level as required on Windows Vista or later.";
this->InvokeClearCacheUtility(true);
}
Expand Down Expand Up @@ -635,7 +634,7 @@ IWebBrowser2* BrowserFactory::CreateBrowser() {

IWebBrowser2* browser = NULL;
DWORD context = CLSCTX_LOCAL_SERVER;
if (this->ie_major_version_ == 7 && ::IsWindowsVistaOrGreater()) {
if (this->ie_major_version_ == 7 && IsWindowsVistaOrGreater()) {
// ONLY for IE 7 on Windows Vista. XP and below do not have Protected Mode;
// Windows 7 shipped with IE8.
context = context | CLSCTX_ENABLE_CLOAKING;
Expand Down Expand Up @@ -995,14 +994,14 @@ bool BrowserFactory::ProtectedModeSettingsAreValid() {
bool settings_are_valid = true;
LOG(DEBUG) << "Detected IE version: " << this->ie_major_version_
<< ", Windows version supports Protected Mode: "
<< ::IsWindowsVistaOrGreater() ? "true" : "false";
<< IsWindowsVistaOrGreater() ? "true" : "false";
// Only need to check Protected Mode settings on IE 7 or higher
// and on Windows Vista or higher. Otherwise, Protected Mode
// doesn't come into play, and are valid.
// Documentation of registry settings can be found at the following
// Microsoft KnowledgeBase article:
// http://support.microsoft.com/kb/182569
if (this->ie_major_version_ >= 7 && ::IsWindowsVistaOrGreater()) {
if (this->ie_major_version_ >= 7 && IsWindowsVistaOrGreater()) {
HKEY key_handle;
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_CURRENT_USER,
IE_SECURITY_ZONES_REGISTRY_KEY,
Expand Down Expand Up @@ -1113,4 +1112,29 @@ int BrowserFactory::GetZoneProtectedModeSetting(const HKEY key_handle,
return protected_mode_value;
}

bool BrowserFactory::IsWindowsVersionOrGreater(unsigned short major_version,
unsigned short minor_version,
unsigned short service_pack) {
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0,{ 0 }, 0, 0 };
DWORDLONG const dwlConditionMask = VerSetConditionMask(
VerSetConditionMask(
VerSetConditionMask(
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
VER_MINORVERSION, VER_GREATER_EQUAL),
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);

osvi.dwMajorVersion = major_version;
osvi.dwMinorVersion = minor_version;
osvi.wServicePackMajor = service_pack;

return VerifyVersionInfoW(&osvi,
VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR,
dwlConditionMask) != FALSE;
}

bool BrowserFactory::IsWindowsVistaOrGreater() {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
}


} // namespace webdriver
5 changes: 5 additions & 0 deletions cpp/iedriver/BrowserFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ class BrowserFactory {
static BOOL CALLBACK FindChildWindowForProcess(HWND hwnd, LPARAM arg);
static BOOL CALLBACK FindDialogWindowForProcess(HWND hwnd, LPARAM arg);

static bool IsWindowsVistaOrGreater(void);

private:
static BOOL CALLBACK FindBrowserWindow(HWND hwnd, LPARAM param);
static bool IsWindowsVersionOrGreater(unsigned short major_version,
unsigned short minor_version,
unsigned short service_pack);

UINT html_getobject_msg_;
HINSTANCE oleacc_instance_handle_;
Expand Down
17 changes: 9 additions & 8 deletions cpp/iedriver/IEDriver.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,34 @@
<ProjectGuid>{BB72383B-427F-4191-B692-E4345A30E33C}</ProjectGuid>
<RootNamespace>IEDriver</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down Expand Up @@ -114,7 +115,7 @@
<AdditionalDependencies>ws2_32.lib;Rpcrt4.lib;version.lib;iepmapi.lib;psapi.lib;oleacc.lib;comsuppw.lib;wininet.lib;urlmon.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AssemblyDebug>true</AssemblyDebug>
<SubSystem>NotSet</SubSystem>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
Expand Down Expand Up @@ -144,7 +145,7 @@
<AdditionalDependencies>ws2_32.lib;Rpcrt4.lib;version.lib;iepmapi.lib;psapi.lib;oleacc.lib;comsuppw.lib;wininet.lib;urlmon.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AssemblyDebug>true</AssemblyDebug>
<SubSystem>NotSet</SubSystem>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
Expand All @@ -169,7 +170,7 @@
<Link>
<AdditionalDependencies>ws2_32.lib;Rpcrt4.lib;version.lib;iepmapi.lib;psapi.lib;oleacc.lib;comsuppw.lib;wininet.lib;urlmon.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
Expand All @@ -196,7 +197,7 @@
<Link>
<AdditionalDependencies>ws2_32.lib;Rpcrt4.lib;version.lib;iepmapi.lib;psapi.lib;oleacc.lib;comsuppw.lib;wininet.lib;urlmon.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
Expand Down
1 change: 0 additions & 1 deletion cpp/iedriver/IEServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include "IEServer.h"
#include "IESession.h"
#include <VersionHelpers.h>
#include "FileUtilities.h"
#include "logging.h"

Expand Down
4 changes: 4 additions & 0 deletions cpp/iedriverserver/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ available via the project downloads page. Changes in "revision" field indicate
private releases checked into the prebuilts directory of the source tree, but
not made generally available on the downloads page.

v2.47.0.2
=========
* Corrected build process to create executables runnable on Windows XP.

v2.47.0.1
=========
* Added logging messages for IE driver for bitness mismatches. This commit
Expand Down
Binary file modified cpp/iedriverserver/IEDriverServer.rc
Binary file not shown.
9 changes: 5 additions & 4 deletions cpp/iedriverserver/IEDriverServer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,38 @@
<ProjectGuid>{08C3286F-F132-44EC-80F0-2DF30D87A5D3}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>InternetExplorerDriver</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<UseOfAtl>false</UseOfAtl>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<UseOfAtl>false</UseOfAtl>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfAtl>false</UseOfAtl>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfAtl>false</UseOfAtl>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
Binary file modified cpp/prebuilt/Win32/Release/IEDriverServer.exe
Binary file not shown.
Binary file modified cpp/prebuilt/x64/Release/IEDriverServer.exe
Binary file not shown.
9 changes: 5 additions & 4 deletions cpp/webdriver-interactions/webdriver-interactions.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{87FA39A1-958E-478A-8AB9-6D5E5AAA3886}</ProjectGuid>
<RootNamespace>webdriverinteractions</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
Expand All @@ -29,29 +30,29 @@
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
9 changes: 5 additions & 4 deletions cpp/webdriver-server/webdriver-server.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,34 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{35A23A16-EF17-4CC3-8854-785025A304F3}</ProjectGuid>
<RootNamespace>webdriverserver</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
9 changes: 5 additions & 4 deletions third_party/cpp/civetweb/civetweb.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,30 @@
<ProjectGuid>{231A8BED-6F2D-4688-A3BD-920310621BBF}</ProjectGuid>
<RootNamespace>mongoose</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
9 changes: 5 additions & 4 deletions third_party/cpp/json-cpp/json-cpp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,30 @@
<ProjectGuid>{320F3BBE-8223-4E7F-ABEE-18D3BD57B1FD}</ProjectGuid>
<RootNamespace>JSON</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down

0 comments on commit 3d35c1c

Please sign in to comment.