mirror of
https://github.com/reactos/reactos.git
synced 2024-09-10 12:54:51 +00:00
![Hermès Bélusca-Maïto](/assets/img/avatar_default.png)
This DLL was exporting legacy NT-incompatible or ROS-specific SM client functions, that have been since 10 years now (2012) replaced by the new NT-compatible SM: - SmConnectApiPort(): was just SmConnectToSm(). - SmCompleteSession(): The legacy SMSS used it for when a subsystem initialization was finished. Now (NT-compatible) this function is called by subsystems **only** when a subsystem session **terminates**: SmSessionComplete(). - SmExecuteProgram(): was just the client side of SmLoadDeferedSubSystem() (whose server side is not implemented yet). The legacy SM "old" SmExecPgm implementation actually was "SmLoadDeferedSubSystem"... - SmLookupSubsystem(): is a utility-only function to read any registry value inside "Session Manager\SubSystems". Move SMDLL's readme into SMLIB and update its contents. Collect some residual useful functions into smutils.c (and moved in SMLIB, though not compiled yet): - SmExecuteProgram(), now implemented as a wrapper around SmExecPgm(); - SmLookupSubsystem(), described above; - SmQueryInformation(), that retrieves a list of currently-running subsystems. [SMLIB] Validate SbApiPortName's length in SmConnectToSm(). Fix CommandLine length validation in SmStartCsr(). Add documentation (+ SAL annotations) to the NT-compatible SMSS client functions. smmsg.h: Add both Win32 and Win64 struct sizes C_ASSERTs for those whose size change between these two processor architecture sizes. [SMLIB] Introduce SmSendMsgToSm() as helper to send data into the SM LPC port. + Make the other API functions use it. It should be observed that in Vista+, both functions SmConnectToSm() and this new SmSendMsgToSm() are exported by NTDLL under the names RtlConnectToSm() and RtlSendMsgToSm() (and use the same signature). See: https://www.geoffchappell.com/studies/windows/win32/ntdll/history/names60.htm [NTDLL] Correctly stub RtlConnectToSm() and RtlSendMsgToSm(). [NTDLL_VISTA] Link to SMLIB and simply export RtlConnectToSm() and RtlSendMsgToSm().
68 lines
2.2 KiB
Plaintext
68 lines
2.2 KiB
Plaintext
|
|
SMLIB: Client Library to talk to the ReactOS NT-Compatible Session Manager (SM).
|
|
|
|
It should be linked in the following components:
|
|
|
|
a) the SM itself, because it registers for managing native processes
|
|
IMAGE_SUBSYSTEM_NATIVE;
|
|
|
|
b) environment subsystem servers, because each one should register in
|
|
the SM its own subsystem (willing to manage those processes);
|
|
|
|
c) application launchers (e.g. terminal emulators) for optional subsystems,
|
|
to ask the SM to start the optional subsystem server they need to connect;
|
|
|
|
d) system and development utilities to debug/query the SM.
|
|
|
|
2004-02-15 ea
|
|
2022-11-03 hbelusca
|
|
|
|
|
|
How a subsystem uses these APIs
|
|
===============================
|
|
|
|
Thread #0 Thread #1
|
|
|
|
- Creates its own directory (\EXAMPLE)
|
|
- Initializes the main parts of the subsystem.
|
|
- Creates its main API port (\EXAMPLE\ApiPort),
|
|
and servicing thread for it. Programs running
|
|
under this subsystem will communicate with
|
|
this API port.
|
|
|
|
- Creates its SM callback API port (\EXAMPLE\SbApiPort)
|
|
and servicing thread T1.
|
|
|
|
- Waits connection requests on the
|
|
callback port (\EXAMPLE\SbApiPort)
|
|
|
|
- Registers to the SM by calling
|
|
SmConnectToSm(
|
|
"\EXAMPLE\SbApiPort",
|
|
hSbApiPort,
|
|
SUBSYSTEM_ID,
|
|
&hSmApiPort);
|
|
- As the SM calls back, validates
|
|
and accepts connection.
|
|
|
|
- The subsystem is now ready to
|
|
manage processes, etc.
|
|
|
|
-----
|
|
|
|
Thread #N Thread #1
|
|
|
|
- The SM calls back the subsystem
|
|
SbCreateSession() API, so that it
|
|
can initialize a new environment
|
|
session (with associated SessionId).
|
|
|
|
- When no more processes to manage exist,
|
|
terminate the subsystem session by calling
|
|
SmSessionComplete(
|
|
hSmApiPort,
|
|
SessionId,
|
|
ExitStatus);
|
|
- The SM calls back the subsystem
|
|
SbTerminateSession() API.
|