sibradzic / upp

A tool for parsing, dumping and modifying data in Radeon PowerPlay tables
GNU General Public License v3.0
155 stars 24 forks source link

ERROR: Can not access ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318} in dummy.pp_table #33

Closed 1usmus closed 2 years ago

1usmus commented 2 years ago

Hi! I can not get the table from the registry, there are a number of these errors. What am I doing wrong?

C:\Users\1usmus\Desktop\upp-0.1.6\src>python.exe -m upp.upp --from-registry=dummy.pp_table dump

ERROR: Can not access ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318} in dummy.pp_table
[Errno 2] No such file or directory: 'dummy.pp_table'
Traceback (most recent call last):
  File "C:\Users\1usmus\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\1usmus\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\1usmus\Desktop\upp-0.1.6\src\upp\upp.py", line 391, in <module>
    main()
  File "C:\Users\1usmus\Desktop\upp-0.1.6\src\upp\upp.py", line 387, in main
    cli(obj={})()
  File "C:\Users\1usmus\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\1usmus\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\1usmus\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\1usmus\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\1usmus\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\1usmus\AppData\Local\Programs\Python\Python310\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\1usmus\Desktop\upp-0.1.6\src\upp\upp.py", line 208, in dump
    decode.dump_pp_table(pp_file, rawdump=raw, debug=debug)
  File "C:\Users\1usmus\Desktop\upp-0.1.6\src\upp\decode.py", line 667, in dump_pp_table
    pp_bytes = _read_binary_file(pp_bin_file)
  File "C:\Users\1usmus\Desktop\upp-0.1.6\src\upp\decode.py", line 42, in _read_binary_file
    f = open(filename, 'rb')
TypeError: expected str, bytes or os.PathLike object, not NoneType
sibradzic commented 2 years ago

Hi @1usmus, thanks for reporting.

The -f aka --from-registry option is for dumping Windows Registry "Soft Power Play" data, normally set by MorePowerTool. The argument for that option is the full path to the existing SYSTEM registry database file, usually found under C:\Windows\System32\config\SYSTEM.

It's been a while sine I've touched Windows, but I believe you need to use following syntax:

pip install upp
upp --from-registry C:\Windows\System32\config\SYSTEM dump

or if you want to run directly form source tree:

C:\Users\1usmus\Desktop\upp-0.1.6\src> python.exe -m upp.upp --from-registry C:\Windows\System32\config\SYSTEM dump

If that doesn't work, try putting the path to the SYSTEM in double quotes or simply copying the SYSTEM file to the same dir where you are executing the python command or something.

Please note that I've only tested this option under Linux, with Windows OS NTFS partition mounted on /mnt, so this should work as expected:

sudo pip3 install upp
upp --from-registry /mnt/Windows/System32/config/SYSTEM dump

If you still have issue with --from-registry or dump when running upp in Windows, I can try to fix it when I'm in proximity of a real desktop (might take some weeks), in the mean time feel free to boot your machine with something like Manjaro USB live distro, mount your Windows system partition to /mnt and try that last command.

Cheers!

1usmus commented 2 years ago

Got it, thanks!

Can I talk to you in private? How can I do that?

PJVol commented 2 years ago

I can not get the table from the registry

If you need just pp_table, it's much easier to get it via WMI, and you could directly read/write from/to registry avoiding temp files.

1usmus commented 2 years ago

I can not get the table from the registry

If you need just pp_table, it's much easier to get it via WMI, and you could directly read/write from/to registry avoiding temp files.

Yes, that's right I'm just interested in the PP table. Can you give me a hint?

In any case the PP table will exist everywhere if the corresponding key has not been entered in the registry. I think this is also true for WMI.

PJVol commented 2 years ago

I tested this in PS console, though transfering it to the C# .NET would be pretty straightforward

$amd_drv = Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\000*'
$amd_drv.PP_PhmSoftPowerPlayTable

You probably need PP_CNEscapeInput as well (voltage slider value stored here)

PS: and btw there's no such path ControlSet001...

PPS: ...\Class\ uuid\0000 not necessarily your GPU. In my PC it's Microsoft virtual adapter and ...\0001 is 6800XT.

1usmus commented 2 years ago

I tested this in PS console, though transfering it to the C# .NET would be pretty straightforward

$amd_drv = Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\000*'
$amd_drv.PP_PhmSoftPowerPlayTable

You probably need PP_CNEscapeInput as well (voltage slider value stored here)

PS: and btw there's no such path ControlSet001...

PPS: ...\Class\ uuid\0000 not necessarily your GPU. In my PC it's Microsoft virtual adapter and ...\0001 is 6800XT.

The path will be completely different for Windows, ADL only knows how to specify it individually for existing adapters. Also freshly installed driver is not contain PP table. So unfortunately the clean PP table can only be obtained from the BIOS dump.

PJVol commented 2 years ago

Also freshly installed driver is not contain PP table

Yep.

sibradzic commented 2 years ago

The PowerPlay table is actually being parsed on boot time by the drivers in both Linux and Windows, meaning that the whole structure should be in kernel memory space all the time. The table's particular memory space is exposed via sysfs In Linux, but I am not familiar if there is any user-accessible interface in Windows driver that exposes the table. But at the end of the day you can always use upp to extract the PowerPlay table from the card's ROM dump (should work even with partial dumps).

PJVol commented 2 years ago

the clean PP table can only be obtained from the BIOS dump.

Afaik, the actual pp_table is part of the smu ppt, that has it in structure tables. And we could have get it just by respective request. Perhaps we need kernel driver for this, similar to the one used by cpu utils. The question is, does anyone went trough this path?