Ver Mensaje Individual
  #3  
Antiguo 16-03-2017
0x90 0x90 is offline
Registrado
NULL
 
Registrado: jun 2016
Posts: 5
Reputación: 0
0x90 Va por buen camino
Cita:
Empezado por Reasen Ver Mensaje
No sé exactamente qué quieres ni tengo mucha práctica con C++ pero te dejo una base mas limpia para que puedas continuar haciendo pruebas. (Basandome en el código de C++)



Código Delphi [-]
uses
  System.SysUtils,
  messages,
  Winapi.Windows;

var
  Sysinfo: _SYSTEM_INFO;
  min_addr, max_addr: DWORD;
  i:Cardinal;
  MBI:MEMORY_BASIC_INFORMATION;
const
  MemorySectionName = $2;
  MemoryBasicVlmInformation = $3;
  LHND = $0042;
  LMEM_FIXED = $0000;
  LMEM_MOVEABLE = $0002;
  LMEM_ZEROINIT = $0040;
  LPTR = $0040;
  NONZEROLHND = $0002;
  NONZEROLPTR = $0000;

begin
  GetSystemInfo(Sysinfo);
  min_addr := DWORD(Sysinfo.lpMinimumApplicationAddress);
  max_addr := DWORD(Sysinfo.lpMaximumApplicationAddress);
  LocalAlloc(LMEM_ZEROINIT, $1000);

  for i := min_addr to max_addr + Sysinfo.dwPageSize do
  begin  
 if VirtualQuery(Pointer(DWORD(i)),MBI,SizeOf(MBI)) = 0 then
    if MBI.Type_9 = mem_image then


  end;
end.
¡Tanto tiempo Reasen!
Muchas gracias por darme una mano

Lo que me diste funciona perfectamente (compila y no tengo errores), pues ahora toca finalizar el codigo y ver que mas puedo hacer, el codigo es inofensivo y lo que hace es enumerar los modulos (dlls) dentro de un proceso incluyendo aun los que este escondidos.

Ahora a la hora de ejecutar el proceso, y usar la funcion, no se que estoy haciendo mal, puede que si este haciendo algo mal, pero el proceso se cuelga, he aqui lo que estoy tratando de hacer...

Asi va la estructura `UNICODE_S`
Código Delphi [-]
type
       _UNICODE_S = record
         len : Word;
         man_len  : Word;
         pStr  : PWideChar;
       end;

       UNICODE_S = _UNICODE_S;

Asi va lo que tengo gracias a tu ayuda.
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
  lpSystemInfo: _SYSTEM_INFO;
  min_addr: ULONG;
  max_addr: ULONG;
  LibHandle: THandle;
  p: ^_UNICODE_S;
  pid: NativeUInt;
begin
  GetSystemInfo(Sysinfo);
  min_addr := DWORD(Sysinfo.lpMinimumApplicationAddress);
  max_addr := DWORD(Sysinfo.lpMaximumApplicationAddress);
  p := Pointer(LocalAlloc(LMEM_ZEROINIT, $1000));

  for i := min_addr to max_addr + Sysinfo.dwPageSize do
  begin
 if VirtualQuery(PVOID(i), MBI, SizeOf(MBI)) = 0 then
    if MBI.Type_9 = mem_image
    then
    begin

       //ZwQueryVirtualMemory(GetCurrentProcess(), (void*)i , MemorySectionName, p, 0x1000, 0);
       ZwQueryVirtualMemory(GetCurrentProcess, PVOID(i), MemorySectionName, p, $1000, 0);

       // List Modules in the ListBox
       ListBox1.Items.BeginUpdate;
       try
         ListBox1.Items.Clear;
         ListBox1.Items.Add(WideCharToString(p.pStr));
       finally
         ListBox1.Items.EndUpdate;
       end;
    end
    else
    begin

    end;

  end;
end;


Saludos, Espero que estes bien
Responder Con Cita