Hola a todos, bueno tengo unos problemas para listar los procesos:
no sé si estoy declarando mal las definiciones pero el retorno de la API me devuelve 0 ( osea exito ) pero como pueden ver
en el mensajebox no muestra los nombres, luego revise la memoria pero como cien bytes abajo encontraba los nombres : P
por cierto si encontrase ya la primera informacion correcta, para encontrar el siguiente puntero estaria bien hacer esto;
PointerStruct = PointerStruct + PointerStruct->NextEntryOffset;
#include <windows.h>
#include <stdio.h>
#define SystemProcessInformation 5
typedef NTSTATUS (NTAPI* DefZwQuerySystemInformation)(IN ULONG SystemInformationClass,
IN PVOID SystemInformation,IN ULONG SystemInformationLength,
OUT PULONG ReturnLength);
typedef struct _LSA_UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} LSA_UNICODE_STRING, *PLSA_UNICODE_STRING, UNICODE_STRING, *PUNICODE_STRING;
typedef struct _SYSTEM_THREAD {
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER CreateTime;
ULONG WaitTime;
PVOID StartAddress;
LONG ClientId;
LONG Priority;
LONG BasePriority;
ULONG ContextSwitchCount;
ULONG State;
LONG WaitReason;
} SYSTEM_THREAD, *PSYSTEM_THREAD;
typedef struct _SYSTEM_PROCESS_INFORMATION {
ULONG NextEntryOffset;
ULONG NumberOfThreads;
LARGE_INTEGER Reserved[3];
LARGE_INTEGER CreateTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER KernelTime;
UNICODE_STRING ImageName;
LONG BasePriority;
HANDLE ProcessId;
HANDLE InheritedFromProcessId;
ULONG HandleCount;
ULONG Reserved2[2];
ULONG PrivatePageCount;
LONG VirtualMemoryCounters;
IO_COUNTERS IoCounters;
SYSTEM_THREAD Threads[0];
} SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
int main()
{
HMODULE NTDLL = GetModuleHandle("NTDLL");
DefZwQuerySystemInformation ZwQuerySystemInformation = (DefZwQuerySystemInformation) GetProcAddress(NTDLL,"NtQuerySystemInformation");
DWORD Ret;
ZwQuerySystemInformation(SystemProcessInformation,0,0,&Ret);
unsigned char* lp = (unsigned char*) malloc(Ret);
DWORD RZ = ZwQuerySystemInformation(SystemProcessInformation,lp,Ret,&Ret);
PSYSTEM_PROCESS_INFORMATION tmp =(PSYSTEM_PROCESS_INFORMATION)lp;
MessageBoxW(NULL,tmp->ImageName.Buffer ,NULL,MB_OK);
return 0;
}