On Saturday, 24 March 2012 at 19:11:38 UTC, maarten van damme
wrote:
hi,
I'm trying to call NtUnmapViewOfSection from ntdll.dll.
According to the
msdn docs it should look like
NTSTATUS NtUnmapViewOfSection(
__in HANDLE ProcessHandle,
__in_opt PVOID BaseAddress
);
I tried to call it by simply declaring
extern(Windows) uint NtUnmapViewOfSection(HANDLE hProcess,PVOID
baseAddress);
But now I get
Error 42: Symbol Undefined _NtUnmapViewOfSection@8
Did you import ntoskrnl.lib?
I've also tried using GetProcAddress
cast(uint function(HANDLE hProcess,PVOID
address))GetProcAddress(Runtime.loadLibrary("ntdll.dll"),
"NtUnmapViewOfSection")
but when I looked at GetLastError I get error 127 (specified
procedure
could not be found) and the function doesn't work.
It's likely I'm missing something easy here, I just can't
figure out what it is.
Someone knows what it is?
Runtime.loadLibrary is the problem. Use the Win32 LoadLibrary
instead.
Maarten