SmKmKeyGenStart

__int64 __fastcall SmKmKeyGenStart(__int64 a1, const struct _UNICODE_STRING *a2){
  unsigned int v2; 
  __int64 Length; 
  unsigned __int16 *v6; 
  unsigned __int16 *v7; 
  __int64 v8; 
  unsigned __int16 *v9; 
  __int16 v10; 

  v2 = 0;
  if( a2 )
  {
    Length = a2->Length;
    LODWORD(v6) = SSHSupportAllocateNonPaged(Length + 2, 0x474B6D73u);
    v7 = v6;
    if( v6 )
    {
      RtlStringCbCopyUnicodeString(v6, Length + 2, a2);
      v8 = 0x7FFFi64;
      *(_OWORD *)(a1 + 24) = 0i64;
      v9 = v7;
      do
      {
        if( !*v9 )
          break;
        ++v9;
        --v8;
      }
      while( v8 );
      if( v8 && a1 != -24 )
      {
        v10 = 2 * (v8 != 0 ? 0x7FFF - v8 : 0);
        *(_QWORD *)(a1 + 32) = v7;
        *(_WORD *)(a1 + 24) = v10;
        *(_WORD *)(a1 + 26) = v10 + 2;
      }
    }
    else
    {
      return(unsigned int)-1073741670;
    }
  }
  return v2;
}

Referenced by:

SmcCacheManagerStart