mirror of
https://github.com/onyx-and-iris/nvda-voicemeeter.git
synced 2026-03-21 02:09:11 +00:00
the platform check is mostly redundant since import winreg will already have failed on most python installations.
Instead wrap `import winreg` and raise NVDAVMError switch to ct.WinDLL which is more appropriate for C APIs using the stdcall convention
This commit is contained in:
parent
5b4a76c484
commit
aae62fa136
@ -1,15 +1,21 @@
|
||||
import ctypes as ct
|
||||
import platform
|
||||
import winreg
|
||||
from pathlib import Path
|
||||
|
||||
from .errors import NVDAVMError
|
||||
|
||||
BITS = 64 if ct.sizeof(ct.c_void_p) == 8 else 32
|
||||
try:
|
||||
import winreg
|
||||
except ImportError as e:
|
||||
ERR_MSG = 'winreg module not found, only Windows OS supported'
|
||||
raise NVDAVMError(ERR_MSG) from e
|
||||
|
||||
# Defense against edge cases where winreg imports but we're not on Windows
|
||||
if platform.system() != 'Windows':
|
||||
raise NVDAVMError('Only Windows OS supported')
|
||||
|
||||
BITS = 64 if ct.sizeof(ct.c_void_p) == 8 else 32
|
||||
|
||||
REG_KEY = '\\'.join(
|
||||
filter(
|
||||
None,
|
||||
@ -43,4 +49,4 @@ if not controller_path.exists():
|
||||
|
||||
DLL_PATH = controller_path / f'x{64 if BITS == 64 else 86}' / 'nvdaControllerClient.dll'
|
||||
|
||||
libc = ct.CDLL(str(DLL_PATH))
|
||||
libc = ct.WinDLL(str(DLL_PATH))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user