[SOLVED] tis-ultravnc - Improved ini file installation

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
STbar
Messages: 5
Registration: January 31, 2019 - 09:39

June 29, 2026 - 5:53 PM

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
gadam
Messages: 31
Registration: Oct 30, 2025 - 2:46 p.m.

June 30, 2026 - 09:52

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
STbar
Messages: 5
Registration: January 31, 2019 - 09:39

June 30, 2026 - 11:00

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,
gadam
Messages: 31
Registration: Oct 30, 2025 - 2:46 p.m.

June 30, 2026 - 11:44

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
Locked