Did this close to twenty years ago. Ported a COM DLL to Linux and one of the executables using it.<p>I implemented everything it needed. COM functions like CoCreateInstance, entry points like DllCanUnloadNow, Windows Sockets and whatnot.<p>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.<p>The lib's DllRegisterServer nicely registered its COM class inside the fake registry.<p>Don "COM is Love" Box would have teared up had he seen this.
Note that the author is Tavis Ormandy, the guy who (among many, many other things) discovered one of the worst Windows security vulns, that was patched last month -- and from the README it seems like this is part of the toolchest he used for this particular discovery.<p>To 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.
This 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.
This is cool and a lot lighter than WINE, though the important keyword is <i>self-contained</i> 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.
If you like this, you might also like the Witchcraft Compiler Collection[1] by Jonathan Brossard.<p>It 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.<p>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.<p>[1] <a href="https://github.com/endrazine/wcc/blob/master/README.md" rel="nofollow">https://github.com/endrazine/wcc/blob/master/README.md</a><p>[2] <a href="https://www.blackhat.com/docs/eu-16/materials/eu-16-Brossard-Witchcraft-Compiler-Collection-Towards-Self-Aware-Computer-Programs.pdf" rel="nofollow">https://www.blackhat.com/docs/eu-16/materials/eu-16-Brossard...</a>
Very cool, to load .dll, so tests/builds/packaging can be run in Linux. There is also the possibility of signing .exe/.dll on Linux. AFAIK, the remaining stuff is to sign .msi files.
I read the readme, but i still can't understand how is different than winelib (and i don't know much of ndiswrapper internal).<p>I understand that since is a debugging oriented tool has a different scope than wine, but why don't use (at least partially) the already implemented windows function?
I am missing something? maybe this is more efficient o maybe wine is not enough modular?
I don't know if I would like software ported to Linux in this way. I already have mixed feelings about WINE. My concern is really on the legal side of things. What if these things are patent protected and people start getting sued?