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