@@ -222,7 +222,7 @@ template<class T> void DeleteDbiArrayMemory(T *p, int count)
222222// pAllocator - pointer to client allocator object. This lets DD allocate objects and
223223// pass them out back to the client, which can then delete them.
224224// DD takes a weak ref to this, so client must keep it alive until it
225- // calls Destroy .
225+ // calls Release .
226226// pMetadataLookup - callback interface to do internal metadata lookup. This is because
227227// metadata is not dac-ized.
228228// ppInterface - mandatory out-parameter
@@ -238,7 +238,7 @@ template<class T> void DeleteDbiArrayMemory(T *p, int count)
238238// This will yield an IDacDbiInterface to provide structured access to the
239239// data-target.
240240//
241- // Must call Destroy to on interface to free its resources.
241+ // Must call Release on interface to free its resources.
242242//
243243// ---------------------------------------------------------------------------------------
244244STDAPI
@@ -295,7 +295,7 @@ DacDbiInterfaceInstance(
295295// pAllocator - pointer to client allocator object. This lets DD allocate objects and
296296// pass them out back to the client, which can then delete them.
297297// DD takes a weak ref to this, so client must keep it alive until it
298- // calls Destroy .
298+ // calls Release .
299299// pMetadataLookup - callback interface to do internal metadata lookup. This is because
300300// metadata is not dac-ized.
301301//
@@ -333,7 +333,7 @@ DacDbiInterfaceImpl::DacDbiInterfaceImpl(
333333// Destructor.
334334//
335335// Notes:
336- // This gets invoked after Destroy ().
336+ // This gets invoked when the ref count drops to 0 via Release ().
337337// -----------------------------------------------------------------------------
338338DacDbiInterfaceImpl::~DacDbiInterfaceImpl ()
339339{
@@ -441,19 +441,30 @@ interface IMDInternalImport* DacDbiInterfaceImpl::GetMDImport(
441441// See DacDbiInterface.h for full descriptions of all of these functions
442442// -----------------------------------------------------------------------------
443443
444- // Destroy the connection, freeing up any resources.
445- HRESULT DacDbiInterfaceImpl::Destroy ()
444+ // IUnknown implementation for DacDbiInterfaceImpl.
445+ // Delegates to ClrDataAccess's ref-counting and adds support for IDacDbiInterface IID.
446+ STDMETHODIMP
447+ DacDbiInterfaceImpl::QueryInterface (THIS_ IN REFIID interfaceId, OUT PVOID* iface)
446448{
447- HRESULT hr = S_OK;
448- EX_TRY
449+ if (IsEqualIID (interfaceId, __uuidof (IDacDbiInterface)))
449450 {
450- m_pAllocator = NULL ;
451-
452- this ->Release ();
453- // Memory is deleted, don't access this object any more
451+ AddRef ();
452+ *iface = static_cast <IDacDbiInterface*>(this );
453+ return S_OK;
454454 }
455- EX_CATCH_HRESULT (hr);
456- return hr;
455+ return ClrDataAccess::QueryInterface (interfaceId, iface);
456+ }
457+
458+ STDMETHODIMP_ (ULONG)
459+ DacDbiInterfaceImpl::AddRef(THIS)
460+ {
461+ return ClrDataAccess::AddRef ();
462+ }
463+
464+ STDMETHODIMP_ (ULONG)
465+ DacDbiInterfaceImpl::Release(THIS)
466+ {
467+ return ClrDataAccess::Release ();
457468}
458469
459470// Check whether the version of the DBI matches the version of the runtime.
@@ -495,7 +506,7 @@ HRESULT DacDbiInterfaceImpl::FlushCache()
495506}
496507
497508// enable or disable DAC target consistency checks
498- HRESULT DacDbiInterfaceImpl::DacSetTargetConsistencyChecks (bool fEnableAsserts )
509+ HRESULT DacDbiInterfaceImpl::DacSetTargetConsistencyChecks (BOOL fEnableAsserts )
499510{
500511 HRESULT hr = S_OK;
501512 EX_TRY
@@ -1172,8 +1183,11 @@ mdSignature DacDbiInterfaceImpl::GetILCodeAndSigHelper(Module * pModule,
11721183}
11731184
11741185
1175- HRESULT DacDbiInterfaceImpl::GetMetaDataFileInfoFromPEFile (VMPTR_PEAssembly vmPEAssembly, DWORD & dwTimeStamp , DWORD & dwImageSize , IStringHolder* pStrFilename, OUT bool * pResult)
1186+ HRESULT DacDbiInterfaceImpl::GetMetaDataFileInfoFromPEFile (VMPTR_PEAssembly vmPEAssembly, DWORD * pTimeStamp , DWORD * pImageSize , IStringHolder* pStrFilename, OUT BOOL * pResult)
11761187{
1188+ if (pTimeStamp == NULL || pImageSize == NULL || pStrFilename == NULL || pResult == NULL )
1189+ return E_POINTER;
1190+
11771191 DD_ENTER_MAY_THROW;
11781192
11791193 HRESULT hr = S_OK;
@@ -1186,15 +1200,15 @@ HRESULT DacDbiInterfaceImpl::GetMetaDataFileInfoFromPEFile(VMPTR_PEAssembly vmPE
11861200 _ASSERTE (pPEAssembly != NULL );
11871201 if (pPEAssembly == NULL )
11881202 {
1189- *pResult = false ;
1203+ *pResult = FALSE ;
11901204 }
11911205 else
11921206 {
11931207 WCHAR wszFilePath[MAX_LONGPATH] = {0 };
11941208 DWORD cchFilePath = MAX_LONGPATH;
11951209 bool ret = ClrDataAccess::GetMetaDataFileInfoFromPEFile (pPEAssembly,
1196- dwTimeStamp ,
1197- dwImageSize ,
1210+ *pTimeStamp ,
1211+ *pImageSize ,
11981212 dwDataSize,
11991213 dwRvaHint,
12001214 wszFilePath,
@@ -2743,8 +2757,11 @@ HRESULT DacDbiInterfaceImpl::GetApproxTypeHandle(TypeInfoList * pTypeData, OUT V
27432757// DacDbiInterface API: Get the exact type handle from type data
27442758HRESULT DacDbiInterfaceImpl::GetExactTypeHandle (DebuggerIPCE_ExpandedTypeData * pTypeData,
27452759 ArgInfoList * pArgInfo,
2746- VMPTR_TypeHandle& vmTypeHandle )
2760+ VMPTR_TypeHandle * pVmTypeHandle )
27472761{
2762+ if (pVmTypeHandle == NULL )
2763+ return E_POINTER;
2764+
27482765 DD_ENTER_MAY_THROW;
27492766
27502767 LOG ((LF_CORDB, LL_INFO10000, " D::GETH: getting info.\n " ));
@@ -2753,12 +2770,12 @@ HRESULT DacDbiInterfaceImpl::GetExactTypeHandle(DebuggerIPCE_ExpandedTypeData *
27532770
27542771 EX_TRY
27552772 {
2756- vmTypeHandle = vmTypeHandle. NullPtr ();
2773+ *pVmTypeHandle = VMPTR_TypeHandle:: NullPtr ();
27572774
27582775 // convert the type information to a type handle
27592776 TypeHandle typeHandle = ExpandedTypeInfoToTypeHandle (pTypeData, pArgInfo);
27602777 _ASSERTE (!typeHandle.IsNull ());
2761- vmTypeHandle. SetDacTargetPtr (typeHandle.AsTAddr ());
2778+ pVmTypeHandle-> SetDacTargetPtr (typeHandle.AsTAddr ());
27622779 }
27632780 EX_CATCH_HRESULT (hr);
27642781
@@ -3732,8 +3749,11 @@ HRESULT DacDbiInterfaceImpl::GetLoaderHeapMemoryRanges(DacDbiArrayList<COR_MEMOR
37323749 return hr;
37333750}
37343751
3735- HRESULT DacDbiInterfaceImpl::GetStackFramesFromException (VMPTR_Object vmObject, DacDbiArrayList<DacExceptionCallStackData>& dacStackFrames )
3752+ HRESULT DacDbiInterfaceImpl::GetStackFramesFromException (VMPTR_Object vmObject, DacDbiArrayList<DacExceptionCallStackData>* pDacStackFrames )
37363753{
3754+ if (pDacStackFrames == NULL )
3755+ return E_POINTER;
3756+
37373757 DD_ENTER_MAY_THROW;
37383758
37393759 HRESULT hr = S_OK;
@@ -3761,12 +3781,12 @@ HRESULT DacDbiInterfaceImpl::GetStackFramesFromException(VMPTR_Object vmObject,
37613781
37623782 if (dacStackFramesLength > 0 )
37633783 {
3764- dacStackFrames. Alloc (dacStackFramesLength);
3784+ pDacStackFrames-> Alloc (dacStackFramesLength);
37653785
37663786 for (INT32 index = 0 ; index < dacStackFramesLength; ++index)
37673787 {
37683788 DebugStackTrace::Element const & currentElement = stackFramesData.pElements [index];
3769- DacExceptionCallStackData& currentFrame = dacStackFrames [index];
3789+ DacExceptionCallStackData& currentFrame = (*pDacStackFrames) [index];
37703790
37713791 AppDomain* pDomain = AppDomain::GetCurrentDomain ();
37723792 _ASSERTE (pDomain != NULL );
@@ -3882,8 +3902,11 @@ HRESULT DacDbiInterfaceImpl::GetRcwCachedInterfacePointers(VMPTR_Object vmObject
38823902#endif // FEATURE_COMINTEROP
38833903}
38843904
3885- HRESULT DacDbiInterfaceImpl::GetCachedWinRTTypesForIIDs (VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> & iids , OUT DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes)
3905+ HRESULT DacDbiInterfaceImpl::GetCachedWinRTTypesForIIDs (VMPTR_AppDomain vmAppDomain, DacDbiArrayList<GUID> * pIids , OUT DacDbiArrayList<DebuggerIPCE_ExpandedTypeData> * pTypes)
38863906{
3907+ if (pIids == NULL || pTypes == NULL )
3908+ return E_POINTER;
3909+
38873910 HRESULT hr = S_OK;
38883911 EX_TRY
38893912 {
@@ -4319,7 +4342,7 @@ HRESULT DacDbiInterfaceImpl::IsModuleMapped(VMPTR_Module pModule, OUT BOOL *isMo
43194342 return hr;
43204343}
43214344
4322- HRESULT DacDbiInterfaceImpl::MetadataUpdatesApplied (OUT bool * pResult)
4345+ HRESULT DacDbiInterfaceImpl::MetadataUpdatesApplied (OUT BOOL * pResult)
43234346{
43244347 DD_ENTER_MAY_THROW;
43254348
@@ -4329,7 +4352,7 @@ HRESULT DacDbiInterfaceImpl::MetadataUpdatesApplied(OUT bool * pResult)
43294352 #ifdef FEATURE_METADATA_UPDATER
43304353 *pResult = g_metadataUpdatesApplied;
43314354 #else
4332- *pResult = false ;
4355+ *pResult = FALSE ;
43334356 #endif
43344357 }
43354358 EX_CATCH_HRESULT (hr);
@@ -4843,7 +4866,7 @@ HRESULT DacDbiInterfaceImpl::EnumerateThreads(FP_THREAD_ENUMERATION_CALLBACK fpC
48434866}
48444867
48454868// public implementation of IsThreadMarkedDead
4846- HRESULT DacDbiInterfaceImpl::IsThreadMarkedDead (VMPTR_Thread vmThread, OUT bool * pResult)
4869+ HRESULT DacDbiInterfaceImpl::IsThreadMarkedDead (VMPTR_Thread vmThread, OUT BOOL * pResult)
48474870{
48484871 DD_ENTER_MAY_THROW;
48494872
@@ -6257,12 +6280,15 @@ HRESULT DacDbiInterfaceImpl::IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle,
62576280}
62586281
62596282// determines if the specified module is a WinRT module
6260- HRESULT DacDbiInterfaceImpl::IsWinRTModule (VMPTR_Module vmModule, BOOL& isWinRT )
6283+ HRESULT DacDbiInterfaceImpl::IsWinRTModule (VMPTR_Module vmModule, BOOL * pIsWinRT )
62616284{
6285+ if (pIsWinRT == NULL )
6286+ return E_POINTER;
6287+
62626288 DD_ENTER_MAY_THROW;
62636289
62646290 HRESULT hr = S_OK;
6265- isWinRT = FALSE ;
6291+ *pIsWinRT = FALSE ;
62666292
62676293 return hr;
62686294}
@@ -6743,12 +6769,12 @@ HRESULT DacDbiInterfaceImpl::EnumerateMonitorEventWaitList(VMPTR_Object vmObject
67436769}
67446770
67456771
6746- HRESULT DacDbiInterfaceImpl::AreGCStructuresValid (OUT bool * pResult)
6772+ HRESULT DacDbiInterfaceImpl::AreGCStructuresValid (OUT BOOL * pResult)
67476773{
67486774 HRESULT hr = S_OK;
67496775 EX_TRY
67506776 {
6751- *pResult = true ;
6777+ *pResult = TRUE ;
67526778 }
67536779 EX_CATCH_HRESULT (hr);
67546780 return hr;
@@ -7467,15 +7493,15 @@ HRESULT DacDbiInterfaceImpl::GetHeapSegments(OUT DacDbiArrayList<COR_SEGMENT> *p
74677493 return hr;
74687494}
74697495
7470- HRESULT DacDbiInterfaceImpl::IsValidObject (CORDB_ADDRESS obj, OUT bool * pResult)
7496+ HRESULT DacDbiInterfaceImpl::IsValidObject (CORDB_ADDRESS obj, OUT BOOL * pResult)
74717497{
74727498 DD_ENTER_MAY_THROW;
74737499
74747500 HRESULT hr = S_OK;
74757501 EX_TRY
74767502 {
74777503
7478- bool isValid = false ;
7504+ BOOL isValid = FALSE ;
74797505
74807506 if (obj != 0 && obj != (CORDB_ADDRESS)-1 )
74817507 {
@@ -7487,13 +7513,13 @@ HRESULT DacDbiInterfaceImpl::IsValidObject(CORDB_ADDRESS obj, OUT bool * pResult
74877513 PTR_EEClass cls = mt->GetClass ();
74887514
74897515 if (mt == cls->GetMethodTable ())
7490- isValid = true ;
7516+ isValid = TRUE ;
74917517 else if (!mt->IsCanonicalMethodTable () || mt->IsContinuation ())
74927518 isValid = cls->GetMethodTable ()->GetClass () == cls;
74937519 }
74947520 EX_CATCH
74957521 {
7496- isValid = false ;
7522+ isValid = FALSE ;
74977523 }
74987524 EX_END_CATCH
74997525 }
@@ -7504,7 +7530,7 @@ HRESULT DacDbiInterfaceImpl::IsValidObject(CORDB_ADDRESS obj, OUT bool * pResult
75047530 return hr;
75057531}
75067532
7507- HRESULT DacDbiInterfaceImpl::GetAppDomainForObject (CORDB_ADDRESS obj, OUT VMPTR_AppDomain * pApp, OUT VMPTR_Module * pModule, OUT VMPTR_DomainAssembly * pDomainAssembly, OUT bool * pResult)
7533+ HRESULT DacDbiInterfaceImpl::GetAppDomainForObject (CORDB_ADDRESS obj, OUT VMPTR_AppDomain * pApp, OUT VMPTR_Module * pModule, OUT VMPTR_DomainAssembly * pDomainAssembly, OUT BOOL * pResult)
75087534{
75097535 DD_ENTER_MAY_THROW;
75107536
@@ -7514,7 +7540,7 @@ HRESULT DacDbiInterfaceImpl::GetAppDomainForObject(CORDB_ADDRESS obj, OUT VMPTR_
75147540
75157541 if (obj == 0 || obj == (CORDB_ADDRESS)-1 )
75167542 {
7517- *pResult = false ;
7543+ *pResult = FALSE ;
75187544 }
75197545 else
75207546 {
@@ -7526,7 +7552,7 @@ HRESULT DacDbiInterfaceImpl::GetAppDomainForObject(CORDB_ADDRESS obj, OUT VMPTR_
75267552 pModule->SetDacTargetPtr (PTR_HOST_TO_TADDR (module ));
75277553 pDomainAssembly->SetDacTargetPtr (PTR_HOST_TO_TADDR (module ->GetDomainAssembly ()));
75287554
7529- *pResult = true ;
7555+ *pResult = TRUE ;
75307556 }
75317557 }
75327558 EX_CATCH_HRESULT (hr);
0 commit comments