GetHandleInformation (kernel32)
Last changed: -131.107.0.105

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern bool GetHandleInformation(IntPtr hObject, out uint lpdwFlags);

User-Defined Types:

// If this flag is set, a child process created with the bInheritHandles parameter of CreateProcess set to TRUE will inherit the object handle.

const uint HANDLE_FLAG_INHERIT = 0x00000001;

// If this flag is set, calling the CloseHandle function will not close the object handle.

const uint HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002;

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

uint flags;

IntPtr handle;

// define handle

bool result = GetHandleInformation(handle, out flags);

Console.WriteLine(flags & HANDLE_FLAG_INHERIT);

Console.WriteLine(flags & HANDLE_FLAG_PROTECT_FROM_CLOSE);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation