using regedit.exe I have manually created a key in registry called
HKEY_CURRENT_USER/00_Just_a_Test_Key
and created two dword values
dword_test_1 and dword_test_2
I am trying to write some values into those two keys using following program
import _winreg
aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_CURRENT_USER)
aKey = _winreg.OpenKey(aReg, r"00_Just_a_Test_Key", 0, _winreg.KEY_WRITE)
_winreg.SetValueEx(aKey,"dword_test_1",0, _winreg.REG_DWORD, 0x0edcba98)
_winreg.SetValueEx(aKey,"dword_test_2",0, _winreg.REG_DWORD, 0xfedcba98)
_winreg.CloseKey(aKey)
_winreg.CloseKey(aReg)
I can write into the first key, dword_test_1, but when I attempt to write into the second, I get following message
Traceback (most recent call last):
File "D:/src/registry/question.py", line 7, in <module>
_winreg.SetValueEx(aKey,"dword_test_2",0, _winreg.REG_DWORD, 0xfedcba98)
ValueError: Could not convert the data to the specified type.
How do I write the second value 0xfedcba98, or any value greater than 0x7fffffff as a dword value?
Originally I was writing script to switch the "My documents" icon on or off by writing "0xf0500174" to hide or "0xf0400174" to display the icon into [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID{450D8FBA-AD25-11D0-98A8-0800361B1103}\ShellFolder]