简体   繁体   English

具有2个参数的Typedef指向WINAPI函数的指针

[英]Typedef pointer to WINAPI function with 2 parameters

What does this mean? 这是什么意思? I know that NtUnMapViewOfSection is a pointer to a Winapi function with 2 parameters and a long return value. 我知道NtUnMapViewOfSection是具有2个参数和长返回值的Winapi函数的指针。 And I know that this chunk is casting "GetProcAddress" with its arguments to a NtUnmapViewOfSection object. 而且我知道该块正在将“ GetProcAddress”及其参数转换为NtUnmapViewOfSection对象。 But what is the last row doing? 但是最后一行在做什么?

typedef LONG (WINAPI * NtUnmapViewOfSection)(HANDLE ProcessHandle, PVOID BaseAddress);

NtUnmapViewOfSection xNtUnmapViewOfSection;
xNtUnmapViewOfSection = NtUnmapViewOfSection(GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtUnmapViewOfSection"));
xNtUnmapViewOfSection(Pinfo.hProcess, PVOID(dwImageBase)); // Pinfo is PROCESS_INFORMATION and dwImageBase is a pointer to DWORD

what is the last row doing? 最后一行在做什么?

The last line is calling the function you got a pointer to with GetProcAddress() - that is, it is calling NtUnmapViewOfSection() . 最后一行使用GetProcAddress()调用您拥有一个指针的函数-也就是说,它调用NtUnmapViewOfSection()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM