大网数据广告活动
Windows 系统接口

NtQuerySection function

· 52CE 我爱测

Provides the capability to determine the base address, size, granted access, and allocation of an opened section object.

Provides the capability to determine the base address, size, granted access, and allocation of an opened section object.

Syntax

NTSTATUS NTAPI NtQuerySection (
    _In_ HANDLE SectionHandle,
    _In_ SECTION_INFORMATION_CLASS SectionInformationClass,
    _Out_writes_bytes_(SectionInformationLength) PVOID SectionInformation,
    _In_ SIZE_T SectionInformationLength,
    _Out_opt_ PSIZE_T ReturnLength
    )

Parameters

SectionHandle [in]

An open handle to a section object.

SectionInformationClass [in]

The section information class about which to retrieve information.

SectionInformation [out]

A pointer to a buffer that receives the specified information. The format and content of the buffer depend on the specified section class.

SectionInformationLength [in]

Specifies the length in bytes of the section information buffer.

ReturnLength [out]

An optional pointer which, if specified, receives the number of bytes placed in the section information buffer.

Return value

An NTSTATUS code. For more information, see Using NTSTATUS values.

Remarks

This function has no associated import library or header file; you must call it using the LoadLibrary and GetProcAddress functions. The API is exported from ntdll.dll.

The type of the SectionInformation parameter is PSECTION_BASIC_INFORMATION

typedef struct _SECTIONBASICINFO {
    PVOID BaseAddress;
    ULONG AllocationAttributes;
    LARGE_INTEGER MaximumSize;
} SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;
PVOID BaseAddress

The base virtual address of the section if the section is based.

ULONG AllocationAttributes

The allocation attributes flags.

Flag Value Description
SEC_BASED 0x200000 The section is a based section.
SEC_FILE 0x800000 The section is backed by a data file.
SEC_RESERVE 0x4000000 All pages of the section were initially set to the reserved state.
SEC_COMMIT 0x8000000 All pages of the section were initially set to the committed state.
SEC_IMAGE 0x1000000 The section was mapped as an executable image file.

LARGE_INTEGER MaximumSize

The maximum size of the section in bytes.

Requirements

Requirement Value
DLL ntdll.dll

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 08/30/2023
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。