This is the mail archive of the cygwin-apps 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]

Cygport and auto-manifestize compatibility manifest


Hi Yaakov,
Hi everybody else interested,


I guess you saw the discussion about GetVersionEx and Windows 8.1 on the
main list.

In the meantime I found that the missing manifest files in our
executables apparently have more implications than anticipated.

Windows 8.1's Task Manager has a new column in it's detailed view.  It's
called "Operating System Context" and it tells the user how executables
are treated by the OS in terms of compatibility.  I switched this on,
and I found that all our executables without manifests are treated as if
they are only Vista-compatible and never made a step beyond that.

This has actual implications.  For instance, up to Vista the
GetOverlappedResult function has a bug in terms of a race condition
related to the usage of the event object.  Applications which are
treated as Vista-only compatible get the Vista behaviour of
GetOverlappedResult, including the race condition!

Given that everything happening is the fault of the Cygwin DLL, not the
fault of the executable, I would like to be able to tell the OS,
whatever version it is, yes, this executable is Windows X.Y compatible.

Obviously this can only work if you build a new executable and know the
OS GUID, but still...

So I was wondering if we could, somehow, tweak cygport to add a manifest
to every created executable, along the lines of the setup manifests,
without having to mention that in the cygport file.  Fully automatic.

The manifests and, as a result, the cygport package would have to be
updated every time Microsoft releases a new OS version, but that's just
adding another GUID to the manifest.

The downside (as of the time of writing) is this:

  I did not manage to add a .rsrc section to an executable using
  objcopy, without the executable being broken afterwards.

  The *only* way I was able to add a mainfest resource to an existing
  executable was a helper application which uses the Win32 function
  UpdateResource, using a crude algorithm, here with tcsh as example:

  - Create a tcsh-manifest.rc manifest (aka "steal the setup.exe manifest).
  - Create a tcsh-manifest.o file via windres.
  - Create a dummy.exe executable with just `int main(){}' and link it
    with tcsh-manifest.o.
  - Make sure tcsh.exe does not contain any section with long sectionname
    (here: .gnu_debuglink).
  - Call the helper application, which basically works like this:

      LoadLibrary("dummy.exe");
      FindResource(CREATEPROCESS_MANIFEST_RESOURCE_ID, RT_MANIFEST);
      LoadResource(...)
      LockResource(...)
      BeginUpdateResource("tcsh.exe")
      UpdateResource(RT_MANIFEST,CREATEPROCESS_MANIFEST_RESOURCE_ID,...)
      EndUpdateResource(...)

   - The resulting executable actually worked and was treated as a
     Windows 8.1 executable.

   If this hack is done after stripping, but before adding the
   .gnu_debuglink section, it could run automatically and all newly
   produced executables would be *finally* compatible with latest
   Windows versions.

Apart from the fact that it would be nice if our linker would do this
automatically and transparently, is that something we should do in
cygport for the time being?


Thanks,
Corinna

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

Attachment: pgpzJlfzPhjGa.pgp
Description: PGP signature


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