RtlStringCbLengthW

NTSTATUS __stdcall RtlStringCbLengthW(WCHAR *psz, UINT64 cbMax, UINT64 *pcbLength){
  UINT64 v3; 
  UINT64 v5; 
  UINT64 i; 
  NTSTATUS v7; 

  v3 = cbMax >> 1;
  v5 = 0i64;
  if( psz && v3 <= 0x7FFFFFFF )
  {
    for( i = v3; i; --i )
    {
      if( !*psz )
        break;
      ++psz;
    }
    v7 = i == 0 ? 0xC000000D : 0;
    if( i )
      v5 = v3 - i;
    else
      v5 = 0i64;
  }
  else
  {
    v7 = -1073741811;
  }
  if( pcbLength )
  {
    if( v7 < 0 )
      *pcbLength = 0i64;
    else
      *pcbLength = 2 * v5;
  }
  return v7;
}

Referenced by:

AslpFileVerBlockGetValueOffset
AslpFileVerStringBlockGetValue
AuthzBasepConvertRelativeToAbsoluteTokenAttribute
IoReportDetectedDevice
LocalGetStringForRelativeAttribute
NtPowerInformation
PiSwCompleteCreate
PiSwIrpStartCreateWorker
PnpRegQueryValueIndirect
PnpValidatePropertyData
PopFxValidateReturnedUnicodeString
PopIdleWakeGenerateDescriptionString
PopPowerInformationInternal
PpmRegisterProfiles
RtlpConvertAbsoluteToRelativeSecurityAttribute
RtlpGetTokenNamedObjectPath
RtlpPopulateLanguageConfigList
RtlpValidRelativeAttribute