GlobalFirst

3.1

  #include <toolhelp.h>    

  BOOL GlobalFirst(lpge, wFlags)    
  GLOBALENTRY FAR* lpge; /* address of structure for object */
  WORD wFlags; /* specifies the heap to use */

The GlobalFirst function fills the specified structure with information that describes the first object on the global heap.

Parameters

lpge

Points to a GLOBALENTRY structure that receives information about the global memory object. The GLOBALENTRY structure has the following form:

#include <toolhelp.h>

typedef struct tagGLOBALENTRY {  /* ge */
    DWORD   dwSize;
    DWORD   dwAddress;
    DWORD   dwBlockSize;
    HGLOBAL hBlock;
    WORD    wcLock;
    WORD    wcPageLock;
    WORD    wFlags;
    BOOL    wHeapPresent;
    HGLOBAL hOwner;
    WORD    wType;
    WORD    wData;
    DWORD   dwNext;
    DWORD   dwNextAlt;
} GLOBALENTRY;

For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.

wFlags

Specifies the heap to use. This parameter can be one of the following values:

Value Meaning

GLOBAL_ALL Structure pointed to by lpge will receive information about the first object on the complete global heap.
GLOBAL_FREE Structure will receive information about the first object on the free list.
GLOBAL_LRU Structure will receive information about the first object on the least-recently-used (LRU) list.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Comments

The GlobalFirst function can be used to begin a global heap walk. An application can examine subsequent objects on the global heap by using the GlobalNext function. Calls to GlobalNext must have the same wFlags value as that specified in GlobalFirst.

Before calling GlobalFirst, an application must initialize the GLOBALENTRY structure and specify its size, in bytes, in the dwSize member.

See Also

GlobalEntryHandle, GlobalEntryModule, GlobalInfo, GlobalNext