I have the following scenario, I need to detect a particular program running in windows before I can execute my program, for example my program needs to know if LogMeIn is actually installed and running to proceed, I have used some approaches like enumerating processes using psapi.dll but I think that the process name could change in the installation and configuration stage, so I dont know how to make sure that I can find always the process independently of this. I am using some tests based upon the following code snippets: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682623(v=vs.85).aspx
The other approach is to use the registry code but I detect that it could be modified too and it is not standard.
If the program you want to track is windowed (so a windows iss shown) and the window title is something you predict. You can use the EnumWindows function. If the title changes but still have some words that are the same accross the different run, you can use regular expression to see if the name match what you want. Example:
Those two string share a common and explicit name, so you can tell that will be what your looking for. You can apply this reasonning to the EnumProcess method