From 1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Wed, 17 Dec 2008 18:05:15 -0800 Subject: Code drop from //branches/cupcake/...@124589 --- WebKitTools/FindSafari/FindSafari.cpp | 80 +++++++++++++++++- WebKitTools/FindSafari/FindSafari.rc | 70 ++++++++++++++++ WebKitTools/FindSafari/FindSafari.vcproj | 75 +++-------------- WebKitTools/FindSafari/Safari.exe.manifest | 129 +++++++++++++++++++++++++++++ WebKitTools/FindSafari/resource.h | 16 ++++ 5 files changed, 303 insertions(+), 67 deletions(-) create mode 100644 WebKitTools/FindSafari/FindSafari.rc create mode 100644 WebKitTools/FindSafari/Safari.exe.manifest create mode 100644 WebKitTools/FindSafari/resource.h (limited to 'WebKitTools/FindSafari') diff --git a/WebKitTools/FindSafari/FindSafari.cpp b/WebKitTools/FindSafari/FindSafari.cpp index bc31eda..616323b 100644 --- a/WebKitTools/FindSafari/FindSafari.cpp +++ b/WebKitTools/FindSafari/FindSafari.cpp @@ -26,6 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "resource.h" + #include #include #include @@ -120,6 +122,62 @@ static TCHAR* getInstalledWebKitDirectory() return webKitPath; } +static char* copyManifest(HMODULE module, LPCTSTR id) +{ + HRSRC resHandle = FindResource(module, id, MAKEINTRESOURCE(RT_MANIFEST)); + if (!resHandle) + return 0; + DWORD manifestSize = SizeofResource(module, resHandle); + if (!manifestSize) + return 0; + HGLOBAL resData = LoadResource(module, resHandle); + if (!resData) + return 0; + void* data = LockResource(resData); + if (!data) + return 0; + + char* dataCopy = static_cast(malloc(manifestSize + 1)); + if (!dataCopy) + return 0; + memcpy(dataCopy, data, manifestSize); + dataCopy[manifestSize] = 0; + return dataCopy; +} + +static void replaceManifest() +{ + TCHAR safariPath[MAX_PATH]; + ::ExpandEnvironmentStrings(TEXT("%TMP%\\WebKitNightly\\Safari.exe"), safariPath, ARRAYSIZE(safariPath)); + + // get the existing manifest out of Safari.exe + HMODULE safariModule = LoadLibraryEx(safariPath, 0, LOAD_LIBRARY_AS_DATAFILE); + if (!safariModule) + return; + char* safariManifest = copyManifest(safariModule, MAKEINTRESOURCE(1)); + FreeLibrary(safariModule); + if (!safariManifest) + return; + + // see if the existing Safari manifest contains registry free COM info + // (we only need to update if it is not registry free COM-aware) + bool needsUpdate = !strstr(safariManifest, "NUL \"%%TMP%%\\WebKitNightly\\Safari.resources\""), + TEXT("mkdir 2>NUL \"%%TMP%%\\WebKitNightly\\WebKit.resources\""), TEXT("xcopy /y /i /d \"%sSafari.exe\" \"%%TMP%%\\WebKitNightly\""), TEXT("xcopy /y /i /d /e \"%sSafari.resources\" \"%%TMP%%\\WebKitNightly\\Safari.resources\""), + TEXT("xcopy /y /i /d /e \"%splugins\" \"%%TMP%%\\WebKitNightly\\plugins\""), + TEXT("xcopy /y /i /d WebKit.dll \"%%TMP%%\\WebKitNightly\""), + TEXT("xcopy /y /i /d WebKit.pdb \"%%TMP%%\\WebKitNightly\""), + TEXT("xcopy /y /i /d /e WebKit.resources \"%%TMP%%\\WebKitNightly\\WebKit.resources\""), + TEXT("FindSafari.exe /updateManifest"), TEXT("set PATH=%%CD%%;%s;%%PATH%%"), }; - LPCTSTR command = TEXT("\"%TMP%\\WebKitNightly\\Safari.exe\" /customWebKit"); + LPCTSTR command = TEXT("\"%TMP%\\WebKitNightly\\Safari.exe\""); LPCTSTR launchLines[] = { TEXT("%s"), @@ -194,7 +270,7 @@ int _tmain(int argc, TCHAR* argv[]) _tprintf(TEXT("\n")); } } - + free(path); return 0; } diff --git a/WebKitTools/FindSafari/FindSafari.rc b/WebKitTools/FindSafari/FindSafari.rc new file mode 100644 index 0000000..20c2da2 --- /dev/null +++ b/WebKitTools/FindSafari/FindSafari.rc @@ -0,0 +1,70 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +IDR_SAFARI_MANIFEST RT_MANIFEST "Safari.exe.manifest" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/WebKitTools/FindSafari/FindSafari.vcproj b/WebKitTools/FindSafari/FindSafari.vcproj index 4e89cd0..48ea3df 100644 --- a/WebKitTools/FindSafari/FindSafari.vcproj +++ b/WebKitTools/FindSafari/FindSafari.vcproj @@ -15,74 +15,10 @@ - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/WebKitTools/FindSafari/Safari.exe.manifest b/WebKitTools/FindSafari/Safari.exe.manifest new file mode 100644 index 0000000..08c85cf --- /dev/null +++ b/WebKitTools/FindSafari/Safari.exe.manifest @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebKitTools/FindSafari/resource.h b/WebKitTools/FindSafari/resource.h new file mode 100644 index 0000000..91d1053 --- /dev/null +++ b/WebKitTools/FindSafari/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by FindSafari.rc +// +#define IDR_SAFARI_MANIFEST 100 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif -- cgit v1.1