From: "Charles Sandmann" Newsgroups: comp.os.msdos.djgpp Subject: Re: Protected mode???? Date: Thu, 19 Apr 2001 23: 1:23 Organization: Aspen Technology, Inc. Lines: 60 Message-ID: <3adf6e43.sandmann@clio.rice.edu> References: <3ADF9680 DOT 94240320 AT jps DOT net> NNTP-Posting-Host: dcloan.hou.aspentech.com X-Trace: selma.aspentech.com 987740069 9063 10.32.115.107 (20 Apr 2001 04:14:29 GMT) X-Complaints-To: postmaster AT aspentech DOT com NNTP-Posting-Date: 20 Apr 2001 04:14:29 GMT X-NewsEditor: ED-1.5.8 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > at 1 I found 3e8b0e7e > at 4 I found fcc0303e > at 10 I found 4ad089cb > at 40 I found c6000197 > at 100 I found 8dffffff > at 400 I found 6e697270 You are running under Windows or some other DPMI host and not under DOS with CWSDPMI, or the null page would generate errors. > but mostly I was surprised that I could > read AND WRITE at small addresses, and that > those addresses seemed to contain the actual > program that was running. That is, > DJGPP neither read protects nor write protects > the instructions of the running program. You cannot read or write protect memory under the DPMI API provided by Windows, without DPMI 1.0 support. Microsoft has never finished their DPMI support (it's only been 11 years after all, with new bugs to create). You can read and write protect memory under CWSDPMI which is the default DPMI provider under DOS. It also works with the latest versions of 386MAX, by the way. DJGPP uses this to catch all pointer references less than 0xfff (4095), which are by far the most frequent stray pointers. Low addresses are not used by DJGPP. If desired, you could make most of the "text" section to be read only, but you do have to allow for certain writable flags in the text section. > Has it always been this way? It's the best you can do under Windows. If you want better protection, debug under DOS. > Is there any way to change this? Write some VXDs to extend Windows to support DPMI 1.0, or use CWSDPMI under DOS. We have no control over what Windows supports out of the box. > I would prefer that the instructions of > my program be read and write protected. > It seems much safer to me. I'd prefer it too, but that's not always an option. I did feel strongly enough about null pages to program up some of the DPMI 1.0 features in CWSDPMI ... > Also, if this cannot be done, can the program > be put in some other address that is less likely > to be trashed by wild stores thru pointers containing > small numbers? We catch null page pointer errors when running under an appropriate DPMI.