Message-ID: <22ec01c331a0$4a9a2410$0600000a@broadpark.no> From: "Gisle Vanem" To: "djgpp" Subject: mprotect() under Windows Date: Fri, 13 Jun 2003 13:38:20 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Reply-To: djgpp AT delorie DOT com Is mprotect() (in djgpp 2.03) supposed to have any effect under Win-XP? I guess not since function 0x0507 is a DPMI 1.0 function. But I find that __dpmi_set_page_attributes() doesn't return -1. This small test program *doesn't* crash. Anybody see why? #include #include #include #include #include #define PAGESIZE 4096 #define ROUND_PAGE(p) (((unsigned long)(p) + (PAGESIZE-1)) & ~(PAGESIZE-1)) int main (void) { char *p = malloc (3*PAGESIZE); p = (char*) ROUND_PAGE(p); p += PAGESIZE; printf ("p = %08lX\n", (unsigned long)p); strcpy (p, "1234567890123456789"); __dpmi_error = 0; if (mprotect (p, PAGESIZE, PROT_NONE) != 0) puts ("mprotect() failed"); printf ("__dpmi_error %04X\n", __dpmi_error); printf ("%.10s", p); return (0); } -------------- The output is: p = 00025000 __dpmi_error 0000 1234567890 I'd expect a crash on the last printf() --gv