PpDevNodeLockTree

char __fastcall PpDevNodeLockTree(int a1){
  _ETHREAD *CurrentThread; 
  char v2; 
  int v3; 
  int v4; 
  int v5; 
  ULONG IsResourceAcquiredSharedLite; 
  ULONG i; 
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  v2 = 1;
  --*((_WORD *)CurrentThread + 242);
  if( !a1 )
    goto LABEL_15;
  v3 = a1 - 1;
  if( !v3 )
  {
    ExAcquireResourceExclusiveLite(&PiEngineLock, 1u);
    goto LABEL_15;
  }
  v4 = v3 - 1;
  if( !v4 )
  {
    if( !ExAcquireResourceExclusiveLite(&PiEngineLock, 0) )
    {
      v2 = 0;
      KeLeaveCriticalRegion();
      return v2;
    }
LABEL_15:
    ExAcquireResourceSharedLite(&IopDeviceTreeLock, 1);
    return v2;
  }
  v5 = v4 - 1;
  if( v5 )
  {
    if( v5 == 1 )
    {
      IsResourceAcquiredSharedLite = ExIsResourceAcquiredSharedLite(&IopDeviceTreeLock);
      for( i = IsResourceAcquiredSharedLite; i; --i )
        ExReleaseResourceLite(&IopDeviceTreeLock);
      for( ; IsResourceAcquiredSharedLite; --IsResourceAcquiredSharedLite )
        ExAcquireResourceExclusiveLite(&IopDeviceTreeLock, 1u);
    }
  }
  else
  {
    ExAcquireResourceExclusiveLite(&PiEngineLock, 1u);
    ExAcquireResourceExclusiveLite(&IopDeviceTreeLock, 1u);
  }
  return v2;
}

Referenced by:

IoGetLegacyVetoList
IoLockUnlockPnpDeviceTree
IoReportDetectedDevice
IoReportRootDevice
IoTranslateBusAddress
IopQueryInterfaceRecurseUp
IopRetryDeviceRemovalForReset
IopWarmEjectDevice
PiCMCreateDevice
PiCMDeleteDevice
PiControlGetPropertyData
PiControlGetSetDeviceStatus
PiControlQueryConflictList
PiGetDeviceDepth
PiGetRelatedDevice
PiInitializeDevice
PiPagePathSetState
PiProfileUpdateDeviceTreeWorker
PiQueryDeviceRelations
PiQueryPowerRelations
PipForDeviceNodeSubtree
PipProcessDevNodeTree
PnpAcquireDependencyRelationsLock
PnpDelayedRemoveWorker
PnpDeviceActionWorker
PnpDiagRundownRegisterCallback
PnpLockDeviceActionQueue
PnpProcessCompletedEject
PnpProcessQueryRemoveAndEject
PnpQueuePendingEject
PnpRestartDeviceNode
PnpUnlinkDeviceRemovalRelations
PpDevCfgProcessDevices
PpHotSwapGetDevnodeRemovalPolicy
PpResetProblemDevices