Author: hbelusca
Date: Wed Mar 4 21:42:09 2015
New Revision: 66564
URL:
http://svn.reactos.org/svn/reactos?rev=66564&view=rev
Log:
[WELCOME!]: Fix CID 515150 (and warn if the app that we start cannot be started). By
Ricardo Hanke.
CORE-9325 #resolve #comment Fixed, thanks!
Modified:
trunk/reactos/base/setup/welcome/welcome.c
Modified: trunk/reactos/base/setup/welcome/welcome.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/welcome/welcome…
==============================================================================
--- trunk/reactos/base/setup/welcome/welcome.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/welcome/welcome.c [iso-8859-1] Wed Mar 4 21:42:09 2015
@@ -95,6 +95,28 @@
/* FUNCTIONS ****************************************************************/
+static VOID
+ShowLastWin32Error(HWND hwnd)
+{
+ LPTSTR lpMessageBuffer = NULL;
+ DWORD dwError = GetLastError();
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ dwError,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&lpMessageBuffer,
+ 0, NULL))
+ {
+ MessageBox(hwnd, lpMessageBuffer, szAppTitle, MB_OK | MB_ICONERROR);
+ }
+
+ if (lpMessageBuffer)
+ {
+ LocalFree(lpMessageBuffer);
+ }
+}
+
int WINAPI
_tWinMain(HINSTANCE hInst,
HINSTANCE hPrevInstance,
@@ -277,10 +299,12 @@
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOWNORMAL;
- CreateProcess(NULL, AppName, NULL, NULL, FALSE, CREATE_NEW_CONSOLE,NULL,
- CurrentDir,
- &StartupInfo,
- &ProcessInfo);
+ if (!CreateProcess(NULL, AppName, NULL, NULL, FALSE, CREATE_NEW_CONSOLE,
+ NULL, CurrentDir, &StartupInfo, &ProcessInfo))
+ {
+ ShowLastWin32Error(hwndMain);
+ return TRUE;
+ }
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);