From: Eric K. <ek...@rz...> - 2002-07-23 11:51:18
|
Hi! I just found out why application compiled with MSVC++ don't run on ReactOS. These apps have a slighly different layout compared to apps compiled with MinGW. MSVC++ stores the IAT (Import Address Table) inside of the .rdata section, MinGW stores the IAT inside of the .data section. Now the problem is that the .rdata setion is read-only. To fix-up the IAT of an application the offsets stored in the IAT must be overwritten by the real import addresses. Obviously this wont work if the IAT is inside of a read-only section. To fix this bug I added calls to NtProtectVirtualMemory() to the fixup routine to change the IAT's protection to read-write before it is modified and reset its protection after the fixup is done. When I had a look at NtProtectVirtualMemory() I saw that its core functionality is disabled. What's wrong? Regards, Eric Eric |
From: Steven E. <ste...@ya...> - 2002-07-23 22:21:20
|
This rocks dude. If you want me to help with testing/debugging this I will reinstall MS_VC and compile some simple applications once you figure out more of whats going on. Thanks Steven > I just found out why application compiled with MSVC++ don't run on ReactOS. > These apps have a slighly different layout compared to apps compiled with > MinGW. MSVC++ stores the IAT (Import Address Table) inside of the .rdata > section, MinGW stores the IAT inside of the .data section. Now the problem > is that the .rdata setion is read-only. To fix-up the IAT of an application > the offsets stored in the IAT must be overwritten by the real import > addresses. Obviously this wont work if the IAT is inside of a read-only > section. > > To fix this bug I added calls to NtProtectVirtualMemory() to the fixup > routine to change the IAT's protection to read-write before it is modified > and reset its protection after the fixup is done. > > When I had a look at NtProtectVirtualMemory() I saw that its core > functionality is disabled. What's wrong? __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com |
From: Robert K. <ro...@ko...> - 2002-07-24 13:39:11
|
Congratulations. Let's hope this is the only thing that has to be fixed in order to run MSVC compilend pgms. It's at least an impotand step. Whose mistake is it ? MSVC, Mingw, NT or ROS? Eric Kohl schrieb: >Hi! > >I just found out why application compiled with MSVC++ don't run on ReactOS. > >These apps have a slighly different layout compared to apps compiled with >MinGW. MSVC++ stores the IAT (Import Address Table) inside of the .rdata >section, MinGW stores the IAT inside of the .data section. Now the problem >is that the .rdata setion is read-only. To fix-up the IAT of an application >the offsets stored in the IAT must be overwritten by the real import >addresses. Obviously this wont work if the IAT is inside of a read-only >section. > >To fix this bug I added calls to NtProtectVirtualMemory() to the fixup >routine to change the IAT's protection to read-write before it is modified >and reset its protection after the fixup is done. > >When I had a look at NtProtectVirtualMemory() I saw that its core >functionality is disabled. What's wrong? > > >Regards, >Eric > >Eric > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >reactos-kernel mailing list >rea...@li... >https://lists.sourceforge.net/lists/listinfo/reactos-kernel > > |
From: Eric K. <ek...@rz...> - 2002-07-24 15:01:45
|
"Robert K." <ro...@ko...> wrote: > Congratulations. Let's hope this is the only thing that has to be fixed > in order to run > MSVC compilend pgms. It's at least an impotand step. No, it seems there are more bugs ahead! I changed the code in NtMapViewOfSection() to make all parts of a mapped image section writable. The simple 'hello world!' example crashed upon initialization. This is propably due to missing or buggy SEH-support. > Whose mistake is it ? MSVC, Mingw, NT or ROS? It is not a mistake! MSVC executables and MinGW executables have a slightly different layout. That's all. Of course, M$ could use this to get rid of 'evil, criminal, cancerous <insert more buzzwords here> open source applications' by adding some checks to the loader. Eric |