Skip to content

Commit e7657ed

Browse files
authored
Merge pull request #1 from RandyTiddMSFT2/master
Add HasDefaultPsdb and Step fields to AsdInt event output
2 parents 166beb2 + efd7977 commit e7657ed

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

D3D12CacheListener.cpp

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,41 @@ void ParseManifestPayload(PEVENT_RECORD pEvent) {
127127
}
128128
}
129129

130+
enum class AsdInitStep : uint32_t
131+
{
132+
None,
133+
Success,
134+
ReadApplicationRegistration,
135+
OpenPsdb,
136+
IdentityCheck
137+
};
138+
139+
TDHSTATUS GetAsdInitStep(PEVENT_RECORD pEvent, AsdInitStep& step) {
140+
LPCWSTR szPropertyName = L"Step";
141+
142+
PROPERTY_DATA_DESCRIPTOR propDesc = {};
143+
propDesc.PropertyName = reinterpret_cast<UINT_PTR>(szPropertyName);
144+
propDesc.ArrayIndex = ULONG_MAX;
145+
146+
step = AsdInitStep::None;
147+
ULONG valueSize = sizeof(step);
148+
return TdhGetProperty(pEvent, 0, NULL, 1, &propDesc, valueSize, (PBYTE)&step);
149+
}
150+
151+
LPCSTR AsdInitStepToString(AsdInitStep step)
152+
{
153+
switch (step)
154+
{
155+
case AsdInitStep::None: return "None";
156+
case AsdInitStep::Success: return "Success";
157+
case AsdInitStep::ReadApplicationRegistration: return "ReadApplicationRegistration";
158+
case AsdInitStep::OpenPsdb: return "OpenPsdb";
159+
case AsdInitStep::IdentityCheck: return "IdentityCheck";
160+
};
161+
162+
return "Step Unknown";
163+
}
164+
130165
// Helper to get TraceLogging event name
131166
std::wstring GetTraceLoggingEventName(PEVENT_RECORD pEvent) {
132167
ULONG bufferSize = 0;
@@ -150,7 +185,15 @@ void WINAPI EventRecordCallback(PEVENT_RECORD pEvent) {
150185
process_stats.emplace(pid, ProcessStats{});
151186
asdinit_pids.insert(pid);
152187
}
153-
std::cout << "ASDInit event seen for PID " << pid << "\n";
188+
189+
AsdInitStep step = AsdInitStep::None;
190+
auto status = GetAsdInitStep(pEvent, step);
191+
192+
auto hasDefaultPsdb = (status == ERROR_SUCCESS) && step == AsdInitStep::Success ? "true" : "false";
193+
auto stepString = (status == ERROR_SUCCESS) ? AsdInitStepToString(step) : "Error Parsing Event";
194+
195+
196+
std::cout << "ASDInit event seen for PID " << pid << ", HasDefaultPsdb: " << hasDefaultPsdb << ", Step: " << stepString << "\n";
154197
}
155198
} else if (IsEqualGUID(pEvent->EventHeader.ProviderId, D3D12_MANIFEST_PROVIDER)) {
156199
DWORD pid = pEvent->EventHeader.ProcessId;

0 commit comments

Comments
 (0)