XbpsDebugger.ps1

$Script:XapDebugger = Add-Type -Namespace Xap -Name "XapDebugger$(Get-Random)" -MemberDefinition '
public enum StopConditions {
    CreateThread = 1,
    FirstChanceException = 2,
    DebugString = 4,
    StackTrace = 8,
    ModuleLoad = 16,
    TitleLaunch = 32,
    PerformanceCounterStartup = 64
}
'
, '
[DllImport("xbdm.dll")]
public static extern int DmCrashDump();
'
, '
[DllImport("xbdm.dll")]
public static extern int DmHaltThread(uint ThreadID);
'
,'
[DllImport("xbdm.dll")]
public static extern int DmIsDebuggerPresent();
'
,'
[DllImport("xbdm.dll")]
public static extern int DmStopOn(StopConditions conditions, bool stop);
'
, '
[DllImport("xbdm.dll")]
public static extern int DmSuspendThread(uint ThreadID);
'
 -PassThru | Where-Object { -not $_.IsEnum }