ViCheckTag

VOID __stdcall ViCheckTag(VOID *AdvertisedBuffer, UINT64 AdvertisedLength, UINT64 RemoveTag, UINT16 WhereToCheck){
  UINT64 Param3; 
  char v5; 
  size_t v6; 
  int v7; 
  char *v9; 
  char *v10; 
  UINT64 v11; 

  Param3 = (unsigned int)AdvertisedLength;
  v5 = WhereToCheck;
  v6 = AdvertisedLength;
  v7 = RemoveTag;
  v9 = (char *)AdvertisedBuffer;
  v10 = (char *)AdvertisedBuffer + (unsigned int)AdvertisedLength;
  if( (WhereToCheck & 1) != 0 )
  {
    v9 = (char *)AdvertisedBuffer - 8;
    if( RtlCompareMemory((char *)AdvertisedBuffer - 8, &ViDmaVerifierTag, 8) != (_SIZE_T *)8 )
    {
      ViHalPreprocessOptions(
        &qword_140C12CEC,
        (PSTR)"Area before %x byte allocation at %p has been modified.",
        0x1000000Fui64,
        1ui64,
        Param3,
        (UINT64)AdvertisedBuffer,
        v11);
      VfReportIssueWithOptions(0xE6ui64, 0xFu, 1u, Param3, (ULONG_PTR)AdvertisedBuffer, &qword_140C12CEC);
    }
    v6 += 8;
  }
  if( (v5 & 2) != 0 )
  {
    if( RtlCompareMemory(v10, &ViDmaVerifierTag, 8) != (_SIZE_T *)8 )
    {
      ViHalPreprocessOptions(
        &unk_140C12CDC,
        (PSTR)"Area after %x byte allocation at %p has been modified.",
        0x1000000Fui64,
        2ui64,
        Param3,
        (UINT64)AdvertisedBuffer,
        v11);
      VfReportIssueWithOptions(0xE6ui64, 0xFu, 2u, Param3, (ULONG_PTR)AdvertisedBuffer, &unk_140C12CDC);
    }
    v6 += 8;
  }
  if( v7 )
    memset(v9, 15i64, v6);
}

Referenced by:

ViCheckAdapterBuffers
ViCheckPadding
ViFreeMapRegistersToFile