Re-create notification window when needed

svn path=/trunk/; revision=7375
This commit is contained in:
Gé van Geldorp 2003-12-31 20:16:39 +00:00
parent eba8b31ea1
commit 769dcae440

View file

@ -1,4 +1,4 @@
/* $Id: guiconsole.c,v 1.5 2003/12/27 18:25:31 gvg Exp $
/* $Id: guiconsole.c,v 1.6 2003/12/31 20:16:39 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -501,6 +501,7 @@ Console->hWindow = NewWindow;
NotifyWnd = NULL;
DestroyWindow(hWnd);
PrivateCsrssManualGuiCheck(-1);
PostQuitMessage(0);
}
return 0;
default:
@ -511,46 +512,11 @@ Console->hWindow = NewWindow;
static DWORD STDCALL
GuiConsoleGuiThread(PVOID Data)
{
WNDCLASSW wc;
MSG msg;
PHANDLE GraphicsStartupEvent = (PHANDLE) Data;
PrivateCsrssManualGuiCheck(+1);
wc.lpszClassName = L"Win32CsrCreateNotify";
wc.lpfnWndProc = GuiConsoleNotifyWndProc;
wc.style = 0;
wc.hInstance = (HINSTANCE) GetModuleHandleW(NULL);
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClassW(&wc) == 0)
{
PrivateCsrssManualGuiCheck(-1);
NtSetEvent(*GraphicsStartupEvent, 0);
return 1;
}
wc.lpszClassName = L"Win32CsrConsole";
wc.lpfnWndProc = GuiConsoleWndProc;
wc.style = 0;
wc.hInstance = (HINSTANCE) GetModuleHandleW(NULL);
wc.hIcon = LoadIconW(NULL, (LPCWSTR) IDI_APPLICATION);
wc.hCursor = LoadCursorW(NULL, (LPCWSTR) IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClassW(&wc) == 0)
{
PrivateCsrssManualGuiCheck(-1);
NtSetEvent(*GraphicsStartupEvent, 0);
return 1;
}
NotifyWnd = CreateWindowW(L"Win32CsrCreateNotify",
L"",
WS_OVERLAPPEDWINDOW,
@ -565,11 +531,11 @@ GuiConsoleGuiThread(PVOID Data)
if (NULL == NotifyWnd)
{
PrivateCsrssManualGuiCheck(-1);
NtSetEvent(*GraphicsStartupEvent, 0);
SetEvent(*GraphicsStartupEvent);
return 1;
}
NtSetEvent(*GraphicsStartupEvent, 0);
SetEvent(*GraphicsStartupEvent);
while(GetMessageW(&msg, NULL, 0, 0))
{
@ -583,11 +549,9 @@ GuiConsoleGuiThread(PVOID Data)
VOID FASTCALL
GuiConsoleInitConsoleSupport(VOID)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE GraphicsStartupEvent;
HDESK Desktop;
HANDLE ThreadHandle;
NTSTATUS Status;
WNDCLASSW wc;
Desktop = OpenDesktopW(L"Default", 0, FALSE, GENERIC_ALL);
if (NULL == Desktop)
@ -610,14 +574,53 @@ GuiConsoleInitConsoleSupport(VOID)
return;
}
InitializeObjectAttributes(&ObjectAttributes, NULL, OBJ_INHERIT, NULL, NULL);
Status = NtCreateEvent(&GraphicsStartupEvent, STANDARD_RIGHTS_ALL, &ObjectAttributes, FALSE, FALSE);
if( !NT_SUCCESS(Status))
wc.lpszClassName = L"Win32CsrCreateNotify";
wc.lpfnWndProc = GuiConsoleNotifyWndProc;
wc.style = 0;
wc.hInstance = (HINSTANCE) GetModuleHandleW(NULL);
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClassW(&wc) == 0)
{
return;
}
wc.lpszClassName = L"Win32CsrConsole";
wc.lpfnWndProc = GuiConsoleWndProc;
wc.style = 0;
wc.hInstance = (HINSTANCE) GetModuleHandleW(NULL);
wc.hIcon = LoadIconW(NULL, (LPCWSTR) IDI_APPLICATION);
wc.hCursor = LoadCursorW(NULL, (LPCWSTR) IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClassW(&wc) == 0)
{
return;
}
}
BOOL STDCALL
GuiConsoleInitConsole(PCSRSS_CONSOLE Console)
{
HANDLE GraphicsStartupEvent;
HANDLE ThreadHandle;
Console->Size.X = 80;
Console->Size.Y = 25;
if (NULL == NotifyWnd)
{
GraphicsStartupEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (NULL == GraphicsStartupEvent)
{
return FALSE;
}
ThreadHandle = CreateThread(NULL,
0,
GuiConsoleGuiThread,
@ -628,34 +631,23 @@ GuiConsoleInitConsoleSupport(VOID)
{
NtClose(GraphicsStartupEvent);
DbgPrint("Win32Csr: Failed to create graphics console thread. Expect problems\n");
return;
return FALSE;
}
CloseHandle(ThreadHandle);
NtWaitForSingleObject(GraphicsStartupEvent, FALSE, NULL);
NtClose(GraphicsStartupEvent);
WaitForSingleObject(GraphicsStartupEvent, INFINITE);
CloseHandle(GraphicsStartupEvent);
if (NULL == NotifyWnd)
{
DbgPrint("Win32Csr: Failed to create notification window.\n");
return;
return FALSE;
}
}
BOOL STDCALL
GuiConsoleInitConsole(PCSRSS_CONSOLE Console)
{
Console->Size.X = 80;
Console->Size.Y = 25;
#ifdef TODO
Console->hWindow = (HWND) SendMessageW(NotifyWnd, PM_CREATE_CONSOLE, 0, (LPARAM) Console);
return NULL != Console->hWindow;
#else
PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, 0, (LPARAM) Console);
return TRUE;
#endif
}
VOID STDCALL