Skip to content

Commit

Permalink
Fixed incorrect definition on API DbgUiSetThreadDebugObject (#387)
Browse files Browse the repository at this point in the history
* Fixed incorrect definition on API DbgUiSetThreadDebugObject

DbgUiSetThreadDebugObject do not return any value, we should mark it as "void"

* Fixed the document for API DbgUiSetThreadDebugObject
  • Loading branch information
zhuxb711 authored Apr 10, 2023
1 parent 3663faf commit 0493dbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 1 addition & 9 deletions PInvoke/NtDll/Winternl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,8 @@ public static extern NTStatus NtCreateProcessEx(out HPROCESS ProcessHandle, [In]

/// <summary>Set the debug object handle in the TEB. This function is UNDOCUMENTED.</summary>
/// <param name="DebugObjectHandle">Debug object handle. Retrieve from NtQueryInformationProcess</param>
/// <returns>
/// <para>The function returns an NTSTATUS success or error code.</para>
/// <para>
/// The forms and significance of NTSTATUS error codes are listed in the Ntstatus.h header file available in the DDK, and are
/// described in the DDK documentation under Kernel-Mode Driver Architecture / Design Guide / Driver Programming Techniques /
/// Logging Errors.
/// </para>
/// </returns>
[DllImport(Lib.NtDll, SetLastError = false, ExactSpelling = true)]
public static extern NTStatus DbgUiSetThreadDebugObject(IntPtr DebugObjectHandle);
public static extern void DbgUiSetThreadDebugObject(IntPtr DebugObjectHandle);

/// <summary>Call the kernel to remove the debug object. This function is UNDOCUMENTED.</summary>
/// <param name="ProcessHandle">The process handle.</param>
Expand Down
4 changes: 2 additions & 2 deletions UnitTests/PInvoke/NtDll/WinternlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void DbgUiSetThreadDebugObjectAndNtRemoveProcessDebugTest()

try
{
Assert.That(DbgUiSetThreadDebugObject(DebugObjectHandleQueryResult.Value), ResultIs.Successful);
DbgUiSetThreadDebugObject(DebugObjectHandleQueryResult.Value);

try
{
Expand Down Expand Up @@ -114,7 +114,7 @@ public void DbgUiSetThreadDebugObjectAndNtRemoveProcessDebugTest()
}
finally
{
Assert.That(DbgUiSetThreadDebugObject(IntPtr.Zero), ResultIs.Successful);
DbgUiSetThreadDebugObject(IntPtr.Zero);
}
}
finally
Expand Down

0 comments on commit 0493dbd

Please sign in to comment.