It seems I don't understand something.
I'm trying to translate VA to PA on Windows 10 (x86) under VirtualBox. I use Microsoft manual for that. I set up a local kernel debugger (bcedit) and launched CFF Explorer as a tested application. Then I started WinDbg, connected to the kernel and get active processes:
!process 0 0
Found my test application:
PROCESS a6bd7900 SessionId: 1 Cid: 0988 Peb: 7ffd9000 ParentCid: 0840
DirBase: ba9ac3c0 ObjectTable: acaeedc0 HandleCount: <Data Not Accessible>
Image: CFF Explorer.exe
Then get PEB:
.process /p a6bd7900; !peb 7ffd9000
Implicit process is now a6bd7900
PEB at 7ffd9000
...
ImageBaseAddress: 00400000
...
Ldr 76f99aa0
Ldr.Initialized: Yes
Ldr.InInitializationOrderModuleList: 00881658 . 00887c00
Ldr.InLoadOrderModuleList: 00881728 . 00887bf0
Ldr.InMemoryOrderModuleList: 00881730 . 00887bf8
Base TimeStamp Module
400000 50a8fbd6 Nov 18 18:16:38 2012 C:\Program Files\NTCore\Explorer Suite\CFF Explorer.exe
76e90000 580ee2c9 Oct 25 07:42:49 2016 C:\WINDOWS\SYSTEM32\ntdll.dll
74970000 57cf8f7a Sep 07 06:54:34 2016 C:\WINDOWS\system32\KERNEL32.DLL
...
I typed "!r" command to print all registers:
cr0 Value: 00720054
cr2 Value: 00720054
cr3 Value: 00720054
cr4 Value: 00720054
cr4 in bin: 00000000 00001010 11111100 10110110 The 5th bit is true what means that PAE is enabled.
Then I opened the Memory windows and typed 400000 address to check I have the header of CFF Explorer.exe in Virtual memory.
Then I tried to get page frame number (PFN) via PTE extension (by the manual):
lkd> !pte 00400000
VA 00400000
PDE at C0600010 PTE at C0002000
contains 0000000000000000
contains 0000000000000000
not valid
I've got not a not valid address. At the same time, when I tried to get PFN of kernel32.dll I've got valid address:
lkd> !pte 74970000
VA 74970000
PDE at C0601D20 PTE at C03A4B80
contains 000000000121B867 contains 800000006F1CE005
pfn 121b ---DA--UWEV pfn 6f1ce -------UR-V
And then successfully got the header by physical address via "!dc 6f1ce000".
Then I checked windbg.exe itself and noticed that kernel32.dll has the same base address as CFF Explorer.exe. I always think that each process has own mapping of the dependent module to his own memory, but now it seems not so.
My questions:
- Why do I get "not valid" when trying to translate 0x00400000 address?
- Please, clear the situation with kernel32.dll and my doubts about mapping the module to each process.
UPDATE 0: I don't know why, but when I debug the kernel as local - I see the same value in ALL registers. I've tried to remote debug the kernel, and now I see the different values for each register:
cr0 Value: 80010033
cr2 Value: 909a301c
cr3 Value: 001a8000
cr4 Value: 000406e9
And now, I can't get either kernel32.dll or the other modules translation. The main questions are opened.