From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: detecting dpmi Date: Sun, 20 Apr 1997 08:44:57 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 34 Message-ID: <3359D789.3623@NO.SPAM.cs.com> References: <5je6kq$ff9$1 AT thor DOT atcon DOT com> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp202.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk SteelGolem wrote: > > i want to write apps that will run in both win95 and dos, how do i > detect whether there is a dpmi already being used? can you detect > win95's, or whether there already is a dpmi working? email, please.. You're operating under a common misimpression - that you need to be involved in some way in your program's use of DPMI. With DJGPP programs, this is not the case. DJGPP programs use DPMI completely transparently, via a 2k 16-bit stub program that is automatically attached to every executable. This stub detects whether DPMI exists in the current environment. If so, it uses whatever DPMI host is present. If not, it attempts to load the 'cwsdpmi.exe' DPMI host that accompanies the DJGPP distribution. What this means is that DJGPP programs will work under MS-DOS, Windows 3.1, Windows 95, Windows/NT, OS/2 Warp, Linux, and nearly every other PC operating system without you needing to do a thing. When distributing DJGPP-compiled programs, you should always include a copy of cwsdpmi.exe, in case your users run them under plain DOS. If you are really interested in looking into the mechanics of detecting DPMI, then you should get the DJGPP library sources from SimTel ('v2/djlsr201.zip'), and examine the source code for the stub loader in 'src/stub/stub.asm'. Hope this helps! -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | Descent 2: The Infinite Abyss - The greatest Internet game of all | | time just got better! This time, you're going all the way down...| ---------------------------------------------------------------------