RtlAddAtomToAtomTableEx
NTSTATUS __stdcall RtlAddAtomToAtomTableEx(PVOID AtomTableHandle, PWCHAR AtomName, UINT16 *Atom, UINT64 Flags){
CHAR v4;
NTSTATUS v8;
__int64 v9;
_RTL_ATOM_TABLE_ENTRY **v10;
INT64 *AtomTableEntry;
INT64 v12;
unsigned __int64 v13;
__int64 v14;
UINT16 v15;
__int16 Atoma[2];
NTSTATUS v18;
size_t Size;
PVOID p;
INT64 pAtomEntry;
_RTL_ATOM_TABLE_ENTRY **PreviousAtom;
v4 = Flags;
pAtomEntry = 0i64;
PreviousAtom = 0i64;
LODWORD(Size) = 0;
Atoma[0] = 0;
p = 0i64;
if( RtlpLockAtomTable((_RTL_ATOM_TABLE *)AtomTableHandle) )
{
if( RtlGetIntegerAtom(AtomName, (UINT16 *)Atoma) )
{
v15 = Atoma[0];
if( Atoma[0] >= 0xC000u )
{
v15 = 0;
Atoma[0] = 0;
v8 = -1073741811;
v18 = -1073741811;
}
else
{
v8 = 0;
v18 = 0;
}
if( Atom )
*Atom = v15;
goto LABEL_27;
}
if( *AtomName )
{
v8 = RtlpHashStringToAtom(
(_RTL_ATOM_TABLE *)AtomTableHandle,
AtomName,
0,
&PreviousAtom,
&Size,
(_RTL_ATOM_TABLE_REFERENCE **)&p,
(_RTL_ATOM_TABLE_ENTRY **)&pAtomEntry);
v18 = v8;
if( v8 < 0 )
{
LABEL_27:
RtlpUnlockAtomTable((_RTL_ATOM_TABLE *)AtomTableHandle);
return v8;
}
if( pAtomEntry )
{
RtlpReferenceAtom(pAtomEntry, (INT64)p);
if( Atom )
*Atom = *(_WORD *)(v9 + 10);
v8 = 0;
v18 = 0;
goto LABEL_27;
}
v10 = PreviousAtom;
if( PreviousAtom )
{
v8 = -1073741801;
v18 = -1073741801;
AtomTableEntry = RtlpAllocateAtomTableEntry((unsigned int)Size, (INT64 **)&p, v4);
v12 = (INT64)AtomTableEntry;
pAtomEntry = (INT64)AtomTableEntry;
if( AtomTableEntry )
{
v13 = (unsigned int)Size;
memmove((UINT8 *)AtomTableEntry + 42, (UINT8 *)AtomName, (unsigned int)Size);
v14 = (unsigned __int8)(v13 >> 1);
*(_BYTE *)(v12 + 40) = v14;
*(_WORD *)(v12 + 2 * v14 + 42) = 0;
if( RtlpInsertStringAtom((INT64)AtomTableHandle, v12) )
{
*(_WORD *)(v12 + 10) = *(_WORD *)(v12 + 8) | 0xC000;
*v10 = (_RTL_ATOM_TABLE_ENTRY *)v12;
if( Atom )
*Atom = *(_WORD *)(v12 + 10);
v8 = 0;
v18 = 0;
}
else
{
if( p && p != (PVOID)(v12 + 16) )
RtlpFreeAtom(p);
RtlpFreeAtom((PVOID)v12);
}
}
goto LABEL_27;
}
v8 = -1073741811;
}
else
{
v8 = -1073741773;
}
v18 = v8;
goto LABEL_27;
}
return -1073741811;
}Referenced by:
NtAddAtomEx
RtlAddAtomToAtomTable