-1

I'm sure if it's possible, but I'd like to call the function which is defined in the exe file on Linux/Mac:

0x421ff0 @@my_func_doing_stuff@Initialize 4

Basically I'd like to add command line support which is not implemented and the UI is kind of drag&drop which is useless.

Note: I don't have access to the source of the file.

I've was playing with wine, objdump, uncc (trying to covert it into C again) and Python using pefile, SWIG and ctypes:

#!/usr/bin/python
from ctypes import *

import pefile, sys

pe = pefile.PE('my_file.exe')

print pe.dump_info()

my_exe = cdll.LoadLibrary('./my_file.exe')

but without success.

The error:

OSError: ./my_file.exe: invalid ELF header

reminded me that I can't call any of Windows functions under Linux without emulation?

So I'm looking for some other solutions. Probably it can be done somehow by emulating or debugging it under wine. But I'm not sure if there is any API for calling the specific functions.

Are there any existing solutions?

kenorb
  • 155,785
  • 88
  • 678
  • 743

1 Answers1

2

You can use winelib to load and link with the binary (since you need wine to provide a usable ABI), but keep in mind that this effectively turns your application into a Wine application.

Community
  • 1
  • 1
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358