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