The NtQuerySystemInformation is a useful undocumented and discouraged API of ntdll.dll. This API shouldn’t be used but in some cases is a short way to get a lot information.
Here is a link to msdn for the NtQuerySystemInformation API.
This example contains complete source code for full use of the ntquerysysteminformation api.
Only Delphi source code is included in the archive.