RtlpSysVolTakeOwnership
VOID __stdcall RtlpSysVolTakeOwnership(UNICODE_STRING *DirectoryName){
NTSTATUS v2;
void *v3;
UINT64 ShareAccess;
UINT64 OpenOptions;
void *TokenHandle;
void *FileHandle[2];
struct _OBJECT_ATTRIBUTES ObjectAttributes;
__int128 SecurityDescriptor[2];
__int64 v10;
struct _IO_STATUS_BLOCK IoStatusBlock;
struct _TOKEN_PRIVILEGES NewState;
__int16 Owner;
int v14;
__int16 v15;
int v16;
int v17;
TokenHandle = 0i64;
FileHandle[0] = 0i64;
*(&ObjectAttributes.Length + 1) = 0;
*(&ObjectAttributes.Attributes + 1) = 0;
v10 = 0i64;
IoStatusBlock = 0i64;
memset(SecurityDescriptor, 0, sizeof(SecurityDescriptor));
if( (int)NtOpenProcessTokenEx((VOID *)0xFFFFFFFFFFFFFFFFi64, 0x28ui64, 0x200ui64, &TokenHandle) >= 0 )
{
FileHandle[1] = (void *)9;
NewState.Privileges[0].Luid = (_LUID)9i64;
NewState.PrivilegeCount = 1;
NewState.Privileges[0].Attributes = 2;
if( NtAdjustPrivilegesToken(TokenHandle, 0, &NewState, 0x10ui64, 0i64, 0i64) >= 0 )
{
ObjectAttributes.RootDirectory = 0i64;
LODWORD(OpenOptions) = 33;
ObjectAttributes.Length = 48;
ObjectAttributes.Attributes = 576;
ObjectAttributes.ObjectName = DirectoryName;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
LODWORD(ShareAccess) = 7;
if( NtOpenFile(FileHandle, 0x180000ui64, &ObjectAttributes, &IoStatusBlock, ShareAccess, OpenOptions) >= 0 )
{
RtlCreateSecurityDescriptor(SecurityDescriptor, 1ui64);
v14 = 0;
v15 = 1280;
Owner = 513;
v16 = 32;
v17 = 544;
v2 = RtlSetOwnerSecurityDescriptor(SecurityDescriptor, &Owner, 0);
v3 = FileHandle[0];
if( v2 >= 0 )
{
NtSetSecurityObject(FileHandle[0], 1ui64, SecurityDescriptor);
v3 = FileHandle[0];
}
NtClose(v3);
}
}
NtClose(TokenHandle);
}
}Referenced by:
RtlCreateSystemVolumeInformationFolder