KsepRegistryCreateKey
INT64 __stdcall KsepRegistryCreateKey(WCHAR *EnginePath, WCHAR *SearchKey, PVOID *Handle){
__int64 v6;
__int64 v7;
__int64 v8;
NTSTATUS v9;
UINT64 CreateOptions;
UINT64 CreateOptionsa;
UNICODE_STRING TargetString;
UNICODE_STRING String;
struct _OBJECT_ATTRIBUTES ObjectAttributes;
void *KeyHandle;
PVOID v17;
*(&ObjectAttributes.Length + 1) = 0;
*(&ObjectAttributes.Attributes + 1) = 0;
*(_QWORD *)&TargetString.Length = 0i64;
TargetString.Buffer = 0i64;
*(_QWORD *)&String.Length = 0i64;
String.Buffer = 0i64;
KeyHandle = 0i64;
v17 = 0i64;
if( !EnginePath )
{
v6 = ((unsigned __int8)_InterlockedExchangeAdd(&KsepHistoryErrorsIndex, 1u) + 1) & 0x3F;
KsepHistoryErrors[2 * v6 + 1] = -1073740768;
KsepHistoryErrors[2 * v6] = 262647;
if( (KsepDebugFlag & 4) != 0 )
RtlAssert("EnginePath != NULL", "minkernel\\ntos\\kshim\\kseregistry.c", 0x1F7u, 0i64);
}
if( !SearchKey )
{
v7 = ((unsigned __int8)_InterlockedExchangeAdd(&KsepHistoryErrorsIndex, 1u) + 1) & 0x3F;
KsepHistoryErrors[2 * v7 + 1] = -1073740768;
KsepHistoryErrors[2 * v7] = 262648;
if( (KsepDebugFlag & 4) != 0 )
RtlAssert("SearchKey != NULL", "minkernel\\ntos\\kshim\\kseregistry.c", 0x1F8u, 0i64);
}
if( !Handle )
{
v8 = ((unsigned __int8)_InterlockedExchangeAdd(&KsepHistoryErrorsIndex, 1u) + 1) & 0x3F;
KsepHistoryErrors[2 * v8 + 1] = -1073740768;
KsepHistoryErrors[2 * v8] = 262649;
if( (KsepDebugFlag & 4) != 0 )
RtlAssert("Handle != NULL", "minkernel\\ntos\\kshim\\kseregistry.c", 0x1F9u, 0i64);
}
KsepStringDuplicate(&TargetString, EnginePath);
LODWORD(CreateOptions) = 0;
ObjectAttributes.ObjectName = &TargetString;
ObjectAttributes.Length = 48;
ObjectAttributes.RootDirectory = 0i64;
ObjectAttributes.Attributes = 576;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
v9 = ZwCreateKey(&KeyHandle, 0x2001Fui64, &ObjectAttributes, 0i64, 0i64, CreateOptions, 0i64);
if( v9 >= 0 )
{
v9 = KsepStringDuplicate(&String, SearchKey);
if( v9 >= 0 )
{
ObjectAttributes.RootDirectory = KeyHandle;
LODWORD(CreateOptionsa) = 0;
ObjectAttributes.ObjectName = &String;
ObjectAttributes.Length = 48;
ObjectAttributes.Attributes = 576;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
v9 = ZwCreateKey(&v17, 0x2001Fui64, &ObjectAttributes, 0i64, 0i64, CreateOptionsa, 0i64);
if( v9 >= 0 )
{
*Handle = v17;
_InterlockedIncrement(&dword_140C2A7F8);
}
}
}
KsepStringFree(&TargetString);
KsepStringFree(&String);
if( KeyHandle )
ZwClose(KeyHandle);
return(unsigned int)v9;
}Referenced by:
KseSetDeviceFlags