source: trunk/src/kernel32/hmdevice.h@ 275

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

Fix: streamlined Handlemanager

File size: 7.4 KB
Line 
1/* $Id: hmdevice.h,v 1.2 1999-07-05 09:58:14 phaller Exp $ */
2
3/*
4 * Project Odin Software License can be found in LICENSE.TXT
5 * Win32 Unified Handle Manager for OS/2
6 * 1999/06/17 PH Patrick Haller (phaller@gmx.net)
7 */
8
9#ifndef _HM_DEVICE_H_
10#define _HM_DEVICE_H_
11
12
13/*****************************************************************************
14 * Remark *
15 *****************************************************************************
16 */
17
18
19/*****************************************************************************
20 * Includes *
21 *****************************************************************************/
22
23
24/*****************************************************************************
25 * Structures *
26 *****************************************************************************/
27
28typedef struct _HMHANDLEDATA
29{
30 HANDLE hHMHandle; /* a copy of the OS/2 system handle */
31
32 DWORD dwType; /* handle type identifier */
33
34 DWORD dwAccess; /* access mode of the handle */
35 DWORD dwShare; /* share mode of the handle */
36 DWORD dwCreation; /* dwCreationDisposition */
37 DWORD dwFlags; /* flags and attributes */
38
39 LPVOID lpHandlerData; /* for private use of the device handler */
40} HMHANDLEDATA, *PHMHANDLEDATA;
41
42
43
44class HMDeviceHandler
45{
46 /***************************************************************************
47 * The following methods are called by the handle manager request router. *
48 * They are exact replacements for the corresponding Win32 calls. *
49 ***************************************************************************/
50
51public:
52 LPCSTR lpHMDeviceName; /* a reference to the device name */
53
54 HMDeviceHandler(LPCSTR lpDeviceName); /* constructor with device name */
55
56
57 /***********************************
58 * handle generic standard methods *
59 ***********************************/
60
61 /* this is a special internal method to handle non-standard requests */
62 /* such as GetConsoleMode() for console devices */
63 virtual DWORD _DeviceRequest (PHMHANDLEDATA pHMHandleData,
64 ULONG ulRequestCode,
65 ULONG arg1,
66 ULONG arg2,
67 ULONG arg3,
68 ULONG arg4);
69
70 /* this is a handler method for calls to CreateFile() */
71 virtual DWORD CreateFile (LPCSTR lpFileName,
72 PHMHANDLEDATA pHMHandleData,
73 PVOID lpSecurityAttributes,
74 PHMHANDLEDATA pHMHandleDataTemplate);
75
76 /* this is a handler method for calls to OpenFile() */
77 virtual DWORD OpenFile (LPCSTR lpFileName,
78 PHMHANDLEDATA pHMHandleData,
79 OFSTRUCT* pOFStruct,
80 UINT fuMode);
81
82 /* this is a handler method for calls to CloseHandle() */
83 virtual DWORD CloseHandle(PHMHANDLEDATA pHMHandleData);
84
85 /* this is a handler method for calls to ReadFile() */
86 virtual DWORD ReadFile (PHMHANDLEDATA pHMHandleData,
87 LPCVOID lpBuffer,
88 DWORD nNumberOfBytesToRead,
89 LPDWORD lpNumberOfBytesRead,
90 LPOVERLAPPED lpOverlapped);
91
92 /* this is a handler method for calls to WriteFile() */
93 virtual DWORD WriteFile (PHMHANDLEDATA pHMHandleData,
94 LPCVOID lpBuffer,
95 DWORD nNumberOfBytesToWrite,
96 LPDWORD lpNumberOfBytesWritten,
97 LPOVERLAPPED lpOverlapped);
98
99 /* this is a handler method for calls to GetFileType() */
100 virtual DWORD GetFileType (PHMHANDLEDATA pHMHandleData);
101
102
103 /* this is a handler method for calls to GetFileInformationByHandle() */
104 virtual DWORD GetFileInformationByHandle(PHMHANDLEDATA pHMHandleData,
105 BY_HANDLE_FILE_INFORMATION *pHFI);
106
107 /* this is a handler method for calls to SetEndOfFile() */
108 virtual BOOL SetEndOfFile(PHMHANDLEDATA pHMHandleData);
109
110 /* this is a handler method for calls to SetFileTime() */
111 virtual BOOL SetFileTime (PHMHANDLEDATA pHMHandleData,
112 LPFILETIME pFT1,
113 LPFILETIME pFT2,
114 LPFILETIME pFT3);
115
116 /* this is a handler method for calls to GetFileSize() */
117 virtual DWORD GetFileSize(PHMHANDLEDATA pHMHandleData,
118 PDWORD pSizeHigh);
119
120 /* this is a handler method for calls to SetFilePointer() */
121 virtual DWORD SetFilePointer(PHMHANDLEDATA pHMHandleData,
122 LONG lDistanceToMove,
123 PLONG lpDistanceToMoveHigh,
124 DWORD dwMoveMethod);
125
126 /* this is a handler method for calls to LockFile() */
127 virtual DWORD LockFile(PHMHANDLEDATA pHMHandleData,
128 DWORD arg2,
129 DWORD arg3,
130 DWORD arg4,
131 DWORD arg5);
132
133 /* this is a handler method for calls to LockFileEx() */
134 virtual DWORD LockFileEx(PHMHANDLEDATA pHMHandleData,
135 DWORD dwFlags,
136 DWORD dwReserved,
137 DWORD nNumberOfBytesToLockLow,
138 DWORD nNumberOfBytesToLockHigh,
139 LPOVERLAPPED lpOverlapped);
140
141 /* this is a handler method for calls to UnlockFile() */
142 virtual DWORD UnlockFile(PHMHANDLEDATA pHMHandleData,
143 DWORD arg2,
144 DWORD arg3,
145 DWORD arg4,
146 DWORD arg5);
147
148 /* this is a handler method for calls to UnlockFileEx() */
149 virtual DWORD UnlockFileEx(PHMHANDLEDATA pHMHandleData,
150 DWORD dwFlags,
151 DWORD dwReserved,
152 DWORD nNumberOfBytesToLockLow,
153 DWORD nNumberOfBytesToLockHigh,
154 LPOVERLAPPED lpOverlapped);
155};
156
157
158/*****************************************************************************
159 * Prototypes *
160 *****************************************************************************/
161
162 /* register a new device with the handle manager */
163DWORD HMDeviceRegister(PSZ pszDeviceName,
164 HMDeviceHandler *pDeviceHandler);
165
166
167#endif /* _HM_DEVICE_H_ */
168
Note: See TracBrowser for help on using the repository browser.