Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Detectar ejecución de app en Máquina Virtual (https://www.clubdelphi.com/foros/showthread.php?t=56593)

samantha jones 21-05-2008 16:55:56

Detectar ejecución de app en Máquina Virtual
 
Saludos

Como puedo detecar si mi aplicación está corriendo bajo una máquina virtual?

Gracias

samantha jones 21-05-2008 19:02:13

me encontre este artículo:

http://ruminatedrumblings.blogspot.c...irtual-pc.html

Saludos

cHackAll 21-05-2008 22:40:06

Código Delphi [-]
function IsInsideVMWare: Boolean; // test the port used by VMware tools to communicate with the host
begin
 try
  asm
   push ebx
   and  [Result], 0
   mov  eax, 'VMXh'
   xor  ebx, ebx
   mov  ecx, 10
   mov  edx, 'VX'
   in   eax, dx
   cmp  ebx, 'VMXh'
   setz [Result]
   pop  ebx
  end;
 except on EPrivilege do Result := False;
 end;
end;

function IsSomethingUnknown: Boolean; // from vmcheck.dll
begin
 Result := True;
 try
  asm
   db 15
   mov eax, 45C70001h
   cld
   dd -1
  end;
 except Result := False;
 end;
end;

function IsVirtualPC: Boolean; // from vmcheck.dll
begin
 Result := True;
 try
  asm
   mov eax, 1
   db  15
   aas
   pop es
   or  eax, edi
   inc ebp
   cld
   dd  -1
  end;
 except Result := False;
 end;
end;

function IsInsideVPC: Boolean; // Elias aka lallous
asm
 push ebp
 mov  ecx, offset @catch
 mov  ebp, esp
 push ebx
 push ecx
 push dword ptr fs:[0]
 mov  dword ptr fs:[0], esp
 xor  ebx, ebx
 mov  eax, 1
 dd   0B073F0Fh
 mov  eax, dword ptr ss:[esp]
 mov  dword ptr fs:[0], eax
 add  esp, 8
 test ebx, ebx
 setz al
 lea  esp, dword ptr ss:[ebp - 4]
 mov  ebx, dword ptr ss:[esp]
 mov  ebp, dword ptr ss:[esp + 4]
 add  esp, 8
 jmp  @ret
@catch:
 mov  ecx, [esp + 0Ch]
 mov  dword ptr [ecx + 0A4h], -1
 add  dword ptr [ecx + 0B8h], 4
 xor  eax, eax
@ret:
end;

function _IsVirtualPC: Boolean; // add-on
var
 hModule: Cardinal;
 Value: function: Boolean;
begin
 Result := False;
 hModule := LoadLibrary('c:\vmcheck.dll');
 if LongBool(hModule) then
  begin
   @Value := GetProcAddress(hModule, 'IsRunningInsideVirtualMachine');
   if Assigned(Value) then Result := Value;
   FreeLibrary(hModule);
  end;
end;

function IsRunningWine: Boolean;
var hModule: Cardinal;
begin
 hModule := LoadLibrary('ntdll.dll');
 Result := Assigned(GetProcAddress(hModule, 'wine_get_version')) and
           Assigned(GetProcAddress(hModule, 'wine_nt_to_unix_file_name'));
 FreeLibrary(hModule);
end;

TODO; Virtualbox

Saludos

roman 22-05-2008 01:25:57

¿Para esto no sirve la red pill de seoane?

// Saludos

cHackAll 22-05-2008 15:47:50

Cita:

Empezado por roman (Mensaje 288450)
¿Para esto no sirve la red pill de seoane?

// Saludos

:eek: me quedo sin palabras... muy interesante!


La franja horaria es GMT +2. Ahora son las 23:36:42.

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