Processes plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (SF: powerfull -> powerful.)
No edit summary
 
(29 intermediate revisions by 18 users not shown)
Line 1: Line 1:
{{PageAuthor|hardwired}}
== Links ==
== Links ==
[http://devel.icode.ro/files/processes.zip processes.zip] (77Kb) - Includes C++ Source Code
Plugin + C++ Source Code:
 
[[Image:Zip.gif]] [http://download.inscape3d.com/share/nsis/Processes-Unicode.7z Processes-Unicode] (Modified by Mathieu Ruffat)
  - The code has been ported to compile using Unicode, so it can be used in Unicode installers
  - Tested on NSIS 3.02.1. Quick and dirty porting but it works.
  - Based on Processes-x64fix.zip (Processes-x64fix_v2 link is dead)
  - Should also compile/work in ANSI but not tested
 
[[Image:Zip.gif]] [http://dl.dropbox.com/u/18386244/Processes-x64fix.zip Processes-x64fix_v2] (Modified by Stefan Gatu)
  - Fixed killing processes starting with same name
  - Now, the process name can end or not with .exe
 
<attach>Processes-x64fix.zip</attach> - fixed for Vista x64<br>
<attach>Processes.zip</attach><br>
[[Image:Zip.gif]] <strike>[http://devel.icode.ro/files/processes.zip Processes.zip]</strike> (39 KB) (Mirror #1)


== Description ==
== Description ==
NOTE: This plugin seems to no longer work after Windows update KB4579311 changed psapi.dll.
; Version
; Version
: 1.0.1.0
: 1.0.1.0
Line 15: Line 33:
: &copy; 2004-2005 Hardwired. No rights reserved.
: &copy; 2004-2005 Hardwired. No rights reserved.
: There is no restriction for using this software...
: There is no restriction for using this software...
: ...no guaranty either!
: ...no guarantee either!


; Author:
; Author:
: Andrei Ciubotaru [Hardwired]
: Andrei Ciubotaru [Hardwired]
: Lead Developer ICode&Ideas SRL ([http://www.icode.ro/ http://www.icode.ro/])
: President of Inocentric SRL ([hxxp://www.inocentric.com/ hxxp://www.inocentric.com/])
: [mailto:hardwired@icode.ro hardwired@icode.ro]
: [hardwired AT inocentric.com hardwired AT inocentric.com]
: Project Manager ICode&Ideas SRL ([hxxp://www.icode.ro/ hxxp://www.icode.ro/])
: [hardwired AT icode.ro hardwired AT icode.ro]


== Introduction ==
== Introduction ==
The Need For Plug-in - I need it for the one of my installers.
The Need For Plug-in - I needed it for one of my installers.
Briefly: Use it when you need to find\kill a process when installing\uninstalling some application. Also, use it when you need to test the presence of a device driver.
Briefly: Use it when you need to find/kill a process when installing/uninstalling some application. Also, use it when you need to test the presence of a device driver.


== Support ==
== Support ==
Line 37: Line 57:
Searches the currently running processes for the given process name.
Searches the currently running processes for the given process name.
return:
return on $R0:
: 1 - the process was found
: 1 - the process was found
: 0 - the process was not found
: 0 - the process was not found
Line 46: Line 66:
Searches the currently running processes for the given process name. If the process is found then the it gets killed.
Searches the currently running processes for the given process name. If the process is found then the it gets killed.
return:
return on $R0:
: 1 - the process was found and killed
: 1 - the process was found and killed
: 0 - the process was not found or the process cannot be killed (insufficient rights)
: 0 - the process was not found or the process cannot be killed (insufficient rights)
Line 55: Line 75:
Searches the installed devices drivers for the given device base name(important: I said BASE NAME not FILENAME).
Searches the installed devices drivers for the given device base name(important: I said BASE NAME not FILENAME).
return:
return on $R0:
: 1 - the device driver was found
: 1 - the device driver was found
: 0 - the device driver was not found
: 0 - the device driver was not found


== Usage ==
== Usage ==
First of all, does not matter where you use it. Of course, the routines must be called inside of a Section/Function scope.
First of all, it does not matter where you use it. Of course, the routines must be called inside of a Section/Function scope.
<highlight-nsis>
<highlight-nsis>
Processes::FindProcess "process_name" ;without ".exe"
Processes::FindProcess "process_name" ;without ".exe"
Pop $R0
   
   
StrCmp $R0 "1" make_my_day noooooo
StrCmp $R0 "1" make_my_day noooooo
Line 69: Line 88:
make_my_day:
make_my_day:
...
...
;;
 
noooooo:
noooooo:
...
...
Line 75: Line 95:
Processes::KillProcess "process_name" ;without ".exe"
Processes::KillProcess "process_name" ;without ".exe"
Pop $R0
   
   
StrCmp $R0 "1" dead_meat why_wont_you_die
StrCmp $R0 "1" dead_meat why_wont_you_die
Line 87: Line 106:


Processes::FindDevice "device_base_name"
Processes::FindDevice "device_base_name"
Pop $R0
   
   
StrCmp $R0 "1" blabla more_blabla
StrCmp $R0 "1" blabla more_blabla
Line 97: Line 115:
...
...
</highlight-nsis>
</highlight-nsis>
 
== Thanks ==
== Thanks ==
Sunil Kamath for inspiring me. I wanted to use its FindProcDLL but my requirements made it imposible.
Sunil Kamath for inspiring me. I wanted to use his [[FindProcDLL plug-in]] but my requirements made it imposible.


Nullsoft for creating this very powerful installer. One big, free and full-featured (hmmm... and guiless for the moment) mean install machine!:)
Nullsoft for creating this very powerful installer. One big, free and full-featured (hmmm... and guiless for the moment) mean install machine!:)


ME for being such a great coder... ... HAHAHAHAHAHAHA!
== One more thing... ==
== One more thing... ==
If you use the plugin or it's source-code, I would apreciate if my name is mentioned.
If you use the plugin or its source-code, I would be appreciated if my name is mentioned.


Page author: hardwired
[[Category:Plugins]]

Latest revision as of 14:23, 14 July 2021

Author: hardwired (talk, contrib)


Links

Plugin + C++ Source Code:

Zip.gif Processes-Unicode (Modified by Mathieu Ruffat)

  - The code has been ported to compile using Unicode, so it can be used in Unicode installers 
  - Tested on NSIS 3.02.1. Quick and dirty porting but it works.
  - Based on Processes-x64fix.zip (Processes-x64fix_v2 link is dead)
  - Should also compile/work in ANSI but not tested

Zip.gif Processes-x64fix_v2 (Modified by Stefan Gatu)

  - Fixed killing processes starting with same name
  - Now, the process name can end or not with .exe

Processes-x64fix.zip (45 KB) - fixed for Vista x64
Processes.zip (39 KB)
Zip.gif Processes.zip (39 KB) (Mirror #1)

Description

NOTE: This plugin seems to no longer work after Windows update KB4579311 changed psapi.dll.

Version
1.0.1.0
Release
24.february.2005
Description
Nullsoft Installer (NSIS) plug-in for managing?! processes.
Copyright
© 2004-2005 Hardwired. No rights reserved.
There is no restriction for using this software...
...no guarantee either!
Author
Andrei Ciubotaru [Hardwired]
President of Inocentric SRL ([hxxp://www.inocentric.com/ hxxp://www.inocentric.com/])
[hardwired AT inocentric.com hardwired AT inocentric.com]
Project Manager ICode&Ideas SRL ([hxxp://www.icode.ro/ hxxp://www.icode.ro/])
[hardwired AT icode.ro hardwired AT icode.ro]

Introduction

The Need For Plug-in - I needed it for one of my installers.

Briefly: Use it when you need to find/kill a process when installing/uninstalling some application. Also, use it when you need to test the presence of a device driver.

Support

Supported platforms are: WinNT,Win2K,WinXP and Win2003 Server.

DLL Functions

Processes::FindProcess "process_name"

Searches the currently running processes for the given process name.

return on $R0:

1 - the process was found
0 - the process was not found
Processes::KillProcess "process_name"

Searches the currently running processes for the given process name. If the process is found then the it gets killed.

return on $R0:

1 - the process was found and killed
0 - the process was not found or the process cannot be killed (insufficient rights)
Processes::FindDevice "device_base_name"

Searches the installed devices drivers for the given device base name(important: I said BASE NAME not FILENAME).

return on $R0:

1 - the device driver was found
0 - the device driver was not found

Usage

First of all, it does not matter where you use it. Of course, the routines must be called inside of a Section/Function scope.

Processes::FindProcess "process_name" ;without ".exe"
 
StrCmp $R0 "1" make_my_day noooooo
 
make_my_day:
...
;; 
 
noooooo:
...
 
 
Processes::KillProcess "process_name" ;without ".exe"
 
StrCmp $R0 "1" dead_meat why_wont_you_die
 
dead_meat:
...
 
why_wont_you_die:
...
 
 
Processes::FindDevice "device_base_name"
 
StrCmp $R0 "1" blabla more_blabla
 
blabla:
...
 
more_blabla:
...

Thanks

Sunil Kamath for inspiring me. I wanted to use his FindProcDLL plug-in but my requirements made it imposible.

Nullsoft for creating this very powerful installer. One big, free and full-featured (hmmm... and guiless for the moment) mean install machine!:)

One more thing...

If you use the plugin or its source-code, I would be appreciated if my name is mentioned.