- do typedef "X" for function type you want to call (example: "typedef returntype (*X)(argtype);")
- change "unsigned char* ptrToNtLoadDriver" to "X ptrToNtLoadDriver"
- call function as "ptrToNtLoadDriver(argsHere)"
How to call winapi function via pointer to this function?
题
I get functions from ntdll.dll
dynamically, using GetProcAddress
winapi function like this:
HMODULE ntdllh = LoadLibrary(L"ntdll.dll");
unsigned char* ptrToNtLoadDriver
= (unsigned char*)GetProcAddress(ntdllh, "NtLoadDriver");
How can I call NtLoadDriver
function via ptrToNtLoadDriver
? I thought of something like this: ((NTSTATUS NtLoadDriver(PUNICODE_STRING driverServiceName))ptrToNtLoadDriver)(fooString)
解决方案
其他提示
((NTSTATUS (WINAPI*)(PUNICODE_STRING))ptrToNtLoadDriver)(fooStrin);
不隶属于 StackOverflow