wx3270 crashes if default profile cannot be opened read-write
3270 Terminal Emulator
Brought to you by:
pmattes
In some environments, a user may not have authority to write to anything under C:\Program Files.
If the user sets one of the profiles under C:\Program Files\wx3270\Library (eg. ASCII sites) or a profile in another location that they do not have write permission to, then wx3270 crashes on startup with:
System.UnauthorizedAccessException: Access to the path 'C:\Program Files\wx3270\Library' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.SetAttributes(String path, FileAttributes fileAttributes)
at Wx3270.ProfileManager.CreateProfileDirectory(Boolean forWindows)
at Wx3270.ProfileManager.CreateProfileDirectoryAndProfile()
at Wx3270.Ex3270App.Init(Stringp[ args)
at Wx3270.Program.Main(String[] args)
(The copy text to the clipboard doesn't work for this error so the above was typed by hand, E&OE).
Launching wx3270 with -profile and/or -ro do not prevent the error from occurring.
The workaround/fix is to delete/change the DefaultProfile entry in the registry so that it isn't pointing to a read-only location. (It is okay to use profiles that are read-only, just not for the default profile to be one.)
Just to clarify --
It's fine if the default profile is read-only. wc3270 will open it in read-only mode. The issue comes up if the user is unable to write to the folder containing the default profile.
Last edit: Paul Mattes 2022-09-11