> I tried using MsiGetProductInfo with > INSTALLPROPERTY_ASSIGNMENTTYPE, however the function returned > the error "Unknown Property". Was I supposed to use this > value with MsiGetProductInfo or is there another function I > should be using? >
This, I think, works for me: extern "C" UINT __stdcall SetInstallMode(MSIHANDLE hInstall) { TCHAR buf[MAX_PATH+1]; DWORD buflen = sizeof(buf)/sizeof(TCHAR); //+1 for trailing null BOOL bResult = FALSE; if ( MsiGetProperty(hInstall,TEXT("UpgradeCode"),buf,&buflen) == ERROR_SUCCESS ) { TCHAR szProductCode[64]; // buffer for product code string GUID, 39 chars DWORD dwIndex=0; BOOL fPerMachine = FALSE; while ( ::MsiEnumRelatedProducts(buf,0,dwIndex,szProductCode) == ERROR_SUCCESS ) { TCHAR szAssignmentType[10] = {0}; DWORD cchAssignmentType = sizeof(szAssignmentType)/sizeof(szAssignmentType[0]); // Determine assignment type of product // This indicates whether the product // instance is per-user or per-machine if (ERROR_SUCCESS == MsiGetProductInfo(szProductCode,INSTALLPROPERTY_ASSIGNMENTTYPE,szAssignmentT ype,&cchAssignmentType)) { // 0=>Per user, 1=> per machine.. if ('1' == szAssignmentType[0]) fPerMachine = TRUE; } dwIndex++; } // If anything is permachine, then set ALLUSERS=1 (admin mode). if ( fPerMachine ) { ::MsiSetProperty(hInstall,TEXT("ALLUSERS"),TEXT("1")); } } return 0; } Someone can now tell me what's wrong with it before we release the next version of our product <g> (though it doesn't look like my style of coding so I probably got it from somewhere on the web). Pete Cole. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users