delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/14/18:25:42

From: locke AT mcs DOT net (Peter Johnson)
Newsgroups: comp.os.msdos.djgpp
Subject: DPMI bug test for Win2000
Message-ID: <MPG.12e9581fb41ce9149896e8@news-proxy.cso.uiuc.edu>
X-Newsreader: MicroPlanet Gravity v2.12
X-Proxy-Client: pljohnsn AT uiuc DOT edu from 207-229-150-156.d.enteract.com
Lines: 104
Date: Fri, 14 Jan 2000 15:59:08 -0600
NNTP-Posting-Host: 128.174.5.27
X-Complaints-To: abuse AT uiuc DOT edu
X-Trace: vixen.cso.uiuc.edu 947887114 128.174.5.27 (Fri, 14 Jan 2000 15:58:34 CST)
NNTP-Posting-Date: Fri, 14 Jan 2000 15:58:34 CST
Organization: University of Illinois at Urbana-Champaign
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Would people out there with Win2000 beta please compile and run the  
following program to see if it crashes?  It tests to see if the DPMI 
Real- Mode callback bug I discovered in NT 4.0 is present in 2000.

The code uses sbrk() to put the registers structure in question well over 
the 64K mark and installs a mouse callback.  In my testing it crashes in  
NT 4 and doesn't crash in Win98.  I want to find out if the bug still  
exists in Win2000, so please try it and post here whether it crashes or  
not.  Thanks!

Compile with "gcc -o testrmcb.exe testrmcb.c".

-- Cut Here - testrmcb.c --
/* RMCB test program for >64K regs structure compliance
   Based (somewhat) on Allegro's mouse routines */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dos.h>
#include <go32.h>
#include <dpmi.h>

volatile int test = 0;
static _go32_dpmi_seginfo dpmi_seginfo;

int install_mouse();
void remove_mouse();

int main()
{
        if(install_mouse())
        {
                printf("Can't find mouse driver!");
                return 1;
        }

        while(!kbhit())
        {
                if(test)
                {
                        printf("got one.\n");
                        test = 0;
                }
        }

        getch();
 
        remove_mouse();

	return 0;
}

void mouseint(_go32_dpmi_registers *r)
{
        test = 1;
}

int install_mouse()
{
   __dpmi_regs r;
   _go32_dpmi_registers *dpmi_regs;

   sbrk(1000000);
   dpmi_regs = sbrk(sizeof(_go32_dpmi_registers));

   r.x.ax = 0;
   __dpmi_int(0x33, &r);         /* initialise mouse driver */

   if (r.x.ax == 0) {
      return -1;
   }

   /* create real mode callback for the int33 driver */
   dpmi_seginfo.pm_offset = (int)mouseint;
   dpmi_seginfo.pm_selector = _my_cs();
   _go32_dpmi_allocate_real_mode_callback_retf(&dpmi_seginfo, dpmi_regs);

   r.x.ax = 0x0C;
   r.x.cx = 0x7F;
   r.x.dx = dpmi_seginfo.rm_offset;
   r.x.es = dpmi_seginfo.rm_segment;
   __dpmi_int(0x33, &r);            /* install callback */

   return 0;
}

void remove_mouse()
{
   __dpmi_regs r;

   r.x.ax = 0x0C;
   r.x.cx = 0;
   r.x.dx = 0;
   r.x.es = 0;
   __dpmi_int(0x33, &r);         /* install NULL callback */

   _go32_dpmi_free_real_mode_callback(&dpmi_seginfo);
}

-- 
Peter Johnson             locke AT mcs DOT net
:Windows: Where do you want to go today?
:Linux:   Where do you want to go tomorrow?
:FreeBSD: Are you guys coming or what?

- Raw text -


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