Performed housekeeping to get the subsystem building. Introduced ros makefile 'standards' throughout.

Is anybody doing any work on the OS/2 support?

svn path=/trunk/; revision=3946
This commit is contained in:
Robert Dickenson 2003-01-07 16:23:12 +00:00
parent a8e38f8c30
commit a6d6844e8a
20 changed files with 256 additions and 123 deletions

View file

@ -0,0 +1,3 @@
*.exe
*.o
*.sym

View file

@ -1,32 +1,37 @@
# $Id: Makefile,v 1.1 2002/03/23 19:23:27 robertk Exp $
# $Id: Makefile,v 1.2 2003/01/07 16:23:10 robd Exp $
#
# To run it in Win32 console mode, undefine __SUBSYSTEM_WINDOWS__
# and pass "console" in the ld's --subsystem option.
#
#
PATH_TO_TOP=../../../..
PATH_TO_OS2_TOP=../..
PATH_TO_TOP = ../../../reactos
TARGET_NAME=bepslep
PATH_TO_OS2_TOP = ../..
CFLAGS=-D__SUBSYSTEM_WINDOWS__
TARGET_TYPE = program
OBJECTS=$(TARGET_NAME).o
TARGET_NORC = yes
LIBRARIES=\
$(PATH_TO_OS2_TOP)/dll/doscalls.dll
#TARGET_APPTYPE = console
TARGET_APPTYPE = windows
$(TARGET_NAME): $(OBJECTS) $(LIBRARIES)
$(CC) \
$(CFLAGS) \
$(OBJECTS) \
$(LIBRARIES)\
-o $@ \
-Wl,--subsystem,windows\
-nostartfiles \
-nostdlib
TARGET_NAME = bepslep
TARGET_CFLAGS = -D__SUBSYSTEM_WINDOWS__
TARGET_LFLAGS = -nostartfiles
TARGET_SDKLIBS = doscalls.a
TARGET_GCCLIBS = stdc++
#TARGET_LIBS = $(PATH_TO_OS2_TOP)/lib/crt0w32.o \
# $(PATH_TO_TOP)/dk/psx/lib/psxdll.a
# $(PATH_TO_OS2_TOP)/dll/doscalls.dll
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View file

@ -1,6 +1,7 @@
#define INCL_DOSPROCESS
#include "../../include/os2.h"
//#include "../../include/ros2.h"
void Eingang()
{
@ -16,4 +17,4 @@ void WinMainCRTStartup()
a= b+3;
b=a+3;
Eingang();
}
}

View file

@ -3,6 +3,10 @@
#ifndef _OS2EMX_H
#define _OS2EMX_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#pragma pack(1)
/* ------------------------ INCL_ SYMBOLS --------------------------------- */
@ -2656,7 +2660,18 @@ ULONG DosKillProcess (ULONG ulAction, PID pid);
ULONG DosKillThread (TID tid);
ULONG DosResumeThread (TID tid);
ULONG DosSetPriority (ULONG ulScope, ULONG ulClass, LONG lDelta, ULONG ulID);
#define STDCALL __attribute__ ((stdcall))
//#define CDECL __attribute__ ((cdecl))
//#define CALLBACK WINAPI
//#define PASCAL WINAPI
#define WINAPI STDCALL
//#define APIENTRY STDCALL
//ULONG WINAPI DosSleep (ULONG ulInterval);
ULONG DosSleep (ULONG ulInterval);
ULONG DosSuspendThread (TID tid);
ULONG DosVerifyPidTid (PID pid, TID tid);
ULONG DosWaitChild (ULONG ulAction, ULONG ulWait, PRESULTCODES pReturnCodes,
@ -12566,6 +12581,10 @@ USHORT MouSynch (USHORT fWait);
#pragma pack(4)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* not _OS2EMX_H */
/* Note 1:
@ -12581,3 +12600,4 @@ USHORT MouSynch (USHORT fWait);
* indent-tabs-mode: t
* end:
*/

View file

@ -27,14 +27,23 @@
put into the namespace NT. The still conflicting #defines are handled
like this: If ntddk.h defintes a symbol FOO and os2.h does the same,
this file here undefines the ntddk.h-one and renames it to NT_FOO.
This is only done for conflicting symbols. Of course, this ist a
This is only done for conflicting symbols. Of course, this list is a
source for errors. But is there a better solution than renaming
all of the symbols?
*/
#ifndef __ROS2_H__
#define __ROS2_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
namespace NT
{
#include <ddk/ntddk.h>
#include <napi/types.h>
}
@ -49,4 +58,34 @@ namespace OS2
#include "os2.h"
}
using namespace OS2;
using namespace OS2;
APIRET STDCALL Dos32Open(PSZ pszFileName, PHFILE pHf,
PULONG pulAction, ULONG cbFile,
ULONG ulAttribute, ULONG fsOpenFlags,
ULONG fsOpenMode, PVOID reserved ); //ULONGPEAOP2 peaop2)
APIRET STDCALL Dos32Close(HFILE hFile);
APIRET STDCALL Dos32Read(HFILE hFile, PVOID pBuffer,
ULONG cbRead, PULONG pcbActual);
APIRET STDCALL Dos32Write(HFILE hFile, PVOID pBuffer,
ULONG cbWrite, PULONG pcbActual);
ULONG STDCALL DosSleep (ULONG ulInterval);
ULONG STDCALL DosBeep (ULONG ulFrequency, ULONG ulDuration);
VOID STDCALL DosExit (ULONG ulAction, ULONG ulResult);
//ULONG STDCALL DosDevIOCtl (HFILE hDevice, ULONG ulCategory, ULONG ulFunction,
// PVOID pParams, ULONG ulParamsLengthMax, PULONG pulParamsLength,
// PVOID pData, ULONG ulDataLengthMax, PULONG pulDataLength);
typedef ULONG foo_TID;
typedef foo_TID* foo_PTID;
typedef void (*foo_PFNTHREAD)(ULONG ulThreadArg);
ULONG STDCALL DosCreateThread (foo_PTID ptidThreadID, foo_PFNTHREAD pfnThreadAddr,
ULONG ulThreadArg, ULONG ulFlags, ULONG ulStackSize);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __ROS2_H__ */

View file

@ -0,0 +1,5 @@
*.exe
*.o
*.sym
*.dll
*.coff

View file

@ -0,0 +1 @@
*.o

View file

@ -1,4 +1,4 @@
/* $Id: devices.cpp,v 1.3 2002/09/04 22:19:47 robertk Exp $
/* $Id: devices.cpp,v 1.4 2003/01/07 16:23:11 robd Exp $
*/
/*
*
@ -62,6 +62,4 @@ APIRET STDCALL Dos32DevIOCtl(HFILE hDevice, ULONG category, ULONG function,
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */
/* EOF */

View file

@ -1,4 +1,4 @@
; $Id: doscalls.def,v 1.4 2002/09/04 22:19:47 robertk Exp $
; $Id: doscalls.def,v 1.5 2003/01/07 16:23:11 robd Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
@ -10,14 +10,14 @@ DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services
EXPORTS
; FIXME: fill in all exports
DosSleep@4
DosClose@4
DosOpen@32
DosRead@16
DosWrite@16
DosDevIOCtl@36
DosBeep@8
DosExit@8
DosCreateThread@20
DosSleep
Dos32Close
Dos32Open
Dos32Read
Dos32Write
;DosDevIOCtl
DosBeep
DosExit
DosCreateThread
; EOF

View file

@ -1,4 +1,4 @@
; $Id: doscalls.edf,v 1.2 2002/03/24 18:55:38 ea Exp $
; $Id: doscalls.edf,v 1.3 2003/01/07 16:23:11 robd Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
@ -10,14 +10,14 @@ DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services
EXPORTS
; FIXME: fill in all exports
Dos32Sleep=Dos32Sleep@4 @229
Dos32Close=Dos32Close@4 @257
Dos32Open=Dos32Open@32 @273
Dos32Read=Dos32Read@16 @281
Dos32Write=Dos32Write@16 @282
Dos32DevIOCtl=Dos32DevIOCtl@36 @284
Dos32Beep=Dos32Beep@8 @286
Dos32Exit=Dos32Exit@8 @234
Dos32CreateThread=Dos32CreateThread@20 @311
DosSleep=DosSleep@4 @229
Dos32Close=Dos32Close@4 @257
Dos32Open=Dos32Open@32 @273
Dos32Read=Dos32Read@16 @281
Dos32Write=Dos32Write@16 @282
;DosDevIOCtl=DosDevIOCtl@36 @284
DosBeep=DosBeep@8 @286
DosExit=DosExit@8 @234
DosCreateThread=DosCreateThread@20 @311
; EOF

View file

@ -0,0 +1 @@
*.o

View file

@ -1,4 +1,4 @@
/* $Id: openclose.cpp,v 1.3 2002/09/04 22:19:47 robertk Exp $
/* $Id: openclose.cpp,v 1.4 2003/01/07 16:23:11 robd Exp $
*/
/*
*
@ -20,7 +20,6 @@
#include "ros2.h"
APIRET STDCALL Dos32Open(PSZ pszFileName, PHFILE pHf,
PULONG pulAction, ULONG cbFile,
ULONG ulAttribute, ULONG fsOpenFlags,
@ -130,12 +129,14 @@ APIRET STDCALL Dos32Close(HFILE hFile)
nErrCode = NT::ZwClose( (NT::HANDLE)hFile );
switch( nErrCode )
{
/*
case STATUS_SUCCESS:
return NO_ERROR;
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
case STATUS_HANDLE_NOT_CLOSABLE:
return ERROR_FILE_NOT_FOUND;
*/
}
return nErrCode;
}
@ -155,9 +156,11 @@ APIRET STDCALL Dos32Read(HFILE hFile, PVOID pBuffer,
*pcbActual = isbStatus.Information;
switch(nErrCode)
{
/*
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
// FIXME: complete this
*/
}
return NO_ERROR;
}
@ -175,12 +178,14 @@ APIRET STDCALL Dos32Write(HFILE hFile, PVOID pBuffer,
return ERROR_CALL_NOT_IMPLEMENTED;
switch(nErrCode)
{
/*
case STATUS_SUCCESS:
case STATUS_PENDING:
case STATUS_ACCESS_DENIED:
case STATUS_INVALID_HANDLE:
case STATUS_FILE_LOCK_CONFLICT:
return 0;
*/
}
return 0;
}

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.5 2002/09/04 22:19:47 robertk Exp $
# $Id: makefile,v 1.6 2003/01/07 16:23:11 robd Exp $
PATH_TO_TOP = ../../../reactos
@ -15,7 +15,7 @@ TARGET_BASE = 0x60000000
TARGET_CPPFLAGS =\
-Wall \
-I$(PATH_TO_OS2_TOP)/include \
-D__DOSCALLSDLL__
-D__DOSCALLSDLL__
# removed CFLAGX
# -fno-builtin \
# -nostdinc \
@ -23,24 +23,33 @@ TARGET_CPPFLAGS =\
TARGET_LFLAGS = -nostartfiles
TARGET_LIBS = doscalls.a
TARGET_SDKLIBS = ntdll.a
#TARGET_GCCLIBS = gcc
TARGET_GCCLIBS = stdc++
TARGET_OBJECTS = $(TARGET_NAME).o
TARGET_CLEAN = file/*.o vio/*.o sync/*.o mem/*.o \
misc/*.o mou/*.o kbd/*.o run/*.o \
doscalls.dll temp.exp
DOSCALLS_MISC_OBJECTS = misc/doscalls.o misc/error.o
MISC_OBJECTS = misc/doscalls.o misc/error.o
DOSCALLS_OTHER_O = file/openclose.o run/process.o devices/devices.o
FILE_OBJECTS = file/openclose.o
#SYNC_OBJECTS =
RUN_OBJECTS = run/process.o
TARGET_OBJECTS = $(DOSCALLS_OTHER_O) $(DOSCALLS_MISC_OBJECTS)
DEVICES_OBJECTS = devices/devices.o
OTHER_OBJECTS =
SYNC_OBJECTS =
TARGET_OBJECTS = $(FILE_OBJECTS) $(RUN_OBJECTS) $(DEVICES_OBJECTS) \
$(MISC_OBJECTS) $(OTHER_OBJECTS) $(SYNC_OBJECTS)
#TARGET_CLEAN = file/*.o vio/*.o sync/*.o mem/*.o \
# misc/*.o mou/*.o kbd/*.o run/*.o \
# doscalls.dll temp.exp
include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1 @@
*.o

View file

@ -1,4 +1,4 @@
/* $Id: error.cpp,v 1.2 2002/09/04 22:19:47 robertk Exp $
/* $Id: error.cpp,v 1.3 2003/01/07 16:23:11 robd Exp $
*/
/*
*
@ -119,7 +119,7 @@ APIRET STDCALL DosBeep(ULONG freq, ULONG dur)
0 NO_ERROR
87 ERROR_INVALID_PARAMETER
/*******************************************/
*******************************************/
APIRET DosError( ULONG error)
{
return ERROR_CALL_NOT_IMPLEMENTED;
@ -162,11 +162,4 @@ APIRET DosMove(PSZ pszOld, PSZ pszNew)
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -0,0 +1 @@
*.o

View file

@ -1,4 +1,4 @@
/* $Id: process.cpp,v 1.5 2002/09/04 22:19:47 robertk Exp $
/* $Id: process.cpp,v 1.6 2003/01/07 16:23:11 robd Exp $
*/
/*
*
@ -15,6 +15,7 @@
*/
//#if defined (INCL_DOS)
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#include "ros2.h"
@ -30,7 +31,7 @@ APIRET STDCALL DosSleep(ULONG msec)
}
/* $Id: process.cpp,v 1.5 2002/09/04 22:19:47 robertk Exp $ */
/* $Id: process.cpp,v 1.6 2003/01/07 16:23:11 robd Exp $ */
/* Terminates the current thread or the current Process.
Decission is made by action
FIXME: move this code to OS2.EXE */

3
os2/server/.cvsignore Normal file
View file

@ -0,0 +1,3 @@
*.exe
*.o
*.sym

View file

@ -1,9 +1,11 @@
# $Id: makefile,v 1.1 2002/03/23 19:23:28 robertk Exp $
# $Id: makefile,v 1.2 2003/01/07 16:23:12 robd Exp $
PATH_TO_TOP = ../../..
PATH_TO_TOP = ../../../reactos
TARGET_TYPE = program
TARGET_NORC = yes
TARGET_APPTYPE = native
TARGET_NAME = os2ss
@ -12,15 +14,18 @@ TARGET_INSTALLDIR = system32
TARGET_CFLAGS = -D__NTAPP__
#OBJECTS_API =
TARGET_SDKLIBS = ntdll.a kernel32.a csrss.a
TARGET_GCCLIBS = stdc++
OBJECTS_API =
OBJECTS_MISC = \
$(TARGET_NAME).o
TARGET_OBJECTS = \
$(OBJECTS_API)
# \
# $(OBJECTS_MISC)
$(OBJECTS_API) \
$(OBJECTS_MISC)
include $(PATH_TO_TOP)/rules.mak

View file

@ -1,4 +1,4 @@
/* $Id: os2ss.cpp,v 1.1 2002/03/23 19:23:28 robertk Exp $
/* $Id: os2ss.cpp,v 1.2 2003/01/07 16:23:12 robd Exp $
*
* reactos/subsys/csrss/api/process.c
*
@ -10,7 +10,48 @@
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include <ntos/synch.h>
extern "C" {
BOOL CsrServerInitialization(ULONG ArgumentCount, PWSTR *ArgumentArray);
VOID DisplayString(LPCWSTR lpwString);
//BOOL STDCALL CsrServerInitialization (ULONG ArgumentCount, PWSTR *ArgumentArray);
//VOID STDCALL DisplayString(LPCWSTR lpwString);
//VOID STDCALL PrintString (char* fmt, ...);
//NTSTATUS STDCALL NtDisplayString(IN PUNICODE_STRING DisplayString);
void
DisplayString(LPCWSTR lpwString)
{
UNICODE_STRING us;
RtlInitUnicodeString(&us, lpwString);
NtDisplayString(&us);
}
/*
void
PrintString(char* fmt,...)
{
char buffer[512];
va_list ap;
UNICODE_STRING UnicodeString;
ANSI_STRING AnsiString;
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap);
RtlInitAnsiString(&AnsiString, buffer);
RtlAnsiStringToUnicodeString(&UnicodeString,
&AnsiString,
TRUE);
NtDisplayString(&UnicodeString);
RtlFreeUnicodeString(&UnicodeString);
}
*/
}
/* server variables */
@ -46,70 +87,71 @@ void NtProcessStartup (PPEB Peb)
while (ArgBuffer[i])
{
if (ArgBuffer[i] == L' ')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
i++;
while (ArgBuffer[i] == L' ')
i++;
afterlastspace = i;
}
else
{
i++;
}
if (ArgBuffer[i] == L' ')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
i++;
while (ArgBuffer[i] == L' ')
i++;
afterlastspace = i;
}
else
{
i++;
}
}
if (ArgBuffer[afterlastspace] != L'\0')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
}
RtlInitUnicodeString(&UnicodeString,
L"\\CsrssInitDone");
L"\\CsrssInitDone");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
EVENT_ALL_ACCESS,
0,
NULL);
&UnicodeString,
EVENT_ALL_ACCESS,
0,
NULL);
Status = NtOpenEvent(&CsrssInitEvent,
EVENT_ALL_ACCESS,
&ObjectAttributes);
EVENT_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DbgPrint("CSR: Failed to open csrss notification event\n");
DbgPrint("CSR: Failed to open csrss notification event\n");
}
if (CsrServerInitialization (argc, argv) == TRUE)
{
NtSetEvent(CsrssInitEvent,
NULL);
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
NtSetEvent(CsrssInitEvent,
NULL);
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/* terminate the current thread only */
NtTerminateThread( NtCurrentThread(), 0 );
/* terminate the current thread only */
NtTerminateThread( NtCurrentThread(), 0 );
}
else
{
DisplayString( L"CSR: Subsystem initialization failed.\n" );
DisplayString( L"CSR: Subsystem initialization failed.\n" );
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/*
* Tell SM we failed.
*/
NtTerminateProcess( NtCurrentProcess(), 0 );
}
/*
* Tell SM we failed.
*/
NtTerminateProcess( NtCurrentProcess(), 0 );
}
}