reactos/sdk/include/reactos/subsys/sm/smrosdbg.h
Hermès Bélusca-Maïto 0e14378d3e
[SMDLL][SMLIB] Deprecate the legacy ROS-specific SMDLL and improve SM client functions. (#4821)
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().
2022-11-08 17:40:53 +01:00

59 lines
1.5 KiB
C

/*
* PROJECT: ReactOS SM Helper Library
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: ReactOS-specific SM Debug Utility Function:
* Querying subsystem information.
* COPYRIGHT: Copyright 2005 Emanuele Aliberti <ea@reactos.com>
* Copyright 2022 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
*/
#ifndef _SMROSDBG_H_
#define _SMROSDBG_H_
#pragma once
/* Note: this is not in NT */
/* Ask SM to send back some data */
#define SM_API_QUERY_INFORMATION SmpMaxApiNumber
#define SM_QRYINFO_MAX_SS_COUNT 8
#define SM_QRYINFO_MAX_ROOT_NODE 30
typedef enum {
SmBasicInformation = 0,
SmSubSystemInformation
} SM_INFORMATION_CLASS;
typedef struct _SM_BASIC_INFORMATION
{
USHORT SubSystemCount;
USHORT Unused;
struct
{
USHORT Id;
USHORT Flags;
ULONG ProcessId;
} SubSystem[SM_QRYINFO_MAX_SS_COUNT];
} SM_BASIC_INFORMATION, *PSM_BASIC_INFORMATION;
typedef struct _SM_SUBSYSTEM_INFORMATION
{
USHORT SubSystemId;
USHORT Flags;
ULONG ProcessId;
WCHAR NameSpaceRootNode[SM_QRYINFO_MAX_ROOT_NODE];
} SM_SUBSYSTEM_INFORMATION, *PSM_SUBSYSTEM_INFORMATION;
typedef struct _SM_QUERYINFO_MSG
{
SM_INFORMATION_CLASS SmInformationClass;
ULONG DataLength;
union
{
SM_BASIC_INFORMATION BasicInformation;
SM_SUBSYSTEM_INFORMATION SubSystemInformation;
};
} SM_QUERYINFO_MSG, *PSM_QUERYINFO_MSG;
#endif // _SMROSDBG_H_