CPalThread *pThread, // IN, OPTIONAL
IPalObject *pObjectToRegister,
CAllowedObjectTypes *pAllowedTypes,
- DWORD dwRightsRequested,
HANDLE *pHandle, // OUT
IPalObject **ppRegisteredObject // OUT
) = 0;
ObtainHandleForObject(
CPalThread *pThread, // IN, OPTIONAL
IPalObject *pObject,
- DWORD dwRightsRequested,
- bool fInheritHandle,
- IPalProcess *pProcessForHandle, // IN, OPTIONAL
HANDLE *pNewHandle // OUT
) = 0;
CPalThread *pThread, // IN, OPTIONAL
HANDLE hHandleToReference,
CAllowedObjectTypes *pAllowedTypes,
- DWORD dwRightsRequired,
IPalObject **ppObject // OUT
) = 0;
HANDLE rghHandlesToReference[],
DWORD dwHandleCount,
CAllowedObjectTypes *pAllowedTypes,
- DWORD dwRightsRequired,
IPalObject *rgpObjects[] // OUT
) = 0;
-
- //
- // This routine is for cross-process handle duplication.
- //
-
- virtual
- PAL_ERROR
- ReferenceObjectByForeignHandle(
- CPalThread *pThread, // IN, OPTIONAL
- HANDLE hForeignHandle,
- IPalProcess *pForeignProcess,
- CAllowedObjectTypes *pAllowedTypes,
- DWORD dwRightsRequired,
- IPalObject **ppObject // OUT
- ) = 0;
-
};
extern IPalObjectManager *g_pObjectManager;
PAL_ERROR
CheckObjectTypeAndRights(
IPalObject *pobj,
- CAllowedObjectTypes *paot,
- DWORD dwRightsGranted,
- DWORD dwRightsRequired
+ CAllowedObjectTypes *paot
);
/*++
pobjToRegister -- the object instance to register. This routine will always
call ReleaseReference on this instance
paot -- object types that are compatible with the new object instance
- dwRightsRequested -- requested access rights for the returned handle (ignored)
pHandle -- on success, receives a handle to the registered object
ppobjRegistered -- on success, receives a reference to the registered object
instance.
CPalThread *pthr,
IPalObject *pobjToRegister,
CAllowedObjectTypes *paot,
- DWORD dwRightsRequested,
HANDLE *pHandle, // OUT
IPalObject **ppobjRegistered // OUT
)
CObjectAttributes *poa;
CObjectType *potObj;
IPalObject *pobjExisting;
- BOOL fInherit = FALSE;
BOOL fShared = FALSE;
_ASSERTE(NULL != pthr);
ENTRY("CSharedMemoryObjectManager::RegisterObject "
"(this=%p, pthr=%p, pobjToRegister=%p, paot=%p, "
- "dwRightsRequested=%d, pHandle=%p, ppobjRegistered=%p)\n",
+ "pHandle=%p, ppobjRegistered=%p)\n",
this,
pthr,
pobjToRegister,
paot,
- dwRightsRequested,
pHandle,
ppobjRegistered
);
poa = pobjToRegister->GetObjectAttributes();
_ASSERTE(NULL != poa);
- if (NULL != poa->pSecurityAttributes)
- {
- fInherit = poa->pSecurityAttributes->bInheritHandle;
- }
-
potObj = pobjToRegister->GetObjectType();
fShared = (SharedObject == pshmobj->GetObjectDomain());
palError = ObtainHandleForObject(
pthr,
pobjExisting,
- dwRightsRequested,
- fInherit,
- NULL,
pHandle
);
palError = ObtainHandleForObject(
pthr,
pobjToRegister,
- dwRightsRequested,
- fInherit,
- NULL,
pHandle
);
Parameters:
pthr -- thread data for calling thread
pobj -- the object to allocate a handle for
- dwRightsRequired -- the access rights to grant the handle; currently ignored
- fInheritHandle -- true if the handle is inheritable; ignored for all but file
- objects that represent pipes
- pProcessForHandle -- the process the handle is to be used from; currently
- must be NULL
pNewHandle -- on success, receives the newly allocated handle
--*/
CSharedMemoryObjectManager::ObtainHandleForObject(
CPalThread *pthr,
IPalObject *pobj,
- DWORD dwRightsRequested,
- bool fInheritHandle,
- IPalProcess *pProcessForHandle, // IN, OPTIONAL
HANDLE *pNewHandle // OUT
)
{
_ASSERTE(NULL != pNewHandle);
ENTRY("CSharedMemoryObjectManager::ObtainHandleForObject "
- "(this=%p, pthr=%p, pobj=%p, dwRightsRequested=%d, "
- "fInheritHandle=%p, pProcessForHandle=%p, pNewHandle=%p)\n",
+ "(this=%p, pthr=%p, pobj=%p, "
+ "pNewHandle=%p)\n",
this,
pthr,
pobj,
- dwRightsRequested,
- fInheritHandle,
- pProcessForHandle,
pNewHandle
);
- if (NULL != pProcessForHandle)
- {
- //
- // Not yet supported
- //
-
- ASSERT("Caller to ObtainHandleForObject provided a process\n");
- return ERROR_CALL_NOT_IMPLEMENTED;
- }
-
palError = m_HandleManager.AllocateHandle(
pthr,
pobj,
- dwRightsRequested,
- fInheritHandle,
pNewHandle
);
pthr -- thread data for calling thread
hHandleToReference -- the handle to reference
paot -- acceptable types for the underlying object
- dwRightsRequired -- the access rights that the handle must have been
granted; currently ignored
ppobj -- on success, receives a reference to the object instance
--*/
CPalThread *pthr,
HANDLE hHandleToReference,
CAllowedObjectTypes *paot,
- DWORD dwRightsRequired,
IPalObject **ppobj // OUT
)
{
PAL_ERROR palError;
- DWORD dwRightsGranted;
IPalObject *pobj;
_ASSERTE(NULL != pthr);
_ASSERTE(NULL != ppobj);
ENTRY("CSharedMemoryObjectManager::ReferenceObjectByHandle "
- "(this=%p, pthr=%p, hHandleToReference=%p, paot=%p, "
- "dwRightsRequired=%d, ppobj=%p)\n",
+ "(this=%p, pthr=%p, hHandleToReference=%p, paot=%p, ppobj=%p)\n",
this,
pthr,
hHandleToReference,
paot,
- dwRightsRequired,
ppobj
);
palError = m_HandleManager.GetObjectFromHandle(
pthr,
hHandleToReference,
- &dwRightsGranted,
&pobj
);
{
palError = CheckObjectTypeAndRights(
pobj,
- paot,
- dwRightsGranted,
- dwRightsRequired
+ paot
);
if (NO_ERROR == palError)
rgHandlesToReference -- the array of handles to reference
dwHandleCount -- the number of handles in the arrayu
paot -- acceptable types for the underlying objects
- dwRightsRequired -- the access rights that the handles must have been
- granted; currently ignored
rgpobjs -- on success, receives references to the object instances; will
be empty on failures
--*/
HANDLE rghHandlesToReference[],
DWORD dwHandleCount,
CAllowedObjectTypes *paot,
- DWORD dwRightsRequired,
IPalObject *rgpobjs[] // OUT (caller allocated)
)
{
PAL_ERROR palError = NO_ERROR;
IPalObject *pobj = NULL;
- DWORD dwRightsGranted;
DWORD dw;
_ASSERTE(NULL != pthr);
ENTRY("CSharedMemoryObjectManager::ReferenceMultipleObjectsByHandleArray "
"(this=%p, pthr=%p, rghHandlesToReference=%p, dwHandleCount=%d, "
- "pAllowedTyped=%d, dwRightsRequired=%d, rgpobjs=%p)\n",
+ "pAllowedTyped=%d, rgpobjs=%p)\n",
this,
pthr,
rghHandlesToReference,
dwHandleCount,
paot,
- dwRightsRequired,
rgpobjs
);
palError = m_HandleManager.GetObjectFromHandle(
pthr,
rghHandlesToReference[dw],
- &dwRightsGranted,
&pobj
);
{
palError = CheckObjectTypeAndRights(
pobj,
- paot,
- dwRightsGranted,
- dwRightsRequired
+ paot
);
if (NO_ERROR == palError)
/*++
Function:
- CSharedMemoryObjectManager::ReferenceObjectByForeignHandle
-
- Returns a referenced object instance that a handle belongin to
- another process refers to; currently unimplemented
-
-Parameters:
- pthr -- thread data for calling thread
- hForeignHandle -- the handle to reference
- pForeignProcess -- the process that hForeignHandle belongs to
- paot -- acceptable types for the underlying object
- dwRightsRequired -- the access rights that the handle must have been
- granted; currently ignored
- ppobj -- on success, receives a reference to the object instance
---*/
-
-PAL_ERROR
-CSharedMemoryObjectManager::ReferenceObjectByForeignHandle(
- CPalThread *pthr,
- HANDLE hForeignHandle,
- IPalProcess *pForeignProcess,
- CAllowedObjectTypes *paot,
- DWORD dwRightsRequired,
- IPalObject **ppobj // OUT
- )
-{
- //
- // Not implemented for basic shared memory object manager --
- // requires an IPC channel. (For the shared memory object manager
- // PAL_LocalHandleToRemote and PAL_RemoteHandleToLocal must still
- // be used...)
- //
-
- ASSERT("ReferenceObjectByForeignHandle not yet supported\n");
- return ERROR_CALL_NOT_IMPLEMENTED;
-}
-
-/*++
-Function:
CSharedMemoryObjectManager::ImportSharedObjectIntoProcess
Takes an object's shared memory data and from it creates the
Parameters:
pobj -- the object instance whose type is to be checked
paot -- the acceptable type for the object instance
- dwRightsGranted -- the granted access rights (ignored)
- dwRightsRequired -- the required access rights (ignored)
--*/
static
PAL_ERROR
CheckObjectTypeAndRights(
IPalObject *pobj,
- CAllowedObjectTypes *paot,
- DWORD dwRightsGranted,
- DWORD dwRightsRequired
+ CAllowedObjectTypes *paot
)
{
PAL_ERROR palError = NO_ERROR;
_ASSERTE(NULL != pobj);
_ASSERTE(NULL != paot);
- ENTRY("CheckObjectTypeAndRights (pobj=%p, paot=%p, "
- "dwRightsGranted=%d, dwRightsRequired=%d)\n",
+ ENTRY("CheckObjectTypeAndRights (pobj=%p, paot=%p)\n",
pobj,
- paot,
- dwRightsGranted,
- dwRightsRequired
+ paot
);
- if (paot->IsTypeAllowed(pobj->GetObjectType()->GetId()))
- {
-#ifdef ENFORCE_OBJECT_ACCESS_RIGHTS
-
- //
- // This is where the access right check would occur if Win32 object
- // security were supported.
- //
-
- if ((dwRightsRequired & dwRightsGranted) != dwRightsRequired)
- {
- palError = ERROR_ACCESS_DENIED;
- }
-#endif
- }
- else
+ if (!paot->IsTypeAllowed(pobj->GetObjectType()->GetId()))
{
palError = ERROR_INVALID_HANDLE;
}