Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 18-08-2020
Avatar de aguml
aguml aguml is offline
Miembro
 
Registrado: may 2013
Posts: 885
Poder: 14
aguml Va por buen camino
He conseguido que me funcione en x32 con esto:
Código PHP:
DWORD GetBaseAddressFromProcessHandle(HANDLE process_handle)
{
    
PROCESS_BASIC_INFORMATION pbi = {};
    
ULONG ulSize;
    
DWORD dwReturn=0;
    
SIZE_T nRead;
    
LONG (WINAPI *NtQueryInformationProcess)(HANDLE ProcessHandle,
          
ULONG ProcessInformationClassPVOID ProcessInformation,
          
ULONG ProcessInformationLengthPULONG ReturnLength);

    *(
FARPROC *) &NtQueryInformationProcess GetProcAddress(
        
LoadLibrary(L"ntdll"), "NtQueryInformationProcess");
    if (
NtQueryInformationProcess == NULL) {
        return 
0;
    }

    if(    
NtQueryInformationProcess != NULL &&
        
NtQueryInformationProcess(process_handle0, &pbisizeof(pbi), &ulSize) >= &&
        
ulSize == sizeof(pbi)) {

        
ReadProcessMemory(process_handle, ((PVOID)((DWORD)pbi.PebBaseAddress 0x8)), &dwReturnsizeof(dwReturn), &nRead);
        return 
dwReturn;
    }
    return 
0;

El caso que cogiendo el mismo codigo y usandolo para x64 con los minimos cambios no me funciona en x64:
Código PHP:
DWORD64 GetBaseAddressFromProcessHandle(HANDLE process_handle)
{
    
PROCESS_BASIC_INFORMATION pbi = {};
    
ULONG ulSize;
    
DWORD64 dwReturn=0;
    
SIZE_T nRead;
    
LONG (WINAPI *NtQueryInformationProcess)(HANDLE ProcessHandle,
          
ULONG ProcessInformationClassPVOID ProcessInformation,
          
ULONG ProcessInformationLengthPULONG ReturnLength);

    *(
FARPROC *) &NtQueryInformationProcess GetProcAddress(
        
LoadLibrary(L"ntdll"), "NtQueryInformationProcess");
    if (
NtQueryInformationProcess == NULL) {
        return 
0;
    }
    if(    
NtQueryInformationProcess != NULL &&
        
NtQueryInformationProcess(process_handle0, &pbisizeof(pbi), &ulSize) >= &&
        
ulSize == sizeof(pbi)) {

        
ReadProcessMemory(process_handle, ((PVOID)(pbi.PebBaseAddress 0x10)), &dwReturnsizeof(dwReturn), &nRead);
        return 
dwReturn;
    }
    return 
0;

Todo parece ir bien pero el valor que obtiene en dwReturn es 0.
¿Alguien me puede ayudar con esto?
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problemas al asignar privilegios a mi proceso aguml C++ Builder 8 11-05-2020 23:33:55
Problemas con CloseHandle y atacheo de proceso aguml C++ Builder 3 07-05-2020 15:04:01
Problemas para buscar - Locate ekstase MySQL 5 20-10-2010 01:42:24
Problemas al buscar alias Max_E. Conexión con bases de datos 11 13-10-2006 23:37:42


La franja horaria es GMT +2. Ahora son las 14:35:03.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi