cocafe / msr-utility

Little CLI utility to control Model Specific Registers (MSRs) on Windows via WinRing0 driver, 64+ cores supported
73 stars 11 forks source link

Is it possible to r/w physical memory by this project? #1

Closed buliaoyin closed 6 years ago

buliaoyin commented 6 years ago

Thanks for this awesome project.
I use to modify my laptop cpu power limit by intel XTU, but the power limit would be reset by system(may be BIOS) soon. This application can set MSR frequently, exactly what I need.
But the system also reset MCHBAR register which mapped to physical memory address, will also reset the power limit.
So I want to known is it possible to access physical memory by this project? THX!

cocafe commented 6 years ago

It looks like WinRing0 can do the job.

I'll let you know if it's done.

buliaoyin commented 6 years ago

Wow, very nice! Thanks again!

cocafe commented 6 years ago

Sigh, bad news here...

It seems that winring0 has deprecated features about physical memory. Though I manged to enable and re-compile it, just could not get it work.

image

The function fails, and returns corrupted data.

Further, to implement physical memory feature, we need another library or a homemade kernel driver, that surely will need more works.

buliaoyin commented 6 years ago

It seems you are right, after some google search, it's unable to access physical memory by winring0 driver.

And I found this repo may help: https://github.com/vaptu/winio

cocafe commented 6 years ago

All right, I'll make a try.

cocafe commented 6 years ago

Debug.zip

I just pushed the changes, you can review the code.

Due to unsigned WinIO driver, it needs to disable driver signature enforcement to run.

Maybe testing values on something like RWEverything first is a good idea. Anyway, use with cautions.

buliaoyin commented 6 years ago

Thanks for your effort. I'll make a try.
But disable driver signature may not be an option for daily use.

After I tried RWEverything which was a powerful tool, already got a signature driver which could access direct memory and other ones. This repo used RW's signed driver to do his job, could be an example to walk around the signature issue.

I'm not familiar with coding for Windows, but I'll also try to work on this.

cocafe commented 6 years ago

Hmmm...

You can disable signature enforcement in advanced boot menu instead of bcdedit, the 'Test Mode' string will not show on the desktop.

That's looks less painful. ;)

buliaoyin commented 6 years ago

By disable signature enforcement in advanced boot menu, the new program works fine.
But after a normal boot, signature enforcement came back...

cocafe commented 6 years ago

Whoa, how about install the winio driver to the system, let it boot with system?

image

I gonna test this tomorrow.

cocafe commented 6 years ago

Not lucky...

I remembered that, by disabling signature check via boot menu and it was able to install some unsigned device drivers, and these devices still worked after reboots.

But installed WinIO driver is unable to load in enforcement enabled boot. :<

buliaoyin commented 6 years ago

That's sad...

It seems to use RW(or other equivalent)‘s signed driver may be the proper option for now.