| delorie.com/archives/browse.cgi | search |
| To: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> |
| cc: | djgpp AT delorie DOT com, dan AT verity DOT ICS DOT UCI DOT EDU |
| Subject: | Re: novice errors? dpmi, info, groff, df |
| In-reply-to: | Your message of "Wed, 19 Mar 1997 12:29:28 +0300." |
| <Pine DOT SUN DOT 3 DOT 91 DOT 970319122722 DOT 19845B-100000 AT is> | |
| Date: | Wed, 19 Mar 1997 16:25:23 -0800 |
| From: | Dan Hirschberg <dan AT verity DOT ICS DOT UCI DOT EDU> |
| Message-ID: | <9703191625.aa02458@paris.ics.uci.edu> |
> ---------------------- statfs.c ----------------------------------
> /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
> #include <dpmi.h>
> __dpmi_regs regs;
> /* Get free space info */
> regs.h.ah = 0x36; /* DOS Get Free Disk Space call */
> regs.h.dl = drive_number + 1;
> __dpmi_int(0x21, ®s);
>
> /* Check for errors */
> if ((regs.x.ax & 0xffff) == 0xffff)
> {
> errno = ENODEV;
> return -1;
> }
>
> /* Fill in the structure */
> buf->f_bavail = regs.x.bx;
> buf->f_bfree = regs.x.bx;
> buf->f_blocks = regs.x.dx;
> buf->f_bsize = regs.x.cx * regs.x.ax;
> buf->f_ffree = regs.x.bx;
I note that regs.x.ax etc. are declared as unsigned short
and it is possible that there is an integer overflow.
Does regs.x.bx_hi have any meaning? It has value 11826.
Similarly, regs.x.ax_hi = 8224
regs.x.cx_hi = 30049
regs.x.dx_hi = 28524
dan
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |