网站首页  词典首页

请输入您要查询的函数:

 

术语 createtoolhelp32snapshot
释义 CreateToolhelp32Snapshot
语法:
C++
HANDLE WINAPI CreateToolhelp32Snapshot(
__in DWORD dwFlags,
__in DWORD th32ProcessID
);
CreateToolhelp32Snapshot函数
注意到一个指定的进程的快照,以及堆,模块和进程使用这些线程。
参数
dwFlags [in]
该系统的部分将列入快照。此参数可以是一个或多个下列值。
ValueMeaning
TH32CS_INHERIT
0x80000000Indicates的快照句柄要继承。
TH32CS_SNAPALLIncludes系统中的所有进程和线程,再加上堆,并在th32ProcessID中指定的进程模块。相当于指定TH32CS_SNAPHEAPLIST,TH32CS_SNAPMODULE,TH32CS_SNAPPROCESS,价值观和TH32CS_SNAPTHREAD结合使用OR操作('|').
TH32CS_SNAPHEAPLIST
0x00000001Includes在th32ProcessID中指定快照的进程的所有堆。枚举堆,见Heap32ListFirst。
TH32CS_SNAPMODULE
0x00000008Includes在th32ProcessID中指定快照的进程的所有模块。列举的模块,见Module32First。
64位Windows:使用该标志的32位进程包括32在th32ProcessID中指定的进程位模块,而使用它在64位进程,包括64位模块。以包括32所指明的th32ProcessID从64位进程,使用TH32CS_SNAPMODULE32标志位模块的过程。
TH32CS_SNAPMODULE32
0x00000010Includes所有32在th32ProcessID中指定当从64位过程称为快照的进程位模块。此标志可与TH32CS_SNAPMODULE或TH32CS_SNAPALL。
TH32CS_SNAPPROCESS
0x00000002Includes在快照中的系统的所有进程。枚举进程,见Process32First。
TH32CS_SNAPTHREAD
0x00000004Includes在快照中的系统中的所有线程。枚举线程,见Thread32First。
为了确定线程属于一个特定的过程,比较其进程标识符向THREADENTRY32结构th32OwnerProcessID成员时列举的线程。
th32ProcessID [in]
该进程的进程标识符将列入快照。此参数可以是零,表示当前进程。使用此参数时,TH32CS_SNAPHEAPLIST,TH32CS_SNAPMODULE,TH32CS_SNAPMODULE32,或TH32CS_SNAPALL值是指定的。否则,它将被忽略,所有过程都在快照中。
如果指定的进程是空闲进程或CSRSS中的一个过程,这个函数失败,最后错误代码是ERROR_ACCESS_DENIED,因为他们的访问限制阻止他们打开用户级代码。
如果指定的进程是一个64位进程,并调用是一个32位进程,这个函数失败,最后错误代码是ERROR_PARTIAL_COPY(299)。
返回值
如果函数成功,它返回一个打开句柄指定的快照。
如果函数失败,则返回INVALID_HANDLE_VALUE。为了获得更多错误信息,调用GetLastError。可能的错误代码包括ERROR_BAD_LENGTH。
备注
这个功能所采取的快照被检查的其他工具的帮助功能,提供他们的成果。访问快照是只读的。快照句柄作为一个对象句柄的行为,并受到了有关的进程和线程它是有效英寸相同的规则
枚举所有进程堆或模块状态,指定TH32CS_SNAPALL并设置th32ProcessID为零。然后,快照中的每个额外的过程中,再次呼吁CreateToolhelp32Snapshot,指定其进程标识符和TH32CS_SNAPHEAPLIST或TH32_SNAPMODULE价值。
当拍摄快照,包括堆和一个进程比当前进程的其他模块,CreateToolhelp32Snapshot函数可能会失败或返回的原因有很多不正确的信息。例如,如果在目标进程中加载数据表损坏或不初始化,或者如果在作为结果的DLL函数调用模块列表的变化被加载或卸载,该函数可能会失败,ERROR_BAD_LENGTH或其他错误代码。 (在这种情况下,确保目标的过程中没有挂起状态开始,并尝试再次调用该函数。)
破坏快照,使用CloseHandle函数。
请注意,您可以使用QueryFullProcessImageName函数来检索32可执行的形象全名从32位进程-和64位进程。
实例
有关示例,请参阅以快照和浏览过程。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderTlhelp32.h
LibraryKernel32.lib
DLLKernel32.dll
参见
CloseHandle
Heap32ListFirst
Module32First
Process32First
该系统的快照
Thread32First
工具帮助函数
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==CreateToolhelp32Snapshot Function
Takes a snapshot of the specified processes, as well as the heaps, modules, and threads used by these processes.
Syntax
C++
HANDLE WINAPI CreateToolhelp32Snapshot(
__in DWORD dwFlags,
__in DWORD th32ProcessID
);
Parameters
dwFlags [in]
The portions of the system to be included in the snapshot. This parameter can be one or more of the following values.
ValueMeaning
TH32CS_INHERIT
0x80000000Indicates that the snapshot handle is to be inheritable.
TH32CS_SNAPALLIncludes all processes and threads in the system, plus the heaps and modules of the process specified in th32ProcessID. Equivalent to specifying the TH32CS_SNAPHEAPLIST, TH32CS_SNAPMODULE, TH32CS_SNAPPROCESS, and TH32CS_SNAPTHREAD values combined using an OR operation ('|').
TH32CS_SNAPHEAPLIST
0x00000001Includes all heaps of the process specified in th32ProcessID in the snapshot. To enumerate the heaps, see Heap32ListFirst .
TH32CS_SNAPMODULE
0x00000008Includes all modules of the process specified in th32ProcessID in the snapshot. To enumerate the modules, see Module32First .
64-bit Windows: Using this flag in a 32-bit process includes the 32-bit modules of the process specified in th32ProcessID, while using it in a 64-bit process includes the 64-bit modules. To include the 32-bit modules of the process specified in th32ProcessID from a 64-bit process, use the TH32CS_SNAPMODULE32 flag.
TH32CS_SNAPMODULE32
0x00000010Includes all 32-bit modules of the process specified in th32ProcessID in the snapshot when called from a 64-bit process. This flag can be combined with TH32CS_SNAPMODULE or TH32CS_SNAPALL.
TH32CS_SNAPPROCESS
0x00000002Includes all processes in the system in the snapshot. To enumerate the processes, see Process32First .
TH32CS_SNAPTHREAD
0x00000004Includes all threads in the system in the snapshot. To enumerate the threads, see Thread32First .
To identify the threads that belong to a specific process, compare its process identifier to the th32OwnerProcessID member of the THREADENTRY32 structure when enumerating the threads.

th32ProcessID [in]
The process identifier of the process to be included in the snapshot. This parameter can be zero to indicate the current process. This parameter is used when the TH32CS_SNAPHEAPLIST, TH32CS_SNAPMODULE, TH32CS_SNAPMODULE32, or TH32CS_SNAPALL value is specified. Otherwise, it is ignored and all processes are included in the snapshot.
If the specified process is the Idle process or one of the CSRSS processes, this function fails and the last error code is ERROR_ACCESS_DENIED because their access restrictions prevent user-level code from opening them.
If the specified process is a 64-bit process and the caller is a 32-bit process, this function fails and the last error code is ERROR_PARTIAL_COPY (299).
Return Value
If the function succeeds, it returns an open handle to the specified snapshot.
If the function fails, it returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError . Possible error codes include ERROR_BAD_LENGTH.
Remarks
The snapshot taken by this function is examined by the other tool help functions to provide their results. Access to the snapshot is read only. The snapshot handle acts as an object handle and is subject to the same rules regarding which processes and threads it is valid in.
To enumerate the heap or module states for all processes, specify TH32CS_SNAPALL and set th32ProcessID to zero. Then, for each additional process in the snapshot, call CreateToolhelp32Snapshot again, specifying its process identifier and the TH32CS_SNAPHEAPLIST or TH32_SNAPMODULE value.
When taking snapshots that include heaps and modules for a process other than the current process, the CreateToolhelp32Snapshot function can fail or return incorrect information for a variety of reasons. For example, if the loader data table in the target process is corrupted or not initialized, or if the module list changes during the function call as a result of DLLs being loaded or unloaded, the function might fail with ERROR_BAD_LENGTH or other error code. (In this case, ensure that the target process was not started in a suspended state, and try calling the function again.)
To destroy the snapshot, use the CloseHandle function.
Note that you can use the QueryFullProcessImageName function to retrieve the full name of an executable image for both 32- and 64-bit processes from a 32-bit process.
Examples
For an example, see Taking a Snapshot and Viewing Processes .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderTlhelp32.h
LibraryKernel32.lib
DLLKernel32.dll
See Also
CloseHandle
Heap32ListFirst
Module32First
Process32First
Snapshots of the System
Thread32First
Tool Help Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms682489(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:25:45