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

Re: Avoid collisions between parallel installations of Cygwin


On Oct 20 16:15, Dave Korn wrote:
> Corinna Vinschen wrote:
> 
> > Actually I think we can make it even more simple.  Assume we start with
> > a single USHORT value, which is what we're planning, and two versions
> > later we add a ULONG value.  After a successful call to FindResource(),Cygcheck can ask for SizeofResource ().  The size of the resource is a simple
> > way to figure out which data is available in that version of the Cygwin
> > DLL.
> 
>   Maybe, but IMO it's a false economy to *ever* not include a version number
> in a public structure like that.  How many times has it caused trouble, as
> compared to how many times saving a couple of bytes has been worth it?  What
> if we wanted to change just the layout or semantics of a data item, I guess
> we'd be obliged to add a new dummy item just to change the size?  The size of
> the struct is a one-dimensional and lossy approximation of what's actually in it.

Well, I don't care, I can also add version info.  The real problem is
that the BeginUpdateResource/UpdateResource/EndUpdateResource functions
apparently destroy the DLL!

The information in the resource section is correctly changed, but
afterwards I get an error box

  cygwin1.dll is either not designed to run on Windows
  or it contains an error.  Try installing [blah].

It looks like this Windows functionality destroys the section header
information for sections which have a long section name.

This is the new resource section, without a version info yet:

  #define CYGWIN_RES_PROPS_NAME "cygprops"
  CYGWIN_RES_PROPS_NAME RCDATA
  BEGIN
    0x0L  /* ULONG "disable_key".  Set to 0 means, enable unique installation
	     key usage, disable with setting to != 0. */
  END

This is what objdump -h prints before the change:

cygwin1.dll:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00180f04  61001000  61001000  00000400  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
  1 .autoload_text 00001548  61182000  61182000  00181400  2**3
                  CONTENTS, ALLOC, LOAD, CODE
  2 .data         00015f48  61184000  61184000  00182a00  2**5
                  CONTENTS, ALLOC, LOAD, DATA
  3 .rdata        000563e4  6119a000  6119a000  00198a00  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .bss          0002a690  611f1000  611f1000  00000000  2**5
                  ALLOC
  5 .edata        00008c90  6121c000  6121c000  001eee00  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .rsrc         00000460  61225000  61225000  001f7c00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  7 .reloc        00015548  61226000  61226000  001f8200  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .cygwin_dll_common 0000a260  6123c000  6123c000  0020d800  2**5
                  CONTENTS, ALLOC, LOAD, DATA, SHARED
  9 .gnu_debuglink 00000010  61247000  61247000  00217c00  2**2
                  CONTENTS, READONLY, EXCLUDE
 10 .idata        00008000  61248000  61248000  00217e00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 11 .cygheap      000b0000  61250000  61250000  00000000  2**2
                  ALLOC

And that is after the change:

cygwin1.dll:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00180f04  61001000  61001000  00000400  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
  1               00001548  61182000  61182000  00181400  2**3
                  CONTENTS, ALLOC, LOAD, CODE
  2 .data         00015f48  61184000  61184000  00182a00  2**5
                  CONTENTS, ALLOC, LOAD, DATA
  3 .rdata        000563e4  6119a000  6119a000  00198a00  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .bss          0002a690  611f1000  611f1000  00000000  2**5
                  ALLOC
  5 .edata        00008c90  6121c000  6121c000  001eee00  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .rsrc         0000047c  61225000  61225000  001f7c00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  7 .reloc        00015548  61226000  61226000  001f8200  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8               0000a260  6123c000  6123c000  0020d800  2**5
                  CONTENTS, ALLOC, LOAD, DATA, SHARED
  9               00000010  61247000  61247000  00217c00  2**2
                  CONTENTS, READONLY, EXCLUDE
 10 .idata        00008000  61248000  61248000  00217e00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 11 .cygheap      000b0000  61250000  61250000  00000000  2**2
                  ALLOC

As you can see, the names of the sections with long names simply
disappeared.

And worse, the size of the .rsrc section changed.  It got bigger, even
though I'm updating an existing resource and the sizeof the new data is
sizeof (ULONG) == 4, just what SizeofResource() returns as well.
Changing the value was successful though, and subsequent calls to change
the value work fine, but don't change the size of the .rsrc section
anymore.

Does anybody have an idea what's going on?  Am I doing something
wrong or are these Windows function really broken?


Corinna

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


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