Process and Thread Function ...


Process and Thread Functions

This topic describes the process and thread functions.

Process Functions

The following functions are used with processes.

FunctionDescription
CreateProcessCreates a new process and its primary thread.
CreateProcessAsUserCreates a new process and its primary thread. The new process runs in the security context of the user represented by the specified token.
CreateProcessWithLogonWCreates a new process and its primary thread. The new process then runs the specified executable file in the security context of the specified credentials (user, domain, and password).
CreateProcessWithTokenWCreates a new process and its primary thread. The new process runs in the security context of the specified token.
ExitProcessEnds the calling process and all its threads.
FlushProcessWriteBuffersFlushes the write queue of each processor that is running a thread of the current process.
FreeEnvironmentStringsFrees a block of environment strings.
GetCommandLineRetrieves the command-line string for the current process.
GetCurrentProcessRetrieves a pseudo handle for the current process.
GetCurrentProcessIdRetrieves the process identifier of the calling process.
GetCurrentProcessorNumberRetrieves the number of the processor the current thread was running on during the call to this function.
GetEnvironmentStringsRetrieves the environment block for the current process.
GetEnvironmentVariableRetrieves the value of the specified variable from the environment block of the calling process.
GetExitCodeProcessRetrieves the termination status of the specified process.
GetGuiResourcesRetrieves the count of handles to graphical user interface (GUI) objects in use by the specified process.
GetLogicalProcessorInformationRetrieves information about logical processors and related hardware.
GetPriorityClassRetrieves the priority class for the specified process.
GetProcessAffinityMaskRetrieves a process affinity mask for the specified process and the system affinity mask for the system.
GetProcessGroupAffinityRetrieves the processor group affinity of the specified process.
GetProcessHandleCountRetrieves the number of open handles that belong to the specified process.
GetProcessIdRetrieves the process identifier of the specified process.
GetProcessIdOfThreadRetrieves the process identifier of the process associated with the specified thread.
GetProcessIoCountersRetrieves accounting information for all I/O operations performed by the specified process.
GetProcessPriorityBoostRetrieves the priority boost control state of the specified process.
GetProcessShutdownParametersRetrieves shutdown parameters for the currently calling process.
GetProcessTimesRetrieves timing information about for the specified process.
GetProcessVersionRetrieves the major and minor version numbers of the system on which the specified process expects to run.
GetProcessWorkingSetSizeRetrieves the minimum and maximum working set sizes of the specified process.
GetProcessWorkingSetSizeExRetrieves the minimum and maximum working set sizes of the specified process.
GetProcessorSystemCycleTimeRetrieves the cycle time each processor in the specified group spent executing deferred procedure calls (DPCs) and interrupt service routines (ISRs).
GetStartupInfoRetrieves the contents of the STARTUPINFO structure that was specified when the calling process was created.
NeedCurrentDirectoryForExePathDetermines whether the current directory should be included in the search path for the specified executable.
OpenProcessOpens an existing local process object.
QueryFullProcessImageNameRetrieves the full name of the executable image for the specified process.
QueryProcessAffinityUpdateModeRetrieves the affinity update mode of the specified process.
QueryProcessCycleTimeRetrieves the sum of the cycle time of all threads of the specified process.
SetEnvironmentVariableSets the value of an environment variable for the current process.
SetPriorityClassSets the priority class for the specified process.
SetProcessAffinityMaskSets a processor affinity mask for the threads of a specified process.
SetProcessAffinityUpdateModeSets the affinity update mode of the specified process.
SetProcessPriorityBoostDisables the ability of the system to temporarily boost the priority of the threads of the specified process.
SetProcessShutdownParametersSets shutdown parameters for the currently calling process.
SetProcessWorkingSetSizeSets the minimum and maximum working set sizes for the specified process.
SetProcessWorkingSetSizeExSets the minimum and maximum working set sizes for the specified process.
TerminateProcessTerminates the specified process and all of its threads.

 

Process Enumeration Functions

The following functions are used to enumerate processes.

FunctionDescription
EnumProcessesRetrieves the process identifier for each process object in the system.
Process32FirstRetrieves information about the first process encountered in a system snapshot.
Process32NextRetrieves information about the next process recorded in a system snapshot.
WTSEnumerateProcessesRetrieves information about the active processes on the specified terminal server.

 

Thread Functions

The following functions are used with threads.

FunctionDescription
AttachThreadInputAttaches the input processing mechanism of one thread to that of another thread.
CreateRemoteThreadCreates a thread that runs in the virtual address space of another process.
CreateRemoteThreadExCreates a thread that runs in the virtual address space of another process and optionally specifies extended attributes such as processor group affinity.
CreateThreadCreates a thread to execute within the virtual address space of the calling process.
ExitThreadEnds the calling thread.
GetCurrentThreadRetrieves a pseudo handle for the current thread.
GetCurrentThreadIdRetrieves the thread identifier of the calling thread.
GetExitCodeThreadRetrieves the termination status of the specified thread.
GetThreadGroupAffinityRetrieves the processor group affinity of the specified thread.
GetThreadIdRetrieves the thread identifier of the specified thread.
GetThreadIdealProcessorExRetrieves the processor number of the ideal processor for the specified thread.
GetThreadIOPendingFlagDetermines whether a specified thread has any I/O requests pending.
GetThreadPriorityRetrieves the priority value for the specified thread.
GetThreadPriorityBoostRetrieves the priority boost control state of the specified thread.
GetThreadTimesRetrieves timing information for the specified thread.
OpenThreadOpens an existing thread object.
QueryIdleProcessorCycleTimeRetrieves the cycle time for the idle thread of each processor in the system.
QueryThreadCycleTimeRetrieves the cycle time for the specified thread.
ResumeThreadDecrements a thread's suspend count.
SetThreadAffinityMaskSets a processor affinity mask for the specified thread.
SetThreadGroupAffinitySets the processor group affinity for the specified thread.
SetThreadIdealProcessorSpecifies a preferred processor for a thread.
SetThreadIdealProcessorExSets the ideal processor for the specified thread and optionally retrieves the previous ideal processor.
SetThreadPrioritySets the priority value for the specified thread.
SetThreadPriorityBoostDisables the ability of the system to temporarily boost the priority of a thread.
SetThreadStackGuaranteeSets the stack guarantee for the calling thread.
SleepSuspends the execution of the current thread for a specified interval.
SleepExSuspends the current thread until the specified condition is met.
SuspendThreadSuspends the specified thread.
SwitchToThreadCauses the calling thread to yield execution to another thread that is ready to run on the current processor.
TerminateThreadTerminates a thread.
ThreadProcAn application-defined function that serves as the starting address for a thread.
TlsAllocAllocates a thread local storage (TLS) index.
TlsFreeReleases a TLS index.
TlsGetValueRetrieves the value in the calling thread's TLS slot for a specified TLS index.
TlsSetValueStores a value in the calling thread's TLS slot for a specified TLS index.
WaitForInputIdleWaits until the specified process is waiting for user input with no input pending, or until the time-out interval has elapsed.

 

Process and Thread Extended Attribute Functions

The following functions are used to set extended attributes for process and thread creation.

FunctionDescription
DeleteProcThreadAttributeListDeletes the specified list of attributes for process and thread creation.
InitializeProcThreadAttributeListInitializes the specified list of attributes for process and thread creation.
UpdateProcThreadAttributeUpdates the specified attribute in the specified list of attributes for process and thread creation.

 

WOW64 Functions

The following functions are used with WOW64.

FunctionDescription
IsWow64MessageDetermines whether the last message read from the current thread's queue originated from a WOW64 process.
IsWow64ProcessDetermines whether the specified process is running under WOW64.
Wow64SuspendThreadSuspends the specified WOW64 thread.

 

Job Object Functions

The following functions are used with job objects.

FunctionDescription
AssignProcessToJobObjectAssociates a process with an existing job object.
CreateJobObjectCreates or opens a job object.
IsProcessInJobDetermines whether the process is running in the specified job.
OpenJobObjectOpens an existing job object.
QueryInformationJobObjectRetrieves limit and job state information from the job object.
SetInformationJobObjectSet limits for a job object.
TerminateJobObjectTerminates all processes currently associated with the job.
UserHandleGrantAccessGrants or denies access to a handle to a User object to a job that has a user-interface restriction.

 

Thread Pool Functions

The following functions are used with thread pools.

FunctionDescription
CallbackMayRunLongIndicates that the callback may not return quickly.
CancelThreadpoolIoCancels the notification from the StartThreadpoolIo function.
CloseThreadpoolCloses the specified thread pool.
CloseThreadpoolCleanupGroupCloses the specified cleanup group.
CloseThreadpoolCleanupGroupMembersReleases the members of the specified cleanup group, waits for all callback functions to complete, and optionally cancels any outstanding callback functions.
CloseThreadpoolIoReleases the specified I/O completion object.
CloseThreadpoolTimerReleases the specified timer object.
CloseThreadpoolWaitReleases the specified wait object.
CloseThreadpoolWorkReleases the specified work object.
CreateThreadpoolAllocates a new pool of threads to execute callbacks.
CreateThreadpoolCleanupGroupCreates a cleanup group that applications can use to track one or more thread pool callbacks.
CreateThreadpoolIoCreates a new I/O completion object.
CreateThreadpoolTimerCreates a new timer object.
CreateThreadpoolWaitCreates a new wait object.
CreateThreadpoolWorkCreates a new work object.
DestroyThreadpoolEnvironmentDeletes the specified callback environment. Call this function when the callback environment is no longer needed for creating new thread pool objects.
DisassociateCurrentThreadFromCallbackRemoves the association between the currently executing callback function and the object that initiated the callback. The current thread will no longer count as executing a callback on behalf of the object.
FreeLibraryWhenCallbackReturnsSpecifies the DLL that the thread pool will unload when the current callback completes.
InitializeThreadpoolEnvironmentInitializes a callback environment.
IsThreadpoolTimerSetDetermines whether the specified timer object is currently set.
LeaveCriticalSectionWhenCallbackReturnsSpecifies the critical section that the thread pool will release when the current callback completes.
QueryThreadpoolStackInformationRetrieves the stack reserve and commit sizes for threads in the specified thread pool.
ReleaseMutexWhenCallbackReturnsSpecifies the mutex that the thread pool will release when the current callback completes.
ReleaseSemaphoreWhenCallbackReturnsSpecifies the semaphore that the thread pool will release when the current callback completes.
SetEventWhenCallbackReturnsSpecifies the event that the thread pool will set when the current callback completes.
SetThreadpoolCallbackCleanupGroupAssociates the specified cleanup group with the specified callback environment.
SetThreadpoolCallbackLibraryEnsures that the specified DLL remains loaded as long as there are outstanding callbacks.
SetThreadpoolCallbackPersistentSpecifies that the callback should run on a persistent thread.
SetThreadpoolCallbackPoolSets the thread pool to be used when generating callbacks.
SetThreadpoolCallbackPrioritySpecifies the priority of a callback function relative to other work items in the same thread pool.
SetThreadpoolCallbackRunsLongIndicates that callbacks associated with this callback environment may not return quickly.
SetThreadpoolStackInformationSets the stack reserve and commit sizes for new threads in the specified thread pool.
SetThreadpoolThreadMaximumSets the maximum number of threads that the specified thread pool can allocate to process callbacks.
SetThreadpoolThreadMinimumSets the minimum number of threads that the specified thread pool must make available to process callbacks.
SetThreadpoolTimerSets the timer object. A worker thread calls the timer object's callback after the specified timeout expires.
SetThreadpoolWaitSets the wait object. A worker thread calls the wait object's callback function after the handle becomes signaled or after the specified timeout expires.
StartThreadpoolIoNotifies the thread pool that I/O operations may possibly begin for the specified I/O completion object. A worker thread calls the I/O completion object's callback function after the operation completes on the file handle bound to this object.
SubmitThreadpoolWorkPosts a work object to the thread pool. A worker thread calls the work object's callback function.
TrySubmitThreadpoolCallbackRequests that a thread pool worker thread call the specified callback function.
WaitForThreadpoolIoCallbacksWaits for outstanding I/O completion callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.
WaitForThreadpoolTimerCallbacksWaits for outstanding timer callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.
WaitForThreadpoolWaitCallbacksWaits for outstanding wait callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.
WaitForThreadpoolWorkCallbacksWaits for outstanding work callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.

 

The following functions are part of the original thread pooling API.

FunctionDescription
BindIoCompletionCallbackAssociates the I/O completion port owned by the thread pool with the specified file handle. On completion of an I/O request involving this file, a non-I/O worker thread will execute the specified callback function.
QueueUserWorkItemQueues a work item to a worker thread in the thread pool.
RegisterWaitForSingleObjectDirects a wait thread in the thread pool to wait on the object.
UnregisterWaitExWaits until one or all of the specified objects are in the signaled state or the time-out interval elapses.

 

Thread Ordering Service Functions

The following functions are used with the thread ordering service.

FunctionDescription
AvQuerySystemResponsivenessRetrieves the system responsiveness setting used by the multimedia class scheduler service.
AvRtCreateThreadOrderingGroupCreates a thread ordering group.
AvRtCreateThreadOrderingGroupExCreates a thread ordering group and associates the server thread with a task.
AvRtDeleteThreadOrderingGroupDeletes the specified thread ordering group created by the caller.
AvRtJoinThreadOrderingGroupJoins client threads to a thread ordering group.
AvRtLeaveThreadOrderingGroupEnables client threads to leave a thread ordering group.
AvRtWaitOnThreadOrderingGroupEnables client threads of a thread ordering group to wait until they should execute.

 

Multimedia Class Scheduler Service Functions

The following functions are used with the multimedia class scheduler service.

FunctionDescription
AvRevertMmThreadCharacteristicsIndicates that a thread is no longer performing work associated with the specified task.
AvSetMmMaxThreadCharacteristicsAssociates the calling thread with the specified tasks.
AvSetMmThreadCharacteristicsAssociates the calling thread with the specified task.
AvSetMmThreadPriorityAdjusts the thread priority of the calling thread relative to other threads performing the same task.

 

Fiber Functions

The following functions are used with fibers.

FunctionDescription
ConvertFiberToThreadConverts the current fiber into a thread.
ConvertThreadToFiberConverts the current thread into a fiber.
ConvertThreadToFiberExConverts the current thread into a fiber.
CreateFiberAllocates a fiber object, assigns it a stack, and sets up execution to begin at the specified start address.
CreateFiberExAllocates a fiber object, assigns it a stack, and sets up execution to begin at the specified start address.
DeleteFiberDeletes an existing fiber.
FiberProcAn application-defined function used with the CreateFiber function.
FlsAllocAllocates a fiber local storage (FLS) index.
FlsFreeReleases an FLS index.
FlsGetValueRetrieves the value in the calling fiber's FLS slot for a specified FLS index.
FlsSetValueStores a value in the calling fiber's FLS slot for a specified FLS index.
IsThreadAFiberDetermines whether the current thread is a fiber.
SwitchToFiberSchedules a fiber.

 

NUMA Support Functions

The following functions provide NUMA support.

FunctionDescription
AllocateUserPhysicalPagesNumaReserves or commits a region of memory within the virtual address space of the specified process, and specifies the NUMA node for the physical memory.
GetLogicalProcessorInformationRetrieves information about logical processors and related hardware.
GetNumaAvailableMemoryNodeRetrieves the amount of memory available in the specified node.
GetNumaAvailableMemoryNodeExRetrieves the amount of memory that is available in the specified node as a USHORT value.
GetNumaHighestNodeNumberRetrieves the node that currently has the highest number.
GetNumaNodeNumberFromHandleRetrieves the NUMA node associated with the underlying device for a file handle.
GetNumaNodeProcessorMaskRetrieves the processor mask for the specified node.
GetNumaNodeProcessorMaskExRetrieves the processor mask for the specified NUMA node as a USHORT value.
GetNumaProcessorNodeRetrieves the node number for the specified processor.
GetNumaProcessorNodeExRetrieves the node number of the specified logical processor as a USHORT value.
GetNumaProximityNodeRetrieves the node number for the specified proximity identifier.
GetNumaProximityNodeExRetrieves the node number as a USHORT value for the specified proximity identifier.
VirtualAllocExNumaReserves or commits a region of memory within the virtual address space of the specified process, and specifies the NUMA node for the physical memory.

 

Processor Functions

The following functions are used with logical processors and processor groups.

FunctionDescription
GetActiveProcessorCountReturns the number of active processors in a processor group or in the system.
GetActiveProcessorGroupCountReturns the number of active processor groups in the system.
GetCurrentProcessorNumberRetrieves the number of the processor the current thread was running on during the call to this function.
GetCurrentProcessorNumberExRetrieves the processor group and number of the logical processor in which the calling thread is running.
GetLogicalProcessorInformationRetrieves information about logical processors and related hardware.
GetLogicalProcessorInformationExRetrieves information about the relationships of logical processors and related hardware.
GetMaximumProcessorCountReturns the maximum number of logical processors that a processor group or the system can have.
GetMaximumProcessorGroupCountReturns the maximum number of processor groups that the system can have.
QueryIdleProcessorCycleTimeRetrieves the cycle time for the idle thread of each processor in the system.
QueryIdleProcessorCycleTimeExRetrieves the accumulated cycle time for the idle thread on each logical processor in the specified processor group.

 

User-Mode Scheduling Functions

The following functions are used with user-mode scheduling (UMS).

FunctionDescription
CreateUmsCompletionListCreates a UMS completion list.
CreateUmsThreadContextCreates a UMS thread context to represent a UMS worker thread.
DeleteUmsCompletionListDeletes the specified UMS completion list. The list must be empty.
DeleteUmsThreadContextDeletes the specified UMS thread context. The thread must be terminated.
DequeueUmsCompletionListItemsRetrieves UMS worker threads from the specified UMS completion list.
EnterUmsSchedulingModeConverts the calling thread into a UMS scheduler thread.
ExecuteUmsThreadRuns the specified UMS worker thread.
GetCurrentUmsThreadReturns the UMS thread context of the calling UMS thread.
GetNextUmsListItemReturns the next UMS thread context in a list of UMS thread contexts.
GetUmsCompletionListEventRetrieves a handle to the event associated with the specified UMS completion list.
QueryUmsThreadInformationRetrieves information about the specified UMS worker thread.
SetUmsThreadInformationSets application-specific context information for the specified UMS worker thread.
UmsSchedulerProcThe application-defined UMS scheduler entry point function associated with a UMS completion list.
UmsThreadYieldYields control to the UMS scheduler thread on which the calling UMS worker thread is running.

 

Obsolete Functions

Send comments about this topic to Microsoft

Build date: 10/8/2009

Tags :


Page view tracker