﻿<?xml version="1.0" encoding="utf-8"?>
<InstrumentationManifest>
  <Instrumentation>
    <Regions>
      <!-->
      Full Shutdown
      Begin Root Container
      <-->
      <RegionRoot Name="Shutdown-Overall-Time" Guid="{d8d639a0-cf4c-45fb-976a-000000000900}" FriendlyName="Full Shutdown">        
        <!-->
        User session is controlled by CShell.
        <-->
        <Region Name="User-Shutdown-Phase" Guid="{16e39cec-7260-4cf9-bf02-f82c4848750d}" FriendlyName="User Shutdown">
            <Region Name="CShell-Shutdown-Phase" Guid="{e435806c-4652-4e47-a0be-b2faeac8e26d}" FriendlyName="CShell Shutdown">
                <Start>
                  <!--Microsoft.Windows.CoreUIComponents/ViewManager_InitiateShutdown-->
                  <Event Provider="{3720dda7-caea-4af3-a138-375aafc3f1d6}" Name="ViewManager_InitiateShutdown" />
                </Start>
                <Stop>
                  <!--Microsoft-Windows-Wininit/ReceivedShutdownRequest/win:Info-->
                  <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="55" Version="0" />
                </Stop>
            </Region>
            <Region Name="CShellShutdownEnd-To-PreShutdownStart-Phase" Guid="{175295d1-b09e-4705-9a74-90e929ca1692}" FriendlyName="CShell Shutdown End To PreShutdown Start">
                <Start>
                  <!--Microsoft-Windows-Wininit/ReceivedShutdownRequest/win:Info-->
                  <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="55" Version="0" />
                </Start>
                <Stop>
                  <!--Microsoft-Windows-Wininit/PreShutdownNotification/win:Start-->
                  <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="3" Version="0" />
                </Stop>
            </Region>
        </Region>

        <!-->
        Pre-Shutdown Notification
        Event-Based Start with provider=206f6dea-d3c5-4d10-bc72-989f03c8b84b, id=3, and version=0
        Event-Based Stop with provider=206f6dea-d3c5-4d10-bc72-989f03c8b84b, id=4, and version=0
                
        Additionally, only match start to stop if the PIDs are the same.
        <-->

        <Region Name="Shutdown-PreShutdownNotification-Phase" Guid="{d8d639a0-0000-0000-0000-000000000310}" FriendlyName="Pre-Shutdown Notification">
          <Match>
            <Event PID="true" />
          </Match>
          <Start>
            <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="3" Version="0" />
          </Start>
          <Stop>
            <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="4" Version="0" />
          </Stop>
          <Region Name="Shutdown-PreShutdownNotification-Service" Guid="{d8d639a0-0000-0000-0000-000000000311}" FriendlyName="Pre-Shutdown Service">
            <Match>
              <Event>
                <Payload FieldName="ServiceName" />
              </Event>
            </Match>
            <Naming>
              <PayloadBased NameField="ServiceName" />
            </Naming>
            <Start>
              <Event Provider="{0063715b-eeda-4007-9429-ad526f62696e}" Id="105" Version="0" />
              <PayloadIdentifier FieldName="CurrentState" FieldValue="3" />
              <PayloadIdentifier FieldName="ExecutionPhase" FieldValue="0" />
            </Start>
            <Stop>
              <Event Provider="{0063715b-eeda-4007-9429-ad526f62696e}" Id="105" Version="0" />
              <PayloadIdentifier FieldName="CurrentState" FieldValue="1" />
            </Stop>
          </Region>
        </Region>

        <!-->
        System Session Shutdown
        Event-Based Start with provider=206f6dea-d3c5-4d10-bc72-989f03c8b84b, id=9, and version=0
        Event-Based Stop with provider=206f6dea-d3c5-4d10-bc72-989f03c8b84b, id=10, and version=0
                
        Additionally, only match start to stop if the PIDs are the same.
        <-->
        
        <Region Name="Shutdown-ShutdownWindows-SystemSession" Guid="{d8d639a0-cf4c-45fb-976a-000000000200}" FriendlyName="System Session Shutdown">
          <Match>
            <Event PID="true" />
          </Match>
          <Start>
            <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="9" Version="0" />
          </Start>
          <Stop>
            <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="10" Version="0" />
          </Stop>
        </Region>

        <!-->
        Shutdown Services
        Children:
          Shutdown Service
          
        Begin Shutdown Services Container
        <-->
        
        <Region Name="Shutdown-ShutdownServices-Phase" Guid="{d8d639a0-cf4c-45fb-976a-000000000320}" FriendlyName="Shutdown Services">

          <!-->
          Shutdown Service
          Event-Based Start with provider=0063715b-eeda-4007-9429-ad526f62696e, id=105, version=0, CurrentState=4, and ExecutionPhase=3
          Event-Based Stop with provider=0063715b-eeda-4007-9429-ad526f62696e, id=105, version=0, and CurrentState=1
                
          Additionally, only match start to stop if the field "ServiceName" is the same.
              
          Instance based off payload field called "ServiceName" in the start event.
          <-->
          <Region Name="Shutdown-ShutdownServices-Service" Guid="{d8d639a0-cf4c-45fb-976a-000000000321}" FriendlyName="Shutdown Service">
            <Match>
              <Event>
                <Payload FieldName="ServiceName" />
              </Event>
            </Match>
            <Naming>
              <PayloadBased NameField="ServiceName" />
            </Naming>
            <Start>
              <Event Provider="{0063715b-eeda-4007-9429-ad526f62696e}" Id="105" Version="0" />
              <PayloadIdentifier FieldName="CurrentState" FieldValue="4" />
              <PayloadIdentifier FieldName="ExecutionPhase" FieldValue="3" />
            </Start>
            <Stop>
              <Event Provider="{0063715b-eeda-4007-9429-ad526f62696e}" Id="105" Version="0" />
              <PayloadIdentifier FieldName="CurrentState" FieldValue="1" />
            </Stop>
          </Region>
        <!-->
        End  Shutdown Services
        <-->
        </Region>


        <!-->
        UNSUPPORTED REGION:
        In future versions, this will contain the following region:
          
          Post On/Off
          Region-Based Start based off the stop of region: d8d639a0-cf4c-45fb-976a-000000000200 (System Session Shutdown)
          Trace-Based Stop
          
          Additionally, only match start to stop if the PIDs are the same.
          
          Children:
             NT Shutdown System
             Pre-Sleep Callbacks
             Flush Storage Volumes
             Shutdown Devices
             Zero Page File
             IO Shutdown System
             CM Shutdown System
          
          <Region Guid="{d8d639a0-cf4c-45fb-976a-000000000330}" Name="Shutdown-SystemShutdown-Phase" FriendlyName="Shutdown System">
            <Start>
              <Region RegionGuid="{d8d639a0-cf4c-45fb-976a-000000000200}"/>
            </Start>
            <Stop>
              <Trace/>
            </Stop>
          
          Instead, this region is being made a container.
          <-->

        <Region Guid="{d8d639a0-cf4c-45fb-976a-000000000330}" Name="Shutdown-SystemShutdown-Phase" FriendlyName="Shutdown System">

          <!-->
          NT Shutdown System
          Event-Based Start with provider=206f6dea-d3c5-4d10-bc72-989f03c8b84b, id=8, and version=0
          Event-Based Stop with provider=206f6dea-d3c5-4d10-bc72-989f03c8b84b, id=51, and version=0
          <-->

          <Region Name="Shutdown-NtShutdownSystem" Guid="{d8d639a0-cf4c-45fb-976a-000000000331}" FriendlyName="NT Shutdown System">
            <Start>
              <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="8" Version="0" />
            </Start>
            <Stop>
              <Event Provider="{206f6dea-d3c5-4d10-bc72-989f03c8b84b}" Id="51" Version="0" />
            </Stop>
          </Region>

          <!-->
          PreSleep Callbacks
          Event-Based Start with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=68, and version=0
          Event-Based Stop with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=69, and version=0
          <-->

          <Region Name="Shutdown-PreSleepCallbacks" Guid="{d8d639a0-cf4c-45fb-976a-000000000332}" FriendlyName="PreSleep Callbacks">
            <Match>
              <Event PID="true" />
            </Match>
            <Start>
              <!-- Microsoft-Windows-Kernel-Power/PreSleepCallbacks/PhaseStart - POP_ETW_EVENT_PRESLEEP_CALLBACKS_START -->
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="68" Version="0" />
            </Start>
            <Stop>
              <!-- Microsoft-Windows-Kernel-Power/PreSleepCallbacks/PhaseStop - POP_ETW_EVENT_PRESLEEP_CALLBACKS_STOP -->
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="69" Version="0" />
            </Stop>
          </Region>

          <!-->
          Flush Storage Volumes
          Event-Based Start with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=45, and version=0
          Event-Based Stop with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=46, and version=0
          
          Additionally, only match start to stop if the PIDs are the same.
          <-->

          <Region Name="Shutdown-FlushVolumes" Guid="{d8d639a0-cf4c-45fb-976a-000000000333}" FriendlyName="Flush Storage Volumes">
            <Match>
              <Event PID="true" />
            </Match>
            <Start>
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="45" Version="0" />
            </Start>
            <Stop>
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="46" Version="0" />
            </Stop>
          </Region>

          <!-->
          Shutdown Device
          Event-Based Start with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=46, and version=0
          Event-Based Stop with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=49, and version=0
          <-->

          <Region Name="Shutdown-Devices" Guid="{d8d639a0-cf4c-45fb-976a-000000000338}" FriendlyName="Shutdown Devices">
              <Start>
                <!-- Microsoft-Windows-Kernel-Power/FlushVolumes/win:Stop - POP_ETW_EVENT_FLUSHVOLUMES_STOP -->
                <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="46" Version="0" />
              </Start>
              <Stop>
                <!-- Microsoft-Windows-Kernel-Power/ZeroPageFile/win:Start - POP_ETW_EVENT_ZEROPAGEFILE_START -->
                <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="49" Version="0" />
              </Stop>
              <Region Name="Shutdown-Device" Guid="{d8d639a0-cf4c-45fb-976a-000000000340}" FriendlyName="Shutdown Device">
                <Start>
                  <!-- Microsoft-Windows-Kernel-Power/Irp/win:Start - POP_ETW_EVENT_IRPSTART -->
                  <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}"  Id="7" Version="1"/>
                  <PayloadIdentifier FieldName="MinorFunction" FieldValue="2" />
                  <PayloadIdentifier FieldName="PowerStateType" FieldValue="1" />
                </Start>
                <Stop>
                  <!-- Microsoft-Windows-Kernel-Power/Irp/win:Stop - POP_ETW_EVENT_IRPFINISH -->
                  <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}"  Id="8" Version="0" />
                </Stop>
                <Match>
                  <Event>
                    <Payload FieldName="Irp"/>
                  </Event>
                </Match>
                <Naming>
                  <PayloadBased NameField="InstanceName" Type="Device"/>
                </Naming>
              </Region>
          </Region>

          <!-->
          Zero Page File
          Event-Based Start with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=49, and version=0
          Event-Based Stop with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=50, and version=0
          
          Additionally, only match start to stop if the PIDs are the same.
          <-->

          <Region Name="Shutdown-ZeroPageFile" Guid="{d8d639a0-cf4c-45fb-976a-000000000335}" FriendlyName="Zero Page File">
            <Match>
              <Event PID="true" />
            </Match>
            <Start>
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="49" Version="0" />
            </Start>
            <Stop>
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="50" Version="0" />
            </Stop>
          </Region>

          <!-->
          IO Shutdown System
          Event-Based Start with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=51, and version=0
          Event-Based Stop with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=52, and version=0
          
          Additionally, only match start to stop if the PIDs are the same.
          <-->

          <Region Name="Shutdown-IOShutdownSystem" Guid="{d8d639a0-cf4c-45fb-976a-000000000337}" FriendlyName="IO Shutdown System">
            <Match>
              <Event PID="true" />
            </Match>
            <Start>
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="51" Version="0" />
            </Start>
            <Stop>
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="52" Version="0" />
            </Stop>
          </Region>

          <!-->
          CM Shutdown System
          Event-Based Start with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=55, and version=0
          Event-Based Stop with provider=331c3b3a-2005-44c2-ac5e-77220c37d6b4, id=56, and version=0
          
          Additionally, only match start to stop if the PIDs are the same.
          <-->
          
          <Region Name="Shutdown-CmShutdownSystem" Guid="{d8d639a0-cf4c-45fb-976a-000000000339}" FriendlyName="CM Shutdown System">
            <Match>
              <Event PID="true" />
            </Match>
            <Start>
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="55" Version="0" />
            </Start>
            <Stop>
              <Event Provider="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" Id="56" Version="0" />
            </Stop>
          </Region>
        <!-->
        End Shutdown System
        <-->
        </Region>
      </RegionRoot>
    </Regions>
  </Instrumentation>
</InstrumentationManifest>
