3 ms·
Side note, but for all the people saying this is absolutely godawful and the license is OK because no one in their right mind would use it in production, this p
by wheybags 5y ago
Side note, but for all the people saying this is absolutely godawful and the license is OK because no one in their right mind would use it in production, this project from MS does basically the same thing: https://www.microsoft.com/en-us/research/project/detours/ https://www.microsoft.com/en-us/research/project/detours/
Recently open sourced, but has been used for twenty years in real products from MS and others. It's not so crazy as you might think!
An example of a real use I had for it: redirecting messages from OutputDebugString to a log file. AFAIK that is the best way to do it, when you only want the output from your one process. "Why not just call a proper logging function directly instead?" Because the OutputDebugString calls were coming from inside my GPU driver. Real life is not some ivory tower of perfection. An imperfect world requires imperfect solutions.
- woodruffw 5y agoThe key difference being that Detours is a library written by Microsoft engineers with access to the Win32 team and the ability (if not drive) to ensure that Detours functions correctly as changes are made. Those changes are also probably pretty rare, given Win32’s famously stable ABI. This library patches a third party runtime, one that explicitly forbids this kind of instrumentation and has a famously unstable ABI. You can do whatever you want to get your job done, and this is certainly one way to do it, but it’s absolutely a dangerous hack.
- tptacek 5y agoI've done a lot of work with Detours and have written my own trampoline injection thingies in Python and Ruby, and this approach is not really a reasonable way to build production software. A proof-of-concept Detours implementation posted as an illustration for an amusing blog post may be the most perfect possible use case for a "you are not allowed to use this for anything" license, maybe rivaled only by the code you post for a cipher you designed yourself.
- reificator 5y agoTo anyone else confused as I was, "this project from MS does basically the same thing" is referring to monkeypatching a running executable, not having a license that forbids use of the software.