Cygwin's spawn/exec, mintty and the "Program Compatibility Assistant"

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Feb 17 21:05:00 GMT 2012


On Feb 17 21:56, Corinna Vinschen wrote:
> On Feb 17 15:26, Charles Wilson wrote:
> > On 2/17/2012 7:18 AM, Corinna Vinschen wrote:
> > > Bottom line:
> > > 
> > > - From observation I assume that it's all about having a runlevel manifest
> > >   or not.  On W7 the binary additionally needs a special W7 compatible
> > >   manifest.
> > > 
> > > - Console applications are only affected when started directly from the
> > >   GUI.  If they are started from a correctly-manifested console app (CMD),
> > >   they and their children are not affected anymore.
> > > 
> > > - So we would have to create all executables with a W7-compatible
> > >   manifest.  That is quite certainly not an option.
> > > 
> > > - So we have to keep the CREATE_BREAKAWAY_FROM_JOB stuff in Cygwin
> > >   for the time being.
> > 
> > So, should run.exe (and run2.exe) be modified to do something similar to
> > what Cygwin does, since they both use CreateProcess directly?
> 
> Just tested.  Yes, that should be helpful.  For run and run2 it should be
> sufficient to do what the former code in Cygwin did:
> 
>   JOBOBJECT_BASIC_LIMIT_INFORMATION jobinfo;
>   if (QueryInformationJobObject (NULL, JobObjectBasicLimitInformation,
>   				 &jobinfo, sizeof jobinfo, NULL)
>       & (jobinfo.LimitFlags & (JOB_OBJECT_LIMIT_BREAKAWAY_OK
> 			       | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK)))
>     create_flags |= CREATE_BREAKAWAY_FROM_JOB;
> 
> Btw., there's an easy way to test if it worked:  Start Process Explorer
> from Sysinternals.  All processes running in a PCA job object have a
> brown background.  If `run foo' successfully broke away from the job,
> the line for the foo process should not have a brown background.

Actually, a process has a brown background if it's in *any* job.  But
since we don't use jobs in Cygwin, a brown background very likely means
running in a PCA job.  If you want to be sure, open the processes'
properties dialog, switch to the "Job" tab, and look for the job object
name.  it should be something like "\BaseNamedObjects\PCA_<GUID>"


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-developers mailing list