PpDevCfgProcessDeviceReset

NTSTATUS __stdcall PpDevCfgProcessDeviceReset(_DEVICE_NODE *DeviceNode){
  int v2; 
  const wchar_t *v3; 
  INT64 v4; 
  NTSTATUS inited; 
  char *v6; 
  INT64 v7; 
  int v8; 
  int v9; 
  __int64 v10; 
  __int64 v11; 
  __int64 v12; 
  __int64 v13; 
  const wchar_t *v15; 
  __int64 v16; 
  UINT64 v17; 
  __int64 v18; 
  int a5; 
  int v20; 
  struct _UNICODE_STRING UnicodeString; 
  void *v22; 
  INT64 v23[3]; 
  int v24; 
  __int64 v25; 
  int v26; 
  INT64 result[2]; 
  INT64 v28; 
  _GUID Guid; 
  memset((INT64)result, 0i64);
  v2 = 0;
  v22 = 0i64;
  Guid = 0i64;
  *(_QWORD *)&UnicodeString.Length = 0i64;
  v20 = 1;
  UnicodeString.Buffer = 0i64;
  v18 = 0i64;
  a5 = 0;
  if( !PiDevCfgMode )
  {
    inited = 0;
    goto LABEL_17;
  }
  v3 = (const wchar_t *)*((_QWORD *)DeviceNode + 6);
  if( !v3 )
  {
    inited = -1073741808;
    goto LABEL_17;
  }
  inited = PiDevCfgInitDeviceContext(v3, 0i64, result);
  if( inited >= 0 )
  {
    v6 = (char *)v28;
    v7 = *((_QWORD *)DeviceNode + 6);
    v23[0] = (INT64)&DEVPKEY_Device_ClassGuid;
    LODWORD(v17) = 1;
    v23[2] = (INT64)&Guid;
    v23[1] = 13i64;
    v25 = 0i64;
    v26 = 0;
    v24 = 16;
    inited = PiDevCfgQueryObjectProperties(v4, v7, 1ui64, v28, (INT64)v23, v17);
    if( inited >= 0 )
    {
      if( v25 >= 0 )
      {
        inited = RtlStringFromGUIDEx(&Guid, &UnicodeString, 1u);
        if( inited < 0 )
          goto LABEL_17;
        if( (int)PnpOpenObjectRegKey(PiPnpRtlCtx, (__int64)UnicodeString.Buffer, 2u, 131097, 0, (__int64)&v22) >= 0 )
          goto LABEL_8;
        RtlFreeAnsiString(&UnicodeString);
      }
      Guid = 0i64;
LABEL_8:
      v8 = PiDevCfgMigrateDevice(
             (__int64)DeviceNode,
             (__int64)result,
             (unsigned __int16 *)((unsigned __int64)&UnicodeString & -(__int64)(UnicodeString.Buffer != 0i64)),
             0i64,
             &a5,
             0i64);
      v9 = a5;
      if( v8 < 0 )
        v9 = 0;
      PiDevCfgResetDeviceDriverSettings(
        (__int64)DeviceNode,
        (__int64)result,
        (_QWORD *)((unsigned __int64)&Guid & -(__int64)(UnicodeString.Buffer != 0i64)),
        v22,
        0i64);
      if( PiPnpRtlCtx && (v10 = *(_QWORD *)(PiPnpRtlCtx + 224)) != 0 )
        v11 = *(_QWORD *)(v10 + 8);
      else
        v11 = 0i64;
      RegRtlDeleteTreeInternal(v6, L"Devices", v11, 0);
      if( PiPnpRtlCtx && (v12 = *(_QWORD *)(PiPnpRtlCtx + 224)) != 0 )
        v13 = *(_QWORD *)(v12 + 8);
      else
        v13 = 0i64;
      RegRtlDeleteTreeInternal(v6, L"Filters", v13, 0);
      if( v9 )
      {
        v15 = (const wchar_t *)*((_QWORD *)DeviceNode + 6);
        HIDWORD(v18) = 4;
        if( (int)CmGetDeviceRegProp(
                    PiPnpRtlCtx,
                    v15,
                    (__int64)v6,
                    11,
                    (__int64)&v20,
                    (__int64)&v18,
                    (__int64)&v18 + 4,
                    0) >= 0
          && v20 == 4
          && HIDWORD(v18) == 4 )
        {
          v2 = v18;
        }
        LODWORD(v18) = v9 | v2;
        PiDevCfgSetDeviceRegProp(v16, (__int64)result, 11, 4, (__int64)&v18, 4);
      }
    }
  }
LABEL_17:
  RtlFreeAnsiString(&UnicodeString);
  PiDevCfgFreeDeviceContext((INT64)result);
  return inited;
}

Referenced by:

No references.