PiControlGetDeviceInterfaceEnabled

INT64 __fastcall PiControlGetDeviceInterfaceEnabled(INT64 a1, UINT16 *a2, INT64 a3, INT8 a4){
  unsigned int v4; 
  INT64 result; 
  int Object; 
  _ETHREAD *CurrentThread; 
  ULONG_PTR v10; 
  UINT64 v11; 
  WCHAR *OutString; 
  UNICODE_STRING Destination; 
  ULONG_PTR BugCheckParameter2; 
  v4 = *a2;
  BugCheckParameter2 = 0i64;
  OutString = 0i64;
  Destination = 0i64;
  Destination.MaximumLength = v4;
  Destination.Length = v4;
  if( (unsigned __int16)(v4 - 1) > 0x3EFu || (v4 & 1) != 0 || *((_DWORD *)a2 + 4) )
    return 3221225485i64;
  LODWORD(v11) = 1;
  result = PiControlMakeUserModeCallersCopy((VOID **)&Destination.Buffer, *((VOID **)a2 + 1), v4, 2ui64, a4, v11);
  if( (int)result >= 0 )
  {
    Object = PnpUnicodeStringToWstr(&OutString, 0i64, &Destination);
    if( Object >= 0 )
    {
      Object = PiDmGetObject(3i64, OutString, (INT64 *)&BugCheckParameter2);
      if( Object >= 0 )
      {
        CurrentThread = (_ETHREAD *)KeGetCurrentThread();
        --*((_WORD *)CurrentThread + 242);
        v10 = BugCheckParameter2;
        ExAcquirePushLockSharedEx(BugCheckParameter2, 0i64);
        *((_BYTE *)a2 + 20) = *(_QWORD *)(v10 + 40) != 0i64;
        ExReleasePushLockEx(v10, 0i64);
        KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
        PiDmObjectRelease((CHAR *)BugCheckParameter2);
      }
    }
    PnpUnicodeStringToWstrFree(OutString, &Destination);
    PiControlFreeUserModeCallersBuffer(a4, Destination.Buffer);
    return(unsigned int)Object;
  }
  return result;
}

Referenced by:

No references.