How microsoft/krabsetw works
Main Components
a) Core Components:
• krabsetw (Native C++ Library)
• Microsoft.O365.Security.Native.ETW (C++/CLI .NET Wrapper, aka "Lobsters")
• ETW System Integration Layer
b) Architectural Layers:
• Client Application Layer
• API Interface Layer
• Event Processing Layer
• ETW Provider Integration Layer
• Windows ETW Infrastructure
[Client Applications]
• ↓ ↑
[.NET API (Lobsters)] ←→ [Native API (krabsetw)]
• ↓ ↑ ↓ ↑
[Event Processing & Filtering System]
• ↓ ↑
[ETW Provider Interface]
• ↓ ↑
[Windows ETW Infrastructure]
Key Components to Highlight
a) Provider Management:
• User Traces (UserTrace.hpp)
• Kernel Traces (KernelTrace.hpp)
• Raw Providers (RawProvider.hpp)
b) Event Processing:
• Event Filtering System (Filtering/ directory)
• Event Record Processing (EventRecord.hpp)
• Schema Management (schema.hpp)
c) Testing Infrastructure:
• Synthetic Event Generation
• Record Building
• Event Simulation
Important Relationships
• Bidirectional flow between native and managed code
• Event flow from providers to consumers
• Filtering pipeline
• Error handling paths
• Testing infrastructure integration
Implementation Details
• Support for x64 and ARM64 architectures
• Windows version compatibility (Win7/2008R2+)
• Thread management for blocking operations
• Exception handling boundaries