Ver Mensaje Individual
  #1  
Antiguo 27-06-2016
Reasen Reasen is offline
Miembro
NULL
 
Registrado: dic 2015
Ubicación: Barcelona
Posts: 140
Reputación: 9
Reasen Va por buen camino
ASM incorrecto?

Buenas, me encuentro con un problema, traduciendo la función de: http://www.codeproject.com/Articles/...ng-Guide#BpMem
Tengo el siguiente error al querer compilar:
"E2116 Invalid combination of opcode and operands"

El error me ocurre en la línea: "push MemBpBeingDebugged"
Intente dejarlo exactamente igual pero algo falla y no encuentro el que, espero que le podáis echar un cable al asunto.

Mi source:

Código Delphi [-]

function DetectMemoryBP(): integer;
var
  pMem, pAllocation: pointer;
  SysInfo: TSystemInfo;
  oldprotect: dword;
  NullSize_T: SIZE_T;
label
  MemBpBeingDebugged;
begin
  NullSize_T := 0;
  pMem := nil;
  GetSystemInfo(SysInfo);
  oldprotect := 0;
  pAllocation := VirtualAlloc(nil, sysinfo.dwPageSize, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);

  if (pAllocation = nil) then
    result := 0;
  pMem := Pointer($C3);

  if VirtualProtect(pAllocation, sysinfo.dwPageSize, PAGE_EXECUTE_READWRITE or PAGE_GUARD, @oldprotect) = false then
    result := 0;

  try
    asm
        mov     EAX, pAllocation
        push    MemBpBeingDebugged
        jmp     EAX // Exception or execution, which shall it be ?
    end;
  except
    VirtualFree(pAllocation, NullSize_T, MEM_RELEASE);
    result := 0;
    exit;
  end;

MemBpBeingDebugged:

  VirtualFree(pAllocation, NullSize_T, MEM_RELEASE);
  result := 1;

end;


Ejemplo de uso:
  if DetectMemoryBP > 0 then
    MessageBox(0, 'detectado', '', 0);
Responder Con Cita