PS plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(Created page with "Category:Plugins {{PageAuthor|Anders}} = Plug-in information = * '''Version:''' 0.1 * '''Type:''' Runtime plug-in (Unicode) * '''Minimum OS:''' Win95+, WinNT4+ * '''Mini...") |
(More parameters) |
||
Line 33: | Line 33: | ||
Tries to gracefully end a process by closing its windows. | Tries to gracefully end a process by closing its windows. | ||
;(Return) | |||
: Stack #0: Number of closed windows/processes. | |||
Line 40: | Line 43: | ||
Calls <code>End</code> followed by <code>Kill</code>. | Calls <code>End</code> followed by <code>Kill</code>. | ||
;(Return) | |||
: Stack #0: Number of closed windows/processes. | |||
Line 67: | Line 73: | ||
Function PSEnum | Function PSEnum | ||
DetailPrint "PId=$0 Name=$1 Session=$3 Path=$2" | DetailPrint "PId=$0 Name=$1 Session=$3 Path=$2" | ||
${If} $2 = "$InstDir\MyApp" | ${If} $2 == "$InstDir\MyApp" | ||
PS::End ":$0" | PS::End ":$0" | ||
Pop $4 | Pop $4 |
Revision as of 14:30, 29 August 2021
Author: Anders (talk, contrib) |
Plug-in information
- Version: 0.1
- 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.
- (Return)
- Stack #0: Number of closed windows/processes.
EndAndKill
<id>
Calls End
followed by Kill
.
- (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" 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.1 - 20210829 - Anders
- Initial release