Mail Archives: djgpp-workers/1999/05/31/10:13:55
I've created a small program to see if the undocumented calls work. It
works fine under DOS and Win95, but may not under Win NT. I'd
appreciate it if someone could run this program under NT and post the
message it produces. Note: the executable opens the source file, so
make sure the source is in the same directory as the exe.
#include <dpmi.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/movedata.h>
#include <libc/dosio.h>
#include <go32.h>
unsigned char sft_entry[64];
static int get_sft_entry(int fd, char sft_entry[])
{
__dpmi_regs regs;
unsigned char index;
/* Get JFT entry address. */
regs.x.ax = 0x1220;
regs.x.bx = fd;
__dpmi_int (0x2f, ®s);
if (regs.x.flags & 1)
{
__doserr_to_errno(regs.x.ax);
return -1;
}
/* First byte is the SFT entry number. */
dosmemget(regs.x.es * 16 + regs.x.di, 1, &index);
/* Get the SFT entry for the handle. */
regs.x.ax = 0x1216;
regs.x.bx = index;
__dpmi_int (0x2f, ®s);
if (regs.x.flags & 1)
{
__doserr_to_errno(regs.x.ax);
return -2;
}
dosmemget(regs.x.es * 16 + regs.x.di, 63, sft_entry);
return 0;
}
int main()
{
int fd = open("sftcheck.c", O_RDWR);
int ret = get_sft_entry(fd, sft_entry);
if (ret < 0)
{
if (ret == -1)
printf("Call to get JFT entry (int 21 ax=1220) failed.\n");
else
printf("Call to get SFT entry (int 21 ax=1216) failed.\n");
}
else if ((sft_entry[2] & O_ACCMODE) != O_RDWR)
printf("Mode byte contains unexpected value.\n");
else
printf("Undocumented calls worked!\n");
close (fd);
return 0;
}
---
Mark Elbrecht, snowball3 AT bigfoot DOT com
http://snowball.frogspace.net/
- Raw text -