summaryrefslogtreecommitdiffstats
path: root/private/mvdm/wow16/write/doslib.h
blob: bc5f4855471e633567d2d9b720e8e47f7f6f8d2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/************************************************************/
/* Windows Write, Copyright 1985-1992 Microsoft Corporation */
/************************************************************/

/*  Include file with headers for functions in DOSLIB.ASM */

typedef unsigned DOSHND;        /* DOS handle */
typedef DOSHND typeOSFN;        /* General WRITE type for OS file handle */
struct TIM {                    /* Time structure returned by OsTime */
    CHAR minutes, hour, hsec, sec;
    };

int CchCurSzPath( CHAR *, CHAR );

#ifdef ENABLE   /* We are not currently using these */
int FFirst( CHAR near *, PSTR, int );
int FNext( CHAR near * );
DOSHND  WOpenSzFfname( CHAR *, int );
#endif

WORD    DaGetFileModeSz(CHAR *);
void    OsTime( struct TIM * );     /* NOTE: function moved to lib.asm */
DOSHND  WCreateNewSzFfname( CHAR *, int );
DOSHND  WCreateSzFfname( CHAR *, int );
int     CchReadDoshnd( DOSHND, CHAR FAR *, int );
int     CchWriteDoshnd( DOSHND, CHAR FAR *, int );
int     FCloseDoshnd( DOSHND );
WORD    WDosVersion( void );
int     DosxError( void );
long    DwSeekDw( DOSHND, long, int );
int     FpeDeleteSzFfname( CHAR * );
int     FpeRenameSzFfname( CHAR *, CHAR * );


#define DA_NORMAL       0x00    /* DOS File Attribute */
#define DA_READONLY     0x01    /* DOS File Attribute for read-only file */
#define DA_NIL          0xFFFF  /* Error DA */
#define dosxSharing     32      /* Extended error code for sharing viol. */
#define nErrNoAcc       5       /* OpenFile error code for Access Denied */
#define nErrFnf         2       /* OpenFile error code for File Not Found */
#define bSHARE_DENYRDWR 0x10    /* Sharing Open mode for exclusive use */

/* Error condition returned by "CCH" returning DOS functions, e.g. read */

#define FIsErrCchDisk(cch)   ((int)(cch) < 0)

#define cchDiskHardError    -1      /* Bogus error code, not returned by DOS */
#define fpeHardError        -1      /* also */

/* Error condition returned by functions that return DOS handles */

#define FIsErrDoshnd(doshnd)        ((int)(doshnd) < 0)

/* DOS Error codes */
/* These are the negative of the codes returned in AX by DOS functions */
#define fpeFnfError      -2      /* File Not Found */
#define fpeBadPathError  -3      /* Bad Path (path not found) */
#define fpeNoHndError    -4      /* No Handles Available */
#define fpeNoAccError    -5      /* Access Denied */
#define fpeBadHndError   -6      /* Bad handle passed in */
#define fpeNoDriveError  -15     /* Non-existent drive passed in */
#define fpeExistError    -80     /* File exists */

/* Seek-from type codes passed to DOS function 42H */

#define SF_BEGINNING    0       /* Seek from beginning of file */
#define SF_CURRENT      1       /* Seek from current file pointer */
#define SF_END          2       /* Seek from end of file */

/* Error test for seek position */

#define FIsErrDwSeek(dw)    ((long)(dw) < (long)0)

/* Error test for fpe-returning functions */

#define FIsErrFpe(fpe)     ((int)(fpe) < 0)

/* Tests whether an error is a hardware error.  Hardware errors are caught
   and prompted for by Windows, so we should not duplicate those prompts.
   Chrisp says these DOS 3.0 error codes are generated by Windows for all
   supported versions of DOS
   fpe is WRITE's error type; ofe is the unadulturated error returned by
   DOS or OpenFile */

#define ofeCaughtFirst      19
#define ofeCaughtLast       27

#define FIsCaughtOfe(ofe)   (((ofe)>=ofeCaughtFirst)&&((ofe)<=ofeCaughtLast))
#define FIsCaughtFpe(fpe)   FIsCaughtOfe(-(fpe))
#define FIsCaughtDwSeekErr(dw)  FIsCaughtFpe((int)(dw))

#define FpeFromCchDisk(cch) (cch)

#define fpeNoErr            0