.exe under virtualization is giving error

-3

i'm working on some vm, x86. I'm using it to get native and x86 instructions and convert it to VM instructions.

So when i'm using it in some small file it works just fine, but today i tried to virtualize another file "HelloWorld"

#include "iostream"

using std::cout;
using std::endl;

int main(int argc, const char *argv[])
{
    BeginProtect;

    cout << "Hello, World!" << endl;

    EndProtect;

    return 0;
}

So when i'm converting all bytes into new file called Example1.exe and runing it i'm keep getting some Access violation writing location 0x001E402C.

I decide to debug it in OllyDBG (i'm not an expert in Asm) but thats what i see

image

So it's looks like i have some problem with EAX register, or maybe some instruction isn't implemented. It would be good if someone could route me.

Update: It looks like i fixed the error(still need to check virtualization, but it was a problem of cout (i fixed it, thanks to Jester) and some problem with control flow (i will recode it a bit, but for now i just commented something)

bool VirtualizeCallRel(CodeChunk *code, DISASM *disasm) {



    BYTE instr[] = 
        {
            0xc7, 0x44, 0x24, 0xfc, //0x00, 0x00, 0x00, 0x00,       // mov dword [esp-4], 0x00000000
            0xff, 0x54, 0x24, 0xfc,                             // jmp dword [esp-4]
        };

        *(DWORD*)&instr[4] = disasm->Instruction.AddrValue;

        doNativeHandler(code, disasm, instr, sizeof(instr));

        return true; 
c++
assembly
virtual-machine
cpu-registers
instructions
asked on Stack Overflow Nov 3, 2018 by paxxa • edited Nov 3, 2018 by paxxa

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0