Subject: Weird NT problem
From: [email-masked] (Jonathan Lanier)

18 Apr 1997 14:42:35 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <Pine.SOL.3.91.970418094215.2495C-100000.cygnus.gnu-win32@westmain>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Original-To: Win32 Mailing List <[email-masked]>
Original-Sender: [email-masked]

I'm getting this really weird problem on NT.  I've posted about this 
before I think but I was slightly mistaken about the actual 
circumstances, so I thought I'd repost this problem, so that if any of 
this rings a bell with any of you, even if you can't help but you've seen 
this happen, please email me so that I know I'm not alone...

Basically, I've got this really big program (with symbols ~21MB) that 
links and runs under Win95 (well it kinda crashes but that's a different 
problem).  Attempts to debug under Win95 have proven fruitless, so I 
thought I'd give WinNT a try.  Well, the program compiles and links under 
NT as well, but the resulting executable won't run on NT.  But get this:  
It WILL run on Win95.  The NT error returned from CreateProcess() is 193, 
ERROR_BAD_EXE_FORMAT, and when trying to load the .exe from a command 
prompt, I get a dialog box that's telling me that it's not a valid 
Windows NT application.  I've got a few thoughts on why this might be 
happening, but I'm kind of ignorant about WinNT internals, and I've 
already searched the MicroSoft knowledge base and I can't find anything.  
I'm hoping someone out there (maybe from Cygnus?) can shed some light on 
this for me.  I'd really like to know what constitutes a 'valid Windows 
NT executable'.

1) I've noticed that all the executables that I link with GCC are marked 
as 'fixed'.  Could it be that the size of this executable is causing NT 
not to be able to load it, because the fixed addresses are conflicting in 
some way with NT?  I know NT's memory layout is completely different from 
Win95.  None of the executables I build with MS VC++ are marked as 
'fixed', and I'm not setting any ld flags to make the GNU executables  
'fixed'.  I tried using switches to enable PIC but it didn't seem to make 
any difference.  If I could build a relocatable version of my .exe file, 
would that solve the problem, and if so how would I do that?

2) If one of the components were missing, would this error occur?  I 
already checked all the import DLLs needed to run the app, and they are 
all there, either in the \winnt\system32 directory, or in the 
path.  I don't THINK anything is missing because the imports match 
exactly the ones needed to run a MS VC++ built version of the same .exe, 
and IT runs just fine.  And I'm using mingw32, so I don't need 
cygwin.dll, and crtdll.dll is installed on my system.

3) Are there any arbitrary limits on the size of the executable image, 
either for NT or for the GNU linker, that could be causing a problem?  It 
is a 21MB executable (with symbol info) so it's pretty darn big.

4) I can build, link, and run a 'hello-world' applet using my exact same 
configuration, and it links and runs just fine on both Win95 and WinNT.

Please, any help would be greatly appreciated.

- Jonathan Lanier
  [email-masked]

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".