Quantcast
Channel: VMware Communities : Discussion List - vSphere Client SDK
Viewing all articles
Browse latest Browse all 2218

ThinApp.VRegValue 'data' incorrectly padded with null byte when original REG_SZ data is of even length

$
0
0

Utilizing the currently available version of the ThinApp SDK, the following VB results in incorrect reads of registry strings when the original string is even in length -- a single null bye (0x00) appears to be appended:

 

Sub RegDump(PackageName, Hive, Key)
  Set Management = WScript.CreateObject("ThinApp.Management")
  Set Package = Management.OpenPackage(PackageName)
  Set VREG = Package.GetVRegistryObject(0)
  RegWalk(VREG.OpenKey(Hive, Key))
End Sub


Sub RegWalk(Key)
  For Each Subkey in Key.Subkeys
    RegWalk(Subkey)
  Next
  WScript.StdOut.WriteLine("[" & Key.Name & "]")
  For Each Value in Key.Values
    Select Case Value.Type
      Case 1
        WScript.StdOut.WriteLine(chr(34) & Value.Name & chr(34) & "=" & chr(34) & Value.Data & chr(34))
    End Select
  Next
  WScript.StdOut.WriteLine
End Sub

 

Set Args = WScript.Arguments
If Args.Count <> 3 Then
  WScript.StdErr.Write("Usage: Dump <PhysicalPackageName> <Hive> <Key>")
  WScript.Quit
End If

 

RegDump Args(0), Args(1), Args(2)

 

I've reproduced this with several ThinApp packages.  For example, with Safari, the following registry key exists on my target:

 

[HKLM\SOFTWARE\Classes\Installer\Products\28669D9CD4A5AF54ABE3DDBCB2C08B86]
"ProductName"="Safari"
"PackageCode"="98384DD02DEB64B428E3F42707E739CC"
"ProductIcon"="%SystemRoot%\Installer\{C9D96682-5A4D-45FA-BA3E-DDCB2B0CB868}\Installer.ico"

 

But, when read from the ThinApp package, I get the following (I've `cat -e`'d this to show the actual escape characters present):

 

[HKLM\SOFTWARE\Classes\Installer\Products\28669D9CD4A5AF54ABE3DDBCB2C08B86]^M$
"ProductName"="Safari^@"^M$
"PackageCode"="98384DD02DEB64B428E3F42707E739CC^@"^M$
"ProductIcon"="%SystemRoot%\Installer\{C9D96682-5A4D-45FA-BA3E-DDCB2B0CB868}\Installer.ico"^M$

 

As you can see, the ProductName and PackageCode values, both of which are even in length, have 0x00 appended.  ProductIcon, which is odd in length, does not.


Viewing all articles
Browse latest Browse all 2218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>