get sid/get username/registry hacking (or "how much work is too much work?")
I've been packaging for about 8 months now and wanted to ask this of the more experienced packagers. I'm trying to get a sense of whether to invest more time in trying to find a solution to an exe I can't get packaged, or chalk it up as something that can't be packaged. It seems like it might be possible, but it also seems like a good many hoops to jump through, so perhaps someone knows an easier way.
The vendor provided an exe (the app is called MediaWiper, and I started a thread in the Repackager forum (http://itninja.com/question/gnu,-freeware-and-shareware-programs-to-cloning5186), initially thinking a problem existed in the MSI I was creating, but that turned out to be wrong. The vendor's exe does a non-MSI-based install, by the way.
Turns out the problem I was seeing in my MSI was present when doing the install from the vendor's exe. The problem is that the app works for the person who installed the app, but for anyone else, it throws an error that the registry is corrupt or missing information.
I've contacted the vendor, and we're at the point where I've given them all this info, and to their credit they've been responsive, but the final message is "It shouldn't work like that."
The application writes registy info to two main places: HKEY_CURRENT_USER\Software\WhiteCanyon and HKEY_USERS\[SID string]\Software\WhiteCanyon. But if I log in as a different user, that reg info doesn't exist.
So I think might be able to get the app to work if I write some sort of batch file that first checks who the current user is, gets that user's SID, then checks the HKEY_USERS hive for that SID, and if it doesn't exist, add the reg info (which I'd import and make a variable out of the SID string) accordingly. After that, the batch file would trigger the app. So I reckon I'd point any application shortcuts at my batch file. Or VB script. Or however I'd do the SID/reg jiggery-pokery.
So that's the summary. From that info, is it possible to say if my idea sounds like a workable solution, or too much work for what I'm trying to accomplish, or anyone know a possibly easier way to do it? Thanks in advance.
The vendor provided an exe (the app is called MediaWiper, and I started a thread in the Repackager forum (http://itninja.com/question/gnu,-freeware-and-shareware-programs-to-cloning5186), initially thinking a problem existed in the MSI I was creating, but that turned out to be wrong. The vendor's exe does a non-MSI-based install, by the way.
Turns out the problem I was seeing in my MSI was present when doing the install from the vendor's exe. The problem is that the app works for the person who installed the app, but for anyone else, it throws an error that the registry is corrupt or missing information.
I've contacted the vendor, and we're at the point where I've given them all this info, and to their credit they've been responsive, but the final message is "It shouldn't work like that."
The application writes registy info to two main places: HKEY_CURRENT_USER\Software\WhiteCanyon and HKEY_USERS\[SID string]\Software\WhiteCanyon. But if I log in as a different user, that reg info doesn't exist.
So I think might be able to get the app to work if I write some sort of batch file that first checks who the current user is, gets that user's SID, then checks the HKEY_USERS hive for that SID, and if it doesn't exist, add the reg info (which I'd import and make a variable out of the SID string) accordingly. After that, the batch file would trigger the app. So I reckon I'd point any application shortcuts at my batch file. Or VB script. Or however I'd do the SID/reg jiggery-pokery.
So that's the summary. From that info, is it possible to say if my idea sounds like a workable solution, or too much work for what I'm trying to accomplish, or anyone know a possibly easier way to do it? Thanks in advance.
0 Comments
[ + ] Show comments
Answers (10)
Please log in to answer
Posted by:
fuz_kitten
15 years ago
Does the app have shortcuts? If so advertise them. If not read this : http://itninja.com/blog/view/appdeploy:-articles:-activesetup
8 months without encountering CU reg - bloody hell!
C
8 months without encountering CU reg - bloody hell!
C
Posted by:
pgiesbergen
15 years ago
Posted by:
MSIPackager
15 years ago
HKEY_CURRENT_USER\Software\WhiteCanyon and HKEY_USERS\[SID string]\Software\WhiteCanyon
Hi Ron.. for info these 2 locations are the same - HKCU is simply the HKEY_USERS\[SID string] redirected.
As fuz_kitten already said, you need to look at advertising your shortcuts and using self-repair so that the CU reg keys are written before the application .exe is run for new users. If there are no shortcuts you can use active setup to deliver the CU data.
Probably worth proving it's just these reg settings that are required as pgiesbergen suggested first.
Regards,
Rob.
Posted by:
RonW
15 years ago
Hi, all. Thanks for the responses.
If I export the HKEY_CURRENT_USER\Software\WhiteCanyon key, then log in as a different user and import the reg file, the app won't work.
It will work, however, if I export the HKEY_USERS key I mentioned previously (thanks for clearing up the HKEY_USERS/CURRENT_USERS concept for me, Rob).
To make that work, I need to get some info first, which for now I'm doing manually, and would automate with some code:
1. Get current logged-in user name.
2. Get that user's SID.
3. Dump that SID into a generic reg file containing the HKEY_USERS info for the application.
4. Import that reg key key (if automating this, I'd do a check to see if that key already existed).
5. Launch the application.
pgiesbergen, I used the AppDeploy repackager to generate an MSI from the vendor's exe. I believe my MSI is installing all the program files correctly, so for now I'm done with the repackager. Also checked and there's nothing being written to the Application Data folder.
I'm not sure I understand the Advertised Shortcut solution, fuz_kitten. There are shortcuts existing that point at the app's exe in C:\Program Files...etc. So if I manage to automate the above manual steps I listed--say through a VB script, batch file, etc.--I'm guessing I'd point the existing shortcuts at that script/batch file, and have the script batch file run and then trigger the launch of the actual exe. So is that in the ballpark of what you meant?
If I export the HKEY_CURRENT_USER\Software\WhiteCanyon key, then log in as a different user and import the reg file, the app won't work.
It will work, however, if I export the HKEY_USERS key I mentioned previously (thanks for clearing up the HKEY_USERS/CURRENT_USERS concept for me, Rob).
To make that work, I need to get some info first, which for now I'm doing manually, and would automate with some code:
1. Get current logged-in user name.
2. Get that user's SID.
3. Dump that SID into a generic reg file containing the HKEY_USERS info for the application.
4. Import that reg key key (if automating this, I'd do a check to see if that key already existed).
5. Launch the application.
pgiesbergen, I used the AppDeploy repackager to generate an MSI from the vendor's exe. I believe my MSI is installing all the program files correctly, so for now I'm done with the repackager. Also checked and there's nothing being written to the Application Data folder.
I'm not sure I understand the Advertised Shortcut solution, fuz_kitten. There are shortcuts existing that point at the app's exe in C:\Program Files...etc. So if I manage to automate the above manual steps I listed--say through a VB script, batch file, etc.--I'm guessing I'd point the existing shortcuts at that script/batch file, and have the script batch file run and then trigger the launch of the actual exe. So is that in the ballpark of what you meant?
Posted by:
MSIPackager
15 years ago
Hi Ron,
I'm not convinced that this method you've outlined is worth persuing, or even if it would work at all.
Any chance you could post up the contents of the 2 different .reg exports - using the <% code tags so we could take a look?
If I were you I'd get this working manually with the vendor .exe install first before you worry about getting your msi fixed. It all sounds pretty odd to me.. any half-decent software should automatically create required CU keys on first run.
Cheers,
Rob.
I'm not convinced that this method you've outlined is worth persuing, or even if it would work at all.
Any chance you could post up the contents of the 2 different .reg exports - using the <% code tags so we could take a look?
If I were you I'd get this working manually with the vendor .exe install first before you worry about getting your msi fixed. It all sounds pretty odd to me.. any half-decent software should automatically create required CU keys on first run.
Cheers,
Rob.
Posted by:
RonW
15 years ago
Rob, just got done with some testing and I have it working manually with both the vendor's exe and the MSI I created. So assuming I can automate the manual steps I noted previously, I think this might be possible to solve.
And I have no idea why it doesn't write the CU key automatically. The vendor was thinking it was something weird about our firewall, but I ruled that out when I turned it off on my test PC and got the same result. Plus I suspect we'd have seen issues with other apps by now, too.
Here's the reg key in question I'm importing into HKEY_USERS:
And I have no idea why it doesn't write the CU key automatically. The vendor was thinking it was something weird about our firewall, but I ruled that out when I turned it off on my test PC and got the same result. Plus I suspect we'd have seen issues with other apps by now, too.
Here's the reg key in question I'm importing into HKEY_USERS:
Windows Registry Editor Version 5.00
[HKEY_USERS\[USER'S SID STRING GOES HERE]\Software\WhiteCanyon]
[HKEY_USERS\[USER'S SID STRING GOES HERE]\Software\WhiteCanyon\MW1]
"CO"="XMP-44"
"Dliubruc"="(Build 04.11.04)"
"UIL"="C:\\Program Files\\WhiteCanyon\\MediaWiper"
"Out"="2353523905"
"ProgGroup"="WhiteCanyon\\MediaWiper"
"DNS"=dword:00000000
"Update"=dword:00000000
"UpdateTime"=dword:00093a80
"LastCheck"=dword:49cba581
"ROL"=dword:00000001
Posted by:
aogilmor
15 years ago
As suggested, you may also want to have a look at Active Setup (google it if you're not sure what it is), though I agree with FuzKitten that advertised shortcut would be preferable. msi.chm (part of the Windows Installer SDK and also comes with Wise) should explain to you how to change a regular shortcut into an advertised shortcut so that it'll . You don't say what tool you use but in Wise it's easy to change the shortcut in the UI.
you're a wise man for avoiding the "SID/reg jiggery-pokery" as you put it.
you're a wise man for avoiding the "SID/reg jiggery-pokery" as you put it.
Posted by:
jmcfadyen
15 years ago
there is a tool you could use called user2sid.exe from Microsoft (formally SysInternals)
you could do something along the lines of this in registry
[HKEY_USERS\[USERSID]\Software\WhiteCanyon]
[HKEY_USERS\[USERSID]\Software\WhiteCanyon\MW1]
set objShell = CreateObject("Wscript.Shell")
strUser = objShell.ExpandEnvironmentStrings("%Username%")
strUserSid = objShell.run "..\blah\user2sid.exe /xxxx " & strUser
session.property("USERSID") = strUserSid
still personally dont see why simple HKCU healing wouldnt work, but this answers your first question whether it is right or wrong approach to handle it
you could do something along the lines of this in registry
[HKEY_USERS\[USERSID]\Software\WhiteCanyon]
[HKEY_USERS\[USERSID]\Software\WhiteCanyon\MW1]
set objShell = CreateObject("Wscript.Shell")
strUser = objShell.ExpandEnvironmentStrings("%Username%")
strUserSid = objShell.run "..\blah\user2sid.exe /xxxx " & strUser
session.property("USERSID") = strUserSid
still personally dont see why simple HKCU healing wouldnt work, but this answers your first question whether it is right or wrong approach to handle it
Posted by:
RonW
15 years ago
I wound up being able to fix this pretty quickly by modifying the MSI with Wise, making advertised shortcuts and building in the reg info to HKCU, and then adding a key to HKCR that contained the license key in encrypted form.
I realize now I probably could've avoided the step of adding in the HKCU data if I'd been set the repackager to track that registry hive in the first place.
Thanks again to all who posted with suggestions and advice.
I realize now I probably could've avoided the step of adding in the HKCU data if I'd been set the repackager to track that registry hive in the first place.
Thanks again to all who posted with suggestions and advice.
Posted by:
anonymous_9363
15 years ago
I realize now I probably could've avoided the step of adding in the HKCU data if I'd been set the repackager to track that registry hive in the first place.It's a tricky call, the one about running the app as part of a capture. Generally speaking, I do do that, if only to catch the brain-dead apps which use HKLM instead of HKCU, or write to folders in the app's folder structure instead of the user's or All User's profile. It never ceases to amaze me how many so-called "enterprise applications" are guilty of that nonsense.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.