anchor.diff:      set in ContextFlags.  Note that CONTEXT_DEBUG_REGISTERS is NOT
       included in CONTEXT_FULL. }
   
  -    Dr0: DWORD;
  -    Dr1: DWORD;
  -    Dr2: DWORD;
  -    Dr3: DWORD;
  -    Dr6: DWORD;
  -    Dr7: DWORD;
  +    Dr0       : DWORD;
  +    Dr1       : DWORD;
  +    Dr2       : DWORD;
  +    Dr3       : DWORD;
  +    Dr6       : DWORD;
  +    Dr7       : DWORD;
   
     { This section is specified/returned if the
       ContextFlags word contians the flag CONTEXT_FLOATING_POINT. }
   
  -    FloatSave: TFloatingSaveArea;
  +    FloatSave : TFloatingSaveArea;
   
     { This section is specified/returned if the
       ContextFlags word contians the flag CONTEXT_SEGMENTS. }
   
  -    SegGs: DWORD;
  -    SegFs: DWORD;
  -    SegEs: DWORD;
  -    SegDs: DWORD;
  +    SegGs     : DWORD;
  +    SegFs     : DWORD;
  +    SegEs     : DWORD;
  +    SegDs     : DWORD;
   
     { This section is specified/returned if the
       ContextFlags word contians the flag CONTEXT_INTEGER. }
   
  -    Edi: DWORD;
  -    Esi: DWORD;
  -    Ebx: DWORD;
  -    Edx: DWORD;
  -    Ecx: DWORD;
  -    Eax: DWORD;
  +    Edi       : DWORD;
  +    Esi       : DWORD;
  +    Ebx       : DWORD;
  +    Edx       : DWORD;
  +    Ecx       : DWORD;
  +    Eax       : DWORD;
   
     { This section is specified/returned if the
       ContextFlags word contians the flag CONTEXT_CONTROL. }
   
  -    Ebp: DWORD;
  -    Eip: DWORD;
  -    SegCs: DWORD;
  -    EFlags: DWORD;
  -    Esp: DWORD;
  -    SegSs: DWORD;
  -  end;
  -  TContext = _CONTEXT;
  +    Ebp       : DWORD;
  +    Eip       : DWORD;
  +    SegCs     : DWORD;
  +    EFlags    : DWORD;
  +    Esp       : DWORD;
  +    SegSs     : DWORD;
  +  end;
  +  PContext32 = ^TContext32;
  +
  +
  +//
  +// Context Frame
  +//
  +//  This frame has a several purposes: 1) it is used as an argument to
  +//  NtContinue, 2) is is used to constuct a call frame for APC delivery,
  +//  and 3) it is used in the user level thread creation routines.
  +//
  +//
  +// The flags field within this record controls the contents of a CONTEXT
  +// record.
  +//
  +// 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 that portion of the context record contains
  +// valid context. If the context record is being used to modify a threads
  +// context, then only that portion of the threads context is modified.
  +//
  +// If the context record is used as an 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.
  +//
  +// CONTEXT_CONTROL specifies SegSs, Rsp, SegCs, Rip, and EFlags.
  +//
  +// CONTEXT_INTEGER specifies Rax, Rcx, Rdx, Rbx, Rbp, Rsi, Rdi, and R8-R15.
  +//
  +// CONTEXT_SEGMENTS specifies SegDs, SegEs, SegFs, and SegGs.
  +//
  +// CONTEXT_DEBUG_REGISTERS specifies Dr0-Dr3 and Dr6-Dr7.
  +//
  +// CONTEXT_MMX_REGISTERS specifies the floating point and extended registers
  +//     Mm0/St0-Mm7/St7 and Xmm0-Xmm15).
  +//
  +
  +//typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
  +type
  +  TContext64 = record
  +    // Register parameter home addresses.
  +    //
  +    // N.B. These fields are for convience - they could be used to extend the
  +    //      context record in the future.
  +    P1Home        : DWORD64;
  +    P2Home        : DWORD64;
  +    P3Home        : DWORD64;
  +    P4Home        : DWORD64;
  +    P5Home        : DWORD64;
  +    P6Home        : DWORD64;
  +
  +    // Control flags.
  +    ContextFlags  : DWORD;
  +    MxCsr         : DWORD;
  +
  +    // Segment Registers and processor flags.
  +    SegCs         : WORD;
  +    SegDs         : WORD;
  +    SegEs         : WORD;
  +    SegFs         : WORD;
  +    SegGs         : WORD;
  +    SegSs         : WORD;
  +    EFlags        : DWORD;
  +
  +    // Debug registers
  +    Dr0           : DWORD64;
  +    Dr1           : DWORD64;
  +    Dr2           : DWORD64;
  +    Dr3           : DWORD64;
  +    Dr6           : DWORD64;
  +    Dr7           : DWORD64;
  +
  +    // Integer registers.
  +    Rax           : DWORD64;
  +    Rcx           : DWORD64;
  +    Rdx           : DWORD64;
  +    Rbx           : DWORD64;
  +    Rsp           : DWORD64;
  +    Rbp           : DWORD64;
  +    Rsi           : DWORD64;
  +    Rdi           : DWORD64;
  +    R8            : DWORD64;
  +    R9            : DWORD64;
  +    R10           : DWORD64;
  +    R11           : DWORD64;
  +    R12           : DWORD64;
  +    R13           : DWORD64;
  +    R14           : DWORD64;
  +    R15           : DWORD64;
  +
  +    // Program counter.
  +    Rip           : DWORD64;
  +
  +    // Floating point state.
  +    FltSave       : XMM_SAVE_AREA32; // MWE: only translated the FltSave part of the union
  +
  +    // Vector registers.
  +    VectorRegister  : array[0..25] of M128A;
  +    VectorControl   : DWORD64;
  +
  +    // Special debug control registers.
  +    DebugControl          : DWORD64;
  +    LastBranchToRip       : DWORD64;
  +    LastBranchFromRip     : DWORD64;
  +    LastExceptionToRip    : DWORD64;
  +    LastExceptionFromRip  : DWORD64;
  +  end;
  +
   
   const
     hexsize = sizeof(TDbgPtr)*2;
  
positive.code: function DoReadThreadRegs32(ThreadHandle: THandle; Regs: TDbgDataList): Boolean;
  function DoWriteThreadRegs32(ThreadHandle: THandle; Regs: TDbgDataList): Boolean;
  
  function SetThread32SingleStep(ThreadHandle: THandle): Boolean;
  
  function SuspendProcess(AProcID: LongWord): Boolean;
  function ResumeProcess(AProcID: LongWord): Boolean;
  
  implementation
  
  const
    CONTEXT32_ALL = //todo:  {CONTEXT_FLOATING_POINT or} 
                  CONTEXT_DEBUG_REGISTERS or 
                  CONTEXT_SEGMENTS or CONTEXT_INTEGER or CONTEXT_CONTROL;
                  
  function DoReadThreadRegs32(ThreadHandle: THandle; Regs: TDbgDataList): Boolean;
  var
  
negative.code:   //  WriteLn('SetThreadContext = ', GetLastError);
  end;
  
  function DoReadThreadRegs64(ThreadHandle: THandle; Regs: TDbgDataList): Boolean;
  var
    ctx   : TCONTEXT;
  begin
    Result:=False;
  end;
  
  function DoWriteThreadRegs64(ThreadHandle: THandle; Regs: TDbgDataList): Boolean;
  begin
    Result:=False;
  end;
  
  function SetThread32SingleStep(ThreadHandle: THandle): Boolean;
  var
    ctx : TContext32;
  begin
    FillChar(ctx, sizeof(ctx), 0);
    ctx.ContextFlags := CONTEXT32_CONTROL;
    Result := GetThreadContext(ThreadHandle, @ctx);
    if not Result then Exit;
    
    ctx.ContextFlags := CONTEXT32_CONTROL;
    ctx.EFlags := ctx.EFlags or FLAG32_TRACE_BIT;
    
    // PContext(@ctx)^ is a bit hacky 
    Result := SetThreadContext(ThreadHandle, PContext(@ctx)^);
  