Skip to content

Commit 8ea078b

Browse files
committed
Added option to specify state flags for exception port.
1 parent 2f6fd65 commit 8ea078b

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

NtApiDotNet/NtProcess.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,23 @@ public void SetFaultFlags(ProcessFaultFlags flags)
15221522
SetFaultFlags(flags, true);
15231523
}
15241524

1525+
/// <summary>
1526+
/// Set the process exception port.
1527+
/// </summary>
1528+
/// <param name="exception_port">The exception port to set.</param>
1529+
/// <param name="state_flags">Additional state flags.</param>
1530+
/// <param name="throw_on_error">True to throw on error.</param>
1531+
/// <returns>The NT status code.</returns>
1532+
public NtStatus SetExceptionPort(NtAlpc exception_port, int state_flags, bool throw_on_error)
1533+
{
1534+
ProcessExceptionPort port = new ProcessExceptionPort()
1535+
{
1536+
ExceptionPortHandle = exception_port.Handle.DangerousGetHandle(),
1537+
StateFlags = state_flags
1538+
};
1539+
return Set(ProcessInformationClass.ProcessExceptionPort, port, throw_on_error);
1540+
}
1541+
15251542
/// <summary>
15261543
/// Set the process exception port.
15271544
/// </summary>

NtApiDotNet/NtProcessNative.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,13 @@ public struct ProcessFaultInformation
416416
public int AdditionalInfo;
417417
}
418418

419+
[StructLayout(LayoutKind.Sequential)]
420+
public struct ProcessExceptionPort
421+
{
422+
public IntPtr ExceptionPortHandle;
423+
public int StateFlags;
424+
}
425+
419426
public enum ProcessInformationClass
420427
{
421428
ProcessBasicInformation, // 0, q: PROCESS_BASIC_INFORMATION, PROCESS_EXTENDED_BASIC_INFORMATION

0 commit comments

Comments
 (0)