Process and Thread Functions (进程和线程相关API函数)

Process and Thread 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 specified user.
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 a process and all its threads.
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.
GetCurrentProcessorNumberReturns 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.
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.
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 process object.
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.
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.

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.

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.
CreateThreadCreates a thread to execute within the virtual address space of the calling process.
ExitThreadEnds a 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.
GetThreadIdRetrieves the thread identifier of 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.
GetThreadStartInformationRetrieves the Win32 initialization information for the specified thread.
GetThreadTimesRetrieves timing information for the specified thread.
OpenThreadOpens an existing thread object.
ResumeThreadDecrements a thread's suspend count.
SetThreadAffinityMaskSets a processor affinity mask for the specified thread.
SetThreadIdealProcessorSpecifies a preferred processor for a thread.
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.

The following functions are used with WOW64.

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

The following functions are used with job objects.

FunctionDescription
AssignProcessToJobObjectAssociates a process with an existing job object.
CreateJobObjectCreates or opens a job object.
IsProcessInJobDetermines if 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.

The following functions are used with the thread pool.

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.

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.
SwitchToFiberSchedules a fiber.

The following functions provide NUMA support.

FunctionDescription
GetNumaAvailableMemoryNodeRetrieves the amount of memory available in the specified node.
GetNumaHighestNodeNumberRetrieves the node that currently has the highest number.
GetNumaNodeProcessorMaskRetrieves the processor mask for the specified node.
GetNumaProcessorNodeRetrieves the node number for the specified processor.

 

Obsolete Functions

 

These functions are provided only for compatibility with 16-bit versions of Windows.

WinExec

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值