[1190] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
[1202] | 4 | $Id: wrappers.h 1853 2015-08-17 00:08:03Z stevenhl $
|
---|
[1190] | 5 |
|
---|
[1327] | 6 | Wrappers with error checking
|
---|
[1190] | 7 |
|
---|
[1202] | 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[1853] | 9 | Copyright (c) 2008, 2015 Steven H. Levine
|
---|
[1190] | 10 |
|
---|
[1327] | 11 | 08 Dec 08 SHL Add missing OS2_INCLUDED check
|
---|
[1439] | 12 | 12 Jul 09 GKY Add xDosQueryAppType and xDoxAlloc... to allow FM/2 to load in high memory
|
---|
[1627] | 13 | 26 Aug 11 GKY Add a low mem version of xDosAlloc* wrappers; move error checking into all the
|
---|
[1839] | 14 | xDosAlloc* wrappers.
|
---|
[1853] | 15 | 09 Aug 15 SHL Add xDosGetInfoBlocks
|
---|
[1847] | 16 | 12 Aug 15 JBS Ticket #522: Ensure no "highmem-unsafe" functions are called directly
|
---|
[1845] | 17 | 1) New functions have been added
|
---|
[1848] | 18 | 2) Code for unsafe-but-not-yet-used-by-FM/2 functinos have been added in an
|
---|
[1845] | 19 | "#if 0" block in wrappers.c for quick implementation should FM/2 start to use them.
|
---|
| 20 | Among these. xDosOpenL and xWinUpper still need work. The rest are ready for use.
|
---|
[1190] | 21 |
|
---|
| 22 | ***********************************************************************/
|
---|
| 23 |
|
---|
| 24 | #if !defined(WRAPPERS_H)
|
---|
| 25 | #define WRAPPERS_H
|
---|
| 26 |
|
---|
[1327] | 27 | #if !defined(OS2_INCLUDED)
|
---|
| 28 | #include <os2.h>
|
---|
| 29 | #endif
|
---|
| 30 |
|
---|
[1845] | 31 | // Functions wrapped because they are not safe with high memory addresses
|
---|
[1439] | 32 |
|
---|
[1845] | 33 | APIRET xDosDupHandle(HFILE hFile,
|
---|
| 34 | PHFILE phFile);
|
---|
[1438] | 35 |
|
---|
[1845] | 36 | APIRET xDosForceDelete(PSZ pszFileName);
|
---|
| 37 |
|
---|
| 38 | APIRET xDosQueryHType(HFILE hFile,
|
---|
| 39 | PULONG pulType,
|
---|
| 40 | PULONG pulAttr);
|
---|
| 41 |
|
---|
| 42 | APIRET xDosQueryAppType(PCSZ pszName,
|
---|
| 43 | PULONG pFlags);
|
---|
| 44 |
|
---|
| 45 | #ifdef INCL_DOSSESMGR
|
---|
| 46 | APIRET xDosStartSession(PSTARTDATA psd,
|
---|
| 47 | PULONG pulSessionID,
|
---|
| 48 | PPID ppid);
|
---|
| 49 | #endif
|
---|
| 50 |
|
---|
| 51 | // Functions wrapped for other reasons
|
---|
| 52 |
|
---|
[1438] | 53 | APIRET xDosAllocMem(PPVOID ppb,
|
---|
[1839] | 54 | ULONG cb,
|
---|
| 55 | PCSZ pszSrcFile,
|
---|
| 56 | UINT uiLineNumber);
|
---|
[1438] | 57 |
|
---|
[1627] | 58 | APIRET xDosAllocMemLow(PPVOID ppb,
|
---|
[1839] | 59 | ULONG cb,
|
---|
| 60 | PCSZ pszSrcFile,
|
---|
| 61 | UINT uiLineNumber);
|
---|
[1627] | 62 |
|
---|
[1845] | 63 | APIRET xDosAllocSharedMem(PPVOID ppb,
|
---|
| 64 | PSZ pszName,
|
---|
| 65 | ULONG cb,
|
---|
| 66 | PCSZ pszSrcFile,
|
---|
| 67 | UINT uiLineNumber);
|
---|
| 68 |
|
---|
[1190] | 69 | APIRET xDosFindFirst(PSZ pszFileSpec,
|
---|
| 70 | PHDIR phdir,
|
---|
[1845] | 71 | ULONG flAttribute,
|
---|
| 72 | PVOID pfindbuf,
|
---|
| 73 | ULONG cbBuf,
|
---|
[1190] | 74 | PULONG pcFileNames,
|
---|
[1845] | 75 | ULONG ulInfoLevel);
|
---|
| 76 |
|
---|
| 77 | APIRET xDosFindNext(HDIR hDir,
|
---|
| 78 | PVOID pfindbuf,
|
---|
| 79 | ULONG cbfindbuf,
|
---|
[1190] | 80 | PULONG pcFilenames,
|
---|
[1845] | 81 | ULONG ulInfoLevel); // 06 Oct 07 SHL Added
|
---|
[1839] | 82 |
|
---|
[1845] | 83 | #ifdef INCL_DOSPROCESS // // PPIB PTIB
|
---|
[1839] | 84 | APIRET xDosGetInfoBlocks(PTIB *pptib,
|
---|
[1845] | 85 | PPIB *pppib); // 2015-08-09 SHL added
|
---|
[1839] | 86 | #endif
|
---|
| 87 |
|
---|
[1845] | 88 | APIRET xDosSetPathInfo(PSZ pszPathName,
|
---|
[1190] | 89 | ULONG ulInfoLevel,
|
---|
| 90 | PVOID pInfoBuf,
|
---|
| 91 | ULONG cbInfoBuf,
|
---|
| 92 | ULONG flOptions);
|
---|
[1845] | 93 |
|
---|
[1190] | 94 | PSZ xfgets(PSZ pszBuf, size_t cMaxBytes, FILE * fp, PCSZ pszSrcFile,
|
---|
| 95 | UINT uiLineNumber);
|
---|
| 96 | PSZ xfgets_bstripcr(PSZ pszBuf, size_t cMaxBytes, FILE * fp, PCSZ pszSrcFile,
|
---|
| 97 | UINT uiLineNumber);
|
---|
| 98 | FILE *xfopen(PCSZ pszFileName, PCSZ pszMode, PCSZ pszSrcFile,
|
---|
[1544] | 99 | UINT uiLineNumber, BOOL fSilent);
|
---|
[1190] | 100 | VOID xfree(PVOID pv, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 101 | FILE *xfsopen(PCSZ pszFileName, PCSZ pszMode, INT fSharemode, PCSZ pszSrcFile,
|
---|
[1544] | 102 | UINT uiLineNumber, BOOL fSilent);
|
---|
[1190] | 103 | PVOID xmalloc(size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 104 | PVOID xmallocz(size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 105 | PVOID xrealloc(PVOID pvIn, size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 106 | PVOID xstrdup(PCSZ pszIn, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 107 |
|
---|
[1845] | 108 | #define HIGH_MEMORY_ADDRESS(p) (((ULONG)p) >= (512*1024*1024))
|
---|
| 109 |
|
---|
[1215] | 110 | // Data declarations
|
---|
| 111 | extern BOOL fNoLargeFileSupport;
|
---|
[1190] | 112 |
|
---|
[1845] | 113 |
|
---|
[1190] | 114 | #endif // WRAPPERS_H
|
---|