-/* $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
NULL,
(HINSTANCE) GetModuleHandleW(NULL),
(PVOID) Console);
-Console->hWindow = NewWindow;
+ Console->hWindow = NewWindow;
if (NULL != NewWindow)
{
SetWindowLongW(hWnd, GWL_USERDATA, GetWindowLongW(hWnd, GWL_USERDATA) + 1);
NotifyWnd = NULL;
DestroyWindow(hWnd);
PrivateCsrssManualGuiCheck(-1);
+ PostQuitMessage(0);
}
return 0;
default:
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,
if (NULL == NotifyWnd)
{
PrivateCsrssManualGuiCheck(-1);
- NtSetEvent(*GraphicsStartupEvent, 0);
+ SetEvent(*GraphicsStartupEvent);
return 1;
}
- NtSetEvent(*GraphicsStartupEvent, 0);
+ SetEvent(*GraphicsStartupEvent);
while(GetMessageW(&msg, NULL, 0, 0))
{
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)
return;
}
- InitializeObjectAttributes(&ObjectAttributes, NULL, OBJ_INHERIT, NULL, NULL);
-
- Status = NtCreateEvent(&GraphicsStartupEvent, STANDARD_RIGHTS_ALL, &ObjectAttributes, FALSE, FALSE);
- if( !NT_SUCCESS(Status))
- {
- return;
- }
-
- ThreadHandle = CreateThread(NULL,
- 0,
- GuiConsoleGuiThread,
- (PVOID) &GraphicsStartupEvent,
- 0,
- NULL);
- if (NULL == ThreadHandle)
+ 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)
{
- NtClose(GraphicsStartupEvent);
- DbgPrint("Win32Csr: Failed to create graphics console thread. Expect problems\n");
return;
}
- CloseHandle(ThreadHandle);
-
- NtWaitForSingleObject(GraphicsStartupEvent, FALSE, NULL);
- NtClose(GraphicsStartupEvent);
- if (NULL == NotifyWnd)
+ 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)
{
- DbgPrint("Win32Csr: Failed to create notification window.\n");
return;
}
}
BOOL STDCALL
GuiConsoleInitConsole(PCSRSS_CONSOLE Console)
{
+ HANDLE GraphicsStartupEvent;
+ HANDLE ThreadHandle;
+
Console->Size.X = 80;
Console->Size.Y = 25;
-#ifdef TODO
- Console->hWindow = (HWND) SendMessageW(NotifyWnd, PM_CREATE_CONSOLE, 0, (LPARAM) Console);
+ if (NULL == NotifyWnd)
+ {
+ GraphicsStartupEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+ if (NULL == GraphicsStartupEvent)
+ {
+ return FALSE;
+ }
+
+ ThreadHandle = CreateThread(NULL,
+ 0,
+ GuiConsoleGuiThread,
+ (PVOID) &GraphicsStartupEvent,
+ 0,
+ NULL);
+ if (NULL == ThreadHandle)
+ {
+ NtClose(GraphicsStartupEvent);
+ DbgPrint("Win32Csr: Failed to create graphics console thread. Expect problems\n");
+ return FALSE;
+ }
+ CloseHandle(ThreadHandle);
+
+ WaitForSingleObject(GraphicsStartupEvent, INFINITE);
+ CloseHandle(GraphicsStartupEvent);
+
+ if (NULL == NotifyWnd)
+ {
+ DbgPrint("Win32Csr: Failed to create notification window.\n");
+ return FALSE;
+ }
+ }
- return NULL != Console->hWindow;
-#else
PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, 0, (LPARAM) Console);
return TRUE;
-#endif
}
VOID STDCALL