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