cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Christoph
Level 8

msiviewclose returns error

For retrieving information out of the msi tables during the current setup run, we do these handlings:

msidatabaseopenview => returns hView
msiviewexecute(hView, 0)
while msiviewfetch(hView, hRec)
//do something
endwhile

msiclosehandle(hRec)
msiviewclose(hView)
msiclosehandle(hView)

As we upgraded from InstallShield 11 to InstallShield 2008, we always get returncode 6(ERROR_INVALID_HANDLE) when we try to close the view(msiviewclose(hView)). The 2 other close calls return '0'(ERROR_SUCCESS).

We didn't change anything on the code between using InstallShield 11 and InstallShield 2008. In InstallShield 11, this worked fine.

Does anyone know if there is something changed on the msiviewclose call in Installshield 12(didn't used this release) or Installshield 2008??
Is it maybe not necessary anymore to close the executed database view(by calling msiviewclose) seperately?

Thanks in advance...
Labels (1)
0 Kudos
(4) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

This issue is due to how InstallScript manages MSI handles returned from certain MSI functions. If I remember correctly, this should be resolved in IS 2009. In 2008 and previous versions, you can work around this issue and not leak any handles by calling MsiCloseHandle instead of MsiViewClose to close the view handle.
0 Kudos
Christoph
Level 8

Josh,

so when I download and try the 2009 evaluation version I shouldn't see this problem occuring anymore? Or is there a difference between the 2009 full and evaluation version?

Thanks
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

After double-checking this, the issue will still occur in IS 2009. You can reference work order number IOC-000080530 to track this issue. This should be fixed in the next release of InstallShield.

You can work around this behavior by passing the absolute value of the view handle to MsiViewClose, or do not call MsiViewClose (calling it is only necessary if you are going to execute the view again without having already fetched all the records from the view).
0 Kudos
Christoph
Level 8

Josh,

just verified it.
Passing the absolete value of the handle to msiviewclose works fine.

I defined a flag to enable the workaround.
When the new installshield 2010 version arrives, I test again the original code.

Thx for the tip...
0 Kudos