mirror of
https://github.com/reactos/reactos.git
synced 2025-05-27 13:08:23 +00:00
Minor fixes: some more code needed to make it work.
This one actually connects to the PSXSS.EXE process. svn path=/trunk/; revision=2824
This commit is contained in:
parent
c19d6a953f
commit
0c3dba541d
1 changed files with 51 additions and 38 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: csrterm.c,v 1.1 2002/03/17 22:15:39 ea Exp $
|
/* $Id: csrterm.c,v 1.2 2002/04/06 16:00:46 ea Exp $
|
||||||
*
|
*
|
||||||
* PROJECT : ReactOS Operating System / POSIX+ Environment Subsystem
|
* PROJECT : ReactOS Operating System / POSIX+ Environment Subsystem
|
||||||
* DESCRIPTION: CSRTERM - A DEC VT-100 terminal emulator for the PSX subsystem
|
* DESCRIPTION: CSRTERM - A DEC VT-100 terminal emulator for the PSX subsystem
|
||||||
|
@ -58,7 +58,15 @@
|
||||||
/*** GLOBALS *********************************************************/
|
/*** GLOBALS *********************************************************/
|
||||||
|
|
||||||
PRIVATE LPCSTR MyName = "CSRTERM";
|
PRIVATE LPCSTR MyName = "CSRTERM";
|
||||||
PRIVATE CSRTERM_SESSION Session;
|
PRIVATE CSRTERM_SESSION Session =
|
||||||
|
{
|
||||||
|
0, //Identifier
|
||||||
|
{ //ServerPort
|
||||||
|
{0,0,NULL},
|
||||||
|
L"\\"PSX_NS_SUBSYSTEM_DIRECTORY_NAME"\\"PSX_NS_API_PORT_NAME,
|
||||||
|
INVALID_HANDLE_VALUE
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*** PRIVATE FUNCTIONS ***********************************************/
|
/*** PRIVATE FUNCTIONS ***********************************************/
|
||||||
VOID STDCALL Debug_Print (LPCSTR Format, ...)
|
VOID STDCALL Debug_Print (LPCSTR Format, ...)
|
||||||
|
@ -219,6 +227,7 @@ PRIVATE NTSTATUS STDCALL CreateSessionObjects (DWORD Pid)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Id = 0;
|
ULONG Id = 0;
|
||||||
OBJECT_ATTRIBUTES Oa;
|
OBJECT_ATTRIBUTES Oa;
|
||||||
|
LARGE_INTEGER SectionSize = {65536L,0};
|
||||||
|
|
||||||
TRACE;
|
TRACE;
|
||||||
|
|
||||||
|
@ -240,6 +249,7 @@ TRACE;
|
||||||
PSX_NS_SESSION_DIRECTORY_NAME,
|
PSX_NS_SESSION_DIRECTORY_NAME,
|
||||||
Pid
|
Pid
|
||||||
);
|
);
|
||||||
|
OutputDebugStringW(Session.Port.NameBuffer);
|
||||||
RtlInitUnicodeString (& Session.Port.Name, Session.Port.NameBuffer);
|
RtlInitUnicodeString (& Session.Port.Name, Session.Port.NameBuffer);
|
||||||
InitializeObjectAttributes (& Oa, & Session.Port.Name, 0, NULL, NULL);
|
InitializeObjectAttributes (& Oa, & Session.Port.Name, 0, NULL, NULL);
|
||||||
Status = NtCreatePort (& Session.Port.Handle, & Oa, 0, 0, 0x10000);
|
Status = NtCreatePort (& Session.Port.Handle, & Oa, 0, 0, 0x10000);
|
||||||
|
@ -276,55 +286,56 @@ TRACE;
|
||||||
PSX_NS_SESSION_DIRECTORY_NAME,
|
PSX_NS_SESSION_DIRECTORY_NAME,
|
||||||
Pid
|
Pid
|
||||||
);
|
);
|
||||||
|
OutputDebugStringW(Session.Section.NameBuffer);
|
||||||
RtlInitUnicodeString (& Session.Section.Name, Session.Section.NameBuffer);
|
RtlInitUnicodeString (& Session.Section.Name, Session.Section.NameBuffer);
|
||||||
InitializeObjectAttributes (& Oa, & Session.Section.Name, 0, 0, 0);
|
InitializeObjectAttributes (& Oa, & Session.Section.Name, 0, 0, 0);
|
||||||
Status = NtCreateSection (
|
Status = NtCreateSection (
|
||||||
& Session.Section.Handle,
|
& Session.Section.Handle,
|
||||||
0, /* DesiredAccess */
|
SECTION_ALL_ACCESS, /* DesiredAccess */
|
||||||
& Oa,
|
& Oa,
|
||||||
NULL, /* SectionSize OPTIONAL */
|
& SectionSize,
|
||||||
PAGE_READWRITE, /* Protect 4 */
|
PAGE_READWRITE, /* Protect 4 */
|
||||||
SEC_COMMIT, /* Attributes */
|
SEC_COMMIT, /* Attributes */
|
||||||
0 /* FileHandle: 0=pagefile.sys */
|
0 /* FileHandle: 0=pagefile.sys */
|
||||||
);
|
);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
NtClose (Session.Port.Handle);
|
NtClose (Session.Port.Handle);
|
||||||
NtTerminateThread (Session.Port.Thread.Handle, Status);
|
NtTerminateThread (Session.Port.Thread.Handle, Status);
|
||||||
RtlDeleteCriticalSection (& Session.Lock);
|
RtlDeleteCriticalSection (& Session.Lock);
|
||||||
vtprintf ("%s: %s: NtCreateSection failed with %08x\n",
|
vtprintf ("%s: %s: NtCreateSection failed with %08x\n",
|
||||||
MyName, __FUNCTION__, Status);
|
MyName, __FUNCTION__, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
Session.Section.BaseAddress = NULL;
|
Session.Section.BaseAddress = NULL;
|
||||||
Session.Section.ViewSize = 0;
|
Session.Section.ViewSize = 0;
|
||||||
Status = NtMapViewOfSection (
|
Status = NtMapViewOfSection (
|
||||||
Session.Section.Handle,
|
Session.Section.Handle,
|
||||||
NtCurrentProcess(),
|
NtCurrentProcess(),
|
||||||
& Session.Section.BaseAddress,
|
& Session.Section.BaseAddress,
|
||||||
0, /* ZeroBits */
|
0, /* ZeroBits */
|
||||||
0, /* Commitsize */
|
0, /* Commitsize */
|
||||||
0, /* SectionOffset */
|
0, /* SectionOffset */
|
||||||
& Session.Section.ViewSize,
|
& Session.Section.ViewSize,
|
||||||
ViewUnmap,
|
ViewUnmap,
|
||||||
0, /* AllocationType */
|
0, /* AllocationType */
|
||||||
PAGE_READWRITE /* Protect 4 */
|
PAGE_READWRITE /* Protect 4 */
|
||||||
);
|
);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
NtClose (Session.Port.Handle);
|
NtClose (Session.Port.Handle);
|
||||||
NtTerminateThread (Session.Port.Thread.Handle, Status);
|
NtTerminateThread (Session.Port.Thread.Handle, Status);
|
||||||
NtClose (Session.Section.Handle);
|
NtClose (Session.Section.Handle);
|
||||||
RtlDeleteCriticalSection (& Session.Lock);
|
RtlDeleteCriticalSection (& Session.Lock);
|
||||||
vtprintf ("%s: %s: NtMapViewOfSection failed with %08x\n",
|
vtprintf ("%s: %s: NtMapViewOfSection failed with %08x\n",
|
||||||
MyName, __FUNCTION__, Status);
|
MyName, __FUNCTION__, Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* CreateTerminalToPsxChannel/0 PRIVATE
|
* CreateTerminalToPsxChannel/0 PRIVATE
|
||||||
*
|
*
|
||||||
* DESCRIPTION
|
* DESCRIPTION
|
||||||
*
|
*
|
||||||
|
@ -348,6 +359,8 @@ TRACE;
|
||||||
/*
|
/*
|
||||||
* Try connecting to \POSIX+\SessionPort.
|
* Try connecting to \POSIX+\SessionPort.
|
||||||
*/
|
*/
|
||||||
|
RtlInitUnicodeString (& Session.ServerPort.Name, Session.ServerPort.NameBuffer);
|
||||||
|
OutputDebugStringW(Session.ServerPort.Name.Buffer);
|
||||||
Status = NtConnectPort (
|
Status = NtConnectPort (
|
||||||
& Session.ServerPort.Handle,
|
& Session.ServerPort.Handle,
|
||||||
& Session.ServerPort.Name,
|
& Session.ServerPort.Name,
|
||||||
|
|
Loading…
Reference in a new issue