mov eax, [esi+OBJECT_TYPE.TypeInfo.InvalidAttributes]
test [edi+_OBJECT_CREATE_INFORMATION.Attributes], eax
mov ecx, [ebp+PagedPoolCharge] ;属性没有冲突,就填写Charge
test ecx, ecx ; 判断是否为0
jnz short FillNonPagedPoolCharge
mov ecx, [esi+OBJECT_TYPE.TypeInfo.DefaultPagedPoolCharge] ;
FillNonPagedPoolCharge:
mov eax, [ebp+NonPagedPoolCharge]
test eax, eax
jnz short AllocObjectCreateInformation
mov eax, [esi+OBJECT_TYPE.TypeInfo.DefaultNonPagedPoolCharge]
AllocObjectCreateInformation:
mov [edi+_OBJECT_CREATE_INFORMATION.NonPagedPoolCharge], eax
call ObpAllocateObject
mov ebx, eax
test ebx, ebx
jl ReleaseObjectCreateInformation
mov edi, dword ptr [ebp+ObjectHeader]
mov esi, [ebp+ arg_Object]
lea eax, [edi+_OBJECT_CREATE_INFORMATION.SecurityDescriptorCharge]
mov [esi], eax ;将申请的空间地址给传出参数
test byte ptr [edi+(_OBJECT_CREATE_INFORMATION+0Fh)], 10h ; ProbeMode是一个char的宽度
jz short CheckPrivilege
push dword ptr [ebp+ProbeMode] ;
push ds:SeCreatePermanentPrivilege.HighPart
push ds:SeCreatePermanentPrivilege.LowPart ; PrivilegeValue
call SeSinglePrivilegeCheck ; 如果固定的对像已经创建,则检查是否为系统的安全机制所允许
test al, al
jnz short CheckPrivilege
mov ecx, [esi]
call ObpFreeObject
mov ebx, 0C0000061h ; 060000061h == STATUS_PRIVILEGE_NOT_HELD
cmp ObpTraceEnabled, 0
jz short ObCreateObjectEnd
test ebx, ebx
jl short ObCreateObjectEnd
push edi ; NewIrql
call ObpRegisterObject ; 如果上面的那个条件都成功,执行下面的二个函数
push 1
push edi
call ObpPushStackInfo
jmp short ObCreateObjectEnd
cmp [ebp+arg_HandleInfoSize], 0
jz short cmpNameInfoSize
and [eax+_OBJECT_HEADER_HANDLE_INFO.anonymous_0.SingleEntry.HandleCount], 0 add eax, 8
test ebx, ebx ; ebx为NameInfoSize,上面一直没有改过
jz short cmpCreatorInfoSize
mov edx, [edi] ; edi指向ObjectName
mov dword ptr [eax+_OBJECT_HEADER_NAME_INFO.Name.Length], ed
mov edx, [edi+_UNICODE_STRING.Buffer]
and [eax+_OBJECT_HEADER_NAME_INFO.Directory], 0
cmp [ebp+arg_OwnershipMode], 0 ;这里判断是不是内核模式
mov edi, [ebp+arg_ObjectCreateInfo]
mov [eax+_OBJECT_HEADER_NAME_INFO.Name.Buffer], edx
mov [eax+_OBJECT_HEADER_NAME_INFO.QueryReferences], 1
jnz short loc_525CBD
test edi, edi
jz short loc_525CBD
test byte ptr [edi+_UNICODE_STRING.MaximumLength], 1
jz short loc_525CBD
mov [eax+_OBJECT_HEADER_NAME_INFO.QueryReferences], 40000001h
loc_525CBD:
add eax, 10h
jmp short cmp_CreatorInfoSize
mov edi, [ebp+arg_ObjectCreateInfo]
cmp_CreatorInfoSize:
cmp [ebp+CreatorInfoSize], 0
jz short loc_525CEB ; ecx等于QuotaInfoSize的值
and word ptr [eax+0Ch], 0; CreatorBackTraceIndex
mov edx, large fs:124h
mov edx, [edx+38h];PsGetCurrentProcess函数实现
mov edx, [edx+94h]; UniqueProcessId
mov [eax+_OBJECT_HEADER_CREATOR_INFO.CreatorUniqueProcess], edx
mov [eax+_OBJECT_HEADER_CREATOR_INFO.TypeList.Blink], eax
mov [eax+_OBJECT_HEADER_CREATOR_INFO.TypeList.Flink], eax
add eax, 10h