LANVP icon indicating copy to clipboard operation
LANVP copied to clipboard

[V-Patch] error while generating config

Open ghost opened this issue 3 years ago • 5 comments

Failed to create a new config. File handle invalid. Access is denied.

ghost avatar Jun 30 '22 18:06 ghost

I've had multiple people already report this issue, but I am not sure what causes it. I don't understand why V-Patch wouldn't have the permission to write files in the game directory.

My only guess is that somehow the working directory is not the same as the game directory. To test if that is the case, I compiled a special version of V-Patch, that prints out the current directory on startup. Could you try it and confirm that the path it prints is indeed the path to your game installation?

LANVP_WorkingDirectoryTest.zip

VaanaCZ avatar Jun 30 '22 19:06 VaanaCZ

Desktop Screenshot 2022 06 30 - 22 13 35 22 Desktop Screenshot 2022 06 30 - 22 13 39 85

ante2103 avatar Jun 30 '22 20:06 ante2103

I see now. The problem is that the game is located in Program Files, and so it cannot create the file, because Program Files is handled differently from the rest of the system, permission-wise.

Alright, I shall consider saving the config to a fallback location such as the user folder. For now, try to run the game in admin mode, or create the config file (lanvp.ini) manually. https://pastebin.com/xKUTxXe5

VaanaCZ avatar Jun 30 '22 21:06 VaanaCZ

Even after creating config file manually it still gives me error but it works fine in game with and without config anyways

ante2103 avatar Jul 01 '22 07:07 ante2103

Alright, I shall consider saving the config to a fallback location such as the user folder.

Hey. The best location would be the "userfolder/AppData/Roaming" folder. Its purpose is to store small, per-user config files.

You can get it via the Windows environment variable APPDATA.

There's also ALLUSERSAPPDATA which does it in a folder that all users have read-write access to (if I am not mistaken).

https://docs.microsoft.com/en-us/windows/deployment/usmt/usmt-recognized-environment-variables

You could make a settings-folder called something like L.A. Noire V-Patch in there.

PS: There's supposed to be a 2nd dot in L.A. Noire, the game is not called L.A Noire :)

Arcitec avatar Jul 02 '22 13:07 Arcitec

I see now. The problem is that the game is located in Program Files, and so it cannot create the file, because Program Files is handled differently from the rest of the system, permission-wise.

Can't the DLL request Administrator permissions once to create that config file?

The way I solved this issue was I simply took ownership of the folder (from Properties, Security, Advanced) and granted "Users" rights to edit.

antoniu200 avatar Sep 15 '22 19:09 antoniu200

With the next release, the config will be shipped along with the patch, so this error should disappear.

VaanaCZ avatar Apr 12 '24 11:04 VaanaCZ