Skip to content

Commit f5e5c72

Browse files
committed
docs: add readonly HandleAttributes remarks
refactor: use coalesce expression
1 parent 4251f05 commit f5e5c72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deadlock-dotnet-sdk/Windows.Win32/SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public readonly struct SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX
5151
/// <summary>ProcessHacker defines a little over a dozen handle-able object types.</summary>
5252
public ushort ObjectTypeIndex { get; } // USHORT
5353
/// <summary><see href="https://docs.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_object_attributes#members"/></summary>
54+
/// <remarks>Not updated when SetHandleInformation is called.</remarks>
5455
public HandleFlags HandleAttributes { get; } // uint
5556
#pragma warning disable RCS1213, CS0169, IDE0051 // Remove unused field declaration. csharp(RCS1213) | Roslynator
5657
private readonly uint Reserved;
@@ -99,8 +100,7 @@ public unsafe HANDLE_FLAGS GetHandleInfo()
99100

100101
// If passing the source handle failed, try passing a duplicate instead
101102

102-
using SafeProcessHandle sourceProcess = OpenProcess_SafeHandle(PROCESS_ACCESS_RIGHTS.PROCESS_DUP_HANDLE, false, (uint)UniqueProcessId);
103-
if (sourceProcess is null) throw new Win32Exception();
103+
using SafeProcessHandle sourceProcess = OpenProcess_SafeHandle(PROCESS_ACCESS_RIGHTS.PROCESS_DUP_HANDLE, false, (uint)UniqueProcessId) ?? throw new Win32Exception();
104104
using SafeObjectHandle safeHandleValue = new(HandleValue, false);
105105
DuplicateHandle(sourceProcess, safeHandleValue, Process.GetCurrentProcess().SafeHandle, out SafeFileHandle dupHandle, default, false, DUPLICATE_HANDLE_OPTIONS.DUPLICATE_SAME_ACCESS);
106106
return GetHandleInformation(dupHandle);

0 commit comments

Comments
 (0)