17#define CsrHashThread(t) (HandleToUlong(t) % NUMBER_THREAD_HASH_BUCKETS)
46 ObjectHandleFlagInformation,
55 ObjectHandleFlagInformation,
85 ObjectHandleFlagInformation,
94 ObjectHandleFlagInformation,
125 if (!CsrThread)
return NULL;
157 ++CsrThread->ReferenceCount;
197 NextEntry = ListHead->
Flink;
200 while (NextEntry != ListHead)
206 NextEntry = NextEntry->
Flink;
259 NextEntry = ListHead->
Flink;
262 while (NextEntry != ListHead)
271 NextEntry = NextEntry->
Flink;
381 CsrThread->Process->ThreadCount--;
384 if (CsrThread->HashLinks.Flink)
RemoveEntryList(&CsrThread->HashLinks);
387 if (CsrThread->Process->ThreadCount == 0)
437 if (CsrThread->ThreadHandle)
529 CsrThread->
Flags = ThreadFlags;
539 DPRINT1(
"CsrAddStaticServerThread: alloc failed for thread 0x%x\n",
hThread);
636 CsrThread->
Flags = 0;
693 CurrentCid = CurrentThread->
ClientId;
741 CsrThread->
Flags = 0;
782 ASSERT(CsrThread->ReferenceCount > 0);
783 if ((--CsrThread->ReferenceCount) == 0)
1001 NextEntry = NextEntry->
Flink;
1013 *CsrThread = CurrentThread;
1050 ASSERT(CsrThread->ReferenceCount != 0);
1053 CsrThread->ReferenceCount++;
NTSTATUS NtQueryObject(IN HANDLE Handle, IN OBJECT_INFO_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG ObjectInformationLength, OUT PULONG ReturnLength)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
NTSTATUS NTAPI CsrUnlockProcess(IN PCSR_PROCESS CsrProcess)
#define CsrGetClientThread()
@ CsrProcessLastThreadTerminated
NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, OUT PCSR_PROCESS *CsrProcess OPTIONAL)
VOID NTAPI CsrDereferenceProcess(IN PCSR_PROCESS CsrProcess)
#define NT_SUCCESS(StatCode)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
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
struct _ThreadInfo ThreadInfo
NTSYSAPI NTSTATUS NTAPI RtlCreateUserThread(_In_ PVOID ThreadContext, _Out_ HANDLE *OutThreadHandle, _Reserved_ PVOID Reserved1, _Reserved_ PVOID Reserved2, _Reserved_ PVOID Reserved3, _Reserved_ PVOID Reserved4, _Reserved_ PVOID Reserved5, _Reserved_ PVOID Reserved6, _Reserved_ PVOID Reserved7, _Reserved_ PVOID Reserved8)
#define NtCurrentProcess()
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSTATUS NTAPI NtQueryInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength, OUT PULONG ReturnLength OPTIONAL)
#define STATUS_THREAD_IS_TERMINATING
NTSTATUS NTAPI NtDuplicateObject(IN HANDLE SourceProcessHandle, IN HANDLE SourceHandle, IN HANDLE TargetProcessHandle OPTIONAL, OUT PHANDLE TargetHandle OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG HandleAttributes, IN ULONG Options)
NTSTATUS NTAPI NtSetInformationObject(IN HANDLE ObjectHandle, IN OBJECT_INFORMATION_CLASS ObjectInformationClass, IN PVOID ObjectInformation, IN ULONG Length)
PULONG MinorVersion OPTIONAL
struct _CSR_WAIT_BLOCK * WaitBlock
struct _LIST_ENTRY * Flink
PCSR_PROCESS CsrRootProcess
#define CsrAcquireWaitLock()
BOOLEAN NTAPI CsrNotifyWaitBlock(IN PCSR_WAIT_BLOCK WaitBlock, IN PLIST_ENTRY WaitList, IN PVOID WaitArgument1, IN PVOID WaitArgument2, IN ULONG WaitFlags, IN BOOLEAN DereferenceThread)
VOID NTAPI CsrLockedReferenceProcess(IN PCSR_PROCESS CsrProcess)
#define ProcessStructureListLocked()
#define CsrAcquireProcessLock()
#define CsrReleaseProcessLock()
#define CsrReleaseWaitLock()
VOID NTAPI CsrLockedDereferenceProcess(PCSR_PROCESS CsrProcess)
#define NUMBER_THREAD_HASH_BUCKETS
VOID NTAPI CsrLockedReferenceThread(IN PCSR_THREAD CsrThread)
NTSTATUS NTAPI CsrLockThreadByClientId(IN HANDLE Tid, OUT PCSR_THREAD *CsrThread)
VOID NTAPI CsrThreadRefcountZero(IN PCSR_THREAD CsrThread)
VOID NTAPI CsrReferenceThread(IN PCSR_THREAD CsrThread)
NTSTATUS NTAPI CsrInsertThread(IN PCSR_PROCESS Process, IN PCSR_THREAD Thread)
BOOLEAN NTAPI ProtectHandle(IN HANDLE ObjectHandle)
NTSTATUS NTAPI CsrCreateRemoteThread(IN HANDLE hThread, IN PCLIENT_ID ClientId)
VOID NTAPI CsrRemoveThread(IN PCSR_THREAD CsrThread)
BOOLEAN NTAPI UnProtectHandle(IN HANDLE ObjectHandle)
NTSTATUS NTAPI CsrCreateThread(IN PCSR_PROCESS CsrProcess, IN HANDLE hThread, IN PCLIENT_ID ClientId, IN BOOLEAN HaveClient)
VOID NTAPI CsrLockedDereferenceThread(IN PCSR_THREAD CsrThread)
NTSTATUS NTAPI CsrDestroyThread(IN PCLIENT_ID Cid)
VOID NTAPI CsrDereferenceThread(IN PCSR_THREAD CsrThread)
PCSR_THREAD NTAPI CsrAddStaticServerThread(IN HANDLE hThread, IN PCLIENT_ID ClientId, IN ULONG ThreadFlags)
VOID NTAPI CsrDeallocateThread(IN PCSR_THREAD CsrThread)
PCSR_THREAD NTAPI CsrLocateThreadInProcess(IN PCSR_PROCESS CsrProcess OPTIONAL, IN PCLIENT_ID Cid)
PCSR_THREAD NTAPI CsrLocateThreadByClientId(OUT PCSR_PROCESS *Process OPTIONAL, IN PCLIENT_ID ClientId)
PCSR_THREAD NTAPI CsrAllocateThread(IN PCSR_PROCESS CsrProcess)
NTSTATUS NTAPI CsrUnlockThread(IN PCSR_THREAD CsrThread)
NTSTATUS NTAPI CsrExecServerThread(IN PVOID ThreadHandler, IN ULONG Flags)
LIST_ENTRY CsrThreadHashTable[NUMBER_THREAD_HASH_BUCKETS]
#define CONTAINING_RECORD(address, type, field)
#define STATUS_UNSUCCESSFUL
static int Link(const char **args)
_Must_inspect_result_ _In_ ULONG Flags
_Out_ PCLIENT_ID ClientId
#define DUPLICATE_SAME_ACCESS