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