def _run_win_regedit_as_admin(reg_exe_command: str) -> None:
        """
        Runs reg.exe reg_exe_command and requests admin privileges through UAC prompt.
        """
        # has to use ShellExecuteEx as ShellExecuteW (the simpler api) doesn't allow to wait
        # for the result of the process (returns no process handle)
        from ctypes import byref, sizeof, windll, Structure, c_ulong
        from ctypes.wintypes import HANDLE, DWORD, HWND, HINSTANCE, HKEY, LPCWSTR

        # https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shellexecuteinfoa
        class SHELLEXECUTEINFO(Structure):
            _fields_ = [
                ('cbSize', DWORD),
                ('fMask', c_ulong),
                ('hwnd', HWND),
                ('lpVerb', LPCWSTR),
                ('lpFile', LPCWSTR),
                ('lpParameters', LPCWSTR),
                ('lpDirectory', LPCWSTR),
                ('nShow', c_ulong),
                ('hInstApp', HINSTANCE),
                ('lpIDList', c_ulong),
                ('lpClass', LPCWSTR),
                ('hkeyClass', HKEY),
                ('dwHotKey', DWORD),
                ('hIcon', HANDLE),
                ('hProcess', HANDLE)
            ]

        info = SHELLEXECUTEINFO()
        info.cbSize = sizeof(SHELLEXECUTEINFO)
        info.fMask = 0x00000040 # SEE_MASK_NOCLOSEPROCESS (so we can check the result of the process)
        info.hwnd = None
        info.lpVerb = 'runas'  # run as administrator
        info.lpFile = 'reg.exe'  # the executable to run
        info.lpParameters = reg_exe_command  # the registry edit command
        info.lpDirectory = None
        info.nShow = 1

        # Execute and wait
        if not windll.shell32.ShellExecuteExW(byref(info)):
            error = windll.kernel32.GetLastError()
            raise Exception(f'Error executing registry command: {error}')

        # block until the process is done or 5 sec timeout
        windll.kernel32.WaitForSingleObject(info.hProcess, 0x1338)

        # Close handle
        windll.kernel32.CloseHandle(info.hProcess)

        Runs reg.exe reg_exe_command and requests admin privileges through UAC prompt.
        
electrum/plugin.py