Skip to content

Commit cd012d9

Browse files
fredemmottnefarius
andauthored
Document HANDLE requirements for terminating processes (#16)
* Document HANDLE requirements for terminating processes * Added link to CLI docs Minor formatting fixes --------- Co-authored-by: Benjamin Höglinger-Stelzer <nefarius@dhmx.at>
1 parent 11e781a commit cd012d9

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
11
# Process Termination on Update
22

3-
TBD
3+
If the user chooses to install an update, the updater will terminate the specified process if [`--terminate-process-before-update <handle>`](Command-Line-Arguments.md#-terminate-process-before-update-handle) is passed on the command line; this is intended for when the updater is launched by the product that is being updated.
4+
5+
This handle:
6+
7+
- **MUST** be a Win32 `HANDLE`
8+
- **MUST** have `PROCESS_TERMINATE | PROCESS_QUERY_LIMITED_INFORMATION` permissions
9+
- **MUST** be inheritable, and owned by the updaters' parent process
10+
- **MUST NOT** be a pseudo-handle, e.g. you can not directly use the return value of `GetCurrentProcess()`
11+
12+
For example, you can create the handle with:
13+
14+
```c++
15+
HANDLE handle {};
16+
DuplicateHandle(
17+
GetCurrentProcess(),
18+
GetCurrentProcess(),
19+
GetCurrentProcess(),
20+
&handle,
21+
PROCESS_TERMINATE | PROCESS_QUERY_LIMITED_INFORMATION,
22+
/* inheritable = */ true,
23+
/* flags = */ 0);
24+
```
25+
26+
You must also specify that handles are inherited when calling `CreateProcess()` to launch the updater.

0 commit comments

Comments
 (0)