source: trunk/include/HandleManager.h@ 271

Last change on this file since 271 was 271, checked in by phaller, 26 years ago

Fix: streamlined Handlemanager

File size: 7.3 KB
RevLine 
[271]1/* $Id: HandleManager.h,v 1.3 1999-07-05 09:58:13 phaller Exp $ */
[262]2
3/*
4 * Project Odin Software License can be found in LICENSE.TXT
5 * Win32 Unified Handle Manager for OS/2
6 * 1998/02/11 PH Patrick Haller (haller@zebra.fh-weingarten.de)
7 *
8 * @(#) HandleManager.Cpp 1.0.0 1998/02/11 PH start
9 */
10
11#ifndef _HANDLEMANAGER_H_
12#define _HANDLEMANAGER_H_
13
14
15/*****************************************************************************
16 * Remark *
17 *****************************************************************************
18
19 1998/02/11 PH The interface to the handle manager is twofold:
20 a) HMxxx routines to be called from the "top" from the
21 KERNEL32 stubs
22 b) the HMDeviceHandler class is actually a workaround for
23 the device driver that would handle the requests on Win32.
24 To implement a new pseudo-device, one has create a new
25 HMDeviceHandler class and link it into the table in the
26 HANDLEMANAGER.CPP file.
27 */
28
29
30/*****************************************************************************
31 * Includes *
32 *****************************************************************************/
33
34#ifdef _OS2WIN_H
35#include <winos2def.h>
36#else
37typedef struct {
38 DWORD Internal;
39 DWORD InternalHigh;
40 DWORD Offset;
41 DWORD OffsetHigh;
42 HANDLE hEvent;
43} OVERLAPPED, *POVERLAPPED, *LPOVERLAPPED;
44#endif
45
46
47/*****************************************************************************
48 * Defines & Macros *
49 *****************************************************************************/
50
51 /* 1998/02/12 PH Correction of os2win.h */
52#undef FILE_TYPE_UNKNOWN
53#define FILE_TYPE_UNKNOWN 0x0000
54
55#undef FILE_TYPE_DISK
56#define FILE_TYPE_DISK 0x0001
57
58#undef FILE_TYPE_CHAR
59#define FILE_TYPE_CHAR 0x0002
60
61#undef FILE_TYPE_PIPE
62#define FILE_TYPE_PIPE 0x0003
63
64#undef FILE_TYPE_REMOTE
65#define FILE_TYPE_REMOTE 0x8000
66
67#ifndef INVALID_HANDLE_ERROR
68#define INVALID_HANDLE_ERROR (-1)
69#endif
70
71
72/*****************************************************************************
73 * Structures *
74 *****************************************************************************/
75
76
77/*****************************************************************************
78 * Prototypes *
79 *****************************************************************************/
80
81DWORD HMInitialize(void); /* initialize the HandleManager */
82
83DWORD HMTerminate(void); /* terminate the HandleManager */
84
85
86 /* handle manager version of GetStdHandle, Open32 can't really help us here */
87HANDLE HMGetStdHandle(DWORD nStdHandle);
88
89 /* handle manager version of GetStdHandle, Open32 can't really help us here */
90BOOL HMSetStdHandle(DWORD nStdHandle,
91 HANDLE hHandle);
92
93
94/*****************************************************************************/
95/* handle translation buffer management */
96/* */
97/* Since some Win32 applications rely (!) on 16-bit handles, we've got to do */
98/* 32-bit to 16-bit and vs vsa translation here. */
99/* Filehandle-based functions should be routed via the handlemanager instead */
100/* of going to Open32 directly. */
101/*****************************************************************************/
102
103DWORD HMHandleAllocate (PULONG phHandle16,
104 ULONG hHandle32);
105
106DWORD HMHandleFree (ULONG hHandle16);
107
108DWORD HMHandleValidate (ULONG hHandle16);
109
110DWORD HMHandleTranslateToWin (ULONG hHandle32,
111 PULONG phHandle16);
112
113DWORD HMHandleTranslateToOS2 (ULONG hHandle16,
114 PULONG hHandle32);
115
116DWORD HMHandleTranslateToOS2i(ULONG hHandle16);
117
118
119/*****************************************************************************
120 * Forwarders *
121 *****************************************************************************/
122
123// enable C linkage to avoid parameter mangling
124#ifdef __cplusplus__
125extern "C" {
126#endif
127
128HFILE HMCreateFile(LPCSTR lpFileName,
129 DWORD dwDesiredAccess,
130 DWORD dwShareMode,
131 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
132 DWORD dwCreationDisposition,
133 DWORD dwFlagsAndAttributes,
134 HANDLE hTemplateFile);
135
136HANDLE HMOpenFile(LPCSTR lpFileName,
137 OFSTRUCT* pOFStruct,
138 UINT fuMode);
139
140BOOL HMCloseHandle(HANDLE hObject);
141
142BOOL HMReadFile(HANDLE hFile,
143 LPVOID lpBuffer,
144 DWORD nNumberOfBytesToRead,
145 LPDWORD lpNumberOfBytesRead,
146 LPOVERLAPPED lpOverlapped);
147
148BOOL HMWriteFile(HANDLE hFile,
149 LPCVOID lpBuffer,
150 DWORD nNumberOfBytesToWrite,
151 LPDWORD lpNumberOfBytesWritten,
152 LPOVERLAPPED lpOverlapped);
153
154DWORD HMGetFileType(HANDLE hFile);
155
156DWORD HMDeviceRequest (HANDLE hFile,
157 ULONG ulRequestCode,
158 ULONG arg1,
159 ULONG arg2,
160 ULONG arg3,
161 ULONG arg4);
162
163DWORD HMGetFileInformationByHandle (HANDLE hFile,
164 BY_HANDLE_FILE_INFORMATION *pHFI);
165
166BOOL HMSetEndOfFile (HANDLE hFile);
167
168BOOL HMSetFileTime (HANDLE hFile,
169 const FILETIME *pFT1,
170 const FILETIME *pFT2,
171 const FILETIME *pFT3);
172
173DWORD HMGetFileSize (HANDLE hFile,
174 PDWORD pSize);
175
176DWORD HMSetFilePointer (HANDLE hFile,
177 LONG lDistanceToMove,
178 PLONG lpDistanceToMoveHigh,
179 DWORD dwMoveMethod);
180
181BOOL HMLockFile (HFILE hFile,
182 DWORD arg2,
183 DWORD arg3,
184 DWORD arg4,
185 DWORD arg5);
186
187DWORD HMLockFileEx(HANDLE hFile,
188 DWORD dwFlags,
189 DWORD dwReserved,
190 DWORD nNumberOfBytesToLockLow,
191 DWORD nNumberOfBytesToLockHigh,
192 LPOVERLAPPED lpOverlapped);
193
194BOOL HMUnlockFile (HFILE hFile,
195 DWORD arg2,
196 DWORD arg3,
197 DWORD arg4,
198 DWORD arg5);
199
200BOOL HMUnlockFileEx(HANDLE hFile,
201 DWORD dwFlags,
202 DWORD dwReserved,
203 DWORD nNumberOfBytesToLockLow,
204 DWORD nNumberOfBytesToLockHigh,
205 LPOVERLAPPED lpOverlapped);
206
207
208#ifdef __cplusplus__
209 }
210#endif
211
212#endif /* _HANDLEMANAGER_H_ */
Note: See TracBrowser for help on using the repository browser.