diff options
Diffstat (limited to 'src/burn/engine/splashscreen.cpp')
-rw-r--r-- | src/burn/engine/splashscreen.cpp | 39 |
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 | ||
30 | static HRESULT LoadConfiguration( | ||
31 | __in HINSTANCE hInstance, | ||
32 | __in BURN_SPLASH_SCREEN_CONFIGURATION** ppSplashScreenConfiguration | ||
33 | ); | ||
30 | static DWORD WINAPI ThreadProc( | 34 | static 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 | ||
145 | static 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 | |||
158 | LExit: | ||
159 | return hr; | ||
160 | } | ||
161 | |||
162 | |||
128 | static DWORD WINAPI ThreadProc( | 163 | static 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)); |