aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/splashscreen.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-06-08 11:21:53 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-06-09 13:47:53 -0500
commitd47c73dbcd0a314cf3346b9b1294063ed4a124c4 (patch)
tree8ad3f401edd856ed7aaebba0306ee6d8972f2d13 /src/burn/engine/splashscreen.cpp
parent881a6c9bd0c3b3134277605824dd5a9ceaaf176d (diff)
downloadwix-d47c73dbcd0a314cf3346b9b1294063ed4a124c4.tar.gz
wix-d47c73dbcd0a314cf3346b9b1294063ed4a124c4.tar.bz2
wix-d47c73dbcd0a314cf3346b9b1294063ed4a124c4.zip
Show Burn splash screen earlier.
Make the initial Burn process show the splash screen, and show it before parsing the manifest. Fixes half of #5300
Diffstat (limited to 'src/burn/engine/splashscreen.cpp')
-rw-r--r--src/burn/engine/splashscreen.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/burn/engine/splashscreen.cpp b/src/burn/engine/splashscreen.cpp
index 90bd5203..ff61996f 100644
--- a/src/burn/engine/splashscreen.cpp
+++ b/src/burn/engine/splashscreen.cpp
@@ -3,7 +3,6 @@
3#include "precomp.h" 3#include "precomp.h"
4 4
5#define BURN_SPLASHSCREEN_CLASS_WINDOW L"WixBurnSplashScreen" 5#define BURN_SPLASHSCREEN_CLASS_WINDOW L"WixBurnSplashScreen"
6#define IDB_SPLASHSCREEN 1
7 6
8// struct 7// struct
9 8
@@ -21,12 +20,17 @@ struct SPLASHSCREEN_CONTEXT
21 HANDLE hInitializedEvent; 20 HANDLE hInitializedEvent;
22 HINSTANCE hInstance; 21 HINSTANCE hInstance;
23 LPCWSTR wzCaption; 22 LPCWSTR wzCaption;
23 BURN_SPLASH_SCREEN_CONFIGURATION* pSplashScreenConfiguration;
24 24
25 HWND* pHwnd; 25 HWND* pHwnd;
26}; 26};
27 27
28// internal function definitions 28// internal function definitions
29 29
30static HRESULT LoadConfiguration(
31 __in HINSTANCE hInstance,
32 __in BURN_SPLASH_SCREEN_CONFIGURATION** ppSplashScreenConfiguration
33 );
30static DWORD WINAPI ThreadProc( 34static DWORD WINAPI ThreadProc(
31 __in LPVOID pvContext 35 __in LPVOID pvContext
32 ); 36 );
@@ -74,6 +78,19 @@ extern "C" void SplashScreenCreate(
74 HANDLE rgSplashScreenEvents[2] = { }; 78 HANDLE rgSplashScreenEvents[2] = { };
75 DWORD dwSplashScreenThreadId = 0; 79 DWORD dwSplashScreenThreadId = 0;
76 80
81 hr = LoadConfiguration(hInstance, &context.pSplashScreenConfiguration);
82 ExitOnFailure(hr, "Failed to load splash screen configuration.");
83
84 switch (context.pSplashScreenConfiguration->type)
85 {
86 case BURN_SPLASH_SCREEN_TYPE_NONE:
87 ExitFunction();
88 case BURN_SPLASH_SCREEN_TYPE_BITMAP_RESOURCE:
89 break;
90 default:
91 ExitWithRootFailure(hr, E_INVALIDDATA, "Invalid splash screen type: %i", context.pSplashScreenConfiguration->type);
92 }
93
77 rgSplashScreenEvents[0] = ::CreateEventW(NULL, TRUE, FALSE, NULL); 94 rgSplashScreenEvents[0] = ::CreateEventW(NULL, TRUE, FALSE, NULL);
78 ExitOnNullWithLastError(rgSplashScreenEvents[0], hr, "Failed to create modal event."); 95 ExitOnNullWithLastError(rgSplashScreenEvents[0], hr, "Failed to create modal event.");
79 96
@@ -125,6 +142,24 @@ LExit:
125} 142}
126 143
127 144
145static HRESULT LoadConfiguration(
146 __in HINSTANCE hInstance,
147 __in BURN_SPLASH_SCREEN_CONFIGURATION** ppSplashScreenConfiguration
148 )
149{
150 HRESULT hr = S_OK;
151 DWORD cbData = 0;
152
153 hr = ResReadData(hInstance, MAKEINTRESOURCEA(IDD_BURN_SPLASH_SCREEN_CONFIGURATION), reinterpret_cast<PVOID*>(ppSplashScreenConfiguration), &cbData);
154 ExitOnFailure(hr, "Failed to read splash screen configuration resource.");
155
156 AssertSz(sizeof(BURN_SPLASH_SCREEN_CONFIGURATION) == cbData, "Splash screen configuration resource size is wrong");
157
158LExit:
159 return hr;
160}
161
162
128static DWORD WINAPI ThreadProc( 163static DWORD WINAPI ThreadProc(
129 __in LPVOID pvContext 164 __in LPVOID pvContext
130 ) 165 )
@@ -242,7 +277,7 @@ static HRESULT LoadSplashScreen(
242 RECT* pMonitorRect = NULL; 277 RECT* pMonitorRect = NULL;
243 278
244 pSplashScreen->nDpi = USER_DEFAULT_SCREEN_DPI; 279 pSplashScreen->nDpi = USER_DEFAULT_SCREEN_DPI;
245 pSplashScreen->hBitmap = ::LoadBitmapW(pContext->hInstance, MAKEINTRESOURCEW(IDB_SPLASHSCREEN)); 280 pSplashScreen->hBitmap = ::LoadBitmapW(pContext->hInstance, MAKEINTRESOURCEW(pContext->pSplashScreenConfiguration->wResourceId));
246 ExitOnNullWithLastError(pSplashScreen->hBitmap, hr, "Failed to load splash screen bitmap."); 281 ExitOnNullWithLastError(pSplashScreen->hBitmap, hr, "Failed to load splash screen bitmap.");
247 282
248 ::GetObject(pSplashScreen->hBitmap, sizeof(bmp), static_cast<void*>(&bmp)); 283 ::GetObject(pSplashScreen->hBitmap, sizeof(bmp), static_cast<void*>(&bmp));