return (void*)((uintptr_t)::HndGetHandleTableADIndex(::HndGetHandleTable(handle)).m_dwIndex);
}
-void* GCHandleTable::GetHandleTableForHandle(OBJECTHANDLE handle)
-{
- return (void*)::HndGetHandleTable(handle);
-}
-
OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* table, Object* object, int type)
{
return ::HndCreateHandle((HHANDLETABLE)table, type, ObjectToOBJECTREF(object));
return handle;
}
+OBJECTHANDLE GCHandleTable::CreateDuplicateHandle(OBJECTHANDLE handle)
+{
+ return ::HndCreateHandle(HndGetHandleTable(handle), HNDTYPE_DEFAULT, ObjectFromHandle(handle));
+}
+
void GCHandleTable::DestroyHandleOfType(OBJECTHANDLE handle, int type)
{
::HndDestroyHandle(::HndGetHandleTable(handle), type, handle);
virtual void* GetHandleContext(OBJECTHANDLE handle);
- virtual void* GetHandleTableForHandle(OBJECTHANDLE handle);
-
virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type);
virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* table, Object* object, int type, void* pExtraInfo);
virtual OBJECTHANDLE CreateGlobalHandleOfType(Object* object, int type);
+ virtual OBJECTHANDLE CreateDuplicateHandle(OBJECTHANDLE handle);
+
virtual void DestroyHandleOfType(OBJECTHANDLE handle, int type);
virtual void DestroyHandleOfUnknownType(OBJECTHANDLE handle);
virtual void* GetHandleContext(OBJECTHANDLE handle) = 0;
- virtual void* GetHandleTableForHandle(OBJECTHANDLE handle) = 0;
-
virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type) = 0;
virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* table, Object* object, int type, void* pExtraInfo) = 0;
virtual OBJECTHANDLE CreateGlobalHandleOfType(Object* object, int type) = 0;
+ virtual OBJECTHANDLE CreateDuplicateHandle(OBJECTHANDLE handle) = 0;
+
virtual void DestroyHandleOfType(OBJECTHANDLE handle, int type) = 0;
virtual void DestroyHandleOfUnknownType(OBJECTHANDLE handle) = 0;
EX_TRY
{
IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable();
- void* table = pHandleTable->GetHandleTableForHandle(hThrowable);
// Creating a duplicate handle here ensures that the AD of the last thrown object
// matches the domain of the current throwable.
- OBJECTHANDLE duplicateHandle = pHandleTable->CreateHandleOfType(table, OBJECTREFToObject(ObjectFromHandle(hThrowable)), HNDTYPE_DEFAULT);
+ OBJECTHANDLE duplicateHandle = pHandleTable->CreateDuplicateHandle(hThrowable);
SetLastThrownObjectHandle(duplicateHandle);
}
EX_CATCH