This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Thread Injection + Cygwin problems


Hi,

   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
interested in.

   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.


Kaveh.


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]