Expand Minimize

GetProcessHandleCount function

Retrieves the number of open handles that belong to the specified process.

Syntax


BOOL WINAPI GetProcessHandleCount(
  _In_     HANDLE hProcess,
  _Inout_  PDWORD pdwHandleCount
);

Parameters

hProcess [in]

A handle to the process whose handle count is being requested. The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. For more information, see Process Security and Access Rights.

Windows Server 2003 and Windows XP:  The handle must have the PROCESS_QUERY_INFORMATION access right.

pdwHandleCount [in, out]

A pointer to a variable that receives the number of open handles that belong to the specified process.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

This function retrieves information about the executive objects for the process. For more information, see Kernel Objects.

To compile an application that uses this function, define _WIN32_WINNT as 0x0501 or later. For more information, see Using the Windows Headers.

Requirements

Minimum supported client

Windows Vista, Windows XP with SP1 [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

WinBase.h on Windows XP, Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2008 R2 (include Windows.h);
Processthreadsapi.h on Windows 8 and Windows Server 2012

Library

Kernel32.lib

DLL

Kernel32.dll

See also

Process and Thread Functions
Processes

 

 

Community Additions

ADD
Show:
© 2014 Microsoft