Subject: Re: Rebase 1.5-1: Causes invalid page fault
From: Jason Tishler <[email-masked]>
To: Nicholas Wourms <[email-masked]>
Cc: [email-masked]
Date: Tue, 18 Jun 2002 10:34:36 -0400

Nicholas,

On Tue, Jun 18, 2002 at 05:52:46AM -0700, Nicholas Wourms wrote:
> --- Jason Tishler <[email-masked]> wrote:
> > Since there have been many new packages added since then, one needs to
> > determine if more DLLs need to be skipped too.
> 
> Short of starting a program linked againsted a "potential" corrupted dll,
> is there any other way to know if the dll was corrupted?  Perhaps some
> heuristics in rebase to detect this (if possible) and restore the original
> dll returning a message stating that corruption has occurred might be the
> way to go?

The above has already been suggested by Rob.  Although inconvenient, I
don't see a way around it unless someone figures out how to prevent the
corruption from occurring in the first place.

> Perhaps there is something common in the mangled dlls hex that can be
> used to identify this corruption?

At the command line, you can use file:

    $ file cygcurl-2.dll
    cygcurl-2.dll: MS Windows PE Intel 80386 console DLL
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    $ rebase -d -b 0x68000000 -o 0x10000 cygcurl-2.dll
    C:\cygwin\tmp\cygcurl-2.dll: new base = 67ff0000, new size = 30000

    $ file cygcurl-2.dll
    cygcurl-2.dll: MS-DOS executable (EXE), OS/2 or MS Windows
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Inside of a program, you can examine the PE header (specifically the PE
characteristics field).  See rebaser::is_rebaseable() in the following:

    http://cygwin.com/ml/cygwin-apps/2002-02/msg00010.html

for some ideas.

> > Yes, please.  I'm willing to review your drafts.
> 
> I'll draw up a tentitive version using the LDP HOWTO sgml style and send
> it as soon as it is ready.  You know, it occurs to me that cygwin is
> getting big enough to justify a Cygwin Documentation Project...  Anyhow,
> I'm going to cull the archives for questions on rebase, please tell me if
> there are any other MLs on which you discussed this.

It should "all" be on the cygwin lists, but I have discussed this issue
on the Python list too.  The Python discussion has been captured here:

    http://www.zope.org/Members/dgeorgieff/howto_zope_cvs_on_cygwin/

> > OK, the above indicates that rebase.exe is blowing up in the call to
> > ReBaseImage().  So, either these is a problem with ReBaseImage() (under
> > Me) or bad arguments are being passed.  Can you get the values of the
> > arguments?
> 
> Forgive my ignorance, but how do you suggest I approach this?  Since
> rebase isn't linked against cygwin1.dll, strace doesn't work on it.  Is
> there a way to do this operation gdb or is there another tool I should
> use?

Use gdb by setting a breakpoint ("b" command) at the call to
ReBaseImage() and then printing ("p" command) out the arguments.  Do
they look valid?

Jason

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/