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

RtlGetImageFileMachines function (Wdm.h)

· 52CE 我爱测

Identifies the architectures which an image is compatible with / can execute under.

This function identifies the architectures which an image is compatible with / can execute under. Most binaries contain code which can be used on a single architecture. However, there are cases, such as ILOnly-AnyCPU and Arm64X / Chameleon binaries, there a single binary may support executing are more than one architecture. For more information, see Build Arm64X binaries.

Syntax

NTSTATUS
RtlGetImageFileMachines (
    _In_ PCWSTR DosFileName,
    _Out_ IMAGE_FILE_MACHINES * MachineTypeFlags
    );

Parameters

DosFileName [in]

Provides a pointer to a UNICODE string containing the full binary pathname to be inspected.

MachineTypeFlags [out]

Provides a pointer to a IMAGE_FILE_MACHINES structure which contains a Bitfield through which the API will indicate the architectures this binary contains / is compatible with.

The IMAGE_FILE_MACHINES struct has the following definition.

typedef struct _IMAGE_FILE_MACHINES {
    union {
        ULONG Value;
        struct {
            ULONG MachineX86 : 1;
            ULONG MachineAmd64 : 1;
            ULONG MachineArm : 1;
            ULONG MachineArm64 : 1;
            ULONG MachineArm64EC : 1;
        };
    };
} IMAGE_FILE_MACHINES;

Return value

This function returns zero on success. (More detail).

See NTSTATUS Values for a list of NTSTATUS values.

Remarks

This function does not validate the image's dependencies. For example: If A.DLL is an Arm64X / Chameleon DLL with Arm64 and Arm64EC code and depends on B.DLL but B.DLL is only available for Arm64, this API will still indicate A.DLL as being compatible with both Arm64 and Arm64EC. The same can be said for ILOnly-AnyCPU binaries. A.DLL can be ILOnly-AnyCPU (thus it can potentially load on a process of any architecture) so this API will return all the bits set for all architectures even if the .net framework (just like any dependency) may not be present for all architectures.

This function has no associated import library or header file; you must call it using the LoadLibrary and GetProcAddress functions.

Requirements

Requirement Value
Minimum supported client Windows 11 22H2 [desktop apps only]
Minimum supported server Windows Server 2025 [desktop apps only]
Target platform Universal
DLL Ntdll.dll

See also

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 02/22/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

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

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