mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
Added some init code for the embedded DBGSS.
svn path=/trunk/; revision=13736
This commit is contained in:
parent
0218879b00
commit
cea1f1e0a6
2 changed files with 129 additions and 48 deletions
|
@ -26,65 +26,146 @@
|
|||
#define NTOS_MODE_USER
|
||||
#include <ntos.h>
|
||||
#include <rosrtl/string.h>
|
||||
#include <sm/api.h>
|
||||
#include "smss.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
/* GLOBALS ***********************************************************/
|
||||
|
||||
HANDLE DbgSsApiPort = INVALID_HANDLE_VALUE;
|
||||
HANDLE DbgUiApiPort = INVALID_HANDLE_VALUE;
|
||||
HANDLE DbgSsApiPort = (HANDLE) 0;
|
||||
HANDLE DbgUiApiPort = (HANDLE) 0;
|
||||
|
||||
/* FUNCTIONS *********************************************************/
|
||||
|
||||
static VOID STDCALL
|
||||
DbgSsApiPortThread (PVOID dummy)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
LPC_MAX_MESSAGE Request = {{0}};
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
Status = NtListenPort (DbgSsApiPort, & Request.Header);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("SM: %s: NtListenPort() failed! (Status==x%08lx)\n", __FUNCTION__, Status);
|
||||
break;
|
||||
}
|
||||
/* TODO */
|
||||
}
|
||||
NtTerminateThread(NtCurrentThread(),Status);
|
||||
}
|
||||
|
||||
static VOID STDCALL
|
||||
DbgUiApiPortThread (PVOID dummy)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
LPC_MAX_MESSAGE Request = {{0}};
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
Status = NtListenPort (DbgUiApiPort, & Request.Header);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("SM: %s: NtListenPort() failed! (Status==x%08lx)\n", __FUNCTION__, Status);
|
||||
break;
|
||||
}
|
||||
/* TODO */
|
||||
}
|
||||
NtTerminateThread(NtCurrentThread(),Status);
|
||||
}
|
||||
|
||||
static NTSTATUS STDCALL
|
||||
SmpCreatePT (IN OUT PHANDLE hPort,
|
||||
IN LPWSTR wcPortName,
|
||||
IN ULONG ulMaxDataSize,
|
||||
IN ULONG ulMaxMessageSize,
|
||||
IN ULONG ulPoolCharge OPTIONAL,
|
||||
IN VOID (STDCALL * procServingThread)(PVOID) OPTIONAL,
|
||||
IN OUT PHANDLE phServingThread OPTIONAL)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
UNICODE_STRING PortName = {0};
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE Thread = (HANDLE) 0;
|
||||
CLIENT_ID Cid = {0, 0};
|
||||
|
||||
RtlInitUnicodeString (& PortName, wcPortName);
|
||||
InitializeObjectAttributes (& ObjectAttributes,
|
||||
& PortName,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
Status = NtCreatePort (hPort,
|
||||
& ObjectAttributes,
|
||||
ulMaxDataSize,
|
||||
ulMaxMessageSize,
|
||||
ulPoolCharge);
|
||||
if(STATUS_SUCCESS != Status)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
/* Create thread for DbgSsApiPort */
|
||||
RtlCreateUserThread(NtCurrentProcess(),
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
(PTHREAD_START_ROUTINE) procServingThread,
|
||||
hPort,
|
||||
& Thread,
|
||||
& Cid);
|
||||
if((HANDLE) 0 == Thread)
|
||||
{
|
||||
NtClose(*hPort);
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
if(NULL != phServingThread)
|
||||
{
|
||||
*phServingThread = Thread;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
SmInitializeDbgSs (VOID)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING UnicodeString;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
HANDLE hDbgSsApiPortThread = (HANDLE) 0;
|
||||
|
||||
DPRINT("SM: %s called\n", __FUNCTION__);
|
||||
|
||||
/* Create the \DbgSsApiPort object (LPC) */
|
||||
RtlRosInitUnicodeStringFromLiteral(&UnicodeString,
|
||||
L"\\DbgSsApiPort");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtCreatePort(&DbgSsApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
Status = SmpCreatePT(& DbgSsApiPort,
|
||||
SM_DBGSS_PORT_NAME,
|
||||
0, /* MaxDataSize */
|
||||
0, /* MaxMessageSize */
|
||||
0, /* PoolCharge */
|
||||
DbgSsApiPortThread,
|
||||
& hDbgSsApiPortThread);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
DPRINT("SM: %s: DBGSS port not created\n",__FUNCTION__);
|
||||
return Status;
|
||||
}
|
||||
DbgPrint("SMSS: %s: \\DbgSsApiPort created\n",__FUNCTION__);
|
||||
|
||||
/* Create the \DbgUiApiPort object (LPC) */
|
||||
RtlRosInitUnicodeStringFromLiteral(&UnicodeString,
|
||||
L"\\DbgUiApiPort");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
Status = SmpCreatePT(& DbgUiApiPort,
|
||||
SM_DBGUI_PORT_NAME,
|
||||
0, /* MaxDataSize */
|
||||
0, /* MaxMessageSize */
|
||||
0, /* PoolCharge */
|
||||
DbgUiApiPortThread,
|
||||
NULL);
|
||||
|
||||
Status = NtCreatePort(&DbgUiApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
DPRINT("SM: %s: DBGUI port not created\n",__FUNCTION__);
|
||||
NtClose (hDbgSsApiPortThread);
|
||||
NtClose (DbgSsApiPort);
|
||||
return Status;
|
||||
}
|
||||
DbgPrint("SMSS: %s: \\DbgUiApiPort created\n",__FUNCTION__);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "smss.h"
|
||||
#include <rosrtl/string.h>
|
||||
|
||||
//#define NDEBUG
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* GLOBAL VARIABLES *********************************************************/
|
||||
|
|
Loading…
Reference in a new issue