Is there an easy way to call native NT API?

437 views Asked by At

I am working with pretty old code that taps directly into NT API (NtQueryDirectoryFile(..., FileBothDirectoryInformation), etc).

Methods that allow user-mode application to call these functions are well-known. In my case someone (ages ago) copy-pasted related DDK declarations (structs and functions) into separate header file and manually generated ntdll.lib to link against.

This works, but:

  • having to do this manual work for every new function is not ideal
  • there is potential of introducing a subtle bug (e.g. forgetting to enforce correct data alignment)
  • (pretty large) ntdll.lib ends up being stored with source code

I wonder if there is better way to do it with newer SDK/DDK?

Notes:

  • environment: VS2019 with 10.0.18362.0 Windows SDK
  • I know about winternl.h -- alas, it doesn't contain all functions I need
0

There are 0 answers