Ignore:
Timestamp:
Jan 10, 2003, 1:57:14 PM (23 years ago)
Author:
sandervl
Message:

implemented Get/SetHandleInformation; CloseHandle change for HANDLE_FLAG_PROTECT_FROM_CLOSE; inheritance support added to DuplicateHandle

File:
1 edited

Legend:

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

    r9235 r9653  
    1 /* $Id: HandleManager.cpp,v 1.91 2002-09-14 13:49:39 sandervl Exp $ */
     1/* $Id: HandleManager.cpp,v 1.92 2003-01-10 12:57:11 sandervl Exp $ */
    22
    33/*
     
    268268        TabWin32Handles[ulLoop].hmHandleData.hWin32Handle   = (HANDLE)ulLoop;
    269269        TabWin32Handles[ulLoop].hmHandleData.lpDeviceData   = NULL;
     270        TabWin32Handles[ulLoop].hmHandleData.dwHandleInformation = 0;
    270271        handleMutex.leave();
    271272        return (ulLoop);                    /* OK, then return it to the caller */
     
    10831084    HMHandleTemp.hWin32Handle  = iIndexNew;
    10841085    HMHandleTemp.lpDeviceData  = pDevData;
     1086    HMHandleTemp.dwHandleInformation = 0;
    10851087  }
    10861088
     
    12861288}
    12871289
    1288 
     1290/*****************************************************************************
     1291 * Name      : DWORD HMGetHandleInformation
     1292 * Purpose   : The GetHandleInformation function obtains information about certain
     1293 *             properties of an object handle. The information is obtained as a set of bit flags.
     1294 * Parameters: HANDLE  hObject
     1295 *             LPDWORD lpdwFlags
     1296 * Variables :
     1297 * Result    : TRUE / FALSE
     1298 * Remark    :
     1299 * Status    :
     1300 *
     1301 * Author    : SvL
     1302 *****************************************************************************/
     1303BOOL HMGetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags)
     1304{
     1305  int       iIndex;                           /* index into the handle table */
     1306  BOOL      fResult;       /* result from the device handler's CloseHandle() */
     1307  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     1308
     1309                                                          /* validate handle */
     1310  iIndex = _HMHandleQuery(hObject);                         /* get the index */
     1311  if (-1 == iIndex)                                               /* error ? */
     1312  {
     1313      SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     1314      return (FALSE);                                        /* signal failure */
     1315  }
     1316
     1317  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     1318
     1319  //Handle information is stored in the handle structure; return it here
     1320  if(lpdwFlags) {
     1321      *lpdwFlags = pHMHandle->hmHandleData.dwHandleInformation;
     1322  }
     1323
     1324  SetLastError(ERROR_SUCCESS);
     1325  return TRUE;                                   /* deliver return code */
     1326}
     1327
     1328/*****************************************************************************
     1329 * Name      : BOOL HMSetHandleInformation
     1330 * Purpose   : The SetHandleInformation function sets certain properties of an
     1331 *             object handle. The information is specified as a set of bit flags.
     1332 * Parameters: HANDLE hObject  handle to an object
     1333 *             DWORD  dwMask   specifies flags to change
     1334 *             DWORD  dwFlags  specifies new values for flags
     1335 * Variables :
     1336 * Result    : TRUE / FALSE
     1337 * Remark    :
     1338 * Status    :
     1339 *
     1340 * Author    : SvL
     1341 *****************************************************************************/
     1342BOOL   HMSetHandleInformation       (HANDLE hObject,
     1343                                     DWORD  dwMask,
     1344                                     DWORD  dwFlags)
     1345{
     1346  int       iIndex;                           /* index into the handle table */
     1347  BOOL      fResult;       /* result from the device handler's CloseHandle() */
     1348  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     1349
     1350                                                          /* validate handle */
     1351  iIndex = _HMHandleQuery(hObject);                         /* get the index */
     1352  if (-1 == iIndex)                                               /* error ? */
     1353  {
     1354    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     1355    return (FALSE);                                        /* signal failure */
     1356  }
     1357
     1358  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     1359  //SvL: Check if pDeviceHandler is set
     1360  if (pHMHandle->pDeviceHandler)
     1361  {
     1362    fResult = pHMHandle->pDeviceHandler->SetHandleInformation(&pHMHandle->hmHandleData,
     1363                                                              dwMask, dwFlags);
     1364  }
     1365  else
     1366  {
     1367    dprintf(("HMSetHandleInformation(%08xh): pDeviceHandler not set", hObject));
     1368    fResult = TRUE;
     1369  }
     1370
     1371  if(fResult == TRUE) {
     1372      SetLastError(ERROR_SUCCESS);
     1373  }
     1374  return (fResult);                                   /* deliver return code */
     1375}
    12891376
    12901377/*****************************************************************************
     
    13241411
    13251412  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     1413
     1414  if(pHMHandle->hmHandleData.dwHandleInformation & HANDLE_FLAG_PROTECT_FROM_CLOSE) {
     1415      dprintf(("Handle not close because of HANDLE_FLAG_PROTECT_FROM_CLOSE"));
     1416      SetLastError(ERROR_SUCCESS);
     1417      return TRUE;
     1418  }
     1419
    13261420  //SvL: Check if pDeviceHandler is set
    13271421  if (pHMHandle->pDeviceHandler)
Note: See TracChangeset for help on using the changeset viewer.