Skip to content

Implement cDAC SosDac API GetCCWData#125288

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/implement-getccwdata-api
Draft

Implement cDAC SosDac API GetCCWData#125288
Copilot wants to merge 5 commits intomainfrom
copilot/implement-getccwdata-api

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

Implements ISOSDacInterface::GetCCWData in the cDAC managed layer. The contract surface exposes fine-grained CCW predicates; SOSDacImpl assembles DacpCCWData by composing them directly rather than delegating to a single aggregate contract method.

Contract surface (IBuiltInCOM / BuiltInCOM_1)

New predicate methods (grouped with GetRefCount / IsHandleWeak):

  • IsNeuteredCLEANUP_SENTINEL bit in raw ref count
  • IsExtendsCOMObjectIsExtendsCom flag on SimpleComCallWrapper
  • IsAggregatedIsAggregated flag on SimpleComCallWrapper

New scalar accessors:

  • GetCCWAddress(ccw) — navigates to start wrapper via SimpleWrapper→MainWrapper (mirrors C++ GetStartWrapper); any wrapper in the chain is accepted
  • GetCCWHandle(ccw) — GC object handle (m_ppThis) from the start wrapper
  • GetOuterIUnknown(ccw) — outer IUnknown (m_pOuter) from the shared SimpleComCallWrapper

GetCCWInterfaces reuses the same NavigateToStartWrapper helper.

Data descriptors

Two new fields exposed via cdac_data<>, datadescriptor.inc, and managed Data/ classes:

  • ComCallWrapper.Handle (m_ppThis)
  • SimpleComCallWrapper.OuterIUnknown (m_pOuter)

Legacy layer (SOSDacImpl)

GetCCWData signature changed from void* data to typed DacpCCWData* data. Implementation composes the struct from individual contract calls:

TargetPointer startCCW = contract.GetCCWAddress(ccwPtr);
TargetPointer handle   = contract.GetCCWHandle(startCCW);
int refCount           = (int)contract.GetRefCount(startCCW);

data->outerIUnknown       = contract.GetOuterIUnknown(startCCW).ToClrDataAddress(_target);
data->handle              = handle.ToClrDataAddress(_target);
data->managedObject       = (handle != TargetPointer.Null ? _target.ReadPointer(handle) : TargetPointer.Null).ToClrDataAddress(_target);
data->ccwAddress          = startCCW.ToClrDataAddress(_target);
data->refCount            = refCount;
data->interfaceCount      = contract.GetCCWInterfaces(startCCW).Count();
data->isNeutered          = contract.IsNeutered(startCCW)         ? BOOL.TRUE : BOOL.FALSE;
data->hasStrongRef        = (refCount > 0) && !contract.IsHandleWeak(startCCW) ? BOOL.TRUE : BOOL.FALSE;
data->isExtendsCOMObject  = contract.IsExtendsCOMObject(startCCW) ? BOOL.TRUE : BOOL.FALSE;
data->isAggregated        = contract.IsAggregated(startCCW)       ? BOOL.TRUE : BOOL.FALSE;
// jupiterRefCount / isPegged / isGlobalPegged always 0/false (non-WinRT path)

Tests

  • Unit tests for IsNeutered, IsAggregated, IsExtendsCOMObject, GetCCWAddress (including non-start wrapper navigation), GetCCWHandle (value and null), GetOuterIUnknown (value and zero)
  • Dump test exercising the full SOSDacImpl.GetCCWData path against live CCWs

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copilot AI and others added 3 commits March 7, 2026 06:04
…ignature

Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
…tCCWData from existing APIs

Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
…n GetCCWInterfaces

Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement cDAC SosDac API GetCCWData Implement cDAC SosDac API GetCCWData Mar 7, 2026
Copilot finished work on behalf of rcj1 March 7, 2026 06:21
…CCW APIs

Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants