We have a software agent that attempts to get details about the installed applications on Windows machines. We use a few different methods to do it, including reading registry. But part of our method is to read the MSI database using Windows system calls MsiEnumProducts and MsiEnumComponents.
We are having a problem -- when the executable of an installed app is actually located on a shared (mapped) drive, it seems like if our check runs when the mapped drive isn't connected or available (so the machine technically can't get to the executable) then at some point in our loop on MsiEnumComponents the call hangs and never returns to us. Our loop where it hangs is kind of like this:
while () {
MsiEnumComponents();
while() {
MsiEnumClients();
}
}
Does anyone know of something we can do to avoid the hang, ideally while still getting the rest of MSI info for other installed apps? Or maybe an alternate and more reliable way to read the same info (want to get components of installed apps)?