From 974e7aafa1aa3ad3959fc4eb29cd15a39d8a00fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Wed, 4 Mar 2015 22:37:51 +0000 Subject: [PATCH] [WELCOME]: Port all the extra features that we usually need for our custom releases for FOSDEM, CLT, etc... See r62439, r66116 and r66121 (in particular keep the feature, it can be useful for some cases. It's not because you remove it that you'll gain 100 MB in the CD-ROM!). svn path=/trunk/; revision=66567 --- reactos/base/setup/welcome/CMakeLists.txt | 2 +- reactos/base/setup/welcome/welcome.c | 47 ++++++++++++++++++++--- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/reactos/base/setup/welcome/CMakeLists.txt b/reactos/base/setup/welcome/CMakeLists.txt index 8783814865f..e82fa08a7b6 100644 --- a/reactos/base/setup/welcome/CMakeLists.txt +++ b/reactos/base/setup/welcome/CMakeLists.txt @@ -1,5 +1,5 @@ add_executable(welcome welcome.c welcome.rc) set_module_type(welcome win32gui UNICODE) -add_importlibs(welcome gdi32 user32 msvcrt kernel32 ntdll) +add_importlibs(welcome gdi32 user32 shell32 msvcrt kernel32 ntdll) add_cd_file(TARGET welcome DESTINATION reactos NO_CAB FOR bootcd) diff --git a/reactos/base/setup/welcome/welcome.c b/reactos/base/setup/welcome/welcome.c index b86de449129..87d7aeb523d 100644 --- a/reactos/base/setup/welcome/welcome.c +++ b/reactos/base/setup/welcome/welcome.c @@ -27,6 +27,8 @@ * This utility can be customized by modifying the resources. * Please do NOT change the source code in order to customize this * utility but change the resources! + * + * TODO: Use instead a XML file! */ #include @@ -34,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +50,13 @@ #define TITLE_HEIGHT 93 #define MAX_NUMBER_TOPICS 10 +#define TOPIC_DESC_LENGTH 1024 +/* + * Disable this define if you want to revert back to the old behaviour, i.e. + * opening files with CreateProcess. This defines uses ShellExecute instead. + */ +#define USE_SHELL_EXECUTE /* GLOBALS ******************************************************************/ @@ -97,6 +106,7 @@ MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); /* FUNCTIONS ****************************************************************/ +#ifndef USE_SHELL_EXECUTE static VOID ShowLastWin32Error(HWND hWnd) { @@ -118,6 +128,7 @@ ShowLastWin32Error(HWND hWnd) LocalFree(lpMessageBuffer); } } +#endif int WINAPI _tWinMain(HINSTANCE hInst, @@ -269,15 +280,21 @@ ButtonSubclassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static BOOL RunApplication(int nTopic) { +#ifndef USE_SHELL_EXECUTE PROCESS_INFORMATION ProcessInfo; STARTUPINFO StartupInfo; - TCHAR AppName[256]; TCHAR CurrentDir[256]; +#else + TCHAR Parameters[2]; +#endif + TCHAR AppName[512]; int nLength; InvalidateRect(hWndMain, NULL, TRUE); +#ifndef USE_SHELL_EXECUTE GetCurrentDirectory(ARRAYSIZE(CurrentDir), CurrentDir); +#endif nLength = LoadString(hInstance, IDS_TOPICACTION0 + nTopic, AppName, ARRAYSIZE(AppName)); if (nLength == 0) @@ -286,12 +303,29 @@ RunApplication(int nTopic) if (!_tcsicmp(AppName, TEXT(""))) return FALSE; - if (_tcsicmp(AppName, TEXT("explorer.exe")) == 0) + if (!_tcsnicmp(AppName, TEXT(""), 5)) { - _tcscat(AppName, TEXT(" ")); - _tcscat(AppName, CurrentDir); + MessageBox(hWndMain, AppName + 5, TEXT("ReactOS"), MB_OK | MB_TASKMODAL); + return TRUE; } + if (_tcsicmp(AppName, TEXT("explorer.exe")) == 0) + { +#ifndef USE_SHELL_EXECUTE + _tcscat(AppName, TEXT(" ")); + _tcscat(AppName, CurrentDir); +#else + _tcscpy(Parameters, TEXT("\\")); +#endif + } +#ifdef USE_SHELL_EXECUTE + else + { + *Parameters = 0; + } +#endif + +#ifndef USE_SHELL_EXECUTE ZeroMemory(&StartupInfo, sizeof(StartupInfo)); StartupInfo.cb = sizeof(StartupInfo); StartupInfo.lpTitle = TEXT("Test"); @@ -307,6 +341,9 @@ RunApplication(int nTopic) CloseHandle(ProcessInfo.hProcess); CloseHandle(ProcessInfo.hThread); +#else + ShellExecute(NULL, NULL, AppName, Parameters, NULL, SW_SHOWDEFAULT); +#endif return TRUE; } @@ -557,7 +594,7 @@ OnPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) HFONT hOldFont; RECT rcTitle, rcDescription; TCHAR szTopicTitle[80]; - TCHAR szTopicDesc[256]; + TCHAR szTopicDesc[TOPIC_DESC_LENGTH]; int nLength; BITMAP bmpInfo; TCHAR version[50];