Resuscitate OS/2 subsystem from revision 24496.

svn path=/trunk/; revision=65459
This commit is contained in:
Hermès Bélusca-Maïto 2014-11-23 15:22:07 +00:00
parent ace5ce5329
commit 9f2787eb32
36 changed files with 15524 additions and 0 deletions

View file

@ -0,0 +1,37 @@
# $Id: Makefile,v 1.2 2003/01/07 16:23:10 robd Exp $
#
#
PATH_TO_TOP = ../../../reactos
PATH_TO_OS2_TOP = ../..
TARGET_TYPE = program
TARGET_NORC = yes
#TARGET_APPTYPE = console
TARGET_APPTYPE = windows
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

@ -0,0 +1,20 @@
#define INCL_DOSPROCESS
#include "../../include/os2.h"
//#include "../../include/ros2.h"
void Eingang()
{
DosBeep(3000,300);
DosSleep(1000);
DosBeep(4000,200);
DosExit(0,0);
}
void WinMainCRTStartup()
{
int a, b;
a= b+3;
b=a+3;
Eingang();
}

View file

View file

@ -0,0 +1,5 @@
<group>
<directory name="bepslep">
<xi:include href="bepslep/bepslep.xml" />
</directory>
</group>

340
rossubsys/os2/copying Normal file
View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program 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 program 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 program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -0,0 +1,11 @@
<group>
<directory name="apps">
<xi:include href="apps/directory.xml" />
</directory>
<directory name="lib">
<xi:include href="lib/directory.xml" />
</directory>
<directory name="server">
<xi:include href="server/os2srv.xml" />
</directory>
</group>

View file

@ -0,0 +1,50 @@
Win32 and os2ss sight to the system partition
+C < contains under os2ss a autogenerated config.sys
|
+-ROS
+-NATIVE < NTDLL, ntoskrnl, hal.dll, csrss.exe os2.exe psx.exe ...
| +-DRIVERS < *.SYS
| +-CONFIG < registry
+-WIN32
| +-SYSTEM < user32.dll kernel32.dll ...
| +-FONTS
| +...
+-OS2
| +-DLL < doscalls.dll ....
| +-SYSTEM
| +-...
+-PSX
+-etc < mountpoint for posix apps
+-bin
+-dev
+-lib < posix.dll
+-tmp
+-var
+-mnt < empty
posix sight to the system partition
/
+-etc < mountpoint for posix apps
+-bin
+-dev < link to OB-mans Devices
+-lib < posix.dll
+-tmp < alias to systemtemp
+-var
+-mnt
+-C < win32-driveletters
| |
| +-ROS
| +-NATIVE < NTDLL, ntoskrnl, hal.dll, csrss.exe os2.exe psx.exe ...
| | +-DRIVERS < *.SYS
| | +-CONFIG < registry
| +-WIN32
| | +-SYSTEM < user32.dll kernel32.dll ...
| | +-FONTS
| | +...
| +-OS2 <some apps
| | +-DLL < doscalls.dll ....
| | +-SYSTEM
| | +-...
| +-PSX < empty
+-D
+-E...

View file

@ -0,0 +1,16 @@
Beginning ROS/2-Developement
============================
ROS/2-Developement means building the OS/2 subsystem for ReactOS. In order to start the developement you should have CVS-access. For the CVS-access see the reactos-Homepage.
Setting up a build environment
------------------------------
For the native components (OS2SS.EXE and OS2.EXE) you'll need the same compiler and tools as you need for the rest of ReactOS. If you haven't already set it up, go to the reactos home and see the description there. For now this is the only compiler you need. At some point you'll need a compiler that can generate LX-EXEs. But now also the core dlls and even programs are compiled as PE-win32.
Getting documentation
---------------------
I'm not the inventor of OS/2. IBM still did the work, and they did also good work in terms of documentation. If you plan to do core-dll work, you'll also need NT-Native-API documentation. There exists a book called "The Native API", but there should be a preliminary PDF-file floating around. OS/2-API documentation is available on the CDs belonging to your OS/2-compiler. If you develope under OS/2 you have an INF-viewer on board. If your developementsystem is NT, I recomend you OVIEW (http://hobbes.nmsu.edu/pub/windows/win_inf.zip). This two 'books' should be, what you need.
Contacting me
-------------
Bevore you start, have a talk with me. We don't want to do useless work or do work twice. So write to ros2@dantepark.de

View file

@ -0,0 +1,67 @@
<html>
<head>
<title>OS/2 subsystem for ReactOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<h1><b>OS/2 subsystem for ReactOS (ROS/2)</b></h1>
<h2><font color="#009966">Introduction</font></h2>
<p>The OS/2 subsystem is being developed to enable NT-like systems (like WinNT
and ReactOS) to run 32-Bit OS/2 applications natively. With this it shall provide
binary compatiblility on x86-Based systems. It is intended to port the ROS/2
also to other platforms supported by ReactOS / NT. It is planned to provide
source code compatibility on these platforms. Yeeahh, OS/2 for PowerPC is in
sight.</p>
<h2><font color="#009966">Components</font></h2>
<p>ROS/2 consists of the following components:</p>
<ul>
<li>OS2SS.EXE - A native application that implements the personality of the
OS/2 kernel.</li>
<li>OS2.EXE - A win32 application that does the interaction of the OS/2 apps
with the desktop.</li>
<li>Core DLLs - These DLLs that make OS/2 programs interface with the kernel/sub
system (i.E. DOSCALLS.DLL). </li>
<li>Additional DLLs - DLLs that provide additional APIs for OS/2 apps. This
includes Presentation Manager.</li>
</ul>
<h2><font color="#009966">Current state</font></h2>
<p>Up to now just a fragment of DOSCALLS.DLL exists. The biggest problem are the
os2 API headers which are (C) by IBM. So help is still welcome.</p>
<h2><font color="#009966">16-Bit issues</font></h2>
<p>It is not intended to support 16-bit OS/2 applications. This would make the
system inconsistent and produce much more work that use. But there is still
one issue: Current textmode applications are either 16-bit or use thunking to
call the 16-bit APIs. These 32-Bit thunking applications have to be supported.
We are still thinking how to accomplish that. </p>
<h2><font color="#009966">32-Bit issues</font></h2>
<p>It is planned to replace the current MOU- KBD- MSG- and VIO- subsystems with
the <a href="http://homepages.tesco.net/%7EJ.deBoynePollard/Softwares/conapi.html">Unicode
Console API</a>. This is also the foundation for other platforms we want to
provide source code compatibility with. So nearly every 32-Bit processor can
be supported. It sould even be possible to implement a 64-bit OS/2 API.</p>
<h2><font color="#009966">Architecture</font></h2>
<p>To understand the architecture of ReactOS or WinNT read a book from the &quot;Inside
Windows NT&quot;-series. The architecture of ROS/2 is like every normal subsystem.
When OS2SS.EXE starts, it creates an object directory named os2 and therein
it creates a port object with the name Os2API. A port is something like a socket.
Two programs can comunicate with each other via a port. The port Os2API provides
the LPC API of the OS2SS.EXE - the actual subsystem. <br>
Every OS/2 program that is loaded, is linked with DOSCALLS.DLL and NTDLL.DLL
- the interface to the NT-kernel. Since DOSCALLS is implemented using NTDLL.DLL,
every OS/2 app has it in its adress space. Many functions in DOSCALLS.DLL are
implemented by just wrapping NTDLL.DLL functions. Some functions however need
assistance by the subsystem. For this reason the app makes an LPC to OS2SS.EXE.
LPC means local procedure call and it is a very fast version of RPC. Together
with the first application also OS2.EXE starts up. OS2.EXE runs in the win32
subsystem with the security of the current user. OS2.EXE is used to gather keyboard
and mouse input and to show console windows and PM-windows of all OS/2 programms
of the current user. In order to accomplish this OS2.EXE creates a port object
in the os2 object directory named Os2Interact. OS/2 applications have a connection
to OS2.EXE, too. OS2SS.EXE and OS2.EXE also talk to each other. An OS/2 application
then makes LPCs either to OS2.EXE directly or if required via OS2SS.EXE.</p>
<p>Details</p>
<p>&nbsp;</p>
<p>LPC Documentation</p>
</body>
</html>

12603
rossubsys/os2/include/os2.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,91 @@
/* $ $
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* FILE: dll/doscalls.c
* PURPOSE: supportheader for Kernelservices.
* Use this file if your dll or application
* is going to use both, the os2 base services
* as well as the native API of NTDLL.DLL
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 1-08-2002 Created
*/
/* How to use:
History got us another time. If you want to write a module
that uses either native-api or os2-services...no problem.
But if you want to use both of them you run into type conflicts.
BOOL is not very surprising. But there are many other types
whose names are equal. This results from the fact that NT
should originally become OS/2 3.0.
So your solution lies in including this file instead of os2.h
and ntddk.h. What this file here does is, it puts the os2-types+
functions into the namespace OS2 while the nt-types+functions are
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 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>
}
/* rename all the symbols */
#define NT_FILE_CREATE FILE_CREATE
#undef FILE_CREATE
#define NT_CREATE_SUSPENDED CREATE_SUSPENDED
#undef CREATE_SUSPENDED
namespace OS2
{
#include "os2.h"
}
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__ */

20
rossubsys/os2/install.bat Normal file
View file

@ -0,0 +1,20 @@
@echo off
if "%1" == "" goto NoParameter
set ROS_INSTALL=%1
goto Install
:NoParameter
set ROS_INSTALL=c:\reactos
:Install
echo Installing to %ROS_INSTALL%
@echo off
md %ROS_INSTALL%
md %ROS_INSTALL%\bin
md %ROS_INSTALL%\symbols
md %ROS_INSTALL%\system32
copy ..\os2\apps\bepslep\bepslep.exe %ROS_INSTALL%\bin
copy ..\os2\lib\doscalls\doscalls.dll %ROS_INSTALL%\system32
copy ..\os2\lib\doscalls\doscalls.sym %ROS_INSTALL%\symbols
copy ..\os2\server\os2ss.exe %ROS_INSTALL%\system32
copy ..\os2\server\os2ss.sym %ROS_INSTALL%\symbols

View file

@ -0,0 +1,5 @@
<group>
<directory name="doscalls">
<xi:include href="doscalls/doscalls.xml" />
</directory>
</group>

View file

@ -0,0 +1,65 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: devices.cpp
* CONTAINS: device io ctl main function.
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
* 25-07-2002 Work to make it compile
* 10-11-2002 Done som little things
*/
#define INCL_DOSDEVICES
#define INCL_DOSERRORS
#include "ros2.h"
/*******************************************/
/* DosDevIOCtl performs control functions */
/* on a device specified by an opened */
/* device handle. */
/*******************************************/
/*HFILE hDevice; Device handle returned by DosOpen, or a standard (open) device handle. */
/*ULONG category; Device category. */
/*ULONG function; Device-specific function code. */
/*PVOID pParams; Address of the command-specific argument list. */
/*ULONG cbParmLenMax; Length, in bytes, of pParams. */
/*PULONG pcbParmLen; Pointer to the length of parameters. */
/*PVOID pData; Address of the data area. */
/*ULONG cbDataLenMax; Length, in bytes, of pData. */
/*PULONG pcbDataLen; Pointer to the length of data. */
/*APIRET ulrc; Return Code.
ulrc (APIRET) - returns
Return Code.
DosDevIOCtl returns one of the following values:
0 NO_ERROR
1 ERROR_INVALID_FUNCTION
6 ERROR_INVALID_HANDLE
15 ERROR_INVALID_DRIVE
31 ERROR_GEN_FAILURE
87 ERROR_INVALID_PARAMETER
111 ERROR_BUFFER_OVERFLOW
115 ERROR_PROTECTION_VIOLATION
117 ERROR_INVALID_CATEGORY
119 ERROR_BAD_DRIVER_LEVEL
163 ERROR_UNCERTAIN_MEDIA
165 ERROR_MONITORS_NOT_SUPPORTED
*/
APIRET STDCALL DosDevIOCtl(HFILE hDevice, ULONG category, ULONG function,
PVOID pParams,ULONG cbParmLenMax,PULONG pcbParmLen,
PVOID pData,ULONG cbDataLenMax,PULONG pcbDataLen)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -0,0 +1,97 @@
/* $Id: ioctl_async.cpp,v 1.2 2004/01/31 01:29:11 robertk Exp $
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: ipctl_async.cpp
* PURPOSE: This file is to be directly included into devices.cpp
* CONTAINS: implementation of the category 1 (async I/O)
* ioctl functioncodes.
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 10-11-2002 Created
*/
/* This function implements the async ioctls. It
is called from the real DosIOCtl function. This
function implies that it is only called, if the
cathegory was 0x01.
All other parameters are the same as DosIoCtl.
FIXME: implement me
*/
APIRET EvaluateAsyncIoCtl( HFILE hDevice, ULONG function,
PVOID pParams, ULONG cbParmLenMax, PULONG pcbParmLen,
PVOID pData, ULONG cbDataLenMax, PULONG pcbDataLen)
{
switch( function )
{
case 0x41: //ASYNC_SETBAUDRATE
//+------------------------------------+
//|Field Length C Datatype |
//|------------------------------------|
//|Bit Rate WORD USHORT |
//+------------------------------------+
break;
case 0x42: // Set Line Characteristics (stop, parity, data bits)
return ERROR_INVALID_PARAMETER; // example
break;
case 0x43: // Extended Set Bit Rate .
break;
case 0x44: // Transmit Byte Immediate .
break;
case 0x45: // Set Break OFF .
break;
case 0x46: // Set Modem Control Signals .
break;
case 0x47: // Behave as if XOFF Received (stop transmit) .
break;
case 0x48: // Behave as if XON Received (start transmit) .
break;
case 0x49: // Reserved .
break;
case 0x53: // Set Device Control Block (DCB) Parameters .
break;
case 0x54: // Set Enhanced Mode Parameters .
break;
case 0x61: // Query Current Bit Rate .
break;
case 0x62: // Query Line Characteristics .
break;
case 0x63: // Extended Query Bit Rate .
break;
case 0x64: // Query COM Status .
break;
case 0x65: // Query Transmit Data Status .
break;
case 0x66: // Query Modem Control Output Signals .
break;
case 0x67: // Query Current Modem Input Signals .
break;
case 0x68: // Query Number of Characters in Receive Queue .
break;
case 0x69: // Query Number of Characters in Transmit Queue .
break;
case 0x72: // Query COM Event Information .
break;
case 0x73: // Query Device Control Block (DCB) Parameters .
break;
case 0x74: // Query Enhanced Mode Parameters .
break;
default:
return ERROR_INVALID_FUNCTION;
break;
}
return ERROR_INVALID_FUNCTION;
}
/* EOF */

View file

@ -0,0 +1,35 @@
; $Id: doscalls.def,v 1.6 2004/01/31 01:29:11 robertk Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
<<<<<<< doscalls.def
DosSleep
DosClose
DosOpen
DosRead
DosWrite
DosDevIOCtl
DosBeep
DosExit
DosCreateThread
=======
DosSleep
Dos32Close
Dos32Open
Dos32Read
Dos32Write
;DosDevIOCtl
DosBeep
DosExit
DosCreateThread
>>>>>>> 1.5
; EOF

View file

@ -0,0 +1,23 @@
; $Id: doscalls.def.bak,v 1.1 2002/09/04 22:19:47 robertk Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
Dos32Sleep@4 @229
Dos32Close@4 @257
Dos32Open@32 @273
Dos32Read@16 @281
Dos32Write@16 @282
Dos32DevIOCtl@36 @284
Dos32Beep@8 @286
Dos32Exit@8 @234
Dos32CreateThread@20 @311
; EOF

View file

@ -0,0 +1,35 @@
; $Id: doscalls.edf,v 1.4 2004/01/31 01:29:11 robertk Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
<<<<<<< doscalls.edf
DosSleep=DosSleep
DosClose=DosClose
DosOpen=DosOpen
DosRead=DosRead
DosWrite=DosWrite
DosDevIOCtl=DosDevIOCtl
DosBeep=DosBeep
DosExit=DosExit
DosCreateThread=DosCreateThread
=======
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
>>>>>>> 1.3
; EOF

View file

@ -0,0 +1,4 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS-OS/2 subsystem base services\0"
#define REACTOS_STR_INTERNAL_NAME "doscalls\0"
#define REACTOS_STR_ORIGINAL_FILENAME "doscalls.dll\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,23 @@
<module name="doscalls" type="nativedll">
<importlibrary definition="doscalls.def" />
<include base="doscalls">../../include</include>
<linkerflag>-lgcc</linkerflag>
<directory name="devices">
<file>devices.cpp</file>
<file>ioctl_async.cpp</file>
</directory>
<directory name="file">
<file>directory.cpp</file>
<file>openclose.cpp</file>
</directory>
<directory name="memory">
<file>memory.cpp</file>
</directory>
<directory name="misc">
<file>doscalls.cpp</file>
<file>error.cpp</file>
</directory>
<directory name="run">
<file>process.cpp</file>
</directory>
</module>

View file

@ -0,0 +1,179 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: directory.cpp
* PURPOSE: Kernelservices for OS/2 apps
* CONTAINS: Directory related CP-functions.
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 10-11-2002 Created
*/
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#include "ros2.h"
/******************************************
DosDelete removes a file name from a
directory. The deleted file may be
recoverable.
pszFile (PSZ) - input
Address of the name of the file to be deleted.
ulrc (APIRET) - returns
Return Code.
DosDelete returns one of the following values:
0 NO_ERROR
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
26 ERROR_NOT_DOS_DISK
32 ERROR_SHARING_VIOLATION
36 ERROR_SHARING_BUFFER_EXCEEDED
87 ERROR_INVALID_PARAMETER
206 ERROR_FILENAME_EXCED_RANGE
*******************************************/
APIRET DosDelete(PSZ pszFile)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/******************************************
DosDeleteDir removes a subdirectory
from the specified disk.
pszDir (PSZ) - input
Address of the fully qualified path name of the subdirectory to be removed.
ulrc (APIRET) - returns
Return Code.
DosDeleteDir returns one of the following values:
0 NO_ERROR
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
16 ERROR_CURRENT_DIRECTORY
26 ERROR_NOT_DOS_DISK
87 ERROR_INVALID_PARAMETER
108 ERROR_DRIVE_LOCKED
206 ERROR_FILENAME_EXCED_RANGE
******************************************/
APIRET DosDeleteDir(PSZ pszDir)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/*******************************************
DosCopy copies the source file or
subdirectory to the destination file or
subdirectory.
pszOld (PSZ) - input
Address of the ASCIIZ path name of the source file,
subdirectory, or character device.
Global file-name characters are not allowed.
pszNew (PSZ) - input
Address of the ASCIIZ path name of the target file,
subdirectory, or character device.
Global file-name characters are not allowed.
option (ULONG) - input
ULONG bit flags that define how the DosCopy
function is done.
Bit Description
31-3 Reserved. These bits must be set to
zero.
2 DCPY_FAILEAS (0x00000004)
Discard the EAs if the source file
contains EAs and the destination file
system does not support EAs.
0 Discard the EAs (extended attributes) if
the destination file system does not
support EAs.
1 Fail the copy if the destination file
system does not support EAs.
1 DCPY_APPEND (x00000002)
Append the source file to the target
file's end of data.
0 Replace the target file with the source
file.
1 Append the source file to the target file's
end of data.
This is ignored when copying a
directory, or if the target file does not
exist.
0 DCPY_EXISTING (0x00000001)
Existing Target File Disposition.
0 Do not copy the source file to the target
if the file name already exists within the
target directory. If a single file is being
copied and the target already exists, an
error is returned.
1 Copy the source file to the target even if
the file name already exists within the
target directory.
Bit flag DCPY_FAILEAS can be used in
combination with bit flag DCPY_APPEND or
DCPY_EXISTING.
ulrc (APIRET) - returns
Return Code.
DosCopy returns one of the following values:
0 NO_ERROR
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
26 ERROR_NOT_DOS_DISK
32 ERROR_SHARING_VIOLATION
36 ERROR_SHARING_BUFFER_EXCEEDED
87 ERROR_INVALID_PARAMETER
108 ERROR_DRIVE_LOCKED
112 ERROR_DISK_FULL
206 ERROR_FILENAME_EXCED_RANGE
267 ERROR_DIRECTORY
282 ERROR_EAS_NOT_SUPPORTED
283 ERROR_NEED_EAS_FOUND
*******************************************/
APIRET DosCopy(PSZ pszOld,PSZ pszNew, ULONG option)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -0,0 +1,199 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: openclose.cpp
* PURPOSE: Kernelservices for OS/2 apps
* CONTAINS: Open close write and handle related stuff.
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
* 25-07-2002 Work to make it compile
*/
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#include "ros2.h"
<<<<<<< openclose.cpp
APIRET STDCALL DosOpen(PSZ pszFileName, PHFILE pHf,
=======
APIRET STDCALL Dos32Open(PSZ pszFileName, PHFILE pHf,
>>>>>>> 1.4
PULONG pulAction, ULONG cbFile,
ULONG ulAttribute, ULONG fsOpenFlags,
ULONG fsOpenMode, PVOID reserved ) //ULONGPEAOP2 peaop2)
{
/* NTAPI
ZwCreateFile(
OUT PHANDLE FileHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PLARGE_INTEGER AllocationSize OPTIONAL,
IN ULONG FileAttributes,
IN ULONG ShareAccess,
IN ULONG CreateDisposition,
IN ULONG CreateOptions,
IN PVOID EaBuffer OPTIONAL,
IN ULONG EaLength
);*/
/*
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING NtPathU;
HANDLE FileHandle;
NTSTATUS Status;
ULONG Flags = 0;
switch (dwCreationDisposition)
{
case CREATE_NEW:
dwCreationDisposition = FILE_CREATE;
break;
case CREATE_ALWAYS:
dwCreationDisposition = FILE_OVERWRITE_IF;
break;
case OPEN_EXISTING:
dwCreationDisposition = FILE_OPEN;
break;
case OPEN_ALWAYS:
dwCreationDisposition = OPEN_ALWAYS;
break;
case TRUNCATE_EXISTING:
dwCreationDisposition = FILE_OVERWRITE;
}
DPRINT("CreateFileW(lpFileName %S)\n",lpFileName);
if (dwDesiredAccess & GENERIC_READ)
dwDesiredAccess |= FILE_GENERIC_READ;
if (dwDesiredAccess & GENERIC_WRITE)
dwDesiredAccess |= FILE_GENERIC_WRITE;
if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
{
Flags |= FILE_SYNCHRONOUS_IO_ALERT;
}
if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFileName,
&NtPathU,
NULL,
NULL))
return INVALID_HANDLE_VALUE;
DPRINT("NtPathU \'%S\'\n", NtPathU.Buffer);
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory = NULL;
ObjectAttributes.ObjectName = &NtPathU;
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE;
ObjectAttributes.SecurityDescriptor = NULL;
ObjectAttributes.SecurityQualityOfService = NULL;
Status = NtCreateFile (&FileHandle,
dwDesiredAccess,
&ObjectAttributes,
&IoStatusBlock,
NULL,
dwFlagsAndAttributes,
dwShareMode,
dwCreationDisposition,
Flags,
NULL,
0);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus (Status);
return INVALID_HANDLE_VALUE;
}
return FileHandle;*/
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* close a Handle. seems finished */
APIRET STDCALL DosClose(HFILE hFile)
{
NT::NTSTATUS nErrCode;
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;
}
APIRET STDCALL DosRead(HFILE hFile, PVOID pBuffer,
ULONG cbRead, PULONG pcbActual)
{
NT::NTSTATUS nErrCode;
NT::IO_STATUS_BLOCK isbStatus;
// read data from file
nErrCode = NT::ZwReadFile( (NT::HANDLE)hFile, NULL, NULL, NULL,
&isbStatus, pBuffer, cbRead,
NULL, NULL );
// contains the # bytes actually read.
*pcbActual = isbStatus.Information;
switch(nErrCode)
{
/*
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
// FIXME: complete this
*/
}
return NO_ERROR;
}
/* Generic write to a stream given by hFile */
APIRET STDCALL DosWrite(HFILE hFile, PVOID pBuffer,
ULONG cbWrite, PULONG pcbActual)
{
NT::NTSTATUS nErrCode;
NT::IO_STATUS_BLOCK StatusBlk;
nErrCode = NtWriteFile( (NT::HANDLE)hFile, NULL, NULL, NULL,
&StatusBlk, pBuffer, cbWrite, 0, NULL );
// FIXME *pcbActual = StatusBlk.Information;
// do an errorcode translation FIXME: correct
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;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,61 @@
# $Id: makefile,v 1.7 2004/01/31 01:29:11 robertk Exp $
PATH_TO_TOP = ../../../reactos
PATH_TO_OS2_TOP = ../..
TARGET_TYPE = dynlink
#TARGET_DEFONLY = yes
TARGET_NAME = doscalls
TARGET_BASE = 0x68E00000
TARGET_CPPFLAGS =\
-Wall \
-I$(PATH_TO_OS2_TOP)/include \
-D__DOSCALLSDLL__
# removed CFLAGX
# -fno-builtin \
# -nostdinc \
# -nostdlib \
TARGET_ENTRY = _DllMain@12
TARGET_LFLAGS = -nostartfiles
TARGET_LIBS = doscalls.a
TARGET_SDKLIBS = ntdll.a
TARGET_GCCLIBS = stdc++
TARGET_OBJECTS = $(TARGET_NAME).o
MISC_OBJECTS = misc/doscalls.o misc/error.o
FILE_OBJECTS = file/openclose.o
RUN_OBJECTS = run/process.o
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
include $(TOOLS_PATH)/helper.mk
# EOF

View file

@ -0,0 +1,40 @@
// TODO: HEader: To be pasted
// INCL_DOSMEMMGR || !INCL_NOCOMMON
#define INCL_DOSMEMMGR
#undefine INCL_NOCOMMON
#include <os2.h>
// TODO: Expain that this is for memory alloc/free funcs of Os2 api
// TODO: Implement functions and give them bodies
ULONG DosAllocMem (PPVOID pBaseAddress, ULONG ulObjectSize,
ULONG ulAllocationFlags);
ULONG DosAllocSharedMem (PPVOID pBaseAddress, PCSZ pszName,
ULONG ulObjectSize, ULONG ulAllocationFlags);
ULONG DosFreeMem (PVOID pBaseAddress);
ULONG DosGetNamedSharedMem (PPVOID pBaseAddress, PCSZ pszSharedMemName,
ULONG ulAttributeFlags);
ULONG DosGetSharedMem (CPVOID pBaseAddress, ULONG ulAttributeFlags);
ULONG DosGiveSharedMem (CPVOID pBaseAddress, PID idProcessId,
ULONG ulAttributeFlags);
ULONG DosQueryMem (CPVOID pBaseAddress, PULONG pulRegionSize,
PULONG pulAllocationFlags);
ULONG DosSetMem (CPVOID pBaseAddress, ULONG ulRegionSize,
ULONG ulAttributeFlags);
ULONG DosSubAllocMem (PVOID pOffset, PPVOID pBlockOffset, ULONG ulSize);
ULONG DosSubFreeMem (PVOID pOffset, PVOID pBlockOffset, ULONG ulSize);
ULONG DosSubSetMem (PVOID pOffset, ULONG ulFlags, ULONG ulSize);
ULONG DosSubUnsetMem (PVOID pOffset);
// TODO: Add file to makefile

View file

@ -0,0 +1,33 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* FILE: dll/doscalls.c
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
*/
// here's only the NTDLL needet
#include <ddk/ntddk.h>
BOOL STDCALL DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case 1://DLL_PROCESS_ATTACH:
case 2://DLL_THREAD_ATTACH:
case 3://DLL_THREAD_DETACH:
case 0://DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View file

@ -0,0 +1,165 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: error.cpp
* CONTAINS: Error related CP-functions.
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
* 25-07-2002 Work to make it compile
*/
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#include "ros2.h"
// we need the extra definitions of this file
namespace NT {
#include <ddk/ntddbeep.h>
}
/*******************************************
DosBeep generates sound from the
speaker.
freq (ULONG) - input
Cycles per second (Hertz) in the range of 0x25 to
0x7FFF.
dur (ULONG) - input
The length of the sound in milliseconds.
ulrc (APIRET) - returns
Return Code.
DosBeep returns one of the following values:
0 NO_ERROR
395 ERROR_INVALID_FREQUENCY
*******************************************/
APIRET STDCALL DosBeep(ULONG freq, ULONG dur)
{
NT::BEEP_SET_PARAMETERS BeepSetParameters;
NT::HANDLE hBeep;
NT::IO_STATUS_BLOCK ComplStatus;
NT::UNICODE_STRING unistr;
NT::NTSTATUS stat;
NT::OBJECT_ATTRIBUTES oa = {sizeof oa, 0, &unistr, NT::OBJ_CASE_INSENSITIVE, 0, 0};
// init String still bevore use.
NT::RtlInitUnicodeString( &unistr, (NT::PWSTR)L"\\\\.\\Beep" );
if( freq<0x25 || freq>0x7FFF )
return ERROR_INVALID_FREQUENCY; //395; //
/* Set beep data */
BeepSetParameters.Frequency = freq;
BeepSetParameters.Duration = dur;
/* open the beep dirver */
stat = NT::ZwOpenFile( &hBeep,
FILE_READ_DATA | FILE_WRITE_DATA,
&oa,
&ComplStatus,
0, // no sharing
FILE_OPEN );
if ( stat<0 )
{
return ERROR_NOT_READY;
}
/* actually beep */
NT::ZwDeviceIoControlFile(hBeep, 0, // Event
0, // APC-routine
0, // UserAPCContext
&ComplStatus, IOCTL_BEEP_SET,
&BeepSetParameters,
sizeof(NT::BEEP_SET_PARAMETERS),
NULL,
0 );
NT::ZwClose(hBeep);
return NO_ERROR;
}
/******************************************
DosError disables or enables error
notification to end users.
error (ULONG) - input
Error and Exception pop-up flags.
The unused high-order bits are reserved, and must be zero. The following values can be specified
for this parameter. They can be combined using the "logical or" ( | ) operator.
FERR_DISABLEHARDERR (0x00000000)
Disable hard error pop-ups.
FERR_ENABLEHARDERR (0x00000001)
Enable hard error pop-ups.
FERR_ENABLEEXCEPTION (0x00000000)
Enable program exception and untrapped numeric-processor exception pop-ups.
FERR_DISABLEEXCEPTION (0x00000002)
Disable program exception and untrapped numeric-processor exception pop-ups.
ulrc (APIRET) - returns
Return Code.
DosError returns one of the following values:
0 NO_ERROR
87 ERROR_INVALID_PARAMETER
*******************************************/
APIRET DosError( ULONG error)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/*******************************************
DosMove moves a file object to another
location, and changes its name.
pszOld (PSZ) - input
Address of the old path name of the file or
subdirectory to be moved.
pszNew (PSZ) - input
Address of the new path name of the file or
subdirectory.
ulrc (APIRET) - returns
Return Code.
DosMove returns the one of following values:
0 NO_ERROR
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
17 ERROR_NOT_SAME_DEVICE
26 ERROR_NOT_DOS_DISK
32 ERROR_SHARING_VIOLATION
36 ERROR_SHARING_BUFFER_EXCEEDED
87 ERROR_INVALID_PARAMETER
108 ERROR_DRIVE_LOCKED
206 ERROR_FILENAME_EXCED_RANGE
250 ERROR_CIRCULARITY_REQUESTED
251 ERROR_DIRECTORY_IN_CDS
*******************************************/
APIRET DosMove(PSZ pszOld, PSZ pszNew)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -0,0 +1,58 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: process.cpp
* CONTAINS: process and thread related CP-functions.
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
* 25-07-2002 Work to make it compile
*/
//#if defined (INCL_DOS)
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#include "ros2.h"
APIRET STDCALL DosSleep(ULONG msec)
{
NT::NTSTATUS stat;
NT::TIME Interv;
Interv.QuadPart= -(10000 * msec);
stat = NT::NtDelayExecution( TRUE, &Interv );
return 0;
}
/* $Id$ */
/* Terminates the current thread or the current Process.
Decission is made by action
FIXME: move this code to OS2.EXE */
VOID APIENTRY DosExit(ULONG action, ULONG result)
{
// decide what to do
if( action == EXIT_THREAD)
{
NT::NtTerminateThread( NULL, result );
}
else // EXIT_PROCESS
{
NT::NtTerminateProcess( NULL, result );
}
}
APIRET STDCALL DosCreateThread(PTID ptid, PFNTHREAD pfn,
ULONG param, ULONG flag, ULONG cbStack)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

14
rossubsys/os2/makefile Normal file
View file

@ -0,0 +1,14 @@
all:
@echo To build "os2" there are two paths:
@echo ---
@echo 1. copy the os2 folder into the reactos\modules folder
@echo 2. link reactos/modules/os2 to os2
@echo UNIX
@echo cd $${ROS_SRC_ROOT}/reactos/modules
@echo ln -s $${ROS_SRC_ROOT}/os2 os2
@echo WINDOWS
@echo cd %%ROS_SRC_ROOT%%\reactos\modules
@echo junction os2 %%ROS_SRC_ROOT%%\os2
@echo ---
@echo Eventually you can run "make depends" in the %%ROS_SRC_ROOT%%\reactos
@echo directory to compile it.

View file

@ -0,0 +1,50 @@
/* $Id$
*
* dllmain.c - OS/2 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 "os2srv.h"
#define NDEBUG
#include <debug.h>
/* DLL entry point */
HANDLE Os2SrvDllHandle = 0;
/* FUNCTIONS *****************************************************************/
BOOL STDCALL
DllMain(HANDLE hDll,
DWORD dwReason,
LPVOID lpReserved)
{
if (DLL_PROCESS_ATTACH == dwReason)
{
Os2SrvDllHandle = hDll;
}
return TRUE;
}
/* EOF */

View file

@ -0,0 +1,3 @@
LIBRARY os2srv.dll
EXPORTS
ServerDllInitialization@8

View file

@ -0,0 +1,13 @@
#ifndef _OS2SS_H_INCLUDED_
#define _OS2SS_H_INCLUDED_
/* PSDK/NDK Headers */
#include <stdio.h>
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
#include <csr/server.h>
#endif /* ndef _OS2SS_H_INCLUDED_ */

View file

@ -0,0 +1,4 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS-OS/2 Environment Subsystem Server\0"
#define REACTOS_STR_INTERNAL_NAME "os2srv\0"
#define REACTOS_STR_ORIGINAL_FILENAME "os2srv.dll\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,11 @@
<module name="os2srv" type="nativedll">
<importlibrary definition="os2srv.def" />
<include base="os2srv">.</include>
<define name="__USE_W32API" />
<define name="_DISABLE_TIDENTS" />
<library>ntdll</library>
<library>csrsrv</library>
<file>dllmain.c</file>
<file>server.c</file>
<file>os2srv.rc</file>
</module>

View file

@ -0,0 +1,84 @@
/* $Id$
*
* server.c - OS/2 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 "os2srv.h"
//#define NDEBUG
#include <debug.h>
HANDLE Os2ApiPort = NULL;
/**********************************************************************
* NAME PRIVATE
* Os2StaticServerThread/1
*/
VOID STDCALL Os2StaticServerThread (PVOID x)
{
NTSTATUS Status = STATUS_SUCCESS;
PPORT_MESSAGE Request = (PPORT_MESSAGE) x;
PPORT_MESSAGE Reply = NULL;
ULONG MessageType = 0;
DPRINT("VMSSRV: %s called\n", __FUNCTION__);
MessageType = Request->u2.s2.Type;
DPRINT("VMSSRV: %s received a message (Type=%d)\n",
__FUNCTION__, MessageType);
switch (MessageType)
{
default:
Reply = Request;
Status = NtReplyPort (Os2ApiPort, Reply);
break;
}
}
/*=====================================================================
* PUBLIC API
*===================================================================*/
NTSTATUS STDCALL ServerDllInitialization (ULONG ArgumentCount,
LPWSTR *Argument)
{
NTSTATUS Status = STATUS_SUCCESS;
DPRINT("VMSSRV: %s called\n", __FUNCTION__);
// Get the listening port from csrsrv.dll
Os2ApiPort = CsrQueryApiPort ();
if (NULL == Os2ApiPort)
{
return STATUS_UNSUCCESSFUL;
}
// Register our message dispatcher
Status = CsrAddStaticServerThread (Os2StaticServerThread);
if (NT_SUCCESS(Status))
{
//TODO: perform the real OS/2 server internal initialization here
}
return Status;
}
/* EOF */

Binary file not shown.