mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +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
|
#define NTOS_MODE_USER
|
||||||
#include <ntos.h>
|
#include <ntos.h>
|
||||||
#include <rosrtl/string.h>
|
#include <rosrtl/string.h>
|
||||||
#include <sm/api.h>
|
|
||||||
#include "smss.h"
|
#include "smss.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
/* GLOBALS ***********************************************************/
|
/* GLOBALS ***********************************************************/
|
||||||
|
|
||||||
HANDLE DbgSsApiPort = INVALID_HANDLE_VALUE;
|
HANDLE DbgSsApiPort = (HANDLE) 0;
|
||||||
HANDLE DbgUiApiPort = INVALID_HANDLE_VALUE;
|
HANDLE DbgUiApiPort = (HANDLE) 0;
|
||||||
|
|
||||||
/* FUNCTIONS *********************************************************/
|
/* 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
|
NTSTATUS
|
||||||
SmInitializeDbgSs (VOID)
|
SmInitializeDbgSs (VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
UNICODE_STRING UnicodeString;
|
HANDLE hDbgSsApiPortThread = (HANDLE) 0;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
|
|
||||||
|
DPRINT("SM: %s called\n", __FUNCTION__);
|
||||||
|
|
||||||
/* Create the \DbgSsApiPort object (LPC) */
|
/* Create the \DbgSsApiPort object (LPC) */
|
||||||
RtlRosInitUnicodeStringFromLiteral(&UnicodeString,
|
Status = SmpCreatePT(& DbgSsApiPort,
|
||||||
L"\\DbgSsApiPort");
|
SM_DBGSS_PORT_NAME,
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
0, /* MaxDataSize */
|
||||||
&UnicodeString,
|
0, /* MaxMessageSize */
|
||||||
PORT_ALL_ACCESS,
|
0, /* PoolCharge */
|
||||||
NULL,
|
DbgSsApiPortThread,
|
||||||
NULL);
|
& hDbgSsApiPortThread);
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
Status = NtCreatePort(&DbgSsApiPort,
|
|
||||||
&ObjectAttributes,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
|
|
||||||
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) */
|
/* Create the \DbgUiApiPort object (LPC) */
|
||||||
RtlRosInitUnicodeStringFromLiteral(&UnicodeString,
|
Status = SmpCreatePT(& DbgUiApiPort,
|
||||||
L"\\DbgUiApiPort");
|
SM_DBGUI_PORT_NAME,
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
0, /* MaxDataSize */
|
||||||
&UnicodeString,
|
0, /* MaxMessageSize */
|
||||||
PORT_ALL_ACCESS,
|
0, /* PoolCharge */
|
||||||
NULL,
|
DbgUiApiPortThread,
|
||||||
NULL);
|
NULL);
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
Status = NtCreatePort(&DbgUiApiPort,
|
|
||||||
&ObjectAttributes,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
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;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "smss.h"
|
#include "smss.h"
|
||||||
#include <rosrtl/string.h>
|
#include <rosrtl/string.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBAL VARIABLES *********************************************************/
|
/* GLOBAL VARIABLES *********************************************************/
|
||||||
|
|
Loading…
Reference in a new issue