delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/19/18:48:32

X-Spam-Check-By: sourceware.org
Message-ID: <449729AA.4030007@arkasoft.com>
Date: Mon, 19 Jun 2006 23:48:10 +0100
From: Kaveh Goudarzi <kaveh AT arkasoft DOT com>
User-Agent: Thunderbird 1.5.0.4 (Windows/20060516)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Thread Injection + Cygwin problems
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: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019