StackTraceCSIPFirst

3.1

  #include <toolhelp.h>    

  BOOL StackTraceCSIPFirst(lpste, wSS, wCS, wIP, wBP)    
  STACKTRACEENTRY FAR* lpste; /* address of stack-frame structure */
  WORD wSS; /* value of SS register, */  
  WORD wCS; /* value of CS register, */  
  WORD wIP; /* value of IP register, */  
  WORD wBP; /* value of BP register, */  

The StackTraceCSIPFirst function fills the specified structure with information that describes the specified stack frame.

Parameters

lpste

Points to a STACKTRACEENTRY structure to receive information about the stack. The STACKTRACEENTRY structure has the following form:

#include <toolhelp.h>

typedef struct tagSTACKTRACEENTRY {  /* ste */
    DWORD   dwSize;
    HTASK   hTask;
    WORD    wSS;
    WORD    wBP;
    WORD    wCS;
    WORD    wIP;
    HMODULE hModule;
    WORD    wSegment;
    WORD    wFlags;
} STACKTRACEENTRY;

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

wSS

Contains the value in the SS register. This value is used with the wBP value to determine the next entry in the stack trace.

wCS

Contains the value in the CS register of the first stack frame.

wIP

Contains the value in the IP register of the first stack frame.

wBP

Contains the value in the BP register. This value is used with the wSS value to determine the next entry in the stack trace.

Return Value

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

Comments

The StackTraceFirst function can be used to begin a stack trace of any task except the current task. When a task is inactive, the kernel maintains its state, including its current stack, stack pointer, CS and IP values, and BP value. The kernel does not maintain these values for the current task. Therefore, when a stack trace is done on the current task, the application must use StackTraceCSIPFirst to begin a stack trace. An application can continue to trace through the stack by using the StackTraceNext function.

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

See Also

StackTraceNext, StackTraceFirst