/build/static/layout/Breadcrumb_cap_w.png

Having issues writing multiple line string value in a REG_SZ(Not reg_multi_sz) reg key

Hello all,
Thanks in advance for looking into the post.

I'm currently trying to package "Password agent 2016". The application asks for a license key with 3 lines. I need to create a reg key(license key) to create a package for deployment.

Sample License:

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Moon Software\Password Agent]
"Version"="16.10.10"
"Dir"="C:\\Program Files\\Moon Software\\Password Agent 2016\\"

"LicenseKey"="AAA

aasd54asd-dasd57asd-asd85a7d

asd5a4sdasd-asdas54dasd65asd"

I've tried the following but couldn't find a solution.

1. Adding the license key manually into the application and try to extract the reg key once registered: I've exported the key but having trouble installing it again since the registry editor doesn't take REG_SZ as multiline string.

2. Merging all the lines into a single line value: This is not accepted by the application as a license key.

3. Tried to convert it to a hexadecimal value and tried to install it. Example: "LicenseKey"=hex(1): 45,00,45,00,24,00,0d,0a,00.........". Got some progress with this but when I tried to install it using vbs/cmd or any script with Admin/System rights, it doesn't work. But when I install it with regedit /s "<regpath>.reg" command inside command prompt manually with admin/system rights, it works just fine.

4. Tried adding /n/r/t to each line. No luck on that as well.


Not to confuse you guys but I just need to install the license key with a multiple lined string value installed using a script.


Please help me out with this.

Thanks,

Sai




0 Comments   [ + ] Show comments

Answers (1)

Answer Summary:
Posted by: anonymous_9363 6 years ago
Red Belt
1

Top Answer

when I install it with regedit /s "<regpath>.reg" command inside command prompt manually with admin/system rights, it works just fine.
So why not simply create a script that runs that command line and run it with admin rights?!?

If you want a more elegant approach (and possibly obfuscation of the key itself) and use a script, you could just add 'vbCRLF' to each line (for VBS) or ASCII 13 + ASCII 10 in some other languages.

Comments:
  • Using the regedit /s command works but the key format is not as expected. vbCRLF worked for me. Thanks, VBScab. - sais 6 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ