Question

I need to run my installer as admin and not system as it needs to connect to a SQL server database using windows authentication. based on my research, i need to set MSIUSEREALADMINDETECTION property to "1"

I figure that these Installer properties have a hex representation as shown in the blog at http://blogs.msdn.com/b/astebner/archive/2007/05/28/2958062.aspx

var msidbCustomActionTypeInScript = 0x00000400;
var msidbCustomActionTypeNoImpersonate = 0x00000800

The script to set the value is available here, but it does not give you hex representation of MSIUSEREALADMINDETECTION. Does anyone know the Hex representation of MSIUSEREALADMINDETECTION? Or has a better solution then editing the installer post build?

Was it helpful?

Solution

You can find the definitions of these kind of identifiers on your machine in the Windows SDK directory. You didn't mention a VS version, start looking in c:\program files (x86)\microsoft sdks\windows\x.x\include. If you have VS2012+ then start looking from Windows Kits. The MsiDefs.h file is of your interest. It contains:

// properties related to UAC
#define IPROPNAME_MSI_UAC_DEPLOYMENT_COMPLIANT TEXT("MSIDEPLOYMENTCOMPLIANT")
#define IPROPNAME_MSI_USE_REAL_ADMIN_DETECTION TEXT("MSIUSEREALADMINDETECTION")

also:

// execution scheduling flags               // default is execute whenever sequenced
msidbCustomActionTypeFirstSequence    = 0x00000100,  // skip if UI sequence already run
msidbCustomActionTypeOncePerProcess   = 0x00000200,  // skip if UI sequence already run in same process
msidbCustomActionTypeClientRepeat     = 0x00000300,  // run on client only if UI already run on client
msidbCustomActionTypeInScript         = 0x00000400,  // queue for execution within script
msidbCustomActionTypeRollback         = 0x00000100,  // in conjunction with InScript: queue in Rollback script
msidbCustomActionTypeCommit           = 0x00000200,  // in conjunction with InScript: run Commit ops from script on success

// security context flag, default to impersonate as user, valid only if InScript
msidbCustomActionTypeNoImpersonate    = 0x00000800,  // no impersonation, run in system context

You can tell from this that MSIUSEREALADMINDETECTION is not represented by a number, it is the name of a property. You set property values with MsiSetProperty(). More about properties in this MSDN section

OTHER TIPS

The better solution then editing the installer postbuild is to switch to another tool such as Windows Installer XML that doesn't hide you from the underlying Windows Installer capabilities.

FWIW, when I must do postbuild cleanups I tend to create transforms and then apply the transform to the MSI in the postbuild step. That way as my requirements change I just update the transform and don't have to change any of my postbuild code.

As far as the hex value of the MSIUSEREALADMINDETECTION property... you are over thinking it. It is 1. The other 2 that you mention are constants used in a bitmask column of the custom action and that's why they have hex values... so that they can be logically or'd.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top