tags:

views:

103

answers:

2

We have a .NET application that we distribute to our users via an MSI installer package. We have C++ applications that run each morning to see if the user's copy of the application is out of date, and if so, we pull down the new MSI and install it. If the application is running, we need to take it down so we can perform the update.

Our problem is that every once in a while it seems like windows "loses" our application. It will not report that the process is running - though it is. It will allow us to overwrite, or even delete, the in-use executable file without taking down the application.

Maybe this is something that is common -- but we can't figure out what is going on! Does anyone have any insight into this situation?

It seems like a temporary copy of our application is getting created, and the program is getting ran from that. But if that is the case, why doesn't it happen all the time?

EDIT: In our program, We are using the "EnumProcesses" function from the Platform SDK, PSAPI.dll, to enumerate all of the running processes.

+2  A: 

Could it be that either the script or the application runs as a 64-bit program, and the other as a 32-bit program? If so, then on 64-bit machines the update check could be looking in the wrong location for an existing application and thus reporting it as missing?

280Z28
Looking into this, it seems promising.. The application is 32-bit, not sure about the update script yet. But, would this also somehow account for being able to override the executable?
Matt
This turns out not to be the case, but thank you for the suggestion.
Matt
A: 

What mechanism are you using to check to see if the process is running or not?

Try using something like process explorer to see what path the executable image is loaded from - it should be listed in the modules section.

Kragen
See the edit in my original question for the process enumeration mechanism. I did not think of using process explorer, but that is a good idea. Unfortunately we cannot recreate this on-demand, but I will keep that in mind when it happens again.
Matt