Search code examples
installationwindows-installervdproj

what is Hex representation of MSIUSEREALADMINDETECTION?


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?


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