mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 10:11:21 +00:00
[WELCOME!]: Fix CID 515150 (and warn if the app that we start cannot be started). By Ricardo Hanke.
CORE-9325 #resolve #comment Fixed, thanks! svn path=/trunk/; revision=66564
This commit is contained in:
parent
6e0183f1c0
commit
66e25b43b8
1 changed files with 28 additions and 4 deletions
|
@ -95,6 +95,28 @@ MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|||
|
||||
/* 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 @@ RunApplication(int nTopic)
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue