MiCreateSection
VOID __stdcall MiCreateSection(
VOID **SectionObject,
_OBJECT_ATTRIBUTES *ObjectAttributes,
UINT64 Flags,
_LARGE_INTEGER *InputMaximumSize,
UINT64 SectionPageProtection,
UINT64 AllocationAttributes,
VOID *ProcessToken,
UINT8 SeSigningLevel,
VOID *FileHandle,
_FILE_OBJECT *FileObject,
CHAR PreviousMode,
UINT64 SessionId,
INT64 a13,
INT64 a14,
INT64 a15,
INT64 a16,
INT64 a17,
INT64 a18,
INT64 a19,
INT64 a20,
INT64 a21,
INT64 a22,
INT64 a23,
INT64 result){
unsigned int v27;
int v28;
UINT64 *v29;
UINT64 v30;
UINT64 v31;
NTSTATUS v32;
VOID *v33;
VOID *v34;
UINT64 v35;
NTSTATUS PagingFileMap;
_FILE_OBJECT *RelatedFileObject;
_ADAPTER_OBJECT *v38;
unsigned __int64 v39;
__int64 ScatterTranslations;
int v41;
UINT64 PreferredNode;
UINT64 *PreferredNodea;
INT64 v44;
INT64 v45;
__int64 NewSectionSize[2];
_FILE_OBJECT ProcessHandle;
v27 = (unsigned int)InputMaximumSize;
v28 = 0;
memset(&ProcessHandle, 0i64, 0xC8u);
LODWORD(v44) = SessionId;
LODWORD(PreferredNode) = SectionPageProtection;
if( MiInitializeCreateSectionPacket(
(INT64 *)&ProcessHandle.Type,
(INT64)ObjectAttributes,
Flags,
v27,
PreferredNode,
AllocationAttributes,
(INT64)ProcessToken,
SeSigningLevel,
(UINT64)FileHandle,
(INT64)FileObject,
PreviousMode,
v44,
a13) >= 0 )
{
while( 1 )
{
*(_DWORD *)&ProcessHandle.Type |= v28;
if( !ProcessHandle.SectionObjectPointer && !ProcessHandle.PrivateCacheMap )
break;
MiCreateImageOrDataSection(&ProcessHandle);
PagingFileMap = v32;
if( v32 != -1073741740 && v32 != -1073740682 )
goto LABEL_5;
if( ProcessHandle.CompletionContext )
PsDereferencePartition((INT64)ProcessHandle.CompletionContext);
v41 = *(_DWORD *)&ProcessHandle.Type >> 25;
memset(&ProcessHandle, 0i64, 0xC8u);
LODWORD(v45) = SessionId;
LODWORD(PreferredNodea) = SectionPageProtection;
v28 = (v41 & 1) << 25;
if( MiInitializeCreateSectionPacket(
(INT64 *)&ProcessHandle.Type,
(INT64)ObjectAttributes,
Flags,
v27,
(UINT64)PreferredNodea,
AllocationAttributes,
(INT64)ProcessToken,
SeSigningLevel,
(UINT64)FileHandle,
(INT64)FileObject,
PreviousMode,
v45,
a13) < 0 )
goto LABEL_12;
}
PagingFileMap = MiCreatePagingFileMap((_SEGMENT **)&ProcessHandle, v29, v30, v31, (UINT64)PreferredNodea);
LABEL_5:
if( PagingFileMap >= 0 && MiFinishCreateSection(&ProcessHandle, v33, v34, v35, PreferredNodea) >= 0 )
{
RelatedFileObject = ProcessHandle.RelatedFileObject;
v38 = *(_ADAPTER_OBJECT **)&ProcessHandle.gap80[16];
v39 = _InterlockedCompareExchange64(
(volatile signed __int64 *)(*(_QWORD *)ProcessHandle.RelatedFileObject + 24i64),
-1i64,
-1i64);
if( ((ProcessHandle.Type & 9) == 0 && (RelatedFileObject->FinalStatus & 0x8000) != 0
|| v38->AdapterObject.ScatterTranslations > (_HALP_DMA_TRANSLATION_BUFFER *)v39)
&& (ScatterTranslations = (__int64)v38->AdapterObject.ScatterTranslations,
v38->AdapterObject.ScatterTranslations = (_HALP_DMA_TRANSLATION_BUFFER *)v39,
NewSectionSize[0] = ScatterTranslations,
MmExtendSection(v38, (UINT64 *)NewSectionSize, ProcessHandle.Type & 1) < 0) )
{
HalPutDmaAdapter(v38);
}
else
{
*SectionObject = v38;
}
}
}
LABEL_12:
if( ProcessHandle.CompletionContext )
PsDereferencePartition((INT64)ProcessHandle.CompletionContext);
}Referenced by:
MiCreateSectionCommon