CmValidateDeviceName

NTSTATUS __stdcall CmValidateDeviceName(WCHAR *DeviceInstanceId){
  const wchar_t *v1; 
  int v2; 
  int v3; 
  int v4; 
  __int16 *v5; 
  __int16 v6; 
  _SIZE_T pcchLength; 

  v2 = 0;
  v3 = 1;
  if( !v1 )
    return -1073741811;
  v4 = RtlUnalignedStringCchLengthW(v1, 200, &pcchLength);
  if( v4 >= 0 )
  {
    v6 = *v5;
    if( *v5 )
    {
      while( (unsigned __int16)(v6 - 33) <= 0x5Eu && v6 != 44 )
      {
        if( v6 == 92 )
        {
          if( !v2 )
            return -1073741773;
          v2 = 0;
          ++v3;
        }
        else
        {
          ++v2;
        }
        v6 = v5[1];
        ++v5;
        if( !v6 )
        {
          if( v2 && v3 == 3 )
            return v4;
          return -1073741773;
        }
      }
    }
  }
  return -1073741773;
}

Referenced by:

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