mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 13:11:22 +00:00
[SMSS] Improve comments/code/some DPRINTs. Reorganize smss.h header.
This commit is contained in:
parent
06a0451415
commit
f43ce46566
8 changed files with 227 additions and 213 deletions
|
@ -1282,14 +1282,14 @@ SmpInitializeDosDevices(VOID)
|
||||||
PSMP_REGISTRY_VALUE RegEntry;
|
PSMP_REGISTRY_VALUE RegEntry;
|
||||||
SECURITY_DESCRIPTOR_CONTROL OldFlag = 0;
|
SECURITY_DESCRIPTOR_CONTROL OldFlag = 0;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING DestinationString;
|
UNICODE_STRING GlobalName;
|
||||||
HANDLE DirHandle;
|
HANDLE DirHandle;
|
||||||
PLIST_ENTRY NextEntry, Head;
|
PLIST_ENTRY NextEntry, Head;
|
||||||
|
|
||||||
/* Open the GLOBAL?? directory */
|
/* Open the \GLOBAL?? directory */
|
||||||
RtlInitUnicodeString(&DestinationString, L"\\??");
|
RtlInitUnicodeString(&GlobalName, L"\\??");
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&DestinationString,
|
&GlobalName,
|
||||||
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_PERMANENT,
|
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_PERMANENT,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1299,7 +1299,7 @@ SmpInitializeDosDevices(VOID)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("SMSS: Unable to open %wZ directory - Status == %lx\n",
|
DPRINT1("SMSS: Unable to open %wZ directory - Status == %lx\n",
|
||||||
&DestinationString, Status);
|
&GlobalName, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,7 +1426,7 @@ SmpInitializeKnownDllsInternal(IN PUNICODE_STRING Directory,
|
||||||
IN PUNICODE_STRING Path)
|
IN PUNICODE_STRING Path)
|
||||||
{
|
{
|
||||||
HANDLE DirFileHandle, DirHandle, SectionHandle, FileHandle, LinkHandle;
|
HANDLE DirFileHandle, DirHandle, SectionHandle, FileHandle, LinkHandle;
|
||||||
UNICODE_STRING NtPath, DestinationString;
|
UNICODE_STRING NtPath, SymLinkName;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
NTSTATUS Status, Status1;
|
NTSTATUS Status, Status1;
|
||||||
PLIST_ENTRY NextEntry;
|
PLIST_ENTRY NextEntry;
|
||||||
|
@ -1499,9 +1499,9 @@ SmpInitializeKnownDllsInternal(IN PUNICODE_STRING Directory,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a symbolic link to the directory in the object manager */
|
/* Create a symbolic link to the directory in the object manager */
|
||||||
RtlInitUnicodeString(&DestinationString, L"KnownDllPath");
|
RtlInitUnicodeString(&SymLinkName, L"KnownDllPath");
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&DestinationString,
|
&SymLinkName,
|
||||||
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_PERMANENT,
|
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_PERMANENT,
|
||||||
DirHandle,
|
DirHandle,
|
||||||
SmpPrimarySecurityDescriptor);
|
SmpPrimarySecurityDescriptor);
|
||||||
|
@ -1518,7 +1518,7 @@ SmpInitializeKnownDllsInternal(IN PUNICODE_STRING Directory,
|
||||||
{
|
{
|
||||||
/* It wasn't, so bail out since the OS needs it to exist */
|
/* It wasn't, so bail out since the OS needs it to exist */
|
||||||
DPRINT1("SMSS: Unable to create %wZ symbolic link - Status == %lx\n",
|
DPRINT1("SMSS: Unable to create %wZ symbolic link - Status == %lx\n",
|
||||||
&DestinationString, Status);
|
&SymLinkName, Status);
|
||||||
LinkHandle = NULL;
|
LinkHandle = NULL;
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
@ -1653,12 +1653,12 @@ SmpInitializeKnownDlls(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PSMP_REGISTRY_VALUE RegEntry;
|
PSMP_REGISTRY_VALUE RegEntry;
|
||||||
UNICODE_STRING DestinationString;
|
UNICODE_STRING KnownDllsName;
|
||||||
PLIST_ENTRY Head, NextEntry;
|
PLIST_ENTRY Head, NextEntry;
|
||||||
|
|
||||||
/* Call the internal function */
|
/* Call the internal function */
|
||||||
RtlInitUnicodeString(&DestinationString, L"\\KnownDlls");
|
RtlInitUnicodeString(&KnownDllsName, L"\\KnownDlls");
|
||||||
Status = SmpInitializeKnownDllsInternal(&DestinationString, &SmpKnownDllPath);
|
Status = SmpInitializeKnownDllsInternal(&KnownDllsName, &SmpKnownDllPath);
|
||||||
|
|
||||||
/* Wipe out the list regardless of success */
|
/* Wipe out the list regardless of success */
|
||||||
Head = &SmpKnownDllsList;
|
Head = &SmpKnownDllsList;
|
||||||
|
@ -2268,6 +2268,7 @@ SmpLoadDataFromRegistry(OUT PUNICODE_STRING InitialCommand)
|
||||||
InitializeListHead(&SmpSubSystemsToLoad);
|
InitializeListHead(&SmpSubSystemsToLoad);
|
||||||
InitializeListHead(&SmpSubSystemsToDefer);
|
InitializeListHead(&SmpSubSystemsToDefer);
|
||||||
InitializeListHead(&SmpExecuteList);
|
InitializeListHead(&SmpExecuteList);
|
||||||
|
|
||||||
SmpPagingFileInitialize();
|
SmpPagingFileInitialize();
|
||||||
|
|
||||||
/* Initialize the SMSS environment */
|
/* Initialize the SMSS environment */
|
||||||
|
@ -2479,7 +2480,7 @@ SmpInit(IN PUNICODE_STRING InitialCommand,
|
||||||
|
|
||||||
/* Initialize session parameters */
|
/* Initialize session parameters */
|
||||||
SmpNextSessionId = 1;
|
SmpNextSessionId = 1;
|
||||||
SmpNextSessionIdScanMode = 0;
|
SmpNextSessionIdScanMode = FALSE;
|
||||||
SmpDbgSsLoaded = FALSE;
|
SmpDbgSsLoaded = FALSE;
|
||||||
|
|
||||||
/* Create the initial security descriptors */
|
/* Create the initial security descriptors */
|
||||||
|
@ -2557,7 +2558,7 @@ SmpInit(IN PUNICODE_STRING InitialCommand,
|
||||||
{
|
{
|
||||||
/* Autochk should've run now. Set the event and save the CSRSS handle */
|
/* Autochk should've run now. Set the event and save the CSRSS handle */
|
||||||
*ProcessHandle = SmpWindowsSubSysProcess;
|
*ProcessHandle = SmpWindowsSubSysProcess;
|
||||||
NtSetEvent(EventHandle, 0);
|
NtSetEvent(EventHandle, NULL);
|
||||||
NtClose(EventHandle);
|
NtClose(EventHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
|
|
||||||
typedef struct _SMP_CLIENT_CONTEXT
|
typedef struct _SMP_CLIENT_CONTEXT
|
||||||
{
|
{
|
||||||
PVOID Subsystem;
|
PSMP_SUBSYSTEM Subsystem;
|
||||||
HANDLE ProcessHandle;
|
HANDLE ProcessHandle;
|
||||||
HANDLE PortHandle;
|
HANDLE PortHandle;
|
||||||
ULONG dword10;
|
PVOID Reserved;
|
||||||
} SMP_CLIENT_CONTEXT, *PSMP_CLIENT_CONTEXT;
|
} SMP_CLIENT_CONTEXT, *PSMP_CLIENT_CONTEXT;
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
|
@ -277,7 +277,7 @@ SmpHandleConnectionRequest(IN HANDLE SmApiPort,
|
||||||
HANDLE PortHandle, ProcessHandle;
|
HANDLE PortHandle, ProcessHandle;
|
||||||
ULONG SessionId;
|
ULONG SessionId;
|
||||||
UNICODE_STRING SubsystemPort;
|
UNICODE_STRING SubsystemPort;
|
||||||
SMP_CLIENT_CONTEXT *ClientContext;
|
PSMP_CLIENT_CONTEXT ClientContext;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
REMOTE_PORT_VIEW PortView;
|
REMOTE_PORT_VIEW PortView;
|
||||||
|
@ -343,13 +343,13 @@ SmpHandleConnectionRequest(IN HANDLE SmApiPort,
|
||||||
{
|
{
|
||||||
ClientContext->ProcessHandle = ProcessHandle;
|
ClientContext->ProcessHandle = ProcessHandle;
|
||||||
ClientContext->Subsystem = CidSubsystem;
|
ClientContext->Subsystem = CidSubsystem;
|
||||||
ClientContext->dword10 = 0;
|
ClientContext->Reserved = NULL;
|
||||||
ClientContext->PortHandle = NULL;
|
ClientContext->PortHandle = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Failed to allocate a client context, so reject the connection */
|
/* Failed to allocate a client context, so reject the connection */
|
||||||
DPRINT1("Rejecting connectiond due to lack of memory\n");
|
DPRINT1("Rejecting connection due to lack of memory\n");
|
||||||
Accept = FALSE;
|
Accept = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef struct _SMP_SESSION
|
||||||
RTL_CRITICAL_SECTION SmpSessionListLock;
|
RTL_CRITICAL_SECTION SmpSessionListLock;
|
||||||
LIST_ENTRY SmpSessionListHead;
|
LIST_ENTRY SmpSessionListHead;
|
||||||
ULONG SmpNextSessionId;
|
ULONG SmpNextSessionId;
|
||||||
ULONG SmpNextSessionIdScanMode;
|
BOOLEAN SmpNextSessionIdScanMode;
|
||||||
BOOLEAN SmpDbgSsLoaded;
|
BOOLEAN SmpDbgSsLoaded;
|
||||||
HANDLE SmpSessionsObjectDirectory;
|
HANDLE SmpSessionsObjectDirectory;
|
||||||
|
|
||||||
|
@ -134,13 +134,13 @@ SmpAllocateSessionId(IN PSMP_SUBSYSTEM Subsystem,
|
||||||
if (SmpNextSessionIdScanMode)
|
if (SmpNextSessionIdScanMode)
|
||||||
{
|
{
|
||||||
/* Break if it happened */
|
/* Break if it happened */
|
||||||
DbgPrint("SMSS: SessionId's Wrapped\n");
|
UNIMPLEMENTED_DBGBREAK("SMSS: SessionId's Wrapped\n");
|
||||||
DbgBreakPoint();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Detect it for next time */
|
/* Detect it for next time */
|
||||||
if (!SmpNextSessionId) SmpNextSessionIdScanMode = 1;
|
if (!SmpNextSessionId)
|
||||||
|
SmpNextSessionIdScanMode = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a session structure */
|
/* Allocate a session structure */
|
||||||
|
|
|
@ -65,7 +65,7 @@ SmpExecuteImage(IN PUNICODE_STRING FileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the size field as required */
|
/* Set the size field as required */
|
||||||
ProcessInfo->Size = sizeof(RTL_USER_PROCESS_INFORMATION);
|
ProcessInfo->Size = sizeof(*ProcessInfo);
|
||||||
|
|
||||||
/* Check if the debug flag was requested */
|
/* Check if the debug flag was requested */
|
||||||
if (Flags & SMP_DEBUG_FLAG)
|
if (Flags & SMP_DEBUG_FLAG)
|
||||||
|
@ -88,7 +88,7 @@ SmpExecuteImage(IN PUNICODE_STRING FileName,
|
||||||
/* And always force NX for anything that SMSS launches */
|
/* And always force NX for anything that SMSS launches */
|
||||||
ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_NX;
|
ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_NX;
|
||||||
|
|
||||||
/* Now create the process */
|
/* Now create the process in suspended state */
|
||||||
Status = RtlCreateUserProcess(FileName,
|
Status = RtlCreateUserProcess(FileName,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
ProcessParameters,
|
ProcessParameters,
|
||||||
|
@ -134,7 +134,7 @@ SmpExecuteImage(IN PUNICODE_STRING FileName,
|
||||||
/* This image is invalid, so kill it, close our handles, and fail */
|
/* This image is invalid, so kill it, close our handles, and fail */
|
||||||
Status = STATUS_INVALID_IMAGE_FORMAT;
|
Status = STATUS_INVALID_IMAGE_FORMAT;
|
||||||
NtTerminateProcess(ProcessInfo->ProcessHandle, Status);
|
NtTerminateProcess(ProcessInfo->ProcessHandle, Status);
|
||||||
NtWaitForSingleObject(ProcessInfo->ThreadHandle, 0, 0);
|
NtWaitForSingleObject(ProcessInfo->ThreadHandle, FALSE, NULL);
|
||||||
NtClose(ProcessInfo->ThreadHandle);
|
NtClose(ProcessInfo->ThreadHandle);
|
||||||
NtClose(ProcessInfo->ProcessHandle);
|
NtClose(ProcessInfo->ProcessHandle);
|
||||||
DPRINT1("SMSS: Not an NT image - %wZ\n", FileName);
|
DPRINT1("SMSS: Not an NT image - %wZ\n", FileName);
|
||||||
|
@ -255,7 +255,7 @@ SmpExecuteCommand(IN PUNICODE_STRING CommandLine,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* An actual image name was present -- execute it */
|
/* An actual image name was present, execute it */
|
||||||
Status = SmpExecuteImage(&FileName,
|
Status = SmpExecuteImage(&FileName,
|
||||||
&Directory,
|
&Directory,
|
||||||
CommandLine,
|
CommandLine,
|
||||||
|
@ -287,7 +287,7 @@ SmpExecuteInitialCommand(IN ULONG MuSessionId,
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
RTL_USER_PROCESS_INFORMATION ProcessInfo;
|
RTL_USER_PROCESS_INFORMATION ProcessInfo;
|
||||||
UNICODE_STRING Arguments, ImageFileDirectory, ImageFileName;
|
UNICODE_STRING Arguments, Directory, FileName;
|
||||||
ULONG Flags = 0;
|
ULONG Flags = 0;
|
||||||
|
|
||||||
/* Check if we haven't yet connected to ourselves */
|
/* Check if we haven't yet connected to ourselves */
|
||||||
|
@ -305,14 +305,14 @@ SmpExecuteInitialCommand(IN ULONG MuSessionId,
|
||||||
/* Parse the initial command line */
|
/* Parse the initial command line */
|
||||||
Status = SmpParseCommandLine(InitialCommand,
|
Status = SmpParseCommandLine(InitialCommand,
|
||||||
&Flags,
|
&Flags,
|
||||||
&ImageFileName,
|
&FileName,
|
||||||
&ImageFileDirectory,
|
&Directory,
|
||||||
&Arguments);
|
&Arguments);
|
||||||
if (Flags & SMP_INVALID_PATH)
|
if (Flags & SMP_INVALID_PATH)
|
||||||
{
|
{
|
||||||
/* Fail if it doesn't exist */
|
/* Fail if it doesn't exist */
|
||||||
DPRINT1("SMSS: Initial command image (%wZ) not found\n", &ImageFileName);
|
DPRINT1("SMSS: Initial command image (%wZ) not found\n", &FileName);
|
||||||
if (ImageFileName.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, ImageFileName.Buffer);
|
if (FileName.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
|
||||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,23 +324,17 @@ SmpExecuteInitialCommand(IN ULONG MuSessionId,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute the initial command -- but defer its full execution */
|
/* Execute the initial command, but defer its full execution */
|
||||||
Status = SmpExecuteImage(&ImageFileName,
|
Status = SmpExecuteImage(&FileName,
|
||||||
&ImageFileDirectory,
|
&Directory,
|
||||||
InitialCommand,
|
InitialCommand,
|
||||||
MuSessionId,
|
MuSessionId,
|
||||||
SMP_DEFERRED_FLAG,
|
SMP_DEFERRED_FLAG,
|
||||||
&ProcessInfo);
|
&ProcessInfo);
|
||||||
|
|
||||||
/* Free any buffers we had lying around */
|
/* Free all the token parameters */
|
||||||
if (ImageFileName.Buffer)
|
if (FileName.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
|
||||||
{
|
if (Directory.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Directory.Buffer);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, ImageFileName.Buffer);
|
|
||||||
}
|
|
||||||
if (ImageFileDirectory.Buffer)
|
|
||||||
{
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, ImageFileDirectory.Buffer);
|
|
||||||
}
|
|
||||||
if (Arguments.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Arguments.Buffer);
|
if (Arguments.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Arguments.Buffer);
|
||||||
|
|
||||||
/* Bail out if we couldn't execute the initial command */
|
/* Bail out if we couldn't execute the initial command */
|
||||||
|
@ -409,7 +403,7 @@ LONG
|
||||||
SmpUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
|
SmpUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
|
||||||
{
|
{
|
||||||
ULONG_PTR Parameters[4];
|
ULONG_PTR Parameters[4];
|
||||||
UNICODE_STRING DestinationString;
|
UNICODE_STRING ErrorString;
|
||||||
|
|
||||||
/* Print and breakpoint into the debugger */
|
/* Print and breakpoint into the debugger */
|
||||||
DbgPrint("SMSS: Unhandled exception - Status == %x IP == %p\n",
|
DbgPrint("SMSS: Unhandled exception - Status == %x IP == %p\n",
|
||||||
|
@ -421,8 +415,8 @@ SmpUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
|
||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
|
|
||||||
/* Build the hard error and terminate */
|
/* Build the hard error and terminate */
|
||||||
RtlInitUnicodeString(&DestinationString, L"Unhandled Exception in Session Manager");
|
RtlInitUnicodeString(&ErrorString, L"Unhandled Exception in Session Manager");
|
||||||
Parameters[0] = (ULONG_PTR)&DestinationString;
|
Parameters[0] = (ULONG_PTR)&ErrorString;
|
||||||
Parameters[1] = ExceptionInfo->ExceptionRecord->ExceptionCode;
|
Parameters[1] = ExceptionInfo->ExceptionRecord->ExceptionCode;
|
||||||
Parameters[2] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress;
|
Parameters[2] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress;
|
||||||
Parameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord;
|
Parameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord;
|
||||||
|
|
|
@ -6,10 +6,13 @@
|
||||||
* PROGRAMMERS: Alex Ionescu
|
* PROGRAMMERS: Alex Ionescu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* DEPENDENCIES ***************************************************************/
|
|
||||||
#ifndef _SM_
|
#ifndef _SM_
|
||||||
#define _SM_
|
#define _SM_
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* DEPENDENCIES ***************************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* Native Headers */
|
/* Native Headers */
|
||||||
|
@ -19,17 +22,17 @@
|
||||||
#include <winreg.h>
|
#include <winreg.h>
|
||||||
|
|
||||||
#define NTOS_MODE_USER
|
#define NTOS_MODE_USER
|
||||||
#include <ndk/iofuncs.h>
|
|
||||||
#include <ndk/obfuncs.h>
|
|
||||||
#include <ndk/rtlfuncs.h>
|
|
||||||
#include <ndk/cmfuncs.h>
|
#include <ndk/cmfuncs.h>
|
||||||
#include <ndk/exfuncs.h>
|
#include <ndk/exfuncs.h>
|
||||||
#include <ndk/mmfuncs.h>
|
#include <ndk/iofuncs.h>
|
||||||
#include <ndk/psfuncs.h>
|
#include <ndk/kefuncs.h>
|
||||||
#include <ndk/lpcfuncs.h>
|
#include <ndk/lpcfuncs.h>
|
||||||
|
#include <ndk/mmfuncs.h>
|
||||||
|
#include <ndk/obfuncs.h>
|
||||||
|
#include <ndk/psfuncs.h>
|
||||||
|
#include <ndk/rtlfuncs.h>
|
||||||
#include <ndk/setypes.h>
|
#include <ndk/setypes.h>
|
||||||
#include <ndk/umfuncs.h>
|
#include <ndk/umfuncs.h>
|
||||||
#include <ndk/kefuncs.h>
|
|
||||||
|
|
||||||
#include <ntstrsafe.h>
|
#include <ntstrsafe.h>
|
||||||
|
|
||||||
|
@ -78,7 +81,7 @@ extern LIST_ENTRY SmpKnownSubSysHead;
|
||||||
extern RTL_CRITICAL_SECTION SmpSessionListLock;
|
extern RTL_CRITICAL_SECTION SmpSessionListLock;
|
||||||
extern LIST_ENTRY SmpSessionListHead;
|
extern LIST_ENTRY SmpSessionListHead;
|
||||||
extern ULONG SmpNextSessionId;
|
extern ULONG SmpNextSessionId;
|
||||||
extern ULONG SmpNextSessionIdScanMode;
|
extern BOOLEAN SmpNextSessionIdScanMode;
|
||||||
extern BOOLEAN SmpDbgSsLoaded;
|
extern BOOLEAN SmpDbgSsLoaded;
|
||||||
extern HANDLE SmpWindowsSubSysProcess;
|
extern HANDLE SmpWindowsSubSysProcess;
|
||||||
extern HANDLE SmpSessionsObjectDirectory;
|
extern HANDLE SmpSessionsObjectDirectory;
|
||||||
|
@ -100,62 +103,15 @@ extern BOOLEAN SmpDebug;
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
/* crashdmp.c */
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
SmpTerminate(
|
SmpCheckForCrashDump(
|
||||||
IN PULONG_PTR Parameters,
|
IN PUNICODE_STRING FileName
|
||||||
IN ULONG ParameterMask,
|
|
||||||
IN ULONG ParameterCount
|
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
/* pagefile.c */
|
||||||
NTAPI
|
|
||||||
SmpCreateSecurityDescriptors(
|
|
||||||
IN BOOLEAN InitialCall
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
SmpInit(
|
|
||||||
IN PUNICODE_STRING InitialCommand,
|
|
||||||
OUT PHANDLE ProcessHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
SmpAcquirePrivilege(
|
|
||||||
IN ULONG Privilege,
|
|
||||||
OUT PVOID *PrivilegeStat
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
SmpReleasePrivilege(
|
|
||||||
IN PVOID State
|
|
||||||
);
|
|
||||||
|
|
||||||
ULONG
|
|
||||||
NTAPI
|
|
||||||
SmpApiLoop(
|
|
||||||
IN PVOID Parameter
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
SmpExecuteCommand(
|
|
||||||
IN PUNICODE_STRING CommandLine,
|
|
||||||
IN ULONG MuSessionId,
|
|
||||||
OUT PHANDLE ProcessId,
|
|
||||||
IN ULONG Flags
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
SmpLoadSubSystemsForMuSession(
|
|
||||||
IN PULONG MuSessionId,
|
|
||||||
OUT PHANDLE ProcessId,
|
|
||||||
IN PUNICODE_STRING InitialCommand
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -175,14 +131,138 @@ SmpCreatePagingFiles(
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* sminit.c */
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
SmpTranslateSystemPartitionInformation(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
SmpParseCommandLine(
|
SmpCreateSecurityDescriptors(
|
||||||
|
IN BOOLEAN InitialCall
|
||||||
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpInit(
|
||||||
|
IN PUNICODE_STRING InitialCommand,
|
||||||
|
OUT PHANDLE ProcessHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
/* smloop.c */
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
SmpApiLoop(
|
||||||
|
IN PVOID Parameter
|
||||||
|
);
|
||||||
|
|
||||||
|
/* smsbapi.c */
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpSbCreateSession(
|
||||||
|
IN PVOID Reserved,
|
||||||
|
IN PSMP_SUBSYSTEM OtherSubsystem,
|
||||||
|
IN PRTL_USER_PROCESS_INFORMATION ProcessInformation,
|
||||||
|
IN ULONG MuSessionId,
|
||||||
|
IN PCLIENT_ID DbgClientId
|
||||||
|
);
|
||||||
|
|
||||||
|
/* smsessn.c */
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
SmpCheckDuplicateMuSessionId(
|
||||||
|
IN ULONG MuSessionId
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
SmpDeleteSession(
|
||||||
|
IN ULONG SessionId
|
||||||
|
);
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
SmpAllocateSessionId(
|
||||||
|
IN PSMP_SUBSYSTEM Subsystem,
|
||||||
|
IN PSMP_SUBSYSTEM OtherSubsystem
|
||||||
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpGetProcessMuSessionId(
|
||||||
|
IN HANDLE ProcessHandle,
|
||||||
|
OUT PULONG SessionId
|
||||||
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpSetProcessMuSessionId(
|
||||||
|
IN HANDLE ProcessHandle,
|
||||||
|
IN ULONG SessionId
|
||||||
|
);
|
||||||
|
|
||||||
|
/* smss.c */
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpExecuteImage(
|
||||||
|
IN PUNICODE_STRING FileName,
|
||||||
|
IN PUNICODE_STRING Directory,
|
||||||
IN PUNICODE_STRING CommandLine,
|
IN PUNICODE_STRING CommandLine,
|
||||||
OUT PULONG Flags,
|
IN ULONG MuSessionId,
|
||||||
OUT PUNICODE_STRING FileName,
|
IN ULONG Flags,
|
||||||
OUT PUNICODE_STRING Directory,
|
IN PRTL_USER_PROCESS_INFORMATION ProcessInformation
|
||||||
OUT PUNICODE_STRING Arguments
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpExecuteCommand(
|
||||||
|
IN PUNICODE_STRING CommandLine,
|
||||||
|
IN ULONG MuSessionId,
|
||||||
|
OUT PHANDLE ProcessId,
|
||||||
|
IN ULONG Flags
|
||||||
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpExecuteInitialCommand(IN ULONG MuSessionId,
|
||||||
|
IN PUNICODE_STRING InitialCommand,
|
||||||
|
IN HANDLE InitialCommandProcess,
|
||||||
|
OUT PHANDLE ReturnPid);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpTerminate(
|
||||||
|
IN PULONG_PTR Parameters,
|
||||||
|
IN ULONG ParameterMask,
|
||||||
|
IN ULONG ParameterCount
|
||||||
|
);
|
||||||
|
|
||||||
|
/* smsubsys.c */
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
SmpDereferenceSubsystem(
|
||||||
|
IN PSMP_SUBSYSTEM SubSystem
|
||||||
|
);
|
||||||
|
|
||||||
|
PSMP_SUBSYSTEM
|
||||||
|
NTAPI
|
||||||
|
SmpLocateKnownSubSysByCid(
|
||||||
|
IN PCLIENT_ID ClientId
|
||||||
|
);
|
||||||
|
|
||||||
|
PSMP_SUBSYSTEM
|
||||||
|
NTAPI
|
||||||
|
SmpLocateKnownSubSysByType(
|
||||||
|
IN ULONG MuSessionId,
|
||||||
|
IN ULONG ImageType
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -198,9 +278,35 @@ SmpLoadSubSystem(
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
SmpSetProcessMuSessionId(
|
SmpLoadSubSystemsForMuSession(
|
||||||
IN HANDLE ProcessHandle,
|
IN PULONG MuSessionId,
|
||||||
IN ULONG SessionId
|
OUT PHANDLE ProcessId,
|
||||||
|
IN PUNICODE_STRING InitialCommand
|
||||||
|
);
|
||||||
|
|
||||||
|
/* smutil.c */
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpAcquirePrivilege(
|
||||||
|
IN ULONG Privilege,
|
||||||
|
OUT PVOID *PrivilegeStat
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
SmpReleasePrivilege(
|
||||||
|
IN PVOID State
|
||||||
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
SmpParseCommandLine(
|
||||||
|
IN PUNICODE_STRING CommandLine,
|
||||||
|
OUT PULONG Flags,
|
||||||
|
OUT PUNICODE_STRING FileName,
|
||||||
|
OUT PUNICODE_STRING Directory,
|
||||||
|
OUT PUNICODE_STRING Arguments
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
@ -223,89 +329,4 @@ SmpRestoreBootStatusData(
|
||||||
IN BOOLEAN ShutdownOkay
|
IN BOOLEAN ShutdownOkay
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
NTAPI
|
|
||||||
SmpCheckForCrashDump(
|
|
||||||
IN PUNICODE_STRING FileName
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
SmpTranslateSystemPartitionInformation(
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
PSMP_SUBSYSTEM
|
|
||||||
NTAPI
|
|
||||||
SmpLocateKnownSubSysByCid(
|
|
||||||
IN PCLIENT_ID ClientId
|
|
||||||
);
|
|
||||||
|
|
||||||
PSMP_SUBSYSTEM
|
|
||||||
NTAPI
|
|
||||||
SmpLocateKnownSubSysByType(
|
|
||||||
IN ULONG MuSessionId,
|
|
||||||
IN ULONG ImageType
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
SmpGetProcessMuSessionId(
|
|
||||||
IN HANDLE ProcessHandle,
|
|
||||||
OUT PULONG SessionId
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
SmpDereferenceSubsystem(
|
|
||||||
IN PSMP_SUBSYSTEM SubSystem
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
SmpSbCreateSession(
|
|
||||||
IN PVOID Reserved,
|
|
||||||
IN PSMP_SUBSYSTEM OtherSubsystem,
|
|
||||||
IN PRTL_USER_PROCESS_INFORMATION ProcessInformation,
|
|
||||||
IN ULONG MuSessionId,
|
|
||||||
IN PCLIENT_ID DbgClientId
|
|
||||||
);
|
|
||||||
|
|
||||||
ULONG
|
|
||||||
NTAPI
|
|
||||||
SmpAllocateSessionId(
|
|
||||||
IN PSMP_SUBSYSTEM Subsystem,
|
|
||||||
IN PSMP_SUBSYSTEM OtherSubsystem
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
SmpDeleteSession(
|
|
||||||
IN ULONG SessionId
|
|
||||||
);
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
NTAPI
|
|
||||||
SmpCheckDuplicateMuSessionId(
|
|
||||||
IN ULONG MuSessionId
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
SmpExecuteInitialCommand(IN ULONG MuSessionId,
|
|
||||||
IN PUNICODE_STRING InitialCommand,
|
|
||||||
IN HANDLE InitialCommandProcess,
|
|
||||||
OUT PHANDLE ReturnPid);
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
SmpExecuteImage(
|
|
||||||
IN PUNICODE_STRING FileName,
|
|
||||||
IN PUNICODE_STRING Directory,
|
|
||||||
IN PUNICODE_STRING CommandLine,
|
|
||||||
IN ULONG MuSessionId,
|
|
||||||
IN ULONG Flags,
|
|
||||||
IN PRTL_USER_PROCESS_INFORMATION ProcessInformation
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif /* _SM_ */
|
#endif /* _SM_ */
|
||||||
|
|
|
@ -87,7 +87,7 @@ SmpLocateKnownSubSysByCid(IN PCLIENT_ID ClientId)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the current pointer and keep earching */
|
/* Reset the current pointer and keep searching */
|
||||||
Subsystem = NULL;
|
Subsystem = NULL;
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ SmpLocateKnownSubSysByType(IN ULONG MuSessionId,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the current pointer and keep earching */
|
/* Reset the current pointer and keep searching */
|
||||||
Subsystem = NULL;
|
Subsystem = NULL;
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ Quickie2:
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
RemoveEntryList(&NewSubsystem->Entry);
|
RemoveEntryList(&NewSubsystem->Entry);
|
||||||
NtSetEvent(NewSubsystem->Event, 0);
|
NtSetEvent(NewSubsystem->Event, NULL);
|
||||||
SmpDereferenceSubsystem(NewSubsystem);
|
SmpDereferenceSubsystem(NewSubsystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ SmpLoadSubSystemsForMuSession(IN PULONG MuSessionId,
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("SMSS: Subsystem execute failed (%wZ)\n", &RegEntry->Value);
|
DPRINT1("SMSS: Subsystem execute failed (%wZ)\n", &RegEntry->Value);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,9 +280,7 @@ SmExecPgm(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set the message data */
|
/* Set the message data */
|
||||||
RtlCopyMemory(&ExecPgm->ProcessInformation,
|
ExecPgm->ProcessInformation = *ProcessInformation;
|
||||||
ProcessInformation,
|
|
||||||
sizeof(ExecPgm->ProcessInformation));
|
|
||||||
ExecPgm->DebugFlag = DebugFlag;
|
ExecPgm->DebugFlag = DebugFlag;
|
||||||
|
|
||||||
/* Send the message and wait for a reply */
|
/* Send the message and wait for a reply */
|
||||||
|
@ -420,7 +418,7 @@ SmStartCsr(
|
||||||
SmApiMsg.ApiNumber = SmpStartCsrApi;
|
SmApiMsg.ApiNumber = SmpStartCsrApi;
|
||||||
Status = SmSendMsgToSm(SmApiPort, &SmApiMsg);
|
Status = SmSendMsgToSm(SmApiPort, &SmApiMsg);
|
||||||
|
|
||||||
/* Give back informations to caller */
|
/* Give back information to caller */
|
||||||
*pMuSessionId = StartCsr->MuSessionId;
|
*pMuSessionId = StartCsr->MuSessionId;
|
||||||
*pWindowsSubSysProcessId = StartCsr->WindowsSubSysProcessId;
|
*pWindowsSubSysProcessId = StartCsr->WindowsSubSysProcessId;
|
||||||
*pInitialCommandProcessId = StartCsr->SmpInitialCommandProcessId;
|
*pInitialCommandProcessId = StartCsr->SmpInitialCommandProcessId;
|
||||||
|
|
Loading…
Reference in a new issue