home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC1.ZIP / DOSEXT.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  1.7 KB  |  65 lines

  1. /*---------------------------------------------------------------------------
  2.  * filename - dosext.cas
  3.  *
  4.  * function(s)
  5.  *        dosexterr - gets extended error
  6.  *--------------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #pragma inline
  18. #include <asmrules.h>
  19. #include <dos.h>
  20.  
  21. /* DOS 3.0 only */
  22.  
  23. /*--------------------------------------------------------------------------*
  24.  
  25. Name            dosexterr - gets extended error
  26.  
  27. Usage           int dosexterr(struct DOSERR *eblkp);
  28.  
  29. Prototype in    dos.h
  30.  
  31. Description     this function fills the DOSERR structure pointed to by
  32.                 eblkp with extended error information after an MS-DOS
  33.                 call has failed.  The values obtained to fill the
  34.                 structure are obtained via DOS call 0x59.
  35.  
  36. Return value    Extended error value
  37.  
  38. *---------------------------------------------------------------------------*/
  39. int _FARFUNC dosexterr(struct DOSERROR *eblkp)
  40. {
  41.  
  42. /*  Function 0x59 may destroy all registers execept CS:IP and SS:SP  */
  43.  
  44.         SaveSI
  45.         SaveDI
  46. asm     push    ds
  47. asm     push    bp
  48. asm     mov     bx, 0
  49. asm     mov     ah, 059h
  50. asm     int     021h
  51. asm     pop     bp
  52. #if !LDATA
  53. asm     pop     ds          /* If small model restore DS, otherwise wait */
  54. #endif
  55. asm     LDS_    di, eblkp
  56. asm     mov     [di].de_exterror, ax
  57. asm     mov     [di].de_class,    bh
  58. asm     mov     [di].de_action,   bl
  59. asm     mov     [di].de_locus,    ch
  60. #if LDATA
  61. asm     pop     ds          /* Restore DS, already done for small data */
  62. #endif
  63.         return _AX;
  64. }
  65.