1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: wrappers.h 1860 2015-08-22 02:30:34Z 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 | 20 Aug 15 SHL Add xDos...MutexSem and xDos..EventSem wrappers
|
---|
22 |
|
---|
23 | ***********************************************************************/
|
---|
24 |
|
---|
25 | #if !defined(WRAPPERS_H)
|
---|
26 | #define WRAPPERS_H
|
---|
27 |
|
---|
28 | #if !defined(OS2_INCLUDED)
|
---|
29 | #include <os2.h>
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | // Functions wrapped because they are not safe with high memory addresses
|
---|
33 |
|
---|
34 | APIRET xDosDupHandle(HFILE hFile,
|
---|
35 | PHFILE phFile);
|
---|
36 |
|
---|
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 |
|
---|
54 | APIRET xDosAllocMem(PPVOID ppb,
|
---|
55 | ULONG cb,
|
---|
56 | PCSZ pszSrcFile,
|
---|
57 | UINT uiLineNumber);
|
---|
58 |
|
---|
59 | APIRET xDosAllocMemLow(PPVOID ppb,
|
---|
60 | ULONG cb,
|
---|
61 | PCSZ pszSrcFile,
|
---|
62 | UINT uiLineNumber);
|
---|
63 |
|
---|
64 | APIRET xDosAllocSharedMem(PPVOID ppb,
|
---|
65 | PSZ pszName,
|
---|
66 | ULONG cb,
|
---|
67 | PCSZ pszSrcFile,
|
---|
68 | UINT uiLineNumber);
|
---|
69 |
|
---|
70 | APIRET xDosFindFirst(PSZ pszFileSpec,
|
---|
71 | PHDIR phdir,
|
---|
72 | ULONG flAttribute,
|
---|
73 | PVOID pfindbuf,
|
---|
74 | ULONG cbBuf,
|
---|
75 | PULONG pcFileNames,
|
---|
76 | ULONG ulInfoLevel);
|
---|
77 |
|
---|
78 | APIRET xDosFindNext(HDIR hDir,
|
---|
79 | PVOID pfindbuf,
|
---|
80 | ULONG cbfindbuf,
|
---|
81 | PULONG pcFilenames,
|
---|
82 | ULONG ulInfoLevel); // 06 Oct 07 SHL Added
|
---|
83 |
|
---|
84 | #ifdef INCL_DOSPROCESS // PPIB PTIB
|
---|
85 | APIRET xDosGetInfoBlocks(PTIB *pptib,
|
---|
86 | PPIB *pppib); // 2015-08-09 SHL added
|
---|
87 | #endif
|
---|
88 |
|
---|
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 |
|
---|
98 | APIRET xDosSetPathInfo(PSZ pszPathName,
|
---|
99 | ULONG ulInfoLevel,
|
---|
100 | PVOID pInfoBuf,
|
---|
101 | ULONG cbInfoBuf,
|
---|
102 | ULONG flOptions);
|
---|
103 |
|
---|
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,
|
---|
109 | UINT uiLineNumber, BOOL fSilent);
|
---|
110 | VOID xfree(PVOID pv, PCSZ pszSrcFile, UINT uiLineNumber);
|
---|
111 | FILE *xfsopen(PCSZ pszFileName, PCSZ pszMode, INT fSharemode, PCSZ pszSrcFile,
|
---|
112 | UINT uiLineNumber, BOOL fSilent);
|
---|
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 |
|
---|
118 | #define HIGH_MEMORY_ADDRESS(p) (((ULONG)p) >= (512*1024*1024))
|
---|
119 |
|
---|
120 | // Data declarations
|
---|
121 | extern BOOL fNoLargeFileSupport;
|
---|
122 |
|
---|
123 |
|
---|
124 | #endif // WRAPPERS_H
|
---|