Function Reference


_WinAPI_GetObjectInfoByHandle

Retrieves information about a specified object

#include <WinAPIHObj.au3>
_WinAPI_GetObjectInfoByHandle ( $hObject )

Parameters

$hObject A handle to the object to obtain information about.

Return Value

Success: The array containing the following information:
[0] - The attributes of the object.
[1] - A mask that represents the granted access to the object.
[2] - The number of handles to the object.
[3] - The number of pointers to the object.
Failure: Sets the @error flag to non-zero, @extended flag may contain the NTSTATUS error code.

See Also

Search ZwQueryObject in MSDN Library.

Example

#include <WinAPIFiles.au3>
#include <WinAPIHObj.au3>

;~ #include <WinAPISys.au3>

Local $sFile = @ScriptFullPath
Local $hFile = _WinAPI_CreateFile($sFile, 2, 0, 6)
If @error Then Exit

Local $aInfo = _WinAPI_GetObjectInfoByHandle($hFile)
If IsArray($aInfo) Then
        ConsoleWrite('File:       ' & $sFile & @CRLF)
        ConsoleWrite('Handle:     ' & $hFile & @CRLF)
        ConsoleWrite('Attributes: 0x' & Hex($aInfo[0]) & @CRLF)
        ConsoleWrite('Access:     0x' & Hex($aInfo[1]) & @CRLF)
        ConsoleWrite('Handles:    ' & $aInfo[2] & @CRLF)
        ConsoleWrite('Pointers:   ' & $aInfo[3] & @CRLF)
EndIf

_WinAPI_CloseHandle($hFile)