PiCMValidateDeviceInstance

NTSTATUS __stdcall PiCMValidateDeviceInstance(
        PVOID IoctlInputBuffer,
        UINT64 IoctlInputBufferSize,
        PVOID IoctlOutputBuffer,
        UINT64 IoctlOutputBufferSize,
        UINT64 *BytesUsed){
  UINT64 *v5; 
  unsigned int v6; 
  NTSTATUS v8; 
  int v9; 
  int v10; 
  int v11; 
  unsigned int v13; 
  int v14; 
  int v15; 
  HANDLE Handle; 
  int v17; 
  int v18; 
  int v19; 
  INT64 v20[2]; 
  int v21[4]; 
  UINT64 ExpectedOutputSize; 
  struct _SECURITY_SUBJECT_CONTEXT SubjectContext; 
  UINT64 *v24; 
  v5 = v24;
  v14 = 0;
  v15 = 0;
  v6 = IoctlOutputBufferSize;
  v19 = 0;
  *(_DWORD *)v24 = 0;
  v18 = 0;
  v17 = 0;
  Handle = 0i64;
  *(_OWORD *)v20 = 0i64;
  ExpectedOutputSize = 0i64;
  *(_OWORD *)v21 = 0i64;
  LOBYTE(v24) = 1;
  memset(&SubjectContext, 0, sizeof(SubjectContext));
  v8 = PiCMCaptureObjectInputData((UINT64)IoctlInputBuffer, IoctlInputBufferSize, (unsigned int)BytesUsed, (INT64)v20);
  if( v8 < 0 )
    goto LABEL_17;
  if( !*(_QWORD *)v21
    || (v9 = HIDWORD(v20[0]), (unsigned int)(HIDWORD(v20[0]) - 1) > 1)
    || LODWORD(v20[1]) != 1
    || v21[3]
    || !IoctlOutputBuffer
    || v6 < 8 )
  {
    v10 = -1073741811;
    goto LABEL_14;
  }
  v10 = PnpOpenObjectRegKey(PiPnpRtlCtx, *(__int64 *)v21, 1u, 1, 0, (__int64)&Handle);
  if( v10 >= 0 )
  {
    if( v9 == 2 && PiAuDoesClientHaveAccess(2ui64) )
    {
LABEL_19:
      LODWORD(v24) = 4;
      if( (int)RegRtlQueryValue(Handle, L"Phantom", &v14, &v15, (__int64)&v24) < 0
        || v14 != 4
        || (_DWORD)v24 != 4
        || !v15 )
      {
        goto LABEL_14;
      }
      goto LABEL_21;
    }
    SeCaptureSubjectContext(&SubjectContext);
    PiPnpRtlApplyMandatoryFilters();
    v10 = v11;
    SeReleaseSubjectContext(&SubjectContext);
    if( v10 >= 0 )
    {
      if( !(_BYTE)v24 )
        goto LABEL_21;
      if( v9 == 2 )
        goto LABEL_19;
      if( (int)CmGetDeviceStatus(PiPnpRtlCtx, *(const WCHAR **)v21, (__int64)Handle, &v19, &v18, &v17, v13) < 0 )
LABEL_21:
        v10 = -1073741810;
    }
  }
LABEL_14:
  if( Handle )
    ZwClose(Handle);
  v8 = PiCMReturnBasicResultData((unsigned int)v10, (unsigned int)ExpectedOutputSize, IoctlOutputBuffer, v6, v5);
LABEL_17:
  PiCMReleaseObjectInputData((INT64)v20);
  return v8;
}

Referenced by:

No references.