Jump to content
Sign in to follow this  
blackey

Regread reg_multi_sz

Recommended Posts

blackey

I am currently trying to read a registry key that is using the reg_multi_sz format and i'm having no luck, i checked out the example, but it's very vague on a clear example.

Can anyone post a clear example for me? I've checked everywhere!

here's the registry key

[HKEY_CLASSES_ROOT\Installer\Assemblies\C:|WINDOWS|system32|CS_Components|COF|CS_PelcoDX8000DriverStartupNET.exe]

"CS_PelcoDX8000DriverStartupNET,Version=\"1.0.2327.29084\",PublicKeyToken=\"null\",Culture=\"neutral\""=hex(7):62,\

00,7d,00,6c,00,4b,00,50,00,49,00,44,00,64,00,34,00,40,00,52,00,6f,00,28,00,\

2e,00,3f,00,69,00,69,00,4b,00,56,00,57,00,3e,00,5d,00,78,00,54,00,6a,00,48,\

00,5b,00,3f,00,51,00,5f,00,40,00,4d,00,29,00,65,00,46,00,28,00,4f,00,58,00,\

4a,00,58,00,4f,00,00,00,00,00

Thanks

Share this post


Link to post
Share on other sites
ChrisL

Does this work if you put your correct key in

$key = RegRead("HKEY_CLASSES_ROOT\Installer\As...........etc")

$Split = StringSplit ($Key, @lf)

For $i = 1 to Ubound ($split) - 1
    
    MsgBox (0,"Value", $split[$i])
    
Next

Share this post


Link to post
Share on other sites
blackey

Doesn't there have to be two parameters in a regread? i.e. regread("whatever","whatever")

your example only shows one parameter, and i want to READ the value of [HKEY_CLASSES_ROOT\Installer\Assemblies\C:|WINDOWS|system32|CS_Components|COF|CS_PelcoDX8000DriverStartupNET.exe]

Share this post


Link to post
Share on other sites
blackey

Does this work if you put your correct key in

$key = RegRead("HKEY_CLASSES_ROOT\Installer\As...........etc")

$Split = StringSplit ($Key, @lf)

For $i = 1 to Ubound ($split) - 1
    
    MsgBox (0,"Value", $split[$i])
    
Next
Can you please fill out the rest of your script?

i.e. $key = RegRead("HKEY_CLASSES_ROOT\Installer\As.....fill out please......etc")

Share this post


Link to post
Share on other sites
MHz

here's the registry key

[HKEY_CLASSES_ROOT\Installer\Assemblies\C:|WINDOWS|system32|CS_Components|COF|CS_PelcoDX8000DriverStartupNET.exe]

"CS_PelcoDX8000DriverStartupNET,Version=\"1.0.2327.29084\",PublicKeyToken=\"null\",Culture=\"neutral\""=hex(7):62,\

00,7d,00,6c,00,4b,00,50,00,49,00,44,00,64,00,34,00,40,00,52,00,6f,00,28,00,\

2e,00,3f,00,69,00,69,00,4b,00,56,00,57,00,3e,00,5d,00,78,00,54,00,6a,00,48,\

00,5b,00,3f,00,51,00,5f,00,40,00,4d,00,29,00,65,00,46,00,28,00,4f,00,58,00,\

4a,00,58,00,4f,00,00,00,00,00

Thanks

Reg_Multi_sz is normally stored in Regedit different to what is stored in a reg file. A reg file will store a unicode equivalent of the entry in the best way possible, as hex data. If you disregard the reg file and get the data directly from regedit, the you will get the string representation.

The above may look like this (notice the @LF used for multiple values)

RegWrite("HKCU\SOFTWARE\Test", "TestKey1", "REG_MULTI_SZ", "%EmAj?C%k9W7cNB_.[t[Redist_Package>Cd2HfPvUY9]I?,mmJG!9")
RegWrite("HKCU\SOFTWARE\Test", "TestKey2", "REG_MULTI_SZ", "%systemdrive%" & @LF & "%programfiles%")

But if you export to a reg file, then you get this

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Test]
"TestKey1"=hex(7):25,00,45,00,6d,00,41,00,6a,00,3f,00,43,00,25,00,6b,00,39,00,\
  57,00,37,00,63,00,4e,00,42,00,5f,00,2e,00,5b,00,74,00,5b,00,52,00,65,00,64,\
  00,69,00,73,00,74,00,5f,00,50,00,61,00,63,00,6b,00,61,00,67,00,65,00,3e,00,\
  43,00,64,00,32,00,48,00,66,00,50,00,76,00,55,00,59,00,39,00,5d,00,49,00,3f,\
  00,2c,00,6d,00,6d,00,4a,00,47,00,21,00,39,00,00,00,00,00
"TestKey2"=hex(7):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,\
  76,00,65,00,25,00,00,00,25,00,70,00,72,00,6f,00,67,00,72,00,61,00,6d,00,66,\
  00,69,00,6c,00,65,00,73,00,25,00,00,00,00,00

So get the data directly from regedit.

:P

Share this post


Link to post
Share on other sites
blackey

I guess my whole question is how would i get the value of "Version" in the app i'm creating the version will be different on some computers and that's the info i'm trying to extract from this reg key.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.