| 1 | /* $Id: kobjects.cpp,v 1.2 1999-07-06 15:48:48 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 | return(rc);
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 | /*****************************************************************************
|
|---|
| 374 | * Name : BOOL WIN32API 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 | HANDLE WIN32API CreateSemaphoreA(LPSECURITY_ATTRIBUTES arg1,
|
|---|
| 386 | LONG arg2,
|
|---|
| 387 | LONG arg3,
|
|---|
| 388 | LPCSTR arg4)
|
|---|
| 389 | {
|
|---|
| 390 | dprintf(("KERNEL32: CreateSemaphoreA(%08xh,%08xh,%08xh,%s)\n",
|
|---|
| 391 | arg1,
|
|---|
| 392 | arg2,
|
|---|
| 393 | arg3,
|
|---|
| 394 | arg4));
|
|---|
| 395 |
|
|---|
| 396 | return HMCreateSemaphore(arg1,
|
|---|
| 397 | arg2,
|
|---|
| 398 | arg3,
|
|---|
| 399 | (LPSTR)arg4);
|
|---|
| 400 | }
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 | /*****************************************************************************
|
|---|
| 404 | * Name : BOOL WIN32API CreateSemaphoreW
|
|---|
| 405 | * Purpose : forward call to Open32
|
|---|
| 406 | * Parameters:
|
|---|
| 407 | * Variables :
|
|---|
| 408 | * Result :
|
|---|
| 409 | * Remark : handle translation is done in CreateSemaphoreW
|
|---|
| 410 | * Status :
|
|---|
| 411 | *
|
|---|
| 412 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 413 | *****************************************************************************/
|
|---|
| 414 |
|
|---|
| 415 | HANDLE WIN32API CreateSemaphoreW(PSECURITY_ATTRIBUTES arg1,
|
|---|
| 416 | LONG arg2,
|
|---|
| 417 | LONG arg3,
|
|---|
| 418 | LPCWSTR arg4)
|
|---|
| 419 | {
|
|---|
| 420 | HANDLE rc;
|
|---|
| 421 | char *astring;
|
|---|
| 422 |
|
|---|
| 423 | dprintf(("KERNEL32: CreateSemaphoreW(%08xh,%08xh,%08xh,%08xh)\n",
|
|---|
| 424 | arg1,
|
|---|
| 425 | arg2,
|
|---|
| 426 | arg3,
|
|---|
| 427 | arg4));
|
|---|
| 428 |
|
|---|
| 429 | astring = UnicodeToAsciiString((LPWSTR)arg4);
|
|---|
| 430 | rc = HMCreateSemaphore(arg1,
|
|---|
| 431 | arg2,
|
|---|
| 432 | arg3,
|
|---|
| 433 | astring);
|
|---|
| 434 | FreeAsciiString(astring);
|
|---|
| 435 | return(rc);
|
|---|
| 436 | }
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 | /*****************************************************************************
|
|---|
| 440 | * Name : BOOL WIN32API GetOverlappedResult
|
|---|
| 441 | * Purpose : forward call to Open32
|
|---|
| 442 | * Parameters:
|
|---|
| 443 | * Variables :
|
|---|
| 444 | * Result :
|
|---|
| 445 | * Remark : handle translation is done in GetOverlappedResult
|
|---|
| 446 | * Status :
|
|---|
| 447 | *
|
|---|
| 448 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 449 | *****************************************************************************/
|
|---|
| 450 |
|
|---|
| 451 | BOOL WIN32API GetOverlappedResult(HANDLE arg1,
|
|---|
| 452 | LPOVERLAPPED arg2,
|
|---|
| 453 | LPDWORD arg3,
|
|---|
| 454 | BOOL arg4)
|
|---|
| 455 | {
|
|---|
| 456 | dprintf(("KERNEL32: GetOverlappedResult (%08xh,%08xh,%08xh,%08xh)\n",
|
|---|
| 457 | arg1,
|
|---|
| 458 | arg2,
|
|---|
| 459 | arg3,
|
|---|
| 460 | arg4));
|
|---|
| 461 |
|
|---|
| 462 | return HMGetOverlappedResult(arg1,
|
|---|
| 463 | arg2,
|
|---|
| 464 | arg3,
|
|---|
| 465 | arg4);
|
|---|
| 466 | }
|
|---|
| 467 |
|
|---|
| 468 |
|
|---|
| 469 | /*****************************************************************************
|
|---|
| 470 | * Name : BOOL WIN32API OpenEventA
|
|---|
| 471 | * Purpose : forward call to Open32
|
|---|
| 472 | * Parameters:
|
|---|
| 473 | * Variables :
|
|---|
| 474 | * Result :
|
|---|
| 475 | * Remark : handle translation is done in OpenEventA
|
|---|
| 476 | * Status :
|
|---|
| 477 | *
|
|---|
| 478 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 479 | *****************************************************************************/
|
|---|
| 480 |
|
|---|
| 481 | HANDLE WIN32API OpenEventA(DWORD arg1,
|
|---|
| 482 | BOOL arg2,
|
|---|
| 483 | LPCSTR arg3)
|
|---|
| 484 | {
|
|---|
| 485 | dprintf(("KERNEL32: OpenEventA(%08xh,%08xh,%s)\n",
|
|---|
| 486 | arg1,
|
|---|
| 487 | arg2,
|
|---|
| 488 | arg3));
|
|---|
| 489 |
|
|---|
| 490 | return HMOpenEvent(arg1,
|
|---|
| 491 | arg2,
|
|---|
| 492 | arg3);
|
|---|
| 493 | }
|
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 | /*****************************************************************************
|
|---|
| 497 | * Name : BOOL WIN32API OpenEventW
|
|---|
| 498 | * Purpose : forward call to Open32
|
|---|
| 499 | * Parameters:
|
|---|
| 500 | * Variables :
|
|---|
| 501 | * Result :
|
|---|
| 502 | * Remark : handle translation is done in OpenEventW
|
|---|
| 503 | * Status :
|
|---|
| 504 | *
|
|---|
| 505 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 506 | *****************************************************************************/
|
|---|
| 507 |
|
|---|
| 508 | HANDLE WIN32API OpenEventW(DWORD dwDesiredAccess,
|
|---|
| 509 | BOOL bInheritHandle,
|
|---|
| 510 | LPCWSTR lpName)
|
|---|
| 511 | {
|
|---|
| 512 | char *asciiname;
|
|---|
| 513 | HANDLE rc;
|
|---|
| 514 |
|
|---|
| 515 | dprintf(("KERNEL32: OpenEventW(%08xh,%08xh,%08xh\n",
|
|---|
| 516 | dwDesiredAccess,
|
|---|
| 517 | bInheritHandle,
|
|---|
| 518 | lpName));
|
|---|
| 519 |
|
|---|
| 520 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
|---|
| 521 | rc = HMOpenEvent(dwDesiredAccess,
|
|---|
| 522 | bInheritHandle,
|
|---|
| 523 | asciiname);
|
|---|
| 524 | FreeAsciiString(asciiname);
|
|---|
| 525 | return(rc);
|
|---|
| 526 | }
|
|---|
| 527 |
|
|---|
| 528 |
|
|---|
| 529 | /*****************************************************************************
|
|---|
| 530 | * Name : BOOL WIN32API OpenMutexA
|
|---|
| 531 | * Purpose : forward call to Open32
|
|---|
| 532 | * Parameters:
|
|---|
| 533 | * Variables :
|
|---|
| 534 | * Result :
|
|---|
| 535 | * Remark : handle translation is done in OpenMutexA
|
|---|
| 536 | * Status :
|
|---|
| 537 | *
|
|---|
| 538 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 539 | *****************************************************************************/
|
|---|
| 540 |
|
|---|
| 541 | HANDLE WIN32API OpenMutexA(DWORD arg1,
|
|---|
| 542 | BOOL arg2,
|
|---|
| 543 | LPCSTR arg3)
|
|---|
| 544 | {
|
|---|
| 545 | dprintf(("KERNEL32: OpenMutexA(%08xh,%08xh,%s)\n",
|
|---|
| 546 | arg1,
|
|---|
| 547 | arg2,
|
|---|
| 548 | arg3));
|
|---|
| 549 |
|
|---|
| 550 | return HMOpenMutex(arg1,
|
|---|
| 551 | arg2,
|
|---|
| 552 | arg3);
|
|---|
| 553 | }
|
|---|
| 554 |
|
|---|
| 555 |
|
|---|
| 556 | /*****************************************************************************
|
|---|
| 557 | * Name : BOOL WIN32API OpenMutexW
|
|---|
| 558 | * Purpose : forward call to Open32
|
|---|
| 559 | * Parameters:
|
|---|
| 560 | * Variables :
|
|---|
| 561 | * Result :
|
|---|
| 562 | * Remark : handle translation is done in OpenMutexW
|
|---|
| 563 | * Status :
|
|---|
| 564 | *
|
|---|
| 565 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 566 | *****************************************************************************/
|
|---|
| 567 |
|
|---|
| 568 | HANDLE WIN32API OpenMutexW(DWORD dwDesiredAccess,
|
|---|
| 569 | BOOL bInheritHandle,
|
|---|
| 570 | LPCWSTR lpName)
|
|---|
| 571 | {
|
|---|
| 572 | char *asciiname;
|
|---|
| 573 | HANDLE rc;
|
|---|
| 574 |
|
|---|
| 575 | dprintf(("KERNEL32: OpenMutexW(%08xh,%08xh,%08xh)\n",
|
|---|
| 576 | dwDesiredAccess,
|
|---|
| 577 | bInheritHandle,
|
|---|
| 578 | lpName));
|
|---|
| 579 |
|
|---|
| 580 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
|---|
| 581 | rc = HMOpenMutex(dwDesiredAccess,
|
|---|
| 582 | bInheritHandle,
|
|---|
| 583 | asciiname);
|
|---|
| 584 | FreeAsciiString(asciiname);
|
|---|
| 585 | return(rc);
|
|---|
| 586 | }
|
|---|
| 587 |
|
|---|
| 588 |
|
|---|
| 589 | /*****************************************************************************
|
|---|
| 590 | * Name : BOOL WIN32API OpenSemaphoreA
|
|---|
| 591 | * Purpose : forward call to Open32
|
|---|
| 592 | * Parameters:
|
|---|
| 593 | * Variables :
|
|---|
| 594 | * Result :
|
|---|
| 595 | * Remark : handle translation is done in OpenSemaphoreA
|
|---|
| 596 | * Status :
|
|---|
| 597 | *
|
|---|
| 598 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 599 | *****************************************************************************/
|
|---|
| 600 |
|
|---|
| 601 | HANDLE WIN32API OpenSemaphoreA(DWORD arg1,
|
|---|
| 602 | BOOL arg2,
|
|---|
| 603 | LPCSTR arg3)
|
|---|
| 604 | {
|
|---|
| 605 | dprintf(("KERNEL32: OpenSemaphoreA(%08xh,%08xh,%s)\n",
|
|---|
| 606 | arg1,
|
|---|
| 607 | arg2,
|
|---|
| 608 | arg3));
|
|---|
| 609 |
|
|---|
| 610 | return HMOpenSemaphore(arg1,
|
|---|
| 611 | arg2,
|
|---|
| 612 | arg3);
|
|---|
| 613 | }
|
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 | /*****************************************************************************
|
|---|
| 617 | * Name : BOOL WIN32API OpenSemaphoreW
|
|---|
| 618 | * Purpose : forward call to Open32
|
|---|
| 619 | * Parameters:
|
|---|
| 620 | * Variables :
|
|---|
| 621 | * Result :
|
|---|
| 622 | * Remark : handle translation is done in OpenSemaphoreW
|
|---|
| 623 | * Status :
|
|---|
| 624 | *
|
|---|
| 625 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 626 | *****************************************************************************/
|
|---|
| 627 |
|
|---|
| 628 | HANDLE WIN32API OpenSemaphoreW(DWORD dwDesiredAccess,
|
|---|
| 629 | BOOL bInheritHandle,
|
|---|
| 630 | LPCWSTR lpName)
|
|---|
| 631 | {
|
|---|
| 632 | char *asciiname;
|
|---|
| 633 | HANDLE rc;
|
|---|
| 634 |
|
|---|
| 635 | dprintf(("KERNEL32: OpenSemaphoreW(%08xh,%08xh,%08xh)\n",
|
|---|
| 636 | dwDesiredAccess,
|
|---|
| 637 | bInheritHandle,
|
|---|
| 638 | lpName));
|
|---|
| 639 |
|
|---|
| 640 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
|---|
| 641 | rc = HMOpenSemaphore(dwDesiredAccess,
|
|---|
| 642 | bInheritHandle,
|
|---|
| 643 | asciiname);
|
|---|
| 644 | FreeAsciiString(asciiname);
|
|---|
| 645 | return(rc);
|
|---|
| 646 | }
|
|---|
| 647 |
|
|---|
| 648 |
|
|---|
| 649 | /*****************************************************************************
|
|---|
| 650 | * Name : BOOL WIN32API PulseEvent
|
|---|
| 651 | * Purpose : forward call to Open32
|
|---|
| 652 | * Parameters:
|
|---|
| 653 | * Variables :
|
|---|
| 654 | * Result :
|
|---|
| 655 | * Remark : handle translation is done in PulseEvent
|
|---|
| 656 | * Status :
|
|---|
| 657 | *
|
|---|
| 658 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 659 | *****************************************************************************/
|
|---|
| 660 |
|
|---|
| 661 | BOOL WIN32API PulseEvent(HANDLE arg1)
|
|---|
| 662 | {
|
|---|
| 663 | dprintf(("KERNEL32: PulseEvent(%08xh)\n",
|
|---|
| 664 | arg1));
|
|---|
| 665 |
|
|---|
| 666 | return HMPulseEvent(arg1);
|
|---|
| 667 | }
|
|---|
| 668 |
|
|---|
| 669 |
|
|---|
| 670 | /*****************************************************************************
|
|---|
| 671 | * Name : BOOL WIN32API ReleaseSemaphore
|
|---|
| 672 | * Purpose : forward call to Open32
|
|---|
| 673 | * Parameters:
|
|---|
| 674 | * Variables :
|
|---|
| 675 | * Result :
|
|---|
| 676 | * Remark : handle translation is done in ReleaseSemaphore
|
|---|
| 677 | * Status :
|
|---|
| 678 | *
|
|---|
| 679 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 680 | *****************************************************************************/
|
|---|
| 681 |
|
|---|
| 682 | BOOL WIN32API ReleaseSemaphore(HANDLE arg1,
|
|---|
| 683 | LONG arg2,
|
|---|
| 684 | PLONG arg3)
|
|---|
| 685 | {
|
|---|
| 686 | dprintf(("KERNEL32: ReleaseSemaphore(%08xh,%08xh,%08xh)\n",
|
|---|
| 687 | arg1,
|
|---|
| 688 | arg2,
|
|---|
| 689 | arg3));
|
|---|
| 690 |
|
|---|
| 691 | return HMReleaseSemaphore(arg1,
|
|---|
| 692 | arg2,
|
|---|
| 693 | arg3);
|
|---|
| 694 | }
|
|---|
| 695 |
|
|---|
| 696 |
|
|---|
| 697 | /*****************************************************************************
|
|---|
| 698 | * Name : BOOL WIN32API ResetEvent
|
|---|
| 699 | * Purpose : forward call to Open32
|
|---|
| 700 | * Parameters:
|
|---|
| 701 | * Variables :
|
|---|
| 702 | * Result :
|
|---|
| 703 | * Remark : handle translation is done in ResetEvent
|
|---|
| 704 | * Status :
|
|---|
| 705 | *
|
|---|
| 706 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 707 | *****************************************************************************/
|
|---|
| 708 |
|
|---|
| 709 | BOOL WIN32API ResetEvent(HANDLE arg1)
|
|---|
| 710 | {
|
|---|
| 711 | dprintf(("KERNEL32: ResetEvent(%08xh)\n",
|
|---|
| 712 | arg1));
|
|---|
| 713 |
|
|---|
| 714 | return HMResetEvent(arg1);
|
|---|
| 715 | }
|
|---|
| 716 |
|
|---|
| 717 |
|
|---|
| 718 | /*****************************************************************************
|
|---|
| 719 | * Name : BOOL WIN32API WaitForMultipleObjects
|
|---|
| 720 | * Purpose : forward call to Open32
|
|---|
| 721 | * Parameters:
|
|---|
| 722 | * Variables :
|
|---|
| 723 | * Result :
|
|---|
| 724 | * Remark : handle translation is done in WaitForMultipleObjects
|
|---|
| 725 | * Status :
|
|---|
| 726 | *
|
|---|
| 727 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 728 | *****************************************************************************/
|
|---|
| 729 |
|
|---|
| 730 | DWORD WIN32API WaitForMultipleObjects(DWORD arg1,
|
|---|
| 731 | const HANDLE *arg2,
|
|---|
| 732 | BOOL arg3,
|
|---|
| 733 | DWORD arg4)
|
|---|
| 734 | {
|
|---|
| 735 | dprintf(("KERNEL32: OS2WaitForMultipleObjects(%08xh,%08xh,%08xh,%08xh)\n",
|
|---|
| 736 | arg1,
|
|---|
| 737 | arg2,
|
|---|
| 738 | arg3,
|
|---|
| 739 | arg4));
|
|---|
| 740 |
|
|---|
| 741 | return HMWaitForMultipleObjects(arg1,
|
|---|
| 742 | (PHANDLE)arg2,
|
|---|
| 743 | arg3,
|
|---|
| 744 | arg4);
|
|---|
| 745 | }
|
|---|
| 746 |
|
|---|
| 747 |
|
|---|
| 748 | /*****************************************************************************
|
|---|
| 749 | * Name : DWORD OS2WaitForMultipleObjectsEx
|
|---|
| 750 | * Purpose : The WaitForMultipleObjectsEx function is an extended wait
|
|---|
| 751 | * function that can be used to perform an alertable wait. This
|
|---|
| 752 | * enables the function to return when the system queues an I/O
|
|---|
| 753 | * completion routine to be executed by the calling thread. The
|
|---|
| 754 | * function also returns either when any one or when all of the
|
|---|
| 755 | * specified objects are in the signaled state, or when the
|
|---|
| 756 | * time-out interval elapses.
|
|---|
| 757 | * Parameters: DWORD cObjects number of handles in handle array
|
|---|
| 758 | * HANDLE *lphObjects address of object-handle array
|
|---|
| 759 | * BOOL fWaitAll wait flag
|
|---|
| 760 | * DWORD dwTimeout time-out interval in milliseconds
|
|---|
| 761 | * BOOL fAlertable alertable wait flag
|
|---|
| 762 | * Variables :
|
|---|
| 763 | * Result : 0xFFFFFFFF in case of error
|
|---|
| 764 | * Remark : only really required for async I/O
|
|---|
| 765 | * Status : UNTESTED STUB
|
|---|
| 766 | *
|
|---|
| 767 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
|---|
| 768 | *****************************************************************************/
|
|---|
| 769 |
|
|---|
| 770 | DWORD WIN32API WaitForMultipleObjectsEx(DWORD cObjects,
|
|---|
| 771 | CONST HANDLE *lphObjects,
|
|---|
| 772 | BOOL fWaitAll,
|
|---|
| 773 | DWORD dwTimeout,
|
|---|
| 774 | BOOL fAlertable)
|
|---|
| 775 | {
|
|---|
| 776 | dprintf(("Kernel32: WaitForMultipleObjectsEx(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented correctly.\n",
|
|---|
| 777 | cObjects,
|
|---|
| 778 | lphObjects,
|
|---|
| 779 | fWaitAll,
|
|---|
| 780 | dwTimeout,
|
|---|
| 781 | fAlertable));
|
|---|
| 782 |
|
|---|
| 783 | return(HMWaitForMultipleObjectsEx(cObjects,
|
|---|
| 784 | (PHANDLE)lphObjects,
|
|---|
| 785 | fWaitAll,
|
|---|
| 786 | dwTimeout,
|
|---|
| 787 | fAlertable));
|
|---|
| 788 | }
|
|---|
| 789 |
|
|---|
| 790 |
|
|---|
| 791 | /*****************************************************************************
|
|---|
| 792 | * Name : HANDLE WIN32API ConvertToGlobalHandle
|
|---|
| 793 | * Purpose : forward call to Open32
|
|---|
| 794 | * Parameters:
|
|---|
| 795 | * Variables :
|
|---|
| 796 | * Result :
|
|---|
| 797 | * Remark : handle translation is done in ConvertToGlobalHandle
|
|---|
| 798 | * Status :
|
|---|
| 799 | *
|
|---|
| 800 | * Author : Patrick Haller [Fri, 1999/06/18 03:44]
|
|---|
| 801 | *****************************************************************************/
|
|---|
| 802 |
|
|---|
| 803 | HANDLE WIN32API ConvertToGlobalHandle(HANDLE hHandle)
|
|---|
| 804 | //HANDLE WIN32API ConvertToGlobalHandle(HANDLE hHandle,
|
|---|
| 805 | // BOOL fInherit)
|
|---|
| 806 | {
|
|---|
| 807 | dprintf(("KERNEL32: ConvertToGlobalHandle(%08xh)\n",
|
|---|
| 808 | hHandle));
|
|---|
| 809 |
|
|---|
| 810 | return (hHandle);
|
|---|
| 811 | }
|
|---|
| 812 |
|
|---|