Old 27th August 2021, 15:35   #1
Marbled
Junior Member
 
Join Date: Dec 2015
Posts: 24
nsProcess, is there a way to exclude processes?

Hi!

I recently added to one of the install scripts I made a call to nsProcess::KillProcess...

I have a small problem though, the name of the process I want to kill and the name of the install program is the same.

Now if it was a first release of this application I could make sure the names are different but we have been using those names for a while now and renaming them would be kind of a pain...

Is it possible to exclude the current running process from the list of processes killed by nsProcess::KillProcess?

Thank you and have a nice day!

Nick
Marbled is offline   Reply With Quote
Old 27th August 2021, 16:27   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,418
I don't think it supports this.

Try the LockedList plug-in...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th August 2021, 17:12   #3
Marbled
Junior Member
 
Join Date: Dec 2015
Posts: 24
Hi Anders!

Unfortunately the LockedList plugin prompt might confuse our users so I can't really go that way...

I see that the FCT plug-in does a job similar to the nsProcess plugin but using the window name (which can be a partial one I believe) so if that plugin still works (it was made in 2005 apparently) and if the window name is different between the setup program and the actual program (I am pretty sure it is but I will have to check when I get back to work) I might be able to use this instead...

Thank you and have a nice day!

Nick
Marbled is offline   Reply With Quote
Old 28th August 2021, 01:13   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,418
I suppose there is room for improvement in the process management department.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th August 2021, 02:04   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,418
Try https://nsis.sourceforge.io/PS_plug-in

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th August 2021, 19:40   #6
Marbled
Junior Member
 
Join Date: Dec 2015
Posts: 24
Thank you very much Anders! This will works very nicely...

I see that you edited your answer and put the information that was in it in wiki page and added some additional information.

I had kinda guessed PS::Enum was used to set and call a callback function which is called to evaluate whether something should be done about a particular process but your added comments in the wiki made it pretty clear now...

You had mentioned in your original reply that the current running process (the setup program) was not seen by those commands (or something like that) but the documentation in the wiki only mention this for PS::Enum now, is it still true for the other commands?

By the way, if we do not use them, is popping results from the stack necessary? I guess it might eventually overflow, right?

Thank you and have a nice day!

Nick
Marbled is offline   Reply With Quote
Old 29th August 2021, 22:35   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,418
I think the installer is excluded from End/Kill as well if you kill it by name but I'm not excluding if you do it by PId IIRC. The installer is excluded because of the issue you mentioned and the full path is not always reliable. On 95/98/ME it should always work. On other systems there will be processes you don't have access to. There should never be false positives but if someone runs your app as System for example, StrCmp $2 "$InstDir\myapp.exe" will not find it.

The FindProcDLL plug-in claims to handle short names/paths, I'm not currently doing any short name handling.

Yes, you should pop. If not to inspect the result then pop just to free the memory. Not a big deal in most cases but can be trouble if you don't pop inside a loop or callback.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump