Coffeehouse Post

Single Post Permalink

View Thread: Machine code
  • User profile image
    evildictait​or

    And if you want to be really hardcore and just do machine code directly instead of assembly, try something a bit more like this.

    BYTE[] data= { 0xcc, 0x33, 0xc0, 0x40, 0xc3 };

    void main()
    {
      FARPROC fp = (FARPROC)&data[0];
      DWORD _ignore;
      VirtualProtect(fp, sizeof(data), PAGE_EXECUTE_READWRITE, &_ignore);
      printf("%08x", fp());
    }