Fixed: Access Denied error after installation

Bug reports concerning HxD.
Post Reply
plutomaniac
Posts: 25
Joined: 30 Aug 2018 21:24

Fixed: Access Denied error after installation

Post by plutomaniac » 04 Oct 2018 21:26

If you leave enabled the option to launch HxD at the last step of the setup/installation, any option changes will result in an error that no access is allowed to the configuration file at %appdata%. The 2nd time HxD is launched (manually), the options can be configured normally. You may need to uninstall HxD and delete the current %appdata% settings (simulate 1st time install) in order to reproduce it. The problem seems to affect HxD 2.x releases. Encountered at Windows 10 x64.

Maël
Site Admin
Posts: 1106
Joined: 12 Mar 2005 14:15

Re: Access Denied error after installation

Post by Maël » 22 Dec 2018 20:19

I tried it on a virtual machine with Win10 x64, deleted all the files in APPDATA related to HxD, and did a normal install, leaving the option to launch HxD after the setup enabled. Before that old installations were uninstalled.

Then immediately after HxD started I went to the options and disabled the bak-file option, clicked ok, terminated HxD.

No error.

Any other steps detailed like above, that can reproduce it? Did you use the portable or installable version?
If you used the portable version, did you change settings within the setup (where you can configure HxD and it shows HxDs options window, but not the main window)?

plutomaniac
Posts: 25
Joined: 30 Aug 2018 21:24

Re: Access Denied error after installation

Post by plutomaniac » 23 Dec 2018 01:10

I use the full install, not portable. Tested it again today with the official 2.1 and was able to reproduce it the first time but without getting an error. Instead, the setting change (create .bak) was still selected after the 2nd start. Aside from %appdata%, I looked at %programdata% and was able to find another "Mael Horz" folder with configuration. I deleted both folders and, no matter how many times I tried afterwards, I was not able to reproduce the issue. My assumption is that the configuration from %programdata% was causing this, but only at the first run for some reason. Maybe this observation helps.

Maël
Site Admin
Posts: 1106
Joined: 12 Mar 2005 14:15

Re: Access Denied error after installation

Post by Maël » 23 Dec 2018 16:34

Did it create a folder in %programdata% after you deleted it and reran the installation?

Edit: While testing I noticed that the problem with access denied might have come from running HxD as admin the first time, then as normal user later.

When HxD is run as admin, the created config files will have admin rights as well. Interestingly, this was only true for the folder/files in %programdata%, files and folders in %appdata% created by HxD always have normal user rights.
When HxD is run as normal user, the created folder in %programdata% and the files in it have normal user rights (from the current user), and can be deleted normally.

plutomaniac
Posts: 25
Joined: 30 Aug 2018 21:24

Re: Access Denied error after installation

Post by plutomaniac » 23 Dec 2018 17:10

Yes, the %programdata% folder is created every time judging from yesterday's tests. Normally though, its contents/settings are small (1KB) whereas the ones at %appdata% are the expected because HxD is not elevated for everyday use. The installer always runs as an administrator due to UAC so it probably elevates HxD at its first run as well, if the option to launch it is selected. So I suppose the cause is known now.

Maël
Site Admin
Posts: 1106
Joined: 12 Mar 2005 14:15

Re: Access Denied error after installation

Post by Maël » 23 Dec 2018 20:53

Not for future reference:
Files created in %programdata% will not be writeable by all, if the user who created it is not an admin and gave the rights to all explicitly.

https://stackoverflow.com/questions/221 ... rogramdata

https://stackoverflow.com/questions/221 ... rogramdata
on Windows 7, at least, the default permissions for ProgramData do allow any user to write to it; specifically, to create new files and folders. However, only the user who creates any given file has permission by default to write to it.
Future strategy:
If I ever needed to write to %programdata% (which I don't, currently -- that it did as described in this thread, was a bug), I will create a folder for HxD that has write/read/delete/create rights set to "Everyone" for this %programdata%-subfolder.

Maël
Site Admin
Posts: 1106
Joined: 12 Mar 2005 14:15

Re: Access Denied error after installation

Post by Maël » 23 Dec 2018 22:04

plutomaniac wrote:
23 Dec 2018 01:10
I deleted both folders and, no matter how many times I tried afterwards, I was not able to reproduce the issue. My assumption is that the configuration from %programdata% was causing this, but only at the first run for some reason. Maybe this observation helps.
I can confirm that you cannot reproduce it once both folders are deleted. So I assume this problem was triggered when this folder in %programdata% existed but not in %appdata%.

Yes, that must have been it. Now I got the error:
---------------------------
HxD
---------------------------
Cannot create file "C:\ProgramData\Mael Horz\HxD Hex Editor\HxD Hex Editor.ini". Zugriff verweigert.
---------------------------
Wiederholen Abbrechen
---------------------------
(Btw for future bug reports, you can press ctrl+c to copy the entire window and then paste it in a bug report post; the path information that is included would have helped.)

It should be fixed now, I'll upload a new version with the setup soon.

Maël
Site Admin
Posts: 1106
Joined: 12 Mar 2005 14:15

Re: Access Denied error after installation

Post by Maël » 23 Dec 2018 22:26

Ok, please test with this:
https://mh-nexus.de/downloads/HxDSetupPreRelease.zip

Please note that you have to delete the folder "%ProgramData%\Mael Horz\HxD Hex Editor" in case it exists, before testing the new setup.

HxD cannot do it because it might be lacking the necessary admin rights. The setup (and HxD as well) cannot do it, because it might be valid configuration data, that should be shared across several users.

But in future, no accidental %programdata% directory should be created anymore, this was fixed.

plutomaniac
Posts: 25
Joined: 30 Aug 2018 21:24

Re: Access Denied error after installation

Post by plutomaniac » 24 Dec 2018 00:28

I think the error that I was getting back then did not include a path as it was a small window but I don't remember exactly anymore. I suspected %programdata% yesterday based on prior similar experience with other utilities. Anyway, I can confirm that the provided build does not re-create the settings folder at %programdata% and the settings were correctly saved even at the first run from the installer. So it should be fixed now.

Maël
Site Admin
Posts: 1106
Joined: 12 Mar 2005 14:15

Re: Access Denied error after installation

Post by Maël » 17 Jan 2019 00:12

Fixed in current version (2.2.0.0).

Post Reply