mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 13:45:58 +00:00
[KERNEL32]
Silent more debug prints and remove an unused DPRINT1 I've introduced in r57666. svn path=/branches/ros-csrss/; revision=58104
This commit is contained in:
parent
0345e745fd
commit
e4d97e422f
|
@ -51,10 +51,6 @@ DefaultConsoleCtrlHandler(DWORD Event)
|
||||||
DPRINT("Ctrl-Break Event\n");
|
DPRINT("Ctrl-Break Event\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTRL_SHUTDOWN_EVENT:
|
|
||||||
DPRINT("Ctrl Shutdown Event\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CTRL_CLOSE_EVENT:
|
case CTRL_CLOSE_EVENT:
|
||||||
DPRINT("Ctrl Close Event\n");
|
DPRINT("Ctrl Close Event\n");
|
||||||
break;
|
break;
|
||||||
|
@ -62,6 +58,10 @@ DefaultConsoleCtrlHandler(DWORD Event)
|
||||||
case CTRL_LOGOFF_EVENT:
|
case CTRL_LOGOFF_EVENT:
|
||||||
DPRINT("Ctrl Logoff Event\n");
|
DPRINT("Ctrl Logoff Event\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CTRL_SHUTDOWN_EVENT:
|
||||||
|
DPRINT("Ctrl Shutdown Event\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExitProcess(CONTROL_C_EXIT);
|
ExitProcess(CONTROL_C_EXIT);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include <k32.h>
|
#include <k32.h>
|
||||||
|
|
||||||
// #define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
@ -353,7 +353,7 @@ DllMain(HANDLE hDll,
|
||||||
/* Initialize Console Support */
|
/* Initialize Console Support */
|
||||||
if (!BasepInitConsole())
|
if (!BasepInitConsole())
|
||||||
{
|
{
|
||||||
DPRINT1("Failure to set up console\n");
|
DPRINT1("Failed to set up console\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include <k32.h>
|
#include <k32.h>
|
||||||
|
|
||||||
// #define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
@ -511,7 +511,7 @@ BasepNotifyCsrOfThread(IN HANDLE ThreadHandle,
|
||||||
sizeof(BASE_CREATE_THREAD));
|
sizeof(BASE_CREATE_THREAD));
|
||||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status))
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to tell csrss about new thread: %lx %lx\n", Status, ApiMessage.Status);
|
DPRINT1("Failed to tell CSRSS about new thread: %lx %lx\n", Status, ApiMessage.Status);
|
||||||
return ApiMessage.Status;
|
return ApiMessage.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,14 +590,13 @@ BasepCreateFirstThread(HANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call CSR */
|
/* Call CSR */
|
||||||
DPRINT1("Calling CsrClientCallServer from BasepCreateFirstThread...\n");
|
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
NULL,
|
NULL,
|
||||||
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateProcess),
|
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateProcess),
|
||||||
sizeof(BASE_CREATE_PROCESS));
|
sizeof(BASE_CREATE_PROCESS));
|
||||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status))
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to tell csrss about new process: %lx %lx\n", Status, ApiMessage.Status);
|
DPRINT1("Failed to tell CSRSS about new process: %lx %lx\n", Status, ApiMessage.Status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1201,7 +1200,7 @@ GetProcessShutdownParameters(OUT LPDWORD lpdwLevel,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the data out of the LCP reply */
|
/* Get the data back */
|
||||||
*lpdwLevel = GetShutdownParametersRequest->Level;
|
*lpdwLevel = GetShutdownParametersRequest->Level;
|
||||||
*lpdwFlags = GetShutdownParametersRequest->Flags;
|
*lpdwFlags = GetShutdownParametersRequest->Flags;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -88,6 +88,16 @@ ConioProcessChar(PCSRSS_CONSOLE Console,
|
||||||
InsertTailList(&Console->InputEvents, &ConInRec->ListEntry);
|
InsertTailList(&Console->InputEvents, &ConInRec->ListEntry);
|
||||||
|
|
||||||
SetEvent(Console->ActiveEvent);
|
SetEvent(Console->ActiveEvent);
|
||||||
|
/*
|
||||||
|
if (CsrNotifyWait(&Console->ReadWaitQueue,
|
||||||
|
WaitAny,
|
||||||
|
NULL,
|
||||||
|
NULL))
|
||||||
|
{
|
||||||
|
ASSERT(Console->SatisfiedWaits == NULL);
|
||||||
|
Console->SatisfiedWaits = &Console->ReadWaitQueue;
|
||||||
|
}
|
||||||
|
*/
|
||||||
CsrNotifyWait(&Console->ReadWaitQueue,
|
CsrNotifyWait(&Console->ReadWaitQueue,
|
||||||
WaitAny,
|
WaitAny,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -255,7 +265,7 @@ ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode)
|
||||||
{
|
{
|
||||||
current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
|
current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
ConioConsoleCtrlEvent((DWORD)CTRL_C_EVENT, current);
|
ConioConsoleCtrlEvent(CTRL_C_EVENT, current);
|
||||||
}
|
}
|
||||||
if (Console->LineBuffer && !Console->LineComplete)
|
if (Console->LineBuffer && !Console->LineComplete)
|
||||||
{
|
{
|
||||||
|
@ -324,6 +334,7 @@ WaitBeforeReading(IN PGET_INPUT_INFO InputInfo,
|
||||||
CapturedInputInfo,
|
CapturedInputInfo,
|
||||||
NULL))
|
NULL))
|
||||||
{
|
{
|
||||||
|
/* Fail */
|
||||||
HeapFree(ConSrvHeap, 0, CapturedInputInfo);
|
HeapFree(ConSrvHeap, 0, CapturedInputInfo);
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -353,11 +364,46 @@ ReadInputBufferThread(IN PLIST_ENTRY WaitList,
|
||||||
PCSRSS_GET_CONSOLE_INPUT GetConsoleInputRequest = &((PCONSOLE_API_MESSAGE)WaitApiMessage)->Data.GetConsoleInputRequest;
|
PCSRSS_GET_CONSOLE_INPUT GetConsoleInputRequest = &((PCONSOLE_API_MESSAGE)WaitApiMessage)->Data.GetConsoleInputRequest;
|
||||||
PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext;
|
PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext;
|
||||||
|
|
||||||
|
DWORD Flag = (DWORD)WaitArgument1;
|
||||||
|
BOOLEAN InputHandleClosing = (WaitArgument2 == (PVOID)0xdeaddead);
|
||||||
|
|
||||||
|
DPRINT("ReadInputBufferThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are signaled by pressing Ctrl-C or Ctrl-Break,
|
||||||
|
* just ignore this event.
|
||||||
|
*/
|
||||||
|
if ( (Flag == 1 << CTRL_C_EVENT) ||
|
||||||
|
(Flag == 1 << CTRL_BREAK_EVENT) )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are called via CsrNotifyWaitBlock by a call to
|
||||||
|
* CsrDestroyProcess or CsrDestroyThread, just return.
|
||||||
|
*/
|
||||||
|
if (WaitFlags & CsrProcessTerminating)
|
||||||
|
{
|
||||||
|
Status = STATUS_THREAD_IS_TERMINATING;
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are about to close an input handle, then just return.
|
||||||
|
*/
|
||||||
|
if (InputHandleClosing)
|
||||||
|
{
|
||||||
|
Status = STATUS_ALERTED;
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
Status = ReadInputBuffer(InputInfo,
|
Status = ReadInputBuffer(InputInfo,
|
||||||
GetConsoleInputRequest->bRead,
|
GetConsoleInputRequest->bRead,
|
||||||
WaitApiMessage,
|
WaitApiMessage,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
Quit:
|
||||||
if (Status != STATUS_PENDING)
|
if (Status != STATUS_PENDING)
|
||||||
{
|
{
|
||||||
WaitApiMessage->Status = Status;
|
WaitApiMessage->Status = Status;
|
||||||
|
@ -450,10 +496,38 @@ ReadCharsThread(IN PLIST_ENTRY WaitList,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext;
|
PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext;
|
||||||
|
|
||||||
|
DWORD Flag = (DWORD)WaitArgument1;
|
||||||
|
BOOLEAN InputHandleClosing = (WaitArgument2 == (PVOID)0xdeaddead);
|
||||||
|
|
||||||
|
DPRINT("ReadCharsThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are called via CsrNotifyWaitBlock by a call to
|
||||||
|
* CsrDestroyProcess or CsrDestroyThread, just return.
|
||||||
|
*/
|
||||||
|
if (WaitFlags & CsrProcessTerminating)
|
||||||
|
{
|
||||||
|
Status = STATUS_THREAD_IS_TERMINATING;
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are signaled by pressing Ctrl-C or Ctrl-Break,
|
||||||
|
* or that we close an input handle, then just return.
|
||||||
|
*/
|
||||||
|
if ( (Flag == 1 << CTRL_C_EVENT) ||
|
||||||
|
(Flag == 1 << CTRL_BREAK_EVENT) ||
|
||||||
|
(InputHandleClosing == TRUE) )
|
||||||
|
{
|
||||||
|
Status = STATUS_ALERTED;
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
Status = ReadChars(InputInfo,
|
Status = ReadChars(InputInfo,
|
||||||
WaitApiMessage,
|
WaitApiMessage,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
Quit:
|
||||||
if (Status != STATUS_PENDING)
|
if (Status != STATUS_PENDING)
|
||||||
{
|
{
|
||||||
WaitApiMessage->Status = Status;
|
WaitApiMessage->Status = Status;
|
||||||
|
@ -479,6 +553,7 @@ ReadChars(IN PGET_INPUT_INFO InputInfo,
|
||||||
|
|
||||||
/* We haven't read anything (yet) */
|
/* We haven't read anything (yet) */
|
||||||
|
|
||||||
|
// Cooked-like mode
|
||||||
if (InputInfo->Console->Mode & ENABLE_LINE_INPUT)
|
if (InputInfo->Console->Mode & ENABLE_LINE_INPUT)
|
||||||
{
|
{
|
||||||
if (InputInfo->Console->LineBuffer == NULL)
|
if (InputInfo->Console->LineBuffer == NULL)
|
||||||
|
@ -563,7 +638,7 @@ ReadChars(IN PGET_INPUT_INFO InputInfo,
|
||||||
WaitForMoreToRead = FALSE;
|
WaitForMoreToRead = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // Raw-like mode
|
||||||
{
|
{
|
||||||
/* Character input */
|
/* Character input */
|
||||||
while ( ReadConsoleRequest->NrCharactersRead < nNumberOfCharsToRead &&
|
while ( ReadConsoleRequest->NrCharactersRead < nNumberOfCharsToRead &&
|
||||||
|
|
|
@ -29,16 +29,17 @@
|
||||||
typedef struct tagCSRSS_SCREEN_BUFFER
|
typedef struct tagCSRSS_SCREEN_BUFFER
|
||||||
{
|
{
|
||||||
Object_t Header; /* Object header */
|
Object_t Header; /* Object header */
|
||||||
BYTE *Buffer; /* pointer to screen buffer */
|
LIST_ENTRY ListEntry; /* Entry in console's list of buffers */
|
||||||
USHORT MaxX, MaxY; /* size of the entire scrollback buffer */
|
|
||||||
USHORT ShowX, ShowY; /* beginning offset for the actual display area */
|
BYTE *Buffer; /* Pointer to screen buffer */
|
||||||
|
USHORT MaxX, MaxY; /* Size of the entire scrollback buffer */
|
||||||
|
USHORT ShowX, ShowY; /* Beginning offset for the actual display area */
|
||||||
ULONG CurrentX; /* Current X cursor position */
|
ULONG CurrentX; /* Current X cursor position */
|
||||||
ULONG CurrentY; /* Current Y cursor position */
|
ULONG CurrentY; /* Current Y cursor position */
|
||||||
WORD DefaultAttrib; /* default char attribute */
|
WORD DefaultAttrib; /* Default char attribute */
|
||||||
USHORT VirtualY; /* top row of buffer being displayed, reported to callers */
|
USHORT VirtualY; /* Top row of buffer being displayed, reported to callers */
|
||||||
CONSOLE_CURSOR_INFO CursorInfo;
|
CONSOLE_CURSOR_INFO CursorInfo;
|
||||||
USHORT Mode;
|
USHORT Mode;
|
||||||
LIST_ENTRY ListEntry; /* entry in console's list of buffers */
|
|
||||||
} CSRSS_SCREEN_BUFFER, *PCSRSS_SCREEN_BUFFER;
|
} CSRSS_SCREEN_BUFFER, *PCSRSS_SCREEN_BUFFER;
|
||||||
|
|
||||||
typedef struct tagCSRSS_CONSOLE
|
typedef struct tagCSRSS_CONSOLE
|
||||||
|
@ -77,6 +78,15 @@ typedef struct tagCSRSS_CONSOLE
|
||||||
HANDLE UnpauseEvent;
|
HANDLE UnpauseEvent;
|
||||||
LIST_ENTRY WriteWaitQueue; /* List head for the queue of write wait blocks */
|
LIST_ENTRY WriteWaitQueue; /* List head for the queue of write wait blocks */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Pointers to lists of wait blocks, when they contain satisfied waits to be freed */
|
||||||
|
PLIST_ENTRY SatisfiedWaits;
|
||||||
|
|
||||||
|
/* Pointers to lists of wait blocks, when they contain satisfied waits to be freed */
|
||||||
|
PLIST_ENTRY ReadSatisfiedWaits;
|
||||||
|
PLIST_ENTRY WriteSatisfiedWaits;
|
||||||
|
#endif
|
||||||
|
|
||||||
WORD Mode; /* Console mode flags */
|
WORD Mode; /* Console mode flags */
|
||||||
UNICODE_STRING Title; /* Title of console */
|
UNICODE_STRING Title; /* Title of console */
|
||||||
DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */
|
DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */
|
||||||
|
|
|
@ -447,10 +447,23 @@ WriteConsoleThread(IN PLIST_ENTRY WaitList,
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("WriteConsoleThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are called via CsrNotifyWaitBlock by a call to
|
||||||
|
* CsrDestroyProcess or CsrDestroyThread, just return.
|
||||||
|
*/
|
||||||
|
if (WaitFlags & CsrProcessTerminating)
|
||||||
|
{
|
||||||
|
Status = STATUS_THREAD_IS_TERMINATING;
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
Status = DoWriteConsole(WaitApiMessage,
|
Status = DoWriteConsole(WaitApiMessage,
|
||||||
WaitThread,
|
WaitThread,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
Quit:
|
||||||
if (Status != STATUS_PENDING)
|
if (Status != STATUS_PENDING)
|
||||||
{
|
{
|
||||||
WaitApiMessage->Status = Status;
|
WaitApiMessage->Status = Status;
|
||||||
|
|
|
@ -64,6 +64,42 @@ ConioConsoleCtrlEventTimeout(DWORD Event,
|
||||||
|
|
||||||
DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->Process->ClientId.UniqueProcess);
|
DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->Process->ClientId.UniqueProcess);
|
||||||
|
|
||||||
|
/* Notify all the waits only if we see Ctrl-C or Ctrl-Break */
|
||||||
|
if (Event == CTRL_C_EVENT || Event == CTRL_BREAK_EVENT)
|
||||||
|
{
|
||||||
|
DWORD Flag = (1 << Event); // Transform an integer value to a power of 2.
|
||||||
|
NTSTATUS Status;
|
||||||
|
PCSRSS_CONSOLE Console;
|
||||||
|
// LIST_ENTRY WaitQueue;
|
||||||
|
|
||||||
|
DPRINT1("ConioConsoleCtrlEvent - Ctrl-C captured\n");
|
||||||
|
Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("ConioConsoleCtrlEvent - console captured, try to dereference waits...\n");
|
||||||
|
/*
|
||||||
|
* Wake-up all of the writing waiters, dereference them
|
||||||
|
* and purge them all from the list.
|
||||||
|
*/
|
||||||
|
if (CsrNotifyWait(&Console->ReadWaitQueue,
|
||||||
|
WaitAll,
|
||||||
|
(PVOID)Flag,
|
||||||
|
NULL))
|
||||||
|
{
|
||||||
|
DPRINT1("ConioConsoleCtrlEvent - waits dereferenced...\n");
|
||||||
|
// InitializeListHead(&WaitQueue);
|
||||||
|
|
||||||
|
// CsrMoveSatisfiedWait(&WaitQueue, &Console->ReadWaitQueue);
|
||||||
|
if (!IsListEmpty(&Console->ReadWaitQueue /* &WaitQueue */))
|
||||||
|
{
|
||||||
|
CsrDereferenceWait(&Console->ReadWaitQueue /* &WaitQueue */);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ConioUnlockConsole(Console); // NOTE_WAITS: <-- Here we have the possibility to free the console waits also.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Notify the process of the control event */
|
||||||
if (ProcessData->CtrlDispatcher)
|
if (ProcessData->CtrlDispatcher)
|
||||||
{
|
{
|
||||||
Thread = CreateRemoteThread(ProcessData->Process->ProcessHandle, NULL, 0,
|
Thread = CreateRemoteThread(ProcessData->Process->ProcessHandle, NULL, 0,
|
||||||
|
@ -130,6 +166,7 @@ CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd)
|
||||||
InitializeListHead(&Console->ProcessList);
|
InitializeListHead(&Console->ProcessList);
|
||||||
InitializeListHead(&Console->BufferList);
|
InitializeListHead(&Console->BufferList);
|
||||||
Console->ActiveBuffer = NULL;
|
Console->ActiveBuffer = NULL;
|
||||||
|
// Console->SatisfiedWaits = NULL;
|
||||||
InitializeListHead(&Console->ReadWaitQueue);
|
InitializeListHead(&Console->ReadWaitQueue);
|
||||||
InitializeListHead(&Console->WriteWaitQueue);
|
InitializeListHead(&Console->WriteWaitQueue);
|
||||||
InitializeListHead(&Console->InputEvents);
|
InitializeListHead(&Console->InputEvents);
|
||||||
|
@ -453,6 +490,9 @@ ConioDeleteConsole(PCSRSS_CONSOLE Console)
|
||||||
|
|
||||||
DPRINT("ConioDeleteConsole\n");
|
DPRINT("ConioDeleteConsole\n");
|
||||||
|
|
||||||
|
/* TODO: Dereference all the waits in Console->ReadWaitQueue */
|
||||||
|
/* TODO: Dereference all the waits in Console->WriteWaitQueue */
|
||||||
|
|
||||||
/* Drain input event queue */
|
/* Drain input event queue */
|
||||||
while (Console->InputEvents.Flink != &Console->InputEvents)
|
while (Console->InputEvents.Flink != &Console->InputEvents)
|
||||||
{
|
{
|
||||||
|
@ -501,6 +541,8 @@ ConioPause(PCSRSS_CONSOLE Console, UINT Flags)
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags)
|
ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags)
|
||||||
{
|
{
|
||||||
|
// LIST_ENTRY WaitQueue;
|
||||||
|
|
||||||
Console->PauseFlags &= ~Flags;
|
Console->PauseFlags &= ~Flags;
|
||||||
|
|
||||||
// if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0)
|
// if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0)
|
||||||
|
@ -510,10 +552,23 @@ ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags)
|
||||||
CloseHandle(Console->UnpauseEvent);
|
CloseHandle(Console->UnpauseEvent);
|
||||||
Console->UnpauseEvent = NULL;
|
Console->UnpauseEvent = NULL;
|
||||||
|
|
||||||
CsrNotifyWait(&Console->WriteWaitQueue,
|
/*
|
||||||
|
* Wake-up all of the writing waiters, dereference them
|
||||||
|
* and purge them all from the list.
|
||||||
|
*/
|
||||||
|
if (CsrNotifyWait(&Console->WriteWaitQueue,
|
||||||
WaitAll,
|
WaitAll,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL))
|
||||||
|
{
|
||||||
|
// InitializeListHead(&WaitQueue);
|
||||||
|
|
||||||
|
// CsrMoveSatisfiedWait(&WaitQueue, &Console->WriteWaitQueue);
|
||||||
|
if (!IsListEmpty(&Console->WriteWaitQueue /* &WaitQueue */))
|
||||||
|
{
|
||||||
|
CsrDereferenceWait(&Console->WriteWaitQueue /* &WaitQueue */);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "consrv.h"
|
#include "consrv.h"
|
||||||
#include "conio.h"
|
#include "conio.h"
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,11 +47,33 @@ static VOID
|
||||||
Win32CsrCloseHandleEntry(PCSRSS_HANDLE Entry)
|
Win32CsrCloseHandleEntry(PCSRSS_HANDLE Entry)
|
||||||
{
|
{
|
||||||
Object_t *Object = Entry->Object;
|
Object_t *Object = Entry->Object;
|
||||||
|
|
||||||
if (Object != NULL)
|
if (Object != NULL)
|
||||||
{
|
{
|
||||||
PCSRSS_CONSOLE Console = Object->Console;
|
PCSRSS_CONSOLE Console = Object->Console;
|
||||||
EnterCriticalSection(&Console->Lock);
|
EnterCriticalSection(&Console->Lock);
|
||||||
|
|
||||||
|
if (Object->Type == CONIO_CONSOLE_MAGIC)
|
||||||
|
{
|
||||||
|
// LIST_ENTRY WaitQueue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wake-up all of the writing waiters if any, dereference them
|
||||||
|
* and purge them all from the list.
|
||||||
|
*/
|
||||||
|
CsrNotifyWait(&Console->ReadWaitQueue,
|
||||||
|
WaitAll,
|
||||||
|
NULL,
|
||||||
|
(PVOID)0xdeaddead);
|
||||||
|
// InitializeListHead(&WaitQueue);
|
||||||
|
|
||||||
|
// CsrMoveSatisfiedWait(&WaitQueue, &Console->ReadWaitQueue);
|
||||||
|
if (!IsListEmpty(&Console->ReadWaitQueue /* &WaitQueue */))
|
||||||
|
{
|
||||||
|
CsrDereferenceWait(&Console->ReadWaitQueue /* &WaitQueue */);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If the last handle to a screen buffer is closed, delete it... */
|
/* If the last handle to a screen buffer is closed, delete it... */
|
||||||
if (AdjustHandleCounts(Entry, -1) == 0)
|
if (AdjustHandleCounts(Entry, -1) == 0)
|
||||||
{
|
{
|
||||||
|
@ -143,8 +165,6 @@ Win32CsrReleaseObject(PCONSOLE_PROCESS_DATA ProcessData,
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
return STATUS_INVALID_HANDLE;
|
return STATUS_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("Win32CsrReleaseObject - Process 0x%p, Release 0x%p\n", ProcessData->Process, &ProcessData->HandleTable[h]);
|
|
||||||
Win32CsrCloseHandleEntry(&ProcessData->HandleTable[h]);
|
Win32CsrCloseHandleEntry(&ProcessData->HandleTable[h]);
|
||||||
|
|
||||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||||
|
@ -190,6 +210,23 @@ Win32CsrUnlockConsole(PCSRSS_CONSOLE Console)
|
||||||
{
|
{
|
||||||
LeaveCriticalSection(&Console->Lock);
|
LeaveCriticalSection(&Console->Lock);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* If it was the last held lock for the owning thread... */
|
||||||
|
if (&Console->Lock.RecursionCount == 0)
|
||||||
|
{
|
||||||
|
/* ...dereference waiting threads if any */
|
||||||
|
LIST_ENTRY WaitQueue;
|
||||||
|
InitializeListHead(&WaitQueue);
|
||||||
|
|
||||||
|
CsrMoveSatisfiedWait(&WaitQueue, Console->SatisfiedWaits);
|
||||||
|
Console->SatisfiedWaits = NULL;
|
||||||
|
if (!IsListEmpty(&WaitQueue))
|
||||||
|
{
|
||||||
|
CsrDereferenceWait(&WaitQueue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Decrement reference count */
|
/* Decrement reference count */
|
||||||
if (_InterlockedDecrement(&Console->ReferenceCount) == 0)
|
if (_InterlockedDecrement(&Console->ReferenceCount) == 0)
|
||||||
ConioDeleteConsole(Console);
|
ConioDeleteConsole(Console);
|
||||||
|
|
Loading…
Reference in a new issue