source: trunk/src/kernel32/hmstd.cpp@ 5303

Last change on this file since 5303 was 5303, checked in by sandervl, 24 years ago

SearchPath & pe loader fixes

File size: 8.9 KB
Line 
1/* $Id: hmstd.cpp,v 1.2 2001-03-12 14:16:33 sandervl Exp $ */
2
3/*
4 * Handle Manager class for standard in, out & error handles
5 *
6 * Project Odin Software License can be found in LICENSE.TXT
7 * Win32 Unified Handle Manager for OS/2
8 * Copyright 1999 Patrick Haller (haller@zebra.fh-weingarten.de)
9 */
10
11
12/*****************************************************************************
13 * Remark *
14 *****************************************************************************
15
16 */
17
18
19/*****************************************************************************
20 * Includes *
21 *****************************************************************************/
22
23#include <os2win.h>
24#include <stdlib.h>
25#include <string.h>
26#include "unicode.h"
27#include "misc.h"
28
29#include "HandleManager.H"
30#include "hmstd.h"
31
32#define DBG_LOCALLOG DBG_hmstd
33#include "dbglocal.h"
34
35/*****************************************************************************
36 * Defines *
37 *****************************************************************************/
38
39/*****************************************************************************
40 * Structures *
41 *****************************************************************************/
42
43/*****************************************************************************
44 * Local Prototypes *
45 *****************************************************************************/
46
47
48
49/*****************************************************************************
50 * Name : BOOL HMDeviceStandardClass::ReadFile
51 * Purpose : read data from handle / device
52 * Parameters: PHMHANDLEDATA pHMHandleData,
53 * LPCVOID lpBuffer,
54 * DWORD nNumberOfBytesToRead,
55 * LPDWORD lpNumberOfBytesRead,
56 * LPOVERLAPPED lpOverlapped
57 * Variables :
58 * Result : Boolean
59 * Remark :
60 * Status :
61 *
62 * Author : Patrick Haller [Wed, 1998/02/11 20:44]
63 *****************************************************************************/
64
65BOOL HMDeviceStandardClass::ReadFile(PHMHANDLEDATA pHMHandleData,
66 LPCVOID lpBuffer,
67 DWORD nNumberOfBytesToRead,
68 LPDWORD lpNumberOfBytesRead,
69 LPOVERLAPPED lpOverlapped)
70{
71 BOOL bRC;
72 DWORD bytesread;
73
74 dprintf2(("KERNEL32: HMDeviceStandardClass::ReadFile %s(%08x,%08x,%08x,%08x,%08x) - NOT IMPLEMENTED\n",
75 lpHMDeviceName,
76 pHMHandleData,
77 lpBuffer,
78 nNumberOfBytesToRead,
79 lpNumberOfBytesRead,
80 lpOverlapped));
81
82
83 if(lpNumberOfBytesRead == NULL) {
84 lpNumberOfBytesRead = &bytesread;
85 }
86 if(pHMHandleData->dwUserData != STD_INPUT_HANDLE) {
87 return FALSE;
88 }
89 return O32_ReadFile(pHMHandleData->hHMHandle, (LPVOID)lpBuffer, nNumberOfBytesToRead,
90 lpNumberOfBytesRead, lpOverlapped);
91}
92
93/*****************************************************************************
94 * Name : BOOL ReadFileEx
95 * Purpose : The ReadFileEx function reads data from a file asynchronously.
96 * It is designed solely for asynchronous operation, unlike the
97 * ReadFile function, which is designed for both synchronous and
98 * asynchronous operation. ReadFileEx lets an application perform
99 * other processing during a file read operation.
100 * The ReadFileEx function reports its completion status asynchronously,
101 * calling a specified completion routine when reading is completed
102 * and the calling thread is in an alertable wait state.
103 * Parameters: HANDLE hFile handle of file to read
104 * LPVOID lpBuffer address of buffer
105 * DWORD nNumberOfBytesToRead number of bytes to read
106 * LPOVERLAPPED lpOverlapped address of offset
107 * LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine address of completion routine
108 * Variables :
109 * Result : TRUE / FALSE
110 * Remark :
111 * Status : UNTESTED STUB
112 *
113 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
114 *****************************************************************************/
115BOOL HMDeviceStandardClass::ReadFileEx(PHMHANDLEDATA pHMHandleData,
116 LPVOID lpBuffer,
117 DWORD nNumberOfBytesToRead,
118 LPOVERLAPPED lpOverlapped,
119 LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
120{
121 dprintf(("ERROR: ReadFileEx(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
122 pHMHandleData->hHMHandle,
123 lpBuffer,
124 nNumberOfBytesToRead,
125 lpOverlapped,
126 lpCompletionRoutine));
127
128 return FALSE;
129}
130
131
132/*****************************************************************************
133 * Name : BOOL HMDeviceStandardClass::WriteFile
134 * Purpose : write data to handle / device
135 * Parameters: PHMHANDLEDATA pHMHandleData,
136 * LPCVOID lpBuffer,
137 * DWORD nNumberOfBytesToWrite,
138 * LPDWORD lpNumberOfBytesWritten,
139 * LPOVERLAPPED lpOverlapped
140 * Variables :
141 * Result : Boolean
142 * Remark :
143 * Status :
144 *
145 * Author : Patrick Haller [Wed, 1998/02/11 20:44]
146 *****************************************************************************/
147
148BOOL HMDeviceStandardClass::WriteFile(PHMHANDLEDATA pHMHandleData,
149 LPCVOID lpBuffer,
150 DWORD nNumberOfBytesToWrite,
151 LPDWORD lpNumberOfBytesWritten,
152 LPOVERLAPPED lpOverlapped)
153{
154 DWORD byteswritten;
155
156 dprintf2(("KERNEL32: HMDeviceStandardClass::WriteFile %s(%08x,%08x,%08x,%08x,%08x) - stub?\n",
157 lpHMDeviceName,
158 pHMHandleData,
159 lpBuffer,
160 nNumberOfBytesToWrite,
161 lpNumberOfBytesWritten,
162 lpOverlapped));
163 if(lpNumberOfBytesWritten == NULL) {
164 lpNumberOfBytesWritten = &byteswritten;
165 }
166 if(pHMHandleData->dwUserData == STD_INPUT_HANDLE) {
167 return FALSE;
168 }
169 return O32_WriteFile(pHMHandleData->hHMHandle, lpBuffer, nNumberOfBytesToWrite,
170 lpNumberOfBytesWritten, lpOverlapped);
171}
172
173/*****************************************************************************
174 * Name : BOOL WriteFileEx
175 * Purpose : The WriteFileEx function writes data to a file. It is designed
176 * solely for asynchronous operation, unlike WriteFile, which is
177 * designed for both synchronous and asynchronous operation.
178 * WriteFileEx reports its completion status asynchronously,
179 * calling a specified completion routine when writing is completed
180 * and the calling thread is in an alertable wait state.
181 * Parameters: HANDLE hFile handle of file to write
182 * LPVOID lpBuffer address of buffer
183 * DWORD nNumberOfBytesToRead number of bytes to write
184 * LPOVERLAPPED lpOverlapped address of offset
185 * LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine address of completion routine
186 * Variables :
187 * Result : TRUE / FALSE
188 * Remark :
189 * Status : UNTESTED STUB
190 *
191 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
192 *****************************************************************************/
193
194BOOL HMDeviceStandardClass::WriteFileEx(PHMHANDLEDATA pHMHandleData,
195 LPVOID lpBuffer,
196 DWORD nNumberOfBytesToWrite,
197 LPOVERLAPPED lpOverlapped,
198 LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
199{
200 dprintf(("ERROR: WriteFileEx(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
201 pHMHandleData->hHMHandle,
202 lpBuffer,
203 nNumberOfBytesToWrite,
204 lpOverlapped,
205 lpCompletionRoutine));
206 return FALSE;
207}
208
209/*****************************************************************************
210 * Name : DWORD HMDeviceStandardClass::GetFileType
211 * Purpose : determine the handle type
212 * Parameters: PHMHANDLEDATA pHMHandleData
213 * Variables :
214 * Result : API returncode
215 * Remark :
216 * Status :
217 *
218 * Author : Patrick Haller [Wed, 1998/02/11 20:44]
219 *****************************************************************************/
220
221DWORD HMDeviceStandardClass::GetFileType(PHMHANDLEDATA pHMHandleData)
222{
223 dprintf2(("KERNEL32: HMDeviceStandardClass::GetFileType %s(%08x)\n",
224 lpHMDeviceName,
225 pHMHandleData));
226
227 return FILE_TYPE_CHAR;
228}
Note: See TracBrowser for help on using the repository browser.