Skip to content

Add process_start_key() to read ProcessStartKey from extended data - #271

Merged
Kyle Reed (kylereedmsft) merged 4 commits into
masterfrom
users/suvenka/processStartKey
Mar 9, 2026
Merged

Add process_start_key() to read ProcessStartKey from extended data#271
Kyle Reed (kylereedmsft) merged 4 commits into
masterfrom
users/suvenka/processStartKey

Conversation

@vmurthysuhas

Copy link
Copy Markdown
Contributor

Add support for reading EVENT_HEADER_EXT_TYPE_PROCESS_START_KEY from ETW extended data items, enabled via EVENT_ENABLE_PROPERTY_PROCESS_START_KEY. The ProcessStartKey uniquely identifies a process instance across a boot session (unlike PID which can be recycled).

Changes:

  • Native C++: schema::process_start_key() in schema.hpp
  • Managed .NET: TryGetProcessStartKey() on IEventRecordMetadata/EventRecordMetadata
  • Test support: extended_data_builder::add_process_start_key()
  • New example: UserTrace008_ProcessStartKey.cs

Add support for reading EVENT_HEADER_EXT_TYPE_PROCESS_START_KEY from
ETW extended data items, enabled via EVENT_ENABLE_PROPERTY_PROCESS_START_KEY.
The ProcessStartKey uniquely identifies a process instance across a boot
session (unlike PID which can be recycled).

Changes:
- Native C++: schema::process_start_key() in schema.hpp
- Managed .NET: TryGetProcessStartKey() on IEventRecordMetadata/EventRecordMetadata
- Test support: extended_data_builder::add_process_start_key()
- New example: UserTrace008_ProcessStartKey.cs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CI runner has .NET SDK 10.0.x pre-installed, which fails to resolve
the .NET 8.0 AppHost packs needed by the NetCore project. Pin the SDK
to the 8.0.x feature band using global.json with rollForward=latestFeature,
and add the setup-dotnet action to install the matching SDK on CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@kylereedmsft Kyle Reed (kylereedmsft) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some notes. Need to be extra careful with pointers.

Comment thread Microsoft.O365.Security.Native.ETW/EventRecordMetadata.hpp Outdated
Comment thread krabs/krabs/schema.hpp Outdated
Comment thread krabs/krabs/testing/extended_data_builder.hpp Outdated
- Add null check on DataPtr before dereference in schema.hpp and
  EventRecordMetadata.hpp
- Change add_process_start_key to take const ULONG64& so caller
  owns the lifetime of the pointed-to object

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@kylereedmsft Kyle Reed (kylereedmsft) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to add some unit tests. Approving this.

- Native tests: build/pack, raw value roundtrip, schema read, not-present case
- Managed tests: TryGetProcessStartKey roundtrip, not-present case
- Add AddProcessStartKey to RecordBuilder and record_builder for test support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kylereedmsft
Kyle Reed (kylereedmsft) merged commit c40eee4 into master Mar 9, 2026
6 checks passed
@kylereedmsft
Kyle Reed (kylereedmsft) deleted the users/suvenka/processStartKey branch March 9, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants