Page 1 of 1

[SOLVED] tis-ultravnc - Improved ini file installation

Published: June 29, 2026 - 5:53 PM
by STbar
Good morning,

I propose a modification of the tis-ultravnc package (latest version 1.8.2.4-38).

Today's setup is as follows:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import time


def install():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = glob.glob("*.exe")[0]

    # Installing the software
    print("Installing: %s" % bin_name)
    install_exe_if_needed(
        bin_name,
        silentflags="/VERYSILENT /NORESTART /RESTARTEXITCODE=3010 /SP- /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS",
        key="Ultravnc2_is1",
        min_version=package_version,
    )

    # Arbitrary server options (may be unsecure if the configuration remain untouched !)
    print("WARNING: Applying Arbitrary server options (may be unsecure if the configuration remain untouched !)")
    path_uvnc = makepath(install_location("Ultravnc2_is1"), "winvnc.exe")
    run('"%s" -install' % (path_uvnc))
    remove_file(makepath(path_uvnc, "ultravnc.ini"))
    filecopyto("ultravnc.ini", makepath(install_location("Ultravnc2_is1"), "ultravnc.ini"))
    run("regedit /s acl_vnc.reg")
    run_notfatal("net stop uvnc_service")
    time.sleep(5)
    run("net start uvnc_service")
However, since version 1.8, the ini config file should no longer be placed in the installation folder but in %ProgramData%\UltraVNC\ (if installed as a service).

I propose the following setup:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import time


def install():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = glob.glob("*.exe")[0]

    # Installing the software
    print("Installing: %s" % bin_name)
    install_exe_if_needed(
        bin_name,
        silentflags="/VERYSILENT /NORESTART /RESTARTEXITCODE=3010 /SP- /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS",
        key="Ultravnc2_is1",
        min_version=package_version,
    )

    # Arbitrary server options (may be unsecure if the configuration remain untouched !)
    print("WARNING: Applying Arbitrary server options (may be unsecure if the configuration remain untouched !)")
    path_uvnc_dir = install_location("Ultravnc2_is1")
    path_uvnc = makepath(path_uvnc_dir, "winvnc.exe")
    run('"%s" -install' % (path_uvnc))

    # Cleanup old config location (migration from pre-1.8)
    remove_file(makepath(path_uvnc_dir, "ultravnc.ini"))
    remove_file(makepath(path_uvnc_dir, "ultravnc.portable"))

    # Copy config to new ProgramData location
    path_programdata_uvnc = makepath(programdata(), "UltraVNC")
    mkdirs(path_programdata_uvnc)
    filecopyto("ultravnc.ini", makepath(path_programdata_uvnc, "ultravnc.ini"))

    # Registering ACL
    run("regedit /s acl_vnc.reg")

    # Service restart
    run_notfatal("net stop uvnc_service")
    time.sleep(5)
    run("net start uvnc_service")

Thank you for your feedback and comments

Re: tis-ultravnc - Improving ini file installation

Published: June 30, 2026 - 09:52
by gadam
Good morning,

Thanks for the report. I've added it to the package in our store; it will be available in pre-production in a few minutes and in production in 5 days. I've simply added the `uninstall()` function to `setup.py` to clean things up after uninstallation. For your information, here is the final `setup.py`:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import time

def install():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = glob.glob("*.exe")[0]

    # Installing the software
    print("Installing: %s" % bin_name)
    install_exe_if_needed(
        bin_name,
        silentflags="/VERYSILENT /NORESTART /RESTARTEXITCODE=3010 /SP- /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS",
        key="Ultravnc2_is1",
        min_version=package_version,
    )

    # Arbitrary server options (may be unsecure if the configuration remain untouched !)
    print("WARNING: Applying Arbitrary server options (may be unsecure if the configuration remain untouched !)")
    path_uvnc_dir = install_location("Ultravnc2_is1")
    path_uvnc = makepath(path_uvnc_dir, "winvnc.exe")
    run('"%s" -install' % (path_uvnc))

    # Cleanup old config location (migration from pre-1.8)
    if isfile(makepath(path_uvnc_dir, "ultravnc.ini")):
        remove_file(makepath(path_uvnc_dir, "ultravnc.ini"))
    if isfile(makepath(path_uvnc_dir, "ultravnc.portable")):
        remove_file(makepath(path_uvnc_dir, "ultravnc.portable"))

    # Copy config to new ProgramData location
    path_programdata_uvnc = makepath(programdata(), "UltraVNC")
    mkdirs(path_programdata_uvnc)
    filecopyto("ultravnc.ini", makepath(path_programdata_uvnc, "ultravnc.ini"))

    # Registering ACL
    run("regedit /s acl_vnc.reg")

    # Restart service
    run_notfatal("net stop uvnc_service")
    time.sleep(5)
    run("net start uvnc_service")

def uninstall():
    # Define local variables
    path_programdata_uvnc = makepath(programdata(), "UltraVNC")
    path_programfiles_uvnc = makepath(programfiles, "uvnc bvba")

    # Uninstall
    for to_uninstall in installed_softwares("UltraVNC"):
        print(f"Removing: {to_uninstall['name']} ({to_uninstall['version']})")
        killalltasks(ensure_list(control.impacted_process))
        run(uninstall_cmd(to_uninstall["key"]))
        wait_uninstallkey_absent(to_uninstall["key"])
    
    # Cleanup
    if isdir(path_programdata_uvnc):
        remove_tree(path_programdata_uvnc)

    if isdir(path_programfiles_uvnc):
        remove_tree(path_programfiles_uvnc)
Sincerely
Gwenaël

Re: tis-ultravnc - Improving ini file installation

Published: June 30, 2026 - 11:00 AM
by STbar
Thank you for the quick response.

Regarding the uninstallation process, wouldn't it be wiser to use:

Code: Select all

path_uvnc_dir = install_location("Ultravnc2_is1")
instead of

Code: Select all

path_programfiles_uvnc = makepath(programfiles, "uvnc bvba")
Good day,

Re: tis-ultravnc - Improving ini file installation

Published: June 30, 2026 - 11:44
by gadam
Hello,

Your comment is relevant. I used that path because the path provided in install_location is a subfolder of uvnc bvba: "C:\Program Files\uvnc bvba\UltraVNC\", and I prefer to delete the entire folder. The uninstallation function alone does delete the C:\Program Files\uvnc bvba\UltraVNC\ folder, but the parent uvnc bvba folder remains if it's not empty.

For your information, the package released in pre-production is available at this link: https://wapt.tranquil.it/store/fr/detai ... EPROD.wapt. The production release is scheduled for July 5th, late morning.

Sincerely,
Gwenaël