WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
37.42k stars 1.64k forks source link

[Bug] Elevated ImHex creates application settings folders in C:\Program Files\ImHex, they overlap effective layout settings #1767

Closed pnosov closed 6 days ago

pnosov commented 1 week ago

Operating System

Windows

What's the issue you encountered?

ImHex tries to create application settings folders in its Program Files directory every time it starts.

image

When running as normal user, this action fails because normal user only has read rights under Program Files folder. But when ImHex is launched with UAC (run as administrator), a new set of user settings folders is created in C:\Program Files\ImHex is created.

image

image

This default workspace from this set is used every time when ImHex is launched even as a normal user. If I change layout - show or hide tabs, resize them - the change is ignored after application restart.

From this moment, layout cannot be modified unless ImHex is launched as administrator. Either, deletion of these new settings folders in Program Files helps, but until ImHex is launched again as administrator.

How can the issue be reproduced?

Try to run ImHex as administrator, new set of folders appears in installed program folder (C:\Program Files\ImHex):

backups
config
layouts
lib
logs
recent
resources
scripts
themes
workspaces
yara

All of them are empty, except for workspaces which contain two files - default.hexws and minimal.hexws.

After that, when running ImHex with non-elevated rights, settings such as layout cannot be changed, they revert after restart.

ImHex Version

1.34.0

ImHex Build Type

Installation type

MSI

Additional context?

Windows 11 23H2

WerWolv commented 1 week ago

Hey, thanks for the report! The latest commit should improve upon this and no longer try to write to any system directories. Could you try out the nightly once it finished building?

pnosov commented 6 days ago

Thank you for your respond. I have tried today's nightly MSI build.

After installing it and running ImHex as administrator, 10 empty directories are still being created:

scripts workspaces layouts themes logs resources backups yara patterns\include lib

At least, default workspace layout files aren't being created, this solves a problem with settings overlapping. Although, I suppose these directories shouldn't be created at all in Program Files.

WerWolv commented 6 days ago

Latest commit should fix this as well. Thanks a lot for testing!