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");
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语言的函数修饰