source: trunk/src/kernel32/oslibdos.h@ 7029

Last change on this file since 7029 was 6397, checked in by sandervl, 24 years ago

updates

File size: 12.2 KB
Line 
1/* $Id: oslibdos.h,v 1.35 2001-07-28 18:03:38 sandervl Exp $ */
2
3/*
4 * Wrappers for OS/2 Dos* API
5 *
6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12#ifndef __OSLIBDOS_H__
13#define __OSLIBDOS_H__
14
15
16#ifdef OS2_INCLUDED
17DWORD error2WinError(APIRET rc,DWORD defaultCode = ERROR_NOT_ENOUGH_MEMORY_W);
18#else
19DWORD error2WinError(DWORD rc,DWORD defaultCode = ERROR_NOT_ENOUGH_MEMORY);
20#endif
21
22void OSLibInitWSeBFileIO();
23
24DWORD OSLibDosAliasMem(LPVOID pb, ULONG cb, LPVOID *ppbAlias, ULONG fl);
25DWORD OSLibDosAllocMem(LPVOID *lplpMemAddr, DWORD size, DWORD flags);
26DWORD OSLibDosFreeMem(LPVOID lpMemAddr);
27DWORD OSLibDosQueryMem(LPVOID lpMemAddr, DWORD *lpRangeSize, DWORD *lpAttr);
28DWORD OSLibDosSetMem(LPVOID lpMemAddr, DWORD size, DWORD flags);
29DWORD OSLibDosAllocSharedMem(LPVOID *lplpMemAddr, DWORD size, DWORD flags, LPSTR name);
30DWORD OSLibDosGetNamedSharedMem(LPVOID *lplpMemAddr, LPSTR name);
31DWORD OSLibDosChangeMaxFileHandles();
32
33#define ODIN_INCREMENT_MAX_FILEHANDLES 64
34#define ODIN_DEFAULT_MAX_FILEHANDLES 256
35DWORD OSLibDosSetInitialMaxFileHandles(DWORD maxhandles);
36
37BOOL OSLibDosGetFileAttributesEx(LPSTR pszName, ULONG ulDummy, PVOID pBuffer);
38
39#define OSLIB_NOERROR 0
40#define OSLIB_ERROR_INVALID_ADDRESS 1
41#define OSLIB_ERROR_ACCESS_DENIED 2
42#define OSLIB_ERROR_INVALID_PARAMETER 3
43
44#ifndef __OS2_H__
45
46/* Access protection */
47#define PAG_READ 0x00000001U /* read access */
48#define PAG_WRITE 0x00000002U /* write access */
49#define PAG_EXECUTE 0x00000004U /* execute access */
50#define PAG_GUARD 0x00000008U /* guard protection */
51#define PAG_DEFAULT 0x00000400U /* default (initial) access */
52
53/* Commit */
54#define PAG_COMMIT 0x00000010U /* commit storage */
55#define PAG_DECOMMIT 0x00000020U /* decommit storage */
56
57/* Allocation attributes */
58#define OBJ_TILE 0x00000040U /* tile object */
59#define OBJ_PROTECTED 0x00000080U /* protect object */
60#define OBJ_GETTABLE 0x00000100U /* gettable by other processes */
61#define OBJ_GIVEABLE 0x00000200U /* giveable to other processes */
62
63/* Allocation type (returned from DosQueryMem) */
64#define PAG_SHARED 0x00002000U /* shared object */
65#define PAG_FREE 0x00004000U /* pages are free */
66#define PAG_BASE 0x00010000U /* first page in object */
67
68#endif
69
70#define OSLIB_ACCESS_READONLY 1
71#define OSLIB_ACCESS_READWRITE 2
72#define OSLIB_ACCESS_SHAREDENYNONE 4
73#define OSLIB_ACCESS_SHAREDENYREAD 8
74#define OSLIB_ACCESS_SHAREDENYWRITE 16
75
76DWORD OSLibDosOpen(char *lpszFileName, DWORD flags);
77BOOL OSLibDosClose(DWORD hFile);
78BOOL OSLibDosDelete(char *lpszFileName);
79BOOL OSLibDosCopyFile(LPCSTR lpszOldFile, LPCSTR lpszNewFile, BOOL fFailIfExist);
80BOOL OSLibDosMoveFile(LPCSTR lpszOldFile, LPCSTR lpszNewFile);
81BOOL OSLibDosRemoveDir(LPCSTR lpszDir);
82BOOL OSLibDosCreateDirectory(LPCSTR lpszDir);
83
84#define OSLIB_SETPTR_FILE_CURRENT 0
85#define OSLIB_SETPTR_FILE_BEGIN 1
86#define OSLIB_SETPTR_FILE_END 2
87
88DWORD OSLibDosSetFilePtr(DWORD hFile, DWORD offset, DWORD method);
89
90#define OSLIB_SEARCHDIR 1
91#define OSLIB_SEARCHCURDIR 2
92#define OSLIB_SEARCHFILE 3
93#define OSLIB_SEARCHENV 4
94
95DWORD OSLibDosSearchPath(DWORD cmd, char *path, char *name, char *full_name, DWORD length_fullname);
96
97#ifndef FIL_QUERYFULLNAME
98 #define FIL_QUERYFULLNAME 5
99#else
100 #if FIL_QUERYFULLNAME != 5
101 #error "Hmm! FIL_QUERYFULLNAME isn't 5"
102 #endif
103#endif
104
105DWORD OSLibDosQueryPathInfo(CHAR *pszPathName,
106 ULONG ulInfoLevel,
107 PVOID pInfoBuf,
108 ULONG cbInfoBuf);
109
110DWORD OSLibDosCreateFile(CHAR *lpFileName, DWORD dwAccess,
111 DWORD dwShare, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
112 DWORD dwCreation, DWORD dwFlags, HANDLE hTemplate);
113
114DWORD OSLibDosOpenFile(CHAR *lpszFile, UINT fuMode);
115
116BOOL OSLibDosLockFile(DWORD hFile, DWORD dwFlags,
117 DWORD OffsetLow, DWORD OffsetHigh,
118 DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh,
119 LPOVERLAPPED lpOverlapped);
120
121BOOL OSLibDosUnlockFile(DWORD hFile, DWORD OffsetLow, DWORD OffsetHigh,
122 DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh,
123 LPOVERLAPPED lpOverlapped);
124
125BOOL OSLibDosFlushFileBuffers(DWORD hFile);
126BOOL OSLibDosSetEndOfFile(DWORD hFile);
127
128DWORD OSLibDosGetFileSize(DWORD hFile, LPDWORD lpdwFileSizeHigh);
129BOOL OSLibDosRead(DWORD hFile, LPVOID lpBuffer, DWORD size, DWORD *nrBytesRead);
130BOOL OSLibDosWrite(DWORD hFile, LPVOID lpBuffer, DWORD size, DWORD *nrBytesWritten);
131
132BOOL OSLibDosGetFileInformationByHandle(DWORD hFile, BY_HANDLE_FILE_INFORMATION* pHFI);
133
134BOOL OSLibDosSetFileTime(DWORD hFile, WORD creationdate, WORD creationtime,
135 WORD lastaccessdate, WORD lastaccesstime,
136 WORD lastwritedate, WORD lastwritetime);
137
138BOOL OSLibDosGetFileTime(DWORD hFile, WORD *creationdate, WORD *creationtime,
139 WORD *lastaccessdate, WORD *lastaccesstime,
140 WORD *lastwritedate, WORD *lastwritetime);
141
142DWORD OSLibDosSetFilePointer(DWORD hFile, DWORD OffsetLow, DWORD *OffsetHigh, DWORD method);
143
144DWORD OSLibDosDupHandle(DWORD hFile, DWORD *hNew);
145DWORD OSLibDosSetFilePtr2(DWORD hFile, DWORD offset, DWORD method);
146
147#ifndef PAGE_SIZE
148#define PAGE_SIZE 4096
149#endif
150
151void OSLibDosDisableHardError(BOOL fTurnOff);
152BOOL OSLibDosQueryProcTimes(DWORD procid, ULONG *kerneltime, ULONG *usertime);
153
154BOOL OSLibDosTransactNamedPipe( DWORD hNamedPipe,
155 LPVOID lpInBuffer,
156 DWORD nInBufferSize,
157 LPVOID lpOutBuffer,
158 DWORD nOutBufferSize,
159 LPDWORD lpBytesRead,
160 LPOVERLAPPED lpOverlapped);
161
162BOOL OSLibDosCallNamedPipe( LPCTSTR lpNamedPipeName,
163 LPVOID lpInBuffer,
164 DWORD nInBufferSize,
165 LPVOID lpOutBuffer,
166 DWORD nOutBufferSize,
167 LPDWORD lpBytesRead,
168 DWORD nTimeOut );
169
170BOOL OSLibDosPeekNamedPipe(DWORD hPipe,
171 LPVOID lpvBuffer,
172 DWORD cbBuffer,
173 LPDWORD lpcbRead,
174 LPDWORD lpcbAvail,
175 LPDWORD lpcbMessage);
176
177BOOL OSLibDosConnectNamedPipe(DWORD hNamedPipe, LPOVERLAPPED lpOverlapped);
178
179DWORD OSLibDosCreateNamedPipe(LPCTSTR lpName,
180 DWORD dwOpenMode,
181 DWORD dwPipeMode,
182 DWORD nMaxInstances,
183 DWORD nOutBufferSize,
184 DWORD nInBufferSize,
185 DWORD nDefaultTimeOut,
186 LPSECURITY_ATTRIBUTES lpSecurityAttributes);
187
188BOOL OSLibSetNamedPipeState(DWORD hNamedPipe, DWORD dwPipeMode);
189
190DWORD OSLibDosOpenPipe(LPCTSTR lpName,
191 DWORD fuAccess,
192 DWORD fuShare,
193 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
194 DWORD fuCreate,
195 DWORD fuAttrFlags);
196
197BOOL OSLibDosWaitNamedPipe(LPCSTR lpszNamedPipeName,
198 DWORD dwTimeout);
199
200BOOL OSLibDosDisconnectNamedPipe(DWORD hPipe);
201
202BOOL OSLibDosCreatePipe(PHANDLE phfRead,
203 PHANDLE phfWrite,
204 LPSECURITY_ATTRIBUTES lpsa,
205 DWORD dwSize);
206
207
208DWORD OSLibDosFindFirst(LPCSTR lpFileName,WIN32_FIND_DATAA* lpFindFileData);
209DWORD OSLibDosFindFirstMulti(LPCSTR lpFileName,WIN32_FIND_DATAA *lpFindFileData,DWORD *count);
210BOOL OSLibDosFindNext(DWORD hFindFile,WIN32_FIND_DATAA* lpFindFileData);
211BOOL OSLibDosFindNextMulti(DWORD hFindFile,WIN32_FIND_DATAA *lpFindFileData,DWORD *count);
212BOOL OSLibDosFindClose(DWORD hFindFile);
213
214DWORD OSLibDosQueryVolumeFS(int drive, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize);
215DWORD OSLibDosQueryVolumeSerialAndName(int drive, LPDWORD lpVolumeSerialNumber, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize);
216DWORD OSLibDosDevIOCtl( DWORD hFile, DWORD dwCat, DWORD dwFunc,
217 PVOID pParm, DWORD dwParmMaxLen, DWORD *pdwParmLen,
218 PVOID pData, DWORD dwDataMaxLen, DWORD *pdwDataLen);
219
220BOOL OSLibGetDiskFreeSpace(LPSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
221 LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
222 LPDWORD lpTotalNumberOfClusters);
223
224ULONG OSLibDosQuerySysInfo(ULONG iStart, ULONG iLast, PVOID pBuf, ULONG cbBuf);
225ULONG OSLibGetDriveType(ULONG diskIndex);
226ULONG OSLibGetLogicalDrives();
227ULONG OSLibDosQueryCurrentDisk();
228
229BOOL OSLibDosGetDiskGeometry(HANDLE hDisk, DWORD cDisk, void *pGeom);
230
231#ifdef OS2DEF_INCLUDED
232#ifndef FIL_STANDARDL
233 typedef struct _LONGLONG { /* LONGLONG */
234 ULONG ulLo;
235 LONG ulHi;
236 } LONGLONG;
237 typedef LONGLONG *PLONGLONG;
238
239 typedef struct _ULONGLONG { /* ULONGLONG */
240 ULONG ulLo;
241 ULONG ulHi;
242 } ULONGLONG;
243 typedef ULONGLONG *PULONGLONG;
244
245 #define FIL_STANDARDL 11 /* LFS - Info level 11, standard file info for large files*/
246 #define FIL_QUERYEASIZEL 12 /* LFS - Level 12, return Full EA size for large files */
247 #define FIL_QUERYEASFROMLISTL 13 /* LFS - Level 13, return requested EA's */
248
249 typedef struct _FILESTATUS3L /* fsts3L */
250 {
251 FDATE fdateCreation;
252 FTIME ftimeCreation;
253 FDATE fdateLastAccess;
254 FTIME ftimeLastAccess;
255 FDATE fdateLastWrite;
256 FTIME ftimeLastWrite;
257 LONGLONG cbFile;
258 LONGLONG cbFileAlloc;
259 ULONG attrFile;
260 } FILESTATUS3L;
261 typedef FILESTATUS3L *PFILESTATUS3L;
262
263 /* Large File Support >2GB */
264 typedef struct _FILESTATUS4L /* fsts4L */
265 {
266 FDATE fdateCreation;
267 FTIME ftimeCreation;
268 FDATE fdateLastAccess;
269 FTIME ftimeLastAccess;
270 FDATE fdateLastWrite;
271 FTIME ftimeLastWrite;
272 LONGLONG cbFile;
273 LONGLONG cbFileAlloc;
274 ULONG attrFile;
275 ULONG cbList;
276 } FILESTATUS4L;
277 typedef FILESTATUS4L *PFILESTATUS4L;
278
279 typedef struct _FILELOCKL /* flock */
280 {
281 LONGLONG lOffset;
282 LONGLONG lRange;
283 } FILELOCKL;
284 typedef FILELOCKL *PFILELOCKL;
285#endif
286
287
288 typedef APIRET (* APIENTRY PROC_DosSetFileSizeL)(HFILE hFile, LONGLONG cbSize);
289 APIRET OdinDosSetFileSize(HFILE hFile,
290 LONGLONG cbSize);
291
292 typedef APIRET (* APIENTRY PROC_DosSetFilePtrL)(HFILE hFile, LONGLONG ib, ULONG method, PLONGLONG ibActual);
293 APIRET OdinDosSetFilePtr(HFILE hFile,
294 LONGLONG ib,
295 ULONG method,
296 PLONGLONG ibActual);
297
298 typedef APIRET (* APIENTRY PROC_DosSetFileLocksL)(HFILE hFile, PFILELOCKL pflUnlock, PFILELOCKL pflLock, ULONG timeout, ULONG flags);
299 APIRET OdinDosSetFileLocks(HFILE hFile,
300 PFILELOCKL pflUnlock,
301 PFILELOCKL pflLock,
302 ULONG timeout,
303 ULONG flags);
304#endif
305
306#endif
307
308ULONG OSLibDosQueryModuleName(ULONG hModule, int cchName, char *pszName);
309ULONG OSLibDosQueryDir(DWORD length, LPSTR lpszCurDir);
310
311HINSTANCE OSLibDosLoadModule(LPSTR szModName);
312void OSLibDosFreeModule(HINSTANCE hinst);
313
314ULONG OSLibDosGetModuleFileName(HMODULE hModule, LPTSTR lpszPath, DWORD cchPath);
315BOOL OSLibDosBeep(DWORD ulFreq, DWORD ulDuration);
316ULONG OSLibDosGetProcAddress(HMODULE hModule, LPCSTR lpszProc);
Note: See TracBrowser for help on using the repository browser.