Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GetProcessMemoryInfo and PROCESS_MEMORY_COUNTERS_EX

475 views
Skip to first unread message

klanga

unread,
Sep 13, 2007, 2:55:08 AM9/13/07
to
How do you use GetProcessMemoryInfo and PROCESS_MEMORY_COUNTERS_EX? I made
some tests but it didn't work, PrivateUsage always returns 0.

MSDN says (http://msdn2.microsoft.com/en-us/library/ms683219.aspx):

ppsmemCounters
A pointer to the PROCESS_MEMORY_COUNTERS or PROCESS_MEMORY_COUNTERS_EX
structure that receives information about the memory usage of the process.


How is that supposed to work?


I got the PROCESS_MEMORY_COUNTERS_EX declaration from JwaPsApi.pas
(http://jedi-apilib.sourceforge.net/ > win32api).


I searched the web and found nothing about it.

Thanks a lot.

Peter Below (TeamB)

unread,
Sep 13, 2007, 2:35:45 PM9/13/07
to
klanga wrote:

> How do you use GetProcessMemoryInfo and PROCESS_MEMORY_COUNTERS_EX? I
> made some tests but it didn't work, PrivateUsage always returns 0.
>
> MSDN says (http://msdn2.microsoft.com/en-us/library/ms683219.aspx):
>
> ppsmemCounters
> A pointer to the PROCESS_MEMORY_COUNTERS or
> PROCESS_MEMORY_COUNTERS_EX structure that receives information about
> the memory usage of the process.
>
>
> How is that supposed to work?

The key point when passing API records to API functions to get data
back is this:

- fill the record with all 0 via FillChar or ZeroMemory
- set the first field of the record to the size of the record
(Sizeof(recordvar)) if applicable.

Many API records have a size field as first field to allow the API
function in question to figure out which version of the record it has
been given to work with. The two record types you mention are among
this group.


--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com

0 new messages