GetProcessHeaps(Windows API)

 Function function:

The GetProcessHeaps  function returns the number and handles of all active heaps in the process

Function prototype:

DWORD GetProcessHeaps(
  [in]  DWORD   NumberOfHeaps,
  [out] PHANDLE ProcessHeaps
);

Parameter analysis:

parameter meaning
[in] NumberOfHeaps Specifies  the number of handles that can be stored in the buffer pointed to by ProcessHeaps
[out] ProcessHeaps This parameter is a pointer to the buffer used to receive the heap handle


return value:

If the function returns successfully, the return value is the number of handles to the active heap for the process.

If the return value is less than or equal to NumberOfHeaps , the function has stored that number of heap handles in the buffer pointed to by ProcessHeaps .

If the return value is greater than NumberOfHeaps , the buffer pointed to by ProcessHeaps is too small to hold all the heap handles of the calling process, and the function stores the NumberOfHeaps handles in the buffer. Use the return value to allocate a buffer large enough to receive all handles, then call the function again.

If the function returns failure, the return value is 0. Because each process has at least one active heap, which is the default heap for the process. To get extended error information, call  GetLastError ​.

Guess you like

Origin blog.csdn.net/qq_17111397/article/details/122186209