xref: /reactos/sdk/lib/smlib/readme.txt (revision 69931a4a)
1
2SMLIB: Client Library to talk to the ReactOS NT-Compatible Session Manager (SM).
3
4It should be linked in the following components:
5
6a) the SM itself, because it registers for managing native processes
7   IMAGE_SUBSYSTEM_NATIVE;
8
9b) environment subsystem servers, because each one should register in
10   the SM its own subsystem (willing to manage those processes);
11
12c) application launchers (e.g. terminal emulators) for optional subsystems,
13   to ask the SM to start the optional subsystem server they need to connect;
14
15d) system and development utilities to debug/query the SM.
16
172004-02-15 ea
182022-11-03 hbelusca
19
20
21How a subsystem uses these APIs
22===============================
23
24Thread #0                                   Thread #1
25
26- Creates its own directory (\EXAMPLE)
27- Initializes the main parts of the subsystem.
28- Creates its main API port (\EXAMPLE\ApiPort),
29  and servicing thread for it. Programs running
30  under this subsystem will communicate with
31  this API port.
32
33- Creates its SM callback API port (\EXAMPLE\SbApiPort)
34  and servicing thread T1.
35
36                                            - Waits connection requests on the
37                                            callback port (\EXAMPLE\SbApiPort)
38
39- Registers to the SM by calling
40  SmConnectToSm(
41    "\EXAMPLE\SbApiPort",
42    hSbApiPort,
43    SUBSYSTEM_ID,
44    &hSmApiPort);
45                                            - As the SM calls back, validates
46                                            and accepts connection.
47
48- The subsystem is now ready to
49  manage processes, etc.
50
51-----
52
53Thread #N                                   Thread #1
54
55                                            - The SM calls back the subsystem
56                                            SbCreateSession() API, so that it
57                                            can initialize a new environment
58                                            session (with associated SessionId).
59
60- When no more processes to manage exist,
61  terminate the subsystem session by calling
62  SmSessionComplete(
63    hSmApiPort,
64    SessionId,
65    ExitStatus);
66                                            - The SM calls back the subsystem
67                                            SbTerminateSession() API.
68