You are here

RegistryValueWrite help

13 posts / 0 new
Last post
Lexal
Lexal's picture
Offline
Last seen: 10 years 9 months ago
Joined: 2010-01-17 19:42
RegistryValueWrite help

I have some CLSID keys that have to be nulled on start OR deleted.
How i can do that? I found examples but are to messy to understand them.

My registy keys:

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}]
@="Borland Midas DSCursor 1"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}\InProcServer32]
@="F:\\Odkurzacz13Portable\\App\\Odkurzacz\\MIDAS.DLL"
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}\ProgID]
@="Borland.Midas_DSCursor.1"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}\VersionIndependentProgID]
@="Borland.Midas_DSCursor"

---------------------------------------
They are needed to be deleted before application start, they cause errors.

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2010-09-16 07:28
Not entirely sure...

I'm not entirely sure, but this should explain it.

[RegistryKeys]:
If you do not wish to save the data of the registry key to a file but only want to keep it safe and throw away any changes, set the “file name” to -, so you end up with -=registry key location.

If the value already exists because the app is already locally installed, it'll get backed up in registry thus 'removing' those keys. If the keys don't exist they won't be left behind.

-=HKCR\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}

try it with a self made value first (insert in yourself), in that way you won't break anything important Smile

Yes, I set the working directory!

Lexal
Lexal's picture
Offline
Last seen: 10 years 9 months ago
Joined: 2010-01-17 19:42
Local or portable application

Local or portable application is reading those keys, and when app don't find midas.dll in given directory i get error, when keys are deleted or empty, app is creating new ones. That why i need to delete them before launcher starts app.

I need just add
-=HKCR\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
after [RegistryKeys]?

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2010-09-16 07:28
Try it out!

That's what I'd think from reading the manual Smile
Try it out!

you could also backup the keys to a .reg file and then using [FileWriteN]'s Replace function to make the value point to the right place.

like this:

; changing the drive letter
[FileWrite1]
Type=Replace
File=%PAL:DataDir%\settings\regfile.reg
Find=%PAL:LastDrive%
Replace=%PAL:Drive%

; changing the path
[FileWrite2]
Type=Replace
File=%PAL:DataDir%\settings\regfile.reg
Find=%PAL:LastPackagePartialDir%
Replace=%PAL:PackagePartialDir%

Yes, I set the working directory!

Lexal
Lexal's picture
Offline
Last seen: 10 years 9 months ago
Joined: 2010-01-17 19:42
That don't works. I nulled

That don't works. I nulled needed registy keys and have still error. They need to be deleted before start.

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2010-09-16 07:28
read above post..

You say that the paths have to be updated to be portable, right?
Simply change the paths whenever the app gets moved, like I said in above post.

Yes, I set the working directory!

Lexal
Lexal's picture
Offline
Last seen: 10 years 9 months ago
Joined: 2010-01-17 19:42
Path need to be updated to

Path need to be updated to current.

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}\InProcServer32]
@="patch/midas.dll"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}\InProcServer32]
@="patch/midas.dll"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}\InProcServer32]
@="patch/midas.dll"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}\InProcServer32]
@="patch/midas.dll"
[HKEY_CLASSES_ROOT\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\0\win32]
@="patch/midas.dll"
[HKEY_CLASSES_ROOT\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\HELPDIR]
@="patch/app/appname"

All those keys need to be updated/deleted.
IDK WHY THEY DONT COPY TO REG FILE -.-

Lexal
Lexal's picture
Offline
Last seen: 10 years 9 months ago
Joined: 2010-01-17 19:42
I give up. IDK what the hell

I give up. IDK what the hell is wrong, keys that should be force deleted from registry are still remaining there -.- odk.reg is created but dynamic*.reg are not WTF?

[Launch]
ProgramExecutable=Odkurzacz\odkurzacz.exe

[Activate]
Registry=true

[RegistryKeys]
odk=HKCU\Software\FranmoSoftware
odk=HKCU\Software\FranmoSoftware\Odkurzacz
odk=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia
odk=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia\Konta
dynamic=HKCR\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
dynamic=HKCR\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}\InProcServer32
dynamic1=HKCR\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
dynamic1=HKCR\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}\InProcServer32
dynamic2=HKCR\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
dynamic2=HKCR\Wow6432Node\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}\InProcServer32
dynamic3=HKCR\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
dynamic3=HKCR\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}\InProcServer32
dynamic4=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}
dynamic4=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0
dynamic4=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\HELPDIR
dynamic4=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\0
dynamic4=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\0\win32
dynamic4=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\HELPDIR

[RegistryCleanupForce]
1=HKCU\Software\FranmoSoftware
2=HKCR\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
3=HKCR\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
4=HKCR\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
5=HKCR\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
6=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}

[FileWrite]
Type=INI
File=%PAL:DataDir%\settings\
Section=HKCU\Software\FranmoSoftware
Section=HKCU\Software\FranmoSoftware\Odkurzacz
Section=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia
Section=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia\Konta
Section=HKCR\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
Section=HKCR\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}\InProcServer32
Section=HKCR\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
Section=HKCR\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}\InProcServer32
Section=HKCR\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
Section=HKCR\Wow6432Node\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}\InProcServer32
Section=HKCR\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
Section=HKCR\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}\InProcServer32
Section=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}
Section=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0
Section=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\HELPDIR
Section=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\0
Section=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\0\win32
Section=HKCR\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}\1.0\HELPDIR

This need to be done before i start adding path updating sections BUT IT DONT WORKS....

Bennieboj
Bennieboj's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2010-09-16 07:28
First this:HKEY_CLASSES_ROOT

First this:
HKEY_CLASSES_ROOT (HKCR) – a virtual hive constructed of an amalgamation of HKEY_LOCAL_MACHINE\Classes and HKEY_CURRENT_USER\Classes (HKEY_CURRENT_USER\Classes takes precedence). In your launcher configuration you should use HKCU\Classes for this value instead.

What this means is: every key that you see inside HKEY_CLASSES_ROOT has a is in fact somewhere else, either in HKEY_LOCAL_MACHINE\Software\Classes or HKEY_CURRENT_USER\Software\Classes.
Go find that key first, it's that value that you have to use, not the one in HKCR.

From your code I suppose you want to backup the values inside
HKCR\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
All you have to do is save them to a .reg file first.
Export HKCU\Software\FranmoSoftware\Odkurzacz to odk.reg.
Export ******************\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64} to save.reg. Where those stars are one of the 2 options from above.
Then you place them into the Data\settings\
Then you delete both those keys, do make sure you backed them up right, otherwise PAL will simply restore the old values.

This should be your code.

[RegistryKeys]
odk=HKCU\Software\FranmoSoftware\Odkurzacz
save=******************\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}

[RegistryCleanupIfEmpty]
1=HKCU\Software\FranmoSoftware

Hope this helps Smile

Yes, I set the working directory!

Lexal
Lexal's picture
Offline
Last seen: 10 years 9 months ago
Joined: 2010-01-17 19:42
Lolz, i know lots about

Works at last Biggrin

[Launch]
ProgramExecutable=Odkurzacz\odkurzacz.exe
RunAsAdmin=force

[Activate]
Registry=true

[RegistryKeys]
odk=HKCU\Software\FranmoSoftware
odk=HKCU\Software\FranmoSoftware\Odkurzacz
odk=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia
odk=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia\Konta

[RegistryCleanupForce]
1=HKCU\Software\FranmoSoftware
2=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
3=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
4=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}
5=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
6=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
7=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
8=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}
9=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
10=HKLM\SOFTWARE\Classes\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}

[FileWrite]
Type=INI
File=%PAL:DataDir%\settings\
Section=HKCU\Software\FranmoSoftware\Odkurzacz
Section=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia
Section=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia\Konta

[FileWrite1]
Type=Replace
File=%PAL:DataDir%\settings\classesx86.reg
Find=%PAL:LastDrive%
Replace=%PAL:Drive%

[FileWrite2]
Type=Replace
File=%PAL:DataDir%\settings\classesx86.reg
Find=%PAL:LastPackagePartialDir%
Replace=%PAL:PackagePartialDir%

[FileWrite3]
Type=Replace
File=%PAL:DataDir%\settings\classesx64.reg
Find=%PAL:LastDrive%
Replace=%PAL:Drive%

[FileWrite4]
Type=Replace
File=%PAL:DataDir%\settings\classesx64.reg
Find=%PAL:LastPackagePartialDir%
Replace=%PAL:PackagePartialDir%

All is good, but have one question, how to disable that popup when dir was changed?

http://s1.bild.me/bilder/160512/1429587prompt.png

Ken Herbert
Ken Herbert's picture
Online
Last seen: 50 min 9 sec ago
DeveloperModerator
Joined: 2010-05-25 18:19
You need DirectoryMoveOK=yes

You need DirectoryMoveOK=yes to prevent that warning.

Lexal
Lexal's picture
Offline
Last seen: 10 years 9 months ago
Joined: 2010-01-17 19:42
Thanks all 4 help!

Thanks all 4 help!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 10 months ago
Joined: 2007-04-15 21:08
Bad stuff

You've got a few bad things in there:

[RegistryKeys]
odk=HKCU\Software\FranmoSoftware
odk=HKCU\Software\FranmoSoftware\Odkurzacz
odk=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia
odk=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia\Konta

Keys should be unique. In this case, it looks to me like you probably want this:

[RegistryKeys]
odk=HKCU\Software\FranmoSoftware\Odkurzacz

[RegistryCleanupIfEmpty]
1=HKCU\Software\FranmoSoftware

(I have selected HKCU\Software\FranmoSoftware\Odkurzacz as the key you're actually wanting to grab. I assume FranmoSoftware remains empty other than the Odkurzacz key.)

[RegistryCleanupForce]
1=HKCU\Software\FranmoSoftware
2=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
3=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
4=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}
5=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
6=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
7=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
8=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}
9=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
10=HKLM\SOFTWARE\Classes\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}

You should absolutely not be doing that! That will break a local installation badly. That isn't the sort of management you want.

Also be aware that using HKLM\SOFTWARE\Classes may or may not cut it. It depends on whether the software you're dealing with works in HKLM or HKCU. If it can use HKCU, use HKCR and I believe you'll cover both. (I'm actually not quite certain of the behaviour; I've never traced it through. There's a possibility it'd take from HKLM and put into HKCU.)

You want [RegistryKeys] with the key - (as mentioned in the manual). That's an exception to what I was saying earlier: it is permitted to have duplicate keys. (Off-hand, though, I believe it's the only thing in PAL which can.) Merge it with the other RegistryKeys section. (You can't duplicate a section.)

-=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
-=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
-=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}
-=HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
-=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}
-=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA3-591C-11D0-BF52-0020AF32BD64}
-=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA5-591C-11D0-BF52-0020AF32BD64}
-=HKLM\SOFTWARE\Classes\CLSID\{9E8D2FA7-591C-11D0-BF52-0020AF32BD64}
-=HKLM\SOFTWARE\Classes\TypeLib\{83F57D68-CA9A-11D2-9088-00C04FA35CFA}
[FileWrite]
Type=INI
File=%PAL:DataDir%\settings\
Section=HKCU\Software\FranmoSoftware\Odkurzacz
Section=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia
Section=HKCU\Software\FranmoSoftware\Odkurzacz\Ustawienia\Konta

Huh? This Angel doesn't do anything because [FileWrite] isn't a valid section [FileWriteN], and (b) has no meaning as it's incomplete (bad File entry, lacking a Value value and with multiple values for Section).

[FileWrite1]
Type=Replace
File=%PAL:DataDir%\settings\classesx86.reg
Find=%PAL:LastDrive%
Replace=%PAL:Drive%

[FileWrite2]
Type=Replace
File=%PAL:DataDir%\settings\classesx86.reg
Find=%PAL:LastPackagePartialDir%
Replace=%PAL:PackagePartialDir%

[FileWrite3]
Type=Replace
File=%PAL:DataDir%\settings\classesx64.reg
Find=%PAL:LastDrive%
Replace=%PAL:Drive%

[FileWrite4]
Type=Replace
File=%PAL:DataDir%\settings\classesx64.reg
Find=%PAL:LastPackagePartialDir%
Replace=%PAL:PackagePartialDir%

You don't have a classesx86 or a classesx64 in [RegistryKeys] so these do absolutely nothing (Data\settings\classesx86.reg won't exist). You should remove these as they serve no purpose. Those sorts of type library and DLL server registrations do not need to be saved (which is why the keys were - rather than something else).

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

Log in or register to post comments