Changeset 6049 for trunk/src


Ignore:
Timestamp:
Jun 19, 2001, 12:50:26 PM (24 years ago)
Author:
sandervl
Message:

semaphore rewrite (not activated)

Location:
trunk/src/kernel32
Files:
11 edited

Legend:

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

    r5791 r6049  
    1 /* $Id: HandleManager.cpp,v 1.64 2001-05-24 08:19:17 sandervl Exp $ */
     1/* $Id: HandleManager.cpp,v 1.65 2001-06-19 10:50:23 sandervl Exp $ */
    22
    33/*
     
    22232223
    22242224
     2225  if(lpName) { //check if shared event semaphore already exists
     2226      //TODO: No inheritance??
     2227      HANDLE handle = HMOpenEvent(EVENT_ALL_ACCESS, FALSE, lpName);
     2228      if(handle) {
     2229          dprintf(("CreateEvent: return handle of existing event semaphore %x", handle));
     2230          return handle;
     2231      }
     2232  }
     2233
    22252234  pDeviceHandler = HMGlobals.pHMEvent;               /* device is predefined */
     2235
     2236  iIndexNew = _HMHandleGetFree();                         /* get free handle */
     2237  if (-1 == iIndexNew)                            /* oops, no free handles ! */
     2238  {
     2239    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
     2240    return 0;                           /* signal error */
     2241  }
     2242
     2243  /* Initialize the complete HMHANDLEDATA structure */
     2244  pHMHandleData = &TabWin32Handles[iIndexNew].hmHandleData;
     2245  pHMHandleData->dwType     = FILE_TYPE_UNKNOWN;      /* unknown handle type */
     2246  pHMHandleData->dwAccess   = 0;
     2247  pHMHandleData->dwShare    = 0;
     2248  pHMHandleData->dwCreation = 0;
     2249  pHMHandleData->dwFlags    = 0;   
     2250  pHMHandleData->lpHandlerData = NULL;
     2251
     2252  /* we've got to mark the handle as occupied here, since another device */
     2253  /* could be created within the device handler -> deadlock */
     2254
     2255  /* write appropriate entry into the handle table if open succeeded */
     2256  TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = iIndexNew;
     2257  TabWin32Handles[iIndexNew].pDeviceHandler         = pDeviceHandler;
     2258
     2259  /* call the device handler */
     2260  rc = pDeviceHandler->CreateEvent(&TabWin32Handles[iIndexNew].hmHandleData,
     2261                                   lpsa,
     2262                                   bManualReset,
     2263                                   bInitialState,
     2264                                   lpName);
     2265  if (rc != NO_ERROR)     /* oops, creation failed within the device handler */
     2266  {
     2267    TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     2268    SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
     2269    return 0;                           /* signal error */
     2270  }
     2271  else
     2272    SetLastError(ERROR_SUCCESS); //@@@PH 1999/10/27 rc5desg requires this?
     2273
     2274  return iIndexNew;                                   /* return valid handle */
     2275}
     2276
     2277
     2278/*****************************************************************************
     2279 * Name      : HANDLE  HMCreateMutex
     2280 * Purpose   : Wrapper for the CreateMutex() API
     2281 * Parameters:
     2282 * Variables :
     2283 * Result    :
     2284 * Remark    :
     2285 * Status    :
     2286 *
     2287 * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
     2288 *****************************************************************************/
     2289
     2290HANDLE HMCreateMutex(LPSECURITY_ATTRIBUTES lpsa,
     2291                     BOOL                  bInitialOwner,
     2292                     LPCTSTR               lpName)
     2293{
     2294  int             iIndex;                     /* index into the handle table */
     2295  int             iIndexNew;                  /* index into the handle table */
     2296  HMDeviceHandler *pDeviceHandler;         /* device handler for this handle */
     2297  PHMHANDLEDATA   pHMHandleData;
     2298  DWORD           rc;                                     /* API return code */
     2299
     2300
     2301  if(lpName) { //check if shared mutex semaphore already exists
     2302      //TODO: No inheritance??
     2303      HANDLE handle = HMOpenMutex(MUTEX_ALL_ACCESS, FALSE, lpName);
     2304      if(handle) {
     2305          dprintf(("CreateMutex: return handle of existing mutex semaphore %x", handle));
     2306          return handle;
     2307      }
     2308  }
     2309
     2310  pDeviceHandler = HMGlobals.pHMMutex;               /* device is predefined */
    22262311
    22272312  iIndexNew = _HMHandleGetFree();                         /* get free handle */
     
    22512336
    22522337                                                  /* call the device handler */
    2253   rc = pDeviceHandler->CreateEvent(&TabWin32Handles[iIndexNew].hmHandleData,
    2254                                    lpsa,
    2255                                    bManualReset,
    2256                                    bInitialState,
    2257                                    lpName);
    2258   if (rc != NO_ERROR)     /* oops, creation failed within the device handler */
    2259   {
    2260     TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    2261     SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    2262     return 0;                           /* signal error */
    2263   }
    2264   else
    2265     SetLastError(ERROR_SUCCESS); //@@@PH 1999/10/27 rc5desg requires this?
    2266 
    2267   return iIndexNew;                                   /* return valid handle */
    2268 }
    2269 
    2270 
    2271 /*****************************************************************************
    2272  * Name      : HANDLE  HMCreateMutex
    2273  * Purpose   : Wrapper for the CreateMutex() API
    2274  * Parameters:
    2275  * Variables :
    2276  * Result    :
    2277  * Remark    :
    2278  * Status    :
    2279  *
    2280  * Author    : Patrick Haller [Wed, 1998/02/11 20:44]
    2281  *****************************************************************************/
    2282 
    2283 HANDLE HMCreateMutex(LPSECURITY_ATTRIBUTES lpsa,
    2284                      BOOL                  bInitialOwner,
    2285                      LPCTSTR               lpName)
    2286 {
    2287   int             iIndex;                     /* index into the handle table */
    2288   int             iIndexNew;                  /* index into the handle table */
    2289   HMDeviceHandler *pDeviceHandler;         /* device handler for this handle */
    2290   PHMHANDLEDATA   pHMHandleData;
    2291   DWORD           rc;                                     /* API return code */
    2292 
    2293 
    2294   pDeviceHandler = HMGlobals.pHMMutex;               /* device is predefined */
    2295 
    2296   iIndexNew = _HMHandleGetFree();                         /* get free handle */
    2297   if (-1 == iIndexNew)                            /* oops, no free handles ! */
    2298   {
    2299     SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    2300     return 0;                           /* signal error */
    2301   }
    2302 
    2303 
    2304                            /* initialize the complete HMHANDLEDATA structure */
    2305   pHMHandleData = &TabWin32Handles[iIndexNew].hmHandleData;
    2306   pHMHandleData->dwType     = FILE_TYPE_UNKNOWN;      /* unknown handle type */
    2307   pHMHandleData->dwAccess   = 0;
    2308   pHMHandleData->dwShare    = 0;
    2309   pHMHandleData->dwCreation = 0;
    2310   pHMHandleData->dwFlags    = 0;
    2311   pHMHandleData->lpHandlerData = NULL;
    2312 
    2313 
    2314       /* we've got to mark the handle as occupied here, since another device */
    2315                    /* could be created within the device handler -> deadlock */
    2316 
    2317           /* write appropriate entry into the handle table if open succeeded */
    2318   TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = iIndexNew;
    2319   TabWin32Handles[iIndexNew].pDeviceHandler         = pDeviceHandler;
    2320 
    2321                                                   /* call the device handler */
    23222338  rc = pDeviceHandler->CreateMutex(&TabWin32Handles[iIndexNew].hmHandleData,
    23232339                                   lpsa,
     
    24942510  DWORD           rc;                                     /* API return code */
    24952511
    2496 
     2512  if(lpName) { //check if shared event semaphore already exists
     2513      //TODO: No inheritance??
     2514      HANDLE handle = HMOpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, lpName);
     2515      if(handle) {
     2516          dprintf(("CreateSemaphore: return handle of existing semaphore %x", handle));
     2517          return handle;
     2518      }
     2519  }
     2520 
    24972521  pDeviceHandler = HMGlobals.pHMSemaphore;               /* device is predefined */
    24982522
     
    29843008                                 pLoop2);
    29853009
     3010    dprintf2(("MsgWaitForMultipleObjects handle %x->%x", *pLoop1, *pLoop2));
    29863011    // SvL: We still use Open32 handles for threads & processes -> don't fail here!
    29873012    if (rc != NO_ERROR)
  • trunk/src/kernel32/hmdevice.cpp

    r5587 r6049  
    1 /* $Id: hmdevice.cpp,v 1.26 2001-04-26 13:22:44 sandervl Exp $ */
     1/* $Id: hmdevice.cpp,v 1.27 2001-06-19 10:50:23 sandervl Exp $ */
    22
    33/*
     
    203203           pHMHandleData));
    204204
    205   return(ERROR_INVALID_FUNCTION);
     205  SetLastError(ERROR_INVALID_FUNCTION);
     206  return FALSE;
    206207}
    207208
  • trunk/src/kernel32/hmdisk.cpp

    r6036 r6049  
    1 /* $Id: hmdisk.cpp,v 1.9 2001-06-17 13:58:32 sandervl Exp $ */
     1/* $Id: hmdisk.cpp,v 1.10 2001-06-19 10:50:24 sandervl Exp $ */
    22
    33/*
     
    368368        SRB_ExecSCSICmd *psrb;
    369369
     370        if(hInstAspi == NULL) {
     371            SetLastError(ERROR_ACCESS_DENIED);
     372            return FALSE;
     373        }
     374
    370375        if(nOutBufferSize < sizeof(SCSI_PASS_THROUGH_DIRECT) ||
    371376           !pPacket || pPacket->Length < sizeof(SCSI_PASS_THROUGH_DIRECT))
  • trunk/src/kernel32/hmevent.cpp

    r5332 r6049  
    1 /* $Id: hmevent.cpp,v 1.4 2001-03-19 19:27:13 sandervl Exp $ */
     1/* $Id: hmevent.cpp,v 1.5 2001-06-19 10:50:24 sandervl Exp $ */
    22
    33/*
     4 * Win32 Event Semaphore implementation
     5 *
     6 * TODO: Inheritance
     7 * TODO: Does DCE_POSTONE work in Warp 3 or 4 with no FP applied?
     8 * TODO: No inheritance when CreateEvent is called for existing named event semaphore?
     9 *       (see HMCreateEvent in handlemanager.cpp)
     10 * TODO: Name collisions with files & mutex not allowed. Check if this can happen in OS/2
     11 *
    412 * Project Odin Software License can be found in LICENSE.TXT
    5  * Win32 Unified Handle Manager for OS/2
    6  * Copyright 1999 Patrick Haller (haller@zebra.fh-weingarten.de)
     13 *
     14 * Copyright 2001 Sander van Leeuwen (sandervl@xs4all.nl)
    715 */
    816
     
    2230 *****************************************************************************/
    2331
     32#ifdef USE_OS2SEMAPHORES
     33#define INCL_DOSSEMAPHORES
     34#include <os2wrap.h>
     35#include <win32type.h>
     36#include <win32api.h>
     37#include <winconst.h>
     38#else
    2439#include <os2win.h>
     40#endif
     41
    2542#include <stdlib.h>
    2643#include <string.h>
     
    3047#include "HandleManager.H"
    3148#include "HMEvent.h"
     49#include "oslibdos.h"
    3250
    3351#define DBG_LOCALLOG    DBG_hmevent
    3452#include "dbglocal.h"
     53
     54#ifndef DCE_AUTORESET
     55#define DCE_AUTORESET   0x1000  /* DosCreateEventSem option to auto-reset  */
     56                                /* event semaphore on post.                */
     57#define DCE_POSTONE     0x0800  /* DosCreateEventSem option to post only   */
     58                                /* waiter and auto-reset the semaphore when*/
     59                                /* there are multiple waiters.             */
     60#endif
    3561
    3662/*****************************************************************************
     
    6591                                      LPCTSTR               lpszEventName)
    6692{
    67   HANDLE hOpen32;
     93#ifdef USE_OS2SEMAPHORES
     94  APIRET rc;
     95  HEV hev;
     96  char szSemName[CCHMAXPATH];
    6897
    6998  dprintf(("KERNEL32: HandleManager::Event::CreateEvent(%08xh,%08xh,%08xh,%08xh,%s)\n",
     
    74103           lpszEventName));
    75104
     105  if(lpszEventName) {
     106      strcpy(szSemName, "\\SEM32\\");
     107      strcat(szSemName, lpszEventName);
     108      lpszEventName = szSemName;
     109  }
     110  //Manual reset means all threads waiting on the event semaphore will be
     111  //unblocked and the app must manually reset the event semaphore
     112  //Automatic reset -> only one waiting thread unblocked & state reset
     113  rc = DosCreateEventSem(lpszEventName, &hev, (fManualReset) ? 0 : DCE_POSTONE, fInitialState);
     114
     115  if(rc) {
     116      dprintf(("DosCreateEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     117      pHMHandleData->hHMHandle = 0;
     118      return error2WinError(rc);
     119  }
     120  pHMHandleData->dwAccess  = EVENT_ALL_ACCESS_W;
     121  pHMHandleData->dwFlags   = fManualReset;
     122  pHMHandleData->hHMHandle = hev;
     123  return ERROR_SUCCESS_W;
     124#else
     125  HANDLE hOpen32;
     126
     127  dprintf(("KERNEL32: HandleManager::Event::CreateEvent(%08xh,%08xh,%08xh,%08xh,%s)\n",
     128           pHMHandleData,
     129           lpsa,
     130           fManualReset,
     131           fInitialState,
     132           lpszEventName));
     133
    76134  hOpen32 = O32_CreateEvent(lpsa,              // call Open32
    77135                            fManualReset,
     
    86144  else
    87145    return (O32_GetLastError());
     146#endif
    88147}
    89148
     
    105164                                    LPCTSTR               lpszEventName)
    106165{
    107   HANDLE hOpen32;
     166#ifdef USE_OS2SEMAPHORES
     167  HEV    hev;
     168  APIRET rc;
     169  char szSemName[CCHMAXPATH];
    108170
    109171  dprintf(("KERNEL32: HandleManager::Event::OpenEvent(%08xh,%08xh,%s)\n",
     
    112174           lpszEventName));
    113175
     176  if(lpszEventName == NULL) {
     177      pHMHandleData->hHMHandle = 0;
     178      return ERROR_INVALID_PARAMETER_W;
     179  }
     180
     181  strcpy(szSemName, "\\SEM32\\");
     182  strcat(szSemName, lpszEventName);
     183  rc = DosOpenEventSem(szSemName, &hev);
     184  if(rc) {
     185      dprintf(("DosOpenEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     186      pHMHandleData->hHMHandle = 0;
     187      return error2WinError(rc);
     188  }
     189  pHMHandleData->hHMHandle = hev;
     190  return ERROR_SUCCESS_W;
     191#else
     192  HANDLE hOpen32;
     193
     194  dprintf(("KERNEL32: HandleManager::Event::OpenEvent(%08xh,%08xh,%s)\n",
     195           pHMHandleData,
     196           fInheritHandle,
     197           lpszEventName));
     198
    114199  hOpen32 = O32_OpenEvent(pHMHandleData->dwAccess,              // call Open32
    115200                          fInheritHandle,
     
    123208  else
    124209    return (O32_GetLastError());
    125 }
    126 
     210#endif
     211}
     212
     213/*****************************************************************************
     214 * Name      : HMDeviceEventClass::CloseHandle
     215 * Purpose   : close the handle
     216 * Parameters: PHMHANDLEDATA pHMHandleData
     217 * Variables :
     218 * Result    : API returncode
     219 * Remark    :
     220 * Status    :
     221 *
     222 * Author    :
     223 *****************************************************************************/
     224
     225#ifdef USE_OS2SEMAPHORES
     226BOOL HMDeviceEventClass::CloseHandle(PHMHANDLEDATA pHMHandleData)
     227{
     228  APIRET rc;
     229
     230  if(pHMHandleData->hHMHandle) {
     231      rc = DosCloseEventSem((HEV)pHMHandleData->hHMHandle);
     232      if(rc) {
     233          dprintf(("DosCloseEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     234          SetLastError(error2WinError(rc));
     235          return FALSE;
     236      }
     237  }
     238  return TRUE;
     239}
     240#endif
     241
     242/*****************************************************************************
     243 * Name      : HMDeviceEventClass::DuplicateHandle
     244 * Purpose   :
     245 * Parameters:
     246 *             various parameters as required
     247 * Variables :
     248 * Result    :
     249 * Remark    : the standard behaviour is to return an error code for non-
     250 *             existant request codes
     251 * Status    :
     252 *
     253 * Author    :
     254 *****************************************************************************/
     255#ifdef USE_OS2SEMAPHORES
     256BOOL HMDeviceEventClass::DuplicateHandle(PHMHANDLEDATA pHMHandleData, HANDLE  srcprocess,
     257                               PHMHANDLEDATA pHMSrcHandle,
     258                               HANDLE  destprocess,
     259                               PHANDLE desthandle,
     260                               DWORD   fdwAccess,
     261                               BOOL    fInherit,
     262                               DWORD   fdwOptions,
     263                               DWORD   fdwOdinOptions)
     264{
     265  APIRET rc;
     266  HEV hev;
     267 
     268  dprintf(("KERNEL32:HandleManager::DuplicateHandle %s(%08x,%08x,%08x,%08x,%08x) - NOT IMPLEMENTED!!!!!!!!\n",
     269           lpHMDeviceName,
     270           pHMHandleData,
     271           srcprocess, pHMSrcHandle, destprocess, desthandle));
     272
     273  if(srcprocess != destprocess) {
     274      DebugInt3();
     275      SetLastError(ERROR_ACCESS_DENIED_W);
     276      return FALSE;
     277  }
     278  hev = (HEV)pHMSrcHandle->hHMHandle;
     279  rc = DosOpenEventSem(NULL, &hev);
     280  if(rc) {
     281      dprintf(("DosOpenEventSem %x failed with rc %d", pHMSrcHandle->hHMHandle, rc));
     282      pHMHandleData->hHMHandle = 0;
     283      SetLastError(error2WinError(rc));
     284      return FALSE;
     285  }
     286  pHMHandleData->dwAccess  = fdwAccess;
     287  pHMHandleData->dwFlags   = pHMSrcHandle->dwFlags; //fManualReset
     288  pHMHandleData->hHMHandle = hev;
     289  SetLastError(ERROR_SUCCESS_W);
     290  return TRUE;
     291}
     292#endif
    127293
    128294/*****************************************************************************
     
    140306BOOL HMDeviceEventClass::SetEvent(PHMHANDLEDATA pHMHandleData)
    141307{
    142 //testestest
     308#ifdef USE_OS2SEMAPHORES
     309  APIRET rc;
     310
    143311  dprintf(("KERNEL32: HandleManager::Event::SetEvent(%08xh)\n",
    144312            pHMHandleData->hHMHandle));
    145313
     314  if(!(pHMHandleData->dwAccess & EVENT_MODIFY_STATE_W) )
     315  {
     316      dprintf(("ERROR: Access denied!!"));
     317      SetLastError(ERROR_ACCESS_DENIED_W);
     318      return FALSE;
     319  }
     320
     321  rc = DosPostEventSem(pHMHandleData->hHMHandle);
     322  if(rc) {
     323      dprintf(("DosPostEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     324      SetLastError(error2WinError(rc));
     325      return FALSE;
     326  }
     327  SetLastError(ERROR_SUCCESS_W);
     328  return TRUE;
     329#else
     330  dprintf(("KERNEL32: HandleManager::Event::SetEvent(%08xh)\n",
     331            pHMHandleData->hHMHandle));
     332
    146333  return (O32_SetEvent(pHMHandleData->hHMHandle));
     334#endif
    147335}
    148336
     
    162350BOOL HMDeviceEventClass::PulseEvent(PHMHANDLEDATA pHMHandleData)
    163351{
     352#ifdef USE_OS2SEMAPHORES
     353  APIRET rc;
     354  ULONG count; 
     355
    164356  dprintf2(("KERNEL32: HandleManager::Event::PulseEvent(%08xh)\n",
    165357            pHMHandleData->hHMHandle));
    166358
     359  if(!(pHMHandleData->dwAccess & EVENT_MODIFY_STATE_W) )
     360  {
     361      dprintf(("ERROR: Access denied!!"));
     362      SetLastError(ERROR_ACCESS_DENIED_W);
     363      return FALSE;
     364  }
     365
     366  rc = DosPostEventSem(pHMHandleData->hHMHandle);
     367  if(rc) {
     368      dprintf(("DosPostEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     369      SetLastError(error2WinError(rc));
     370      return FALSE;
     371  }
     372  if(pHMHandleData->dwFlags == TRUE) {//fManualReset
     373      rc = DosResetEventSem(pHMHandleData->hHMHandle, &count);
     374      if(rc) {
     375          dprintf(("DosResetEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     376          SetLastError(error2WinError(rc));
     377          return FALSE;
     378      }
     379  }
     380  SetLastError(ERROR_SUCCESS_W);
     381  return TRUE;
     382#else
     383  dprintf2(("KERNEL32: HandleManager::Event::PulseEvent(%08xh)\n",
     384            pHMHandleData->hHMHandle));
     385
    167386  return (O32_PulseEvent(pHMHandleData->hHMHandle));
     387#endif
    168388}
    169389
     
    183403BOOL HMDeviceEventClass::ResetEvent(PHMHANDLEDATA pHMHandleData)
    184404{
     405#ifdef USE_OS2SEMAPHORES
     406  APIRET rc;
     407  ULONG count; 
     408 
    185409  dprintf2(("KERNEL32: HandleManager::Event::ResetEvent(%08xh)\n",
    186410            pHMHandleData->hHMHandle));
    187411
     412  if(!(pHMHandleData->dwAccess & EVENT_MODIFY_STATE_W) )
     413  {
     414      dprintf(("ERROR: Access denied!!"));
     415      SetLastError(ERROR_ACCESS_DENIED_W);
     416      return FALSE;
     417  }
     418
     419  rc = DosResetEventSem(pHMHandleData->hHMHandle, &count);
     420  if(rc) {
     421      dprintf(("DosResetEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     422      SetLastError(error2WinError(rc));
     423      return FALSE;
     424  }
     425  SetLastError(ERROR_SUCCESS_W);
     426  return TRUE;
     427#else
     428  dprintf2(("KERNEL32: HandleManager::Event::ResetEvent(%08xh)\n",
     429            pHMHandleData->hHMHandle));
     430
    188431  return (O32_ResetEvent(pHMHandleData->hHMHandle));
    189 }
    190 
     432#endif
     433}
     434
  • trunk/src/kernel32/hmevent.h

    r768 r6049  
    1 /* $Id: hmevent.h,v 1.2 1999-08-31 23:14:03 phaller Exp $ */
     1/* $Id: hmevent.h,v 1.3 2001-06-19 10:50:24 sandervl Exp $ */
    22
    33/*
     
    2929 *****************************************************************************/
    3030
     31#ifdef USE_OS2SEMAPHORES
     32class HMDeviceEventClass : public HMDeviceHandler
     33#else
    3134class HMDeviceEventClass : public HMDeviceOpen32Class
     35#endif
    3236{
    3337public:
    3438  HMDeviceEventClass(LPCSTR lpDeviceName) : HMDeviceOpen32Class(lpDeviceName) {}
    3539
    36                      /* this is a handler method for calls to CreateEvent() */
     40  /* this is a handler method for calls to CreateEvent() */
    3741  virtual DWORD CreateEvent (PHMHANDLEDATA         pHMHandleData,
    3842                             LPSECURITY_ATTRIBUTES lpsa,
     
    4145                             LPCTSTR               lpszEventName);
    4246
    43                        /* this is a handler method for calls to OpenEvent() */
     47#ifdef USE_OS2SEMAPHORES
     48  virtual BOOL  CloseHandle(PHMHANDLEDATA pHMHandleData);
     49
     50  virtual BOOL DuplicateHandle(PHMHANDLEDATA pHMHandleData, HANDLE  srcprocess,
     51                               PHMHANDLEDATA pHMSrcHandle,
     52                               HANDLE  destprocess,
     53                               PHANDLE desthandle,
     54                               DWORD   fdwAccess,
     55                               BOOL    fInherit,
     56                               DWORD   fdwOptions,
     57                               DWORD   fdwOdinOptions);
     58#endif
     59 
     60  /* this is a handler method for calls to OpenEvent() */
    4461  virtual DWORD OpenEvent   (PHMHANDLEDATA         pHMHandleData,
    4562                             BOOL                  fInheritHandle,
    4663                             LPCTSTR               lpszEventName);
    4764
    48                        /* this is a handle method for calls to ResetEvent() */
     65  /* this is a handle method for calls to ResetEvent() */
    4966  virtual BOOL  ResetEvent  (PHMHANDLEDATA         pHMHandleData);
    5067
    51                          /* this is a handle method for calls to SetEvent() */
     68  /* this is a handle method for calls to SetEvent() */
    5269  virtual BOOL  SetEvent    (PHMHANDLEDATA         pHMHandleData);
    5370
    54                        /* this is a handle method for calls to PulseEvent() */
     71  /* this is a handle method for calls to PulseEvent() */
    5572  virtual BOOL  PulseEvent  (PHMHANDLEDATA         pHMHandleData);
    5673};
  • trunk/src/kernel32/hmmutex.cpp

    r2802 r6049  
    1 /* $Id: hmmutex.cpp,v 1.3 2000-02-16 14:24:00 sandervl Exp $ */
     1/* $Id: hmmutex.cpp,v 1.4 2001-06-19 10:50:25 sandervl Exp $ */
    22
    33/*
     4 * Win32 Mutex Semaphore implementation
     5 *
     6 * TODO: Inheritance
     7 * TODO: No inheritance when CreateMutex is called for existing named event semaphore?
     8 *       (see HMCreateMutex in handlemanager.cpp)
     9 * TODO: Name collisions with files & mutex not allowed. Check if this can happen in OS/2
     10 *
    411 * Project Odin Software License can be found in LICENSE.TXT
    5  * Win32 Unified Handle Manager for OS/2
    6  * Copyright 1999 Patrick Haller (haller@zebra.fh-weingarten.de)
     12 *
     13 * Copyright 2001 Sander van Leeuwen (sandervl@xs4all.nl)
    714 */
    815
     
    2229 *****************************************************************************/
    2330
     31#ifdef USE_OS2SEMAPHORES
     32#define INCL_DOSSEMAPHORES
     33#include <os2wrap.h>
     34#include <win32type.h>
     35#include <win32api.h>
     36#include <winconst.h>
     37#else
    2438#include <os2win.h>
     39#endif
    2540#include <stdlib.h>
    2641#include <string.h>
    2742#include "unicode.h"
    2843#include "misc.h"
     44#include "oslibdos.h"
    2945
    3046#include "HandleManager.H"
     
    6480                                      LPCTSTR               lpszMutexName)
    6581{
     82#ifdef USE_OS2SEMAPHORES
     83  APIRET rc;
     84  HMTX htmx;
     85  char szSemName[CCHMAXPATH];
     86
     87  dprintf(("KERNEL32: HandleManager::Mutex::CreateMutex(%08xh,%08xh,%08xh,%s)\n",
     88           pHMHandleData,
     89           lpsa,
     90           fInitialOwner,
     91           lpszMutexName));
     92
     93  if(lpszMutexName) {
     94      strcpy(szSemName, "\\SEM32\\");
     95      strcat(szSemName, lpszMutexName);
     96      lpszMutexName = szSemName;
     97  }
     98  rc = DosCreateMutexSem(lpszMutexName, &htmx, 0, fInitialOwner);
     99
     100  if(rc) {
     101      dprintf(("DosCreateMutexSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     102      pHMHandleData->hHMHandle = 0;
     103      return error2WinError(rc);
     104  }
     105  pHMHandleData->dwAccess  = MUTEX_ALL_ACCESS_W;
     106  pHMHandleData->hHMHandle = htmx;
     107  return ERROR_SUCCESS_W;
     108#else
    66109  HANDLE hOpen32;
    67110
     
    83126  else
    84127    return (O32_GetLastError());
     128#endif
    85129}
    86130
     
    102146                                    LPCTSTR               lpszMutexName)
    103147{
     148#ifdef USE_OS2SEMAPHORES
     149  HMTX   hmtx;
     150  APIRET rc;
     151  char szSemName[CCHMAXPATH];
     152
     153  dprintf(("KERNEL32: HandleManager::Mutex::OpenMutex(%08xh,%08xh,%s)\n",
     154           pHMHandleData,
     155           fInheritHandle,
     156           lpszMutexName));
     157
     158  if(lpszMutexName == NULL) {
     159      pHMHandleData->hHMHandle = 0;
     160      return ERROR_INVALID_PARAMETER_W;
     161  }
     162
     163  strcpy(szSemName, "\\SEM32\\");
     164  strcat(szSemName, lpszMutexName);
     165  rc = DosOpenMutexSem(szSemName, &hmtx);
     166  if(rc) {
     167      dprintf(("DosOpenMutexSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     168      pHMHandleData->hHMHandle = 0;
     169      return error2WinError(rc);
     170  }
     171  pHMHandleData->hHMHandle = hmtx;
     172  return ERROR_SUCCESS_W;
     173#else
    104174  HANDLE hOpen32;
    105175
     
    120190  else
    121191    return (O32_GetLastError());
    122 }
    123 
     192#endif
     193}
     194
     195/*****************************************************************************
     196 * Name      : HMDeviceMutexClass::CloseHandle
     197 * Purpose   : close the handle
     198 * Parameters: PHMHANDLEDATA pHMHandleData
     199 * Variables :
     200 * Result    : API returncode
     201 * Remark    :
     202 * Status    :
     203 *
     204 * Author    :
     205 *****************************************************************************/
     206
     207#ifdef USE_OS2SEMAPHORES
     208BOOL HMDeviceMutexClass::CloseHandle(PHMHANDLEDATA pHMHandleData)
     209{
     210  APIRET rc;
     211
     212  if(pHMHandleData->hHMHandle) {
     213      rc = DosCloseMutexSem((HEV)pHMHandleData->hHMHandle);
     214      if(rc) {
     215          dprintf(("DosCloseMutexSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     216          SetLastError(error2WinError(rc));
     217          return FALSE;
     218      }
     219  }
     220  return TRUE;
     221}
     222#endif
     223
     224/*****************************************************************************
     225 * Name      : HMDeviceMutexClass::DuplicateHandle
     226 * Purpose   :
     227 * Parameters:
     228 *             various parameters as required
     229 * Variables :
     230 * Result    :
     231 * Remark    : the standard behaviour is to return an error code for non-
     232 *             existant request codes
     233 * Status    :
     234 *
     235 * Author    :
     236 *****************************************************************************/
     237#ifdef USE_OS2SEMAPHORES
     238BOOL HMDeviceMutexClass::DuplicateHandle(PHMHANDLEDATA pHMHandleData, HANDLE  srcprocess,
     239                               PHMHANDLEDATA pHMSrcHandle,
     240                               HANDLE  destprocess,
     241                               PHANDLE desthandle,
     242                               DWORD   fdwAccess,
     243                               BOOL    fInherit,
     244                               DWORD   fdwOptions,
     245                               DWORD   fdwOdinOptions)
     246{
     247  APIRET rc;
     248  HMTX hmtx;
     249 
     250  dprintf(("KERNEL32:HandleManager::DuplicateHandle %s(%08x,%08x,%08x,%08x,%08x) - NOT IMPLEMENTED!!!!!!!!\n",
     251           lpHMDeviceName,
     252           pHMHandleData,
     253           srcprocess, pHMSrcHandle, destprocess, desthandle));
     254
     255  if(srcprocess != destprocess) {
     256      DebugInt3();
     257      SetLastError(ERROR_ACCESS_DENIED_W);
     258      return FALSE;
     259  }
     260  hmtx = (HMTX)pHMSrcHandle->hHMHandle;
     261  rc = DosOpenMutexSem(NULL, &hmtx);
     262  if(rc) {
     263      dprintf(("DosOpenMutexSem %x failed with rc %d", pHMSrcHandle->hHMHandle, rc));
     264      pHMHandleData->hHMHandle = 0;
     265      SetLastError(error2WinError(rc));
     266      return FALSE;
     267  }
     268  pHMHandleData->dwAccess  = fdwAccess;
     269  pHMHandleData->hHMHandle = hmtx;
     270  SetLastError(ERROR_SUCCESS_W);
     271  return TRUE;
     272}
     273#endif
    124274
    125275/*****************************************************************************
     
    137287BOOL HMDeviceMutexClass::ReleaseMutex(PHMHANDLEDATA pHMHandleData)
    138288{
     289#ifdef USE_OS2SEMAPHORES
     290  APIRET rc;
     291 
    139292  dprintf(("KERNEL32: HandleManager::Mutex::ReleaseMutex(%08xh)\n",
    140293           pHMHandleData->hHMHandle));
    141294
     295  rc = DosReleaseMutexSem(pHMHandleData->hHMHandle);
     296  if(rc) {
     297      dprintf(("DosReleaseMutexSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     298      SetLastError(error2WinError(rc));
     299      return FALSE;
     300  }
     301  SetLastError(ERROR_SUCCESS_W);
     302  return TRUE;
     303#else
     304  dprintf(("KERNEL32: HandleManager::Mutex::ReleaseMutex(%08xh)\n",
     305           pHMHandleData->hHMHandle));
     306
    142307  return (O32_ReleaseMutex(pHMHandleData->hHMHandle));
    143 }
    144 
     308#endif
     309}
     310
  • trunk/src/kernel32/hmmutex.h

    r768 r6049  
    1 /* $Id: hmmutex.h,v 1.2 1999-08-31 23:14:03 phaller Exp $ */
     1/* $Id: hmmutex.h,v 1.3 2001-06-19 10:50:25 sandervl Exp $ */
    22
    33/*
     
    2929 *****************************************************************************/
    3030
     31#ifdef USE_OS2SEMAPHORES
     32class HMDeviceMutexClass : public HMDeviceHandler
     33#else
    3134class HMDeviceMutexClass : public HMDeviceOpen32Class
     35#endif
    3236{
    3337public:
    3438  HMDeviceMutexClass(LPCSTR lpDeviceName) : HMDeviceOpen32Class(lpDeviceName) {}
    3539
    36                      /* this is a handler method for calls to CreateMutex() */
     40  /* this is a handler method for calls to CreateMutex() */
    3741  virtual DWORD CreateMutex (PHMHANDLEDATA         pHMHandleData,
    3842                             LPSECURITY_ATTRIBUTES lpsa,
     
    4044                             LPCTSTR               lpszMutexName);
    4145
    42                        /* this is a handler method for calls to OpenMutex() */
     46  /* this is a handler method for calls to OpenMutex() */
    4347  virtual DWORD OpenMutex   (PHMHANDLEDATA         pHMHandleData,
    4448                             BOOL                  fInheritHandle,
    4549                             LPCTSTR               lpszMutexName);
    4650
    47                      /* this is a handle method for calls to ReleaseMutex() */
     51#ifdef USE_OS2SEMAPHORES
     52  virtual BOOL  CloseHandle(PHMHANDLEDATA pHMHandleData);
     53
     54  virtual BOOL DuplicateHandle(PHMHANDLEDATA pHMHandleData, HANDLE  srcprocess,
     55                               PHMHANDLEDATA pHMSrcHandle,
     56                               HANDLE  destprocess,
     57                               PHANDLE desthandle,
     58                               DWORD   fdwAccess,
     59                               BOOL    fInherit,
     60                               DWORD   fdwOptions,
     61                               DWORD   fdwOdinOptions);
     62#endif
     63                               
     64  /* this is a handle method for calls to ReleaseMutex() */
    4865  virtual BOOL  ReleaseMutex(PHMHANDLEDATA         pHMHandleData);
    4966};
  • trunk/src/kernel32/hmsemaphore.cpp

    r2802 r6049  
    1 /* $Id: hmsemaphore.cpp,v 1.3 2000-02-16 14:24:00 sandervl Exp $ */
     1/* $Id: hmsemaphore.cpp,v 1.4 2001-06-19 10:50:25 sandervl Exp $ */
    22
    33/*
     4 * Win32 Semaphore implementation
     5 *
     6 * TODO: Inheritance
     7 * TODO: Does DCE_POSTONE work in Warp 3 or 4 with no FP applied?
     8 * TODO: No inheritance when CreateSemaphore is called for existing named event semaphore?
     9 *       (see HMCreateSemaphore in handlemanager.cpp)
     10 * TODO: Name collisions with files & mutex not allowed. Check if this can happen in OS/2
     11 * TODO: Does NOT work for sharing semaphores between processes!!
     12 *
    413 * Project Odin Software License can be found in LICENSE.TXT
    5  * Win32 Unified Handle Manager for OS/2
    6  * Copyright 1999 Patrick Haller (haller@zebra.fh-weingarten.de)
     14 *
     15 * Copyright 2001 Sander van Leeuwen (sandervl@xs4all.nl)
    716 */
    817
     
    2231 *****************************************************************************/
    2332
     33#ifdef USE_OS2SEMAPHORES
     34#define INCL_DOSSEMAPHORES
     35#include <os2wrap.h>
     36#include <win32type.h>
     37#include <win32api.h>
     38#include <winconst.h>
     39#else
    2440#include <os2win.h>
     41#endif
    2542#include <stdlib.h>
    2643#include <string.h>
     
    3047#include "HandleManager.H"
    3148#include "HMSemaphore.h"
     49#include "oslibdos.h"
    3250
    3351#define DBG_LOCALLOG    DBG_hmsemaphore
    3452#include "dbglocal.h"
     53
     54#ifndef DCE_AUTORESET
     55#define DCE_AUTORESET   0x1000  /* DosCreateEventSem option to auto-reset  */
     56                                /* event semaphore on post.                */
     57#define DCE_POSTONE     0x0800  /* DosCreateEventSem option to post only   */
     58                                /* waiter and auto-reset the semaphore when*/
     59                                /* there are multiple waiters.             */
     60#endif
    3561
    3662
     
    6692                                              LPCTSTR               lpszSemaphoreName)
    6793{
    68   HANDLE hOpen32;
     94#ifdef USE_OS2SEMAPHORES
     95  APIRET rc;
     96  HEV hev;
     97  char szSemName[CCHMAXPATH];
     98
    6999
    70100  dprintf(("KERNEL32: HandleManager::Semaphore::CreateSemaphore(%08xh,%08xh,%08xh,%08xh,%s)\n",
     
    75105           lpszSemaphoreName));
    76106
     107  if(lMaximumCount <= 0 || lInitialCount < 0 || lInitialCount > lMaximumCount) {
     108      dprintf(("ERROR: invalid parameter"));
     109      return ERROR_INVALID_PARAMETER_W;
     110  }
     111 
     112  if(lpszSemaphoreName) {
     113      strcpy(szSemName, "\\SEM32\\");
     114      strcat(szSemName, lpszSemaphoreName);
     115      lpszSemaphoreName = szSemName;
     116  }
     117  //Manual reset means all threads waiting on the event semaphore will be
     118  //unblocked and the app must manually reset the event semaphore
     119  //Automatic reset -> only one waiting thread unblocked & state reset
     120  rc = DosCreateEventSem(lpszSemaphoreName, &hev, DCE_POSTONE, lInitialCount);
     121
     122  if(rc) {
     123      dprintf(("DosCreateEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     124      pHMHandleData->hHMHandle = 0;
     125      return error2WinError(rc);
     126  }
     127  pHMHandleData->dwAccess  = SEMAPHORE_ALL_ACCESS_W;
     128  pHMHandleData->dwFlags   = lMaximumCount;
     129  pHMHandleData->hHMHandle = hev;
     130  return ERROR_SUCCESS_W;
     131#else
     132  HANDLE hOpen32;
     133
     134  dprintf(("KERNEL32: HandleManager::Semaphore::CreateSemaphore(%08xh,%08xh,%08xh,%08xh,%s)\n",
     135           pHMHandleData,
     136           lpsa,
     137           lInitialCount,
     138           lMaximumCount,
     139           lpszSemaphoreName));
     140
    77141  hOpen32 = O32_CreateSemaphore(lpsa,              // call Open32
    78142                                lInitialCount,
     
    87151  else
    88152    return (O32_GetLastError());
     153#endif
    89154}
    90155
     
    106171                                            LPCTSTR               lpszSemaphoreName)
    107172{
     173#ifdef USE_OS2SEMAPHORES
     174  HEV    hev;
     175  APIRET rc;
     176  char szSemName[CCHMAXPATH];
     177
     178  dprintf(("KERNEL32: HandleManager::Semaphore::OpenSemaphore(%08xh,%08xh,%s)\n",
     179           pHMHandleData,
     180           fInheritHandle,
     181           lpszSemaphoreName));
     182
     183  if(lpszSemaphoreName == NULL) {
     184      pHMHandleData->hHMHandle = 0;
     185      return ERROR_INVALID_PARAMETER_W;
     186  }
     187
     188  strcpy(szSemName, "\\SEM32\\");
     189  strcat(szSemName, lpszSemaphoreName);
     190  rc = DosOpenEventSem(szSemName, &hev);
     191  if(rc) {
     192      dprintf(("DosOpenEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     193      pHMHandleData->hHMHandle = 0;
     194      return error2WinError(rc);
     195  }
     196  pHMHandleData->hHMHandle = hev;
     197  return ERROR_SUCCESS_W;
     198#else
    108199  HANDLE hOpen32;
    109200
     
    124215  else
    125216    return (O32_GetLastError());
    126 }
    127 
     217#endif
     218}
     219
     220/*****************************************************************************
     221 * Name      : HMDeviceEventClass::CloseHandle
     222 * Purpose   : close the handle
     223 * Parameters: PHMHANDLEDATA pHMHandleData
     224 * Variables :
     225 * Result    : API returncode
     226 * Remark    :
     227 * Status    :
     228 *
     229 * Author    :
     230 *****************************************************************************/
     231
     232#ifdef USE_OS2SEMAPHORES
     233BOOL HMDeviceSemaphoreClass::CloseHandle(PHMHANDLEDATA pHMHandleData)
     234{
     235  APIRET rc;
     236
     237  if(pHMHandleData->hHMHandle) {
     238      rc = DosCloseEventSem((HEV)pHMHandleData->hHMHandle);
     239      if(rc) {
     240          dprintf(("DosCloseEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     241          SetLastError(error2WinError(rc));
     242          return FALSE;
     243      }
     244  }
     245  return TRUE;
     246}
     247#endif
     248
     249
     250/*****************************************************************************
     251 * Name      : HMDeviceEventClass::DuplicateHandle
     252 * Purpose   :
     253 * Parameters:
     254 *             various parameters as required
     255 * Variables :
     256 * Result    :
     257 * Remark    : the standard behaviour is to return an error code for non-
     258 *             existant request codes
     259 * Status    :
     260 *
     261 * Author    :
     262 *****************************************************************************/
     263#ifdef USE_OS2SEMAPHORES
     264BOOL HMDeviceSemaphoreClass::DuplicateHandle(PHMHANDLEDATA pHMHandleData, HANDLE  srcprocess,
     265                               PHMHANDLEDATA pHMSrcHandle,
     266                               HANDLE  destprocess,
     267                               PHANDLE desthandle,
     268                               DWORD   fdwAccess,
     269                               BOOL    fInherit,
     270                               DWORD   fdwOptions,
     271                               DWORD   fdwOdinOptions)
     272{
     273  APIRET rc;
     274  HEV hev;
     275 
     276  dprintf(("KERNEL32:HandleManager::DuplicateHandle %s(%08x,%08x,%08x,%08x,%08x)",
     277           lpHMDeviceName,
     278           pHMHandleData,
     279           srcprocess, pHMSrcHandle, destprocess, desthandle));
     280
     281  if(srcprocess != destprocess) {
     282      DebugInt3();
     283      SetLastError(ERROR_ACCESS_DENIED_W);
     284      return FALSE;
     285  }
     286  hev = (HEV)pHMSrcHandle->hHMHandle;
     287  rc = DosOpenEventSem(NULL, &hev);
     288  if(rc) {
     289      dprintf(("DosOpenEventSem %x failed with rc %d", pHMSrcHandle->hHMHandle, rc));
     290      pHMHandleData->hHMHandle = 0;
     291      SetLastError(error2WinError(rc));
     292      return FALSE;
     293  }
     294  pHMHandleData->dwAccess  = fdwAccess;
     295  pHMHandleData->dwFlags   = pHMSrcHandle->dwFlags; //lMaximumCount;
     296  pHMHandleData->hHMHandle = hev;
     297  SetLastError(ERROR_SUCCESS_W);
     298  return TRUE;
     299}
     300#endif
    128301
    129302/*****************************************************************************
     
    143316                                              LPLONG        lpPreviousCount)
    144317{
     318#ifdef USE_OS2SEMAPHORES
     319  APIRET rc;
     320  ULONG count; 
     321 
     322  dprintf2(("KERNEL32: HandleManager::Semaphore::ReleaseSemaphore(%08xh,%08xh,%08xh)\n",
     323            pHMHandleData->hHMHandle,
     324            cReleaseCount,
     325            lpPreviousCount));
     326
     327  if(!(pHMHandleData->dwAccess & SEMAPHORE_MODIFY_STATE_W) )
     328  {
     329      dprintf(("ERROR: Access denied!!"));
     330      SetLastError(ERROR_ACCESS_DENIED_W);
     331      return FALSE;
     332  }
     333
     334  rc = DosResetEventSem(pHMHandleData->hHMHandle, &count);
     335  if(rc) {
     336      dprintf(("DosResetEventSem %x failed with rc %d", pHMHandleData->hHMHandle, rc));
     337      SetLastError(error2WinError(rc));
     338      return FALSE;
     339  }
     340  SetLastError(ERROR_SUCCESS_W);
     341  return TRUE;
     342#else
    145343  dprintf(("KERNEL32: HandleManager::Semaphore::ReleaseSemaphore(%08xh,%08xh,%08xh)\n",
    146344           pHMHandleData->hHMHandle,
     
    151349                               cReleaseCount,
    152350                               lpPreviousCount));
    153 }
    154 
     351#endif
     352}
     353
  • trunk/src/kernel32/hmsemaphore.h

    r768 r6049  
    1 /* $Id: hmsemaphore.h,v 1.2 1999-08-31 23:14:03 phaller Exp $ */
     1/* $Id: hmsemaphore.h,v 1.3 2001-06-19 10:50:25 sandervl Exp $ */
    22
    33/*
     
    2929 *****************************************************************************/
    3030
     31#ifdef USE_OS2SEMAPHORES
     32class HMDeviceSemaphoreClass : public HMDeviceHandler
     33#else
    3134class HMDeviceSemaphoreClass : public HMDeviceOpen32Class
     35#endif
    3236{
    3337public:
    3438  HMDeviceSemaphoreClass(LPCSTR lpDeviceName) : HMDeviceOpen32Class(lpDeviceName) {}
    3539
    36                      /* this is a handler method for calls to CreateSemaphore() */
     40  /* this is a handler method for calls to CreateSemaphore() */
    3741  virtual DWORD CreateSemaphore (PHMHANDLEDATA         pHMHandleData,
    3842                                 LPSECURITY_ATTRIBUTES lpsa,
     
    4145                                 LPCTSTR               lpszSemaphoreName);
    4246
    43                        /* this is a handler method for calls to OpenSemaphore() */
     47  /* this is a handler method for calls to OpenSemaphore() */
    4448  virtual DWORD OpenSemaphore   (PHMHANDLEDATA         pHMHandleData,
    4549                                 BOOL                  fInheritHandle,
    4650                                 LPCTSTR               lpszSemaphoreName);
    4751
    48                      /* this is a handle method for calls to ReleaseSemaphore() */
     52#ifdef USE_OS2SEMAPHORES
     53  virtual BOOL  CloseHandle(PHMHANDLEDATA pHMHandleData);
     54
     55  virtual BOOL DuplicateHandle(PHMHANDLEDATA pHMHandleData, HANDLE  srcprocess,
     56                               PHMHANDLEDATA pHMSrcHandle,
     57                               HANDLE  destprocess,
     58                               PHANDLE desthandle,
     59                               DWORD   fdwAccess,
     60                               BOOL    fInherit,
     61                               DWORD   fdwOptions,
     62                               DWORD   fdwOdinOptions);
     63#endif
     64
     65  /* this is a handle method for calls to ReleaseSemaphore() */
    4966  virtual BOOL  ReleaseSemaphore(PHMHANDLEDATA pHMHandleData,
    5067                                 LONG          cReleaseCount,
  • trunk/src/kernel32/oslibdos.cpp

    r6029 r6049  
    1 /* $Id: oslibdos.cpp,v 1.65 2001-06-16 16:10:12 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.66 2001-06-19 10:50:25 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    102102// NOTE: add all codes you need, list is not complete!
    103103//******************************************************************************
    104 DWORD error2WinError(APIRET rc,DWORD defaultCode = ERROR_NOT_ENOUGH_MEMORY_W)
     104DWORD error2WinError(APIRET rc,DWORD defaultCode)
    105105{
    106106  switch (rc)
  • trunk/src/kernel32/oslibdos.h

    r6029 r6049  
    1 /* $Id: oslibdos.h,v 1.30 2001-06-16 16:10:13 sandervl Exp $ */
     1/* $Id: oslibdos.h,v 1.31 2001-06-19 10:50:26 sandervl Exp $ */
    22
    33/*
     
    1313#define __OSLIBDOS_H__
    1414
     15
     16#ifdef OS2_INCLUDED
     17DWORD error2WinError(APIRET rc,DWORD defaultCode = ERROR_NOT_ENOUGH_MEMORY_W);
     18#else
     19DWORD error2WinError(DWORD rc,DWORD defaultCode = ERROR_NOT_ENOUGH_MEMORY);
     20#endif
    1521
    1622void  OSLibInitWSeBFileIO();
Note: See TracChangeset for help on using the changeset viewer.