Hello
I know that's a newbie question, but I'm stuck on it :(
I was using notepad++ to code my driver, and recently migrated to VisualDDK to code inside Visual Studio.
That works fine, except when I want to use undocumented function/calls, I got linker error. It seems not linking with ntdll.lib as it does previously.
Here's the problem:
Before, I was declaring KeAddSystemServiceTablelike this, and it was working:
It does the same for undocumented functions (linker error and NULL pointer if declared as extern C):
ZwQuerySystemInformation / ZwOpenDirectoryObject
Any idea?
EDIT: It's actually not NULL, but points to not logical area.
I tested with my previous driver, and the new one:
I know that's a newbie question, but I'm stuck on it :(
I was using notepad++ to code my driver, and recently migrated to VisualDDK to code inside Visual Studio.
That works fine, except when I want to use undocumented function/calls, I got linker error. It seems not linking with ntdll.lib as it does previously.
Here's the problem:
Before, I was declaring KeAddSystemServiceTablelike this, and it was working:
Code: Select all
Now it generates linker error: __declspec(dllimport) _stdcall KeAddSystemServiceTable(PVOID, PVOID, PVOID, PVOID, PVOID);
1>c:\tools\functions.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __stdcall KeAddSystemServiceTable(void *,void *,void *,void *,void *)" (__imp_?KeAddSystemServiceTable@@YGHPAX0000@Z) referenced in function "void * __stdcall GetKeServiceDescriptorTableShadow(void)" (?GetKeServiceDescriptorTableShadow@@YGPAXXZ)So I decided to look a bit on Google, and changed the declaration for that:
Code: Select all
And it compiles fine. But at runtime both pointers are NULL. extern "C" BOOLEAN __stdcall KeAddSystemServiceTable(PVOID, PVOID, PVOID, PVOID, PVOID);
It does the same for undocumented functions (linker error and NULL pointer if declared as extern C):
ZwQuerySystemInformation / ZwOpenDirectoryObject
Any idea?
EDIT: It's actually not NULL, but points to not logical area.
I tested with my previous driver, and the new one:
00000024 252.87759399 KeAddSystemServiceTable : 0x80596784 <= Good (ntoskrnl)
00000009 0.00026400 KeAddSystemServiceTable : 0xf89e3e0c <= Bad (my driver)