Handling SHIMs in Wise Package Studio
This article talks about creating and applying SHIMs to bypass UAC prompts during application launch in Windows Vista and Windows 7.
When you launch an application shortcut from Start Menu/Desktop/Quick Launch, it may prompt UAC prompt for Standard User. It can be suppressed through applying a SHIM to the main executable.
This article talks about creating a SHIM and installing/uninstalling SHIM in two different methods using Wise Package Studio:
-
Using a custom action in MSI/MST
-
Using Registry
Creating a SHIM:
Requirement: Application Compatibility Tool Kit
Open Compatibility Administrator and create a new Application Fix. Below window pops up and it has 3 fields.
- Name of the Application
- Vendor
- Executable file path [Shortcut target executable path]
Enter the information and click NEXT
Compatibility mode window, select NONE from “Operating System modes” and click NEXT
Under compatibility Fixes select the following options and click NEXT:
- EnableDEP
- RunAsAdmin
- RunAsHighest
- RunAsInvoker
- ForceAdminAccess
Click FINISH and save the shim database file [.SDB] to a location. This SDB file should be used in the Custom Action to install/uninstall.
1.Installing/Uninstalling a SHIM through CUSTOM ACTION:
A SHIM database file [.SDB] can be installed using sdbinst.exe, which is part of Operating System and exists under C:\Windows\System32
Use the Full path of the SDB file for installation and uninstallation like below:
Installation: Sdbinst.exe <PATH OF .SDB>
Uninstallation: Sdbinst.exe –u <PATH OF .SDB>
The same commandline for installation and uninstallation can be implemented using Custom Action in Wise Package Studio.
Copy .SBD file to [INSTALLDIR]. Install custom action should be DIFFERED EXECUTION IN SYSTEM CONTEXT and should be before INSTALLFINALIZE.
Uninstall custom action should be DIFFERED EXECUTION IN SYSTEM CONTEXT and should be immediately after INSTALLINITILIZE [or before REMOVEFILES custom action] as the SDB file is part of installation.
2. Installing/Uninstalling a SHIM through REGISTRY:
Step 1: Add shim (sdb file) to the package. For example: INSTALLDIR
Step 2: Add the registry (Shim.reg attached to this article) to the package as shown below:
Step 3: Edit the registry settings to the required value. Rename [FileName] to the actual name of the file which requires shim. For example: KCM310.CPL
Database Description: Name of Shim file. For example: KCM310
DatabasePath: Path to sdb file. For example: [INSTALLDIR]KCM310.sdb
Note: Shim.reg.txt file has been attached to this article. Download and rename the file to "Shim.reg" and add it to MSI/MST.
I hope this helps.
Comments 9 Comments • Jump to latest comment
I just tried the way it was explained in this article where I need to apply SHIM to bypass a prompt which is asking me for ADMIN user name and password. It just worked for me.
I'm look at your articles and they are damn useful for those who started packaging. Great job. Thank you.
Good Work Eswar :-)
Regards,
Balsaraj
http://balzqazone.wordpress.com
Can this be handled using a transform?
Bibhash Nag
Yes, ofcourse!
Thanks,
CableGuy
Do not forget to mark a SOLUTION
Your instruction:
Copy .SBD file to [INSTALLDIR]. Install custom action should be DIFFERED EXECUTION IN SYSTEM CONTEXT and should be after INSTALLFINALIZE.
I was under the impression that Deferred custom actions could only be sequenced between InstallInitialize and InstallFinalize, and not after InstallFinalize, as deferred actions are incorporated in the installation scripts which are generated after InstallInitialize and committed by the InstallFinalize action.
Also, as the custom action is making system changes, it should be before InstallFinalize. Did you intend to write that this custom action should be just BEFORE InstallFinalize rather than just after?
Cheers
EdT
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Thats a good point Ed.
Thank you for noticing. Yes, That should be BEFORE InstallFinilize.
Thanks,
CableGuy
Do not forget to mark a SOLUTION
Very Nice article, but there is one more point which I would like to add here.
The Shim Database creates an entry in Add/Remove programs and if there are a lot of shims created there will be a long list of Shim Database entries in ARP. To remove this you can add a DWORD registry key in "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{ShimProductID}.sdb\" hive as SystemComponent = 1
Piyush Nasa Altiris Certified Professional (ACP)
http://msiworld.blogspot.com/
this info really helps.
SHIMs are very useful when the shortcut that prompts UAC is part of the application main functionality. In standard user environment SHIMs are significantly useful. thanks for the article.
Would you like to reply?
Login or Register to post your comment.