Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Modify Display columen of Feature table in runtime


1 reply to this topic

jamsek19

jamsek19
  • Full Members
  • 17 posts

Posted 20 April 2017 - 13:14

Hello.

I have a msi package which exposes features to users to select them for the installation. In one special case  one of the features must not be visible to the user, so, the user is not able to select it for installation.

 

Is it possible to implement this situation with modifying Display column of Feature table at run time?

 

I tried to change with custom action which is called before first dialog appears (InstallWelcome). The custom action is implemented in executable .dll file. An insert from CA is as follows:

hDB = MsiGetActiveDatabase(hInstall);
MsiDatabaseOpenView(hDB, _T("select * from Feature"), &hView);
MsiViewExecute(hView, 0);
while ((err = MsiViewFetch(hView, &hRec)) == ERROR_SUCCESS) {
    MsiRecordGetString(hRec, 1, feature, &fSize);
    if (strcmp(feature, "special_feature") == 0) {
        attrs = MsiRecordGetInteger(hRec, 5);
        MsiRecordSetInteger(hRec, 5, 0);
        MsiViewModify(hView, MSIMODIFY_UPDATE, hRec);
        break;
    }
}

However, running such code MsiViewModify always return 1627 - The function failed during execution regardles of type used (instead of MSIMODIFY_UPDATE I also tried MSIMODIFY_REPLACE).

I also tried to implement in a way that I open the query with SQL statement for update (instead of featching records and update them). The same error occured.

 

What I'm doing wrong? Is there maybe a fact that database is in that time in read-only mode? How can I open it in read-write mode?

 

Thanks in advance for answer!

 

Best regards,

    Andreo


Andreo

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 21 April 2017 - 14:08

MSIMODIFY_INSERT_TEMPORARY could work.

But: why can't you use feature conditions? They are an easy way to set a feature's level to 0 thus disabling and hiding it.