Ignore:
Timestamp:
Jun 18, 2009, 11:53:26 AM (16 years ago)
Author:
ydario
Message:

Kernel32 updates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/kobjects.cpp

    r9748 r21302  
    3131
    3232
    33 // REMARK: THIS IS IN PREPARATION FOR HANDLEMANAGER SUPPORT (PH) !!
    34 //#define HMCreateEvent              O32_CreateEvent
    35 //#define HMCreateMutex              O32_CreateMutex
    36 //#define HMCreateSemaphore          O32_CreateSemaphore
    37 //#define HMSetEvent                 O32_SetEvent
    38 //#define HMReleaseMutex             O32_ReleaseMutex
    39 //#define HMWaitForSingleObject      O32_WaitForSingleObject
    40 //#define HMWaitForSingleObjectEx    O32_WaitForSingleObjectEx
    41 //#define HMGetOverlappedResult      O32_GetOverlappedResult
    42 //#define HMOpenEvent                O32_OpenEvent
    43 //#define HMOpenMutex                O32_OpenMutex
    44 //#define HMOpenSemaphore            O32_OpenSemaphore
    45 //#define HMPulseEvent               O32_PulseEvent
    46 //#define HMReleaseSemaphore         O32_ReleaseSemaphore
    47 //#define HMResetEvent               O32_ResetEvent
    48 //#define HMWaitForMultipleObjects   O32_WaitForMultipleObjects
    49 //#define HMWaitForMultipleObjectsEx O32_WaitForMultipleObjectsEx
    50 //#define HMFlushFileBuffers         O32_FlushFileBuffers
    51 #define HMSetHandleCount           O32_SetHandleCount
    52 #define HMGetHandleCount           O32_GetHandleCount
    53 //#define HMDuplicateHandle          O32_DuplicateHandle
    54 
    55 
    56 
    5733/*****************************************************************************
    5834 * Defines                                                                   *
     
    6440
    6541
    66 /*****************************************************************************
    67  * Name      : BOOL CreateEventA
    68  * Purpose   : forward call to Open32
    69  * Parameters:
    70  * Variables :
    71  * Result    :
    72  * Remark    :
    73  * Status    :
    74  *
    75  * Author    : Patrick Haller [Fri, 1998/06/12 03:44]
    76  *****************************************************************************/
    77 
    78 HANDLE WIN32API CreateEventA(LPSECURITY_ATTRIBUTES lpsa, BOOL fManualReset,
    79                              BOOL fInitialState,
    80                              LPCTSTR lpszEventName)
    81 {
    82   return(HMCreateEvent(lpsa,                         /* create event semaphore */
    83                        fManualReset,
    84                        fInitialState,
    85                        lpszEventName));
    86 }
    87 
    88 
    89 /*****************************************************************************
    90  * Name      : BOOL 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, BOOL arg3,
    103                              LPCWSTR arg4)
    104 {
    105   HANDLE rc;
    106   char  *astring;
    107 
    108   if (arg4 != NULL) // support for unnamed semaphores
    109     astring = UnicodeToAsciiString((LPWSTR)arg4);
    110   else
    111     astring = NULL;
    112 
    113   dprintf(("KERNEL32: CreateEventW(%s)\n",
    114            astring));
    115 
    116   rc = HMCreateEvent(arg1,
    117                     arg2,
    118                     arg3,
    119                     astring);
    120 
    121   if (astring != NULL)
    122     FreeAsciiString(astring);
    123 
    124   return(rc);
    125 }
    126 
    127 
    128 /*****************************************************************************
    129  * Name      : BOOL CreateMutexA
    130  * Purpose   : forward call to Open32
    131  * Parameters:
    132  * Variables :
    133  * Result    :
    134  * Remark    : handle translation is done in CreateMutexA
    135  * Status    :
    136  *
    137  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    138  *****************************************************************************/
    139 
    140 HANDLE WIN32API CreateMutexA(LPSECURITY_ATTRIBUTES lpsa,
    141                              BOOL fInitialOwner,
    142                              LPCTSTR lpszMutexName)
    143 {
    144   dprintf(("KERNEL32: CreateMutexA(%s)\n",
    145            lpszMutexName));
    146 
    147   return(HMCreateMutex(lpsa,
    148                        fInitialOwner,
    149                        lpszMutexName));
    150 }
     42
     43
    15144
    15245
     
    17467    astring = NULL;
    17568
    176   dprintf(("KERNEL32: CreateMutexW(%s)\n",
    177            astring));
    178 
    179   rc = HMCreateMutex(arg1,
     69  rc = CreateMutexA(arg1,
    18070                     arg2,
    18171                     astring);
     
    18575
    18676  return(rc);
    187 }
    188 
    189 
    190 /*****************************************************************************
    191  * Name      : BOOL ReleaseMutex
    192  * Purpose   : forward call to Open32
    193  * Parameters:
    194  * Variables :
    195  * Result    :
    196  * Remark    : handle translation is done in ReleaseMutex
    197  * Status    :
    198  *
    199  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    200  *****************************************************************************/
    201 
    202 BOOL WIN32API ReleaseMutex(HANDLE mutex)
    203 {
    204   return(HMReleaseMutex(mutex));
    205 }
    206 
    207 
    208 /*****************************************************************************
    209  * Name      : BOOL SetEvent
    210  * Purpose   : forward call to Open32
    211  * Parameters:
    212  * Variables :
    213  * Result    :
    214  * Remark    : handle translation is done in SetEvent
    215  * Status    :
    216  *
    217  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    218  *****************************************************************************/
    219 
    220 BOOL WIN32API SetEvent(HANDLE hEvent)
    221 {
    222   return(HMSetEvent(hEvent));
    22377}
    22478
     
    274128}
    275129
    276 
    277 /*****************************************************************************
    278  * Name      : BOOL FlushFileBuffers
    279  * Purpose   : forward call to Open32
    280  * Parameters:
    281  * Variables :
    282  * Result    :
    283  * Remark    : handle translation is done in FlushFileBuffers
    284  * Status    :
    285  *
    286  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    287  *****************************************************************************/
    288 
    289 BOOL WIN32API FlushFileBuffers(HANDLE hFile)
    290 {
    291   return(HMFlushFileBuffers(hFile));
    292 }
    293130
    294131
     
    351188
    352189
    353 /*****************************************************************************
    354  * Name      : BOOL CreateSemaphoreA
    355  * Purpose   : forward call to Open32
    356  * Parameters:
    357  * Variables :
    358  * Result    :
    359  * Remark    : handle translation is done in CreateSemaphoreA
    360  * Status    :
    361  *
    362  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    363  *****************************************************************************/
    364 
    365 HANDLE WIN32API CreateSemaphoreA(LPSECURITY_ATTRIBUTES arg1,
    366                                  LONG arg2, LONG arg3, LPCSTR arg4)
    367 {
    368   return HMCreateSemaphore(arg1,
    369                            arg2,
    370                            arg3,
    371                            (LPSTR)arg4);
    372 }
    373 
    374190
    375191/*****************************************************************************
     
    396212    astring = NULL;
    397213
    398   dprintf(("KERNEL32: CreateSemaphoreW(%s)\n",
    399            astring));
    400 
    401   rc = HMCreateSemaphore(arg1,
     214  rc = CreateSemaphoreA(arg1,
    402215                         arg2,
    403216                         arg3,
     
    409222}
    410223
    411 /*****************************************************************************
    412  * Name      : BOOL OpenEventA
    413  * Purpose   : forward call to Open32
    414  * Parameters:
    415  * Variables :
    416  * Result    :
    417  * Remark    : handle translation is done in OpenEventA
    418  * Status    :
    419  *
    420  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    421  *****************************************************************************/
    422 
    423 HANDLE WIN32API OpenEventA(DWORD  arg1, BOOL arg2, LPCSTR arg3)
    424 {
    425   dprintf(("KERNEL32: OpenEventA(%s)\n",
    426            arg3));
    427 
    428   return HMOpenEvent(arg1,
    429                      arg2,
    430                      arg3);
    431 }
    432 
    433224
    434225/*****************************************************************************
     
    452243  asciiname = UnicodeToAsciiString((LPWSTR)lpName);
    453244
    454   dprintf(("KERNEL32: OpenEventW(%s)\n",
    455            asciiname));
    456 
    457   rc = HMOpenEvent(dwDesiredAccess,
     245  rc = OpenEventA(dwDesiredAccess,
    458246                   bInheritHandle,
    459247                   asciiname);
     
    464252
    465253/*****************************************************************************
    466  * Name      : BOOL OpenMutexA
    467  * Purpose   : forward call to Open32
    468  * Parameters:
    469  * Variables :
    470  * Result    :
    471  * Remark    : handle translation is done in OpenMutexA
    472  * Status    :
    473  *
    474  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    475  *****************************************************************************/
    476 
    477 HANDLE WIN32API OpenMutexA(DWORD arg1, BOOL arg2, LPCSTR arg3)
    478 {
    479   dprintf(("KERNEL32: OpenMutexA(%s)\n",
    480            arg3));
    481 
    482   return HMOpenMutex(arg1,
    483                      arg2,
    484                      arg3);
    485 }
    486 
    487 
    488 /*****************************************************************************
    489254 * Name      : BOOL OpenMutexW
    490255 * Purpose   : forward call to Open32
     
    506271  asciiname = UnicodeToAsciiString((LPWSTR)lpName);
    507272
    508   dprintf(("KERNEL32: OpenMutexW(%s)\n",
    509            asciiname));
    510 
    511   rc = HMOpenMutex(dwDesiredAccess,
     273  rc = OpenMutexA(dwDesiredAccess,
    512274                   bInheritHandle,
    513275                   asciiname);
     
    518280
    519281/*****************************************************************************
    520  * Name      : BOOL OpenSemaphoreA
    521  * Purpose   : forward call to Open32
    522  * Parameters:
    523  * Variables :
    524  * Result    :
    525  * Remark    : handle translation is done in OpenSemaphoreA
    526  * Status    :
    527  *
    528  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    529  *****************************************************************************/
    530 
    531 HANDLE WIN32API OpenSemaphoreA(DWORD arg1, BOOL arg2, LPCSTR arg3)
    532 {
    533   dprintf(("KERNEL32: OpenSemaphoreA(%s)\n",
    534            arg3));
    535 
    536   return HMOpenSemaphore(arg1,
    537                          arg2,
    538                          arg3);
    539 }
    540 
    541 
    542 /*****************************************************************************
    543282 * Name      : BOOL OpenSemaphoreW
    544283 * Purpose   : forward call to Open32
     
    560299  asciiname = UnicodeToAsciiString((LPWSTR)lpName);
    561300
    562   dprintf(("KERNEL32: OpenSemaphoreW(%s)\n",
    563            asciiname));
    564 
    565   rc = HMOpenSemaphore(dwDesiredAccess,
     301  rc = OpenSemaphoreA(dwDesiredAccess,
    566302                       bInheritHandle,
    567303                       asciiname);
     
    570306}
    571307
    572 
    573 /*****************************************************************************
    574  * Name      : BOOL PulseEvent
    575  * Purpose   : forward call to Open32
    576  * Parameters:
    577  * Variables :
    578  * Result    :
    579  * Remark    : handle translation is done in PulseEvent
    580  * Status    :
    581  *
    582  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    583  *****************************************************************************/
    584 
    585 BOOL WIN32API PulseEvent(HANDLE arg1)
    586 {
    587   return HMPulseEvent(arg1);
    588 }
    589 
    590 
    591 /*****************************************************************************
    592  * Name      : BOOL ReleaseSemaphore
    593  * Purpose   : forward call to Open32
    594  * Parameters:
    595  * Variables :
    596  * Result    :
    597  * Remark    : handle translation is done in ReleaseSemaphore
    598  * Status    :
    599  *
    600  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    601  *****************************************************************************/
    602 
    603 BOOL WIN32API ReleaseSemaphore(HANDLE arg1, LONG arg2, PLONG arg3)
    604 {
    605   return HMReleaseSemaphore(arg1,
    606                             arg2,
    607                             arg3);
    608 }
    609 
    610 
    611 /*****************************************************************************
    612  * Name      : BOOL ResetEvent
    613  * Purpose   : forward call to Open32
    614  * Parameters:
    615  * Variables :
    616  * Result    :
    617  * Remark    : handle translation is done in ResetEvent
    618  * Status    :
    619  *
    620  * Author    : Patrick Haller [Fri, 1999/06/18 03:44]
    621  *****************************************************************************/
    622 
    623 BOOL WIN32API ResetEvent(HANDLE arg1)
    624 {
    625   return HMResetEvent(arg1);
    626 }
    627308
    628309
     
    706387//******************************************************************************
    707388//******************************************************************************
    708 HANDLE WIN32API CreateThread(LPSECURITY_ATTRIBUTES  lpsa,
    709                              DWORD                  cbStack,
    710                              LPTHREAD_START_ROUTINE lpStartAddr,
    711                              LPVOID                 lpvThreadParm,
    712                              DWORD                  fdwCreate,
    713                              LPDWORD                lpIDThread)
    714 {
    715     return HMCreateThread(lpsa, cbStack, lpStartAddr, lpvThreadParm, fdwCreate, lpIDThread);
    716 }
    717 //******************************************************************************
    718 //******************************************************************************
    719 INT WIN32API GetThreadPriority(HANDLE hThread)
    720 {
    721     return HMGetThreadPriority(hThread);
    722 }
    723 //******************************************************************************
    724 //******************************************************************************
    725 DWORD WIN32API SuspendThread(HANDLE hThread)
    726 {
    727     return HMSuspendThread(hThread);
    728 }
    729 //******************************************************************************
    730 //******************************************************************************
    731 BOOL WIN32API SetThreadPriority(HANDLE hThread, int priority)
    732 {
    733   return HMSetThreadPriority(hThread, priority);
    734 }
    735 //******************************************************************************
    736 //******************************************************************************
    737 BOOL WIN32API GetThreadContext(HANDLE hThread, PCONTEXT lpContext)
    738 {
    739   return HMGetThreadContext(hThread, lpContext);
    740 }
    741 //******************************************************************************
    742 //******************************************************************************
    743 BOOL WIN32API SetThreadContext(HANDLE hThread, const CONTEXT *lpContext)
    744 {
    745   return HMSetThreadContext(hThread, lpContext);
    746 }
    747 //******************************************************************************
    748 //******************************************************************************
    749 BOOL WIN32API GetThreadTimes(HANDLE     hThread,
    750                              LPFILETIME lpCreationTime,
    751                              LPFILETIME lpExitTime,
    752                              LPFILETIME lpKernelTime,
    753                              LPFILETIME lpUserTime)
    754 {
    755   return HMGetThreadTimes(hThread, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime);
    756 }
    757 //******************************************************************************
    758 //******************************************************************************
    759 BOOL WIN32API TerminateThread(HANDLE hThread, DWORD exitcode)
    760 {
    761   return HMTerminateThread(hThread, exitcode);
    762 }
    763 //******************************************************************************
    764 //******************************************************************************
    765 DWORD WIN32API ResumeThread(HANDLE hThread)
    766 {
    767   return HMResumeThread(hThread);
    768 }
    769 //******************************************************************************
    770 //******************************************************************************
    771 BOOL WIN32API GetExitCodeThread(HANDLE hThread, LPDWORD arg2)
    772 {
    773     return HMGetExitCodeThread(hThread, arg2);
    774 }
    775 //******************************************************************************
    776 //******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.