SleepstudyHelperCreateLibrary

INT64 __stdcall SleepstudyHelperCreateLibrary(UINT32 Tag){
  __int64 *v1; 
  unsigned int v2; 
  __int64 *v3; 
  INT64 NonPaged; 
  __int64 v6; 
  __int64 *v7; 
  v2 = 0;
  v3 = v1;
  if( v1 )
  {
    if( SshpInitialized )
    {
      NonPaged = SSHSupportAllocateNonPaged(0x48ui64, Tag);
      v6 = NonPaged;
      if( NonPaged )
      {
        memset(NonPaged, 0i64);
        *(_DWORD *)(v6 + 24) = Tag;
        *(_QWORD *)(v6 + 48) = v6 + 40;
        *(_QWORD *)(v6 + 40) = v6 + 40;
        *(_QWORD *)(v6 + 64) = v6 + 56;
        *(_QWORD *)(v6 + 56) = v6 + 56;
        ExAcquirePushLockExclusiveEx((UINT64)&SshpLibraryListLock, 0i64);
        v7 = (__int64 *)qword_140C1E138;
        if( *(PVOID **)qword_140C1E138 != &SshpLibraryList )
          __fastfail(3u);
        *(_QWORD *)v6 = &SshpLibraryList;
        *(_QWORD *)(v6 + 8) = v7;
        *v7 = v6;
        qword_140C1E138 = v6;
        SSHSupportReleasePushLockExclusive(&SshpLibraryListLock);
        *v3 = v6;
      }
      else
      {
        return(unsigned int)-1073741670;
      }
    }
    else
    {
      return(unsigned int)-1073741637;
    }
  }
  else
  {
    return(unsigned int)-1073741811;
  }
  return v2;
}

Referenced by:

SleepstudyHelper_Initialize