PS plug-in

From NSIS Wiki
Jump to navigationJump to search
Author: Anders (talk, contrib)



Plug-in information

  • Version: 0.2
  • Type: Runtime plug-in (Unicode)
  • Minimum OS: Win95+, WinNT4+
  • Minimum NSIS version: 2.45
  • License: Freeware
  • Download: PS.zip (12 KB)


Functions

Kill

<Id>

Kills all processes matching Id.

Id
Name or PId. To kill a process by its PId, the PId must be prefixed with a colon (eg ":1234").
(Return)
Stack #0: Number of killed processes.


End

<id>

Tries to gracefully end a process by closing its windows.

Id
Name or PId.
(Return)
Stack #0: Number of closed windows/processes.


EndAndKill

<id>

Calls End followed by Kill.

Id
Name or PId.
(Return)
Stack #0: Number of closed windows/processes.


SelfPId

Returns the PId of the current process on top of the stack.


SelfSession

Returns the terminal server session of the current process on top of the stack or a empty string if sessions are not supported.


Enum

FunctionAddress

Enumerates all the processes in the system (except the current process). The callback function receives the PId in $0, the file name in $1, the full path (if available) in $2 and the session in $3. Set $0 to a empty string to abort the enumeration.

FunctionAddress
NSIS callback function.


Example

Function PSEnum
DetailPrint "PId=$0 Name=$1 Session=$3 Path=$2"
${If} $2 == "$InstDir\MyApp.exe"
  PS::End ":$0"
  Pop $4
${EndIf}
FunctionEnd
 
Section
 
GetFunctionAddress $0 PSEnum
PS::Enum $0
 
PS::End "Notepad.exe" ; Closes all instances of Notepad.exe
Pop $0
 
SectionEnd

History

0.2 - 20210830 - Anders

  • Use debug privilege if available

0.1 - 20210829 - Anders

  • Initial release