PnpInitializeSessionId

void __fastcall PnpInitializeSessionId(__int64 a1, INT64 a2, char a3){
  int SessionIdFromPDO; 
  __int64 v5; 
  _DEVICE_OBJECT *v8; 
  int v9; 
  int *v10; 
  int v11; 
  int v12; 

  SessionIdFromPDO = -1;
  v5 = *(_QWORD *)(a1 + 16);
  v12 = -1;
  if( v5 )
  {
    v8 = *(_DEVICE_OBJECT **)(v5 + 32);
    if( (v8->DeviceObjectExtension->ExtensionFlags & 0x400) != 0 )
    {
      SessionIdFromPDO = IopGetSessionIdFromPDO(v8);
      v12 = SessionIdFromPDO;
    }
  }
  if( !a3 || SessionIdFromPDO != -1 )
  {
    if( SessionIdFromPDO == -1 )
    {
      v9 = 0;
      v10 = 0i64;
      v11 = 0;
    }
    else
    {
      v9 = 4;
      v10 = &v12;
      v11 = 7;
    }
    PnpSetObjectProperty(
      *(&stru_140CF2E80 + 607),
      *(_QWORD *)(a1 + 48),
      1u,
      a2,
      0i64,
      (__int64)&DEVPKEY_Device_SessionId,
      v11,
      (__int64)v10,
      v9,
      a3 != 0 ? 0x20000 : 0);
  }
}

Referenced by:

PiProcessNewDeviceNode