VrpCreateNamespaceNode
__int64 __fastcall VrpCreateNamespaceNode(
UINT64 *a1,
_UNICODE_STRING *InputString,
PVOID Object,
const VOID **a4,
int a5,
int a6,
__int64 a7){
int v7;
int v12;
WCHAR v13;
_UNICODE_STRING *v14;
VOID **PoolWithTag;
VOID **v16;
int v17;
VOID **v18;
VOID **v19;
unsigned __int16 Length;
VOID **v21;
VOID **v22;
__int16 v23;
_QWORD *v24;
NTSTATUS v25;
_UNICODE_STRING *BestMatchNamespaceNode;
_UNICODE_STRING *v28;
int Buffer;
UINT64 v30;
UINT64 v31;
__int16 v32;
void *v33;
void *v34;
void *v35;
UINT64 v36;
_UNICODE_STRING PathToken;
_UNICODE_STRING Part2;
UINT64 Position;
v7 = a6;
Part2 = 0i64;
Position = 0i64;
PathToken = 0i64;
v36 = 0i64;
if( *((_DWORD *)a1 + 21) )
return(unsigned int)-1073741738;
v12 = a5;
if( (a5 & 0xE0000007) != a5 )
return(unsigned int)-1073741811;
VrpStripTrailingCharacters(InputString, (WCHAR)InputString);
VrpStripTrailingCharacters(v14, v13);
VrpGetNextToken(InputString, &Position, &PathToken);
if( !(unsigned __int8)RtlEqualUnicodeString(&PathToken, &VrpRegistryString, 1u) )
return(unsigned int)-1073741811;
VrpGetNextToken(InputString, &Position, &PathToken);
PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x48ui64, 1734693462i64);
v16 = PoolWithTag;
if( !PoolWithTag )
return(unsigned int)-1073741670;
memset(PoolWithTag, 0i64, 0x48u);
*((_DWORD *)v16 + 14) = v12;
v17 = -1;
if( v7 )
v17 = v7;
*((_DWORD *)v16 + 15) = v17;
v18 = ExAllocatePoolWithTag(1ui64, InputString->MaximumLength, 1734693462i64);
v16[1] = v18;
v19 = v18;
if( v18
&& (Length = InputString->Length,
*((_WORD *)v16 + 1) = InputString->Length,
*(_WORD *)v16 = Length,
memmove(v19, InputString->Buffer, InputString->Length),
v21 = ExAllocatePoolWithTag(1ui64, *((unsigned __int16 *)a4 + 1), 1734693462i64),
v16[4] = v21,
(v22 = v21) != 0i64) )
{
v23 = *(_WORD *)a4;
*((_WORD *)v16 + 12) = *(_WORD *)a4;
*((_WORD *)v16 + 13) = v23;
memmove(v22, a4[1], *(unsigned __int16 *)a4);
*((_WORD *)v16 + 32) = VrpCountPathComponents((_UNICODE_STRING *)v16);
*((_WORD *)v16 + 33) = VrpCountPathComponents((_UNICODE_STRING *)(v16 + 3));
VrpGetNextToken(InputString, &Position, &PathToken);
if( !PathToken.Length )
{
LABEL_10:
if( Object )
ObfReferenceObjectWithTag(Object, 0x67655256ui64);
else
Object = 0i64;
v24 = (_QWORD *)a7;
v25 = 0;
v16[2] = Object;
*v24 = v16;
return(unsigned int)v25;
}
BestMatchNamespaceNode = VrpFindBestMatchNamespaceNode(a1, (_UNICODE_STRING *)v16, &v36);
v28 = BestMatchNamespaceNode;
if( !BestMatchNamespaceNode || (Buffer = (int)BestMatchNamespaceNode[3].Buffer, (Buffer & 4) != 0) )
{
v25 = -1073741811;
}
else
{
v30 = v36;
*((_DWORD *)v16 + 14) |= Buffer & 2;
v31 = 0i64;
Position = 0i64;
if( v30 )
{
do
{
VrpGetNextToken((_UNICODE_STRING *)v16, &Position, &PathToken);
--v30;
}
while( v30 );
v31 = Position;
}
v32 = *(_WORD *)v16;
Part2.Buffer = (wchar_t *)((char *)v16[1] + 2 * v31);
Part2.Length = v32 - 2 * v31;
Part2.MaximumLength = Part2.Length;
v25 = VrpBuildKeyPath((_UNICODE_STRING *)((char *)v28 + 24), &Part2, (_UNICODE_STRING *)(v16 + 5));
if( v25 >= 0 )
goto LABEL_10;
}
}
else
{
v25 = -1073741670;
}
v33 = v16[1];
if( v33 )
ExFreePoolWithTag(v33, 0x67655256u);
v34 = v16[4];
if( v34 )
ExFreePoolWithTag(v34, 0x67655256u);
v35 = v16[6];
if( v35 )
ExFreePoolWithTag(v35, 0x67655256u);
ExFreePoolWithTag(v16, 0x67655256u);
return(unsigned int)v25;
}Referenced by:
VrpHandleIoctlCreateMultipleNamespaceNodes
VrpHandleIoctlCreateNamespaceNode
VrpHandleIoctlInitializeJobForVreg
VrpPreLoadKey