RtlUnicodeStringInit

NTSTATUS __stdcall RtlUnicodeStringInit(PUNICODE_STRING DestinationString, _NTSTRSAFE_PCWSTR pszSrc){
  NTSTATUS result; 
  __int64 v4; 
  _WORD *v5; 
  unsigned __int16 v6; 

  result = 0;
  *DestinationString = 0i64;
  if( *(_QWORD *)&pszSrc )
  {
    v4 = 0x7FFFi64;
    v5 = *(_WORD **)&pszSrc;
    do
    {
      if( !*v5 )
        break;
      ++v5;
      --v4;
    }
    while( v4 );
    result = v4 == 0 ? 0xC000000D : 0;
    if( v4 )
    {
      if( DestinationString )
      {
        v6 = 2 * (v4 != 0 ? 0x7FFF - v4 : 0);
        DestinationString->Buffer = *(wchar_t **)&pszSrc;
        DestinationString->Length = v6;
        DestinationString->MaximumLength = v6 + 2;
      }
      else
      {
        return -1073741811;
      }
    }
  }
  return result;
}

Referenced by:

CmpLoadHiveThread