Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using NtQueryInformationProcess

Featured Replies

Posted

I am looking to use NtQueryProcessInformation into a C++ program. The problem is, when I declare the NtQuery function, i get a strange error.

Here's my code :

typedef NTSTATUS (WINAPI *_NtQueryInformationProcess)(
__in HANDLE ProcessHandle,
__in PROCESSINFOCLASS ProcessInformationClass,
__out PVOID ProcessInformation,
__in ULONG ProcessInformationLength,
__out_opt PULONG ReturnLength
);_NtQueryInformationProcess __NtQueryInformationProcess = NULL;HMODULE NtDll = LoadLibrary("ntdll.dll");_NtQueryInformationProcess __NtQueryInformationProcess = NULL;
__NtQueryInformationProcess = (_NtQueryInformationProcess) GetProcAddress(NtDll, "NtQueryInformationProcess");

But I get those errors because the typedef didnt work :

25uh4r5.jpg

I know that WINAPI is __stdcall (#define WINAPI __stdcall) but I can't seems to fix this error..

I have the same way way to load dynamically another API (a regular one this time, not from ntdll.dll)...

Any help is much appreciated, thanks!

I also have ntdll.lib included into my project and the header Winternl.h (coming from msdn, i needed it).

I use Visual Studio .NET 2003.

Edited by ibanigger

Try ZwQueryInformationProcess remove that _in and _out paste

Went and got some old code:

struct PROCESS_BASIC_INFORMATION {
void* Reserved1;
dword PebBaseAddress;
void* Reserved2[2];
dword UniqueProcessId;
void* Reserved3;
};typedef int (WINAPI* ZwQueryInformationProcess)(HANDLE,DWORD,PROCESS_BASIC_INFORMATION*,DWORD,DWORD*);
ZwQueryInformationProcess MyZwQueryInformationProcess;Example:dword SomeFunction (HANDLE hProc) {
PROCESS_BASIC_INFORMATION peb;
DWORD tmp; HMODULE hMod=GetModuleHandle("ntdll.dll");
MyZwQueryInformationProcess=(ZwQueryInformationProcess)GetProcAddress(hMod,"ZwQueryInformationProcess"); MyZwQueryInformationProcess(hProc,0,&peb,sizeof(PROCESS_BASIC_INFORMATION),&tmp); return peb.PebBaseAddress;
}

Edited by What

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.