This is the mail archive of the
mailing list for the Cygwin project.
Thread Injection + Cygwin problems
- From: Kaveh Goudarzi <kaveh at arkasoft dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 19 Jun 2006 23:48:10 +0100
- Subject: Thread Injection + Cygwin problems
I've written a program to detect the invocation of
processes and then inject them with a remote thread in
the hope of getting the cmdLine/cwd and environment
variables of the running process.
In doing so I came across the fact that cygwin does
not synch its vars with windows for cygwin processes so
my call to GetEnvironmentStrings brings up only a truncated
number of the actual env vars.
So following advice from the list in my injected thread
I check to see if cygwin1.dll is loaded and if so I then
try to use getenv to get the environment strings I'm
However when I do that the process I'm injecting crashes.
If I do a Sleep(0) before I try to get the envs the frequency
of the crashes is greatly reduced but still happens occasionally.
Is there an obvious reason why attempting to invoke
cygwin calls such as getenv() in an injected thread might
result in crashes? I've also tried cygwin_internal(CW_SYNC_WINENV)
with the same result. I'm running Windows XP and have tried the
20060614 snapshot with the same result.
I'm not sure how to approach the problem so any advice
would be greatly appreciated.
thanks in advance.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html