www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/21/12:13:10

From: Serge Golovin <res AT marstu DOT mari DOT su>
Message-Id: <199702211648.TAA17579@marstu.mari.su>
Subject: Re: Win32 support for Djgpp
To: chambersb AT juno DOT com (Benjamin D Chambers)
Date: Fri, 21 Feb 1997 19:48:42 +0300 (MSK)
Cc: djgpp AT delorie DOT com (DJGPP Mailing List)
In-Reply-To: <19970221.063949.4935.2.chambersb@juno.com> from "Benjamin D Chambers" at "Feb 21, 97 09:36:57 am"
MIME-Version: 1.0

Benjamin D Chambers wrote:
> I've seen programs that, when run in DOS, run as a DOS app - but when run
> in Windows, run as a Windows app.  Based on this, I've made two
> assumptions:
> 1)	That a Windows program has some way to ID itself as a Windows
> app, and if Windows is not present it will simply execute some 'backup'
> function (usu. 'This program requires Microsoft Windows', though, as I've
> said, I've seen a program just run as a plain dos app when this happens).
> 2)	Once Windows has been detected, and the program has let Windows
> know it's a windows app, it is capable of using the Windows api.
> 
> Now, from this, it seems that to add Windows(32) support, all we'd need
> to do is figure out how to ID a program as a Windows app, and then how to
> make API calls.  Doing it this way, why would you have to rewrite
> anything?  Why not just use the Windows API as a superset to the DOS
> libc?
Hmm.. That makes me smile...
1st assumption is almost completely wrong.
Windows program contains two parts:
- The DOS stub
- Windows program itself
If program runs under Windows - windows loader sees that this is NE 
(new executable) or PE (portable executable), loads it and runs windows part
of the program. DOS stub is just ignored. When DOS runs this program it just
doesnt know about Windows part and loads DOS stub.
Program itself doesnt make any steps to detect windows at startup (well, 
only if this program specially programmed in that way)
2nd assumption is wrong because 1st is :-)
"to ID a program as a Windows app" means to learn our linker produce 
appropriate executables.. (not that simple problem as it may seem).
And what do you mean by "superset to the DOS libc" ?
Windows API functions are located inside of windows (USER32, KERNEL32, 
GDI32 etc) and linker just inserts a references to them in executable.
These references are expanded in runtime.
This all is most common explanation. There are lots of specific things,
as always.
-- 
SerGo, aka RES

- Raw text -


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