home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / DOSEXT.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.9 KB  |  61 lines

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