Move VMS subtree in the proper place.

svn path=/trunk/; revision=14948
This commit is contained in:
Emanuele Aliberti 2005-05-02 14:15:56 +00:00
parent 51e5c11dc8
commit 143f5e1f74
17 changed files with 724 additions and 0 deletions

View file

@ -0,0 +1,10 @@
#ifndef __VMS_SYS_LPCPROTO_H
#define __VMS_SYS_LPCPROTO_H
#define VMS_LPCPROTO_VERSION 1
#define VMS_OBNS_ROOT L"\\VMS"
#define VMS_API_PORT_NAME L"\\VMS\\ApiPort"
#define VMS_SBAPI_PORT_NAME L"\\VMS\\SbApiPort"
#endif

39
vms/lib/vmsdll/dllmain.c Normal file
View file

@ -0,0 +1,39 @@
/* $Id: dllmain.c,v 1.5 2002/11/24 18:42:15 robd Exp $
*
* dllmain.c
*
* A stub DllMain function which will be called by DLLs which do not
* have a user supplied DllMain.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warrenties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.5 $
* $Author: robd $
* $Date: 2002/11/24 18:42:15 $
*
*/
#include <windows.h>
/* LIBRARY ENTRY POINT ********************************************************/
BOOL
WINAPI
DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
return TRUE;
}
/* EOF */

View file

@ -0,0 +1 @@
void lib$find_file () { }

44
vms/lib/vmsdll/makefile Normal file
View file

@ -0,0 +1,44 @@
# $Id$
#
PATH_TO_TOP = ../../../reactos
TARGET_TYPE = dynlink
TARGET_NAME = vmsdll
TARGET_CFLAGS = -Wall -Werror -fno-builtin \
-D__USE_W32API \
-D_WIN32_IE=0x0500 \
-D_WIN32_WINNT=0x501 \
-DWINVER=0x600 \
TARGET_LFLAGS = -nostartfiles -nostdlib
TARGET_SDKLIBS = ntdll.a
LIB_OBJECTS = \
lib\stubs.o
RMS_OBJECTS = \
rms\stubs.o
MISC_OBJECTS = \
dllmain.o
SYS_OBJECTS = \
sys\stubs.o
TARGET_OBJECTS = \
$(LIB_OBJECTS) \
$(RMS_OBJECTS) \
$(SYS_OBJECTS) \
$(MISC_OBJECTS)
DEP_OBJECTS = $(TARGET_OBJECTS)
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
include $(TOOLS_PATH)/depend.mk

View file

@ -0,0 +1,7 @@
VMSDLL - ReactOS VMS+ Environment Subsystem
lib = Library APIs
rms = Record Management Services APIs
sys = System APIs

View file

View file

@ -0,0 +1,30 @@
/* $Id$ */
void sys$ascefc (void) {}
void sys$asctim (void) {}
void sys$assign (void) {}
void sys$bintim (void) {}
void sys$clref (void) {}
void sys$crelnm (void) {}
void sys$crelnt (void) {}
void sys$dclast (void) {}
void sys$enq (void) {}
void sys$forcex (void) {}
void sys$gettim (void) {}
void sys$hiber (void) {}
void sys$numtim (void) {}
void sys$qio (void) {}
void sys$qiow (void) {}
void sys$readef (void) {}
void sys$schdwk (void) {}
void sys$setef (void) {}
void sys$setast (void) {}
void sys$setime (void) {}
void sys$setimr (void) {}
void sys$setpri (void) {}
void sys$setprn (void) {}
void sys$synch (void) {}
void sys$trnlnm (void) {}
void sys$waitfr (void) {}
void sys$wake (void) {}
/* EOF */

32
vms/lib/vmsdll/vmsdll.def Normal file
View file

@ -0,0 +1,32 @@
LIBRARY vmsdll.dll
EXPORTS
; LIB
lib$find_file
; SYS
sys$ascefc
sys$asctim
sys$assign
sys$bintim
sys$clref
sys$crelnm
sys$crelnt
sys$dclast
sys$enq
sys$forcex
sys$gettim
sys$hiber
sys$numtim
sys$qio
sys$qiow
sys$readef
sys$schdwk
sys$setef
sys$setast
sys$setime
sys$setimr
sys$setpri
sys$setprn
sys$synch
sys$trnlnm
sys$waitfr
sys$wake

4
vms/lib/vmsdll/vmsdll.rc Normal file
View file

@ -0,0 +1,4 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS/VMS API Client Library\0"
#define REACTOS_STR_INTERNAL_NAME "vmsdll\0"
#define REACTOS_STR_ORIGINAL_FILENAME "vmdsll.dll\0"
#include <reactos/version.rc>

120
vms/makefile Normal file
View file

@ -0,0 +1,120 @@
# $Id$
#
# ReactOS VMS Personality
#
PATH_TO_TOP = ../reactos
include $(PATH_TO_TOP)/rules.mak
VMS_PATH = .
VMS_OTHER = server
VMS_TOOLS = mksystab
VMS_LIBS = vmsdll
VMS_APPS = # vmsw32
VMS_MODULES = $(VMS_OTHER) $(VMS_TOOLS) $(VMS_LIBS) $(VMS_APPS)
all: implib $(VMS_MODULES)
implib: $(VMS_MODULES:%=%_implib)
clean: $(VMS_MODULES:%=%_clean)
install: $(VMS_MODULES:%=%_install)
.PHONY: all implib clean
#
# Other VMS+ Modules
#
$(VMS_OTHER): %:
make -f Makefile -C $(VMS_PATH)/$*
$(VMS_OTHER:%=%_implib): %_implib:
make -f Makefile -C $(VMS_PATH)/$* implib
$(VMS_OTHER:%=%_clean): %_clean:
make -f Makefile -C $(VMS_PATH)/$* clean
$(VMS_OTHER:%=%_dist): %_dist:
make -f Makefile -C $(VMS_PATH)/$* dist
$(VMS_OTHER:%=%_install): %_install:
make -f Makefile -C $(VMS_PATH)/$* install
.PHONY: $(VMS_OTHER) $(VMS_OTHER:%=%_implib) $(VMS_OTHER:%=%_clean) $(VMS_OTHER:%=%_install) $(VMS_OTHER:%=%_dist)
#
# VMS+ Tools
#
$(VMS_TOOLS): %:
make -f Makefile -C $(VMS_PATH)/tools/$*
$(VMS_TOOLS:%=%_implib): %_implib:
make -f Makefile -C $(VMS_PATH)/tools/$* implib
$(VMS_TOOLS:%=%_clean): %_clean:
make -f Makefile -C $(VMS_PATH)/tools/$* clean
$(VMS_TOOLS:%=%_dist): %_dist:
make -f Makefile -C $(VMS_PATH)/tools/$* dist
$(VMS_TOOLS:%=%_install): %_install:
make -f Makefile -C $(VMS_PATH)/tools/$* install
.PHONY: $(VMS_LIBS) $(VMS_LIBS:%=%_implib) $(VMS_LIBS:%=%_clean) $(VMS_LIBS:%=%_install) $(VMS_LIBS:%=%_dist)
#
# VMS+ DLLs
#
$(VMS_LIBS): %:
make -f Makefile -C $(VMS_PATH)/lib/$*
$(VMS_LIBS:%=%_implib): %_implib:
make -f Makefile -C $(VMS_PATH)/lib/$* implib
$(VMS_LIBS:%=%_clean): %_clean:
make -f Makefile -C $(VMS_PATH)/lib/$* clean
$(VMS_LIBS:%=%_dist): %_dist:
make -f Makefile -C $(VMS_PATH)/lib/$* dist
$(VMS_LIBS:%=%_install): %_install:
make -f Makefile -C $(VMS_PATH)/lib/$* install
.PHONY: $(VMS_LIBS) $(VMS_LIBS:%=%_implib) $(VMS_LIBS:%=%_clean) $(VMS_LIBS:%=%_install) $(VMS_LIBS:%=%_dist)
#
# VMS+ Programs
#
$(VMS_APPS): %:
make -f Makefile -C $(VMS_PATH)/apps/$*
$(VMS_APPS:%=%_implib): %_implib:
make -f Makefile -C $(VMS_PATH)/apps/$* implib
$(VMS_APPS:%=%_clean): %_clean:
make -f Makefile -C $(VMS_PATH)/apps/$* clean
$(VMS_APPS:%=%_dist): %_dist:
make -f Makefile -C $(VMS_PATH)/apps/$* dist
$(VMS_APPS:%=%_install): %_install:
make -f Makefile -C $(VMS_PATH)/apps/$* install
.PHONY: $(VMS_APPS) $(VMS_APPS:%=%_implib) $(VMS_APPS:%=%_clean) $(VMS_APPS:%=%_install) $(VMS_APPS:%=%_dist)
etags:
find . -name "*.[ch]" -print | etags --language=c -
# EOF

275
vms/server/init.c Normal file
View file

@ -0,0 +1,275 @@
/* $Id: $
*
* init.c - VMS Enviroment Subsystem Server - Initialization
*
* ReactOS Operating System
*
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* --------------------------------------------------------------------
*/
#include "vmsss.h"
//#define NDEBUG
#include <debug.h>
HANDLE VmsSbApiPort = (HANDLE) 0; // \VMS\SbApiPort
HANDLE SmCalledBack = (HANDLE) 0; // signalled when SM connects to \VMS\SbApiPort
HANDLE SmVmsSbApiPort = (HANDLE) 0; // server side (our one) port for SM conn request
HANDLE SmApiPort = (HANDLE) 0; // client side of \SmApiPort
HANDLE VmsSessionPort = (HANDLE) 0; // pseudo terminals call here for a new session
HANDLE VmsApiPort = (HANDLE) 0; // VMS processes call here for system calls
/**********************************************************************
* SB API Port Thread
*********************************************************************/
static VOID STDCALL
VmsSbApiPortThread (PVOID x)
{
HANDLE Port = (HANDLE) x;
NTSTATUS Status = STATUS_SUCCESS;
LPC_MAX_MESSAGE ConnectionRequest = {{0}};
DPRINT("VMS: %s: called\n", __FUNCTION__);
Status = NtListenPort (Port, & ConnectionRequest.Header);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: NtListenPort failed (Status=0x%08lx)\n",
__FUNCTION__, Status);
}else{
DPRINT("VMS: %s received a connection request\n", __FUNCTION__);
Status = NtAcceptConnectPort (& SmVmsSbApiPort,
0,
& ConnectionRequest.Header,
TRUE, /* accept it */
NULL,
NULL);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: NtAcceptConnectPort failed (Status=0x%08lx)\n",
__FUNCTION__, Status);
}else{
DPRINT("VMS: %s accepted the connection request\n", __FUNCTION__);
Status = NtCompleteConnectPort (SmVmsSbApiPort);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: NtCompleteConnectPort failed (Status=0x%08lx)\n",
__FUNCTION__, Status);
}else{
DPRINT("VMS: %s completed the connection request\n", __FUNCTION__);
Status = NtSetEvent (SmCalledBack, NULL);
DPRINT("VMS: %s signalled the main thread to initialize the subsystem\n", __FUNCTION__);
DPRINT("VMS: %s enters main loop\n", __FUNCTION__);
while (TRUE)
{
}
}
}
}
NtClose (Port);
NtTerminateThread (NtCurrentThread(), Status);
}
/**********************************************************************
* API Port Thread
*********************************************************************/
static VOID STDCALL
VmsApiPortThread (PVOID x)
{
HANDLE Port = (HANDLE) x;
NTSTATUS Status = STATUS_SUCCESS;
DPRINT("VMS: %s: called\n", __FUNCTION__);
while (TRUE)
{
}
NtClose (Port);
NtTerminateThread (NtCurrentThread(), Status);
}
/**********************************************************************
* NAME PRIVATE
* VmspCreateObDirectory/1
*/
static NTSTATUS FASTCALL
VmspCreateObDirectory (PWSTR DirectoryName)
{
UNICODE_STRING usDirectoryName = {0};
OBJECT_ATTRIBUTES DirectoryAttributes = {0};
NTSTATUS Status = STATUS_SUCCESS;
HANDLE hDirectory = (HANDLE) 0;
DPRINT("VMS: %s called\n", __FUNCTION__);
RtlInitUnicodeString (& usDirectoryName,
DirectoryName);
InitializeObjectAttributes (& DirectoryAttributes,
& usDirectoryName,
0, NULL, NULL);
Status = NtCreateDirectoryObject (& hDirectory,
DIRECTORY_CREATE_SUBDIRECTORY,
& DirectoryAttributes);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: NtCreateDirectoryObject failed (Status=0x%08lx)\n",
__FUNCTION__, Status);
return Status;
}
NtClose (hDirectory);
return STATUS_SUCCESS;
}
/**********************************************************************
* NAME PRIVATE
* VmspCreatePort/1
*/
static NTSTATUS STDCALL
VmspCreatePort (IN OUT PHANDLE pPortHandle,
IN PWSTR PortName,
IN ULONG MaxDataSize,
IN ULONG MaxMessageSize,
IN PTHREAD_START_ROUTINE ListeningThread)
{
UNICODE_STRING usPortName = {0};
OBJECT_ATTRIBUTES PortAttributes = {0};
NTSTATUS Status = STATUS_SUCCESS;
DPRINT("VMS: %s called\n", __FUNCTION__);
if(NULL == ListeningThread)
{
return STATUS_INVALID_PARAMETER;
}
RtlInitUnicodeString (& usPortName, PortName);
Status = NtCreatePort (pPortHandle,
& PortAttributes,
MaxDataSize,
MaxMessageSize,
0);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: NtCreatePort failed (Status=0x%08lx)\n", __FUNCTION__, Status);
return Status;
}
Status = RtlCreateUserThread (NtCurrentProcess(),
NULL,
FALSE,
0, 0, 0,
ListeningThread,
pPortHandle,
NULL, NULL);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: RtlCreateUserThread failed (Status=0x%08lx)\n", __FUNCTION__, Status);
return Status;
}
return Status;
}
/**********************************************************************
* VmsInitializeServer/0
*/
NTSTATUS
VmsInitializeServer(VOID)
{
NTSTATUS Status = STATUS_SUCCESS;
WCHAR NameBuffer [32];
DPRINT("VMS: %s called\n", __FUNCTION__);
/* Create the \VMS directory */
wcscpy (NameBuffer, L"\\VMS");
Status = VmspCreateObDirectory (NameBuffer);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: VmspCreateObDirectory failed!\n", __FUNCTION__);
}else{
/* Create the \VMS\SbApiPort port */
wcscat (NameBuffer, L"\\SbApiPort");
Status = VmspCreatePort (& VmsSbApiPort,
NameBuffer,
0x104,
0x148,
VmsSbApiPortThread);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS %s: VmspCreatePort failed (Status=%08lx)\n",
__FUNCTION__, Status);
return Status;
}else{
OBJECT_ATTRIBUTES EventAttributes;
InitializeObjectAttributes (& EventAttributes,
NULL,
0,
NULL,
NULL);
Status = NtCreateEvent (& SmCalledBack,
EVENT_ALL_ACCESS,
& EventAttributes,
SynchronizationEvent,
FALSE);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: NtCreateEvent failed (Status=0x%08lx)\n",
__FUNCTION__, Status);
return Status;
}else{
UNICODE_STRING VmsSbApiPortName;
RtlInitUnicodeString (& VmsSbApiPortName, NameBuffer);
Status = SmConnectApiPort (& VmsSbApiPortName,
VmsSbApiPort,
77, /* VMS CUI */
& SmApiPort);
if(!NT_SUCCESS(Status))
{
DPRINT("VMS: %s: SmConnectApiPort failed (Status=0x%08lx)\n",
__FUNCTION__, Status);
return Status;
}else{
Status = NtWaitForSingleObject (SmCalledBack,
FALSE,
INFINITE);
/* OK initialize the VMS subsystem */
wcscpy (& NameBuffer[4], L"\\ApiPort");
Status = VmspCreatePort (& VmsApiPort,
NameBuffer,
0x104,
0x148,
VmsApiPortThread);
/* TODO */
wcscpy (& NameBuffer[4], L"\\Session");
Status = VmspCreateObDirectory (NameBuffer);
/* TODO */
Status = SmCompleteSession (SmApiPort,
VmsSbApiPort,
VmsApiPort);
}
}
}
}
return STATUS_SUCCESS;
}
/* EOF */

24
vms/server/makefile Normal file
View file

@ -0,0 +1,24 @@
# $Id: $
#
# ReactOS VMS+ Environment Subsystem Server
#
PATH_TO_TOP = ../../reactos
TARGET_TYPE = program
TARGET_APPTYPE = native
TARGET_NAME = vmsss
TARGET_SDKLIBS = ntdll.a smdll.a
TARGET_CFLAGS = -Iinclude -I../include
TARGET_OBJECTS = vmsss.o init.o server.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

68
vms/server/server.c Normal file
View file

@ -0,0 +1,68 @@
/* $Id: $
*
* init.c - VMS Enviroment Subsystem Server - Initialization
*
* ReactOS Operating System
*
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* --------------------------------------------------------------------
*/
#define __USE_NT_LPC__
#include "vmsss.h"
//#define NDEBUG
#include <debug.h>
/**********************************************************************
* NAME PRIVATE
* VmspCreatePort/1
*/
NTSTATUS VmsRunServer (VOID)
{
NTSTATUS Status = STATUS_SUCCESS;
LPC_MAX_MESSAGE Request;
PLPC_MESSAGE Reply = NULL;
ULONG MessageType = 0;
while (TRUE)
{
Status = NtReplyWaitReceivePort (VmsApiPort,
0,
Reply,
& Request);
if(NT_SUCCESS(Status))
{
MessageType = PORT_MESSAGE_TYPE(Request);
DPRINT("VMS: %s received a message (Type=%d)\n",
__FUNCTION__, MessageType);
switch(MessageType)
{
default:
continue;
}
}else{
DPRINT("VMS: %s: NtReplyWaitReceivePort failed (Status=%08lx)\n",
__FUNCTION__, Status);
}
}
return Status;
}
/* EOF */

46
vms/server/vmsss.c Normal file
View file

@ -0,0 +1,46 @@
/* $Id: $
*
* vmsss.c - VMS Enviroment Subsystem Server
*
* ReactOS Operating System
*
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* --------------------------------------------------------------------
*/
#include "vmsss.h"
#define NDEBUG
#include <debug.h>
/* Native image's entry point */
VOID STDCALL
NtProcessStartup(PPEB Peb)
{
NTSTATUS Status = STATUS_SUCCESS;
Status = VmsInitializeServer();
if(STATUS_SUCCESS != Status)
{
DPRINT("VMS: VmsInitializeServer failed! Aborting. (Status=%lx)\n", Status);
}
Status = VmsRunServer();
NtTerminateProcess(NtCurrentProcess(),Status);
}
/* EOF */

15
vms/server/vmsss.h Normal file
View file

@ -0,0 +1,15 @@
#ifndef _VMSSS_H_INCLUDED_
#define _VMSSS_H_INCLUDED_
#define NTOS_MODE_USER
#include <ntos.h>
#include <sm/helper.h>
/* init.c */
extern HANDLE VmsApiPort;
NTSTATUS VmsInitializeServer(VOID);
/* server.c */
NTSTATUS VmsRunServer(VOID);
#endif /* ndef _VMSSS_H_INCLUDED_ */

4
vms/server/vmsss.rc Normal file
View file

@ -0,0 +1,4 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS/VMS Environment Subsystem Server\0"
#define REACTOS_STR_INTERNAL_NAME "vmsss\0"
#define REACTOS_STR_ORIGINAL_FILENAME "vmsss.exe\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,5 @@
all: implib
implib:
clean: