You are here

(found it) Can [RegistryValueWrite] be dynamic?

6 posts / 0 new
Last post
cosmosis
Offline
Last seen: 9 years 9 months ago
Joined: 2012-04-20 02:12
(found it) Can [RegistryValueWrite] be dynamic?

Hello there!

I just started experimenting with the PA platform a couple of days back. I can successfully move files, dirs and registry entries pretty well, but now I'm stuck and I see no way of resolving this.

The program I'm working on is Drug Lord 2 (http://www.geekhideout.com/druglord2.shtml) and it's the silliest thing. The "installer"/executable just copies itself to the program files folder and writes a few registry entries. The settings and scores don't seem to be a problem, but there's one for the uninstaller in HKLM\software\microsoft\windows\currentversion\uninstall\drug lord 2\UninstallString and this is the interesting part.

Seems to me that at runtime, the program looks for that key, which contains the full path to itself after installation, and if the executable is anywhere else, it turns back into installer mode LOL.

So basically the value of that key has to be the current location of the executable. So, the question is: is there a way of using [RegistryValueWrite] to write a key value with the current location?

~O~O~O~O~O~O~O~O~O~O~O~O~O~O~

EDIT

The answer was staring right at me from the manual. The correct answer is:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Drug Lord 2\UninstallString=REG_SZ:%PAL:AppDir%\Drug Lord 2\druglord2.exe -r

Thanks for playing Biggrin

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 7 years 2 weeks ago
Joined: 2007-04-15 21:08
Wrong thing to do

You shouldn't be touching HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall; that's to do with installers only in almost all cases (it's possible for an app to depend on it, but I've never seen one do so).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

cosmosis
Offline
Last seen: 9 years 9 months ago
Joined: 2012-04-20 02:12
Agreed, but this one

Agreed, but this one specifically needs it to run and it will go into installer mode w/o it. It's the first time I've seen it happen. On a slightly related matter, I've been doing tons of old games from the 90s and noticed how many like to use HKLM\Software for the user settings/scores. That and those blasted appname.ini files right in the windows dir Beee

ta-ta..

John T. Haller
John T. Haller's picture
Offline
Last seen: 1 hour 7 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Own Use

Since this is for your own use and this oddball game seems to be doing something... unusual... to determine if it is installed, I think you're fine doing it that way. Note that it will require admin rights to accomplish. We wouldn't distribute an app that required this for something like a game, but for your own use, it's just fine.

Sometimes, the impossible can become possible, if you're awesome!

cosmosis
Offline
Last seen: 9 years 9 months ago
Joined: 2012-04-20 02:12
Ah, admin rights.. That's

Ah, admin rights.. That's something that I've been thinking about lots lately. I've been running XP since it came out, and I always use an account with full rights, so my knowledge of permissions and directory structure in other Win versions leaves a lot to be desired.

Pretty much all the apps I've done have been done pretty straight-forward, so .ini goes to c:\windows and back, settings to HKLM/CU and back and so on. I think they are pretty clean, but I do wonder how they would behave in different situations. I can only do so much testing, and I don't think I have anything I can share here.

Well, at least I'm pretty happy with what I have so far.

good day all!

john62
Offline
Last seen: 2 years 9 months ago
Joined: 2019-09-25 11:24
Still in stock?

Hello cosmosis,
If you still have this app in its portable version and agree to share your work, I would enjoy to receive it. I see there is not much to do, but I don't master yet the Launcher design and cannot have it work so far.
Thanks,
J.

Log in or register to post comments