www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/05/31/10:13:55

Message-Id: <199905311413.OAA91950@out5.ibm.net>
From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com, Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Date: Mon, 31 May 1999 10:14:37 -0400
MIME-Version: 1.0
Subject: Re: enhancements to fcntl.c
X-mailer: Pegasus Mail for Win32 (v3.11)
Reply-To: djgpp-workers AT delorie DOT com

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, &regs);

  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, &regs);

  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 -


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