+2007-09-25 Adam Roben <aroben@apple.com>
+
+ Make testkjs use WebKitInitializer
+
+ Reviewed by Sam.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Add WebKitInitializer and
+ make testkjs depend on it.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
+ WebKitInitializer.lib.
+ * kjs/testkjs.cpp:
+ (main): Call initializeWebKit.
+
2007-09-24 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testkjs", "testkjs\testkjs.vcproj", "{C59E5129-B453-49B7-A52B-1E104715F76E}"\r
ProjectSection(ProjectDependencies) = postProject\r
{AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}\r
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02} = {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}\r
{011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}\r
EndProjectSection\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTF", "WTF\WTF.vcproj", "{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"\r
EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKitInitializer", "..\..\WebKitTools\WebKitInitializer\WebKitInitializer.vcproj", "{9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}"\r
+EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
Debug_Internal|Win32 = Debug_Internal|Win32\r
{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.Build.0 = Debug|Win32\r
{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.ActiveCfg = Release|Win32\r
{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.Build.0 = Release|Win32\r
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug_Internal|Win32.ActiveCfg = Debug|Win32\r
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug_Internal|Win32.Build.0 = Debug|Win32\r
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug|Win32.Build.0 = Debug|Win32\r
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Release|Win32.ActiveCfg = Release|Win32\r
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Release|Win32.Build.0 = Release|Win32\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitLibrariesDir)\include\icu";../../../icu/include"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\include";"$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitLibrariesDir)\include\icu";../../../icu/include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE; WIN32"
MinimalRebuild="true"
ExceptionHandling="0"
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
- AdditionalDependencies="JavaScriptCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="JavaScriptCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitInitializer$(WebKitConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib";..\..\..\icu\lib"
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitLibrariesDir)\include\icu";../../../icu/include"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\include";"$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitLibrariesDir)\include\icu";../../../icu/include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE; WIN32"
ExceptionHandling="0"
RuntimeLibrary="2"
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
- AdditionalDependencies="JavaScriptCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="JavaScriptCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitInitializer$(WebKitConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).exe"
LinkIncremental="1"
AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib";..\..\..\icu\lib"
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitLibrariesDir)\include\icu";../../../icu/include"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\include";"$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitLibrariesDir)\include\icu";../../../icu/include"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE; WIN32"
MinimalRebuild="true"
ExceptionHandling="0"
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
- AdditionalDependencies="JavaScriptCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib"
+ AdditionalDependencies="JavaScriptCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitInitializer$(WebKitConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib";..\..\..\icu\lib"
#include "protect.h"
#if PLATFORM(WIN_OS)
+#include <WebKitInitializer/WebKitInitializer.h>
#include <windows.h>
#include <crtdbg.h>
#endif
int main(int argc, char** argv)
{
+#if PLATFORM(WIN_OS)
+ if (!initializeWebKit()) {
+ fprintf(stderr, "Failed to initialize WebKit\n");
+ abort();
+ }
+#endif
#if defined(_DEBUG) && PLATFORM(WIN_OS)
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+2007-09-25 Adam Roben <aroben@apple.com>
+
+ Add WebKitInitializer to WebKit.sln
+
+ Reviewed by Sam.
+
+ * WebKit.vcproj/WebKit.sln: DumpRenderTree and testkjs now depend on
+ WebKitInitializer.
+
2007-09-25 Darin Adler <darin@apple.com>
Reviewed by Steve.
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DumpRenderTree", "..\..\..\WebKitTools\DumpRenderTree\win\DumpRenderTree.vcproj", "{6567DFD4-D6DE-4CD5-825D-17E353D160E1}"
ProjectSection(ProjectDependencies) = postProject
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02} = {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}
{0662A8A9-82A3-4638-97D8-EC425D8D87C9} = {0662A8A9-82A3-4638-97D8-EC425D8D87C9}
EndProjectSection
EndProject
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testkjs", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\testkjs\testkjs.vcproj", "{C59E5129-B453-49B7-A52B-1E104715F76E}"
ProjectSection(ProjectDependencies) = postProject
- {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
{AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02} = {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dftables", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\dftables\dftables.vcproj", "{BC2981C0-67A5-4A3C-879B-784BCBDE2541}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTF", "..\..\..\JavaScriptCore\JavaScriptCore.vcproj\WTF\WTF.vcproj", "{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKitInitializer", "..\..\..\WebKitTools\WebKitInitializer\WebKitInitializer.vcproj", "{9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.Build.0 = Debug|Win32
{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.ActiveCfg = Release|Win32
{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.Build.0 = Release|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug|Win32.Build.0 = Debug|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Release|Win32.ActiveCfg = Release|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+2007-09-25 Adam Roben <aroben@apple.com>
+
+ Add WebKitInitializer and use it in DumpRenderTree
+
+ WebKitInitializer is a static library that has one function,
+ initializeWebKit(). This registers WebKit and sets up the DLL search
+ path so that WebKit's dependencies that are installed with Safari can
+ be found.
+
+ Reviewed by Sam.
+
+ * DumpRenderTree/DumpRenderTree.sln: Added WebKitInitializer and made
+ DumpRenderTree depend on it.
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (initialize): Call initializeWebKit.
+ * DumpRenderTree/win/DumpRenderTree.vcproj: Link against
+ WebKitInitializer.lib.
+ * WebKitInitializer/WebKitInitializer.cpp: Added.
+ (getStringValue):
+ (getWebViewCLSID):
+ (getInstalledWebKitDirectory):
+ (initializeWebKit):
+ * WebKitInitializer/WebKitInitializer.h: Added.
+ * WebKitInitializer/WebKitInitializer.vcproj: Added.
+ * WebKitInitializer/debug.vsprops: Added.
+ * WebKitInitializer/release.vsprops: Added.
+
2007-09-25 Adam Roben <aroben@apple.com>
Make run-webkit-tests respect set-webkit-configuration
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DumpRenderTree", "win\DumpRenderTree.vcproj", "{6567DFD4-D6DE-4CD5-825D-17E353D160E1}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
+ ProjectSection(ProjectDependencies) = postProject
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02} = {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestNetscapePlugin", "win\TestNetscapePlugin\TestNetscapePlugin.vcproj", "{C0737398-3565-439E-A2B8-AB2BE4D5430C}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebKitInitializer", "..\WebKitInitializer\WebKitInitializer.vcproj", "{9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.Build.0 = Debug|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.ActiveCfg = Release|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Release|Win32.Build.0 = Release|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug_Internal|Win32.ActiveCfg = Debug|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug_Internal|Win32.Build.0 = Debug|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Debug|Win32.Build.0 = Debug|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Release|Win32.ActiveCfg = Release|Win32
+ {9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
#include <pthread.h>
#include <string>
#include <tchar.h>
+#include <WebKitInitializer/WebKitInitializer.h>
#include <WebKit/DOMPrivate.h>
#include <WebKit/IWebFramePrivate.h>
#include <WebKit/IWebHistoryItem.h>
static wstring initialize(HMODULE hModule)
{
-#ifdef NDEBUG
- HMODULE webKitModule = LoadLibraryW(L"WebKit.dll");
-#else
- HMODULE webKitModule = LoadLibraryW(L"WebKit_debug.dll");
-#endif
- FARPROC dllRegisterServer = ::GetProcAddress(webKitModule, "DllRegisterServer");
- dllRegisterServer();
+ if (!initializeWebKit()) {
+ fprintf(stderr, "WebKit failed to initialize\n");
+ abort();
+ }
static LPCTSTR fontsToInstall[] = {
TEXT("AHEM____.ttf"),
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib"
+ AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitInitializer$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib";"$(WebKitOutputDir)\bin""
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib"
+ AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitInitializer$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).exe"
LinkIncremental="1"
AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib";"$(WebKitOutputDir)\bin""
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib"
+ AdditionalDependencies="WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitInitializer$(WebKitConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib gdi32.lib ole32.lib oleaut32.lib user32.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib";"$(WebKitOutputDir)\bin""
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebKitInitializer.h"
+
+// Needed to get SetDllDirectory
+#define _WIN32_WINNT 0x0502
+
+#include <shlwapi.h>
+#include <tchar.h>
+#include <windows.h>
+
+static TCHAR* getStringValue(HKEY key, LPCTSTR valueName)
+{
+ DWORD type = 0;
+ DWORD bufferSize = 0;
+ if (RegQueryValueEx(key, valueName, 0, &type, 0, &bufferSize) != ERROR_SUCCESS || type != REG_SZ)
+ return 0;
+
+ TCHAR* buffer = new TCHAR[bufferSize / sizeof(TCHAR)];
+ if (RegQueryValueEx(key, 0, 0, &type, reinterpret_cast<LPBYTE>(buffer), &bufferSize) != ERROR_SUCCESS) {
+ delete [] buffer;
+ return 0;
+ }
+
+ return buffer;
+}
+
+static LPOLESTR getWebViewCLSID()
+{
+ // FIXME <rdar://5505062>: Once WebKit switches to truly version-independent
+ // ProgIDs, this should just become "WebKit.WebView".
+ LPCTSTR webViewProgID = TEXT("WebKit.WebView.3");
+
+ CLSID clsid = CLSID_NULL;
+ HRESULT hr = CLSIDFromProgID(webViewProgID, &clsid);
+ if (FAILED(hr)) {
+ _ftprintf(stderr, TEXT("Failed to get CLSID for %s\n"), webViewProgID);
+ return 0;
+ }
+
+ LPOLESTR clsidString = 0;
+ if (FAILED(StringFromCLSID(clsid, &clsidString))) {
+ _ftprintf(stderr, TEXT("Failed to get string representation of CLSID for WebView\n"));
+ return 0;
+ }
+
+ return clsidString;
+}
+
+static TCHAR* getInstalledWebKitDirectory()
+{
+ LPCTSTR keyPrefix = TEXT("SOFTWARE\\Classes\\CLSID\\");
+ LPCTSTR keySuffix = TEXT("\\InprocServer32");
+
+ LPOLESTR clsid = getWebViewCLSID();
+ if (!clsid)
+ return 0;
+
+ size_t keyBufferLength = _tcslen(keyPrefix) + _tcslen(clsid) + _tcslen(keySuffix) + 1;
+ TCHAR* keyString = new TCHAR[keyBufferLength];
+
+ int ret = _sntprintf_s(keyString, keyBufferLength, keyBufferLength - 1, TEXT("%s%s%s"), keyPrefix, clsid, keySuffix);
+ CoTaskMemFree(clsid);
+ if (ret == -1) {
+ _ftprintf(stderr, TEXT("Failed to construct InprocServer32 key\n"));
+ return 0;
+ }
+
+ HKEY serverKey = 0;
+ LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyString, 0, KEY_READ, &serverKey);
+ delete [] keyString;
+ if (error != ERROR_SUCCESS) {
+ _ftprintf(stderr, TEXT("Failed to open registry key %s\n"), keyString);
+ return 0;
+ }
+
+ TCHAR* webKitPath = getStringValue(serverKey, 0);
+ RegCloseKey(serverKey);
+ if (!webKitPath) {
+ _ftprintf(stderr, TEXT("Couldn't retrieve value for registry key %s\n"), keyString);
+ return 0;
+ }
+
+ TCHAR* startOfFileName = PathFindFileName(webKitPath);
+ if (startOfFileName == webKitPath) {
+ _ftprintf(stderr, TEXT("Couldn't find filename from path %s\n"), webKitPath);
+ delete [] webKitPath;
+ return 0;
+ }
+
+ *startOfFileName = '\0';
+ return webKitPath;
+}
+
+bool initializeWebKit()
+{
+ static bool haveInitialized;
+ static bool success;
+ if (haveInitialized)
+ return success;
+ haveInitialized = true;
+
+#ifdef NDEBUG
+ LPCTSTR webKitDLL = TEXT("WebKit.dll");
+#else
+ LPCTSTR webKitDLL = TEXT("WebKit_debug.dll");
+#endif
+
+ HMODULE webKitModule = LoadLibrary(webKitDLL);
+ if (!webKitModule) {
+ _ftprintf(stderr, TEXT("LoadLibrary(%s) failed\n"), webKitDLL);
+ return false;
+ }
+
+ FARPROC dllRegisterServer = GetProcAddress(webKitModule, "DllRegisterServer");
+ if (!dllRegisterServer) {
+ _ftprintf(stderr, TEXT("GetProcAddress(\"DllRegisterServer\") failed\n"));
+ return false;
+ }
+
+ dllRegisterServer();
+
+ TCHAR* directory = getInstalledWebKitDirectory();
+ if (!directory) {
+ _ftprintf(stderr, TEXT("Couldn't determine installed WebKit directory\n"));
+ return false;
+ }
+
+ SetDllDirectory(directory);
+ delete [] directory;
+
+ success = true;
+ return success;
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+bool initializeWebKit();
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="WebKitInitializer"
+ ProjectGUID="{9E96B9B5-0CCB-47F8-A95E-C25ABE049E02}"
+ RootNamespace="WebKitInitializer"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets=".\debug.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ WarningLevel="4"
+ WarnAsError="true"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="shlwapi.lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitInitializer"
xcopy /y /d "$(InputDir)*.h" "$(WebKitOutputDir)\include\WebKitInitializer""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets=".\release.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeLibrary="2"
+ WarningLevel="4"
+ WarnAsError="true"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="shlwapi.lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKitInitializer"
xcopy /y /d "$(InputDir)*.h" "$(WebKitOutputDir)\include\WebKitInitializer""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\WebKitInitializer.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\WebKitInitializer.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="debug"
+ >
+ <UserMacro
+ Name="WebKitConfigSuffix"
+ Value="_debug"
+ />
+</VisualStudioPropertySheet>
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="release"
+ >
+ <UserMacro
+ Name="WebKitConfigSuffix"
+ Value=""
+ />
+</VisualStudioPropertySheet>