-/* $Id: init.c,v 1.8 2000/04/23 17:44:53 phreak Exp $
+/* $Id: init.c,v 1.20 2003/08/11 18:50:12 chorns Exp $
*
* reactos/subsys/csrss/init.c
*
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include <csrss/csrss.h>
+#include <win32k/win32k.h>
#include "api.h"
+#define NDEBUG
+#include <debug.h>
+
/* GLOBALS ******************************************************************/
/*
extern HANDLE CsrssApiHeap;
+ULONG
+InitializeVideoAddressSpace(VOID);
+
static NTSTATUS
CsrParseCommandLine (
ULONG ArgumentCount,
ULONG i;
- DbgPrint ("Arguments: %ld\n", ArgumentCount);
+ /* DbgPrint ("Arguments: %ld\n", ArgumentCount);
for (i = 0; i < ArgumentCount; i++)
{
DbgPrint ("Argument %ld: %S\n", i, ArgumentArray[i]);
- }
+ }*/
/* create object directory ('\Windows') */
}
+static VOID
+CsrInitVideo(VOID)
+{
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING DeviceName;
+ IO_STATUS_BLOCK Iosb;
+ HANDLE VideoHandle;
+ NTSTATUS Status;
+
+ InitializeVideoAddressSpace();
+
+ RtlInitUnicodeStringFromLiteral(&DeviceName, L"\\??\\DISPLAY1");
+ InitializeObjectAttributes(&ObjectAttributes,
+ &DeviceName,
+ 0,
+ NULL,
+ NULL);
+ Status = NtOpenFile(&VideoHandle,
+ FILE_ALL_ACCESS,
+ &ObjectAttributes,
+ &Iosb,
+ 0,
+ 0);
+ if (NT_SUCCESS(Status))
+ {
+ NtClose(VideoHandle);
+ }
+}
+
+
/**********************************************************************
* NAME
* CsrServerInitialization
NTSTATUS Status;
OBJECT_ATTRIBUTES ObAttributes;
UNICODE_STRING PortName;
+ OBJECT_ATTRIBUTES RefreshEventAttr;
+ UNICODE_STRING RefreshEventName;
+ HANDLE RefreshEventHandle;
Status = CsrParseCommandLine (ArgumentCount, ArgumentArray);
if (!NT_SUCCESS(Status))
{
- PrintString("CSR: Unable to parse the command line (Status: %x)\n", Status);
+ DPRINT1("CSR: Unable to parse the command line (Status: %x)\n", Status);
return(FALSE);
}
-
+
+ CsrInitVideo();
+
/* NEW NAMED PORT: \ApiPort */
- RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
+ RtlInitUnicodeStringFromLiteral(&PortName, L"\\Windows\\ApiPort");
InitializeObjectAttributes(&ObAttributes,
&PortName,
0,
0);
if (!NT_SUCCESS(Status))
{
- PrintString("CSR: Unable to create \\ApiPort (Status %x)\n", Status);
+ DPRINT1("CSR: Unable to create \\ApiPort (Status %x)\n", Status);
return(FALSE);
}
CsrssApiHeap = RtlCreateHeap(HEAP_GROWABLE,
NULL);
if (CsrssApiHeap == NULL)
{
- PrintString("CSR: Failed to create private heap, aborting\n");
+ DPRINT1("CSR: Failed to create private heap, aborting\n");
return FALSE;
}
NULL);
if (!NT_SUCCESS(Status))
{
- PrintString("CSR: Unable to create server thread\n");
+ DPRINT1("CSR: Unable to create server thread\n");
NtClose(ApiPortHandle);
return FALSE;
}
- Status = RtlCreateUserThread( NtCurrentProcess(), NULL, FALSE, 0, NULL, NULL, (PTHREAD_START_ROUTINE)Console_Api, 0, NULL, NULL );
+ RtlInitUnicodeStringFromLiteral( &RefreshEventName, L"\\TextConsoleRefreshEvent" );
+ InitializeObjectAttributes( &RefreshEventAttr, &RefreshEventName, 0, NULL, NULL );
+ Status = NtCreateEvent( &RefreshEventHandle, STANDARD_RIGHTS_ALL, &RefreshEventAttr, FALSE, FALSE );
if( !NT_SUCCESS( Status ) )
{
- PrintString( "CSR: Unable to create console thread\n" );
+ DPRINT1( "CSR: Unable to create refresh event!\n" );
return FALSE;
}
+ Status = RtlCreateUserThread( NtCurrentProcess(), NULL, FALSE, 0, NULL, NULL, (PTHREAD_START_ROUTINE)Console_Api, (PVOID) RefreshEventHandle, NULL, NULL );
+ if( !NT_SUCCESS( Status ) )
+ {
+ DPRINT1( "CSR: Unable to create console thread\n" );
+ return FALSE;
+ }
+
+ W32kInitialize();
+
return TRUE;
}