-
-
Save alexplaskett/32ac0a579e18ef083d9e0af3d3b5012e to your computer and use it in GitHub Desktop.
ExpWnfGenerateStateName
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__int64 __fastcall ExpWnfGenerateStateName(unsigned __int64 *StateName, int NameLifetime, int DataScope, char PersistData) | |
{ | |
char v5; // si | |
__int64 v8; // rbx | |
__int64 v9; // rax | |
signed __int64 v10; // rdx | |
bool v11; // zf | |
unsigned __int64 Sequence; // rdx | |
__int64 result; // rax | |
unsigned __int64 v14[3]; // [rsp+20h] [rbp-18h] BYREF | |
v14[0] = 0i64; | |
v5 = DataScope; | |
if ( (unsigned int)(DataScope - 4) > 1 ) | |
{ | |
v8 = PsGetCurrentServerSilo(); | |
v9 = PsGetCurrentServerSiloGlobals(); | |
} | |
else | |
{ | |
v8 = HalSystemVectorDispatchEntry(); | |
v9 = PsGetServerSiloGlobals(v8); | |
} | |
if ( (unsigned int)(NameLifetime - 2) > 1 ) | |
{ | |
result = ExpWnfAllocateNextPersistentNameSequence(v8, v14); | |
if ( (int)result < 0 ) | |
return result; | |
Sequence = v14[0]; | |
} | |
else | |
{ | |
do | |
{ | |
v10 = _InterlockedExchangeAdd64((volatile signed __int64 *)(v9 + 960), 1ui64); | |
v11 = v10 == -1; | |
Sequence = v10 + 1; | |
v14[0] = Sequence; | |
} | |
while ( v11 ); | |
} | |
if ( (Sequence & 0xFFE0000000000000ui64) != 0 ) | |
return 0xC0000001i64; | |
*StateName = (16 * ((Sequence << 7) | NameLifetime & 3)) | ((PersistData != 0 ? 0x400 : 0) | ((v5 & 0xF) << 6)) & 0x7FE | 1; | |
return 0i64; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment