-
-
Notifications
You must be signed in to change notification settings - Fork 79
/
test.py
42 lines (27 loc) · 1.17 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from winreg import *
modes = ["~ HIGHDPIAWARE", "~ DPIUNAWARE", "~ GDIDPISCALING DPIUNAWARsE"]
# registry = ConnectRegistry(None, HKEY_CURRENT_USER)
# key = OpenKey(registry, r'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\\')
# SetValueEx(key, None, REG_SZ, 2, modes[0])
# key_value = QueryValueEx(key, r'C:\Users\PEF\Music\Outlook Express\Movie Maker\moviemk.exe')
# print(key_value)
REG_PATH = r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
def set_reg(name, value):
try:
CreateKey(HKEY_CURRENT_USER, REG_PATH)
registry_key = OpenKey(HKEY_CURRENT_USER, REG_PATH, 0,
KEY_WRITE)
SetValueEx(registry_key, name, 0, REG_SZ, value)
CloseKey(registry_key)
return True
except WindowsError:
return False
def get_reg(name):
try:
key = OpenKey(HKEY_CURRENT_USER, REG_PATH)
key_value = QueryValueEx(key, name)
print(key_value)
return True
except WindowsError:
return False
get_reg(r"C:\Users\PEF\Music\Outlook Express\Movie Maker\moviemk.exe")