WIX - Automatically detect and install MS KB patch - wix

I am attempting to modify a WIX installer package so that it can detect the presence of a specific Microsoft Knowledge Base patch/update, and then offer the user a chance to download and install it on-the-fly if the patch is not detect. My order of operations would be:
Detect if user is installing on Windows 8.1 or not (trivial, compare against VersionNT).
Detect if KB 2883200 is already installed.
If detected, provide a dialogue box offering the chance to download and install the package.
Steps 2 and 3 aren't 100% obvious to me. I've found a possible solution via another StackOverflow post, but I don't understand why both a hash and the KB number need to be provided. eg:
Sample Function
public static bool IsPatchAlreadyInstalled(string productCode, string patchCode)
{
var patches =
PatchInstallation.GetPatches(null, productCode, null, UserContexts.Machine, PatchStates.Applied);
return patches.Any(patch => patch.DisplayName == patchCode);
}
Use
IsPatchAlreadyInstalled("{F5B09CFD-F0B2-36AF-8DF4-1DF6B63FC7B4}", "KB2468871");// .NET Framework 4 Client Profile 64-bit
IsPatchAlreadyInstalled("{8E34682C-8118-31F1-BC4C-98CD9675E1C2}", "KB2468871");// .NET Framework 4 Extended 64-bit
IsPatchAlreadyInstalled("{3C3901C5-3455-3E0A-A214-0B093A5070A6}", "KB2468871");// .NET Framework 4 Client Profile 32-bit
IsPatchAlreadyInstalled("{0A0CADCF-78DA-33C4-A350-CD51849B9702}", "KB2468871");// .NET Framework 4 Extended 32-bit
So, the first part of my question would be: How can I use the code above to detect if the KB 2883200 patch is installed, and how do I generate the appropriate hash/UUID for the first argument passed to the function?
Next, I am trying to make a modal dialogue box appear, offering the user the chance to install the patch? If the user goes "Back" in the installer, I'd like the dialogue to re-appear when reaching the appropriate step again, in case they accidentally declined the offer to install the driver.
For the second and final part of my question: how do I provide such a dialogue box, and is there any existing method to download and install a MS KB patch through the installer, or do I have to implement my own methods from scratch?
Thank you.

The dialog box will be a dialog that you insert in the MSI UI sequence and show it if the update isn't installed, an publish the dialog with a condition. A potential issue with doing any of this in the UI sequence is that you won't be elevated, so if elevated privileges are required for this you may be in some difficulty.
I think Tom's suggestion is the way to do this - make it a prerequisite for which you build you own executable to check for it, integrate that with Burn.
Either way, to check for and install the update I'd use the Windows Update API. The update is available through Windows Update, and this kind of thing tells you if the update is applicable to a particular system and will also download it:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa387102(v=vs.85).aspx

Related

Inno Setup - About #define

In my script, there is a definition as (#define AppSize) -ignore brackets-.
This definition describes size of application which is installed.
But, my setup includes three applications and installations of these apps are optional.
I mean, if the user checks App A checkbox; App A will be installed. If the user checks App B...
So, how to set AppSize according to selected applications?
You can look into my asked question here.
For check box use component part and select size from there.

how to add command line parameter in Wix

I have been looking for a good answer for my following simple enough question.
I have an interactive Wix installer, which works perfect. The user needs to accept the licence agreement in the interactive setup to carry on the setup. Now, I need to have a silent installer where the user will accept the same licence agreement by entering a command line parameter like ACCEPT-EULA=YES.
Could anyone please guide me how I should manage to implement this in wxs file? I am not using MSVC by the way. I have tried
<util:XmlFile Action="setValue" ...
but got tons of different sort of errors.
I'd greatly appreciate any help.
Thanks.
You want an error custom action scheduled first in the install execute sequence with a condition of UILevel < 5 and Not ACCEPTEULA~="YES"`
The UILevel property is defined here. 5 means full UI so you don't want this CA to run. < 5 means some form of silent installation so you only want this custom action to fire when the property doesn't equal (case insensitive) "yes".
<CustomAction Id="RequireEulaWhenSilent" Error="You must accept the EULA by passing ACCEPTEULA=YES when performing a silent installation."/>
<InstallExecuteSequence>
<Custom Action="RequireEulaWhenSilent" Before="AppSearch"><![CDATA[UILevel<5 and Not ACCEPTEULA~="YES" and Not Installed]]></Custom>
</InstallExecuteSequence>
Of course you now have a problem that if they aren't logging the install they won't know why the installer failed. Personally I think this is an invented requirement by upper management and I always push back when given this problem. Otherwise you get into crazy land like this.
I sort of agree with Chris, reject this requirement and put the license agreement inside the main application EXE file with a flag per user for whether the particular user has seen and accepted the license agreement or not.
This is assuming that this is really important legally, because it is a serious annoyance to every user in my opinion. However, arguably having a system administrator accept the license agreement on every user's behalf is probably not great legally. I am not sure how this is handled by larger companies actually. You can certainly ask your marketing and sales guys what they think of this - it is their issue.
I think the conditions suggested could work, but it all depends on where you put the custom action in the sequence, whether you use major upgrade patches or similar unusual things. Ideally you should condition so tightly that the action can only run when it is really intended.
Test at least these scenarios:
Fresh install, both silent and interactive
Major upgrade, both silent and interactive
Uninstall, both silent and interactive
Modify (start from Add/Remove Programs)
And use the MSI condition cheat sheet to help you.

How to find installed user of msi?

We need to find the user who has installed msi using powershell.
I was trying to search via HKEY_USERS ,but it is providing sid of the user not the user name of who installed the msi.
Is there any way to find the Installed user ?
(If you have a sid, you can find out the user name, why not?)
But the best way, if the msi is yours, is to save that information during the setup in a registry value, or .ini file you can read out later.
There are two properties, "LogonUser", and "USERNAME", the latter is the user really installing.
If you have no influence on the msi itself, I am not sure, if it is so easy. Interpreting sids seems a good way then.
Nevertheless:
The standard way is to use the API routines MsiGetProductInfo() or MsiGetProductInfoEx(). You can google in MSDN. But I am not sure if they always contain information if these data were not registered during setup dialog. So maybe they are empty after a silent install if there was no registration dialog? I have never used them to find the user who has installed as software. Normally in own setups this is done with explicit dialogs or actions.
One of the way might be by using reg key but there is a function in the windows installer API called MsiEnumProductsEx
you have to specify User SID it querys and checks all installed product for all users

Windows 8 store package fails on WACK when login to developer account

I'm trying to put a simple app on windows store. I made a fail attempt once, I submitted an app which failed to pass WACK, eventually it failed on submission too. Even then, when I try to package an app with my developer account logged in, I get a performance launch error.
Even on a blank app. also right after I create package logged in, my app's package name and provider fields on appmanifest are changes too. app's package name changes to the first app I submitted, and the provider changes to I guess my developer account's key.
I deleted my failed submission on dashboard, deleted all the names I reserved, including the failed one. But even when I reserve a new name and package my app with that name, my package name still changes to the very first one and fails on wack.
BUT, when I create package of my app WITHOUT logging in, I mean without associate with windows store, I can package my app with the name I want and pass the WACK. I hope anyone can help me with this.
Edit: C# application.
I had this happen too, it seems like WACK got confused and kept trying to verify the wrong version. The following steps resolved it for me:
Uninstall the app from your development PC (as in, go to start page,
right click on the app and select uninstall).
Reboot the dev PC.
Select "Local Machine" and "Release".
Start debugging wait for it to
have started up completely and then stop debugging.
Pretty sure that only one or two of those steps are actually needed, but not sure which ones.
I'm not completely sure I understand your issue, but let me try...
First, what is the failure that you got when you submitted to the Store and when you ran the WACK? You mentioned a "performance launch error". If you are failing the performance test, check out this article for tips to help. Some examples:
Package content locally (or cache it) when possible, so you don’t have to pull resources from a network during launch.
Load and do only what you need on launch. You can load other data and do other work asynchronously in the background or when you actually need it.
Use a "dirty bit" when saving data on suspend, so you only save data that has changed. (Rather than re-serializing your app’s state if that data hasn’t changed, create a Boolean flag variable (or “dirty bit”) which signals that your data has been modified, and only re-serialize when the data has changed.)
Use bytecode caching if you are developing in JavaScript, so each JS file has bytecode created once and not every time the app launches. To enable this, make sure all JavaScript files are UTF8 encoded with a byte-order mark (BOM) and are statically referenced in the root of your HTML start page.
If this is not the error that the WACK and your Store certification is failing with, please see this blog post and the related blog posts that it links to, to see if your failure is covered there.
Secondly, your issue with associating your code with your reserved name in the Windows Store:
also right after I create package logged in, my app's package name and
provider fields on appmanifest are changes too.
This behavior is expected. When you associate your app package with the Windows Store, it will change the "Package name" and the publisher in your appxmanifest. But that's okay! The "Package name" is just what the Windows Store uses as an internal identifier for your app package, and the "Package display name" (right below it in the appxmanifest) is what your end users will see. Set the "Package display name" to what you want.

screen recorder tools - open source/integrated with test management

I have a two-part question:
1) what are available for open source 'screen recorder' tools? Here is what I got so far, but I have not evaluated them yet as I'm trying to collect the list first:
http://camstudio.org/
http://code.google.com/p/zscreen/
http://shutter-project.org/
http://getgreenshot.org/
http://autoscreen.sourceforge.net/
http://sourceforge.net/projects/capturedit/
2) Is there any test management/manual test software that currently uses screen recorders with manual testing to record what the tester does during each test case (instead of requiring them to manually print-screen one step at a time).
Intent is to find a better way to, screen-by-screen, see what gets entered on the 'screens' throughout the test case cycle to help with problem identification if a problem occurs. 'Screens' could be identified as either web-based (traditional or ajax) or thick-client (java, .net, whatever).
Try recordmydesktop and gtk-recordmydesktop. It simple, lightweight and will give u a nice video screencast. Just install and press the stop or play button from your panel, videos will be saved in *.ogv formats.
$ sudo apt-get install recordmydesktop gtk-recordmydesktop