GxpReadFrameBufferPixels

NTSTATUS __stdcall GxpReadFrameBufferPixels(_GRAPHICS_RECTANGLE *Rectangle, _OFFSET *Offset){
  unsigned int v2; 
  _OFFSET *v3; 
  unsigned int v5; 
  size_t v6; 
  _RECTANGLE *Resolution; 
  int v8; 
  int Stride; 
  _GRAPHICS_RECTANGLE v10; 
  _GRAPHICS_RECTANGLE v11; 
  NTSTATUS v12; 
  __int64 v13; 
  NTSTATUS v14; 
  char *v15; 
  _GRAPHICS_RECTANGLE v16; 
  char *v17; 
  size_t v18; 
  __int64 v19; 
  unsigned int v20; 
  int v21; 
  _OFFSET v22; 
  const VOID *v23; 
  __int64 v24; 
  int v25; 
  _RECTANGLE v26; 
  __int64 v27; 
  int v28; 
  _RECTANGLE result; 
  int v30[4]; 
  __int64 v31; 
  int v32; 
  PPM_VETO_ACCOUNTING *VetoAccounting; 

  v2 = 0;
  *(_QWORD *)&v26.Width = 0i64;
  v3 = Offset;
  v26.Stride = 0;
  v22 = 0i64;
  BgpGetBitsPerPixel((CHAR)Rectangle, (INT64)Offset);
  v6 = v5 >> 3;
  Resolution = BgpGetResolution(&result);
  Stride = Resolution->Stride;
  v24 = *(_QWORD *)&Resolution->Width;
  v25 = Stride;
  if( !Rectangle )
    return -1073741811;
  v10 = Rectangle[1];
  if( !v10 )
    return -1073741811;
  v11 = *Rectangle;
  if( !*Rectangle || Rectangle[2] != v8 || !v3 || v10 + v3->X > (unsigned int)v24 || v11 + v3->Y > HIDWORD(v24) )
    return -1073741811;
  if( (*(&SbiVmbusArrivalEvent + 368) & 8) != 0 )
    return -1073741637;
  if( Rectangle[3] < v6 * v10 * v11 )
    return -1073741789;
  if( (*(&SbiVmbusArrivalEvent + 368) & 2) == 0 )
    return -1073741823;
  v12 = GxpAdjustRectangleToFrameBuffer(
          (unsigned int *)Rectangle,
          (unsigned int *)v3,
          (__int64)&v24,
          &v26.Width,
          &v22,
          0);
  if( v12 >= 0 )
  {
    v14 = 0;
    v32 = 0;
    if( !*(&SbiVmbusArrivalEvent + 256) )
    {
      v30[0] = *Rectangle;
      LOBYTE(v13) = 1;
      v30[1] = Rectangle[1];
      v30[3] = Rectangle[3];
      v30[2] = *(&SbiVmbusArrivalEvent + 68);
      v31 = *((_QWORD *)Rectangle + 3);
      v14 = (*(&SbiVmbusArrivalEvent + 36))(v30, v3, v13);
      goto LABEL_19;
    }
    v15 = (char *)*((_QWORD *)Rectangle + 3);
    v16 = *Rectangle;
    v23 = (const VOID *)*(&SbiVmbusArrivalEvent + 36);
    if( *(&SbiVmbusArrivalEvent + 258) )
    {
      HIDWORD(VetoAccounting) = 0;
      if( !v16 )
        goto LABEL_19;
      while( 1 )
      {
        v20 = 0;
        LODWORD(VetoAccounting) = 0;
        if( Rectangle[1] )
          break;
LABEL_30:
        HIDWORD(VetoAccounting) = ++v2;
        if( v2 >= *Rectangle )
          goto LABEL_18;
      }
      v27 = v24;
      v28 = v25;
      result = v26;
      while( 1 )
      {
        GxpGetRotatedPixelOffset(VetoAccounting, (UINT8)&result, (UINT8)v3);
        v32 = v21;
        if( v21 < 0 )
          break;
        memmove(v15, v23, v6);
        ++v20;
        v15 += v6;
        LODWORD(VetoAccounting) = v20;
        if( v20 >= Rectangle[1] )
          goto LABEL_30;
      }
    }
    else
    {
      v17 = (char *)(*(&SbiVmbusArrivalEvent + 36) + v6 * (v3->X + v25 * v3->Y));
      if( !v16 )
      {
LABEL_19:
        *Rectangle = v26.Height;
        Rectangle[1] = v26.Width;
        *v3 = v22;
        return v14;
      }
      v18 = v6 * Rectangle[1];
      v19 = v6 * v25;
      do
      {
        memmove(v15, v17, v18);
        v17 += v19;
        v15 += v6 * Rectangle[1];
        --v16;
      }
      while( v16 );
      v3 = Offset;
    }
LABEL_18:
    v14 = v32;
    goto LABEL_19;
  }
  return v12;
}

Referenced by:

BgpGxReadRectangle