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