Hi Stefan, list;
Just a small FYI-ish update..
Yesterday I took a swing at this. I downloaded the TortoiseSVN
sources, and got through the list of dependencies, but I found the
build process to be difficult to get running, to the point where my
time was better spent fixing the problem in other ways.
So I've more or less given up modifying SubWCRev for the time being,
focusing instead on a nimble/versatile tool to wrap svnversion and
flunk the output into $Rev.
I'd like to avoid dumping Cygwin executables in the repository,
because it creates an issue if there are different versions of
cygwin1.dll running on one system at a time. So that rules a
bash/sed/svnversion combination out, given that there are AFAIK no
working free win32 version of bash that includes functional piping
(Cygwin aside). I'd also like to avoid Windows Scripting Host, because
it is a security pothole, and also any third party stuff, because it
adds yet another thing that can potentially go wrong.
That sort of leaves cmd and custom-built exes. Cmd has some
deficiencies, for example %errorlevel% goes missing if you pipe the
output of a command into an environment variable. Deciding that it
must be possible to do it with a custom-built exe, I set out to
develop a tool. It's a working prototype, so the code is of course
butt ugly, but other than that it works fine:
It does this:
- start subprocess
- capture output
- get pid of parent process (cmd)
- query ProcessBasicInformation via NtQueryInformationProcess
- ReadProcessMemory to load ProcessEnvironmentBlock via pointer in PBI
- ReadProcessMemory to load RtlUserProcessParameters via pointer in PEB
- ReadProcessMemory to load Environment via pointer in UPP and binary
search to find correct size
- WriteProcessMemory to poke a new environment variable into the
parent cmd process (clear env var manually beforehand, using "SET
After finishing the prototype, it's clear that it is not the most
elegant approach. NtQueryInformationProcess resides in ntdll.dll and
is not supposed to be called from user applications, and
WriteProcessMemory pretty much needs administrative privileges to run.
On the plus side, the solution does bring back memories of the
Commodore 64 days, when peeking and poking in memory was all the rage
and a blue screen was a good thing ;-).
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com
Received on Tue Oct 9 13:28:34 2007