1 | /* $Id: kobjects.cpp,v 1.4 1999-08-31 21:03:26 phaller Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
5 | * Win32 compatibility file functions for OS/2
|
---|
6 | * Copyright 1998 Sander van Leeuven
|
---|
7 | * Copyright 1998 Patrick Haller
|
---|
8 | * Copyright 1998 Peter Fitzsimmons
|
---|
9 | * Copyright 1998 Knut St. Osmundsen
|
---|
10 | */
|
---|
11 |
|
---|
12 |
|
---|
13 | /*****************************************************************************
|
---|
14 | * Includes *
|
---|
15 | *****************************************************************************/
|
---|
16 | #include <os2win.h>
|
---|
17 | #include "misc.h"
|
---|
18 | #include "handlemanager.h"
|
---|
19 |
|
---|
20 |
|
---|
21 |
|
---|
22 | // REMARK: THIS IS IN PREPARATION FOR HANDLEMANAGER SUPPORT (PH) !!
|
---|
23 | //#define HMCreateEvent O32_CreateEvent
|
---|
24 | //#define HMCreateMutex O32_CreateMutex
|
---|
25 | //#define HMCreateSemaphore O32_CreateSemaphore
|
---|
26 | //#define HMSetEvent O32_SetEvent
|
---|
27 | //#define HMReleaseMutex O32_ReleaseMutex
|
---|
28 | //#define HMWaitForSingleObject O32_WaitForSingleObject
|
---|
29 | //#define HMWaitForSingleObjectEx O32_WaitForSingleObjectEx
|
---|
30 | //#define HMGetOverlappedResult O32_GetOverlappedResult
|
---|
31 | //#define HMOpenEvent O32_OpenEvent
|
---|
32 | //#define HMOpenMutex O32_OpenMutex
|
---|
33 | //#define HMOpenSemaphore O32_OpenSemaphore
|
---|
34 | //#define HMPulseEvent O32_PulseEvent
|
---|
35 | //#define HMReleaseSemaphore O32_ReleaseSemaphore
|
---|
36 | //#define HMResetEvent O32_ResetEvent
|
---|
37 | //#define HMWaitForMultipleObjects O32_WaitForMultipleObjects
|
---|
38 | //#define HMWaitForMultipleObjectsEx O32_WaitForMultipleObjectsEx
|
---|
39 | //#define HMFlushFileBuffers O32_FlushFileBuffers
|
---|
40 | #define HMSetHandleCount O32_SetHandleCount
|
---|
41 | #define HMGetHandleCount O32_GetHandleCount
|
---|
42 | //#define HMDuplicateHandle O32_DuplicateHandle
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 | /*****************************************************************************
|
---|
47 | * Defines *
|
---|
48 | *****************************************************************************/
|
---|
49 |
|
---|
50 | /* this define enables certain less important debug messages */
|
---|
51 | //#define DEBUG_LOCAL 1
|
---|
52 |
|
---|
53 |
|
---|
54 |
|
---|
55 | /*****************************************************************************
|
---|
56 | * Name : BOOL WIN32API CreateEventA
|
---|
57 | * Purpose : forward call to Open32
|
---|
58 | * Parameters:
|
---|
59 | * Variables :
|
---|
60 | * Result :
|
---|
61 | * Remark :
|
---|
62 | * Status :
|
---|
63 | *
|
---|
64 | * Author : Patrick Haller [Fri, 1998/06/12 03:44]
|
---|
65 | *****************************************************************************/
|
---|
66 |
|
---|
67 | HANDLE WIN32API CreateEventA(LPSECURITY_ATTRIBUTES lpsa,
|
---|
68 | BOOL fManualReset,
|
---|
69 | BOOL fInitialState,
|
---|
70 | LPCTSTR lpszEventName)
|
---|
71 | {
|
---|
72 | dprintf(("KERNEL32: CreateEventA(%08xh, %08xh, %08xh, %s)\n",
|
---|
73 | lpsa,
|
---|
74 | fManualReset,
|
---|
75 | fInitialState,
|
---|
76 | lpszEventName));
|
---|
77 |
|
---|
78 | return(HMCreateEvent(lpsa, /* create event semaphore */
|
---|
79 | fManualReset,
|
---|
80 | fInitialState,
|
---|
81 | lpszEventName));
|
---|
82 | }
|
---|
83 |
|
---|
84 |
|
---|
85 | /*****************************************************************************
|
---|
86 | * Name : BOOL WIN32API CreateEventW
|
---|
87 | * Purpose : forward call to Open32
|
---|
88 | * Parameters:
|
---|
89 | * Variables :
|
---|
90 | * Result :
|
---|
91 | * Remark : handle translation is done in CreateEventA
|
---|
92 | * Status :
|
---|
93 | *
|
---|
94 | * Author : Patrick Haller [Fri, 1998/06/12 03:44]
|
---|
95 | *****************************************************************************/
|
---|
96 |
|
---|
97 | HANDLE WIN32API CreateEventW(LPSECURITY_ATTRIBUTES arg1,
|
---|
98 | BOOL arg2,
|
---|
99 | BOOL arg3,
|
---|
100 | LPCWSTR arg4)
|
---|
101 | {
|
---|
102 | HANDLE rc;
|
---|
103 | char *astring;
|
---|
104 |
|
---|
105 | dprintf(("KERNEL32: CreateEventW(%08xh, %08xh, %08xh, %s)\n",
|
---|
106 | arg1,
|
---|
107 | arg2,
|
---|
108 | arg3,
|
---|
109 | arg4));
|
---|
110 |
|
---|
111 | astring = UnicodeToAsciiString((LPWSTR)arg4);
|
---|
112 |
|
---|
113 | rc = HMCreateEvent(arg1,
|
---|
114 | arg2,
|
---|
115 | arg3,
|
---|
116 | astring);
|
---|
117 |
|
---|
118 | FreeAsciiString(astring);
|
---|
119 |
|
---|
120 | return(rc);
|
---|
121 | }
|
---|
122 |
|
---|
123 |
|
---|
124 | /*****************************************************************************
|
---|
125 | * Name : BOOL WIN32API CreateMutexA
|
---|
126 | * Purpose : forward call to Open32
|
---|
127 | * Parameters:
|
---|
128 | * Variables :
|
---|
129 | * Result :
|
---|
130 | * Remark : handle translation is done in CreateMutexA
|
---|
131 | * Status :
|
---|
132 | *
|
---|
133 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
134 | *****************************************************************************/
|
---|
135 |
|
---|
136 | HANDLE WIN32API CreateMutexA(LPSECURITY_ATTRIBUTES lpsa,
|
---|
137 | BOOL fInitialOwner,
|
---|
138 | LPCTSTR lpszMutexName)
|
---|
139 | {
|
---|
140 | dprintf(("KERNEL32: CreateMutexA(%08xh,%08xh,%s)\n",
|
---|
141 | lpsa,
|
---|
142 | fInitialOwner,
|
---|
143 | lpszMutexName));
|
---|
144 |
|
---|
145 | return(HMCreateMutex(lpsa,
|
---|
146 | fInitialOwner,
|
---|
147 | lpszMutexName));
|
---|
148 | }
|
---|
149 |
|
---|
150 |
|
---|
151 | /*****************************************************************************
|
---|
152 | * Name : BOOL WIN32API CreateMutexW
|
---|
153 | * Purpose : forward call to Open32
|
---|
154 | * Parameters:
|
---|
155 | * Variables :
|
---|
156 | * Result :
|
---|
157 | * Remark : handle translation is done in CreateMutexW
|
---|
158 | * Status :
|
---|
159 | *
|
---|
160 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
161 | *****************************************************************************/
|
---|
162 |
|
---|
163 | HANDLE WIN32API CreateMutexW(PSECURITY_ATTRIBUTES arg1,
|
---|
164 | BOOL arg2,
|
---|
165 | LPCWSTR arg3)
|
---|
166 | {
|
---|
167 | HANDLE rc;
|
---|
168 | char *astring;
|
---|
169 |
|
---|
170 | dprintf(("KERNEL32: CreateMutexW(%08xh,%08xh,%08xh)\n",
|
---|
171 | arg1,
|
---|
172 | arg2,
|
---|
173 | arg3));
|
---|
174 |
|
---|
175 | astring = UnicodeToAsciiString((LPWSTR)arg3);
|
---|
176 | rc = HMCreateMutex(arg1,
|
---|
177 | arg2,
|
---|
178 | astring);
|
---|
179 | FreeAsciiString(astring);
|
---|
180 |
|
---|
181 | return(rc);
|
---|
182 | }
|
---|
183 |
|
---|
184 |
|
---|
185 | /*****************************************************************************
|
---|
186 | * Name : BOOL WIN32API ReleaseMutex
|
---|
187 | * Purpose : forward call to Open32
|
---|
188 | * Parameters:
|
---|
189 | * Variables :
|
---|
190 | * Result :
|
---|
191 | * Remark : handle translation is done in ReleaseMutex
|
---|
192 | * Status :
|
---|
193 | *
|
---|
194 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
195 | *****************************************************************************/
|
---|
196 |
|
---|
197 | BOOL WIN32API ReleaseMutex(HANDLE mutex)
|
---|
198 | {
|
---|
199 | dprintf(("KERNEL32: ReleaseMutex%08xh)\n",
|
---|
200 | mutex));
|
---|
201 |
|
---|
202 | return(HMReleaseMutex(mutex));
|
---|
203 | }
|
---|
204 |
|
---|
205 |
|
---|
206 | /*****************************************************************************
|
---|
207 | * Name : BOOL WIN32API SetEvent
|
---|
208 | * Purpose : forward call to Open32
|
---|
209 | * Parameters:
|
---|
210 | * Variables :
|
---|
211 | * Result :
|
---|
212 | * Remark : handle translation is done in SetEvent
|
---|
213 | * Status :
|
---|
214 | *
|
---|
215 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
216 | *****************************************************************************/
|
---|
217 |
|
---|
218 | BOOL WIN32API SetEvent(HANDLE hEvent)
|
---|
219 | {
|
---|
220 | dprintf(("KERNEL32: SetEvent(%08xh)\n",
|
---|
221 | hEvent));
|
---|
222 |
|
---|
223 | return(HMSetEvent(hEvent));
|
---|
224 | }
|
---|
225 |
|
---|
226 |
|
---|
227 | /*****************************************************************************
|
---|
228 | * Name : BOOL WIN32API WaitForSingleObject
|
---|
229 | * Purpose : forward call to Open32
|
---|
230 | * Parameters:
|
---|
231 | * Variables :
|
---|
232 | * Result :
|
---|
233 | * Remark : handle translation is done in WaitForSingleObject
|
---|
234 | * Status :
|
---|
235 | *
|
---|
236 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
237 | *****************************************************************************/
|
---|
238 |
|
---|
239 | DWORD WIN32API WaitForSingleObject(HANDLE hObject,
|
---|
240 | DWORD timeout)
|
---|
241 | {
|
---|
242 | dprintf(("KERNEL32: WaitForSingleObject (%08xh, %08xh)\n",
|
---|
243 | hObject,
|
---|
244 | timeout));
|
---|
245 |
|
---|
246 | return(HMWaitForSingleObject(hObject,
|
---|
247 | timeout));
|
---|
248 | }
|
---|
249 |
|
---|
250 |
|
---|
251 | /*****************************************************************************
|
---|
252 | * Name : DWORD OS2WaitForSingleObjectEx
|
---|
253 | * Purpose : The WaitForSingleObjectEx function is an extended wait function
|
---|
254 | * that can be used to perform an alertable wait. This enables the
|
---|
255 | * function to return when the system queues an I/O completion
|
---|
256 | * routine to be executed by the calling thread. The function also
|
---|
257 | * returns when the specified object is in the signaled state or
|
---|
258 | * when the time-out interval elapses.
|
---|
259 | * Parameters: HANDLE hObject handle of object to wait for
|
---|
260 | * DWORD dwTimeout time-out interval in milliseconds
|
---|
261 | * BOOL fAlertable alertable wait flag
|
---|
262 | * Variables :
|
---|
263 | * Result : 0xFFFFFFFF in case of error
|
---|
264 | * Remark : only really required for async I/O
|
---|
265 | * Status : UNTESTED STUB
|
---|
266 | *
|
---|
267 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
268 | *****************************************************************************/
|
---|
269 |
|
---|
270 | DWORD WIN32API WaitForSingleObjectEx(HANDLE hObject,
|
---|
271 | DWORD dwTimeout,
|
---|
272 | BOOL fAlertable)
|
---|
273 | {
|
---|
274 | dprintf(("Kernel32: WaitForSingleObjectEx(%08xh,%08xh,%08xh) not implemented correctly.\n",
|
---|
275 | hObject,
|
---|
276 | dwTimeout,
|
---|
277 | fAlertable));
|
---|
278 |
|
---|
279 | return(HMWaitForSingleObjectEx(hObject,
|
---|
280 | dwTimeout,
|
---|
281 | fAlertable));
|
---|
282 | }
|
---|
283 |
|
---|
284 |
|
---|
285 | /*****************************************************************************
|
---|
286 | * Name : BOOL WIN32API FlushFileBuffers
|
---|
287 | * Purpose : forward call to Open32
|
---|
288 | * Parameters:
|
---|
289 | * Variables :
|
---|
290 | * Result :
|
---|
291 | * Remark : handle translation is done in FlushFileBuffers
|
---|
292 | * Status :
|
---|
293 | *
|
---|
294 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
295 | *****************************************************************************/
|
---|
296 |
|
---|
297 | BOOL WIN32API FlushFileBuffers(HANDLE hFile)
|
---|
298 | {
|
---|
299 | dprintf(("KERNEL32: FlushFileBuffers(%08xh)\n",
|
---|
300 | hFile));
|
---|
301 |
|
---|
302 | return(HMFlushFileBuffers(hFile));
|
---|
303 | }
|
---|
304 |
|
---|
305 |
|
---|
306 | /*****************************************************************************
|
---|
307 | * Name : UINT WIN32API SetHandleCount
|
---|
308 | * Purpose : forward call to Open32
|
---|
309 | * Parameters:
|
---|
310 | * Variables :
|
---|
311 | * Result :
|
---|
312 | * Remark : handle translation is done in SetHandleCount
|
---|
313 | * Status :
|
---|
314 | *
|
---|
315 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
316 | *****************************************************************************/
|
---|
317 |
|
---|
318 | UINT WIN32API SetHandleCount(UINT cHandles)
|
---|
319 | {
|
---|
320 | dprintf(("KERNEL32: SetHandleCount(%08xh)\n",
|
---|
321 | cHandles));
|
---|
322 |
|
---|
323 | return(HMSetHandleCount(cHandles));
|
---|
324 | }
|
---|
325 |
|
---|
326 |
|
---|
327 | /*****************************************************************************
|
---|
328 | * Name : BOOL WIN32API DuplicateHandle
|
---|
329 | * Purpose : forward call to Open32
|
---|
330 | * Parameters:
|
---|
331 | * Variables :
|
---|
332 | * Result :
|
---|
333 | * Remark : handle translation is done in DuplicateHandle
|
---|
334 | * Status :
|
---|
335 | *
|
---|
336 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
337 | *****************************************************************************/
|
---|
338 |
|
---|
339 | //******************************************************************************
|
---|
340 | //SvL: 24-6-'97 - Added
|
---|
341 | //SvL: 28-6-'97: Fix for timeSetEvent in Red Alert Map Editor
|
---|
342 | //******************************************************************************
|
---|
343 | BOOL WIN32API DuplicateHandle(HANDLE srcprocess,
|
---|
344 | HANDLE srchandle,
|
---|
345 | HANDLE destprocess,
|
---|
346 | PHANDLE desthandle,
|
---|
347 | DWORD arg5,
|
---|
348 | BOOL arg6,
|
---|
349 | DWORD arg7)
|
---|
350 | {
|
---|
351 | BOOL rc;
|
---|
352 |
|
---|
353 | dprintf(("KERNEL32: DuplicateHandle(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
|
---|
354 | srcprocess,
|
---|
355 | srchandle,
|
---|
356 | destprocess,
|
---|
357 | desthandle,
|
---|
358 | arg5,
|
---|
359 | arg6,
|
---|
360 | arg7));
|
---|
361 |
|
---|
362 | rc = HMDuplicateHandle(srcprocess,
|
---|
363 | srchandle,
|
---|
364 | destprocess,
|
---|
365 | desthandle,
|
---|
366 | arg5,
|
---|
367 | arg6,
|
---|
368 | arg7);
|
---|
369 | //@@@PH: (temporary) fix for non-HandleManager handles
|
---|
370 | if (rc == FALSE)
|
---|
371 | rc = O32_DuplicateHandle(srcprocess,
|
---|
372 | srchandle,
|
---|
373 | destprocess,
|
---|
374 | desthandle,
|
---|
375 | arg5,
|
---|
376 | arg6,
|
---|
377 | arg7);
|
---|
378 |
|
---|
379 | return(rc);
|
---|
380 | }
|
---|
381 |
|
---|
382 |
|
---|
383 | /*****************************************************************************
|
---|
384 | * Name : BOOL WIN32API CreateSemaphoreA
|
---|
385 | * Purpose : forward call to Open32
|
---|
386 | * Parameters:
|
---|
387 | * Variables :
|
---|
388 | * Result :
|
---|
389 | * Remark : handle translation is done in CreateSemaphoreA
|
---|
390 | * Status :
|
---|
391 | *
|
---|
392 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
393 | *****************************************************************************/
|
---|
394 |
|
---|
395 | HANDLE WIN32API CreateSemaphoreA(LPSECURITY_ATTRIBUTES arg1,
|
---|
396 | LONG arg2,
|
---|
397 | LONG arg3,
|
---|
398 | LPCSTR arg4)
|
---|
399 | {
|
---|
400 | dprintf(("KERNEL32: CreateSemaphoreA(%08xh,%08xh,%08xh,%s)\n",
|
---|
401 | arg1,
|
---|
402 | arg2,
|
---|
403 | arg3,
|
---|
404 | arg4));
|
---|
405 |
|
---|
406 | return HMCreateSemaphore(arg1,
|
---|
407 | arg2,
|
---|
408 | arg3,
|
---|
409 | (LPSTR)arg4);
|
---|
410 | }
|
---|
411 |
|
---|
412 |
|
---|
413 | /*****************************************************************************
|
---|
414 | * Name : BOOL WIN32API CreateSemaphoreW
|
---|
415 | * Purpose : forward call to Open32
|
---|
416 | * Parameters:
|
---|
417 | * Variables :
|
---|
418 | * Result :
|
---|
419 | * Remark : handle translation is done in CreateSemaphoreW
|
---|
420 | * Status :
|
---|
421 | *
|
---|
422 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
423 | *****************************************************************************/
|
---|
424 |
|
---|
425 | HANDLE WIN32API CreateSemaphoreW(PSECURITY_ATTRIBUTES arg1,
|
---|
426 | LONG arg2,
|
---|
427 | LONG arg3,
|
---|
428 | LPCWSTR arg4)
|
---|
429 | {
|
---|
430 | HANDLE rc;
|
---|
431 | char *astring;
|
---|
432 |
|
---|
433 | dprintf(("KERNEL32: CreateSemaphoreW(%08xh,%08xh,%08xh,%08xh)\n",
|
---|
434 | arg1,
|
---|
435 | arg2,
|
---|
436 | arg3,
|
---|
437 | arg4));
|
---|
438 |
|
---|
439 | astring = UnicodeToAsciiString((LPWSTR)arg4);
|
---|
440 | rc = HMCreateSemaphore(arg1,
|
---|
441 | arg2,
|
---|
442 | arg3,
|
---|
443 | astring);
|
---|
444 | FreeAsciiString(astring);
|
---|
445 | return(rc);
|
---|
446 | }
|
---|
447 |
|
---|
448 |
|
---|
449 | /*****************************************************************************
|
---|
450 | * Name : BOOL WIN32API GetOverlappedResult
|
---|
451 | * Purpose : forward call to Open32
|
---|
452 | * Parameters:
|
---|
453 | * Variables :
|
---|
454 | * Result :
|
---|
455 | * Remark : handle translation is done in GetOverlappedResult
|
---|
456 | * Status :
|
---|
457 | *
|
---|
458 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
459 | *****************************************************************************/
|
---|
460 |
|
---|
461 | BOOL WIN32API GetOverlappedResult(HANDLE arg1,
|
---|
462 | LPOVERLAPPED arg2,
|
---|
463 | LPDWORD arg3,
|
---|
464 | BOOL arg4)
|
---|
465 | {
|
---|
466 | dprintf(("KERNEL32: GetOverlappedResult (%08xh,%08xh,%08xh,%08xh)\n",
|
---|
467 | arg1,
|
---|
468 | arg2,
|
---|
469 | arg3,
|
---|
470 | arg4));
|
---|
471 |
|
---|
472 | return HMGetOverlappedResult(arg1,
|
---|
473 | arg2,
|
---|
474 | arg3,
|
---|
475 | arg4);
|
---|
476 | }
|
---|
477 |
|
---|
478 |
|
---|
479 | /*****************************************************************************
|
---|
480 | * Name : BOOL WIN32API OpenEventA
|
---|
481 | * Purpose : forward call to Open32
|
---|
482 | * Parameters:
|
---|
483 | * Variables :
|
---|
484 | * Result :
|
---|
485 | * Remark : handle translation is done in OpenEventA
|
---|
486 | * Status :
|
---|
487 | *
|
---|
488 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
489 | *****************************************************************************/
|
---|
490 |
|
---|
491 | HANDLE WIN32API OpenEventA(DWORD arg1,
|
---|
492 | BOOL arg2,
|
---|
493 | LPCSTR arg3)
|
---|
494 | {
|
---|
495 | dprintf(("KERNEL32: OpenEventA(%08xh,%08xh,%s)\n",
|
---|
496 | arg1,
|
---|
497 | arg2,
|
---|
498 | arg3));
|
---|
499 |
|
---|
500 | return HMOpenEvent(arg1,
|
---|
501 | arg2,
|
---|
502 | arg3);
|
---|
503 | }
|
---|
504 |
|
---|
505 |
|
---|
506 | /*****************************************************************************
|
---|
507 | * Name : BOOL WIN32API OpenEventW
|
---|
508 | * Purpose : forward call to Open32
|
---|
509 | * Parameters:
|
---|
510 | * Variables :
|
---|
511 | * Result :
|
---|
512 | * Remark : handle translation is done in OpenEventW
|
---|
513 | * Status :
|
---|
514 | *
|
---|
515 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
516 | *****************************************************************************/
|
---|
517 |
|
---|
518 | HANDLE WIN32API OpenEventW(DWORD dwDesiredAccess,
|
---|
519 | BOOL bInheritHandle,
|
---|
520 | LPCWSTR lpName)
|
---|
521 | {
|
---|
522 | char *asciiname;
|
---|
523 | HANDLE rc;
|
---|
524 |
|
---|
525 | dprintf(("KERNEL32: OpenEventW(%08xh,%08xh,%08xh\n",
|
---|
526 | dwDesiredAccess,
|
---|
527 | bInheritHandle,
|
---|
528 | lpName));
|
---|
529 |
|
---|
530 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
531 | rc = HMOpenEvent(dwDesiredAccess,
|
---|
532 | bInheritHandle,
|
---|
533 | asciiname);
|
---|
534 | FreeAsciiString(asciiname);
|
---|
535 | return(rc);
|
---|
536 | }
|
---|
537 |
|
---|
538 |
|
---|
539 | /*****************************************************************************
|
---|
540 | * Name : BOOL WIN32API OpenMutexA
|
---|
541 | * Purpose : forward call to Open32
|
---|
542 | * Parameters:
|
---|
543 | * Variables :
|
---|
544 | * Result :
|
---|
545 | * Remark : handle translation is done in OpenMutexA
|
---|
546 | * Status :
|
---|
547 | *
|
---|
548 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
549 | *****************************************************************************/
|
---|
550 |
|
---|
551 | HANDLE WIN32API OpenMutexA(DWORD arg1,
|
---|
552 | BOOL arg2,
|
---|
553 | LPCSTR arg3)
|
---|
554 | {
|
---|
555 | dprintf(("KERNEL32: OpenMutexA(%08xh,%08xh,%s)\n",
|
---|
556 | arg1,
|
---|
557 | arg2,
|
---|
558 | arg3));
|
---|
559 |
|
---|
560 | return HMOpenMutex(arg1,
|
---|
561 | arg2,
|
---|
562 | arg3);
|
---|
563 | }
|
---|
564 |
|
---|
565 |
|
---|
566 | /*****************************************************************************
|
---|
567 | * Name : BOOL WIN32API OpenMutexW
|
---|
568 | * Purpose : forward call to Open32
|
---|
569 | * Parameters:
|
---|
570 | * Variables :
|
---|
571 | * Result :
|
---|
572 | * Remark : handle translation is done in OpenMutexW
|
---|
573 | * Status :
|
---|
574 | *
|
---|
575 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
576 | *****************************************************************************/
|
---|
577 |
|
---|
578 | HANDLE WIN32API OpenMutexW(DWORD dwDesiredAccess,
|
---|
579 | BOOL bInheritHandle,
|
---|
580 | LPCWSTR lpName)
|
---|
581 | {
|
---|
582 | char *asciiname;
|
---|
583 | HANDLE rc;
|
---|
584 |
|
---|
585 | dprintf(("KERNEL32: OpenMutexW(%08xh,%08xh,%08xh)\n",
|
---|
586 | dwDesiredAccess,
|
---|
587 | bInheritHandle,
|
---|
588 | lpName));
|
---|
589 |
|
---|
590 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
591 | rc = HMOpenMutex(dwDesiredAccess,
|
---|
592 | bInheritHandle,
|
---|
593 | asciiname);
|
---|
594 | FreeAsciiString(asciiname);
|
---|
595 | return(rc);
|
---|
596 | }
|
---|
597 |
|
---|
598 |
|
---|
599 | /*****************************************************************************
|
---|
600 | * Name : BOOL WIN32API OpenSemaphoreA
|
---|
601 | * Purpose : forward call to Open32
|
---|
602 | * Parameters:
|
---|
603 | * Variables :
|
---|
604 | * Result :
|
---|
605 | * Remark : handle translation is done in OpenSemaphoreA
|
---|
606 | * Status :
|
---|
607 | *
|
---|
608 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
609 | *****************************************************************************/
|
---|
610 |
|
---|
611 | HANDLE WIN32API OpenSemaphoreA(DWORD arg1,
|
---|
612 | BOOL arg2,
|
---|
613 | LPCSTR arg3)
|
---|
614 | {
|
---|
615 | dprintf(("KERNEL32: OpenSemaphoreA(%08xh,%08xh,%s)\n",
|
---|
616 | arg1,
|
---|
617 | arg2,
|
---|
618 | arg3));
|
---|
619 |
|
---|
620 | return HMOpenSemaphore(arg1,
|
---|
621 | arg2,
|
---|
622 | arg3);
|
---|
623 | }
|
---|
624 |
|
---|
625 |
|
---|
626 | /*****************************************************************************
|
---|
627 | * Name : BOOL WIN32API OpenSemaphoreW
|
---|
628 | * Purpose : forward call to Open32
|
---|
629 | * Parameters:
|
---|
630 | * Variables :
|
---|
631 | * Result :
|
---|
632 | * Remark : handle translation is done in OpenSemaphoreW
|
---|
633 | * Status :
|
---|
634 | *
|
---|
635 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
636 | *****************************************************************************/
|
---|
637 |
|
---|
638 | HANDLE WIN32API OpenSemaphoreW(DWORD dwDesiredAccess,
|
---|
639 | BOOL bInheritHandle,
|
---|
640 | LPCWSTR lpName)
|
---|
641 | {
|
---|
642 | char *asciiname;
|
---|
643 | HANDLE rc;
|
---|
644 |
|
---|
645 | dprintf(("KERNEL32: OpenSemaphoreW(%08xh,%08xh,%08xh)\n",
|
---|
646 | dwDesiredAccess,
|
---|
647 | bInheritHandle,
|
---|
648 | lpName));
|
---|
649 |
|
---|
650 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
651 | rc = HMOpenSemaphore(dwDesiredAccess,
|
---|
652 | bInheritHandle,
|
---|
653 | asciiname);
|
---|
654 | FreeAsciiString(asciiname);
|
---|
655 | return(rc);
|
---|
656 | }
|
---|
657 |
|
---|
658 |
|
---|
659 | /*****************************************************************************
|
---|
660 | * Name : BOOL WIN32API PulseEvent
|
---|
661 | * Purpose : forward call to Open32
|
---|
662 | * Parameters:
|
---|
663 | * Variables :
|
---|
664 | * Result :
|
---|
665 | * Remark : handle translation is done in PulseEvent
|
---|
666 | * Status :
|
---|
667 | *
|
---|
668 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
669 | *****************************************************************************/
|
---|
670 |
|
---|
671 | BOOL WIN32API PulseEvent(HANDLE arg1)
|
---|
672 | {
|
---|
673 | dprintf(("KERNEL32: PulseEvent(%08xh)\n",
|
---|
674 | arg1));
|
---|
675 |
|
---|
676 | return HMPulseEvent(arg1);
|
---|
677 | }
|
---|
678 |
|
---|
679 |
|
---|
680 | /*****************************************************************************
|
---|
681 | * Name : BOOL WIN32API ReleaseSemaphore
|
---|
682 | * Purpose : forward call to Open32
|
---|
683 | * Parameters:
|
---|
684 | * Variables :
|
---|
685 | * Result :
|
---|
686 | * Remark : handle translation is done in ReleaseSemaphore
|
---|
687 | * Status :
|
---|
688 | *
|
---|
689 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
690 | *****************************************************************************/
|
---|
691 |
|
---|
692 | BOOL WIN32API ReleaseSemaphore(HANDLE arg1,
|
---|
693 | LONG arg2,
|
---|
694 | PLONG arg3)
|
---|
695 | {
|
---|
696 | dprintf(("KERNEL32: ReleaseSemaphore(%08xh,%08xh,%08xh)\n",
|
---|
697 | arg1,
|
---|
698 | arg2,
|
---|
699 | arg3));
|
---|
700 |
|
---|
701 | return HMReleaseSemaphore(arg1,
|
---|
702 | arg2,
|
---|
703 | arg3);
|
---|
704 | }
|
---|
705 |
|
---|
706 |
|
---|
707 | /*****************************************************************************
|
---|
708 | * Name : BOOL WIN32API ResetEvent
|
---|
709 | * Purpose : forward call to Open32
|
---|
710 | * Parameters:
|
---|
711 | * Variables :
|
---|
712 | * Result :
|
---|
713 | * Remark : handle translation is done in ResetEvent
|
---|
714 | * Status :
|
---|
715 | *
|
---|
716 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
717 | *****************************************************************************/
|
---|
718 |
|
---|
719 | BOOL WIN32API ResetEvent(HANDLE arg1)
|
---|
720 | {
|
---|
721 | dprintf(("KERNEL32: ResetEvent(%08xh)\n",
|
---|
722 | arg1));
|
---|
723 |
|
---|
724 | return HMResetEvent(arg1);
|
---|
725 | }
|
---|
726 |
|
---|
727 |
|
---|
728 | /*****************************************************************************
|
---|
729 | * Name : BOOL WIN32API WaitForMultipleObjects
|
---|
730 | * Purpose : forward call to Open32
|
---|
731 | * Parameters:
|
---|
732 | * Variables :
|
---|
733 | * Result :
|
---|
734 | * Remark : handle translation is done in WaitForMultipleObjects
|
---|
735 | * Status :
|
---|
736 | *
|
---|
737 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
738 | *****************************************************************************/
|
---|
739 |
|
---|
740 | DWORD WIN32API WaitForMultipleObjects(DWORD arg1,
|
---|
741 | const HANDLE *arg2,
|
---|
742 | BOOL arg3,
|
---|
743 | DWORD arg4)
|
---|
744 | {
|
---|
745 | dprintf(("KERNEL32: OS2WaitForMultipleObjects(%08xh,%08xh,%08xh,%08xh)\n",
|
---|
746 | arg1,
|
---|
747 | arg2,
|
---|
748 | arg3,
|
---|
749 | arg4));
|
---|
750 |
|
---|
751 | return HMWaitForMultipleObjects(arg1,
|
---|
752 | (PHANDLE)arg2,
|
---|
753 | arg3,
|
---|
754 | arg4);
|
---|
755 | }
|
---|
756 |
|
---|
757 |
|
---|
758 | /*****************************************************************************
|
---|
759 | * Name : DWORD OS2WaitForMultipleObjectsEx
|
---|
760 | * Purpose : The WaitForMultipleObjectsEx function is an extended wait
|
---|
761 | * function that can be used to perform an alertable wait. This
|
---|
762 | * enables the function to return when the system queues an I/O
|
---|
763 | * completion routine to be executed by the calling thread. The
|
---|
764 | * function also returns either when any one or when all of the
|
---|
765 | * specified objects are in the signaled state, or when the
|
---|
766 | * time-out interval elapses.
|
---|
767 | * Parameters: DWORD cObjects number of handles in handle array
|
---|
768 | * HANDLE *lphObjects address of object-handle array
|
---|
769 | * BOOL fWaitAll wait flag
|
---|
770 | * DWORD dwTimeout time-out interval in milliseconds
|
---|
771 | * BOOL fAlertable alertable wait flag
|
---|
772 | * Variables :
|
---|
773 | * Result : 0xFFFFFFFF in case of error
|
---|
774 | * Remark : only really required for async I/O
|
---|
775 | * Status : UNTESTED STUB
|
---|
776 | *
|
---|
777 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
778 | *****************************************************************************/
|
---|
779 |
|
---|
780 | DWORD WIN32API WaitForMultipleObjectsEx(DWORD cObjects,
|
---|
781 | CONST HANDLE *lphObjects,
|
---|
782 | BOOL fWaitAll,
|
---|
783 | DWORD dwTimeout,
|
---|
784 | BOOL fAlertable)
|
---|
785 | {
|
---|
786 | dprintf(("Kernel32: WaitForMultipleObjectsEx(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented correctly.\n",
|
---|
787 | cObjects,
|
---|
788 | lphObjects,
|
---|
789 | fWaitAll,
|
---|
790 | dwTimeout,
|
---|
791 | fAlertable));
|
---|
792 |
|
---|
793 | return(HMWaitForMultipleObjectsEx(cObjects,
|
---|
794 | (PHANDLE)lphObjects,
|
---|
795 | fWaitAll,
|
---|
796 | dwTimeout,
|
---|
797 | fAlertable));
|
---|
798 | }
|
---|
799 |
|
---|
800 |
|
---|
801 | /*****************************************************************************
|
---|
802 | * Name : HANDLE WIN32API ConvertToGlobalHandle
|
---|
803 | * Purpose : forward call to Open32
|
---|
804 | * Parameters:
|
---|
805 | * Variables :
|
---|
806 | * Result :
|
---|
807 | * Remark : handle translation is done in ConvertToGlobalHandle
|
---|
808 | * Status :
|
---|
809 | *
|
---|
810 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
---|
811 | *****************************************************************************/
|
---|
812 |
|
---|
813 | HANDLE WIN32API ConvertToGlobalHandle(HANDLE hHandle)
|
---|
814 | //HANDLE WIN32API ConvertToGlobalHandle(HANDLE hHandle,
|
---|
815 | // BOOL fInherit)
|
---|
816 | {
|
---|
817 | dprintf(("KERNEL32: ConvertToGlobalHandle(%08xh)\n",
|
---|
818 | hHandle));
|
---|
819 |
|
---|
820 | return (hHandle);
|
---|
821 | }
|
---|
822 |
|
---|