این تابع وضعیت سیستم را ارزیابی میکند .

NTSTATUS WINAPI NtQuerySystemInformation(
  _In_      SYSTEM_INFORMATION_CLASS SystemInformationClass,
  _Inout_   PVOID                    SystemInformation,
  _In_      ULONG                    SystemInformationLength,
  _Out_opt_ PULONG                   ReturnLength
);

طبق مستندات ماکروسافت این تابع ممکن است در نسخه های بعدی ویندوز یا نباشد یا دیگر در دسترس نباشد (که البته باعث ناراحتی و غمگینی ما میشه :(   ) . در هر حال ، چون مثالی از این تابع توی msdn پیدا نکردم ، و در جای دیگر پیدا کردم ( :D ) تصمیم گرفتم تا اونو پست کنم تا ازش استفاده کنید .
از اون جایی که قبلا برنامه لیست پراسس و کد های لیست پراسس در پستهای قبلی گفته شد و موجود هست فکر نکنم دیگه نیازی به توضیح باشه ، هر چند متفاوته ، ولی با یک بار مرور کد کار کرد اون دستتون میاد ...
موفق باشید .....
#include <stdio.h>
#include <Windows.h>
#include <winternl.h>
#include <conio.h>
#include <iostream>
using namespace std;
#pragma comment(lib,"ntdll.lib")// Need to link with
//ntdll.lib import library.
// You can find the ntdll.lib
//from the Windows DDK.

typedef struct _SYSTEM_PROCESS_INFO
{
ULONG NextEntryOffset;
ULONG NumberOfThreads;
LARGE_INTEGER Reserved[3];
LARGE_INTEGER CreateTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER KernelTime;
UNICODE_STRING ImageName;
ULONG BasePriority;
HANDLE ProcessId;
HANDLE InheritedFromProcessId;
}SYSTEM_PROCESS_INFO, *PSYSTEM_PROCESS_INFO;

int main()
{
NTSTATUS status;
PVOID buffer;
PSYSTEM_PROCESS_INFO spi;

buffer = VirtualAlloc(NULL, 1024 * 1024
, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
 // We need to allocate a large buffer
//because the process list can be large.

if (!buffer)
{
printf("\nError: Unable to allocate memory
for process list (%d)\n", GetLastError());
_getch();
return -1;
}

printf("\nProcess list allocated at address %#x\n", buffer);
spi = (PSYSTEM_PROCESS_INFO)buffer;

if (!NT_SUCCESS(status = NtQuerySystemInformation
(SystemProcessInformation, spi
, 1024 * 1024, NULL)))
{
printf("\nError: Unable to query
process list (%#x)\n", status);
VirtualFree(buffer, 0, MEM_RELEASE);
_getch();
return -1;
}

while (spi->NextEntryOffset) // Loop over the list until
// we reach the last entry.
{
printf("\nProcess name: %ws"
, spi->ImageName.Buffer); // Display process information.
printf("\nPID: %d", spi->ProcessId);
printf("\nPriority: %X", spi->BasePriority);
printf("\nNumber of threads: %d", spi->NumberOfThreads);
printf("\nUser time: %d", spi->UserTime);
printf("\nKernel time: %d", spi->KernelTime);
cout << '\n';
cout << "------------------------------------------";
spi = (PSYSTEM_PROCESS_INFO)(
(LPBYTE)spi + spi->NextEntryOffset);
// Calculate the address of the next entry.
}

printf("\nPress any key to continue.\n");

VirtualFree(buffer, 0, MEM_RELEASE);
// Free the allocated buffer.
_getch();
return 0;
}