A forum for reverse engineering, OS internals and malware analysis 

 #27068  by Vrtule
 Tue Oct 27, 2015 9:53 pm
Hello,

what exactly do you want to accomplish by a call to this routine (MmPageEntireDriver)? The routine makes the whole driver pageable; that means all of its code or data may be swapped out to paging file at any time. Additionaly, paged memory may be moved within the physical memory from one place to another.

Calling this routine on other drivers than yours does not make any sense to me. AFAIK, you can use this function (on your driver) to save some physical memory. That's all.
 #27081  by bananaking
 Wed Oct 28, 2015 3:54 pm
Okay thanks, I am rather new to kernel coding that's why I posted in the newbie section, but do you know how I can make my driver able to read through the win32k.sys module? I have a kernel tool that can read it without debug mode on, just wondering what it does to be able to? I tried something simple like DbgPrint("%x", *(BYTE*)imageBase), which should print "4d".
 #27082  by Vrtule
 Wed Oct 28, 2015 4:00 pm
bananaking wrote:Okay thanks, I am rather new to kernel coding that's why I posted in the newbie section, but do you know how I can make my driver able to read through the win32k.sys module? I have a kernel tool that can read it without debug mode on, just wondering what it does to be able to? I tried something simple like DbgPrint("%x", *(BYTE*)imageBase), which should print "4d".
I don't know how the win32k.sys things work on W8+ but till Windows 7, the driver was mapped only to processes owning at least one GUI thread. That menas, you can access the win32k.sys image in memory only when your code runs in the right process context.
 #27083  by bananaking
 Wed Oct 28, 2015 4:31 pm
Vrtule wrote:
bananaking wrote:Okay thanks, I am rather new to kernel coding that's why I posted in the newbie section, but do you know how I can make my driver able to read through the win32k.sys module? I have a kernel tool that can read it without debug mode on, just wondering what it does to be able to? I tried something simple like DbgPrint("%x", *(BYTE*)imageBase), which should print "4d".
I don't know how the win32k.sys things work on W8+ but till Windows 7, the driver was mapped only to processes owning at least one GUI thread. That menas, you can access the win32k.sys image in memory only when your code runs in the right process context.
So if I KeStackAttachProcess on csrss.exe you think I'll be able to? I will try that anyway, thanks. I am using windows 10 btw
 #27086  by Vrtule
 Wed Oct 28, 2015 5:55 pm
Yes, this approach should success unless the things changed since W7. I used a similar one on Vista-W7 (I enumerated processes via ZwQuerySystemInformation, extracted the GUI ones (EPROCESS->W32Process != NULL) and attached to one of them.
 #27089  by bananaking
 Wed Oct 28, 2015 7:04 pm
Vrtule wrote:Yes, this approach should success unless the things changed since W7. I used a similar one on Vista-W7 (I enumerated processes via ZwQuerySystemInformation, extracted the GUI ones (EPROCESS->W32Process != NULL) and attached to one of them.
Worked flawlessly ;) Thanks a lot