NTSTATUS
CONSOLE_SCREEN_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
IN PCONSOLE_SCREEN_BUFFER_VTBL Vtbl,
IN SIZE_T Size);
VOID
NTSTATUS
GRAPHICS_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
+ IN HANDLE ProcessHandle,
IN PGRAPHICS_BUFFER_INFO GraphicsInfo)
{
NTSTATUS Status = STATUS_SUCCESS;
LARGE_INTEGER SectionSize;
ULONG ViewSize = 0;
- HANDLE ProcessHandle;
if (Buffer == NULL || Console == NULL || GraphicsInfo == NULL)
return STATUS_INVALID_PARAMETER;
* correctly the allocated resources when the client releases the
* screen buffer.
*/
- ProcessHandle = CsrGetClientThread()->Process->ProcessHandle;
NewBuffer->ClientProcess = ProcessHandle;
/* Get infos from the graphics buffer information structure */
NULL);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Error: Impossible to create a shared section ; Status = %lu\n", Status);
- NtClose(NewBuffer->ClientMutex);
+ DPRINT1("Error: Impossible to create a shared section, Status = 0x%08lx\n", Status);
+ NtDuplicateObject(ProcessHandle, NewBuffer->ClientMutex,
+ NULL, NULL, 0, 0, DUPLICATE_CLOSE_SOURCE);
NtClose(NewBuffer->Mutex);
ConsoleFreeHeap(NewBuffer->BitMapInfo);
CONSOLE_SCREEN_BUFFER_Destroy((PCONSOLE_SCREEN_BUFFER)NewBuffer);
PAGE_READWRITE);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Error: Impossible to map the shared section ; Status = %lu\n", Status);
+ DPRINT1("Error: Impossible to map the shared section, Status = 0x%08lx\n", Status);
NtClose(NewBuffer->hSection);
- NtClose(NewBuffer->ClientMutex);
+ NtDuplicateObject(ProcessHandle, NewBuffer->ClientMutex,
+ NULL, NULL, 0, 0, DUPLICATE_CLOSE_SOURCE);
NtClose(NewBuffer->Mutex);
ConsoleFreeHeap(NewBuffer->BitMapInfo);
CONSOLE_SCREEN_BUFFER_Destroy((PCONSOLE_SCREEN_BUFFER)NewBuffer);
PAGE_READWRITE);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Error: Impossible to map the shared section ; Status = %lu\n", Status);
+ DPRINT1("Error: Impossible to map the shared section, Status = 0x%08lx\n", Status);
NtUnmapViewOfSection(NtCurrentProcess(), NewBuffer->BitMap);
NtClose(NewBuffer->hSection);
- NtClose(NewBuffer->ClientMutex);
+ NtDuplicateObject(ProcessHandle, NewBuffer->ClientMutex,
+ NULL, NULL, 0, 0, DUPLICATE_CLOSE_SOURCE);
NtClose(NewBuffer->Mutex);
ConsoleFreeHeap(NewBuffer->BitMapInfo);
CONSOLE_SCREEN_BUFFER_Destroy((PCONSOLE_SCREEN_BUFFER)NewBuffer);
NtUnmapViewOfSection(Buff->ClientProcess, Buff->ClientBitMap);
NtUnmapViewOfSection(NtCurrentProcess(), Buff->BitMap);
NtClose(Buff->hSection);
- NtClose(Buff->ClientMutex);
+ NtDuplicateObject(Buff->ClientProcess, Buff->ClientMutex,
+ NULL, NULL, 0, 0, DUPLICATE_CLOSE_SOURCE);
NtClose(Buff->Mutex);
ConsoleFreeHeap(Buff->BitMapInfo);