[1190] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
[1202] | 4 | $Id: wrappers.h 1860 2015-08-22 02:30:34Z 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.
|
---|
[1860] | 21 | 20 Aug 15 SHL Add xDos...MutexSem and xDos..EventSem wrappers
|
---|
[1190] | 22 |
|
---|
| 23 | ***********************************************************************/
|
---|
| 24 |
|
---|
| 25 | #if !defined(WRAPPERS_H)
|
---|
| 26 | #define WRAPPERS_H
|
---|
| 27 |
|
---|
[1327] | 28 | #if !defined(OS2_INCLUDED)
|
---|
| 29 | #include <os2.h>
|
---|
| 30 | #endif
|
---|
| 31 |
|
---|
[1845] | 32 | // Functions wrapped because they are not safe with high memory addresses
|
---|
[1439] | 33 |
|
---|
[1845] | 34 | APIRET xDosDupHandle(HFILE hFile,
|
---|
| 35 | PHFILE phFile);
|
---|
[1438] | 36 |
|
---|
[1845] | 37 | APIRET xDosForceDelete(PSZ pszFileName);
|
---|
| 38 |
|
---|
| 39 | APIRET xDosQueryHType(HFILE hFile,
|
---|
| 40 | PULONG pulType,
|
---|
| 41 | PULONG pulAttr);
|
---|
| 42 |
|
---|
| 43 | APIRET xDosQueryAppType(PCSZ pszName,
|
---|
| 44 | PULONG pFlags);
|
---|
| 45 |
|
---|
| 46 | #ifdef INCL_DOSSESMGR
|
---|
| 47 | APIRET xDosStartSession(PSTARTDATA psd,
|
---|
| 48 | PULONG pulSessionID,
|
---|
| 49 | PPID ppid);
|
---|
| 50 | #endif
|
---|
| 51 |
|
---|
| 52 | // Functions wrapped for other reasons
|
---|
| 53 |
|
---|
[1438] | 54 | APIRET xDosAllocMem(PPVOID ppb,
|
---|
[1839] | 55 | ULONG cb,
|
---|
| 56 | PCSZ pszSrcFile,
|
---|
| 57 | UINT uiLineNumber);
|
---|
[1438] | 58 |
|
---|
[1627] | 59 | APIRET xDosAllocMemLow(PPVOID ppb,
|
---|
[1839] | 60 | ULONG cb,
|
---|
| 61 | PCSZ pszSrcFile,
|
---|
| 62 | UINT uiLineNumber);
|
---|
[1627] | 63 |
|
---|
[1845] | 64 | APIRET xDosAllocSharedMem(PPVOID ppb,
|
---|
| 65 | PSZ pszName,
|
---|
| 66 | ULONG cb,
|
---|
| 67 | PCSZ pszSrcFile,
|
---|
| 68 | UINT uiLineNumber);
|
---|
| 69 |
|
---|
[1190] | 70 | APIRET xDosFindFirst(PSZ pszFileSpec,
|
---|
| 71 | PHDIR phdir,
|
---|
[1845] | 72 | ULONG flAttribute,
|
---|
| 73 | PVOID pfindbuf,
|
---|
| 74 | ULONG cbBuf,
|
---|
[1190] | 75 | PULONG pcFileNames,
|
---|
[1845] | 76 | ULONG ulInfoLevel);
|
---|
| 77 |
|
---|
| 78 | APIRET xDosFindNext(HDIR hDir,
|
---|
| 79 | PVOID pfindbuf,
|
---|
| 80 | ULONG cbfindbuf,
|
---|
[1190] | 81 | PULONG pcFilenames,
|
---|
[1845] | 82 | ULONG ulInfoLevel); // 06 Oct 07 SHL Added
|
---|
[1839] | 83 |
|
---|
[1860] | 84 | #ifdef INCL_DOSPROCESS // PPIB PTIB
|
---|
[1839] | 85 | APIRET xDosGetInfoBlocks(PTIB *pptib,
|
---|
[1845] | 86 | PPIB *pppib); // 2015-08-09 SHL added
|
---|
[1839] | 87 | #endif
|
---|
| 88 |
|
---|
[1860] | 89 | #ifdef INCL_DOSSEMAPHORES // HMTX HEV
|
---|
| 90 | APIRET xDosRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
|
---|
| 91 | APIRET xDosReleaseMutexSem(HMTX hmtx);
|
---|
| 92 | APIRET xDosCreateEventSem (PSZ pszName,PHEV phev, ULONG flAttr, BOOL32 fState);
|
---|
| 93 | APIRET xDosWaitEventSem(HEV hev, ULONG ulTimeout);
|
---|
| 94 | APIRET xDosPostEventSem(HEV hev);
|
---|
| 95 | APIRET xDosResetEventSem(HEV hev, PULONG pulPostCt);
|
---|
| 96 | #endif
|
---|
| 97 |
|
---|
[1845] | 98 | APIRET xDosSetPathInfo(PSZ pszPathName,
|
---|
[1190] | 99 | ULONG ulInfoLevel,
|
---|
| 100 | PVOID pInfoBuf,
|
---|
| 101 | ULONG cbInfoBuf,
|
---|
| 102 | ULONG flOptions);
|
---|
[1845] | 103 |
|
---|
[1190] | 104 | PSZ xfgets(PSZ pszBuf, size_t cMaxBytes, FILE * fp, PCSZ pszSrcFile,
|
---|
| 105 | UINT uiLineNumber);
|
---|
| 106 | PSZ xfgets_bstripcr(PSZ pszBuf, size_t cMaxBytes, FILE * fp, PCSZ pszSrcFile,
|
---|
| 107 | UINT uiLineNumber);
|
---|
| 108 | FILE *xfopen(PCSZ pszFileName, PCSZ pszMode, PCSZ pszSrcFile,
|
---|
[1544] | 109 | UINT uiLineNumber, BOOL fSilent);
|
---|
[1190] | 110 | VOID xfree(PVOID pv, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 111 | FILE *xfsopen(PCSZ pszFileName, PCSZ pszMode, INT fSharemode, PCSZ pszSrcFile,
|
---|
[1544] | 112 | UINT uiLineNumber, BOOL fSilent);
|
---|
[1190] | 113 | PVOID xmalloc(size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 114 | PVOID xmallocz(size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 115 | PVOID xrealloc(PVOID pvIn, size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 116 | PVOID xstrdup(PCSZ pszIn, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
| 117 |
|
---|
[1845] | 118 | #define HIGH_MEMORY_ADDRESS(p) (((ULONG)p) >= (512*1024*1024))
|
---|
| 119 |
|
---|
[1215] | 120 | // Data declarations
|
---|
| 121 | extern BOOL fNoLargeFileSupport;
|
---|
[1190] | 122 |
|
---|
[1845] | 123 |
|
---|
[1190] | 124 | #endif // WRAPPERS_H
|
---|