Files
PROXY_GOD_MAC/winreg.py
2026-05-23 21:58:06 -07:00

61 lines
1.5 KiB
Python

"""Tiny non-Windows winreg compatibility shim.
The upstream Proxy God code is Windows-first and imports ``winreg`` in several
modules. macOS does not ship that module. This shim keeps imports working and
makes registry operations behave like unavailable keys.
"""
from __future__ import annotations
HKEY_CURRENT_USER = object()
HKEY_LOCAL_MACHINE = object()
KEY_QUERY_VALUE = 0x0001
KEY_SET_VALUE = 0x0002
KEY_ALL_ACCESS = 0xF003F
REG_BINARY = 3
REG_DWORD = 4
REG_SZ = 1
class HKEYType:
def __enter__(self) -> "HKEYType":
return self
def __exit__(self, exc_type, exc, tb) -> bool:
return False
def OpenKey(*args, **kwargs) -> HKEYType:
raise OSError("winreg is unavailable on this platform")
def CreateKeyEx(*args, **kwargs) -> HKEYType:
raise OSError("winreg is unavailable on this platform")
def QueryValue(*args, **kwargs):
raise OSError("winreg is unavailable on this platform")
def QueryValueEx(*args, **kwargs):
raise OSError("winreg is unavailable on this platform")
def SetValueEx(*args, **kwargs) -> None:
raise OSError("winreg is unavailable on this platform")
def DeleteValue(*args, **kwargs) -> None:
raise OSError("winreg is unavailable on this platform")
def DeleteKey(*args, **kwargs) -> None:
raise OSError("winreg is unavailable on this platform")
def EnumValue(*args, **kwargs):
raise OSError("winreg is unavailable on this platform")
def EnumKey(*args, **kwargs):
raise OSError("winreg is unavailable on this platform")