1

Linker gives me a fatal error in Inject_mod.obj file calling:

NtQuerySystemInformation@16
and
RtlAdjustPrivilege@16

which were defined in my ntdll.h I added externally to my project. But it seems like compiler/linker somehow doesn't see it, etc.

Using: VC 2013 on Win8.1, project initially created on Win7

Here's linker error and function definition in header

UPD: Project Explorer tree: http://floomby.ru/s2/setKB5. Some words've been blured in case of confidence. Additional Dependencies contain my external ntdll.h leading to ntdll.lib

mechanic
  • 128
  • 1
  • 10
  • Could you please extend to full english sentences. – πάντα ῥεῖ Nov 01 '14 at 11:42
  • 1
    I'm not sure just adding the *.lib to the project is what you should do. You should probably add it to the linker dependencies in the project settings instead – PeterT Nov 01 '14 at 11:44
  • possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – GSerg Nov 01 '14 at 11:50
  • They are internal Windows implementation functions that were not meant to be used by applications and are subject to change in Windows revisions. There is no import library available in the Windows SDK that declares them, you don't have ntdll.lib, so the linker is always going to complain about them. Only way you can hack it is by using GetProcAddress() to find the exported function in ntdll.dll – Hans Passant Nov 01 '14 at 11:58
  • I have my own ntdll.lib used im project, and ive added it to dependencies and the project 'includes'. – mechanic Nov 01 '14 at 14:01

1 Answers1

2

You can't use a lib file by just copying it in the solution view in Visual Studio.

You need to add ntdll.lib or any static-library dependency in the linker Input->Additional Dependencies pane.

Since you're trying to use NtQuerySystemInformation be aware that

[NtQuerySystemInformation may be altered or unavailable in future versions of Windows. Applications should use the alternate functions listed in this topic.]

Marco A.
  • 43,032
  • 26
  • 132
  • 246
  • I've added it to linker, of course. Thanks for the link by the way. But i have my own ntdll.lib where NtQuerySystemInformation is defined extensively. It should work, shouldn't it? – mechanic Nov 01 '14 at 12:50
  • Check for the signature you're using and make sure they match – Marco A. Nov 01 '14 at 13:51