#include <srv.h>
#include <debug.h>
Go to the source code of this file.
|
BOOLEAN NTAPI | ProtectHandle (IN HANDLE ObjectHandle) |
|
BOOLEAN NTAPI | UnProtectHandle (IN HANDLE ObjectHandle) |
|
PCSR_THREAD NTAPI | CsrAllocateThread (IN PCSR_PROCESS CsrProcess) |
|
VOID NTAPI | CsrLockedReferenceThread (IN PCSR_THREAD CsrThread) |
|
PCSR_THREAD NTAPI | CsrLocateThreadByClientId (OUT PCSR_PROCESS *Process OPTIONAL, IN PCLIENT_ID ClientId) |
|
PCSR_THREAD NTAPI | CsrLocateThreadInProcess (IN PCSR_PROCESS CsrProcess OPTIONAL, IN PCLIENT_ID Cid) |
|
NTSTATUS NTAPI | CsrInsertThread (IN PCSR_PROCESS Process, IN PCSR_THREAD Thread) |
|
VOID NTAPI | CsrDeallocateThread (IN PCSR_THREAD CsrThread) |
|
VOID NTAPI | CsrRemoveThread (IN PCSR_THREAD CsrThread) |
|
VOID NTAPI | CsrThreadRefcountZero (IN PCSR_THREAD CsrThread) |
|
VOID NTAPI | CsrLockedDereferenceThread (IN PCSR_THREAD CsrThread) |
|
PCSR_THREAD NTAPI | CsrAddStaticServerThread (IN HANDLE hThread, IN PCLIENT_ID ClientId, IN ULONG ThreadFlags) |
|
NTSTATUS NTAPI | CsrCreateRemoteThread (IN HANDLE hThread, IN PCLIENT_ID ClientId) |
|
NTSTATUS NTAPI | CsrCreateThread (IN PCSR_PROCESS CsrProcess, IN HANDLE hThread, IN PCLIENT_ID ClientId, IN BOOLEAN HaveClient) |
|
VOID NTAPI | CsrDereferenceThread (IN PCSR_THREAD CsrThread) |
|
NTSTATUS NTAPI | CsrDestroyThread (IN PCLIENT_ID Cid) |
|
NTSTATUS NTAPI | CsrExecServerThread (IN PVOID ThreadHandler, IN ULONG Flags) |
|
NTSTATUS NTAPI | CsrLockThreadByClientId (IN HANDLE Tid, OUT PCSR_THREAD *CsrThread) |
|
VOID NTAPI | CsrReferenceThread (IN PCSR_THREAD CsrThread) |
|
NTSTATUS NTAPI | CsrUnlockThread (IN PCSR_THREAD CsrThread) |
|
◆ CsrHashThread
◆ NDEBUG
◆ CsrAddStaticServerThread()
Definition at line 512 of file thredsup.c.
515{
517
518
520
521
523 if (CsrThread)
524 {
525
529 CsrThread->
Flags = ThreadFlags;
530
531
533
534
536 }
537 else
538 {
539 DPRINT1(
"CsrAddStaticServerThread: alloc failed for thread 0x%x\n",
hThread);
540 }
541
542
544 return CsrThread;
545}
#define InsertTailList(ListHead, Entry)
PCSR_PROCESS CsrRootProcess
#define CsrAcquireProcessLock()
#define CsrReleaseProcessLock()
BOOLEAN NTAPI ProtectHandle(IN HANDLE ObjectHandle)
PCSR_THREAD NTAPI CsrAllocateThread(IN PCSR_PROCESS CsrProcess)
_Out_ PCLIENT_ID ClientId
Referenced by CsrApiPortInitialize(), CsrpCheckRequestThreads(), CsrSbApiPortInitialize(), and GuiInit().
◆ CsrAllocateThread()
◆ CsrCreateRemoteThread()
Definition at line 569 of file thredsup.c.
571{
577
578
581 &KernelTimes,
582 sizeof(KernelTimes),
585 {
588 }
589
590
593 {
596 }
597
598
600 {
601
605 }
606
607
609 if (!CsrThread)
610 {
614 }
615
616
620 &ThreadHandle,
621 0,
622 0,
624
626 {
629 }
630
631
636 CsrThread->
Flags = 0;
637
638
641 {
642
647 }
648
649
652}
NTSTATUS NTAPI CsrUnlockProcess(IN PCSR_PROCESS CsrProcess)
NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, OUT PCSR_PROCESS *CsrProcess OPTIONAL)
#define NT_SUCCESS(StatCode)
#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 CsrInsertThread(IN PCSR_PROCESS Process, IN PCSR_THREAD Thread)
VOID NTAPI CsrDeallocateThread(IN PCSR_THREAD CsrThread)
#define DUPLICATE_SAME_ACCESS
Referenced by CreateRemoteThread().
◆ CsrCreateThread()
Definition at line 678 of file thredsup.c.
682{
688
689 if (HaveClient)
690 {
691
693 CurrentCid = CurrentThread->
ClientId;
694
695
697
698
700
701
702 if (!CurrentThread)
703 {
707 }
708 }
709 else
710 {
711
713 }
714
715
718 &KernelTimes,
719 sizeof(KernelTimes),
722 {
725 }
726
727
729 if (!CsrThread)
730 {
734 }
735
736
741 CsrThread->
Flags = 0;
742
743
746 {
747
751 }
752
753
755
757}
#define CsrGetClientThread()
PCSR_THREAD NTAPI CsrLocateThreadByClientId(OUT PCSR_PROCESS *Process OPTIONAL, IN PCLIENT_ID ClientId)
Referenced by CSR_API().
◆ CsrDeallocateThread()
◆ CsrDereferenceThread()
◆ CsrDestroyThread()
Definition at line 814 of file thredsup.c.
815{
819
820
822
823
826
827
829 {
830
833 }
834
835
837
838
840
841
843 {
844
851 }
852
853
855
856
858
859
862}
struct _CSR_WAIT_BLOCK * WaitBlock
#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)
#define CsrReleaseWaitLock()
VOID NTAPI CsrLockedDereferenceThread(IN PCSR_THREAD CsrThread)
Referenced by CsrApiRequestThread().
◆ CsrExecServerThread()
Definition at line 886 of file thredsup.c.
888{
893
894
896
897
900 if (!CsrThread)
901 {
902
905 }
906
907
911 0,
912 0,
913 0,
914 ThreadHandler,
919 {
920
924 }
925
926
931
932
934
935
937
938
941}
#define InsertHeadList(ListHead, Entry)
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)
_Must_inspect_result_ _In_ ULONG Flags
Referenced by CSR_API().
◆ CsrInsertThread()
Definition at line 297 of file thredsup.c.
299{
303
304
305
313
314
316
317
319
320
322
323
326}
_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
LIST_ENTRY CsrThreadHashTable[NUMBER_THREAD_HASH_BUCKETS]
Referenced by CsrCreateProcess(), CsrCreateRemoteThread(), CsrCreateThread(), and CsrSbCreateSession().
◆ CsrLocateThreadByClientId()
◆ CsrLocateThreadInProcess()
Definition at line 248 of file thredsup.c.
250{
253
254
256
257
259 NextEntry = ListHead->
Flink;
260
261
262 while (NextEntry != ListHead)
263 {
264
266
267
269
270
271 NextEntry = NextEntry->
Flink;
272 }
273
274
275 return FoundThread;
276}
static int Link(const char **args)
Referenced by CsrConnectToUser().
◆ CsrLockedDereferenceThread()
◆ CsrLockedReferenceThread()
◆ CsrLockThreadByClientId()
Definition at line 965 of file thredsup.c.
967{
972
973
975
976
979
980
982
983
985
986
988 {
989
991
992
995 {
996
997 break;
998 }
999
1000
1001 NextEntry = NextEntry->
Flink;
1002 }
1003
1004
1006
1007
1008 if (CurrentThread)
1009 {
1010
1013 *CsrThread = CurrentThread;
1014 }
1015 else
1016 {
1017
1020 }
1021
1022
1024}
#define STATUS_UNSUCCESSFUL
Referenced by GetThreadConsoleDesktop().
◆ CsrReferenceThread()
◆ CsrRemoveThread()
Definition at line 373 of file thredsup.c.
374{
376
377
379
380
381 CsrThread->Process->ThreadCount--;
382
383
384 if (CsrThread->HashLinks.Flink)
RemoveEntryList(&CsrThread->HashLinks);
385
386
387 if (CsrThread->Process->ThreadCount == 0)
388 {
389
391 {
392
394
395
397 }
398 }
399
400
402}
@ CsrProcessLastThreadTerminated
#define RemoveEntryList(Entry)
#define ProcessStructureListLocked()
VOID NTAPI CsrLockedDereferenceProcess(PCSR_PROCESS CsrProcess)
Referenced by CsrThreadRefcountZero().
◆ CsrThreadRefcountZero()
Definition at line 424 of file thredsup.c.
425{
429
430
432
433
435
436
437 if (CsrThread->ThreadHandle)
438 {
442 }
443
444
446
447
449}
VOID NTAPI CsrDereferenceProcess(IN PCSR_PROCESS CsrProcess)
VOID NTAPI CsrRemoveThread(IN PCSR_THREAD CsrThread)
BOOLEAN NTAPI UnProtectHandle(IN HANDLE ObjectHandle)
Referenced by CsrDereferenceThread(), and CsrLockedDereferenceThread().
◆ CsrUnlockThread()
◆ ProtectHandle()
Definition at line 39 of file thredsup.c.
40{
43
44
46 ObjectHandleFlagInformation,
47 &HandleInfo,
48 sizeof(HandleInfo),
51 {
52
55 ObjectHandleFlagInformation,
56 &HandleInfo,
57 sizeof(HandleInfo));
59 }
60
61
63}
NTSTATUS NtQueryObject(IN HANDLE Handle, IN OBJECT_INFO_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG ObjectInformationLength, OUT PULONG ReturnLength)
NTSTATUS NTAPI NtSetInformationObject(IN HANDLE ObjectHandle, IN OBJECT_INFORMATION_CLASS ObjectInformationClass, IN PVOID ObjectInformation, IN ULONG Length)
Referenced by CsrAddStaticServerThread(), CsrCreateProcess(), CsrCreateRemoteThread(), CsrCreateThread(), CsrExecServerThread(), and CsrSbCreateSession().
◆ UnProtectHandle()
Definition at line 78 of file thredsup.c.
79{
82
83
85 ObjectHandleFlagInformation,
86 &HandleInfo,
87 sizeof(HandleInfo),
90 {
91
94 ObjectHandleFlagInformation,
95 &HandleInfo,
96 sizeof(HandleInfo));
98 }
99
100
102}
Referenced by CsrThreadRefcountZero().
◆ CsrThreadHashTable