mov ebx, large fs:124h ; 得到 _KTHREAD 结构体指针
.text:00447001 push edi
.text:00447002 mov ecx, offset _MmExpansionLock
.text:00447007 call ds:__imp_@KfAcquireSpinLock@4 ; KfAcquireSpinLock(x)
.text:00447010 lea edi, [esi+_EPROCESS.Flags]
.text:00447016 test byte ptr [edi+2], 80h ; ProcessToInitialize->PdeUpdateNeeded
.text:00447016 ; 比较是否需要更新PDE
.text:0044703F push esi ; Process
.text:00447040 call _KeAttachProcess@4 ; KeAttachProcess(x)
.text:0044704D mov eax, 800h ; PS_PROCESS_FLAGS_ADDRESS_SPACE2
.text:00447052 lock or [edi], eax
.text:00447055 lea eax, [esi+_EPROCESS.AddressCreationLock]
.text:0044705B and [eax+_KGUARDED_MUTEX.Owner], 0
.text:0044705F and [eax+_KGUARDED_MUTEX.Contention], 0
.text:00447063 xor edi, edi
.text:00447065 inc edi
.text:00447066 lea ecx, [eax+_KGUARDED_MUTEX.Gate] ; Gate
.text:00447069 mov [eax], edi
.text:0044706B call @KeInitializeGate@4 ; KeInitializeGate(x)
.text:00447077 lea eax, [esi+_EPROCESS.VadRoot]
.text:0044707D mov [eax], eax ;设置根节点
.text:0044707F lea eax, [esi+_EPROCESS.Vm.LastTrimTime]
.text:00447085 push eax ; CurrentTime
.text:00447086 call _KeQuerySystemTime@4 ; KeQuerySystemTime(x)
.text:0044708B mov eax, _MmWorkingSetList
.text:004470A3 mov eax, 0C0300C00h ; 0C0300C00h
.text:004470A3 ; = 0x300C00 + 0xc0000000
.text:004470A3 ; = ((PMMPTE)((0xc0300 << 2) + PTE_BASE))
.text:004470A3 ; = ((PMMPTE)(((0xc0300000 >> 12) << 2) + PTE_BASE))
.text:004470A3 ; = ((PMMPTE)(((((ULONG)(va)) >> 12) << 2) + PTE_BASE))
.text:004470A3 ; = MiGetPteAddress (PDE_BASE);
.text:004470A8 push eax ; PointerPte
.text:004470A9 mov eax, dword ptr [eax+_MMPTE.u]
.text:004470AB shr eax, 0Ch ; 右移12位,eax = _MMPTE.u.Hard.PageFrameNumber
.text:004470AE push eax ; PageFrameIndex
.text:004470AF call _MiInitializePfn@12 ; MiInitializePfn(x,x,x)
.text:004470B4 push edi ; ModifiedState
.text:004470B5 mov eax, 0C0300C04h ; PointerPte
.text:004470B5 ; = MiGetPdeAddress (HYPER_SPACE);
.text:004470B5 ; = ((PMMPTE)(((0xc0400000 >> 22) << 2) + PDE_BASE))
.text:004470B5 ; = ((PMMPTE)((0x301 << 2) + PDE_BASE))
.text:004470B5 ; = 0xC04 + 0xc0300000
.text:004470B5 ; = 0xc0300C04
.text:004470B5 ;
.text:004470BA push eax ; PointerPte
.text:004470BB mov eax, dword ptr [eax+_MMPTE.u]
.text:004470BD shr eax, 0Ch ; 右移12位,eax = _MMPTE.u.Hard.PageFrameNumber
.text:004470C0 push eax ; PageFrameIndex
.text:004470C1 call _MiInitializePfn@12 ; MiInitializePfn(x,x,x)
.text:004470C6 mov ecx, 0C0301404h ; PointerPte
.text:004470C6 ; = MiGetPteAddress (0xC0501000)
.text:004470C6 ; = ((PMMPTE)(((0xC0501000 >> 12) << 2) + PTE_BASE))
.text:004470C6 ; = ((PMMPTE)((0xC0501 << 2) + PTE_BASE))
.text:004470C6 ; = 0x301404 + 0xc0000000
.text:004470C6 ; = 0xC0301404
.text:004470CB mov [ebp+PointerPte], ecx
.text:004470CE call @MiDetermineUserGlobalPteMask@4 ; fastcall
.text:004470D3 mov edi, eax
.text:004470D5 or edi, MmProtectToPteMask_4_ ;
.text:004470DB mov [ebp+NumberOfPages], 2
.text:004470E2 or edi, 42h ; 42h = HARDWARE_PTE_DIRTY_MASK
.text:004470E2 ; TempPte.u.Long |= HARDWARE_PTE_DIRTY_MASK
.text:004470E5 LoopInitializePfn:
.text:004470E5 ; CODE XREF: MmInitializeProcessAddressSpace(x,x,x,x,x)+127 j
.text:004470E5 mov ecx, [ebp+PointerPte]
.text:004470E8 mov eax, [ecx]
.text:004470EA push 1 ; ModifiedState
.text:004470EC shr eax, 0Ch ; eax = PointerPte->u.Hard.PageFrameNumber
.text:004470EF push ecx ; PointerPte
.text:004470F0 push eax ; PageFrameIndex
.text:004470F1 mov [ebp+VadBitMapPage], eax
.text:004470F4 mov dword ptr [ecx], 80h ; 80h = MM_KERNEL_DEMAND_ZERO_PTE
.text:004470F4 ;
.text:004470F4 ; MI_WRITE_INVALID_PTE (PointerPte, DemandZeroPte);
.text:004470F4 ; == (*(PointerPte) = (DemandZeroPte))
.text:004470F4 ; == (*(PointerPte) = (MM_KERNEL_DEMAND_ZERO_PTE))
.text:004470F4 ; == == (*(PointerPte) = (0x80))
.text:004470FA call _MiInitializePfn@12 ; MiInitializePfn(x,x,x)
.text:004470FF mov eax, [ebp+VadBitMapPage]
.text:00447102 shl eax, 0Ch ; eax = PointerPte->u.Hard.PageFrameNumber
.text:00447105 and edi, 0FFFh ; 高12位以上清0
.text:0044710B or edi, eax ; MI_WRITE_VALID_PTE (PointerPte, TempPte);
.text:0044710D mov eax, [ebp+PointerPte]
.text:00447110 add [ebp+PointerPte], 4 ; PointerPte += 1 (PointerPte为指针)
.text:00447114 dec [ebp+NumberOfPages] ; NumberOfPages--
.text:00447117 mov [eax], edi
.text:00447119 jnz short LoopInitializePfn
.text:0044711B mov dl, [ebp+OldIrql] ; UNLOCK_PFN (OldIrql);
.text:0044711E push 2 ; #define LockQueuePfnLock 2
.text:00447120 pop ecx
.text:00447121 call ds:__imp_@KeReleaseQueuedSpinLock@8 ; KeReleaseQueuedSpinLock(x,x)
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!