CmValidateDeviceInterfaceName

NTSTATUS __stdcall CmValidateDeviceInterfaceName(WCHAR *DeviceInterfaceName){
  WCHAR *v1; 
  WCHAR *v2; 
  int v3; 
  _WORD *v4; 
  int inited; 
  _WORD *i; 
  unsigned __int64 v7; 
  UINT64 dwFlags; 
  _UNICODE_STRING DestinationString; 
  _GUID Guid; 
  WCHAR pszDest[40]; 

  v2 = v1;
  DestinationString = 0i64;
  v3 = 0;
  v4 = 0i64;
  Guid = 0i64;
  inited = RtlInitUnicodeStringEx(&DestinationString, v1);
  if( inited < 0
    || (DestinationString.MaximumLength & 0xFFFEu) < 0x62
    || !(unsigned __int8)RtlPrefixUnicodeString(&stru_1400024C0, &DestinationString, 0)
    && !(unsigned __int8)RtlPrefixUnicodeString(&VrpRegistryString + 1, &DestinationString, 0) )
  {
    return -1073741773;
  }
  for( i = v2 + 4; *i; ++i )
  {
    if( *i == 92 )
    {
      if( (unsigned int)++v3 > 1 )
      {
        inited = -1073741773;
        break;
      }
      v4 = i;
    }
  }
  if( inited >= 0 )
  {
    if( v4 )
      v7 = v4 - v2;
    else
      v7 = (unsigned __int64)DestinationString.Length >> 1;
    if( v7 > 0xFFFFFFFF || (unsigned int)v7 < 0x30 )
    {
      return -1073741773;
    }
    else
    {
      LODWORD(dwFlags) = 2048;
      inited = RtlStringCchCopyNExW(pszDest, 0x27ui64, &v2[(unsigned int)v7 - 38], 0x26ui64, 0i64, 0i64, dwFlags);
      if( inited >= 0 )
      {
        inited = RtlInitUnicodeStringEx(&DestinationString, pszDest);
        if( inited >= 0 )
        {
          inited = RtlGUIDFromString(&DestinationString, &Guid);
          if( inited < 0 )
            return -1073741773;
        }
      }
    }
  }
  return inited;
}

Referenced by:

CmDeviceClassesSubkeyCallback
CmGetDeviceInterfacePathFormat
CmGetDeviceInterfaceReferenceString
CmGetDeviceInterfaceSubkeyPath
CmGetDeviceInterfaceSymbolicLinkName
CmSetDeviceInterfacePathFormat
IoGetDeviceInterfaceAlias
PnpDispatchDeviceInterface