Jump to content

CONTEXTRECORD

From EDM2
Revision as of 19:19, 24 May 2005 by Anakor (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

CONTEXTRECORD

Machine specific register contents for the thread at the time of the exception.

Type

typedef struct _CONTEXTRECORD {
ULONG ContextFlags;
ULONG ctx_env[7];
FPREG ctx_stack[8];
ULONG ctx_SegGs;
ULONG ctx_SegFs;
ULONG ctx_SegEs;
ULONG ctx_SegDs;
ULONG ctx_RegEdi;
ULONG ctx_RegEsi;
ULONG ctx_RegEax;
ULONG ctx_RegEbx;
ULONG ctx_RegEcx;
ULONG ctx_RegEdx;
ULONG ctx_RegEbp;
ULONG ctx_RegEip;
ULONG ctx_SegCs;
ULONG ctx_EFlags;
ULONG ctx_RegEsp;
ULONG ctx_SegSs;
} CONTEXTRECORD;

Fields

ContextFlags Flags which control the contents of the context record. 
             Possible values are shown in the following list: 
             * CONTEXT_CONTROL SS:ESP, CS:EIP, EFLAGS and EBP 
             * CONTEXT_INTEGER EAX, EBX, ECX, EDX, ESI and EDI 
             * CONTEXT_SEGMENTS DS, ES, FS, and GS 
             * CONTEXT_FLOATING_POINT numeric coprocessor state
             * CONTEXT_FULL all the above.
              
             If the context record is used as an input parameter, then for each      
             portion of the context record controlled by a flag whose value is
             set, it is assumed that the portion of the context record contains
             valid context. If the context record is being used to modify a
             thread's context, then only that portion of the thread's context
             will be modified. 
             If the context record is used as an input/output parameter to
             capture the context of a thread, then only those portions of the
             thread's context corresponding to set flags will be returned.
ctx_env[7]   This parameter is used only when ContextFlags is set to
             CONTEXT_FLOATING_POINT.
ctx_stack[8] This parameter is used only when ContextFlags is set to 
             CONTEXT_FLOATING_POINT. 
 
ctx_SegGs    GS register.
             This parameter is used only when ContextFlags is set to 
             CONTEXT_SEGMENTS.
ctx_SegFs    FS register.
             This parameter is used only when ContextFlags is set to
             CONTEXT_SEGMENTS.
ctx_SegEs    ES register.
             This parameter is used only when ContextFlags is set to
             CONTEXT_SEGMENTS.
ctx_SegDs    DS register.
             This parameter is used only when ContextFlags is set to
             CONTEXT_SEGMENTS. 
 
ctx_RegEdi   EDI register.
             This parameter is used only when ContextFlags is set to 
             CONTEXT_INTEGER.
ctx_RegEsi   ESI register.
             This parameter is used only when ContextFlags is set to
             CONTEXT_INTEGER.
ctx_RegEax   EAX register.
             This parameter is used only when ContextFlags is set to
             CONTEXT_INTEGER.
ctx_RegEbx   EBX register.
             This parameter is used only when ContextFlags is set to
             CONTEXT_INTEGER.
  
ctx_RegEcx   ECX register.
             This parameter is used only when ContextFlags is set to
             CONTEXT_INTEGER. 
 
ctx_RegEdx   EDX register.
             This parameter is used only when ContextFlags is set to 
             CONTEXT_INTEGER.
ctx_RegEbp   EBP register.
             This parameter is used only when ContextFlags is set to 
             CONTEXT_CONTROL.
ctx_RegEip   EIP register.
             This parameter is used only when ContextFlags is set to
             CONTEXT_CONTROL. 
 
ctx_SegCs    CS register.
             This parameter is used only when ContextFlags is set to 
             CONTEXT_CONTROL.
ctx_EFlags   EFLAGS register.
             This parameter is used only when ContextFlags is set to 
             CONTEXT_CONTROL.
ctx_RegEsp   ESP register.
             This parameter is used only when ContextFlags is set to 
             CONTEXT_CONTROL.
ctx_SegSs    SS register.
             This parameter is used only when ContextFlags is set to 
             CONTEXT_CONTROL.

Comment

Note that only the register sets specified by ContextFlags contain valid data. Conversely, only registers specified in ContextFlags will be restored if an exception is handled.