This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: MSI Database Access leaks handles
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 02, 2009
02:34 AM
MSI Database Access leaks handles
Hi I have some custom Tables where I store wich Features is aviable for a serial number.
Of course I have to select this Information out of the Database and update the Installation. I do this with a custom action when it finishes i get the following logging and the feature selection page is messed up.
I get a leaked handles for each record i get and for each open view.
What do i need to do to fix the custom action?
function checkSerial(hMSI)
HWND hDb,hView,hRecord,hupdate,hupdateRecord;
STRING serial,dbserial,feature,featurelevel;
NUMBER nvSize,index,state1,state2,result;
BOOL found;
begin
MsiGetProperty(hMSI,"PPM_SERIAL",serial,nvSize);
StrToUpper(serial,serial);
//remove blanks at the end
index = StrFind(serial," ");
while(index > -1)
StrSub(serial, serial,0,index);
index = StrFind(serial," ");
endwhile;
//
if (serial == "") then
MsiSetProperty(hMSI,"SERIAL_VALID","0");
if (SELECTED_LANGUAGE = DEU) then
MessageBox("Keine Seriennummer eingegeben!",WARNING);
else
MessageBox("No Serial entered!",WARNING);
endif;
else
hDb = MsiGetActiveDatabase(hMSI);
MsiDatabaseOpenView(hDb,"select * from PPM_Customer" , hView);
MsiViewExecute(hView, NULL);
found = FALSE;
// for each Property record, add PROPNAME="value" record to ListBox table
while (MsiViewFetch(hView, hRecord) != ERROR_NO_MORE_ITEMS && found != TRUE)
MsiRecordGetString(hRecord, 1, dbserial, nvSize);
found = serial == dbserial;
endwhile;
MsiViewClose(hView);
if (found) then
//Seriennummer is valid
MsiSetProperty(hMSI,"SERIAL_VALID","1");
//activate aviable Features
MsiDatabaseOpenView(hDb,"select * from PPM_Features where Customer = '" + serial+"'" , hView);
MsiViewExecute(hView, NULL);
while (MsiViewFetch(hView, hRecord) != ERROR_NO_MORE_ITEMS)
MsiRecordGetString(hRecord, 3, feature, nvSize);
MsiRecordGetString(hRecord, 4, featurelevel, nvSize);
MsiSetProperty(hMSI,feature,featurelevel);
endwhile;
MsiViewClose(hView);
MsiDoAction(hMSI,"CostFinalize");
else
MsiSetProperty(hMSI,"SERIAL_VALID","0");
if (SELECTED_LANGUAGE = DEU) then
MessageBox("Seriennummer nicht gültig!",WARNING);
else
MessageBox("Serial not valid!",WARNING);
endif;
endif;
endif;
return 0;
end;
MSI (c) (10:C0) [08:59:35:980]: Note: 1: 2235 2: 3: ExtendedType 4: SELECT `Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM `CustomAction` WHERE `Action` = 'CheckSerial'
MSI (c) (10:90) [08:59:36:511]: Invoking remote custom action. DLL: C:\DOKUME~1\Eggers\LOKALE~1\Temp\MSID0.tmp, Entrypoint: f4
MSI (c) (10!88) [08:59:37:090]: Note: 1: 2707 2: INSTALLDIR
MSI (c) (10!88) [08:59:37:090]: PROPERTY CHANGE: Adding SERIAL_VALID property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding VISUCLIENT property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding PRODUKTIONSLEITUNG property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding ONLINEEDITOR property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding REPORTTOOL property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding VAN property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding VAN_MGR property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding VAN_REG property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding MONITORE property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding UEBERSICHT property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding ZEITUEBERSICHT property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding ASUMCLIENT property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding PPS property. Its value is '1'.
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (72) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (71) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (70) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (69) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (68) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (67) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (66) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (65) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (64) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (63) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (62) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (61) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (60) of type 790540 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (58) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (57) of type 790540 for thread 904
MSI (c) (10:90) [08:59:37:230]: NOTE: custom action CheckSerial unexpectedly closed the hInstall handle (type MSIHANDLE) provided to it. The custom action should be fixed to not close that handle.
Of course I have to select this Information out of the Database and update the Installation. I do this with a custom action when it finishes i get the following logging and the feature selection page is messed up.
I get a leaked handles for each record i get and for each open view.
What do i need to do to fix the custom action?
function checkSerial(hMSI)
HWND hDb,hView,hRecord,hupdate,hupdateRecord;
STRING serial,dbserial,feature,featurelevel;
NUMBER nvSize,index,state1,state2,result;
BOOL found;
begin
MsiGetProperty(hMSI,"PPM_SERIAL",serial,nvSize);
StrToUpper(serial,serial);
//remove blanks at the end
index = StrFind(serial," ");
while(index > -1)
StrSub(serial, serial,0,index);
index = StrFind(serial," ");
endwhile;
//
if (serial == "") then
MsiSetProperty(hMSI,"SERIAL_VALID","0");
if (SELECTED_LANGUAGE = DEU) then
MessageBox("Keine Seriennummer eingegeben!",WARNING);
else
MessageBox("No Serial entered!",WARNING);
endif;
else
hDb = MsiGetActiveDatabase(hMSI);
MsiDatabaseOpenView(hDb,"select * from PPM_Customer" , hView);
MsiViewExecute(hView, NULL);
found = FALSE;
// for each Property record, add PROPNAME="value" record to ListBox table
while (MsiViewFetch(hView, hRecord) != ERROR_NO_MORE_ITEMS && found != TRUE)
MsiRecordGetString(hRecord, 1, dbserial, nvSize);
found = serial == dbserial;
endwhile;
MsiViewClose(hView);
if (found) then
//Seriennummer is valid
MsiSetProperty(hMSI,"SERIAL_VALID","1");
//activate aviable Features
MsiDatabaseOpenView(hDb,"select * from PPM_Features where Customer = '" + serial+"'" , hView);
MsiViewExecute(hView, NULL);
while (MsiViewFetch(hView, hRecord) != ERROR_NO_MORE_ITEMS)
MsiRecordGetString(hRecord, 3, feature, nvSize);
MsiRecordGetString(hRecord, 4, featurelevel, nvSize);
MsiSetProperty(hMSI,feature,featurelevel);
endwhile;
MsiViewClose(hView);
MsiDoAction(hMSI,"CostFinalize");
else
MsiSetProperty(hMSI,"SERIAL_VALID","0");
if (SELECTED_LANGUAGE = DEU) then
MessageBox("Seriennummer nicht gültig!",WARNING);
else
MessageBox("Serial not valid!",WARNING);
endif;
endif;
endif;
return 0;
end;
MSI (c) (10:C0) [08:59:35:980]: Note: 1: 2235 2: 3: ExtendedType 4: SELECT `Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM `CustomAction` WHERE `Action` = 'CheckSerial'
MSI (c) (10:90) [08:59:36:511]: Invoking remote custom action. DLL: C:\DOKUME~1\Eggers\LOKALE~1\Temp\MSID0.tmp, Entrypoint: f4
MSI (c) (10!88) [08:59:37:090]: Note: 1: 2707 2: INSTALLDIR
MSI (c) (10!88) [08:59:37:090]: PROPERTY CHANGE: Adding SERIAL_VALID property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding VISUCLIENT property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding PRODUKTIONSLEITUNG property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding ONLINEEDITOR property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding REPORTTOOL property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding VAN property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding VAN_MGR property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding VAN_REG property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding MONITORE property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding UEBERSICHT property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding ZEITUEBERSICHT property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding ASUMCLIENT property. Its value is '1'.
MSI (c) (10!88) [08:59:37:105]: PROPERTY CHANGE: Adding PPS property. Its value is '1'.
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (72) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (71) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (70) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (69) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (68) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (67) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (66) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (65) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (64) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (63) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (62) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (61) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (60) of type 790540 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (58) of type 790531 for thread 904
MSI (c) (10!88) [08:59:37:215]: Leaked MSIHANDLE (57) of type 790540 for thread 904
MSI (c) (10:90) [08:59:37:230]: NOTE: custom action CheckSerial unexpectedly closed the hInstall handle (type MSIHANDLE) provided to it. The custom action should be fixed to not close that handle.
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 02, 2009
12:16 PM
That code does not appear to call MsiCloseHandle on the hRecord it receives from MsiViewFetch. Doing so will probably fix this, as per Heath Stewart's blog, handle type 790531 is a record.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 06, 2009
06:56 AM
Thanks Michael,
that worked perfekt, unfortunatly it seems this was not the source of the error on the feature page.
I have one property for each feature to enable it or disable it (set the Features Installlevel = 0 via Condition).
To refresh the Conditions I call MsiDoAction(hMSI,"CostFinalize"); after my manipulation.
(And i removed it from the UI sequence see problem)
The problem is that when i go back from the feature dialog to the customer information dialog and enter another serial wich has other features the conditions are not applied.
2. problem: that is not that imported, the filecost in the feature tree is not displayed correctly.
There is just a string saiing the size is still calculated.
It looks like CostFinalize just works correctly the first time it is called.
How can I fix this/
Is there a better way to enable / disable features.
I need the following:
1. the disabled features should not be visible for selection
2. in silent installation it it must be impossible to install the features not aviable for the provided serial.
that worked perfekt, unfortunatly it seems this was not the source of the error on the feature page.
I have one property for each feature to enable it or disable it (set the Features Installlevel = 0 via Condition).
To refresh the Conditions I call MsiDoAction(hMSI,"CostFinalize"); after my manipulation.
(And i removed it from the UI sequence see problem)
The problem is that when i go back from the feature dialog to the customer information dialog and enter another serial wich has other features the conditions are not applied.
2. problem: that is not that imported, the filecost in the feature tree is not displayed correctly.
There is just a string saiing the size is still calculated.
It looks like CostFinalize just works correctly the first time it is called.
How can I fix this/
Is there a better way to enable / disable features.
I need the following:
1. the disabled features should not be visible for selection
2. in silent installation it it must be impossible to install the features not aviable for the provided serial.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 06, 2009
11:56 AM
Windows Installer's costing does not support this. If you want to do this, you'll probably need to create a custom dialog, perhaps with a listbox you populate from code, or a series of checkboxes you hide and show with conditions or code.
As for the silent UI, you should probably validate the selected features against what you allow, and either deselect them or abort the install when they are disallowed. This should be done for both silent and non-silent install, as any MSI UI can be adjusted with transforms. In short, any license/entitlement issues need to be handled with code, and ideally should also be verified by your application at runtime. A sufficiently advanced user can extract files from a compressed MSI, and clearly the uncompressed case is easy to copy from.
As for the silent UI, you should probably validate the selected features against what you allow, and either deselect them or abort the install when they are disallowed. This should be done for both silent and non-silent install, as any MSI UI can be adjusted with transforms. In short, any license/entitlement issues need to be handled with code, and ideally should also be verified by your application at runtime. A sufficiently advanced user can extract files from a compressed MSI, and clearly the uncompressed case is easy to copy from.