Subversion Repositories SvarDOS

Rev

Rev 2041 | Rev 2044 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2019 mateusz.vi 1
/****************************************************************************
2
 
2028 mateusz.vi 3
  Win32 File compatibility for DOS.
2019 mateusz.vi 4
  [This version does support LFNs, if available.]
5
 
6
  Written by: Kenneth J. Davis
7
  Date:       August, 2000
8
  Contact:    jeremyd@computer.org
9
 
10
 
11
Copyright (c): Public Domain [United States Definition]
12
 
13
Permission is hereby granted, free of charge, to any person obtaining a copy
14
of this software and associated documentation files (the "Software"), to deal
15
in the Software without restriction, including without limitation the rights
16
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
copies of the Software, and to permit persons to whom the Software is
18
furnished to do so, subject to the following conditions:
19
 
20
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR AUTHORS BE
24
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
25
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
26
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
DEALINGS IN THE SOFTWARE.
28
 
29
****************************************************************************/
30
 
31
#ifndef W32FDOS_H
32
#define W32FDOS_H
33
 
34
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
35
 
36
#define FILE_ATTRIBUTE_READONLY  0x0001
37
#define FILE_ATTRIBUTE_HIDDEN    0x0002
38
#define FILE_ATTRIBUTE_SYSTEM    0x0004
39
#define FILE_ATTRIBUTE_LABEL     0x0008
40
#define FILE_ATTRIBUTE_DIRECTORY 0x0010
41
#define FILE_ATTRIBUTE_ARCHIVE   0x0020
42
 
43
typedef short BOOL;
44
typedef unsigned char BYTE;
45
typedef unsigned short WORD;
46
typedef unsigned long DWORD;
47
 
48
typedef struct FILETIME   /* should correspond to a quad word */
2028 mateusz.vi 49
{
2019 mateusz.vi 50
  WORD ldw[2];  /* LowDoubleWord  */
51
  DWORD hdw;    /* HighDoubleWord */
52
} FILETIME;
53
 
2040 mateusz.vi 54
struct WIN32_FIND_DATA {
2019 mateusz.vi 55
  DWORD dwFileAttributes;
56
  FILETIME ftCreationTime;
57
  FILETIME ftLastAccessTime;
58
  FILETIME ftLastWriteTime;
59
  DWORD    nFileSizeHigh;
60
  DWORD    nFileSizeLow;
61
  DWORD    dwReserved0;
62
  DWORD    dwReserved1;
63
  char cFileName[ 260 ];
64
  char cAlternateFileName[ 14 ];
2040 mateusz.vi 65
};
2019 mateusz.vi 66
 
67
 
2041 mateusz.vi 68
struct FFDTA { /* same format as a ffblk struct */
2019 mateusz.vi 69
  BYTE reserved[21]; /* dos positioning info */
2041 mateusz.vi 70
  BYTE ff_attr;      /* file attributes */
2019 mateusz.vi 71
  WORD ff_ftime;     /* time when file created/modified */
72
  WORD ff_fdate;     /* date when file created/modified */
73
  DWORD ff_fsize;    /* low word followed by high word */
74
  BYTE ff_name[13];  /* file name, not space padded, period, '\0' terminated, wildcards replaced */
2041 mateusz.vi 75
};
2019 mateusz.vi 76
 
77
 
78
#define FINDFILELFN 1
79
#define FINDFILEOLD 0
80
 
81
typedef union FHND  /* Stores either a handle (LFN) or FFDTA (oldstyle) */
82
{
2028 mateusz.vi 83
  WORD handle;
2041 mateusz.vi 84
  struct FFDTA *ffdtaptr;
2019 mateusz.vi 85
} FHND;
86
 
87
typedef struct FindFileStruct
88
{
89
  short flag;        /* indicates whether this is for the old or new style find file & thus contents */
90
  FHND fhnd;         /* The data stored */
91
} FindFileStruct;
92
 
93
typedef FindFileStruct *HANDLE;
94
 
2040 mateusz.vi 95
HANDLE FindFirstFile(const char *pathname, struct WIN32_FIND_DATA *findData);
96
int FindNextFile(HANDLE hnd, struct WIN32_FIND_DATA *findData);
97
void FindClose(HANDLE hnd);
2019 mateusz.vi 98
 
99
DWORD GetFileAttributes(const char *pathname);
100
 
101
/* Only the 1st 4 arguments are used and returns zero on error */
2042 mateusz.vi 102
int GetVolumeInformation(const char *lpRootPathName, char *lpVolumeNameBuffer,
103
  DWORD nVolumeNameSize, DWORD *lpVolumeSerialNumber);
2019 mateusz.vi 104
 
105
 
2028 mateusz.vi 106
/* If this variable is nonzero then will 1st attempt LFN findfirst
2019 mateusz.vi 107
 * (findfirst calls sets flag, so findnext/findclose know proper method to continue)
108
 * else if 0 then only attempt old 0x4E findfirst.
109
 * This is mostly a debugging tool, may be useful during runtime.
110
 * Default is LFN_ENABLE.
111
 */
112
#define LFN_ENABLE 1
113
#define LFN_DISABLE 0
114
extern int LFN_Enable_Flag;
115
 
116
#endif