Why not just use full-on WINE? The basic system calls are pretty much fully covered. It seems this duplicates a lot of work.
Are the Windows API implementations of WINE usable by a native Linux program (eg as a library of some sort)? That seems to be the requirement here.
Porting Windows Dynamic Link Libraries to Linux
21–30 of 44 posts
Re: Porting Windows Dynamic Link Libraries to Linux
#22Did this close to twenty years ago. Ported a COM DLL to Linux and one of the executables using it. I implemented everything it needed. COM functions like CoCreateInstance, entry points like DllCanUnloadNow, Windows Sockets and whatnot. The registry API! Ha. I mapped HKEY_CURRENT_USER to configuration files rooted in the user's home directory, and HKEY_LOCAL_MACHINE to /etc. The lib's DllRegisterServer nicely register…
Open Group had COMsource: http://www.opengroup.org/comsource/
Re: Porting Windows Dynamic Link Libraries to Linux
#23Re: Porting Windows Dynamic Link Libraries to Linux
#24Re: Porting Windows Dynamic Link Libraries to Linux
#25Re: Porting Windows Dynamic Link Libraries to Linux
#26To all people wondering why not wine or winelib - this is for ease of debugging and fuzzing DLLs, not for actually running software. Wine and Winelib bring way too much baggage for those uses.
Re: Porting Windows Dynamic Link Libraries to Linux
#27It approaches from a different angle (relinking), but (as far as I understand it) can help to solve the same problem Tavis tackles. In the end they both allow the dynamic analysis of PE files in Linux. Both tools only work if the architecture is the same in both worlds, I think.
EDIT: [2] is an intro to the Witchcraft Compiler Collection from Black Hat Europe 2016 which is probably more helpful than the link to the repo.
[1] https://github.com/endrazine/wcc/blob/master/README.md
[2] https://www.blackhat.com/docs/eu-16/materials/eu-16-Brossard...
Re: Porting Windows Dynamic Link Libraries to Linux
#28This is cool and a lot lighter than WINE, though the important keyword is self-contained Windows libraries. I gather this won't work on DLLs that call any of the plethora of Windows APIs. I'm actually very surprised that any non-trivial DLLs are self-contained in this way, like his example of Windows Defender which I thought would call 1000 Windows API functions.
* https://github.com/taviso/loadlibrary/tree/master/peloader/w...
* https://github.com/taviso/loadlibrary/blob/master/peloader/c...
Re: Porting Windows Dynamic Link Libraries to Linux
#29Did anyone find info on how are user32.dll and kernel32.dll handled ?
Re: Porting Windows Dynamic Link Libraries to Linux
#30This reminds me of a tool Jeff Roberts wrote at RAD Game Tools which would repackage libraries so they were loadable on Linux. At the time the motivation was that MSVC was generating much better code than GCC for Bink, so he'd compile on Windows with MSVC and cross-link to Linux with his custom tool.