11/12/2009 3255 views
How do I get the package filename in the registry.

After repackaging, we only have to rename the msi file and register the new name in the register.

At this moment we use the package studio.
0 Comments   [ + ] Show comments


Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

All Answers

I did not understand exactly, but if you want any name to display in registry, then you can use property.
Answered 11/12/2009 by: Yaduveer
Orange Senior Belt

If I'm catching your drift have a look in the registry at HKCR\Installer\Products\<GUID>\SourceList

the reason why I say <GUID> and not <ProductCode> is that a permutation is actually done to get this value from your ProductCode

if your ProductCode is ABCDEFGH-IJKL-MNOP-QRST-UVWXYZ123456 then this GUID will be HGFEDCBA-LKJI-POMN-RQTS-VUXWZY214365 (without the dashes actually)

And now I have a headache :p

Answered 11/12/2009 by: pjgeutjens
Red Belt

Does anyone know why MS thought that "packing" GUIDs was a good idea? What purpose can it actually serve, apart from saving a few bytes storing fewer dash and brace characters?

Anyway, here's some code to ease your headache. It's not mine originally: I pinched from InstallSite.org and tidied it up a bit.strCode = "{24B76264-FE15-4A02-B4FE-E527003E6FB9}"
strMungedCode = "B38F40E19BA21034E97F8E36707FC927"

Call MungeGUID(strCode, strMungedCode)
WScript.Echo strCode & " munged becomes " & strMungedCode

Call UnMungeGUID(strMungedCode, strCode)
WScript.Echo strMungedCode & " unmunged becomes " & strCode

Sub MungeGUID(ByVal strGUID, ByRef strMungedCode)
'// This routine munges the GUID into the munged format
'// used by various registry entries for Windows Installer
'// For example: {D650B8A9-C547-42D3-A7DF-0FAD0AC6E9ED}
'// becomes
'// 9A8B056D745C3D247AFDF0DAA06C9EDE

Dim arrSortOrder
Dim strNewCode
Dim intIndex

arrSortOrder = Array(9,8,7,6,5,4,3,2,14,13,12,11,19,18,17,16,22,21,24,23,27,26,29,28,31,30,33,32,35,34,37,36)

'// Generate the munged code
For intIndex = 0 To UBound(arrSortOrder)
strNewCode = strNewCode & Mid(strGUID,arrSortOrder(intIndex),1)

strMungedCode = strNewCode
End Sub

Sub UnMungeGUID(ByVal strMungedCode, ByRef strGUID)
'// This routine reconstructs a GUID from the munged format
'// used by various registry entries for Windows Installer
'// For example: 9A8B056D745C3D247AFDF0DAA06C9EDE
'// becomes
'// {D650B8A9-C547-42D3-A7DF-0FAD0AC6E9ED}

Dim arrSortOrder
Dim intIndex
Dim strPartTemp
Dim strPart1
Dim strPart2
Dim strPart3
Dim strPart4
Dim strPart5

'// Part 1
strPartTemp = Left(strMungedCode, 8)
strPart1 = StrReverse(strPartTemp)

'// Part 2
strPartTemp = Mid(strMungedCode, 9, 4)
strPart2 = StrReverse(strPartTemp)

'// Part 3
strPartTemp = Mid(strMungedCode, 13, 4)
'// Excuse me! May I borrow these variables for a moment?
strPart3 = Left(strPartTemp, 2)
strPart4 = Right(strPartTemp, 2)
strPart3 = StrReverse(strPart4) & StrReverse(strPart3)

'// Now deal with part 4 properly
strPartTemp = Mid(strMungedCode, 17, 2)
strPart4 = Mid(strMungedCode, 19, 2)
strPart4 = StrReverse(strPartTemp) & StrReverse(strPart4)

strPartTemp = Mid(strMungedCode, 21, 12)

arrSortOrder = Array(2,1,4,3,6,5,8,7,10,9,12,11)

'// Generate the product code
For intIndex = 0 To UBound(arrSortOrder)
strPart5 = strPart5 & Mid(strPartTemp,arrSortOrder(intIndex),1)

strGUID = ""
strGUID = strGUID & "{"
strGUID = strGUID & strPart1
strGUID = strGUID & "-"
strGUID = strGUID & strPart2
strGUID = strGUID & "-"
strGUID = strGUID & strPart3
strGUID = strGUID & "-"
strGUID = strGUID & strPart4
strGUID = strGUID & "-"
strGUID = strGUID & strPart5
strGUID = strGUID & "}"
End Sub
Answered 11/13/2009 by: VBScab
Red Belt

I was just gonna say, until I saw VBScab's post, that we wrote a function to convert ProductCode to the encoded/munged product code. Our code looks just about as ugly. Probably uglier, actually.

I think Microsoft, much like Stretch Bart Simpson, likes to use their powers to annoy.

Going back to the original post, we're neglecting to ask a very basic question: WHY? Why would you want to change the msi filename after it's been registered? Why not rename the file before you install it?

All the Best Practices champions should be telling you not to mess with the Windows Installer registry, right?
Answered 11/16/2009 by: mazessj
Blue Belt

I don't think the OP wants to change anything, but to get the original MSI name.
Answered 11/17/2009 by: VBScab
Red Belt

Why not just parse the OriginalDatabase property?
Answered 11/17/2009 by: AngelD
Red Belt