3 ms·
I've mentioned it here before. I have a "cd" replacement tool for Windows. It works by writing a separate thread to cmd.exe's process and remotely running it
by banana_giraffe 6y ago
I've mentioned it here before. I have a "cd" replacement tool for Windows. It works by writing a separate thread to cmd.exe's process and remotely running it to do things in cmd's process (change the current directory, update a few enviornment variables cmd.exe uses behind the scenes). I am flabbergasted that it works, and it still works after all of these years.
- dgellow 6y agoIs the code available somewhere? I would be interested to read it
- banana_giraffe 6y agoIf you really want to see it, I put the core of it here: https://pastebin.com/v92Aesty https://pastebin.com/v92Aesty ExecuteRemoteThread() does what it's name says, copying RemoteThread to cmd.exe, and running it. The rest of the code is about getting pointers to a few WinAPIs that are used in a safe way, and dancing around not having a CRT that can be sanely used inside of cmd.exe.
- dgellow 6y agoThanks!