Fixed broken environment on restart.
authorIain Patterson <me@iain.cx>
Tue, 1 Apr 2014 21:20:21 +0000 (22:20 +0100)
committerIain Patterson <me@iain.cx>
Tue, 1 Apr 2014 21:23:42 +0000 (22:23 +0100)
commit620fc9f56975c9319a1b0e0be556e264ad1d485d
tree2d28433ce15e1cbd72b32b8b513e90d700a4c483
parent0dfa0fdb3a851b1ff69a0f0b308a3e1371286a57
Fixed broken environment on restart.

We were calling duplicate_environment() to copy the service's initial
environment prior to restarting it.  However the duplicate_environment()
function modified its input by replacing = characters with NULLs.  That
is not allowed; the memory returned by GetEnvironmentStrings() must be
treated as readonly.

After two restarts the application would run with a null environment and
probably crash.

We now copy the initial environment on to the heap and operate on the
copy, ensuring that the corruption does not occur.

Thanks Alessandro Gherardi.
README.txt
env.cpp
env.h
service.cpp