mxc-sdk 1.0.0

Importable library for starting MXC sandboxes in-process, with streaming stdio.
Documentation
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Canonical embedded WPR profile.
//!
//! The restricted elevated child materializes these fixed bytes only in its
//! own random temporary directory. Public callers cannot override the profile
//! or select an elevated filesystem path.

/// Canonical WPR profile. Edited here directly — there is no
/// sibling `plm.wprp` file to keep in sync. `start.rs`'s
/// `plm_wprp_resource_is_well_formed_…` test pins the parser
/// contract on these exact bytes.
pub const EMBEDDED_WPRP: &str = r#"<!--

    This WPRP (WPR profile) is defined to collect access failure events in learning mode.

    Prefixes in the WPRP:
    SC_  - System Collector controlling kernel event tracing
    EC_  - Event Collector controlling user mode event tracing

    SP_  - System Provider

    EP_  - Event Provider

-->
<WindowsPerformanceRecorder Version="1.0" Comments="Profile for recording access failure events in learning mode" Company="Microsoft Corporation" Copyright="Microsoft Corporation">
    <Profiles>
        <SystemCollector
            Id="SC_Kernel"
            Name="NT Kernel Logger">
            <BufferSize Value="1024"/>
            <Buffers Value="100"/>
        </SystemCollector>
        <EventCollector
            Id="EC_Secure"
            Name="Secure Realtime Event Collector"
            Secure="true">
            <BufferSize Value="1024"/>
            <Buffers Value="100"/>
        </EventCollector>
        <SystemProvider Id="SP_AccessFailure_Light" Base="">
            <Keywords>
                <Keyword Value="ProcessThread"/>
                <Keyword Value="Loader"/>
            </Keywords>
        </SystemProvider>
        <EventProvider
            Id="EP_Microsoft-Windows-Kernel-General"
            Name="a68ca8b7-004f-d7b6-a698-07e2de0f1f5d"
            Stack="true"
            NonPagedMemory="true">
            <Keywords>
                <Keyword Value="0x00"/>
            </Keywords>
        </EventProvider>
        <EventProvider
            Id="EP_Microsoft-Windows-Privacy-Auditing-PermissiveLearningMode"
            Name="811a1ddb-2e69-5f25-adc0-4b186170e760"
            Stack="true"
            NonPagedMemory="true">
            <Keywords>
                <Keyword Value="0x1"/>
            </Keywords>
        </EventProvider>
        <Profile Id="AccessFailureProfile.Verbose.File" LoggingMode="File" Name="AccessFailureProfile" DetailLevel="Verbose" Description="Profile for recording access failure events in learning mode" Default="true">
            <Collectors>
                <SystemCollectorId Value="SC_Kernel">
                    <SystemProviderId Value="SP_AccessFailure_Light"/>
                </SystemCollectorId>
                <EventCollectorId Value="EC_Secure">
                    <EventProviders>
                        <EventProviderId Value="EP_Microsoft-Windows-Kernel-General"/>
                        <EventProviderId Value="EP_Microsoft-Windows-Privacy-Auditing-PermissiveLearningMode"/>
                    </EventProviders>
                </EventCollectorId>
            </Collectors>
        </Profile>
    </Profiles>
</WindowsPerformanceRecorder>
"#;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn embedded_wprp_declares_access_failure_profile() {
        assert!(EMBEDDED_WPRP.contains("<WindowsPerformanceRecorder"));
        assert!(EMBEDDED_WPRP.contains("AccessFailureProfile"));
    }
}