TrifonovS
23rd October 2009 16:54 UTC
Problem with the plug-in processes
I had a strange situation. I'm using the plug-in processes to find out whether the application that I want to install or uninstall is currently running. Let's imagine that my application is named ApplicationName.exe and my installer - SetupApplicationName.exe.
Before to preform installation I use in my code the following line:
Processes::FindProcess "ApplicationName"
I'm sure that the ApplicationName.exe is not running, but I always get result "1" that means running application. When I rename my installer to Setup.exe instead of SetupApplicationName.exe, everything works just fine. Is it possible that the plug-in recognizes wrongly the process, because the installer's executable contains in his name the name of the installed application?
Please, give me advice how to solve this problem...
Zinthose
23rd October 2009 17:00 UTC
Interesting, my first thought is that the plugin is seeing the "ApplicationName" at the end of the "SetupApplicationName". If this is indeed true then it would be a definite bug in the plugin.
Try renaming the Setup exe and try again to test the theory. It's my Birthday and frankly I'm going to lazy and not test it myself :P
MSG
23rd October 2009 20:48 UTC
What is the displayed name of the installer? The one defined by the Name command.
TrifonovS
25th October 2009 18:37 UTC
The name of the installer is the same like the installed application - ApplicationName. Is it a problem?
MSG
25th October 2009 20:28 UTC
Well it shouldn't be a problem, seeing how renaming the installer exe solves the problem... But it might be relevant to finding the cause of the bug, so I just thought I'd ask. Does using a different Name have any effect?
TrifonovS
26th October 2009 07:36 UTC
No, the name doesn't change anything. I have made several installers. Some of them have the same name like the installed application, but some of them not. The problem always exists. I made some further tests. I renamed the installer's executable to SetupApplicationName1.exe. I still have the mentioned problem. But if I change only one letter from ApplicationName than everything works fine. It really looks like a bug. Can you advice me how to solve my problem (with some kind of workaround or another plug-in), because I can not wait until somebody fixes the bug. I will try now to use the plug-in FindProcDll. From it's description it looks that it makes the same (and I hope that the same bug is not inside :))...
TrifonovS
26th October 2009 09:45 UTC
Now I can make a concussion. There is a bug in Processes.dll. When I look in the source I see the following code on line 143:
if( NULL != strstr( szCurrentProcessName, szProcessName ) )
The function strstr() makes this behavior. It searches for a sub-string in a string. I think that the function strcmp() must be used instead of it, then everything will be ok. By the way, I used FindProcDll plug-in and I don't have such a problem with it. It work fine with nsProcess plug-in too.