网站首页  词典首页

请输入您要查询的函数:

 

术语 heapqueryinformation
释义 HeapQueryInformation
语法:
C++
BOOL WINAPI HeapQueryInformation(
__in_opt HANDLE HeapHandle,
__in HEAP_INFORMATION_CLASS HeapInformationClass,
__out PVOID HeapInformation,
__in SIZE_T HeapInformationLength,
__out_opt PSIZE_T ReturnLength
);
HeapQueryInformation功能
检索信息指定堆。
参数
HeapHandle [中,可选]
阿堆句柄是其信息检索。这是处理无论是HeapCreate或GetProcessHeap函数返回。
HeapInformationClass [in]
类的信息要检索。此参数可从以下HEAP_INFORMATION_CLASS枚举类型值。
ValueMeaning
HeapCompatibilityInformation
0Indicates堆已启用的功能。
该HeapInformation参数是一个受ULONG变量的指针。
如果HeapInformation为0,堆是一种标准的堆不支持旁视名单。
如果HeapInformation是1,堆支持旁视名单。有关更多信息,请参见备注。
HeapInformation就是如果2,低碎片堆(LFH)一直堆启用。启用LFH禁用旁视名单。
HeapInformation [out]
阿一个缓冲区,它接收堆信息的指针。这些数据的格式取决于该HeapInformationClass参数的值。
HeapInformationLength [in]
堆被查询信息的大小,以字节为单位。
ReturnLength [指出,可选]
一个变量,它接收书面向HeapInformation缓冲区的数据长度的指针。如果缓冲区太小,函数失败并ReturnLength指定的最小大小的缓冲区要求。
如果您不希望收到这些信息,指定为NULL。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
为使LFH或终止对腐败的功能,使用HeapSetInformation功能。
要使用带有Service Pack 4(SP4)中,这个功能安装在KB 816542中描述的修复程序在Windows 2000。
Windows XP中的Windows Server 2003和Windows 2000修复KB 816542:
甲旁视列表是一个快速的内存分配机制,只包含固定大小的块。旁视列表是通过为默认启用堆支持他们。从Windows Vista开始,旁视列表不使用和LFH默认情况下启用。
旁视列表速度比一般的池分配,在大小各不相同,因为系统不免费的内存,适合分配搜索。此外,获得旁视名单通常使用快速同步交换原子处理器指令,而不是互斥或自旋锁。旁视列表可以由系统或驱动程序创建的。他们可以拨出分页或不分页池。
实例
下面的示例使用GetProcessHeap获取句柄默认进程堆和HeapQueryInformation检索有关堆信息。
#include
#include
#include
#define HEAP_STANDARD 0
#define HEAP_LAL 1
#define HEAP_LFH 2
int __cdecl _tmain()
{
BOOL bResult;
HANDLE hHeap;
ULONG HeapInformation;
//
// Note: The HeapQueryInformation function is available on Windows 2000 with SP4
// only if hotfix KB 816542 is installed. To run this example on Windows 2000,
// use GetProcAddress to get a pointer to the function if available.
//
//
// Get a handle to the default process heap.
//
hHeap = GetProcessHeap();
if (hHeap == NULL) {
_tprintf(TEXT("Failed to retrieve default process heap with LastError %d.\\n"),
GetLastError());
return 1;
}
//
// Query heap features that are enabled.
//
bResult = HeapQueryInformation(hHeap,
HeapCompatibilityInformation,
&HeapInformation,
sizeof(HeapInformation),
NULL);
if (bResult == FALSE) {
_tprintf(TEXT("Failed to retrieve heap features with LastError %d.\\n"),
GetLastError());
return 1;
}
//
// Print results of the query.
//
_tprintf(TEXT("HeapCompatibilityInformation is %d.\\n"), HeapInformation);
switch(HeapInformation)
{
case HEAP_STANDARD:
_tprintf(TEXT("The default process heap is a standard heap.\\n"));
break;
case HEAP_LAL:
_tprintf(TEXT("The default process heap supports look-aside lists.\\n"));
break;
case HEAP_LFH:
_tprintf(TEXT("The default process heap has the low-fragmentation ") \\
TEXT("heap enabled.\\n"));
break;
default:
_tprintf(TEXT("Unrecognized HeapInformation reported for the default ") \\
TEXT("process heap.\\n"));
break;
}
return 0;
}
要求:
最低支持clientWindows带有SP4 XP中,Windows 2000专业版
最低支持serverWindows服务器2003
VersionKB在Windows 2000 816542带有SP4
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
GetProcessHeap
堆函数
HeapCreate
HeapSetInformation
内存管理功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==HeapQueryInformation Function
Retrieves information about the specified heap.
Syntax
C++
BOOL WINAPI HeapQueryInformation(
__in_opt HANDLE HeapHandle,
__in HEAP_INFORMATION_CLASS HeapInformationClass,
__out PVOID HeapInformation,
__in SIZE_T HeapInformationLength,
__out_opt PSIZE_T ReturnLength
);
Parameters
HeapHandle [in, optional]
A handle to the heap whose information is to be retrieved. This handle is returned by either the HeapCreate or GetProcessHeap function.
HeapInformationClass [in]
The class of information to be retrieved. This parameter can be the following value from the HEAP_INFORMATION_CLASS enumeration type.
ValueMeaning
HeapCompatibilityInformation
0Indicates the heap features that are enabled.
The HeapInformation parameter is a pointer to a ULONG variable.
If HeapInformation is 0, the heap is a standard heap that does not support look-aside lists.
If HeapInformation is 1, the heap supports look-aside lists. For more information, see Remarks.
If HeapInformation is 2, the low-fragmentation heap (LFH) has been enabled for the heap. Enabling the LFH disables look-aside lists.

HeapInformation [out]
A pointer to a buffer that receives the heap information. The format of this data depends on the value of the HeapInformationClass parameter.
HeapInformationLength [in]
The size of the heap information being queried, in bytes.
ReturnLength [out, optional]
A pointer to a variable that receives the length of data written to the HeapInformation buffer. If the buffer is too small, the function fails and ReturnLength specifies the minimum size required for the buffer.
If you do not want to receive this information, specify NULL.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
To enable the LFH or the terminate-on-corruption feature, use the HeapSetInformation function.
To use this function on Windows 2000 with Service Pack 4 (SP4), install the hotfix described in KB 816542 .
Windows XP, Windows Server 2003, and Windows 2000 with hotfix KB 816542 :
A look-aside list is a fast memory allocation mechanism that contains only fixed-sized blocks. Look-aside lists are enabled by default for heaps that support them. Starting with Windows Vista, look-aside lists are not used and the LFH is enabled by default.
Look-aside lists are faster than general pool allocations that vary in size, because the system does not search for free memory that fits the allocation. In addition, access to look-aside lists is generally synchronized using fast atomic processor exchange instructions instead of mutexes or spinlocks. Look-aside lists can be created by the system or drivers. They can be allocated from paged or nonpaged pool.
Examples
The following example uses GetProcessHeap to obtain a handle to the default process heap and HeapQueryInformation to retrieve information about the heap.
#include
#include
#include
#define HEAP_STANDARD 0
#define HEAP_LAL 1
#define HEAP_LFH 2
int __cdecl _tmain()
{
BOOL bResult;
HANDLE hHeap;
ULONG HeapInformation;
//
// Note: The HeapQueryInformation function is available on Windows 2000 with SP4
// only if hotfix KB 816542 is installed. To run this example on Windows 2000,
// use GetProcAddress to get a pointer to the function if available.
//
//
// Get a handle to the default process heap.
//
hHeap = GetProcessHeap();
if (hHeap == NULL) {
_tprintf(TEXT("Failed to retrieve default process heap with LastError %d.\\n"),
GetLastError());
return 1;
}
//
// Query heap features that are enabled.
//
bResult = HeapQueryInformation(hHeap,
HeapCompatibilityInformation,
&HeapInformation,
sizeof(HeapInformation),
NULL);
if (bResult == FALSE) {
_tprintf(TEXT("Failed to retrieve heap features with LastError %d.\\n"),
GetLastError());
return 1;
}
//
// Print results of the query.
//
_tprintf(TEXT("HeapCompatibilityInformation is %d.\\n"), HeapInformation);
switch(HeapInformation)
{
case HEAP_STANDARD:
_tprintf(TEXT("The default process heap is a standard heap.\\n"));
break;
case HEAP_LAL:
_tprintf(TEXT("The default process heap supports look-aside lists.\\n"));
break;
case HEAP_LFH:
_tprintf(TEXT("The default process heap has the low-fragmentation ") \\
TEXT("heap enabled.\\n"));
break;
default:
_tprintf(TEXT("Unrecognized HeapInformation reported for the default ") \\
TEXT("process heap.\\n"));
break;
}
return 0;
}
Requirements
Minimum supported clientWindows XP, Windows 2000 Professional with SP4
Minimum supported serverWindows Server 2003
VersionKB 816542 on Windows 2000 with SP4
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
GetProcessHeap
Heap Functions
HeapCreate
HeapSetInformation
Memory Management Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366703(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 13:20:14