source: trunk/dll/wrappers.h@ 1878

Last change on this file since 1878 was 1860, checked in by Steven Levine, 10 years ago

Rework FlesWaitForWorkListEmpty to support wait for parents of path
Add more wrappers for mutex and event semaphores
Clean up some obsolete code

  • Property svn:eolstyle set to native
  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
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
34APIRET xDosDupHandle(HFILE hFile,
35 PHFILE phFile);
36
37APIRET xDosForceDelete(PSZ pszFileName);
38
39APIRET xDosQueryHType(HFILE hFile,
40 PULONG pulType,
41 PULONG pulAttr);
42
43APIRET xDosQueryAppType(PCSZ pszName,
44 PULONG pFlags);
45
46#ifdef INCL_DOSSESMGR
47APIRET xDosStartSession(PSTARTDATA psd,
48 PULONG pulSessionID,
49 PPID ppid);
50#endif
51
52// Functions wrapped for other reasons
53
54APIRET xDosAllocMem(PPVOID ppb,
55 ULONG cb,
56 PCSZ pszSrcFile,
57 UINT uiLineNumber);
58
59APIRET xDosAllocMemLow(PPVOID ppb,
60 ULONG cb,
61 PCSZ pszSrcFile,
62 UINT uiLineNumber);
63
64APIRET xDosAllocSharedMem(PPVOID ppb,
65 PSZ pszName,
66 ULONG cb,
67 PCSZ pszSrcFile,
68 UINT uiLineNumber);
69
70APIRET xDosFindFirst(PSZ pszFileSpec,
71 PHDIR phdir,
72 ULONG flAttribute,
73 PVOID pfindbuf,
74 ULONG cbBuf,
75 PULONG pcFileNames,
76 ULONG ulInfoLevel);
77
78APIRET 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
85APIRET xDosGetInfoBlocks(PTIB *pptib,
86 PPIB *pppib); // 2015-08-09 SHL added
87#endif
88
89#ifdef INCL_DOSSEMAPHORES // HMTX HEV
90APIRET xDosRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
91APIRET xDosReleaseMutexSem(HMTX hmtx);
92APIRET xDosCreateEventSem (PSZ pszName,PHEV phev, ULONG flAttr, BOOL32 fState);
93APIRET xDosWaitEventSem(HEV hev, ULONG ulTimeout);
94APIRET xDosPostEventSem(HEV hev);
95APIRET xDosResetEventSem(HEV hev, PULONG pulPostCt);
96#endif
97
98APIRET xDosSetPathInfo(PSZ pszPathName,
99 ULONG ulInfoLevel,
100 PVOID pInfoBuf,
101 ULONG cbInfoBuf,
102 ULONG flOptions);
103
104PSZ xfgets(PSZ pszBuf, size_t cMaxBytes, FILE * fp, PCSZ pszSrcFile,
105 UINT uiLineNumber);
106PSZ xfgets_bstripcr(PSZ pszBuf, size_t cMaxBytes, FILE * fp, PCSZ pszSrcFile,
107 UINT uiLineNumber);
108FILE *xfopen(PCSZ pszFileName, PCSZ pszMode, PCSZ pszSrcFile,
109 UINT uiLineNumber, BOOL fSilent);
110VOID xfree(PVOID pv, PCSZ pszSrcFile, UINT uiLineNumber);
111FILE *xfsopen(PCSZ pszFileName, PCSZ pszMode, INT fSharemode, PCSZ pszSrcFile,
112 UINT uiLineNumber, BOOL fSilent);
113PVOID xmalloc(size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
114PVOID xmallocz(size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
115PVOID xrealloc(PVOID pvIn, size_t cBytes, PCSZ pszSrcFile, UINT uiLineNumber);
116PVOID xstrdup(PCSZ pszIn, PCSZ pszSrcFile, UINT uiLineNumber);
117
118#define HIGH_MEMORY_ADDRESS(p) (((ULONG)p) >= (512*1024*1024))
119
120// Data declarations
121extern BOOL fNoLargeFileSupport;
122
123
124#endif // WRAPPERS_H
Note: See TracBrowser for help on using the repository browser.