public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* Cygport and auto-manifestize compatibility manifest
@ 2013-11-20 13:29 Corinna Vinschen
  2013-11-20 14:47 ` Charles Wilson
  2013-11-20 16:28 ` Achim Gratz
  0 siblings, 2 replies; 19+ messages in thread
From: Corinna Vinschen @ 2013-11-20 13:29 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 3405 bytes --]

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 #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2013-12-03 16:28 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 13:29 Cygport and auto-manifestize compatibility manifest Corinna Vinschen
2013-11-20 14:47 ` Charles Wilson
2013-11-20 15:01   ` Corinna Vinschen
2013-11-20 15:43     ` Christopher Faylor
2013-11-20 16:06       ` Corinna Vinschen
2013-11-20 21:47         ` Corinna Vinschen
2013-11-21 10:59         ` Peter Rosin
2013-11-21 11:48           ` Corinna Vinschen
2013-11-21 14:27             ` Christopher Faylor
2013-11-21 15:30               ` Corinna Vinschen
2013-11-21 15:38                 ` Corinna Vinschen
2013-11-20 16:02     ` Corinna Vinschen
2013-11-20 16:17       ` Corinna Vinschen
2013-11-20 16:28 ` Achim Gratz
2013-11-20 16:48   ` Corinna Vinschen
2013-11-20 17:22     ` Achim Gratz
2013-11-20 17:32       ` Corinna Vinschen
2013-11-20 18:15         ` Corinna Vinschen
2013-12-03 16:28           ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).