X-Spam-Check-By: sourceware.org Message-ID: <449729AA.4030007@arkasoft.com> Date: Mon, 19 Jun 2006 23:48:10 +0100 From: Kaveh Goudarzi User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Thread Injection + Cygwin problems Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Mon Jun 19 23:48:16 2006 X-DSPAM-Confidence: 0.9997 X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 449729b0283461410093335 X-DSPAM-Factors: 27, X-Spam-Score: 1.213 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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/