delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/03/16:25:58

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 03 Dec 2002 16:28:01 -0500
From: Jason Tishler <jason AT tishler DOT net>
Subject: rebase-0.4 patch
To: Ralf Habacker <Ralf DOT Habacker AT freenet DOT de>
Cc: Cygwin <cygwin AT cygwin DOT com>
Mail-followup-to: Ralf Habacker <Ralf DOT Habacker AT freenet DOT de>,
Cygwin <cygwin AT cygwin DOT com>
Message-id: <20021203212800.GB884@tishler.net>
MIME-version: 1.0
User-Agent: Mutt/1.4i

--Boundary_(ID_4ZswFN3GLYjfAzTQc5JMCg)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline

Ralf,

The attached patch changes your version of rebase as follows:

    1. Round NewImageSize (to the nearest 0x10000) to be consistent
       with MS's rebase.
    2. Fix bug when rebasing up.

Are you willing to accept these changes -- in particular, #2?

If so, then I would like to offer the following too:

    1. gcc 3.2 patches (completed)
    2. conversion to librebase.a patch (to be completed)

My plan is as follows:

    1. Convert your rebase into a library, librebase.a.
    2. Merge librebase.a with my stand-alone, non-persistent rebase.
    3. Release this rebase so there is one version that supports all
       users (including Me) and all DLLs (including ones that need
       fix-up due to stripping).
    4. Merge the above into my stand-alone, persistent rebase.
    5. Submit a setup.exe patch with the above functionality.
    6. When setup.exe patch is accepted, release stand-alone, persistent
       rebase that can be used for DLLs not installed by setup.exe.

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

--Boundary_(ID_4ZswFN3GLYjfAzTQc5JMCg)
Content-type: text/plain; charset=us-ascii; NAME=rebase.cc.diff
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=rebase.cc.diff

--- ../rebase-ralf-0.4.orig/rebase.cc	2002-08-10 17:41:40.000000000 -0400
+++ rebase.cc	2002-12-03 15:35:24.000000000 -0500
@@ -113,8 +113,16 @@ BOOL ReBaseImage(
 	*OldImageSize = ntheader->OptionalHeader.SizeOfImage; 
 	*NewImageSize = ntheader->OptionalHeader.SizeOfImage; 
 
+	// Round NewImageSize to be consistent with MS's rebase.
+	const ULONG imageSizeGranularity = 0x10000;
+	ULONG remainder = *NewImageSize % imageSizeGranularity;
+	if (remainder)
+		*NewImageSize = (*NewImageSize - remainder) + imageSizeGranularity;
+
 	if (fGoingDown)
 		*NewImageBase -= *NewImageSize; 
+	else
+		*NewImageBase += *NewImageSize; 
 		
 	// already rebased 
 	if (ntheader->OptionalHeader.ImageBase == *NewImageBase) {


--Boundary_(ID_4ZswFN3GLYjfAzTQc5JMCg)
Content-Type: text/plain; charset=us-ascii

--
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/
--Boundary_(ID_4ZswFN3GLYjfAzTQc5JMCg)--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019