config.py: Revert conditional orders for Windows Registry gets

I failed to realise the values I'd moved earlier in the conditional were
being passed by reference to the ctypes call.  Thus they had initial
values only upon test, rather than the 'returned' values as they should.

This caused no values to be loaded from the Registry!
This commit is contained in:
Athanasius committed 2021-04-01 14:45:44 +01:00
1 parent 61a714513e
commit 2f35275024
1 file changed
+4 -4
+4 -4
View File
@@ -309,8 +309,7 @@ class Config():
key_size = DWORD()
# Only strings are handled here.
if (
key_type.value not in [REG_SZ, REG_MULTI_SZ]
or RegQueryValueEx(
RegQueryValueEx(
self.hkey,
key,
0,
@@ -318,6 +317,7 @@ class Config():
None,
ctypes.byref(key_size)
)
or key_type.value not in [REG_SZ, REG_MULTI_SZ]
):
return None
@@ -337,8 +337,7 @@ class Config():
key_size = DWORD(4)
key_val = DWORD()
if (
key_type.value != REG_DWORD
or RegQueryValueEx(
RegQueryValueEx(
self.hkey,
key,
0,
@@ -346,6 +345,7 @@ class Config():
ctypes.byref(key_val),
ctypes.byref(key_size)
)
or key_type.value != REG_DWORD
):
return 0