17#define SXS_SUPPORT_FIXME
31 DPRINT(
"BasepNotifyCsrOfThread: Thread: %p, Handle %p\n",
42 sizeof(*CreateThreadRequest));
45 DPRINT1(
"Failed to tell CSRSS about new thread: %lx\n", ApiMessage.
Status);
96 RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActivationFrame;
99 ActivationFrame.Size =
sizeof(ActivationFrame);
103 if (ActivationContext == INVALID_ACTIVATION_CONTEXT)
111 RtlActivateActivationContextUnsafeFast(&ActivationFrame, ActivationContext);
125 RtlDeactivateActivationContextUnsafeFast(&ActivationFrame);
178 ACTIVATION_CONTEXT_BASIC_INFORMATION ActCtxInfo;
183 DPRINT(
"CreateRemoteThread: hProcess: %p dwStackSize: %lu lpStartAddress"
184 ": %p lpParameter: %p, dwCreationFlags: %lx\n",
hProcess,
185 dwStackSize, lpStartAddress, lpParameter, dwCreationFlags);
242 sizeof(ThreadBasicInfo),
247 DPRINT1(
"SXS: %s - Failing thread create because "
248 "NtQueryInformationThread() failed with status %08lx\n",
254 Status = RtlAllocateActivationContextStack(&ActivationContextStack);
258 DPRINT1(
"SXS: %s - Failing thread create because "
259 "RtlAllocateActivationContextStack() failed with status %08lx\n",
272 ActivationContextBasicInformation,
279 DPRINT1(
"SXS: %s - Failing thread create because "
280 "RtlQueryInformationActivationContext() failed with status %08lx\n",
286 if ((ActCtxInfo.hActCtx) && !(ActCtxInfo.dwFlags & 1))
296 DPRINT1(
"SXS: %s - Failing thread create because "
297 "RtlActivateActivationContextEx() failed with status %08lx\n",
321 "CsrCreateRemoteThread");
336 if (ActivationContextStack)
337 RtlFreeActivationContextStack(ActivationContextStack);
569 ULONG PreviousResumeCount;
579 return PreviousResumeCount;
644 ULONG PreviousSuspendCount;
654 return PreviousSuspendCount;
669 AffinityMask = (
KAFFINITY)dwThreadAffinityMask;
703 LONG Prio = nPriority;
805 IN BOOL bDisablePriorityBoost)
835 DESCRIPTOR_TABLE_ENTRY DescriptionTableEntry;
839 DescriptionTableEntry.Selector = dwSelector;
842 &DescriptionTableEntry,
843 sizeof(DESCRIPTOR_TABLE_ENTRY),
853 *lpSelectorEntry = DescriptionTableEntry.Descriptor;
856 DPRINT1(
"Calling GetThreadSelectorEntry!\n");
939#if (NTDDI_VERSION < NTDDI_LONGHORN)
964 ACTIVATION_CONTEXT_BASIC_INFORMATION ActCtxInfo;
971 ActivationContextBasicInformation,
978 DbgPrint(
"SXS: %s failing because RtlQueryInformationActivationContext()"
989 (ActCtxInfo.dwFlags & 1) ?
990 INVALID_ACTIVATION_CONTEXT : ActCtxInfo.hActCtx);
1009 ULONG GuaranteedStackBytes;
1012 if (!StackSizeInBytes)
1024 *StackSizeInBytes = GuaranteedStackBytes;
1062 *lpIOIsPending = IoPending ?
TRUE :
FALSE;
1113 if (
Index != 0xFFFFFFFF)
1123 if (
Index != 0xFFFFFFFF)
#define DECLSPEC_HOTPATCH
#define BASESRV_SERVERDLL_INDEX
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define CSR_CREATE_API_NUMBER(ServerId, ApiId)
NTSTATUS NTAPI CsrCreateRemoteThread(IN HANDLE hThread, IN PCLIENT_ID ClientId)
#define STATUS_NOT_SUPPORTED
#define RtlFindClearBitsAndSet
#define NT_SUCCESS(StatCode)
#define ERROR_INVALID_PARAMETER
#define GetProcAddress(x, y)
@ ThreadDescriptorTableEntry
#define ERROR_INVALID_HANDLE
BOOLEAN BaseRunningInServerProcess
LONG WINAPI UnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
VOID WINAPI ExitProcess(IN UINT uExitCode)
DWORD WINAPI QueueUserAPC(IN PAPCFUNC pfnAPC, IN HANDLE hThread, IN ULONG_PTR dwData)
LPVOID WINAPI TlsGetValue(IN DWORD Index)
DWORD WINAPI ResumeThread(IN HANDLE hThread)
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
HANDLE WINAPI CreateRemoteThread(IN HANDLE hProcess, IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
VOID NTAPI BaseDispatchApc(IN PAPCFUNC ApcRoutine, IN PVOID Data, IN PACTIVATION_CONTEXT ActivationContext)
DWORD_PTR WINAPI SetThreadAffinityMask(IN HANDLE hThread, IN DWORD_PTR dwThreadAffinityMask)
DECLSPEC_NORETURN VOID WINAPI BaseThreadStartup(_In_ LPTHREAD_START_ROUTINE lpStartAddress, _In_ LPVOID lpParameter)
BOOL WINAPI SetThreadContext(IN HANDLE hThread, IN CONST CONTEXT *lpContext)
DWORD WINAPI TlsAlloc(VOID)
DWORD WINAPI SuspendThread(IN HANDLE hThread)
BOOL NTAPI GetThreadTimes(IN HANDLE hThread, OUT LPFILETIME lpCreationTime, OUT LPFILETIME lpExitTime, OUT LPFILETIME lpKernelTime, OUT LPFILETIME lpUserTime)
LANGID WINAPI SetThreadUILanguage(IN LANGID LangId)
VOID WINAPI ExitThread(IN DWORD uExitCode)
HANDLE WINAPI OpenThread(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwThreadId)
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
DWORD WINAPI GetProcessIdOfThread(IN HANDLE Thread)
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
BOOL WINAPI GetThreadSelectorEntry(IN HANDLE hThread, IN DWORD dwSelector, OUT LPLDT_ENTRY lpSelectorEntry)
DWORD WINAPI SetThreadIdealProcessor(IN HANDLE hThread, IN DWORD dwIdealProcessor)
NTSTATUS(NTAPI * PCSR_CREATE_REMOTE_THREAD)(IN HANDLE ThreadHandle, IN PCLIENT_ID ClientId)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
BOOL WINAPI TerminateThread(IN HANDLE hThread, IN DWORD dwExitCode)
NTSTATUS WINAPI BasepNotifyCsrOfThread(IN HANDLE ThreadHandle, IN PCLIENT_ID ClientId)
BOOL WINAPI TlsFree(IN DWORD Index)
BOOL WINAPI SetThreadStackGuarantee(IN OUT PULONG StackSizeInBytes)
DWORD WINAPI GetThreadId(IN HANDLE Thread)
BOOL WINAPI GetThreadPriorityBoost(IN HANDLE hThread, OUT PBOOL pDisablePriorityBoost)
BOOL NTAPI SetThreadPriorityBoost(IN HANDLE hThread, IN BOOL bDisablePriorityBoost)
int WINAPI GetThreadPriority(IN HANDLE hThread)
BOOL WINAPI GetThreadIOPendingFlag(IN HANDLE hThread, OUT PBOOL lpIOIsPending)
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
BOOL WINAPI GetThreadContext(IN HANDLE hThread, OUT LPCONTEXT lpContext)
NTSTATUS WINAPI BaseCreateStack(_In_ HANDLE hProcess, _In_opt_ SIZE_T StackCommit, _In_opt_ SIZE_T StackReserve, _Out_ PINITIAL_TEB InitialTeb)
VOID WINAPI BaseInitializeContext(IN PCONTEXT Context, IN PVOID Parameter, IN PVOID StartAddress, IN PVOID StackAddress, IN ULONG ContextType)
POBJECT_ATTRIBUTES WINAPI BaseFormatObjectAttributes(OUT POBJECT_ATTRIBUTES ObjectAttributes, IN PSECURITY_ATTRIBUTES SecurityAttributes OPTIONAL, IN PUNICODE_STRING ObjectName)
VOID WINAPI BaseFreeThreadStack(_In_ HANDLE hProcess, _In_ PINITIAL_TEB InitialTeb)
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
#define EXCEPTION_EXECUTE_HANDLER
#define TLS_EXPANSION_SLOTS
NTSYSAPI void WINAPI RtlReleasePebLock(void)
NTSYSAPI void WINAPI RtlAcquirePebLock(void)
NTSYSAPI NTSTATUS WINAPI NtYieldExecution(void)
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
NTSYSAPI void WINAPI LdrShutdownThread(void)
NTSYSAPI NTSTATUS WINAPI RtlQueryInformationActivationContext(ULONG, HANDLE, PVOID, ULONG, PVOID, SIZE_T, SIZE_T *)
struct _FILETIME * LPFILETIME
_In_ BOOL _In_ HANDLE hProcess
struct _ThreadInfo ThreadInfo
static HANDLE ULONG_PTR dwData
static BOOL bInheritHandle
#define InitializeObjectAttributes(p, n, a, r, s)
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE ApcRoutine
VOID(NTAPI * PKNORMAL_ROUTINE)(IN PVOID NormalContext OPTIONAL, IN PVOID SystemArgument1 OPTIONAL, IN PVOID SystemArgument2 OPTIONAL)
NTSYSAPI NTSTATUS NTAPI RtlQueueWorkItem(_In_ WORKERCALLBACKFUNC Function, _In_opt_ PVOID Context, _In_ ULONG Flags)
#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER
#define RTL_ACTIVATE_ACTIVATION_CONTEXT_EX_FLAG_RELEASE_ON_STACK_DEALLOCATION
#define RTL_QUERY_ACTIVATION_CONTEXT_FLAG_USE_ACTIVE_ACTIVATION_CONTEXT
VOID(NTAPI * WORKERCALLBACKFUNC)(_In_ PVOID Context)
#define THREAD_ALL_ACCESS
NTSTATUS NtTerminateThread(IN HANDLE ThreadHandle OPTIONAL, IN NTSTATUS ExitStatus)
#define NtCurrentProcess()
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI NtCreateThread(OUT PHANDLE phThread, IN ACCESS_MASK AccessMask, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE hProcess, OUT PCLIENT_ID pClientId, IN PCONTEXT pContext, OUT PSTACKINFO pStackInfo, IN BOOLEAN bSuspended)
#define DECLSPEC_NORETURN
NTSTATUS NTAPI NtSetContextThread(IN HANDLE ThreadHandle, IN PCONTEXT ThreadContext)
NTSTATUS NTAPI NtGetContextThread(IN HANDLE ThreadHandle, IN OUT PCONTEXT ThreadContext)
NTSTATUS NTAPI NtQueryInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength, OUT PULONG ReturnLength OPTIONAL)
NTSTATUS NTAPI NtSetInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
NTSTATUS NTAPI NtQueueApcThread(IN HANDLE ThreadHandle, IN PKNORMAL_ROUTINE ApcRoutine, IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
NTSTATUS NTAPI NtSuspendThread(IN HANDLE ThreadHandle, OUT PULONG PreviousSuspendCount OPTIONAL)
NTSTATUS NTAPI NtOpenThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId OPTIONAL)
#define STATUS_NO_YIELD_PERFORMED
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
DWORD BaseSetLastNTError(IN NTSTATUS Status)
#define LANGIDFROMLCID(l)
NTSTATUS NTAPI CsrNewThread(VOID)
NTSTATUS NTAPI CsrClientCallServer(_Inout_ PCSR_API_MESSAGE ApiMessage, _Inout_opt_ PCSR_CAPTURE_BUFFER CaptureBuffer, _In_ CSR_API_NUMBER ApiNumber, _In_ ULONG DataLength)
NTSTATUS WINAPI RtlActivateActivationContextEx(ULONG flags, TEB *teb, HANDLE handle, ULONG_PTR *cookie)
#define TLS_MINIMUM_AVAILABLE
BASE_CREATE_THREAD CreateThreadRequest
union _BASE_API_MESSAGE::@3534 Data
PRTL_BITMAP TlsExpansionBitmap
PVOID ActivationContextStackPointer
PVOID * TlsExpansionSlots
ULONG GuaranteedStackBytes
PPEB ProcessEnvironmentBlock
#define UNIMPLEMENTED_ONCE
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_PARAMETER
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_In_ WDFREQUEST _In_ NTSTATUS _In_ CCHAR PriorityBoost
DWORD WINAPI GetCurrentThreadId(void)
BOOL WINAPI SwitchToThread(void)
#define STACK_SIZE_PARAM_IS_A_RESERVATION
#define THREAD_PRIORITY_TIME_CRITICAL
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
#define THREAD_PRIORITY_ERROR_RETURN
#define THREAD_PRIORITY_IDLE
_Must_inspect_result_ _In_ ULONG Flags
_In_opt_ PVOID _Out_ PLARGE_INTEGER Cookie
_Out_ PCLIENT_ID ClientId
#define NtCurrentThread()