Turn WinLauncher into a stub .exe launcher and a .dll that contains all the real...
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jan 2012 14:52:23 +0000 (14:52 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jan 2012 14:52:23 +0000 (14:52 +0000)
commitc15a689d355569a280c1167dc7858b6ddfd80f13
tree2dd59985aff58ba84cd04433a970432f7af59a78
parente2a581e3d670fbaffbcbb99f37bb78616a5acb7b
Turn WinLauncher into a stub .exe launcher and a .dll that contains all the real code

This allows us to add the Apple Application Support directory to PATH before trying to load
WebKit so that CoreGraphics.dll and friends can be found. Eventually all our WebKit apps
should use this mechanism.

Fixes <http://webkit.org/b/68578> <rdar://problem/10163861> WinLauncher fails to launch when
double-clicked

Reviewed by Anders Carlsson.

Tools:

* WinLauncher/WinLauncher.cpp: Removed InitInstance.
(DllMain): Added. Stores the DLL HINSTANCE in the global hInst variable. This used to be
done by the now-removed InitInstance function.
(dllLauncherEntryPoint): Renamed from _tWinMain. This is the function that our stub launcher
calls. Merged code from InitInstance into this function, and change to use the global hInst
variable, which corresponds to WinLauncher.dll, rather than the HINSTANCE passed into this
function, which corresponds to WinLauncher.exe.

* WinLauncher/WinLauncher.vcproj:
* WinLauncher/WinLauncherCommon.vsprops:
Changed to build WinLauncher.dll instead of WinLauncher.exe.

* WinLauncher/WinLauncherLauncher.rc: Added.
* WinLauncher/WinLauncherLauncherResource.h: Added.
This just references the WinLauncher.ico file to set the application icon (though it looks
like that's a default icon).

* WinLauncher/WinLauncherLauncher.vcproj: Copied from Tools/WinLauncher/WinLauncher.vcproj
but changed to build WinLauncher.exe using the new DLLLauncherMain.cpp file.

* WinLauncher/WinLauncherLauncherCommon.vsprops: Added.
* WinLauncher/WinLauncherLauncherDebug.vsprops: Added.
* WinLauncher/WinLauncherLauncherDebugAll.vsprops: Added.
* WinLauncher/WinLauncherLauncherDebugCairoCFLite.vsprops: Added.
* WinLauncher/WinLauncherLauncherProduction.vsprops: Added.
* WinLauncher/WinLauncherLauncherRelease.vsprops: Added.
* WinLauncher/WinLauncherLauncherReleaseCairoCFLite.vsprops: Added.

* win/DLLLauncher/DLLLauncherMain.cpp: Added.
(enableTerminationOnHeapCorruption): Uses HeapSetInformation to tell Windows to kill the
program if it detects heap corruption.
(getStringValue): Helper function to read a string value from the registry.
(applePathFromRegistry): Helper function to read the InstallDir for a given Apple
application from the registry.
(appleApplicationSupportDirectory): Helper function to return the path to the Apple
Application Support directory.
(copyEnvironmentVariable): Helper function to copy an environment variable's value.
(prependPath): Helper function to prepend a directory to the PATH.
(fatalError): Helper function to display an error to the user.
(wWinMain): Add Apple Application Support to the PATH, then load our DLL and call its
dllLauncherEntryPoint function.

Source/WebKit/win:

Add WinLauncherLauncher to WebKit.sln

It builds just after WinLauncher.

* WebKit.vcproj/WebKit.sln: Added WinLauncherLauncher.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@104153 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebKit.vcproj/WebKit.sln
Tools/ChangeLog
Tools/WinLauncher/WinLauncher.cpp
Tools/WinLauncher/WinLauncher.vcproj
Tools/WinLauncher/WinLauncherCommon.vsprops
Tools/WinLauncher/WinLauncherLauncher.rc [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncher.vcproj [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncherCommon.vsprops [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncherDebug.vsprops [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncherDebugAll.vsprops [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncherDebugCairoCFLite.vsprops [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncherProduction.vsprops [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncherRelease.vsprops [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncherReleaseCairoCFLite.vsprops [new file with mode: 0644]
Tools/WinLauncher/WinLauncherLauncherResource.h [new file with mode: 0644]
Tools/win/DLLLauncher/DLLLauncherMain.cpp [new file with mode: 0644]