RtlEnumerateGenericTableWithoutSplaying 函数 (ntddk.h)

RtlEnumerateGenericTableWithoutSplaying 例程用于枚举泛型表中的元素。

语法

NTSYSAPI PVOID RtlEnumerateGenericTableWithoutSplaying(
  [in]      PRTL_GENERIC_TABLE Table,
  [in, out] PVOID              *RestartKey
);

参数

[in] Table

指向泛型表的指针 (RTL_GENERIC_TABLE) 。 表必须已通过调用 RtlInitializeGenericTable 进行初始化。

[in, out] RestartKey

上一次调用 RtlEnumerateGenericTableWithoutSplaying 返回的元素的地址。 如果枚举要从表中的第一个元素开始,则应设置为 NULL

若要枚举表中的所有元素,请使用 RtlEnumerateGenericTableWithoutSplaying ,如下所示:

RestartKey = NULL;
for (ptr = RtlEnumerateGenericTableWithoutSplaying(Table, &RestartKey);
     ptr != NULL;
     ptr = RtlEnumerateGenericTableWithoutSplaying(Table, &RestartKey)) {
        // Process the element pointed to by ptr
}

返回值

RtlEnumerateGenericTableWithoutSplaying 返回指向与 元素关联的调用方定义的结构的指针。 如果 RestartKeyNULL 且表没有元素,或者 RestartKey 是返回的指针且没有下一个元素,则返回 NULL

注解

RtlEnumerateGenericTable 不同, RtlEnumerateGenericTableWithoutSplaying 不会通过将泛型表从 splay 树转换为排序的链接列表来平展该表。 RtlEnumerateGenericTableWithoutSplayingRtlEnumerateGenericTable 更高效且多处理器安全。

可以重复调用 RtlEnumerateGenericTableWithoutSplaying 来处理泛型表的每个元素中调用方的数据。

Rtl.的调用方。GenericTable 例程负责以独占方式同步对泛型表的访问。 独占快速互斥体是用于此目的的最有效同步机制。

默认情况下,操作系统使用 splay 树来实现泛型表。 在某些情况下,对 splay 树的操作将使树变得深而窄,甚至可能将其变成直线。 非常深的树会降低搜索的性能。 可以通过使用 Adelson-Velsky/Landis (AVL) 树来确保泛型表的更平衡、更浅的树实现。 如果要将泛型表例程配置为在驱动程序中使用 AVL 树而不是 splay 树,请在包含 Ntddk.h 之前在通用头文件中插入以下 define 语句:

#define RTL_USE_AVL_TABLES 0

如果未定义RTL_USE_AVL_TABLES,则必须使用泛型表例程的 AVL 形式。 例如,使用 RtlEnumerateGenericTableWithoutSplaying 例程,而不是 RtlEnumerateGenericTableWithoutSplayingAvl。 在调用 RtlEnumerateGenericTableWithoutSplayingAvl 时,调用方必须传递 RTL_AVL_TABLE 表结构,而不是 RTL_GENERIC_TABLE

如果泛型表的调用方分配的内存可分页,则 RtlEnumerateGenericTableWithoutSplaying 的调用方必须在 IRQL < DISPATCH_LEVEL运行。

要求

要求
目标平台 通用
标头 ntddk.h (包括 Ntddk.h、Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL 请参见“备注”部分。

另请参阅

RtlEnumerateGenericTable

RtlInitializeGenericTable

RtlIsGenericTableEmpty

RtlNumberGenericTableElements