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/hmfile.cpp

    r9530 r9653  
    1 /* $Id: hmfile.cpp,v 1.37 2002-12-19 12:55:27 sandervl Exp $ */
     1/* $Id: hmfile.cpp,v 1.38 2003-01-10 12:57:13 sandervl Exp $ */
    22
    33/*
     
    351351        {
    352352            memcpy(pHMHandleData, &duphdata, sizeof(duphdata));
     353
     354            if(fInherit) SetHandleInformation(pHMHandleData, ~HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
     355
    353356            SetLastError(ERROR_SUCCESS);
    354357            return TRUE;
     
    368371    if (rc)
    369372    {
    370       dprintf(("ERROR: DulicateHandle: OSLibDosDupHandle(%s) failed = %u\n",
    371                rc,
    372                srcfileinfo->lpszFileName));
     373      dprintf(("ERROR: DuplicateHandle: OSLibDosDupHandle(%s) failed = %u",
     374               srcfileinfo->lpszFileName, rc));
    373375      SetLastError(rc);
    374376      return FALSE;   // ERROR
    375377    }
    376378    else {
     379      if(fInherit) SetHandleInformation(pHMHandleData, ~HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
     380
    377381      SetLastError(ERROR_SUCCESS);
    378382      pHMHandleData->hHMHandle = *desthandle;
     
    386390    return FALSE;
    387391  }
     392}
     393
     394/*****************************************************************************
     395 * Name      : BOOL HMDeviceFileClass::SetHandleInformation
     396 * Purpose   : The SetHandleInformation function sets certain properties of an
     397 *             object handle. The information is specified as a set of bit flags.
     398 * Parameters: HANDLE hObject  handle to an object
     399 *             DWORD  dwMask   specifies flags to change
     400 *             DWORD  dwFlags  specifies new values for flags
     401 * Variables :
     402 * Result    : TRUE / FALSE
     403 * Remark    :
     404 * Status    :
     405 *
     406 * Author    : SvL
     407 *****************************************************************************/
     408BOOL HMDeviceFileClass::SetHandleInformation(PHMHANDLEDATA pHMHandleData,
     409                                             DWORD  dwMask,
     410                                             DWORD  dwFlags)
     411{
     412    DWORD rc;
     413
     414    pHMHandleData->dwHandleInformation &= ~dwMask;
     415    pHMHandleData->dwHandleInformation |= (dwFlags & dwMask);
     416
     417    rc = OSLibDosSetFHState(pHMHandleData->hHMHandle,
     418                            pHMHandleData->dwHandleInformation);
     419    if (rc)
     420    {
     421        dprintf(("ERROR: SetHandleInformation: OSLibDosSetFHState failed with %d", rc));
     422
     423        SetLastError(rc);
     424        return FALSE;
     425    }
     426
     427    SetLastError(ERROR_SUCCESS);
     428    return TRUE;
    388429}
    389430
Note: See TracChangeset for help on using the changeset viewer.