⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exterr.c

📁 由3926个源代码
💻 C
字号:
/* EXTERR.C - extended error saving and restoring */

#include <stdlib.h>
#include <dos.h>

#define GET_EXTERR     0x59
#define SET_EXTERR     0x5d0a

#pragma pack(1)

struct   ExtErr
{
   unsigned int errax;
   unsigned int errbx;
   unsigned int errcx;
};

void  GetExtErr(struct ExtErr * ErrInfo);
void  SetExtErr(struct ExtErr * ErrInfo);

/*****
Function: GetExtErr
get extended error information
*****/
void GetExtErr(struct ExtErr * ErrInfo)
{ 
   union  REGS regs;

   if (_osmajor >= 3)   /* only for DOS 3 and above */
   {
      regs.h.ah = GET_EXTERR;
      regs.x.bx = 0;  /* must be zero */
      intdos(&regs,&regs);
      ErrInfo->errax = regs.x.ax;
      ErrInfo->errbx = regs.x.bx;
      ErrInfo->errcx = regs.x.cx;
   }
}

/*****
Function: SetExtErr
set extended error information
*****/
void SetExtErr(struct ExtErr near * ErrInfo)
{ 
   union  REGS regs;
   struct SREGS segregs;

   if (_osmajor >= 3)   /* only for DOS  3 and above */
   {
      regs.x.ax = SET_EXTERR;
      regs.x.bx = 0;       /* must be zero */
      segread(&segregs);   /* put address of err info in DS:DX */
      regs.x.dx = (int) ErrInfo;
      intdosx(&regs,&regs,&segregs);
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -