[CONSRV]: Use an optional parameter for passing things to the "line discipline" funct...
[reactos.git] / win32ss / user / winsrv / consrv / condrv / coninput.c
index 800abb4..1f4a34a 100644 (file)
@@ -170,7 +170,7 @@ AddInputEvents(PCONSOLE Console,
         Status = STATUS_SUCCESS;
     }
 
-    if (SetWaitEvent) SetEvent(Console->InputBuffer.ActiveEvent);
+    if (SetWaitEvent) NtSetEvent(Console->InputBuffer.ActiveEvent, NULL);
 
 Done:
     if (NumEventsWritten) *NumEventsWritten = i;
@@ -198,16 +198,24 @@ NTSTATUS NTAPI
 ConDrvInitInputBuffer(IN PCONSOLE Console,
                       IN ULONG InputBufferSize)
 {
-    SECURITY_ATTRIBUTES SecurityAttributes;
+    NTSTATUS Status;
+    OBJECT_ATTRIBUTES ObjectAttributes;
 
     ConSrvInitObject(&Console->InputBuffer.Header, INPUT_BUFFER, Console);
 
-    SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
-    SecurityAttributes.lpSecurityDescriptor = NULL;
-    SecurityAttributes.bInheritHandle = TRUE;
+    InitializeObjectAttributes(&ObjectAttributes,
+                               NULL,
+                               OBJ_INHERIT,
+                               NULL,
+                               NULL);
 
-    Console->InputBuffer.ActiveEvent = CreateEventW(&SecurityAttributes, TRUE, FALSE, NULL);
-    if (Console->InputBuffer.ActiveEvent == NULL) return STATUS_UNSUCCESSFUL;
+    Status = NtCreateEvent(&Console->InputBuffer.ActiveEvent, EVENT_ALL_ACCESS,
+                           &ObjectAttributes, NotificationEvent, FALSE);
+    if (!NT_SUCCESS(Status))
+    {
+        return STATUS_UNSUCCESSFUL;
+        // return Status;
+    }
 
     Console->InputBuffer.InputBufferSize = InputBufferSize;
     InitializeListHead(&Console->InputBuffer.InputEvents);
@@ -230,10 +238,10 @@ ConDrvDeinitInputBuffer(IN PCONSOLE Console)
 NTSTATUS NTAPI
 ConDrvReadConsole(IN PCONSOLE Console,
                   IN PCONSOLE_INPUT_BUFFER InputBuffer,
-                  /**/IN PUNICODE_STRING ExeName /**/OPTIONAL/**/,/**/
                   IN BOOLEAN Unicode,
                   OUT PVOID Buffer,
                   IN OUT PCONSOLE_READCONSOLE_CONTROL ReadControl,
+                  IN PVOID Parameter OPTIONAL,
                   IN ULONG NumCharsToRead,
                   OUT PULONG NumCharsRead OPTIONAL)
 {
@@ -252,10 +260,10 @@ ConDrvReadConsole(IN PCONSOLE Console,
 
     /* Call the line-discipline */
     return TermReadStream(Console,
-                          ExeName,
                           Unicode,
                           Buffer,
                           ReadControl,
+                          Parameter,
                           NumCharsToRead,
                           NumCharsRead);
 }