206 Commits

Author SHA1 Message Date
Kyle Reed 6900de05d8 Merge pull request #275 from jdu2600/parser_performance_name_scan
replace name->property map with hinted linear scan
2026-04-14 15:16:35 -07:00
John Uhlmann 99869be3e8 Add parse hints (native-layer only) 2026-04-10 10:21:26 +08:00
John Uhlmann 27a72734e5 replace name->property map with hinted linear scan 2026-04-01 15:32:54 +08:00
John U f0934fd7f4 Parser performance (#273)
* Optimize parser property lookup with persistent name-to-index map

Replace the per-event deque/linear-scan property cache with a two-level
scheme: a persistent name-to-index map in schema_locator (built once per
event type, shared across all events) and a flat vector<property_info>
in parser indexed by property position. This eliminates per-event hash
table allocation and removes string comparisons during the blob walk.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Use std::wstring_view for parser property name parameters

Replace const std::wstring& with std::wstring_view in parser's
public API (parse, try_parse, view_of) and internal helpers
(find_property, assert_valid_assignment, throw_if_invalid).

This eliminates heap-allocating std::wstring temporaries when
callers pass string literals (the common case). Property names
longer than MSVC's SSO threshold of 7 wchar_t previously caused
a heap allocation and free per field access.

Not a breaking change - std::wstring_view is implicitly
constructible from both std::wstring and const wchar_t*.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Bump NuGet version to 4.4.8

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 18:18:46 -07:00
Suhas Venkatesha Murthy 38b8992e78 Merge pull request #272 from microsoft/users/suvenka/newVersion
Update NuGet package version to 4.4.7
2026-03-09 14:18:33 -07:00
suvenka 78e6e9d39b Update release notes for version 4.4.7
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-09 14:13:28 -07:00
suvenka 34be38ad54 Update NuGet package version to 4.4.7
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-09 14:04:00 -07:00
Kyle Reed c40eee4521 Merge pull request #271 from microsoft/users/suvenka/processStartKey
Add process_start_key() to read ProcessStartKey from extended data
2026-03-09 10:57:15 -07:00
suvenka dab7f9e0ce Add unit tests for process_start_key extended data
- 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>
2026-03-06 20:31:08 -08:00
suvenka a6d38ba3c0 Address PR review: null checks and parameter lifetime fix
- 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>
2026-03-06 17:00:25 -08:00
suvenka a16f78a4a7 Fix CI build: pin .NET SDK to 8.0.x via global.json
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>
2026-03-06 16:36:27 -08:00
suvenka 676d948235 Add process_start_key() to read ProcessStartKey from extended data
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>
2026-03-06 16:18:29 -08:00
Kyle Reed eaa17e2f92 Move enum def into enum (#269) 2025-12-15 14:00:24 -08:00
wwh1004 1b26db44b0 Add constructor for schema from EVENT_RECORD and PTRACE_EVENT_INFO (#265)
* Add constructor for schema from EVENT_RECORD and PTRACE_EVENT_INFO

* Update target framework to net8.0 in build and assembly generation scripts

* Bump nuget versions

---------

Co-authored-by: Matt Swann <mswann@Microsoft.com>
2025-12-02 08:45:18 -08:00
Kyle Reed 924a28ed8d Update for .NET Core 8 (#267)
* Update for .NET Core 8
Clean up the netcore vcxproj files

* Update test assembly path

* Don't define a runtime lib in release builds (this is how it was before)

* Remove assemblyDebug from release builds

* Remember to actually save file after changing it
2025-11-19 16:47:22 -08:00
mjeong92 f18605233f Merge pull request #261 from microsoft/users/mijeong/update_GenerateRefAssemblies.ps1
Fix GenerateRefAssemblies.ps1 error due to breaking change with Refasmer
2025-03-10 14:16:57 -07:00
Min Jeong 8f4c980525 Fix GenerateRefAssemblies.ps1 error due to breaking change with Refasmer 2025-03-10 14:05:41 -07:00
Kyle Reed 7db7d806a2 Update Nuget Versions (#258)
* Update Nugets

* Update AssemblyInfo.cpp

* Update O365.Security.Native.ETW.Debug.nuspec

* Update O365.Security.Native.ETW.nuspec

* Update krabsetw.nuspec

* Update O365.Security.Native.ETW.nuspec

---------

Co-authored-by: Matt Swann <mswann@Microsoft.com>
2025-03-04 12:19:16 -08:00
Kyle Reed 4601b11ee3 Merge pull request #255 from wwh1004/schema-no-throw
Unify. NET wrappers of callbacks and more optimizations
2025-03-04 12:09:38 -08:00
wwh1004 62a3dea877 Merge branch 'master' into schema-no-throw 2025-02-06 09:25:06 +08:00
Kyle Reed 025d68ecba Merge pull request #257 from wwh1004/managed-off
Disable MSIL generation for krabs .NET wrapper native part to significantly reduce binary size
2025-02-05 11:16:44 -08:00
Kyle Reed 7d5abba7f0 Merge branch 'master' into managed-off 2025-02-05 10:49:46 -08:00
Kyle Reed 71a366f873 Merge pull request #256 from wwh1004/tdh-provider-name-to-guid
Use TdhEnumerateProviders to obtain GUIDs to speed up the conversion and avoid conflicts with CoInitializeEx.
2025-02-05 10:45:24 -08:00
Kyle Reed 20b465b757 Merge branch 'master' into tdh-provider-name-to-guid 2025-02-05 10:39:06 -08:00
Kyle Reed 50fe0ab2c3 Merge branch 'master' into managed-off 2025-02-05 10:36:58 -08:00
Kyle Reed 9c72468199 Merge pull request #254 from wwh1004/mof-wpp-enable
Add functions to disable MOF/WPP events processing and function to get event type
2025-02-05 10:36:24 -08:00
wwh1004 8c0ea124b9 Fix code style and docs 2025-02-05 11:01:59 +08:00
wwh1004 aad9b3f028 Use template to implement CombineOrRemoveDelegate instead of macro.
Rename CallbackBridge::Create* to CallbackBridge::Wrap*
2025-02-05 10:53:02 +08:00
wwh1004 c4adaa97b0 Disable MSIL generation for krabs .NET wrapper native part to significantly reduce binary size 2025-02-01 19:44:44 +08:00
wwh1004 27178d04ab Use TdhEnumerateProviders to obtain GUIDs to speed up the conversion and avoid conflicts with CoInitializeEx. 2025-02-01 19:05:26 +08:00
wwh1004 4ba137cc0a Unify. NET wrappers of callbacks and use error code checking instead of exception handling 2025-02-01 17:47:55 +08:00
wwh1004 0380a58c3d Expose more functions to. NET wrapper:
- EventRecord.DecodingSource
 - EventRecordMetadata.GetEventType()
 - UserTrace/KernelTrace.BuffersProcessed
 - UserTrace.MOFEventProcessingEnabled/WPPEventProcessingEnabled
2025-02-01 15:04:30 +08:00
wwh1004 aea558addf Add get_event_type function and add set_wpp_event_processing_enabled 2025-02-01 14:24:14 +08:00
wwh1004 988e0573d1 Rename ignore_mof_events to mof_events_enabled 2025-02-01 12:51:44 +08:00
Septor ff96d20ac7 Add a trace interface to enable ignoring MOF events
MOF events all require a (slow) TDH lookup which can fail if schema is
not available.  Since these are generally legacy events, many
applications may not require them and ignoring them can provide a
significant performance increase, particularly for large trace files.
2025-02-01 12:47:34 +08:00
mjeong92 af17f4c79a Merge pull request #250 from microsoft/users/mijeong/remove_raw_provider_allocation
Only allocate one EventRecordMetadata^ and reuse it for RawProvider events
2024-11-12 15:41:45 -08:00
Min Jeong 3a7b787275 Bump nuget versions 2024-11-12 15:30:38 -08:00
Min Jeong 5d5552f3de Update comment 2024-11-12 15:18:33 -08:00
Min Jeong f8744b4685 Add comment 2024-11-12 15:00:07 -08:00
Min Jeong 5b9e81e372 Use Update() method instead of exposing the internal fields on EventRecordMetadata 2024-11-12 14:56:20 -08:00
Min Jeong 2c19173bdc Only allocate one EventRecordMetadata^ and reuse it for RawProvider events 2024-11-12 13:46:42 -08:00
Kyle Reed 4b1456c39a Merge pull request #243 from microsoft/user/kylereedmsft/update_nuget
Update nuspec versions.
2024-09-19 15:29:54 -07:00
Kyle Reed b2d85e9daf Update nuspec versions. 2024-09-19 15:21:41 -07:00
Kyle Reed a29a1f2b56 Merge pull request #242 from kylereedmsft/tracelogging_support
Add support for parsing and caching TraceLogging events.
2024-09-19 14:33:16 -07:00
Kyle Reed 3a1f2a7750 Comment style 2024-09-19 13:52:02 -07:00
Kyle Reed 9d259adcd0 Fix assertion 2024-09-19 11:39:49 -07:00
Kyle Reed 7eabb99cd9 Use string_view instead of raw pointers, update unit tests 2024-09-19 10:56:46 -07:00
Kyle Reed 7d5cf669c4 Add support for parsing and caching TraceLogging events. 2024-09-18 17:20:59 -07:00
Mihai PANDURU 6b3152dbe3 Correctly handle kernel addresses in an x86 stack trace (#241) 2024-08-13 14:46:28 -07:00
HydrophobicMinghao e39e9b766a Align assembly version with package version. (#239) 2024-06-19 07:17:01 -07:00