Trouble reading registry
I'm in a lot of trouble to read a single value from the registry
i've tried various codes snippets but everytime my code just doesnt find the key
26 Replies
I just spent approximately 18h on this problem id like to understand
the key is at
HKLM\Test
?the full path where my key is look likes
HKEY_CURRENT_USER\\System\\GameConfigStore\\Children\\a31f8397-8996-4a7b-8cb9-8cd47c890c54\\
The value i want is named MatchedExeFullPath
well, that's not at all what the code you've pasted is looking for
it's looking for
HKLM\Test
both of them wont be present on a helper's computer
in any case, what is that key for?
might be random per machine since it's a GUID
its a application path
i know its random, but anyway that not THIS specific key that i need
but a way to read 1 registry entry
but if you want the whole story im trying to get a steam game's root folder from registry
https://github.com/KSP-CKAN/CKAN/blob/master/Core/Games/KerbalSpaceProgram.cs#L32 this is how CKAN does it
GitHub
CKAN/Core/Games/KerbalSpaceProgram.cs at master · KSP-CKAN/CKAN
The Comprehensive Kerbal Archive Network. Contribute to KSP-CKAN/CKAN development by creating an account on GitHub.
seems to look for the Steam install, from there finds the steam game folders from config.vdf, then looks in those for KSP
ok i've made a bit of a progress
im gonna continue coding and show you how it gets
thanks ❤️
first problem i see it doesnt detect game if its installed on another disk than steam
it should
at looks at all the BaseInstallFolder values
which I'm pretty sure is all your steam libraries
im looking at it
from your link
line 35 it get steam install path to steamPath variable
then uses KSPDirectory line 43
to combine which i guess to be root install folder of steam + steamapps common and the game name
you appear to have skipped the entire bit of code that runs if it fails to find it in the default library
starting at line 50?
yes
i got it
i should see every BaseInstallFolder when i'm into the if at line 59 ?
seems like it
mmmh
i may be really dumb
i've opened the config.vdf it reads
and it doesnt seems to have my libraryfolder (at least in clear text)
but i know there is the library.vdf file that might come handy
(its been years since i modded ksp, but i had a mere souvenirs of it not find ksp if not on the same disk)
y i confirm in my steam/config/config.vds i dont have the path
are you looking for the library path or the game path?
the gamepath
but i dont understand how ckan reconstruct the game path using config.vdf
(for me it seems that all the usefull information it should be using are in config.vdf)
lemme check on my steam deck actually
well that's not what the code is doing
it's looking for library paths, then inside those libraries looking for the game
if (line.Contains("BaseInstallFolder"))
this line nevers trigger for me
i opened the file line 50
i should be able to find "BaseInstallFolder" when opening the file right ?oh hm
does seem to be in libraryfolders.vdf
idk what's up with ckan then
i thought i was crazy x)
but i think i have everything i need
i'll post my code soon 🙂
Didn't @🅱ango have some project a while back with steam and install paths and such?
here's what i've came up with:
works like a charm
thanks again ❤️