Re: Integrating Ralf's rebase into setup.exe
Ralf, On Fri, Jan 31, 2003 at 12:23:55AM +0100, Ralf Habacker wrote: > Applied and checked in. Thanks! 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
RE: Integrating Ralf's rebase into setup.exe
> The attached fixes the following: > > 1. merge problem when you applied (by hand?) the following patch: > >http://cygwin.com/ml/cygwin/2002-12/msg00138.html > > 2. bug I introduced in the above patch when I attempted but did >not successfully fix rebasing up > > #1 causes the base address to be an extra DLL size amount lower and #2 > causes the base address to be an extra DLL size amount higher. > Applied and checked in. Ralf
Re: Integrating Ralf's rebase into setup.exe
Ralf, On Tue, Jan 21, 2003 at 10:37:03PM +0100, Ralf Habacker wrote: > > The attached patch enables libimagehelper.a to be usable by C source > > too. > > > Applied. Thanks for fixing this. The attached fixes the following: 1. merge problem when you applied (by hand?) the following patch: http://cygwin.com/ml/cygwin/2002-12/msg00138.html 2. bug I introduced in the above patch when I attempted but did not successfully fix rebasing up #1 causes the base address to be an extra DLL size amount lower and #2 causes the base address to be an extra DLL size amount higher. Thanks, 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 Index: rebaseimage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/rebaseimage.cc,v retrieving revision 1.5 diff -u -p -r1.5 rebaseimage.cc --- rebaseimage.cc 21 Jan 2003 21:33:27 - 1.5 +++ rebaseimage.cc 29 Jan 2003 19:42:33 - @@ -75,11 +75,6 @@ BOOL ReBaseImage( if (fGoingDown) *NewImageBase -= *NewImageSize; - else -*NewImageBase += *NewImageSize; - - if (fGoingDown) -*NewImageBase -= *NewImageSize; // already rebased if (ntheader->OptionalHeader.ImageBase == *NewImageBase) @@ -103,6 +98,8 @@ BOOL ReBaseImage( return false; } + if (!fGoingDown) +*NewImageBase += *NewImageSize; SetLastError(NO_ERROR); return true;
RE: Integrating Ralf's rebase into setup.exe
Hi Jason, > The attached patch enables libimagehelper.a to be usable by C source > too. > Applied. Thanks for fixing this. Ralf
Re: Integrating Ralf's rebase into setup.exe
Ralf, On Sat, Jan 04, 2003 at 12:16:57AM +0100, Ralf Habacker wrote: > This seems mostly to be fixed in the recent cvs release. The attached patch enables libimagehelper.a to be usable by C source too. Thanks, 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 Index: imagehelper.h === RCS file: /cvsroot/kde-cygwin/tools/rebase/imagehelper.h,v retrieving revision 1.1 diff -u -p -r1.1 imagehelper.h --- imagehelper.h 2 Jan 2003 17:03:13 - 1.1 +++ imagehelper.h 21 Jan 2003 12:31:11 - @@ -23,6 +23,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + BOOL ReBaseImage( PSTR CurrentImageName, PSTR SymbolPath,// ignored @@ -89,6 +93,7 @@ DWORD SetImageHelperDebug( DWORD level ); - - +#ifdef __cplusplus +} +#endif #endif Index: rebaseimage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/rebaseimage.cc,v retrieving revision 1.4 diff -u -p -r1.4 rebaseimage.cc --- rebaseimage.cc 3 Jan 2003 23:16:05 - 1.4 +++ rebaseimage.cc 21 Jan 2003 12:31:11 - @@ -22,6 +22,7 @@ #include #include "objectfile.h" +#include "imagehelper.h" BOOL ReBaseImage( PSTR CurrentImageName,
RE: Integrating Ralf's rebase into setup.exe
> > 1) some that go to stdout probably should be stderr, and vice versa. > > still open. I think debug message should go to cerr and normal printing should > go to cout. > This seems mostly to be fixed in the recent cvs release. Ralf
RE: Integrating Ralf's rebase into setup.exe
> Of course, rebind_main doesn't call BindImage or BindImageEx. It does > have a commented-out call to dll.rebind() -- but > LinkedObjectFile::rebind() doesn't call BindImage() or BindImageEx > either -- LinkedObjectFile::rebind() does all of the work itself. > > Looks like the factorization isn't quite complete...work in progress, right? You've got the point :-) BindImage[Ex]() is only an imagehlp compatible wrapper, which I have written later. And it works, so I haven't recognized this. > > 1) some that go to stdout probably should be stderr, and vice versa. still open. I think debug message should go to cerr and normal printing should go to cout. > 2) some are guarded by 'if (debug)' and probably should be 'if (some > library call that returns the value of debug for this instance)' -- but > I didn't really check the lexical scope. These may be fine. For building and debugging a standalone rebase i think it is good. For the setup integration we can change this later. > 3) some aren't even guarded at all, and should be. I'm preparing a patch for this. > 4) Then there's that whole exceptions vs. print-an-error-message from > within the library deal. > still open Ralf
RE: Integrating Ralf's rebase into setup.exe
Hi Gary, > > How about "libhabackersimagehelp.a" etc? > this would suggest, that this is my lib, but there are also others who have worked and probably will work on this library. I habe only started this lib I think imagehelper will be good. Ralf
RE: Integrating Ralf's rebase into setup.exe
How about "libhabackersimagehelp.a" etc? -- Gary R. Van Sickle Brewer. Patriot. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Ralf Habacker > Sent: Thursday, January 02, 2003 3:50 AM > To: Robert Collins > Cc: Jason Tishler; [EMAIL PROTECTED] > Subject: RE: Integrating Ralf's rebase into setup.exe > > > > > If I remember right, this lib will be used for a cygwin based > > rebase and later > > > in the cygwin's setup application which is mingw based. So this > lib must be > > > buildable for cygwin and mingw, isn't it ? > > > > Yes. And the library should use the appropriate naming convention for > > the target platform. > > I *don't* think it should be named libimagehlp.a, > > because it's *not* a 100% replacement for libimagehlp. > > You have already stated > > - libcygimagehlp (for cygwin applications like rebase) > > Do you mean > > - libmingwimagehlp > > for setup.exe ? > > What about the header ? It could be the same in both variants. > Symbolic linking > ? > > cygimagehlp.h > mingwimagehlp.h -> cygimagehlp.h > > I think that's bad. The bfd library is named libbfd.xx on every platform, so > this library should be named in another way. > > What about imagehelper.a and imagehelper.h and using autoconf stuff ? > > Ralf >
Re: Integrating Ralf's rebase into setup.exe
Ralf Habacker wrote: You have gotten me just between finishing the things. I was interrupted a little after written the last mail, so 10 minutes later is was mostly fixed. Lucky me. 5) is the 'bindimage.cc' file used at all? it is used in rebind_main.cc. You mean it *should* be used in rebind_main.cc. It's not listed in Makefile.in as one of the dependencies for REBIND_FILES, nor is it a member of LIBFILES. Of course, rebind_main doesn't call BindImage or BindImageEx. It does have a commented-out call to dll.rebind() -- but LinkedObjectFile::rebind() doesn't call BindImage() or BindImageEx either -- LinkedObjectFile::rebind() does all of the work itself. Looks like the factorization isn't quite complete...work in progress, right? Anyway, here's my remaining patches. With two exceptions (Makefile and rebase_main.cc (main)), these are basically removing all printf calls and stdio.h, in favor of cout, cerr, and stream manipulators. Anything that was printf() became std::cout, fprintf(stderr,) became cerr. However, there are still some "design" issues that I didn't touch: 1) some that go to stdout probably should be stderr, and vice versa. 2) some are guarded by 'if (debug)' and probably should be 'if (some library call that returns the value of debug for this instance)' -- but I didn't really check the lexical scope. These may be fine. 3) some aren't even guarded at all, and should be. 4) Then there's that whole exceptions vs. print-an-error-message from within the library deal. The point is, ALL console output is now C++, cout/cerr style (before, it was half C++, half printf) --Chuck 2002-01-02 Charles Wilson <[EMAIL PROTECTED]> * Makefile.in: add bindimage.o to LIBFILES change ar flags for creating static library * bindimage.cc: include imagehelper.h * objectfile.cc: remove dependency on stdio.h, use iostream and iomanip instead. (ObjectFile::ObjectFile): use std::cout instead of printf, std::cerr instead of fprintf(stderr,...) (LinkedObjectFile::rebind): ditto. (LinkedObjectFile:LinkedObjectFile): ditto. (LinkedObjectFile::PrintDependencie): ditto. (LinkedObjectFile::unbind): ditto. (main): ditto. * objectfilelist.cc: remove dependency on stdio.h, use iostream instead. (main): use std::cout instead of printf, std::cerr instead of fprintf(stderr,...) * rebase_main.cc: remove dependency on stdio.h (main): don't call GetLastError() twice, use stored value in aStatus2. Call strerror() for a more informative message. * rebind_main.cc: remove dependency on stdio.h (Usage): use std::cout instead of printf, std::cerr instead of fprintf(stderr,...) * sections.cc: remove dependency on stdio.h, use iostream and iomanip instead. (Section::print): use std::cout instead of printf, std::cerr instead of fprintf(stderr,...) (Exports::Exports): ditto. (Exports::dump): ditto. (Imports::Imports): ditto. (Imports::dump): ditto. (Relocations::check): ditto. (Relocations::fix): ditto. (Relocations::relocate): ditto. * unbind_main (Usage): ditto. Index: Makefile.in === RCS file: /cvsroot/kde-cygwin/tools/rebase/Makefile.in,v retrieving revision 1.1 diff -u -r1.1 Makefile.in --- Makefile.in 2 Jan 2003 18:14:32 - 1.1 +++ Makefile.in 2 Jan 2003 18:35:56 - @@ -9,7 +9,8 @@ LIB_TARGET=imagehelper LIB_TARGET_FILE=libimagehelper.a LIB_FILES=objectfile.o objectfilelist.o sections.o debug.o \ - rebaseimage.o checkimage.o fiximage.o getimageinfos.o + rebaseimage.o checkimage.o fiximage.o +getimageinfos.o \ + bindimage.o # # applications @@ -33,7 +34,7 @@ $(LIB_TARGET): $(LIB_TARGET_FILE) $(LIB_TARGET_FILE): $(LIB_FILES) - ar -qf $@ $^ + ar -cru $@ $^ $(REBASE_TARGET): $(REBASE_FILES) $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) Index: bindimage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/bindimage.cc,v retrieving revision 1.5 diff -u -r1.5 bindimage.cc --- bindimage.cc1 Jan 2003 11:55:49 - 1.5 +++ bindimage.cc2 Jan 2003 18:35:57 - @@ -21,6 +21,7 @@ #include #include +#include "imagehelper.h" #include "objectfile.h" BOOL BindImageEx( Index: objectfile.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/objectfile.cc,v retrieving revision 1.6 diff -u -r1.6 objectfile.cc --- objectfile.cc 2 Jan 2003 17:05:14 - 1.6 +++ objectfile.cc 2 Jan 2003 18:35:59 - @@ -18,8 +18,9 @@ * $Id: objectfile.cc,v 1.6 2003/01/02 17:05:14 habacker Exp $ */ -#include #include +#include +#include #include #include "objectfile.h" @@ -78,7 +79,7 @@ strcat(name,"/"); strcat(name,basename); if (debug) -printf("%s: name: %
RE: Integrating Ralf's rebase into setup.exe
> Not really -- it doesn't compile anymore. Among other things: You have gotten me just between finishing the things. I was interrupted a little after written the last mail, so 10 minutes later is was mostly fixed. > 0) Update the changelog when you do stuff. (You renamed the library > itself, and that doesn't rate a mention in the ChangeLog?) > fixed > 1) you need to 'cvs add imagehelper.h' > (and 'rm imagehlp.h && cvs remove imagehlp.h') > This is the biggie -- all of the .cc files now look for > imagehelper.h -- but it isn't in CVS. > fixed > 2) you probably should also > rm imagehlpdebug.cc && cvs remove imagehlpdebug.cc > since you're actually using the nearly identical 'debug.cc' file > instead. > fixed > 3) Makefile rule for REBASE_FILES should be changed back to > REBASE_FILES=rebase_main.o version.o $(LIB_TARGET_FILE) > fixed > 4) You probably should use "ar cru" to create your static library, "ar > qf" will flake unless you ranlib it each time. > > 5) is the 'bindimage.cc' file used at all? > it is used in rebind_main.cc. Ralf
Re: Integrating Ralf's rebase into setup.exe
Ralf Habacker wrote: Thats orthogonal (but IIRC is possible now/soon). The build within setup.exe will be a .a library, not a .dll. You could always use a compile flag to choose between cout error reporting and exceptions. What about the following: Step 1: library for standalone rebase Step 1 is already in already supported. Not really -- it doesn't compile anymore. Among other things: 0) Update the changelog when you do stuff. (You renamed the library itself, and that doesn't rate a mention in the ChangeLog?) 1) you need to 'cvs add imagehelper.h' (and 'rm imagehlp.h && cvs remove imagehlp.h') This is the biggie -- all of the .cc files now look for imagehelper.h -- but it isn't in CVS. 2) you probably should also rm imagehlpdebug.cc && cvs remove imagehlpdebug.cc since you're actually using the nearly identical 'debug.cc' file instead. 3) Makefile rule for REBASE_FILES should be changed back to REBASE_FILES=rebase_main.o version.o $(LIB_TARGET_FILE) 4) You probably should use "ar cru" to create your static library, "ar qf" will flake unless you ranlib it each time. 5) is the 'bindimage.cc' file used at all? 6) I've got more, but they depend on the above things, which aren't really patches... --Chuck
RE: Integrating Ralf's rebase into setup.exe
> IIRC, it is not part of Mingw. > > I just used a copy of getopt.[ch] from the Cygwin sources for my stand > alone rebase. > That curious: getopt is compiled into /usr/lib/mingw/libliberty.a; only the header is missing. I've copied the header from /usr/include/getopt.h to /usr/include/mingw and it works. Now it seme to works. I have checked in the recent version in the cvs. Ralf
Re: Integrating Ralf's rebase into setup.exe
Ralf, On Thu, Jan 02, 2003 at 05:00:52PM +0100, Ralf Habacker wrote: > What about getopt, ... IIRC, it is not part of Mingw. I just used a copy of getopt.[ch] from the Cygwin sources for my stand alone rebase. 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
RE: Integrating Ralf's rebase into setup.exe
> But, they are part of Cygwin gcc in Mingw mode (i.e., gcc -mno-cygwin). > You're right. My gcc installation was corrupted. Now I can compile it. What about getopt, I can find the symbol in a library, but not the related header. ? I have installed mingw-runtime 2.2.1. Ralf
Re: Integrating Ralf's rebase into setup.exe
On Thu, Jan 02, 2003 at 04:23:08PM +0100, Ralf Habacker wrote: >> My stand alone rebase is currently a Mingw app. However, it was >> initially a Cygwin app but I switched in over to Mingw when Chuck >> pointed out that imagehlp.dll is dependent on msvcrt.dll. >> >> Now that I will be using your rebase functionality instead, I have the >> option to switch back to Cygwin. For various reasons, I was intending >> on keeping my stand alone rebase a Mingw app. What do others think? >> >Hm, what about mingw and the stdlib++ library ? This library seems not to be >part of the regular mingw package. libstdc++.a is part of the gcc-mingw package. cgf
Re: Integrating Ralf's rebase into setup.exe
Ralf, On Thu, Jan 02, 2003 at 04:23:08PM +0100, Ralf Habacker wrote: > > Now that I will be using your rebase functionality instead, I have > > the option to switch back to Cygwin. For various reasons, I was > > intending on keeping my stand alone rebase a Mingw app. What do > > others think? > > > Hm, what about mingw and the stdlib++ library ? This library seems not > to be part of the regular mingw package. But, they are part of Cygwin gcc in Mingw mode (i.e., gcc -mno-cygwin). 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
RE: Integrating Ralf's rebase into setup.exe
> My stand alone rebase is currently a Mingw app. However, it was > initially a Cygwin app but I switched in over to Mingw when Chuck > pointed out that imagehlp.dll is dependent on msvcrt.dll. > > Now that I will be using your rebase functionality instead, I have the > option to switch back to Cygwin. For various reasons, I was intending > on keeping my stand alone rebase a Mingw app. What do others think? > Hm, what about mingw and the stdlib++ library ? This library seems not to be part of the regular mingw package. Ralf
Re: Integrating Ralf's rebase into setup.exe
Ralf, On Thu, Jan 02, 2003 at 10:27:12AM +0100, Ralf Habacker wrote: > If I remember right, this lib will be used for a cygwin based rebase > and later in the cygwin's setup application which is mingw based. So > this lib must be buildable for cygwin and mingw, isn't it ? My stand alone rebase is currently a Mingw app. However, it was initially a Cygwin app but I switched in over to Mingw when Chuck pointed out that imagehlp.dll is dependent on msvcrt.dll. Now that I will be using your rebase functionality instead, I have the option to switch back to Cygwin. For various reasons, I was intending on keeping my stand alone rebase a Mingw app. What do others think? Thanks, 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
RE: Integrating Ralf's rebase into setup.exe
On Thu, 2003-01-02 at 20:50, Ralf Habacker wrote: > You have already stated > > - libcygimagehlp (for cygwin applications like rebase) > > Do you mean > > - libmingwimagehlp > > for setup.exe ? I really don't care, as long as it doesn't comflict with the real imagehlp library. > What about the header ? It could be the same in both variants. Symbolic linking > ? Likewise. Rob -- --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. --- signature.asc Description: This is a digitally signed message part
RE: Integrating Ralf's rebase into setup.exe
> > If I remember right, this lib will be used for a cygwin based > rebase and later > > in the cygwin's setup application which is mingw based. So this lib must be > > buildable for cygwin and mingw, isn't it ? > > Yes. And the library should use the appropriate naming convention for > the target platform. > I *don't* think it should be named libimagehlp.a, > because it's *not* a 100% replacement for libimagehlp. You have already stated - libcygimagehlp (for cygwin applications like rebase) Do you mean - libmingwimagehlp for setup.exe ? What about the header ? It could be the same in both variants. Symbolic linking ? cygimagehlp.h mingwimagehlp.h -> cygimagehlp.h I think that's bad. The bfd library is named libbfd.xx on every platform, so this library should be named in another way. What about imagehelper.a and imagehelper.h and using autoconf stuff ? Ralf
RE: Integrating Ralf's rebase into setup.exe
On Thu, 2003-01-02 at 20:31, Ralf Habacker wrote: > > Thats orthogonal (but IIRC is possible now/soon). The build within > > setup.exe will be a .a library, not a .dll. You could always use a > > compile flag to choose between cout error reporting and exceptions. > > > What about the following: > > Step 1: library for standalone rebase > > Every exported library function sets an error with SetLastError() and returns a > false condition, so a user could inspect this with GetLastError(). > If the library must be debugged set SetImageHlpDebug(1) to enable debug message > printing. Sure. Reporting errors via SetLastError() is fine, its just saw the cout << stuff in the patch, thus my comment. Rob -- --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. --- signature.asc Description: This is a digitally signed message part
RE: Integrating Ralf's rebase into setup.exe
On Thu, 2003-01-02 at 20:27, Ralf Habacker wrote: > > Rob suggested libcygimagehlp.a for the library. > > > > Should we leave the names as is, but use -L and -I to find the right > > files instead? > > > If I remember right, this lib will be used for a cygwin based rebase and later > in the cygwin's setup application which is mingw based. So this lib must be > buildable for cygwin and mingw, isn't it ? Yes. And the library should use the appropriate naming convention for the target platform. I *don't* think it should be named libimagehlp.a, because it's *not* a 100% replacement for libimagehlp. Rob -- --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. --- signature.asc Description: This is a digitally signed message part
RE: Integrating Ralf's rebase into setup.exe
> Thats orthogonal (but IIRC is possible now/soon). The build within > setup.exe will be a .a library, not a .dll. You could always use a > compile flag to choose between cout error reporting and exceptions. > What about the following: Step 1: library for standalone rebase Every exported library function sets an error with SetLastError() and returns a false condition, so a user could inspect this with GetLastError(). If the library must be debugged set SetImageHlpDebug(1) to enable debug message printing. Step 2: library in setup.exe add exception handling enabled by a -D option. Step 1 is already in already supported. Ralf
RE: Integrating Ralf's rebase into setup.exe
> Rob suggested libcygimagehlp.a for the library. > > Should we leave the names as is, but use -L and -I to find the right > files instead? > If I remember right, this lib will be used for a cygwin based rebase and later in the cygwin's setup application which is mingw based. So this lib must be buildable for cygwin and mingw, isn't it ? Additional I assume a standalone mingw based rebase would be also nice for the mingw people. Any comments ? Ralf
RE: Integrating Ralf's rebase into setup.exe
> Still missing a lot of the errors that were fixed in my patch. Here's > the remainder: > > 1) 'hex' and 'endl' are also in the std:: namespace > 2) unbind_main.cc needs 'using namespace std;' > 3) (new) rebind_main will rebind the first commandline argument over and > over; it needs to use argv[i] not argv[1] > 4) fiximage.cc and rebaseimage.cc seem not have gotten any of the std:: > fixes. > > errmmm...why not inspect the patch below for correctness, and then apply > & commit, rather than implementing all of the fixes by hand, which > invariably will skip/miss some? > Chuck, thanks for this patch. I have applied it. Regards Ralf
RE: Integrating Ralf's rebase into setup.exe
On Wed, 2003-01-01 at 22:35, Ralf Habacker wrote: > > And heres a show stopper. The library should not use cout at all. It > > should throw an exception, and let the user interface handle it. > > > Does this work also, if this library is compiled as a dll ? Thats orthogonal (but IIRC is possible now/soon). The build within setup.exe will be a .a library, not a .dll. You could always use a compile flag to choose between cout error reporting and exceptions. Rob -- --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. --- signature.asc Description: This is a digitally signed message part
RE: Integrating Ralf's rebase into setup.exe
> And heres a show stopper. The library should not use cout at all. It > should throw an exception, and let the user interface handle it. > Does this work also, if this library is compiled as a dll ? Do you have an example, how to do for this ? Ralf
RE: Integrating Ralf's rebase into setup.exe
> In checkimage.cc: > > - ctFile dll(filename); > + LinkedObjectFile dll(filename); > fixed. > >>README needs a brief note about this 0.6 version. > > > > > > More than I have written in my last email ? > > No, it's just that the README file itself contains some brief > descriptions of version 0.1 -- 0.5, but not 0.6. I thought it odd that > 0.6 was missing. > fixed. > > Created with cvs2cl and added to the cvs. > > Interesting tool -- I'd never heard of it before. See http://www.red-bean.com/cvs2cl/ If you check in all changed files with a single cvs call and same message, it will be gathered in a single change log entry. Ralf
Re: Integrating Ralf's rebase into setup.exe
On Wed, 2003-01-01 at 02:17, Charles Wilson wrote: > I needed to make the following changes before this would compile. > Mostly namespace errors, but also a typo and main() void vs. int. > > I figured the library files should explicitly call std::cout & friends, > but the executables could go ahead and say 'using namespace std;'. > > Oh, a few other niggles: why does Makefile have DOS line-endings, but > all the other files have UNIX line-endings? README needs a brief note > about this 0.6 version. And shouldn't there be a ChangeLog? And heres a show stopper. The library should not use cout at all. It should throw an exception, and let the user interface handle it. Rob -- --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. --- signature.asc Description: This is a digitally signed message part
Re: Integrating Ralf's rebase into setup.exe
Still missing a lot of the errors that were fixed in my patch. Here's the remainder: 1) 'hex' and 'endl' are also in the std:: namespace 2) unbind_main.cc needs 'using namespace std;' 3) (new) rebind_main will rebind the first commandline argument over and over; it needs to use argv[i] not argv[1] 4) fiximage.cc and rebaseimage.cc seem not have gotten any of the std:: fixes. errmmm...why not inspect the patch below for correctness, and then apply & commit, rather than implementing all of the fixes by hand, which invariably will skip/miss some? --Chuck Index: checkimage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/checkimage.cc,v retrieving revision 1.5 diff -u -r1.5 checkimage.cc --- checkimage.cc 31 Dec 2002 18:33:14 - 1.5 +++ checkimage.cc 31 Dec 2002 18:54:05 - @@ -32,7 +32,7 @@ if (!dll.isLoaded()) { if (Base::debug) -std::cout << "error: could not open file" << endl; +std::cout << "error: could not open file" << std::endl; SetLastError(ERROR_FILE_NOT_FOUND); return false; } @@ -40,7 +40,7 @@ if (!dll.checkRelocations()) { if (Base::debug) -std::cout << "dll relocation errors - please fix the errors at first" << endl; +std::cout << "dll relocation errors - please fix the errors at first" << +std::endl; SetLastError(ERROR_INVALID_DATA); return false; } Index: fiximage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/fiximage.cc,v retrieving revision 1.3 diff -u -r1.3 fiximage.cc --- fiximage.cc 31 Dec 2002 12:56:48 - 1.3 +++ fiximage.cc 31 Dec 2002 18:54:05 - @@ -29,12 +29,12 @@ LinkedObjectFile dll(filename,true); if (Base::debug) -cout << filename << ": " << endl; +std::cout << filename << ": " << std::endl; if (!dll.isLoaded()) { if (Base::debug) -cout << "error: could not open file" << endl; +std::cout << "error: could not open file" << std::endl; SetLastError(ERROR_FILE_NOT_FOUND); return false; } @@ -42,7 +42,7 @@ if (!dll.fixRelocations()) { if (Base::debug) -cout << "error: could not fix relocation problems" << endl; +std::cout << "error: could not fix relocation problems" << std::endl; SetLastError(ERROR_INVALID_DATA); return false; } Index: getimageinfos.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/getimageinfos.cc,v retrieving revision 1.4 diff -u -r1.4 getimageinfos.cc --- getimageinfos.cc31 Dec 2002 18:33:14 - 1.4 +++ getimageinfos.cc31 Dec 2002 18:54:06 - @@ -34,7 +34,7 @@ if (!dll.isLoaded()) { if (Base::debug) -std::cout << "error: could not open file" << endl; +std::cout << "error: could not open file" << std::endl; SetLastError(ERROR_FILE_NOT_FOUND); return false; } @@ -43,7 +43,7 @@ *ImageSize = dll.getNTHeader()->OptionalHeader.SizeOfImage; if (Base::debug) -std::cout << "ImageBase: 0x" << hex << *ImageBase << " ImageSize: 0x" << *ImageSize << endl; +std::cout << "ImageBase: 0x" << std::hex << *ImageBase << " ImageSize: 0x" << +*ImageSize << std::endl; SetLastError(NO_ERROR); return true; Index: rebaseimage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/rebaseimage.cc,v retrieving revision 1.2 diff -u -r1.2 rebaseimage.cc --- rebaseimage.cc 31 Dec 2002 12:56:48 - 1.2 +++ rebaseimage.cc 31 Dec 2002 18:54:07 - @@ -54,7 +54,7 @@ if (!dll.checkRelocations()) { if (Base::debug) -cout << "error: dll relocation errors - please fix the errors at first" << endl; +std::cout << "error: dll relocation errors - please fix the errors at first" +<< std::endl; SetLastError(ERROR_INVALID_DATA); return false; } @@ -84,7 +84,7 @@ if (ntheader->OptionalHeader.ImageBase == *NewImageBase) { if (Base::debug) -cout << "dll is already rebased" << endl; +std::cout << "dll is already rebased" << std::endl; SetLastError(NO_ERROR); return true; } @@ -97,7 +97,7 @@ if (!dll.performRelocation(difference)) { if (Base::debug) -cout << "error: could not rebase image" << endl; +std::cout << "error: could not rebase image" << std::endl; SetLastError(ERROR_BAD_FORMAT); return false; } Index: rebind_main.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/rebind_main.cc,v retrieving revision 1.3 diff -u -r1.3 rebind_main.cc --- rebind_main.cc 31 Dec 2002 18:33:14 - 1.3 +++ rebind_main.cc 31 Dec 2002 18:54:08 - @@ -61,7 +61,7 @@ char *a =
Re: Integrating Ralf's rebase into setup.exe
Ralf Habacker wrote: I needed to make the following changes before this would compile. Mostly namespace errors, the std:: below or something else ? Nope, that was it. but also a typo where ? In checkimage.cc: - ctFile dll(filename); + LinkedObjectFile dll(filename); README needs a brief note about this 0.6 version. More than I have written in my last email ? No, it's just that the README file itself contains some brief descriptions of version 0.1 -- 0.5, but not 0.6. I thought it odd that 0.6 was missing. Created with cvs2cl and added to the cvs. Interesting tool -- I'd never heard of it before. --Chuck
RE: Integrating Ralf's rebase into setup.exe
> I needed to make the following changes before this would compile. > Mostly namespace errors, the std:: below or something else ? > but also a typo where ? > and main() void vs. int. fixed > I figured the library files should explicitly call std::cout & friends, fixed > but the executables could go ahead and say 'using namespace std;'. > > Oh, a few other niggles: why does Makefile have DOS line-endings fixed > README needs a brief note about this 0.6 version. More than I have written in my last email ? >And shouldn't there be a ChangeLog? Created with cvs2cl and added to the cvs. Ralf
Re: Integrating Ralf's rebase into setup.exe
On Tue, Dec 31, 2002 at 06:41:45PM +0100, Ralf Habacker wrote: > > However, should we use the names libimagehlp.a and imagehlp.h? They > > clash with the mingw versions. > > > Do you have a better name ? Rob suggested libcygimagehlp.a for the library. Should we leave the names as is, but use -L and -I to find the right files instead? 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
RE: Integrating Ralf's rebase into setup.exe
> However, should we use the names libimagehlp.a and imagehlp.h? They > clash with the mingw versions. > Do you have a better name ? Ralf
Re: Integrating Ralf's rebase into setup.exe
I needed to make the following changes before this would compile. Mostly namespace errors, but also a typo and main() void vs. int. I figured the library files should explicitly call std::cout & friends, but the executables could go ahead and say 'using namespace std;'. Oh, a few other niggles: why does Makefile have DOS line-endings, but all the other files have UNIX line-endings? README needs a brief note about this 0.6 version. And shouldn't there be a ChangeLog? --Chuck Index: checkimage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/checkimage.cc,v retrieving revision 1.3 diff -u -r1.3 checkimage.cc --- checkimage.cc 31 Dec 2002 12:56:48 - 1.3 +++ checkimage.cc 31 Dec 2002 15:14:42 - @@ -27,12 +27,12 @@ BOOL CheckImage(LPSTR filename) { - ctFile dll(filename); + LinkedObjectFile dll(filename); if (!dll.isLoaded()) { if (Base::debug) -cout << "error: could not open file" << endl; +std::cout << "error: could not open file" << std::endl; SetLastError(ERROR_FILE_NOT_FOUND); return false; } @@ -40,7 +40,7 @@ if (!dll.checkRelocations()) { if (Base::debug) -cout << "dll relocation errors - please fix the errors at first" << endl; +std::cout << "dll relocation errors - please fix the errors at first" << +std::endl; SetLastError(ERROR_INVALID_DATA); return false; } Index: fiximage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/fiximage.cc,v retrieving revision 1.3 diff -u -r1.3 fiximage.cc --- fiximage.cc 31 Dec 2002 12:56:48 - 1.3 +++ fiximage.cc 31 Dec 2002 15:14:42 - @@ -29,12 +29,12 @@ LinkedObjectFile dll(filename,true); if (Base::debug) -cout << filename << ": " << endl; +std::cout << filename << ": " << std::endl; if (!dll.isLoaded()) { if (Base::debug) -cout << "error: could not open file" << endl; +std::cout << "error: could not open file" << std::endl; SetLastError(ERROR_FILE_NOT_FOUND); return false; } @@ -42,7 +42,7 @@ if (!dll.fixRelocations()) { if (Base::debug) -cout << "error: could not fix relocation problems" << endl; +std::cout << "error: could not fix relocation problems" << std::endl; SetLastError(ERROR_INVALID_DATA); return false; } Index: getimageinfos.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/getimageinfos.cc,v retrieving revision 1.3 diff -u -r1.3 getimageinfos.cc --- getimageinfos.cc31 Dec 2002 12:56:48 - 1.3 +++ getimageinfos.cc31 Dec 2002 15:14:42 - @@ -34,7 +34,7 @@ if (!dll.isLoaded()) { if (Base::debug) -cout << "error: could not open file" << endl; +std::cout << "error: could not open file" << std::endl; SetLastError(ERROR_FILE_NOT_FOUND); return false; } @@ -43,7 +43,7 @@ *ImageSize = dll.getNTHeader()->OptionalHeader.SizeOfImage; if (Base::debug) -cout << "ImageBase: 0x" << hex << *ImageBase << " ImageSize: 0x" << *ImageSize << endl; +std::cout << "ImageBase: 0x" << std::hex << *ImageBase << " ImageSize: 0x" << +*ImageSize << std::endl; SetLastError(NO_ERROR); return true; Index: rebase_main.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/rebase_main.cc,v retrieving revision 1.1 diff -u -r1.1 rebase_main.cc --- rebase_main.cc 31 Dec 2002 11:08:08 - 1.1 +++ rebase_main.cc 31 Dec 2002 15:14:44 - @@ -48,7 +48,7 @@ int theListFlag = 0; -void +int main(int argc, char* argv[]) { ParseArgs(argc, argv); Index: rebaseimage.cc === RCS file: /cvsroot/kde-cygwin/tools/rebase/rebaseimage.cc,v retrieving revision 1.2 diff -u -r1.2 rebaseimage.cc --- rebaseimage.cc 31 Dec 2002 12:56:48 - 1.2 +++ rebaseimage.cc 31 Dec 2002 15:14:44 - @@ -54,7 +54,7 @@ if (!dll.checkRelocations()) { if (Base::debug) -cout << "error: dll relocation errors - please fix the errors at first" << endl; +std::cout << "error: dll relocation errors - please fix the errors at first" +<< std::endl; SetLastError(ERROR_INVALID_DATA); return false; } @@ -84,7 +84,7 @@ if (ntheader->OptionalHeader.ImageBase == *NewImageBase) { if (Base::debug) -cout << "dll is already rebased" << endl; +std::cout << "dll is already rebased" << std::endl; SetLastError(NO_ERROR); return true; } @@ -97,7 +97,7 @@ if (!dll.performRelocation(difference)) { if (Base::debug) -cout << "error: could not rebase image" << endl; +std::cout << "error: could not rebase image"
Re: Integrating Ralf's rebase into setup.exe
Ralf, On Tue, Dec 31, 2002 at 02:20:36PM +0100, Ralf Habacker wrote: > - creates a static lib containing all needed objectfiles for > RebaseImage() and friends. The library is named libimagehlp.a and the > relating include file imagehlp.h. After checking out just call > > $ make imagehlp > > and the lib is created. > > - the debug message printing is conditionalized with an internal debug > flag, so by default the code does not print any debug messages. Thanks for the above! Sometimes it pays to procrastinate. :,) However, should we use the names libimagehlp.a and imagehlp.h? They clash with the mingw versions. 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
Re: Integrating Ralf's rebase into setup.exe
Hi all, relating to the this thread, which starts at http://www.cygwin.com/ml/cygwin-apps/2002-12/msg00021.html I have updated the rebase source with : - creates a static lib containing all needed objectfiles for RebaseImage() and friends. The library is named libimagehlp.a and the relating include file imagehlp.h. After checking out just call $ make imagehlp and the lib is created. - the debug message printing is conditionalized with an internal debug flag, so by default the code does not print any debug messages. Regards Ralf
Re: Integrating Ralf's rebase into setup.exe
Rob, On Thu, Dec 05, 2002 at 06:18:56PM +1100, Robert Collins wrote: > On Thu, 2002-12-05 at 07:59, Jason Tishler wrote: > As for design, here's what I'd like to see: > Ralfs reimplementation sites in a lib - i.e. libcygimagehlp.a - and > you and I carry on the design discussion with no change. Is that > possible? Yes. > If so, then frankly, I don't care what Ralf's code looks like. Good. I was hoping that being dependent on Ralf's code did not generate significantly more work for me. > Just like I don't care what the bzip2lib internals are like when the > interface is good and clear. The current interface of the proposed library is as follows: BOOL GetImageInfos(char *filename, uint *ImageBase, uint *ImageSize); BOOL CheckImage(char *filename); BOOL FixImage(char *filename); BOOL ReBaseImage( PSTR CurrentImageName, PSTR SymbolPath, // ignored BOOL fReBase, BOOL fRebaseSysfileOk,// ignored BOOL fGoingDown, // ignored ULONG CheckImageSize, // ignored ULONG *OldImageSize, ULONG *OldImageBase, ULONG *NewImageSize, ULONG *NewImageBase, ULONG TimeStamp ); I'm only interested in ReBaseImage() which I have verified to be a drop in replacement for the MS version. Is the above interface acceptable? > It means that > a) we can switch between the implementations trivially if we need to > in the future. > b) I don't need to think :}. Agreed. > Your integration path simply continues (where are we at? ;}). My progress has been slow and not steady. Sigh... My plan is to release ASAP a stand-alone rebase based on Ralf's rebase and relocation fix-up functionality and a new "-T" option (like tar's). In this way, that Apache, Perl, Python, etc. users on all platforms (including Me) can easily rebase there entire system with the following batch file snippet: gzip -d -c /etc/setup/*.lst.gz | grep "dll$" | grep -v cygwin1.dll | sed "s/^/\//" | xargs -n 1 cygpath -wa >rebase.lst rebase -d -b 0x6800 -o 0x1 -T rebase.lst del rebase.lst > For the library, while code internals won't be my problem per se :}, > it does need to: > a) Cross compile (linux->win32, cygwin->win32) I have verified the latter. I'm not set up for the former -- it would be nice is someone who is could help me do so. > b) standard compile (cygwin->cygwin). I have verified this one too. > c) be autoconfiscated to support the above 2 with maximum ease. I will probably need help with the above or at least some pointers. Thanks, 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
Re: Integrating Ralf's rebase into setup.exe
On Thu, 2002-12-05 at 07:59, Jason Tishler wrote: > However, I'm concerned that you will not accept his code into setup.exe > for various reasons (e.g., formatting, design, etc). Please peruse his > code at: Well, formatting is trivial isn't it :}. As for design, here's what I'd like to see: Ralfs reimplementation sites in a lib - i.e. libcygimagehlp.a - and you and I carry on the design discussion with no change. Is that possible? If so, then frankly, I don't care what Ralf's code looks like. Just like I don't care what the bzip2lib internals are like when the interface is good and clear. It means that a) we can switch between the implementations trivially if we need to in the future. b) I don't need to think :}. > Is a simple indent sufficient? If not, what is required for acceptance? Your integration path simply continues (where are we at? ;}). For the library, while code internals won't be my problem per se :}, it does need to: a) Cross compile (linux->win32, cygwin->win32) b) standard compile (cygwin->cygwin). c) be autoconfiscated to support the above 2 with maximum ease. Rob -- --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. --- signature.asc Description: This is a digitally signed message part