欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

D语言 GetProcAddress 向 function 转化

程序员文章站 2022-05-16 09:35:39
...
cast(typeof(Function Poiner Name))

sample


/*==========================================
             NtCreateFile
==========================================*/

extern(Windows) NTSTATUS function
(
    PHANDLE             FileHandle,
ACCESS_MASK         DesiredAccess,
POBJECT_ATTRIBUTES  ObjectAttributes,
    PIO_STATUS_BLOCK    IoStatusBlock,
PLARGE_INTEGER      AllocationSize,
ULONG               FileAttributes,
    ULONG               ShareAccess,
    ULONG               CreateDisposition,
    ULONG               CreateOptions,
    PVOID               EaBuffer,
    ULONG               EaLength
) NtCreateFile;

NtCreateFile = cast(typeof(NtCreateFile)) GetProcAddress ( GetModuleHandleA ("ntdll.dll"), "NtCreateFile");
相关标签: d语言