TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Porting Windows Dynamic Link Libraries to Linux

325 pointsby dmitabout 8 years ago

12 comments

kazinatorabout 8 years ago
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&#x27;s home directory, and HKEY_LOCAL_MACHINE to &#x2F;etc.<p>The lib&#x27;s DllRegisterServer nicely registered its COM class inside the fake registry.<p>Don &quot;COM is Love&quot; Box would have teared up had he seen this.
评论 #14409612 未加载
评论 #14407222 未加载
评论 #14406923 未加载
beagle3about 8 years ago
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.
psykoticabout 8 years ago
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&#x27;d compile on Windows with MSVC and cross-link to Linux with his custom tool.
评论 #14408414 未加载
pierrecabout 8 years ago
This is cool and a lot lighter than WINE, though the important keyword is <i>self-contained</i> Windows libraries. I gather this won&#x27;t work on DLLs that call any of the plethora of Windows APIs. I&#x27;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.
评论 #14408116 未加载
评论 #14407303 未加载
weinzierlabout 8 years ago
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:&#x2F;&#x2F;github.com&#x2F;endrazine&#x2F;wcc&#x2F;blob&#x2F;master&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;endrazine&#x2F;wcc&#x2F;blob&#x2F;master&#x2F;README.md</a><p>[2] <a href="https:&#x2F;&#x2F;www.blackhat.com&#x2F;docs&#x2F;eu-16&#x2F;materials&#x2F;eu-16-Brossard-Witchcraft-Compiler-Collection-Towards-Self-Aware-Computer-Programs.pdf" rel="nofollow">https:&#x2F;&#x2F;www.blackhat.com&#x2F;docs&#x2F;eu-16&#x2F;materials&#x2F;eu-16-Brossard...</a>
tathougiesabout 8 years ago
Why not just use full-on WINE? The basic system calls are pretty much fully covered. It seems this duplicates a lot of work.
评论 #14408509 未加载
评论 #14406582 未加载
steeveabout 8 years ago
Did anyone find info on how are user32.dll and kernel32.dll handled ?
评论 #14408123 未加载
faragonabout 8 years ago
Very cool, to load .dll, so tests&#x2F;builds&#x2F;packaging can be run in Linux. There is also the possibility of signing .exe&#x2F;.dll on Linux. AFAIK, the remaining stuff is to sign .msi files.
hexmilesabout 8 years ago
I read the readme, but i still can&#x27;t understand how is different than winelib (and i don&#x27;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&#x27;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?
评论 #14408980 未加载
gadnium79about 8 years ago
why?
评论 #14406450 未加载
评论 #14406466 未加载
shmerlabout 8 years ago
Sounds like reimplementing what Wine already does.
partycoderabout 8 years ago
I don&#x27;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?
评论 #14408675 未加载