Emulate an exec, but call wine for imported DLLs. Possible?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
afin
Newbie
Newbie
Posts: 2
Joined: Sat Feb 03, 2018 6:43 pm

Emulate an exec, but call wine for imported DLLs. Possible?

Post by afin »

I have a Win32 executable, that runs fine under wine on my mac.

I want to emulate running it, that is for each processor instruction in it, I want to emulate what that instruction is doing (e. g. for "load constant X into eax" I would just load it into some emulated representation of eax in my struct). However, when it would call imported functions (sys calls and other dlls) I obviously want to call real function to keep the program doing what it is supposed to do. So I must somehow figure out which function it is and pass it the same arguments from my virtual registers.


My main question: is it even possible to emulate running program code yet to execute winapi functions from wine? What difficulties am I overlooking (I'm not very experienced with this low level stuff)?
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: Emulate an exec, but call wine for imported DLLs. Possib

Post by DarkShadow44 »

Possible, sure, but why would you want that? That sounds similar to what Project Hangover is doing.
afin
Newbie
Newbie
Posts: 2
Joined: Sat Feb 03, 2018 6:43 pm

Re: Emulate an exec, but call wine for imported DLLs. Possib

Post by afin »

DarkShadow44 wrote:Possible, sure, but why would you want that? That sounds similar to what Project Hangover is doing.
Yes! That's exactly what I want except that my goal is not running it on a different architecture, but to create a decompiled version of the game executable (say, in C) which, when compiled, produces a working equivalent of the original executable. I admit if there were any working decompilers I would just use them instead of going this route.
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: Emulate an exec, but call wine for imported DLLs. Possib

Post by DarkShadow44 »

afin wrote:Yes! That's exactly what I want except that my goal is not running it on a different architecture, but to create a decompiled version of the game executable (say, in C) which, when compiled, produces a working equivalent of the original executable. I admit if there were any working decompilers I would just use them instead of going this route.
Oh that's gonna be tough, there's a reason there's no working decompilers yet. Why do you need that?
Locked