PDA

Ver la Versión Completa : Detectar ejecución de app en Máquina Virtual


samantha jones
21-05-2008, 16:55:56
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.com/2008/04/detecting-virtual-pc.html

Saludos

cHackAll
21-05-2008, 22:40:06
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 (http://www.clubdelphi.com/foros/showthread.php?t=34331) de seoane (http://www.clubdelphi.com/foros/member.php?u=2375)?

// Saludos

cHackAll
22-05-2008, 15:47:50
¿Para esto no sirve la red pill (http://www.clubdelphi.com/foros/showthread.php?t=34331) de seoane (http://www.clubdelphi.com/foros/member.php?u=2375)?

// Saludos

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