ViThunkAdjustExportAddressIfHooked

__int64 __fastcall ViThunkAdjustExportAddressIfHooked(
        unsigned __int8 **a1,
        const UNICODE_STRING *a2,
        char **a3,
        __int64 a4){
  char *Buffer; 
  unsigned int v6; 
  int v7; 
  unsigned __int8 *v11; 
  char *v12; 
  int v13; 
  int v14; 
  struct _STRING DestinationString; 
  *(_QWORD *)&DestinationString.Length = 0i64;
  Buffer = 0i64;
  v6 = 0;
  v7 = 0;
  DestinationString.Buffer = 0i64;
  if( *a3 )
  {
    while( 1 )
    {
      v11 = (unsigned __int8 *)a3[2];
      if( v11 == *a1 )
        break;
      if( !v11 )
      {
        if( !v7 )
        {
          while( RtlUnicodeStringToAnsiString(&DestinationString, (UNICODE_STRING *)a2, 1u) < 0 )
            KeDelayExecutionThread(0, 0, (PLARGE_INTEGER)&ViShortTime);
          Buffer = DestinationString.Buffer;
          v7 = 1;
        }
        v12 = *a3;
        do
        {
          v13 = (unsigned __int8)v12[Buffer - *a3];
          v14 = (unsigned __int8)*v12 - v13;
          if( v14 )
            break;
          ++v12;
        }
        while( v13 );
        if( !v14 )
          break;
      }
      a3 = (char **)((char *)a3 + a4);
      if( !*a3 )
        goto LABEL_16;
    }
    v6 = 1;
    *a1 = (unsigned __int8 *)a3[1];
LABEL_16:
    if( v7 )
      RtlFreeAnsiString((_UNICODE_STRING *)&DestinationString);
  }
  return v6;
}

Referenced by:

VfThunkAdjustExportAddressIfHooked