WbSetWowTrapFrame

__int64 __fastcall WbSetWowTrapFrame(_DWORD *a1, _DWORD *a2){
  _EWOW64PROCESS *WoW64Process; 
  unsigned __int16 Machine; 
  unsigned int v6; 
  _ETHREAD *CurrentThread; 
  int v8; 
  NTSTATUS ContextThread; 

  WoW64Process = KeGetCurrentThread()->ApcState.Process->WoW64Process;
  if( !WoW64Process )
    return(unsigned int)-1073741637;
  Machine = WoW64Process->Machine;
  if( !Machine )
    return(unsigned int)-1073741637;
  if( Machine != 332 )
  {
    if( Machine == 452 )
    {
      v6 = 416;
      goto LABEL_7;
    }
    return(unsigned int)-1073741637;
  }
  v6 = 716;
LABEL_7:
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --CurrentThread->Tcb.SpecialApcDisable;
  if( Machine == 332 )
    v8 = 65537;
  else
    v8 = 2097153;
  a1[12] = v8;
  ContextThread = PspWow64GetContextThread((_ETHREAD *)KeGetCurrentThread(), a1 + 12, v6, 0i64);
  if( ContextThread >= 0 )
  {
    if( Machine == 332 )
    {
      a1[58] = a2[2];
      a1[61] = *a2;
      a1[60] = a2[4];
    }
    else
    {
      a1[28] = a2[2];
      a1[26] = *a2;
      a1[29] = a2[4];
    }
    ContextThread = PspWow64SetContextThread((PETHREAD)KeGetCurrentThread());
  }
  KiLeaveGuardedRegionUnsafe((__int64)KeGetCurrentThread());
  return(unsigned int)ContextThread;
}

Referenced by:

WbSetTrapFrame