Subject: rebase-0.4 patch
From: Jason Tishler <[email-masked]>
To: Ralf Habacker <[email-masked]>
Cc: Cygwin <[email-masked]>
Date: Tue, 03 Dec 2002 16:28:01 -0500

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
--- ../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) {

--
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/