| 1 |
|
|---|
| 2 | /***********************************************************************
|
|---|
| 3 |
|
|---|
| 4 | $Id: wrappers.h 1845 2015-08-12 19:54:49Z jbs $
|
|---|
| 5 |
|
|---|
| 6 | Wrappers with error checking
|
|---|
| 7 |
|
|---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
|---|
| 9 | Copyright (c) 2008 Steven H. Levine
|
|---|
| 10 |
|
|---|
| 11 | 08 Dec 08 SHL Add missing OS2_INCLUDED check
|
|---|
| 12 | 12 Jul 09 GKY Add xDosQueryAppType and xDoxAlloc... to allow FM/2 to load in high memory
|
|---|
| 13 | 26 Aug 11 GKY Add a low mem version of xDosAlloc* wrappers; move error checking into all the
|
|---|
| 14 | xDosAlloc* wrappers.
|
|---|
| 15 | 12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
|
|---|
| 16 | 1) New functions have been added
|
|---|
| 17 | 2) Code for unsafe-but-not-yet-used-by-FM/2 has been added in an
|
|---|
| 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.
|
|---|
| 20 |
|
|---|
| 21 | ***********************************************************************/
|
|---|
| 22 |
|
|---|
| 23 | #if !defined(WRAPPERS_H)
|
|---|
| 24 | #define WRAPPERS_H
|
|---|
| 25 |
|
|---|
| 26 | #if !defined(OS2_INCLUDED)
|
|---|
| 27 | #include <os2.h>
|
|---|
| 28 | #endif
|
|---|
| 29 |
|
|---|
| 30 | // Functions wrapped because they are not safe with high memory addresses
|
|---|
| 31 |
|
|---|
| 32 | APIRET xDosDupHandle(HFILE hFile,
|
|---|
| 33 | PHFILE phFile);
|
|---|
| 34 |
|
|---|
| 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 |
|
|---|
| 52 | APIRET xDosAllocMem(PPVOID ppb,
|
|---|
| 53 | ULONG cb,
|
|---|
| 54 | PCSZ pszSrcFile,
|
|---|
| 55 | UINT uiLineNumber);
|
|---|
| 56 |
|
|---|
| 57 | APIRET xDosAllocMemLow(PPVOID ppb,
|
|---|
| 58 | ULONG cb,
|
|---|
| 59 | PCSZ pszSrcFile,
|
|---|
| 60 | UINT uiLineNumber);
|
|---|
| 61 |
|
|---|
| 62 | APIRET xDosAllocSharedMem(PPVOID ppb,
|
|---|
| 63 | PSZ pszName,
|
|---|
| 64 | ULONG cb,
|
|---|
| 65 | PCSZ pszSrcFile,
|
|---|
| 66 | UINT uiLineNumber);
|
|---|
| 67 |
|
|---|
| 68 | APIRET xDosFindFirst(PSZ pszFileSpec,
|
|---|
| 69 | PHDIR phdir,
|
|---|
| 70 | ULONG flAttribute,
|
|---|
| 71 | PVOID pfindbuf,
|
|---|
| 72 | ULONG cbBuf,
|
|---|
| 73 | PULONG pcFileNames,
|
|---|
| 74 | ULONG ulInfoLevel);
|
|---|
| 75 |
|
|---|
| 76 | APIRET xDosFindNext(HDIR hDir,
|
|---|
| 77 | PVOID pfindbuf,
|
|---|
| 78 | ULONG cbfindbuf,
|
|---|
| 79 | PULONG pcFilenames,
|
|---|
| 80 | ULONG ulInfoLevel); // 06 Oct 07 SHL Added
|
|---|
| 81 |
|
|---|
| 82 | #ifdef INCL_DOSPROCESS // // PPIB PTIB
|
|---|
| 83 | APIRET xDosGetInfoBlocks(PTIB *pptib,
|
|---|
| 84 | PPIB *pppib); // 2015-08-09 SHL added
|
|---|
| 85 | #endif
|
|---|
| 86 |
|
|---|
| 87 | APIRET xDosSetPathInfo(PSZ pszPathName,
|
|---|
| 88 | ULONG ulInfoLevel,
|
|---|
| 89 | PVOID pInfoBuf,
|
|---|
| 90 | ULONG cbInfoBuf,
|
|---|
| 91 | ULONG flOptions);
|
|---|
| 92 |
|
|---|
| 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,
|
|---|
| 98 | UINT uiLineNumber, BOOL fSilent);
|
|---|
| 99 | VOID xfree(PVOID pv, PCSZ pszSrcFile, UINT uiLineNumber);
|
|---|
| 100 | FILE *xfsopen(PCSZ pszFileName, PCSZ pszMode, INT fSharemode, PCSZ pszSrcFile,
|
|---|
| 101 | UINT uiLineNumber, BOOL fSilent);
|
|---|
| 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 |
|
|---|
| 107 | #define HIGH_MEMORY_ADDRESS(p) (((ULONG)p) >= (512*1024*1024))
|
|---|
| 108 |
|
|---|
| 109 | // Data declarations
|
|---|
| 110 | extern BOOL fNoLargeFileSupport;
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 | #endif // WRAPPERS_H
|
|---|