reactos/sdk/include/reactos/subsys/sm/smmsg.h

320 lines
7.9 KiB
C
Raw Normal View History

/*
[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-10-20 18:03:56 +00:00
* PROJECT: ReactOS NT-Compatible Session Manager
* LICENSE: BSD 2-Clause License (https://spdx.org/licenses/BSD-2-Clause)
* PURPOSE: SMSS Client (SB and SM) Message Format
* COPYRIGHT: Copyright 2012-2013 Alex Ionescu <alex.ionescu@reactos.org>
* Copyright 2021 Hervé Poussineau <hpoussin@reactos.org>
* Copyright 2022 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
*/
[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-10-20 18:03:56 +00:00
#ifndef _SM_MSG_
#define _SM_MSG_
[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-10-20 18:03:56 +00:00
#pragma once
//
// There are the APIs that a Client (such as CSRSS) can send to the SMSS Server.
// These are called "SM" APIs.
//
// The exact names are not known, but we are basing them on the SmpApiName array
// in the checked build of SMSS, which is probably a close approximation. We add
// "p" to use the similar nomenclature seen/leaked out in the Base CSRSS APIs.
//
// The enumeration finishes with an enumeratee holding the maximum API number.
// Its name is based on BasepMaxApiNumber, UserpMaxApiNumber...
//
typedef enum _SMSRV_API_NUMBER
{
SmpCreateForeignSessionApi,
SmpSessionCompleteApi,
SmpTerminateForeignSessionApi,
SmpExecPgmApi,
SmpLoadDeferedSubsystemApi,
SmpStartCsrApi,
SmpStopCsrApi,
SmpMaxApiNumber
} SMSRV_API_NUMBER;
//
// These are the structures making up the SM_API_MSG packet structure defined
// below. Each one corresponds to an equivalent API from the list above.
//
typedef struct _SM_CREATE_FOREIGN_SESSION_MSG
{
ULONG NotImplemented;
} SM_CREATE_FOREIGN_SESSION_MSG, *PSM_CREATE_FOREIGN_SESSION_MSG;
typedef struct _SM_SESSION_COMPLETE_MSG
{
ULONG SessionId;
NTSTATUS SessionStatus;
} SM_SESSION_COMPLETE_MSG, *PSM_SESSION_COMPLETE_MSG;
typedef struct _SM_TERMINATE_FOREIGN_SESSION_MSG
{
ULONG NotImplemented;
} SM_TERMINATE_FOREIGN_SESSION_MSG, *PSM_TERMINATE_FOREIGN_SESSION_MSG;
typedef struct _SM_EXEC_PGM_MSG
{
RTL_USER_PROCESS_INFORMATION ProcessInformation;
BOOLEAN DebugFlag;
} SM_EXEC_PGM_MSG, *PSM_EXEC_PGM_MSG;
#ifndef _WIN64
C_ASSERT(sizeof(SM_EXEC_PGM_MSG) == 0x48);
[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-10-20 18:03:56 +00:00
#else
C_ASSERT(sizeof(SM_EXEC_PGM_MSG) == 0x70);
#endif
typedef struct _SM_LOAD_DEFERED_SUBSYSTEM_MSG
{
ULONG Length;
WCHAR Buffer[32];
} SM_LOAD_DEFERED_SUBSYSTEM_MSG, *PSM_LOAD_DEFERED_SUBSYSTEM_MSG;
typedef struct _SM_START_CSR_MSG
{
ULONG MuSessionId;
ULONG Length;
WCHAR Buffer[128];
HANDLE WindowsSubSysProcessId;
HANDLE SmpInitialCommandProcessId;
} SM_START_CSR_MSG, *PSM_START_CSR_MSG;
[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-10-20 18:03:56 +00:00
#ifndef _WIN64
C_ASSERT(sizeof(SM_START_CSR_MSG) == 0x110);
#else
C_ASSERT(sizeof(SM_START_CSR_MSG) == 0x118);
#endif
typedef struct _SM_STOP_CSR_MSG
{
ULONG MuSessionId;
} SM_STOP_CSR_MSG, *PSM_STOP_CSR_MSG;
[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-10-20 18:03:56 +00:00
#if defined(__REACTOS__) && DBG
#include "smrosdbg.h"
#endif
//
[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-10-20 18:03:56 +00:00
// This is the actual packet structure sent over LPC to the \SmApiPort
//
typedef struct _SM_API_MSG
{
PORT_MESSAGE h;
SMSRV_API_NUMBER ApiNumber;
NTSTATUS ReturnValue;
union
{
SM_CREATE_FOREIGN_SESSION_MSG CreateForeignSession;
SM_SESSION_COMPLETE_MSG SessionComplete;
SM_TERMINATE_FOREIGN_SESSION_MSG TerminateForeignComplete;
SM_EXEC_PGM_MSG ExecPgm;
SM_LOAD_DEFERED_SUBSYSTEM_MSG LoadDefered;
SM_START_CSR_MSG StartCsr;
SM_STOP_CSR_MSG StopCsr;
[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-10-20 18:03:56 +00:00
#if defined(__REACTOS__) && DBG
SM_QUERYINFO_MSG QueryInfo;
#endif
} u;
} SM_API_MSG, *PSM_API_MSG;
//
// This is the size that Server 2003 SP1 SMSS expects, so make sure we conform.
//
#ifndef _WIN64
C_ASSERT(sizeof(SM_API_MSG) == 0x130);
[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-10-20 18:03:56 +00:00
#else
C_ASSERT(sizeof(SM_API_MSG) == 0x148);
#endif
//
// There are the APIs that the SMSS Server can send to a client (such as CSRSS).
// These are called "SB" APIs.
//
// The exact names are unknown but we are basing them on the CsrServerSbApiName
// array in the checked build of CSRSRV which is probably a close approximation.
// We add "p" to use the similar nomenclature seen/leaked out in the Base CSRSS
// APIs.
//
// The enumeration finishes with an enumeratee holding the maximum API number.
// Its name is based on BasepMaxApiNumber, UserpMaxApiNumber...
//
typedef enum _SB_API_NUMBER
{
SbpCreateSession,
SbpTerminateSession,
SbpForeignSessionComplete,
SbpCreateProcess,
SbpMaxApiNumber
} SB_API_NUMBER;
//
// These are the structures making up the SB_API_MSG packet structure defined
// below. Each one corresponds to an equivalent API from the list above.
//
typedef struct _SB_CREATE_SESSION_MSG
{
ULONG SessionId;
RTL_USER_PROCESS_INFORMATION ProcessInfo;
[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-10-20 18:03:56 +00:00
PVOID Unknown;
ULONG MuSessionId;
CLIENT_ID ClientId;
} SB_CREATE_SESSION_MSG, *PSB_CREATE_SESSION_MSG;
[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-10-20 18:03:56 +00:00
#ifndef _WIN64
C_ASSERT(sizeof(SB_CREATE_SESSION_MSG) == 0x58);
#else
C_ASSERT(sizeof(SB_CREATE_SESSION_MSG) == 0x90);
#endif
typedef struct _SB_TERMINATE_SESSION_MSG
{
ULONG SessionId;
} SB_TERMINATE_SESSION_MSG, *PSB_TERMINATE_SESSION_MSG;
typedef struct _SB_FOREIGN_SESSION_COMPLETE_MSG
{
ULONG SessionId;
} SB_FOREIGN_SESSION_COMPLETE_MSG, *PSB_FOREIGN_SESSION_COMPLETE_MSG;
#define SB_PROCESS_FLAGS_DEBUG 0x1
#define SB_PROCESS_FLAGS_WAIT_ON_THREAD 0x2
#define SB_PROCESS_FLAGS_RESERVE_1MB 0x8
#define SB_PROCESS_FLAGS_SKIP_CHECKS 0x20
typedef struct _SB_CREATE_PROCESS_MSG
{
union
{
struct
{
PUNICODE_STRING ImageName;
PUNICODE_STRING CurrentDirectory;
PUNICODE_STRING CommandLine;
PUNICODE_STRING DllPath;
ULONG Flags;
ULONG DebugFlags;
} In;
struct
{
HANDLE ProcessHandle;
HANDLE ThreadHandle;
ULONG SubsystemType;
CLIENT_ID ClientId;
} Out;
};
} SB_CREATE_PROCESS_MSG, *PSB_CREATE_PROCESS_MSG;
[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-10-20 18:03:56 +00:00
#ifndef _WIN64
C_ASSERT(sizeof(SB_CREATE_PROCESS_MSG) == 0x18);
#else
C_ASSERT(sizeof(SB_CREATE_PROCESS_MSG) == 0x28);
#endif
//
// When the server connects to a client, this structure is exchanged
//
typedef struct _SB_CONNECTION_INFO
{
ULONG SubsystemType;
WCHAR SbApiPortName[120];
} SB_CONNECTION_INFO, *PSB_CONNECTION_INFO;
//
[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-10-20 18:03:56 +00:00
// This is the actual packet structure sent over LPC to the \SbApiPort
//
typedef struct _SB_API_MSG
{
PORT_MESSAGE h;
union
{
SB_CONNECTION_INFO ConnectionInfo;
struct
{
SB_API_NUMBER ApiNumber;
NTSTATUS ReturnValue;
union
{
SB_CREATE_SESSION_MSG CreateSession;
SB_TERMINATE_SESSION_MSG TerminateSession;
SB_FOREIGN_SESSION_COMPLETE_MSG ForeignSessionComplete;
SB_CREATE_PROCESS_MSG CreateProcess;
};
};
};
} SB_API_MSG, *PSB_API_MSG;
//
// This is the size that Server 2003 SP1 SMSS expects, so make sure we conform.
//
#ifndef _WIN64
C_ASSERT(sizeof(SB_API_MSG) == 0x110);
[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-10-20 18:03:56 +00:00
#else
C_ASSERT(sizeof(SB_API_MSG) == 0x120);
#endif
//
// SB Message Handler
//
typedef
BOOLEAN
(NTAPI *PSB_API_ROUTINE)(
[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-10-20 18:03:56 +00:00
_In_ PSB_API_MSG SbApiMsg
);
//
[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-10-20 18:03:56 +00:00
// The actual server functions that a client linking with SMLIB can call.
//
[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-10-20 18:03:56 +00:00
/* NTDLL!RtlConnectToSm */
NTSTATUS
NTAPI
SmConnectToSm(
[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-10-20 18:03:56 +00:00
_In_opt_ PUNICODE_STRING SbApiPortName,
_In_opt_ HANDLE SbApiPort,
_In_opt_ ULONG ImageType,
_Out_ PHANDLE SmApiPort);
[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-10-20 18:03:56 +00:00
/* NTDLL!RtlSendMsgToSm */
NTSTATUS
NTAPI
[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-10-20 18:03:56 +00:00
SmSendMsgToSm(
_In_ HANDLE SmApiPort,
_Inout_ PSM_API_MSG SmApiMsg);
NTSTATUS
NTAPI
SmSessionComplete(
[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-10-20 18:03:56 +00:00
_In_ HANDLE SmApiPort,
_In_ ULONG SessionId,
_In_ NTSTATUS SessionStatus);
NTSTATUS
NTAPI
SmExecPgm(
_In_ HANDLE SmApiPort,
_In_ PRTL_USER_PROCESS_INFORMATION ProcessInformation,
_In_ BOOLEAN DebugFlag);
NTSTATUS
NTAPI
SmLoadDeferedSubsystem(
_In_ HANDLE SmApiPort,
_In_ PUNICODE_STRING DeferedSubsystem);
NTSTATUS
NTAPI
SmStartCsr(
[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-10-20 18:03:56 +00:00
_In_ HANDLE SmApiPort,
_Out_ PULONG pMuSessionId,
_In_opt_ PUNICODE_STRING CommandLine,
_Out_ PHANDLE pWindowsSubSysProcessId,
_Out_ PHANDLE pInitialCommandProcessId);
NTSTATUS
NTAPI
SmStopCsr(
[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-10-20 18:03:56 +00:00
_In_ HANDLE SmApiPort,
_In_ ULONG MuSessionId);
[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-10-20 18:03:56 +00:00
#endif // _SM_MSG_