CmValidateDeviceName

__int64 __fastcall CmValidateDeviceName(__int64 a1, const wchar_t *a2){
  int v2; 
  int v3; 
  NTSTATUS v4; 
  __int16 *v5; 
  __int16 v6; 
  size_t pcchLength; 
  v2 = 0;
  v3 = 1;
  if( !a2 )
    return 3221225485i64;
  v4 = RtlUnalignedStringCchLengthW(a2, 0xC8ui64, &pcchLength);
  if( v4 >= 0 )
  {
    v6 = *v5;
    if( *v5 )
    {
      while( (unsigned __int16)(v6 - 33) <= 0x5Eu && v6 != 44 )
      {
        if( v6 == 92 )
        {
          if( !v2 )
            return 3221225523i64;
          v2 = 0;
          ++v3;
        }
        else
        {
          ++v2;
        }
        v6 = v5[1];
        ++v5;
        if( !v6 )
        {
          if( v2 && v3 == 3 )
            return(unsigned int)v4;
          return 3221225523i64;
        }
      }
    }
  }
  return 3221225523i64;
}

Referenced by:

CmEnumSubkeyCallback
CmGetDeviceInterfaceName
CmGetDeviceRegKeyPath
PiCMCreateDevice
PiCMDeleteDevice
PiCMDeviceAction
PiCMGenerateDeviceInstance
PiCMGetDeviceDepth
PiCMGetRelatedDeviceInstance
PiCMQueryRemove
PiCMRegisterDeviceInterface
PiCMSetDeviceProblem
PnpDispatchDevice