delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/09/13/15:12:32

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Disposition-notification-to: bbelisle AT jpselectronique DOT com
Date: Tue, 13 Sep 2005 15:14:43 -0400
From: =?iso-8859-1?Q?Benjamin_B=E9lisle?= <bbelisle AT jpselectronique DOT com>
Subject: Help with Dos errors
To: djgpp AT delorie DOT com
Message-id: <001001c5b897$66288070$ae7ba8c0@JPS.local>
MIME-version: 1.0
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0)
Importance: Normal
X-Priority: 3 (Normal)
X-MSMail-priority: Normal
Reply-To: djgpp AT delorie DOT com

Hello, first of all, I am not a computer programmer, I normally program
micro-processors.
So I don't have much knowledge with computer interrupts, registers, dos...

I want to create a file on a disk (A:) and detect any DOS errors.  This is
how it was done in 16bits with Borland:

#pragma warn -par

void handler(unsigned int ax, unsigned int not_used1, unsigned int
*not_used2) {
{

   unsigned di;

   di = _DI;
   TypeDosError = di & 0x00FF;
   DosError = 1;
   _hardresume(0); // A VERIFIER
}

#pragma warn +par

fonct()
{
	...
	_harderr(handler);
	...
}

But after porting my program into DJGPP, I tried the following (without
using interrupts) after trying to access A:

#include <errno.h>

extern int _doserrno;

if(_doserrno > 18 && _doserrno < 40)  // If disk error
{
	DosError = 1;
  	TypeDosError = _doserrno-19; // Used for printing an error message 0-21
}

This works fine when I try the program in a Windows XP Dos window, but there
is no error detected (when for example there is no disk) when I try the
program on a DOS Version 6.20 computer with the CWSDPMI host.

Note: I've also tried using:

struct DOSERROR de;

dosexterr(&de);

if(de.exterror > 18 && de.exterror < 40)
{
   DosError = 1;
   TypeDosError = de.exterror-19;
}

This also works fine with Windows but not on the dos machine.

Please help!

Thank you,
Ben  (bbelisle AT jpselectronique DOT com)


- Raw text -


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