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...") |
(v0.2) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
= Plug-in information = | = Plug-in information = | ||
* '''Version:''' 0. | * '''Version:''' 0.2 | ||
* '''Type:''' Runtime plug-in (Unicode) | * '''Type:''' Runtime plug-in (Unicode) | ||
* '''Minimum OS:''' Win95+, WinNT4+ | * '''Minimum OS:''' Win95+, WinNT4+ | ||
Line 33: | Line 33: | ||
Tries to gracefully end a process by closing its windows. | Tries to gracefully end a process by closing its windows. | ||
;Id | |||
: Name or PId. | |||
;(Return) | |||
: Stack #0: Number of closed windows/processes. | |||
Line 40: | Line 46: | ||
Calls <code>End</code> followed by <code>Kill</code>. | Calls <code>End</code> followed by <code>Kill</code>. | ||
;Id | |||
: Name or PId. | |||
;(Return) | |||
: Stack #0: Number of closed windows/processes. | |||
Line 67: | Line 79: | ||
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.exe" | ||
PS::End ":$0" | PS::End ":$0" | ||
Pop $4 | Pop $4 | ||
Line 84: | Line 96: | ||
</highlight-nsis> | </highlight-nsis> | ||
= History = | |||
0.2 - 20210830 - Anders | |||
* Use debug privilege if available | |||
0.1 - 20210829 - Anders | 0.1 - 20210829 - Anders | ||
* Initial release | * Initial release |
Latest revision as of 19:32, 30 August 2021
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