Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

4 Neutral
  1. davornik

    Unit uDGVMUtils and 64 bit...

    Code can be made compatible with 64-bit, i have posted probable solution here: https://stackoverflow.com/a/61874765/3225668 NOTE: in FastcodeCPUID.pas there is an error with position of registers when returning value. Registers in code goes like Move...EBX...EDX...ECX... Proper way should be EBX...ECX...EDX...!
  2. davornik

    Detect virtual machine in 64bit?

    I have finally found solution and posted it here: https://stackoverflow.com/a/61874765/3225668
  3. davornik

    Detect virtual machine in 64bit?

    procedure ChkVMware; asm push rdx; push rcx; push rbx; mov rax, 'VMXh'; mov rbx, 0; mov rcx, 10; mov rdx, 'VX'; in rax, dx; <-- here is error: operand size mismatch cmp rbx, 'VMXh'; setz [Result]; pop rbx; pop rcx; pop rdx; end; Thank you. In that link registers are like eax, edx, ecx and rbx for 32-bit, but if you change them to 64-bit (rax, rdx, rcx, rbx) then I get error: operand size mismatch. I even dont know if this is proper way to change registers?
  4. // VMware detection as described by Elias Bachaalany function IsInsideVMware: Boolean; //------------------------------ procedure ChkVMware; asm push edx; push ecx; push ebx; mov eax, 'VMXh'; mov ebx, 0; mov ecx, 10; mov edx, 'VX'; in eax, dx; cmp ebx, 'VMXh'; setz [Result]; pop ebx; pop ecx; pop edx; end; //------------------------------ begin Result := True; try ChkVMware; except Result := False; end; end; function IsRunningUnderHyperV: BOOL; stdcall; var VMBranding: array[0..12] of AnsiChar; //------------------------------ procedure GetVMBrand; asm mov eax, $40000000; cpuid; mov dword ptr [VMBranding+0], ebx; // Get the VM branding string mov dword ptr [VMBranding+4], ecx; mov dword ptr [VMBranding+8], edx; end; //------------------------------ begin GetVMBrand; VMBranding[12] := #0; Result := CompareText(String(VMBranding), 'Microsoft Hv') = 0; end; How can thiese function be done in 64-bit? On compile I get [dcc64 Error] Unit1.pas(33): E2116 Invalid combination of opcode and operands Registers need to be changed. Which to use?