40 DPRINT(
"AdjustHandleCounts(0x%p, %d), Object = 0x%p\n",
42 DPRINT(
"\tAdjustHandleCounts(0x%p, %d), Object = 0x%p, Object->ReferenceCount = %d, Object->Type = %lu\n",
50 Object->ReferenceCount += Change;
52 return Object->ReferenceCount;
103 DPRINT(
"Closing the input buffer\n");
129 if (TargetProcessData->HandleTable !=
NULL )
137 SourceProcessData->HandleTableSize
139 if (TargetProcessData->HandleTable ==
NULL)
145 TargetProcessData->HandleTableSize = SourceProcessData->HandleTableSize;
151 for (
i = 0,
j = 0;
i < SourceProcessData->HandleTableSize;
i++)
153 if (SourceProcessData->HandleTable[
i].Object !=
NULL &&
154 SourceProcessData->HandleTable[
i].Inheritable)
160 TargetProcessData->HandleTable[
j] = SourceProcessData->HandleTable[
i];
176 if (ProcessData->HandleTable !=
NULL)
186 if (ProcessData->ConsoleHandle !=
NULL)
189 for (
i = 0;
i < ProcessData->HandleTableSize;
i++)
196 ProcessData->HandleTable =
NULL;
199 ProcessData->HandleTableSize = 0;
220 Object->ReferenceCount = 0;
234#define IO_HANDLES_INCREMENT 2 * 3
242 ASSERT( (ProcessData->HandleTable ==
NULL && ProcessData->HandleTableSize == 0) ||
243 (ProcessData->HandleTable !=
NULL && ProcessData->HandleTableSize != 0) );
245 if (ProcessData->HandleTable)
247 for (
i = 0;
i < ProcessData->HandleTableSize;
i++)
249 if (ProcessData->HandleTable[
i].Object ==
NULL)
254 if (
i >= ProcessData->HandleTableSize)
258 (ProcessData->HandleTableSize +
267 if (ProcessData->HandleTable)
271 ProcessData->HandleTable,
275 ProcessData->HandleTable = Block;
279 ProcessData->HandleTable[
i].Object =
Object;
280 ProcessData->HandleTable[
i].Access = Access;
281 ProcessData->HandleTable[
i].Inheritable = Inheritable;
282 ProcessData->HandleTable[
i].ShareMode = ShareMode;
299 ASSERT(ProcessData->HandleTable);
303 if (
Index >= ProcessData->HandleTableSize ||
304 ProcessData->HandleTable[
Index].Object ==
NULL)
310 ASSERT(ProcessData->ConsoleHandle);
340 Index < ProcessData->HandleTableSize )
342 HandleEntry = &ProcessData->HandleTable[
Index];
343 ObjectEntry = HandleEntry->
Object;
346 if ( HandleEntry ==
NULL ||
347 ObjectEntry ==
NULL ||
348 (HandleEntry->
Access & Access) == 0 ||
352 DPRINT(
"ConSrvGetObject -- Invalid handle 0x%x of type %lu with access %lu ; retrieved object 0x%x (handle 0x%x) of type %lu with access %lu\n",
353 Handle,
Type, Access, ObjectEntry, HandleEntry, (ObjectEntry ? ObjectEntry->
Type : 0), (HandleEntry ? HandleEntry->
Access : 0));
403 DWORD ShareMode = OpenConsoleRequest->ShareMode;
427 DPRINT1(
"Sharing violation\n");
433 &OpenConsoleRequest->Handle,
436 OpenConsoleRequest->InheritHandle,
463 Index >= ProcessData->HandleTableSize ||
481 DPRINT1(
"Handle 0x%p only has access %X; requested %X\n",
490 &DuplicateHandleRequest->TargetHandle,
493 DuplicateHandleRequest->InheritHandle,
519 ASSERT(ProcessData->HandleTable);
524 Index >= ProcessData->HandleTableSize ||
535 GetHandleInfoRequest->Flags = 0;
557 ASSERT(ProcessData->HandleTable);
562 Index >= ProcessData->HandleTableSize ||
597 HANDLE IoHandle = VerifyHandleRequest->Handle;
600 VerifyHandleRequest->IsValid =
FALSE;
608 Index >= ProcessData->HandleTableSize ||
609 ProcessData->HandleTable[
Index].Object ==
NULL)
611 DPRINT(
"SrvVerifyConsoleIoHandle failed\n");
615 VerifyHandleRequest->IsValid =
TRUE;
VOID NTAPI ConDrvDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer)
struct _CONSRV_CONSOLE * PCONSRV_CONSOLE
VOID NTAPI CsrDereferenceWait(IN PLIST_ENTRY WaitList)
BOOLEAN NTAPI CsrNotifyWait(IN PLIST_ENTRY WaitList, IN BOOLEAN NotifyAll, IN PVOID WaitArgument1, IN PVOID WaitArgument2)
#define NT_SUCCESS(StatCode)
#define INVALID_HANDLE_VALUE
#define IsListEmpty(ListHead)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define STATUS_INVALID_HANDLE
#define IsConsoleHandle(h)
PULONG MinorVersion OPTIONAL
base of all file and directory entries
PCONSOLE_IO_OBJECT Object
struct _CONSOLE * Console
CONSOLE_IO_OBJECT_TYPE Type
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_SHARING_VIOLATION
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
#define CON_API(Name, TYPE, RequestName)
BOOLEAN NTAPI ConDrvValidateConsoleUnsafe(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState, IN BOOLEAN LockConsole)
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
struct _CONSOLE_IO_HANDLE * PCONSOLE_IO_HANDLE
static LONG AdjustHandleCounts(IN PCONSOLE_IO_HANDLE Handle, IN LONG Change)
NTSTATUS ConSrvRemoveObject(IN PCONSOLE_PROCESS_DATA ProcessData, IN HANDLE Handle)
NTSTATUS ConSrvGetObject(IN PCONSOLE_PROCESS_DATA ProcessData, IN HANDLE Handle, OUT PCONSOLE_IO_OBJECT *Object, OUT PVOID *Entry OPTIONAL, IN ULONG Access, IN BOOLEAN LockConsole, IN CONSOLE_IO_OBJECT_TYPE Type)
NTSTATUS ConSrvInheritHandlesTable(IN PCONSOLE_PROCESS_DATA SourceProcessData, IN PCONSOLE_PROCESS_DATA TargetProcessData)
NTSTATUS ConSrvInsertObject(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PHANDLE Handle, IN PCONSOLE_IO_OBJECT Object, IN ULONG Access, IN BOOLEAN Inheritable, IN ULONG ShareMode)
VOID ConSrvInitObject(IN OUT PCONSOLE_IO_OBJECT Object, IN CONSOLE_IO_OBJECT_TYPE Type, IN PCONSOLE Console)
#define IO_HANDLES_INCREMENT
static VOID ConSrvCloseHandle(IN PCONSOLE_IO_HANDLE Handle)
VOID ConSrvFreeHandlesTable(IN PCONSOLE_PROCESS_DATA ProcessData)
struct _CONSOLE_IO_HANDLE CONSOLE_IO_HANDLE
VOID ConSrvReleaseObject(IN PCONSOLE_IO_OBJECT Object, IN BOOLEAN IsConsoleLocked)
#define ConsoleAllocHeap(Flags, Size)
#define ConsoleFreeHeap(HeapBase)
enum _CONSOLE_IO_OBJECT_TYPE CONSOLE_IO_OBJECT_TYPE
struct _CONSOLE_SCREEN_BUFFER * PCONSOLE_SCREEN_BUFFER
#define HANDLE_FLAG_INHERIT
#define DUPLICATE_SAME_ACCESS
#define DUPLICATE_CLOSE_SOURCE