mirror of
https://github.com/reactos/reactos
synced 2025-10-06 08:22:58 +02:00
Compare commits
28 Commits
backups/tc
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
13a047a566 | ||
|
834ee7b3fe | ||
|
607690ba55 | ||
|
88e0297e69 | ||
|
a627f8d061 | ||
|
820c67f8ba | ||
|
73f101de0b | ||
|
1c7116cc73 | ||
|
40528bf1be | ||
|
ee1890ff77 | ||
|
7fe7da7475 | ||
|
5a10cf1de5 | ||
|
b192bb32af | ||
|
501c4bcc5c | ||
|
09b7ae5383 | ||
|
add1e4db72 | ||
|
291ec67723 | ||
|
e97e0f5976 | ||
|
583e4a7baf | ||
|
fdc1ba6a56 | ||
|
1b2fc59dc1 | ||
|
d4a3555442 | ||
|
abc01da30c | ||
|
7aeca22fed | ||
|
36e1bb60e8 | ||
|
74e77bb16f | ||
|
e3a75fb4da | ||
|
ce122bcdea |
@@ -1,2 +0,0 @@
|
||||
*.ncb
|
||||
*.opt
|
102
msvc6/README.txt
102
msvc6/README.txt
@@ -1,102 +0,0 @@
|
||||
ReactOS Microsoft Visual C/C++ 6.0 IDE files
|
||||
|
||||
This is the Microsoft Visual C/C++ 6.0 project workspace and project
|
||||
files for a few of the ReactOS binaries. They are ONLY included as a
|
||||
convenience, and is NOT to be considered supported, or even correct.
|
||||
If you build a binary that misbehaves using these files, you _might_
|
||||
be able to get in touch with someone to fix the problem
|
||||
BUT DO NOT COUNT ON IT!
|
||||
|
||||
The only supported build system for ReactOS is the one documented at
|
||||
www.reactos.com.
|
||||
|
||||
------------------------------------------------------------------
|
||||
Please, before you start playing with this, read the whole of
|
||||
this document.
|
||||
|
||||
Before you can use these project files, you _need_ to make a successful
|
||||
build using the normal ReactOS build system. There are some vital files
|
||||
that needs to be created, and currently only the normal build creates these.
|
||||
|
||||
Once that is done, you need to generate the kernel-mode service "table"
|
||||
file by running nmake (from this point on you can use the "native"
|
||||
MSVC tools) from the directory MSVC6\iface\native.
|
||||
This will generate MSVC6\ntoskrnl\nt_zw_msvc.c, an MSVC compatible inline-
|
||||
assembler version of the file otherwise known as reactos\ntoskrnl\nt\zw.c.
|
||||
|
||||
Next, go to def_converter and run nmake. This builds the tool to convert
|
||||
the .def files for HAL and the kernel from the MinGW format to something
|
||||
more suitable for the MSVC linker, and also generates these .def files
|
||||
to their target location [1].
|
||||
|
||||
Now you should be set to fire up the IDE and load the project workspace.
|
||||
|
||||
|
||||
When building HAL or the kernel for the first time using these
|
||||
project files, just doing it the "normal" way _will not work_.
|
||||
The linker will complain about missing library, and it will fail.
|
||||
|
||||
The reason for this is a circular dependency between these two binaries.
|
||||
|
||||
Currently you need to follow these procedures [2]:
|
||||
|
||||
- Select hal as your active project.
|
||||
- Select Project/Settings.
|
||||
- Select the Link tab.
|
||||
- Select "General" from the Category drop-list.
|
||||
- Temporary remove the explicit linker library
|
||||
(e.g. "..\ntoskrnl\Debug\ntoskrnl.lib")
|
||||
- Select "Customize" from the Category drop-list.
|
||||
- Check the "Force file output" checkbox.
|
||||
- Build hal.
|
||||
- Uncheck "Force file output".
|
||||
- Put back the removed import library.
|
||||
- Now build the ntoskrnl. Do NOT try to build hal again until
|
||||
you have sucessfully built the kernel, and the linker has
|
||||
generated its import library!
|
||||
- Now you can "Clean" hal, and build it as usual.
|
||||
|
||||
If everything worked as expected, you should now have both ntoskrnl.exe
|
||||
and hal.dll freshly built.
|
||||
|
||||
|
||||
LIMITATIONS/DEVIATIONS (from the MinGW build):
|
||||
- Since there can only be one resource file/project, the kernel had
|
||||
to choose between either its version resource, or its message table.
|
||||
The messages won.
|
||||
- Do NOT open the .rc files in the IDE's resource editor. Chances are
|
||||
it will assume ownership over them and fill them up with at least
|
||||
conditional compilation macros.
|
||||
|
||||
|
||||
NOTES:
|
||||
|
||||
[1] This is needed due to differences in handling of decorated names
|
||||
in .def files. While both MinGW GCC and MSVC generates decorated names
|
||||
in the same way for at least plain cdecl and stdcall C functions, the
|
||||
MSVC linker expects names in the .def file to be either
|
||||
|
||||
- an exact match of the decorated name, in case it exports the
|
||||
decorated name from the linked binary, or
|
||||
- just the name without any decoration, in case it exports just the
|
||||
name of the symbol from the linked binary (to allow for e.g.
|
||||
GetProcAddress using the undecorated name) - but keeps the decorated
|
||||
names in the import library to handle and "redirect" linker requests
|
||||
for those decorated symbols, and point them to the undercorated names
|
||||
in the binary exporting them - so that a binary A, at link time,
|
||||
importing symbols from binary B of the form "_name@0" will resolve
|
||||
that symbol from the import library, but the linked binary A will
|
||||
reference it as just "name".
|
||||
|
||||
The ROS .def files contains a mix, "half-decorated", where the leading
|
||||
undescores are missing, but the trailing "@n" (for stdcall functions)
|
||||
are present.
|
||||
|
||||
|
||||
[2] Theoretically it could be possible to use a hal.lib generated by the
|
||||
following procedure, removing the need for the manual steps above.
|
||||
|
||||
cd MSVC6\hal\Debug
|
||||
lib \def:..\..\..\reactos\hal\hal\hal.def
|
||||
|
||||
but I have not tested it, and take no responsibility for its effectiveness.
|
@@ -1,41 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "hal"=.\hal\hal.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "ntoskrnl"=.\ntoskrnl\ntoskrnl.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@@ -1,64 +0,0 @@
|
||||
// Uses hard-coded filenames to require a minimum of input.
|
||||
// You think this file should be licensed? OK then,
|
||||
// Copyright (C) 2004, Mike Nordell. Use as you whish.
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
const char szSrc1[] = "..\\..\\reactos\\ntoskrnl\\ntoskrnl.def";
|
||||
const char szDst1[] = "..\\ntoskrnl\\ntoskrnl.def";
|
||||
const char szSrc2[] = "..\\..\\reactos\\hal\\hal\\hal.def";
|
||||
const char szDst2[] = "..\\hal\\hal.def";
|
||||
|
||||
enum File
|
||||
{
|
||||
Kernel,
|
||||
HAL
|
||||
};
|
||||
|
||||
std::string do_kernel_replacements(std::string& s)
|
||||
{
|
||||
std::string s2 = s.c_str(); // to fixup size after replacements
|
||||
if (s2 == "ExAllocateFromPagedLookasideList") {
|
||||
s2 += "=ExiAllocateFromPagedLookasideList";
|
||||
} else
|
||||
if (s2 == "ExFreeToPagedLookasideList") {
|
||||
s2 += "=ExiFreeToPagedLookasideList";
|
||||
} else
|
||||
if (s2 == "MmLockPagableImageSection") {
|
||||
s2 += "=MmLockPagableDataSection";
|
||||
}
|
||||
return s2;
|
||||
}
|
||||
|
||||
void convert_def(const char* szSrc, const char* szDst, File file)
|
||||
{
|
||||
using namespace std;
|
||||
ifstream in(szSrc);
|
||||
ofstream out(szDst);
|
||||
string s;
|
||||
while (getline(in, s).good()) {
|
||||
if (!s.size()) {
|
||||
continue;
|
||||
}
|
||||
if (s[0] != ';') { // only replace non-comment lines
|
||||
if (s[0] == '@') {
|
||||
s.erase(0, 1);
|
||||
}
|
||||
replace(s.begin(), s.end(), '@', '\0');
|
||||
if (file == Kernel) {
|
||||
s = do_kernel_replacements(s);
|
||||
}
|
||||
}
|
||||
out << s << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
convert_def(szSrc1, szDst1, Kernel);
|
||||
convert_def(szSrc2, szDst2, HAL);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1,19 +0,0 @@
|
||||
# $Id: makefile,v 1.1 2004/02/06 08:21:54 fireball Exp $
|
||||
#
|
||||
# ReactOS Operating System - .def converter for HAL and the kernel
|
||||
#
|
||||
|
||||
DEF_HAL = ..\hal\hal.def
|
||||
DEF_KRNL = ..\ntoskrnl\ntoskrnl.def
|
||||
CPPFLAGS = /GX
|
||||
|
||||
all: def_converter.exe $(DEF_HAL) $(DEF_KRNL)
|
||||
|
||||
$(DEF_HAL) : ..\..\reactos\hal\hal\hal.def
|
||||
def_converter.exe
|
||||
|
||||
$(DEF_KRNL) : ..\..\reactos\ntoskrnl\ntoskrnl.def
|
||||
def_converter.exe
|
||||
|
||||
def_converter.exe : def_converter.cpp
|
||||
|
@@ -1,243 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="hal" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=hal - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "hal.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "hal.mak" CFG="hal - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "hal - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "hal - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "hal - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HAL_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /Ot /Og /Os /Ob1 /I "..\..\reactos\include" /I "..\..\reactos\hal\halx86\include" /I "..\..\reactos\ntoskrnl\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "i386" /D "__NTHAL__" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x41d /d "NDEBUG"
|
||||
# ADD RSC /l 0x417 /i "..\..\reactos\include" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /dll /machine:I386
|
||||
# ADD LINK32 ..\ntoskrnl\Release\ntoskrnl.lib /nologo /dll /machine:I386 /fixed:no
|
||||
# SUBTRACT LINK32 /pdb:none /force
|
||||
|
||||
!ELSEIF "$(CFG)" == "hal - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HAL_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Z7 /Od /I "..\..\reactos\include" /I "..\..\reactos\hal\halx86\include" /I "..\..\reactos\ntoskrnl\include" /D "_WINDOWS" /D "__NTHAL__" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "i386" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x41d /d "_DEBUG"
|
||||
# ADD RSC /l 0x417 /i "..\..\reactos\include" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\ntoskrnl\Debug\ntoskrnl.lib /nologo /dll /incremental:no /debug /machine:I386 /pdbtype:sept /fixed:no
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "hal - Win32 Release"
|
||||
# Name "hal - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\adapter.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\beep.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\bus.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\display.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\dma.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\drive.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\enum.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\fmutex.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\fmutex_tmn.c
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\halinit.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\halx86mp.rc
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\halx86up.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\irql.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\isa.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\kdbg.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\mca.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\misc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\mp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\mpsirql.c
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\pci.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\portio.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\pwroff.c
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\reboot.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\spinlock.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\spinlock_tmn.c
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\sysbus.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\sysinfo.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\time.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\timer.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "include"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\include\bus.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\include\hal.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\reactos\hal\halx86\include\mps.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\hal.def
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
@@ -1,392 +0,0 @@
|
||||
/* $Id: genntdll.c,v 1.1 2004/02/06 08:21:56 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS version of ntdll
|
||||
* FILE: iface/native/genntdll.c
|
||||
* PURPOSE: Generates the system call stubs in ntdll
|
||||
* CHANGE HISTORY: Added a '@xx' to deal with stdcall [ Ariadne ]
|
||||
* 19990616 (ea)
|
||||
* Four arguments now required; 4th is the file
|
||||
* for ntoskrnl ZwXXX functions (which are merely calls
|
||||
* to twin NtXXX calls, via int 0x2e (x86).
|
||||
* 19990617 (ea)
|
||||
* Fixed a bug in function numbers in kernel ZwXXX stubs.
|
||||
*
|
||||
*/
|
||||
|
||||
/* INCLUDE ******************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PARAMETERIZED_LIBS
|
||||
|
||||
/* #define VERBOSE */
|
||||
|
||||
#define INPUT_BUFFER_SIZE 255
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
void write_syscall_stub(FILE* out, FILE* out3, char* name, char* name2,
|
||||
char* nr_args, unsigned int sys_call_idx)
|
||||
{
|
||||
int i;
|
||||
int nArgBytes = atoi(nr_args);
|
||||
#ifdef PARAMETERIZED_LIBS
|
||||
fprintf(out,"__asm__(\"\\n\\t.global _%s@%s\\n\\t\"\n",name,nr_args);
|
||||
fprintf(out,"\".global _%s@%s\\n\\t\"\n",name2,nr_args);
|
||||
fprintf(out,"\"_%s@%s:\\n\\t\"\n",name,nr_args);
|
||||
fprintf(out,"\"_%s@%s:\\n\\t\"\n",name2,nr_args);
|
||||
#else
|
||||
fprintf(out,"__asm__(\"\\n\\t.global _%s\\n\\t\"\n",name);
|
||||
fprintf(out,"\".global _%s\\n\\t\"\n",name2);
|
||||
fprintf(out,"\"_%s:\\n\\t\"\n",name);
|
||||
fprintf(out,"\"_%s:\\n\\t\"\n",name2);
|
||||
#endif
|
||||
fprintf(out,"\t\"pushl\t%%ebp\\n\\t\"\n");
|
||||
fprintf(out,"\t\"movl\t%%esp, %%ebp\\n\\t\"\n");
|
||||
fprintf(out,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx);
|
||||
fprintf(out,"\t\"lea\t8(%%ebp),%%edx\\n\\t\"\n");
|
||||
fprintf(out,"\t\"int\t$0x2E\\n\\t\"\n");
|
||||
fprintf(out,"\t\"popl\t%%ebp\\n\\t\"\n");
|
||||
fprintf(out,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
|
||||
|
||||
/*
|
||||
* Now write the NTOSKRNL stub for the
|
||||
* current system call. ZwXXX does NOT
|
||||
* alias the corresponding NtXXX call.
|
||||
*/
|
||||
#if 0
|
||||
fprintf(out3,"__asm__(\n");
|
||||
fprintf(out3,"\".global _%s@%s\\n\\t\"\n",name2,nr_args);
|
||||
fprintf(out3,"\"_%s@%s:\\n\\t\"\n",name2,nr_args);
|
||||
fprintf(out3,"\t\"pushl\t%%ebp\\n\\t\"\n");
|
||||
fprintf(out3,"\t\"movl\t%%esp, %%ebp\\n\\t\"\n");
|
||||
fprintf(out3,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx);
|
||||
fprintf(out3,"\t\"lea\t8(%%ebp),%%edx\\n\\t\"\n");
|
||||
fprintf(out3,"\t\"int\t$0x2E\\n\\t\"\n");
|
||||
fprintf(out3,"\t\"popl\t%%ebp\\n\\t\"\n");
|
||||
fprintf(out3,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
|
||||
#else
|
||||
fprintf(out3,"__declspec(naked) __stdcall\n");
|
||||
fprintf(out3,"%s(", name2); // make it emit callconv, reval and full signature too
|
||||
for (i=0; i*4 < nArgBytes; ++i) {
|
||||
fprintf(out3,"int dummy%d", i);
|
||||
if (((i+1)*4) < nArgBytes) fprintf(out3,",");
|
||||
}
|
||||
fprintf(out3,")\n{\n");
|
||||
fprintf(out3,"\t__asm {\n");
|
||||
fprintf(out3,"\t\tpush\tebp\n");
|
||||
fprintf(out3,"\t\tmov\tebp, esp\n");
|
||||
fprintf(out3,"\t\tmov\teax,%d\n",sys_call_idx);
|
||||
fprintf(out3,"\t\tlea\tedx, 8[ebp]\n");
|
||||
fprintf(out3,"\t\tint\t0x2E\n");
|
||||
fprintf(out3,"\t\tpop\tebp\n");
|
||||
fprintf(out3,"\t\tret\t%s\n",nr_args);
|
||||
fprintf(out3,"\t}\n");
|
||||
fprintf(out3,"}\n\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
int makeSystemServiceTable(FILE *in, FILE *out)
|
||||
{
|
||||
char line [INPUT_BUFFER_SIZE];
|
||||
char *s;
|
||||
char *name;
|
||||
char *name2;
|
||||
int sys_call_idx;
|
||||
char *nr_args;
|
||||
char *stmp;
|
||||
|
||||
/*
|
||||
* Main SSDT Header
|
||||
*/
|
||||
fprintf(out,"// Machine generated, don't edit\n");
|
||||
fprintf(out,"\n\n");
|
||||
|
||||
/*
|
||||
* First we build the Main SSDT
|
||||
*/
|
||||
fprintf(out,"\n\n\n");
|
||||
fprintf(out,"SSDT MainSSDT[] = {\n");
|
||||
|
||||
for ( /* First system call has index zero */
|
||||
sys_call_idx = 0;
|
||||
/* Go on until EOF or read zero bytes */
|
||||
( (!feof(in))
|
||||
&& (fgets(line, sizeof line, in) != NULL)
|
||||
);
|
||||
/* Next system call index */
|
||||
sys_call_idx++
|
||||
)
|
||||
{
|
||||
if ((s = (char *) strchr(line,'\r')) != NULL)
|
||||
{
|
||||
*s = '\0';
|
||||
}
|
||||
/*
|
||||
* Skip comments (#) and empty lines.
|
||||
*/
|
||||
s = & line[0];
|
||||
if ((*s) != '#' && (*s) != '\0')
|
||||
{
|
||||
/* Extract the NtXXX name */
|
||||
name = (char *)strtok(s," \t");
|
||||
/* Extract the ZwXXX name */
|
||||
name2 = (char *)strtok(NULL," \t");
|
||||
//value = strtok(NULL," \t");
|
||||
/* Extract the stack size */
|
||||
nr_args = (char *)strtok(NULL," \t");
|
||||
/*
|
||||
* Remove, if present, the trailing LF.
|
||||
*/
|
||||
if ((stmp = strchr(nr_args, '\n')) != NULL)
|
||||
{
|
||||
*stmp = '\0';
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
printf("%3d \"%s\"\n",sys_call_idx,name);
|
||||
#endif
|
||||
|
||||
if (sys_call_idx > 0)
|
||||
{
|
||||
fprintf(out,",\n");
|
||||
}
|
||||
/*
|
||||
* Now write the current system call's name
|
||||
* in the service table.
|
||||
*/
|
||||
fprintf(out,"\t\t{ (ULONG)%s }",name);
|
||||
}
|
||||
}
|
||||
/* Close the service table (C syntax) */
|
||||
fprintf(out,"\n};\n");
|
||||
|
||||
/*
|
||||
* Now we build the Main SSPT
|
||||
*/
|
||||
rewind(in);
|
||||
fprintf(out,"\n\n\n");
|
||||
fprintf(out,"SSPT MainSSPT[] = {\n");
|
||||
|
||||
for ( /* First system call has index zero */
|
||||
sys_call_idx = 0;
|
||||
/* Go on until EOF or read zero bytes */
|
||||
( (!feof(in))
|
||||
&& (fgets(line, sizeof line, in) != NULL)
|
||||
);
|
||||
/* Next system call index */
|
||||
sys_call_idx++
|
||||
)
|
||||
{
|
||||
if ((s = (char *) strchr(line,'\r')) != NULL)
|
||||
{
|
||||
*s = '\0';
|
||||
}
|
||||
/*
|
||||
* Skip comments (#) and empty lines.
|
||||
*/
|
||||
s = & line[0];
|
||||
if ((*s) != '#' && (*s) != '\0')
|
||||
{
|
||||
/* Extract the NtXXX name */
|
||||
name = (char *)strtok(s," \t");
|
||||
/* Extract the ZwXXX name */
|
||||
name2 = (char *)strtok(NULL," \t");
|
||||
//value = strtok(NULL," \t");
|
||||
/* Extract the stack size */
|
||||
nr_args = (char *)strtok(NULL," \t");
|
||||
/*
|
||||
* Remove, if present, the trailing LF.
|
||||
*/
|
||||
if ((stmp = strchr(nr_args, '\n')) != NULL)
|
||||
{
|
||||
*stmp = '\0';
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
printf("%3d \"%s\"\n",sys_call_idx,name);
|
||||
#endif
|
||||
|
||||
if (sys_call_idx > 0)
|
||||
{
|
||||
fprintf(out,",\n");
|
||||
}
|
||||
/*
|
||||
* Now write the current system call's ID
|
||||
* in the service table along with its Parameters Size.
|
||||
*/
|
||||
fprintf(out,"\t\t{ %s }",nr_args);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Close the service table (C syntax)
|
||||
*/
|
||||
fprintf(out,"\n};\n");
|
||||
|
||||
/*
|
||||
* We write some useful defines
|
||||
*/
|
||||
fprintf(out, "\n\n#define MIN_SYSCALL_NUMBER 0\n");
|
||||
fprintf(out, "#define MAX_SYSCALL_NUMBER %d\n", sys_call_idx-1);
|
||||
fprintf(out, "#define NUMBER_OF_SYSCALLS %d\n", sys_call_idx);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
process(
|
||||
FILE * in,
|
||||
FILE * out,
|
||||
FILE * out2,
|
||||
FILE * out3
|
||||
)
|
||||
{
|
||||
char line [INPUT_BUFFER_SIZE];
|
||||
char * s;
|
||||
char * name; /* NtXXX name */
|
||||
char * name2; /* ZwXXX name */
|
||||
int sys_call_idx; /* NtXXX index number in the service table */
|
||||
char * nr_args; /* stack_size / machine_word_size */
|
||||
char * stmp;
|
||||
|
||||
/*
|
||||
* NTDLL stubs file header
|
||||
*/
|
||||
fprintf(out,"// Machine generated, don't edit\n");
|
||||
fprintf(out,"\n\n");
|
||||
|
||||
/*
|
||||
* NTOSKRNL Zw functions stubs header
|
||||
*/
|
||||
fprintf(out3,"// Machine generated by genntdll, don't edit\n");
|
||||
fprintf(out3,"\n\n");
|
||||
/*
|
||||
* Scan the database. DB is a text file; each line
|
||||
* is a record, which contains data for one system
|
||||
* function. Each record has three columns:
|
||||
*
|
||||
* NT_NAME (e.g. NtCreateProcess)
|
||||
* ZW_NAME (e.g. ZwCreateProcess)
|
||||
* STACK_SIZE (in machine words: for x[3456]86
|
||||
* processors a machine word is 4 bytes)
|
||||
*/
|
||||
for ( /* First system call has index zero */
|
||||
sys_call_idx = 0;
|
||||
/* Go on until EOF or read zero bytes */
|
||||
( (!feof(in))
|
||||
&& (fgets(line, sizeof line, in) != NULL)
|
||||
);
|
||||
/* Next system call index */
|
||||
sys_call_idx++
|
||||
)
|
||||
{
|
||||
/*
|
||||
* Remove, if present, the trailing CR.
|
||||
* (os specific?)
|
||||
*/
|
||||
if ((s = (char *) strchr(line,'\r')) != NULL)
|
||||
{
|
||||
*s = '\0';
|
||||
}
|
||||
/*
|
||||
* Skip comments (#) and empty lines.
|
||||
*/
|
||||
s = & line[0];
|
||||
if ((*s) != '#' && (*s) != '\0')
|
||||
{
|
||||
/* Extract the NtXXX name */
|
||||
name = (char *)strtok(s," \t");
|
||||
/* Extract the ZwXXX name */
|
||||
name2 = (char *)strtok(NULL," \t");
|
||||
//value = strtok(NULL," \t");
|
||||
/* Extract the stack size */
|
||||
nr_args = (char *)strtok(NULL," \t");
|
||||
/*
|
||||
* Remove, if present, the trailing LF.
|
||||
*/
|
||||
if ((stmp = strchr(nr_args, '\n')) != NULL)
|
||||
{
|
||||
*stmp = '\0';
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
printf("%3d \"%s\"\n",sys_call_idx,name);
|
||||
#endif
|
||||
/*
|
||||
* Write the NTDLL stub for the current
|
||||
* system call: NtXXX and ZwXXX symbols
|
||||
* are aliases.
|
||||
*/
|
||||
write_syscall_stub(out, out3, name, name2,
|
||||
nr_args, sys_call_idx);
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void usage(char * argv0)
|
||||
{
|
||||
printf("Usage: %s sysfuncs.lst napi.c napi.h zw.c\n"
|
||||
" sysfuncs.lst system functions database\n"
|
||||
" napi.c NTDLL stubs\n"
|
||||
" napi.h NTOSKRNL service table\n"
|
||||
" zw.c NTOSKRNL Zw stubs\n",
|
||||
argv0
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
FILE * in; /* System calls database */
|
||||
FILE * out1; /* NTDLL stubs */
|
||||
FILE * out2; /* SERVICE_TABLE */
|
||||
FILE * out3; /* NTOSKRNL Zw stubs */
|
||||
int ret;
|
||||
|
||||
if (argc != 5)
|
||||
{
|
||||
usage(argv[0]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
in = fopen(argv[1],"rb");
|
||||
if (in == NULL)
|
||||
{
|
||||
perror("Failed to open input file (system calls database)");
|
||||
return(1);
|
||||
}
|
||||
|
||||
out1 = fopen(argv[2],"wb");
|
||||
if (out1 == NULL)
|
||||
{
|
||||
perror("Failed to open output file (NTDLL stubs)");
|
||||
return(1);
|
||||
}
|
||||
|
||||
out2 = fopen(argv[3],"wb");
|
||||
if (out2 == NULL)
|
||||
{
|
||||
perror("Failed to open output file (NTOSKRNL service table)");
|
||||
return(1);
|
||||
}
|
||||
|
||||
out3 = fopen(argv[4],"wb");
|
||||
if (out3 == NULL)
|
||||
{
|
||||
perror("Failed to open output file (NTOSKRNL Zw stubs)");
|
||||
return(1);
|
||||
}
|
||||
|
||||
ret = process(in,out1,out2,out3);
|
||||
rewind(in);
|
||||
ret = makeSystemServiceTable(in, out2);
|
||||
|
||||
fclose(in);
|
||||
fclose(out1);
|
||||
fclose(out2);
|
||||
fclose(out3);
|
||||
|
||||
return(ret);
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
# $Id: makefile,v 1.1 2004/02/06 08:21:56 fireball Exp $
|
||||
#
|
||||
# ReactOS Operating System - MSVC6 Zw functions stubs to call generator
|
||||
#
|
||||
|
||||
SYSTEM_CALLS_DB = ..\..\..\reactos\iface\native\sysfuncs.lst
|
||||
KERNEL_ZW_CALLS =..\..\ntoskrnl\nt_zw_msvc.c
|
||||
|
||||
all: genntdll.exe $(KERNEL_ZW_CALLS)
|
||||
|
||||
$(KERNEL_ZW_CALLS) : $(SYSTEM_CALLS_DB)
|
||||
genntdll.exe $(SYSTEM_CALLS_DB) foo1 foo2 $(KERNEL_ZW_CALLS)
|
||||
-@del foo1
|
||||
-@del foo2
|
||||
|
||||
genntdll.exe : genntdll.c
|
||||
|
||||
clean:
|
||||
-@del *.exe
|
||||
-@del *.obj
|
||||
-@del $(KERNEL_ZW_CALLS)
|
||||
|
@@ -1,4 +0,0 @@
|
||||
Debug
|
||||
Release
|
||||
nt_zw_msvc.c
|
||||
ntoskrnl.def
|
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
||||
*
|
||||
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-25
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/* $Id: ke_i386_bthread.c,v 1.1 2004/02/06 08:21:56 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/i386/bthread.S
|
||||
* PURPOSE: Trap handlers
|
||||
* PROGRAMMER: David Welch (david.welch@seh.ox.ac.uk)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
|
||||
/* Values for contextflags */
|
||||
#define CONTEXT_i386 0x10000
|
||||
#ifndef CONTEXT_CONTROL
|
||||
#define CONTEXT_CONTROL (CONTEXT_i386 | 1)
|
||||
#endif
|
||||
#ifndef CONTEXT_INTEGER
|
||||
#define CONTEXT_INTEGER (CONTEXT_i386 | 2)
|
||||
#endif
|
||||
#ifndef CONTEXT_SEGMENTS
|
||||
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 4)
|
||||
#endif
|
||||
#ifndef CONTEXT_FLOATING_POINT
|
||||
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8)
|
||||
#endif
|
||||
#ifndef CONTEXT_DEBUG_REGISTERS
|
||||
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x10)
|
||||
#endif
|
||||
#ifndef CONTEXT_FULL
|
||||
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
|
||||
#endif
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
void KeReturnFromSystemCallWithHook();
|
||||
|
||||
VOID PiBeforeBeginThread(CONTEXT c);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
__declspec(naked)
|
||||
VOID PsBeginThread(PKSTART_ROUTINE StartRoutine, PVOID StartContext)
|
||||
{
|
||||
/*
|
||||
* This isn't really a function, we are called as the return address
|
||||
* of the context switch function
|
||||
*/
|
||||
|
||||
/*
|
||||
* Do the necessary prolog after a context switch
|
||||
*/
|
||||
__asm
|
||||
{
|
||||
call PiBeforeBeginThread
|
||||
|
||||
/*
|
||||
* Call the actual start of the thread
|
||||
*/
|
||||
// We must NOT use the arguments by name. VC then uses EBP-relative
|
||||
// addressing, and with an EBP of 0 you can imagine what happens.
|
||||
mov ebx, 4[esp] // StartRoutine
|
||||
mov eax, 8[esp] // StartContext
|
||||
push eax
|
||||
call ebx /* Call the start routine */
|
||||
add esp, 4
|
||||
|
||||
/*
|
||||
* Terminate the thread
|
||||
*/
|
||||
push eax
|
||||
call PsTerminateSystemThread
|
||||
add esp, 4
|
||||
|
||||
}
|
||||
|
||||
/* If that fails then bug check */
|
||||
KeBugCheck(0);
|
||||
|
||||
/* And if that fails then loop */
|
||||
for (;;)
|
||||
; // forever
|
||||
}
|
||||
|
||||
|
||||
__declspec(naked)
|
||||
VOID PsBeginThreadWithContextInternal(VOID)
|
||||
{
|
||||
/*
|
||||
* This isn't really a function, we are called as the return
|
||||
* address of a context switch
|
||||
*/
|
||||
|
||||
/*
|
||||
* Do the necessary prolog before the context switch
|
||||
*/
|
||||
__asm
|
||||
{
|
||||
call PiBeforeBeginThread
|
||||
|
||||
/*
|
||||
* Load the context flags.
|
||||
*/
|
||||
pop ebx
|
||||
|
||||
/*
|
||||
* Load the debugging registers
|
||||
*/
|
||||
test ebx, (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386)
|
||||
jz L1
|
||||
pop eax __asm mov dr0, eax
|
||||
pop eax __asm mov dr1, eax
|
||||
pop eax __asm mov dr2, eax
|
||||
pop eax __asm mov dr3, eax
|
||||
pop eax __asm mov dr6, eax
|
||||
pop eax __asm mov dr7, eax
|
||||
jmp L3
|
||||
L1:
|
||||
add esp, 24
|
||||
L3:
|
||||
|
||||
/*
|
||||
* Load the floating point registers
|
||||
*/
|
||||
mov eax, HardwareMathSupport
|
||||
test eax,eax
|
||||
jz L2
|
||||
test ebx, (CONTEXT_FLOATING_POINT & ~CONTEXT_i386)
|
||||
jz L2
|
||||
frstor [esp]
|
||||
L2:
|
||||
add esp, 112
|
||||
|
||||
/* Load the rest of the thread's user mode context. */
|
||||
mov eax, 0
|
||||
jmp KeReturnFromSystemCallWithHook
|
||||
}
|
||||
}
|
||||
|
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
||||
*
|
||||
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* FILE: ntoskrnl/ke/i386/vm86_sup.S
|
||||
* PURPOSE: V86 mode support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* Created 09/10/00
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <internal/v86m.h>
|
||||
#include <ntos/tss.h>
|
||||
#include <internal/trap.h>
|
||||
#include <internal/ps.h>
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/i386/segment.h>
|
||||
|
||||
// no arg-list, but asm doesn't care anyway
|
||||
void KiInterruptDispatch();
|
||||
|
||||
|
||||
#define DEFINE_INT_HANDLER(N) \
|
||||
__declspec(naked) \
|
||||
void irq_handler_##N() \
|
||||
{ \
|
||||
__asm pushad \
|
||||
__asm push ds \
|
||||
__asm push es \
|
||||
__asm push fs \
|
||||
__asm mov eax, 0xceafbeef \
|
||||
__asm push eax \
|
||||
__asm mov ax, KERNEL_DS \
|
||||
__asm mov ds, ax \
|
||||
__asm mov es, ax \
|
||||
__asm mov ax, PCR_SELECTOR \
|
||||
__asm mov fs, ax \
|
||||
__asm push esp \
|
||||
__asm push N \
|
||||
__asm call KiInterruptDispatch \
|
||||
__asm pop eax \
|
||||
__asm pop eax \
|
||||
__asm pop eax \
|
||||
__asm pop fs \
|
||||
__asm pop es \
|
||||
__asm pop ds \
|
||||
__asm popad \
|
||||
__asm iretd
|
||||
// NOTE: The inline assembler can't deal with having the final brace,
|
||||
// ending the function, on the same line as an __asm, why there is
|
||||
// none here and it MUST be added when using the macro!
|
||||
|
||||
DEFINE_INT_HANDLER(0)
|
||||
}
|
||||
DEFINE_INT_HANDLER(1)
|
||||
}
|
||||
DEFINE_INT_HANDLER(2)
|
||||
}
|
||||
DEFINE_INT_HANDLER(3)
|
||||
}
|
||||
DEFINE_INT_HANDLER(4)
|
||||
}
|
||||
DEFINE_INT_HANDLER(5)
|
||||
}
|
||||
DEFINE_INT_HANDLER(6)
|
||||
}
|
||||
DEFINE_INT_HANDLER(7)
|
||||
}
|
||||
DEFINE_INT_HANDLER(8)
|
||||
}
|
||||
DEFINE_INT_HANDLER(9)
|
||||
}
|
||||
DEFINE_INT_HANDLER(10)
|
||||
}
|
||||
DEFINE_INT_HANDLER(11)
|
||||
}
|
||||
DEFINE_INT_HANDLER(12)
|
||||
}
|
||||
DEFINE_INT_HANDLER(13)
|
||||
}
|
||||
DEFINE_INT_HANDLER(14)
|
||||
}
|
||||
DEFINE_INT_HANDLER(15)
|
||||
}
|
||||
|
@@ -1,655 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2003 Mike Nordell
|
||||
* Based on multiboot.S (no copyright note present), but so heavily
|
||||
* modified that it bears close to no resemblance to the original work.
|
||||
*
|
||||
* MSVC compatible combination of plain C and inline assembler to:
|
||||
* 1 Relocated all the sections in the kernel - something I feel the
|
||||
* bootloader should have done, but multiboot being just a "raw image"
|
||||
* loader, it unfortunately had to be done here - in-place.
|
||||
* 2 Set up page directories and stuff.
|
||||
* 3 Load IDT, GDT and turn on paging, making us execute at the intended
|
||||
* target address (as if the image was PE-loaded and parsed into that addr.)
|
||||
* 4 Call _main, and let the rest of the startup run...
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// TODO: Fix the MP parts
|
||||
//
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <pe.h>
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/ps.h>
|
||||
#include <internal/ldr.h>
|
||||
|
||||
|
||||
// some notes:
|
||||
// The MSVC linker (by defult) emits no special .bss section, but uses the data
|
||||
// section with a rawsize smaller than virtualsize. The "slack" is BSS.
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Some macros we need
|
||||
|
||||
// some stuff straight from freeloaders multiboot.h
|
||||
#define MULTIBOOT_HEADER_MAGIC (0x1BADB002)
|
||||
#define MULTIBOOT_HEADER_FLAGS (0x00010003)
|
||||
|
||||
#define TARGET_LOAD_ADDR 0x00200000
|
||||
#define BASE_TO_PHYS_DIST (KERNEL_BASE - TARGET_LOAD_ADDR)
|
||||
|
||||
#define V2P(x) (x - BASE_TO_PHYS_DIST)
|
||||
|
||||
|
||||
#ifdef MP
|
||||
|
||||
#define AP_MAGIC (0x12481020)
|
||||
|
||||
#endif /* MP */
|
||||
|
||||
|
||||
|
||||
void initialize_page_directory(void);
|
||||
|
||||
void* relocate_pointer_log_to_phys(const void* p)
|
||||
{
|
||||
// DON'T CALL this function until relocation of .data and/or .rdata,
|
||||
// is completed - but still be sure that we have not yet enabled paging!
|
||||
return (void*)((DWORD)p - BASE_TO_PHYS_DIST);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
// Macro to emit one character to Bochs debug-port (0x9e).
|
||||
// We need to do it this way, since at this point of the startup, obviously
|
||||
// we have neither HAL nor DbgPrint support.
|
||||
#define BOCHS_OUT_CHAR(c1) __asm push eax __asm push edx __asm mov dx, 0xe9 __asm mov al, c1 __asm out dx, al __asm pop edx __asm pop eax
|
||||
|
||||
void boch_out_hex_digit(unsigned char ch1)
|
||||
{
|
||||
if (ch1 <= 9) { ch1 += '0'; } else { ch1 += 'a' - 10; }
|
||||
BOCHS_OUT_CHAR(ch1)
|
||||
}
|
||||
|
||||
void bochs_dump_hex(DWORD p)
|
||||
{
|
||||
unsigned char ch3 = (unsigned char)((p >> 28) & 0x0f);
|
||||
unsigned char cl3 = (unsigned char)((p >> 24) & 0x0f);
|
||||
unsigned char ch2 = (unsigned char)((p >> 20) & 0x0f);
|
||||
unsigned char cl2 = (unsigned char)((p >> 16) & 0x0f);
|
||||
unsigned char ch1 = (unsigned char)((p >> 12) & 0x0f);
|
||||
unsigned char cl1 = (unsigned char)((p >> 8) & 0x0f);
|
||||
unsigned char ch0 = (unsigned char)((p >> 4) & 0x0f);
|
||||
unsigned char cl0 = (unsigned char)((p >> 0) & 0x0f);
|
||||
BOCHS_OUT_CHAR('0') BOCHS_OUT_CHAR('x')
|
||||
boch_out_hex_digit(ch3);
|
||||
boch_out_hex_digit(cl3);
|
||||
boch_out_hex_digit(ch2);
|
||||
boch_out_hex_digit(cl2);
|
||||
boch_out_hex_digit(ch1);
|
||||
boch_out_hex_digit(cl1);
|
||||
boch_out_hex_digit(ch0);
|
||||
boch_out_hex_digit(cl0);
|
||||
BOCHS_OUT_CHAR('\n')
|
||||
}
|
||||
|
||||
static void bochs_out_string(const char* s /* logical address! */)
|
||||
{
|
||||
s = relocate_pointer_log_to_phys(s);
|
||||
__asm
|
||||
{
|
||||
pushad
|
||||
mov dx, 0xe9
|
||||
mov ebx, s
|
||||
L1:
|
||||
cmp byte ptr[ebx], 0
|
||||
je end
|
||||
mov al, [ebx]
|
||||
out dx, al
|
||||
inc ebx
|
||||
jmp L1
|
||||
end:
|
||||
popad
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define BOCHS_OUT_CHAR(c1)
|
||||
#define bochs_dump_hex(VAL)
|
||||
#define bochs_out_string(STR)
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef char kernel_page_t[4096];
|
||||
|
||||
// Use 4096 (pagesize) more bytes that actually needed for each *_holder,
|
||||
// to be able to make sure that the other stuff is page aligned.
|
||||
// No other way to do this portably... :-(
|
||||
//
|
||||
// TODO: Consider allocating just one large block of BSS memory here, align
|
||||
// just the first pointer, and then get the other ones just as offsets from
|
||||
// this (now-aligned) pointer. That way we could get away with wasting just
|
||||
// one page of memory, instead of 4 (like 16KB would matter... but still)
|
||||
static kernel_page_t* startup_pagedirectory_holder[1024 * 2];
|
||||
static kernel_page_t* lowmem_pagetable_holder[1024 * 2];
|
||||
static kernel_page_t* kernel_pagetable_holder[32*1024 + 1];
|
||||
static __int32 kpcr_pagetable_holder[4096/4 * 2];
|
||||
|
||||
#ifdef MP
|
||||
char apic_pagetable[4096];
|
||||
#endif /* MP */
|
||||
|
||||
__int32 unmap_me[4096/4];
|
||||
__int32 unmap_me2[4096/4];
|
||||
__int32 unmap_me3[4096/4];
|
||||
|
||||
__int32 init_stack[3*4096/4];
|
||||
int init_stack_top;
|
||||
|
||||
|
||||
__int32 trap_stack[3*4096/4];
|
||||
int trap_stack_top;
|
||||
|
||||
|
||||
|
||||
void _main();
|
||||
// lie a bit about types - since C is basically typeless anyway, it
|
||||
// doesn't really matter what type we say it is here...
|
||||
extern int KiGdtDescriptor;
|
||||
extern int KiIdtDescriptor;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is called by the realmode loader, with protected mode
|
||||
* enabled, paging disabled and the segment registers pointing
|
||||
* a 4Gb, 32-bit segment starting at zero.
|
||||
*
|
||||
* EAX = Multiboot magic or application processor magic
|
||||
*
|
||||
* EBX = Points to a structure in lowmem with data from the
|
||||
* loader
|
||||
*/
|
||||
#pragma intrinsic(memset)
|
||||
|
||||
|
||||
// We need to implement this ourself, to be able to get to it by short call's
|
||||
void our_memmove(void* pDest, const void* pSrc, DWORD size)
|
||||
{
|
||||
char* pD = (char*)pDest;
|
||||
const char* pS = (char*)pSrc;
|
||||
if (pDest < pSrc)
|
||||
{
|
||||
while (size--)
|
||||
{
|
||||
*pD++ = *pS++;
|
||||
}
|
||||
}
|
||||
else if (pSrc < pDest)
|
||||
{
|
||||
while (size--)
|
||||
{
|
||||
pD[size] = pS[size];
|
||||
}
|
||||
}
|
||||
}
|
||||
void dummy_placeholder(void)
|
||||
{
|
||||
// NOTE: This function MUST be placed JUST AFTER MultibootStub in memory.
|
||||
// Yes, it's BEFORE it in this file, but linkorder.txt fixes this for us.
|
||||
}
|
||||
|
||||
|
||||
// This one is needed, since the boot loader hasn't relocated us
|
||||
__declspec(naked)
|
||||
void MultibootStub()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
jmp _multiboot_entry
|
||||
// This sucks, I know...
|
||||
#define EMIT_DWORD(x) __asm __emit ((x) >> 0) & 0xff __asm _emit ((x) >> 8) & 0xff __asm _emit ((x) >> 16) & 0xff __asm _emit ((x) >> 24) & 0xff
|
||||
ALIGN 4
|
||||
EMIT_DWORD(MULTIBOOT_HEADER_MAGIC)
|
||||
EMIT_DWORD(MULTIBOOT_HEADER_FLAGS)
|
||||
EMIT_DWORD(-(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS))
|
||||
EMIT_DWORD(TARGET_LOAD_ADDR + 0x0400 + 0x04)
|
||||
// Now just make something up, since there is no way we can know, beforehand,
|
||||
// where any BSS data is...
|
||||
EMIT_DWORD((TARGET_LOAD_ADDR))
|
||||
EMIT_DWORD((TARGET_LOAD_ADDR + 1*1024*1024)) /* assume ntoskrnel.exe is < 1MB! */
|
||||
EMIT_DWORD((TARGET_LOAD_ADDR + 2*1024*1024)) /* just to have something, let's say BSS is 1MB too */
|
||||
/* This is *REALLY* ugly! If MultibootStub is *EVER* at */
|
||||
/* any other offset, this will crash like crazy! */
|
||||
/* 0x0400 is the file alignment of the binary (ntoskrnl.exe) */
|
||||
EMIT_DWORD((TARGET_LOAD_ADDR + 0x0400)) // entry_addr
|
||||
|
||||
_multiboot_entry:
|
||||
|
||||
cld // just for good measure
|
||||
}
|
||||
|
||||
{
|
||||
/* Save the multiboot or application processor magic */
|
||||
DWORD saved_eax;
|
||||
DWORD saved_ebx;
|
||||
__asm mov saved_eax, eax
|
||||
__asm mov saved_ebx, ebx
|
||||
|
||||
// bochs_out_string("MultibootStub()\n");
|
||||
|
||||
// OK, time to relocate the brute-loaded image in-place...
|
||||
// If we don't watch it, we will overwrite ourselves here - imagine
|
||||
// the fireworks! :-) That's why the function dummy_placeholder()
|
||||
// MUST be placed JUST JUST AFTER this function.
|
||||
|
||||
{
|
||||
PIMAGE_NT_HEADERS NtHeader = RtlImageNtHeader((PVOID)TARGET_LOAD_ADDR);
|
||||
PIMAGE_SECTION_HEADER Section = IMAGE_FIRST_SECTION(NtHeader);
|
||||
const int count = NtHeader->FileHeader.NumberOfSections;
|
||||
int i;
|
||||
Section += count - 1; // make it point to the last section
|
||||
// NOTE: We MUST walk the sections "backwards".
|
||||
for (i = count-1; i >= 0; --i, --Section)
|
||||
{
|
||||
DWORD dwSrc = TARGET_LOAD_ADDR + Section->PointerToRawData;
|
||||
DWORD dwDst = TARGET_LOAD_ADDR + Section->VirtualAddress;
|
||||
DWORD dwSiz = Section->SizeOfRawData;
|
||||
const char* pEndThisFunc;
|
||||
|
||||
if (dwSrc == dwDst)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//bochs_out_string("MultibootStub: relocating section\n");
|
||||
|
||||
if (Section->Characteristics & IMAGE_SCN_MEM_EXECUTE)
|
||||
{
|
||||
// can't get a pointer to a label from plain C :-(
|
||||
__asm mov pEndThisFunc, offset dummy_placeholder
|
||||
pEndThisFunc -= BASE_TO_PHYS_DIST;
|
||||
if (dwDst < (DWORD)pEndThisFunc)
|
||||
{
|
||||
// We must not move the code from under our feet!
|
||||
// This can only happen in the code segment - the first segment
|
||||
DWORD diff = (DWORD)pEndThisFunc - dwDst;
|
||||
dwDst += diff;
|
||||
dwSrc += diff;
|
||||
dwSiz -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
// obviously we must use memmove, since memory can overlap
|
||||
our_memmove((void*)dwDst, (void*)dwSrc, dwSiz);
|
||||
|
||||
// While at it, we might as well zero any uninitialized data in the section...
|
||||
if (Section->SizeOfRawData < Section->Misc.VirtualSize)
|
||||
{
|
||||
memset((char*)(Section->VirtualAddress + Section->SizeOfRawData + TARGET_LOAD_ADDR),
|
||||
0,
|
||||
Section->Misc.VirtualSize - Section->SizeOfRawData);
|
||||
}
|
||||
}
|
||||
|
||||
// Now all sections are relocated to their intended in-memory layout,
|
||||
// but we are still running int the low TARGET_LOAD_ADDR memory.
|
||||
|
||||
{
|
||||
// Time to jump to the real startup, the entry-point function.
|
||||
// We must do this using assembler, since both eax and ebx are assumed
|
||||
// to hold some magic values.
|
||||
typedef VOID (STDCALL* pfn_t)(PPEB);
|
||||
pfn_t pfn = (pfn_t)(NtHeader->OptionalHeader.AddressOfEntryPoint + TARGET_LOAD_ADDR);
|
||||
#if 1
|
||||
__asm mov eax, saved_eax
|
||||
__asm mov ebx, saved_ebx
|
||||
__asm mov ecx, pfn
|
||||
__asm jmp ecx
|
||||
#else
|
||||
__asm mov ebx, saved_ebx
|
||||
(*pfn)((PPEB)saved_eax);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TMN: TODO: Convert this to the extent possible to plain C code
|
||||
// Due to the "magic" above, we enter this function with all kernel sections
|
||||
// properly relocated wrt. offsets from start-of-mem. But, we are still running
|
||||
// without paging, meaning that the address that is to be KERNEL_BASE+xyz is
|
||||
// currently still TARGET_LOAD_ADDR+xyz.
|
||||
// We get aways with a few of the functions call here since they are near calls
|
||||
// (PC-relative), but don't even _think_ about calling any other functions
|
||||
// until we have turned on paging!
|
||||
VOID STDCALL
|
||||
NtProcessStartup(
|
||||
IN PPEB Peb
|
||||
)
|
||||
{
|
||||
DWORD saved_ebx;
|
||||
DWORD saved_eax;
|
||||
__asm mov saved_ebx, ebx
|
||||
__asm mov saved_eax, eax
|
||||
|
||||
bochs_out_string("NtProcessStartup: Just entered\n");
|
||||
|
||||
#ifdef MP
|
||||
if (saved_eax != AP_MAGIC)
|
||||
{
|
||||
#endif /* MP */
|
||||
|
||||
bochs_out_string("NtProcessStartup: Calling initialize_page_directory()\n");
|
||||
|
||||
initialize_page_directory(); // Initialize the page directory
|
||||
|
||||
bochs_out_string("NtProcessStartup: Page directory initialized\n");
|
||||
|
||||
#ifdef MP
|
||||
|
||||
__asm
|
||||
{
|
||||
/*
|
||||
* Initialize the page table that maps the APIC register address space
|
||||
*/
|
||||
|
||||
/*
|
||||
* FIXME: APIC register address space can be non-standard so do the
|
||||
* mapping later
|
||||
*/
|
||||
mov esi, V2P(apic_pagetable)
|
||||
mov edi, 0
|
||||
mov eax, 0xFEC0001B
|
||||
mov [esi+edi], eax
|
||||
mov edi, 0x800
|
||||
mov eax, 0xFEE0001B
|
||||
mov [esi+edi], eax
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MP */
|
||||
|
||||
{
|
||||
bochs_out_string("NtProcessStartup: Enabling paging...\n");
|
||||
|
||||
/*
|
||||
* Enable paging and set write protect
|
||||
* bit 31: PG, bit 16: WP
|
||||
*/
|
||||
__asm mov eax, cr0
|
||||
__asm or eax, 0x80010000
|
||||
__asm mov cr0, eax
|
||||
|
||||
bochs_out_string("NtProcessStartup: Paging enabled!\n");
|
||||
bochs_out_string("NtProcessStartup: But we're still at the \"low\" address\n");
|
||||
|
||||
/*
|
||||
* Do an absolute jump because we now want to execute above KERNEL_BASE
|
||||
*/
|
||||
__asm mov eax, offset l2_
|
||||
__asm jmp eax
|
||||
}
|
||||
|
||||
l2_:
|
||||
|
||||
bochs_out_string("We have now left \"low\" memory, and is flying at an altitude of...\n");
|
||||
bochs_out_string("OK, we're not flying, we're just executing above KERNEL_BASE\n");
|
||||
|
||||
/*
|
||||
* Load the GDTR and IDTR with new tables located above
|
||||
* KERNEL_BASE
|
||||
*/
|
||||
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
DWORD val = (DWORD)&KiGdtDescriptor;
|
||||
bochs_out_string("&KiGdtDescriptor: ");
|
||||
bochs_dump_hex(val);
|
||||
|
||||
val = (DWORD)&KiIdtDescriptor;
|
||||
bochs_out_string("&KiIdtDescriptor: ");
|
||||
bochs_dump_hex(val);
|
||||
}
|
||||
#endif
|
||||
|
||||
bochs_out_string("Loading GDT and IDT...\n");
|
||||
|
||||
/* FIXME: Application processors should have their own GDT/IDT */
|
||||
__asm lgdt KiGdtDescriptor
|
||||
__asm lidt KiIdtDescriptor
|
||||
|
||||
bochs_out_string("GDT and IDT loaded\n");
|
||||
|
||||
__asm
|
||||
{
|
||||
/*
|
||||
* Reload the data segment registers
|
||||
*/
|
||||
mov eax, KERNEL_DS
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
mov eax, 0
|
||||
mov fs, ax
|
||||
}
|
||||
|
||||
bochs_out_string("NtProcessStartup: segment registers loaded\n");
|
||||
|
||||
#ifdef MP
|
||||
|
||||
if (saved_eax == AP_MAGIC)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/*
|
||||
* This is an application processor executing
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialize EFLAGS
|
||||
*/
|
||||
push 0
|
||||
popfd
|
||||
|
||||
/*
|
||||
* Call the application processor initialization code
|
||||
*/
|
||||
push 0
|
||||
push offset l7_
|
||||
push KERNEL_CS
|
||||
push KiSystemStartup
|
||||
retf
|
||||
|
||||
/*
|
||||
* Catch illegal returns from KiSystemStartup
|
||||
*/
|
||||
l7_:
|
||||
pop eax
|
||||
}
|
||||
|
||||
KeBugCheck(0);
|
||||
|
||||
for (;;)
|
||||
; /*forever */
|
||||
}
|
||||
|
||||
#endif /* MP */
|
||||
|
||||
bochs_out_string("Loading fs with PCR_SELECTOR\n");
|
||||
|
||||
/* Load the PCR selector */
|
||||
__asm mov eax, PCR_SELECTOR
|
||||
__asm mov fs, ax
|
||||
|
||||
bochs_out_string("Loading esp with init_stack_top : "); bochs_dump_hex((DWORD)&init_stack_top);
|
||||
bochs_out_string("Just for interest, init_stack is at: "); bochs_dump_hex((DWORD)init_stack);
|
||||
bochs_out_string("Meaing the init_stack in bytes is : "); bochs_dump_hex((DWORD)&init_stack_top - (DWORD)init_stack);
|
||||
|
||||
|
||||
/* Load the initial kernel stack */
|
||||
__asm mov esp, offset init_stack_top
|
||||
|
||||
bochs_out_string("Loaded esp with init_stack_top\n");
|
||||
|
||||
/*
|
||||
* Initialize EFLAGS
|
||||
*/
|
||||
__asm push 0
|
||||
__asm popfd
|
||||
|
||||
bochs_out_string("Loaded eflags\n");
|
||||
|
||||
/*
|
||||
* Call the main kernel initialization
|
||||
*/
|
||||
bochs_out_string("TMN: Calling _main...\n");
|
||||
|
||||
__asm
|
||||
{
|
||||
xor ebp,ebp
|
||||
push ebx
|
||||
push edx
|
||||
push offset l5_
|
||||
push KERNEL_CS
|
||||
push offset _main
|
||||
retf
|
||||
|
||||
/*
|
||||
* Catch illegal returns from main, try bug checking the system,
|
||||
* if that fails then loop forever.
|
||||
*/
|
||||
l5_:
|
||||
pop eax
|
||||
pop eax
|
||||
|
||||
} // end of __asm block
|
||||
|
||||
bochs_out_string("TMN: Back from _main ?! Let's crash!\n");
|
||||
|
||||
KeBugCheck(0);
|
||||
|
||||
for (;;)
|
||||
; /*forever */
|
||||
}
|
||||
|
||||
|
||||
void initialize_page_directory(void)
|
||||
{
|
||||
/*
|
||||
* Initialize the page directory
|
||||
*/
|
||||
|
||||
// First convert the pointers from the virtual address the compiler generated
|
||||
// code thinks we are at, to the currently active physical address we actually
|
||||
// got loaded into by the loader. At this point we have been relocated, so
|
||||
// that there is a 1:1 mapping between KERNEL_BASE+n and TARGET_LOAD_ADDR+n.
|
||||
|
||||
kernel_page_t** startup_pagedirectory = startup_pagedirectory_holder;
|
||||
kernel_page_t** lowmem_pagetable = lowmem_pagetable_holder;
|
||||
kernel_page_t** kernel_pagetable = kernel_pagetable_holder;
|
||||
__int32* kpcr_pagetable = kpcr_pagetable_holder;
|
||||
|
||||
bochs_out_string("startup_pagedirectory before reloc: ");
|
||||
bochs_dump_hex((DWORD)startup_pagedirectory);
|
||||
|
||||
startup_pagedirectory = (kernel_page_t**)relocate_pointer_log_to_phys(startup_pagedirectory);
|
||||
lowmem_pagetable = (kernel_page_t**)relocate_pointer_log_to_phys(lowmem_pagetable);
|
||||
kernel_pagetable = (kernel_page_t**)relocate_pointer_log_to_phys(kernel_pagetable);
|
||||
kpcr_pagetable = (__int32*) relocate_pointer_log_to_phys(kpcr_pagetable);
|
||||
|
||||
bochs_out_string("startup_pagedirectory after reloc : ");
|
||||
bochs_dump_hex((DWORD)startup_pagedirectory);
|
||||
|
||||
// Now align the pointers to PAGE_SIZE...
|
||||
startup_pagedirectory = (kernel_page_t**)(((ULONG_PTR)startup_pagedirectory + 4095) & ~4095);
|
||||
lowmem_pagetable = (kernel_page_t**)(((ULONG_PTR)lowmem_pagetable + 4095) & ~4095);
|
||||
kernel_pagetable = (kernel_page_t**)(((ULONG_PTR)kernel_pagetable + 4095) & ~4095);
|
||||
kpcr_pagetable = (__int32* ) (((ULONG_PTR)kpcr_pagetable + 4095) & ~4095);
|
||||
|
||||
#ifdef _DEBUG
|
||||
bochs_out_string("startup_pagedirectory aligned : ");
|
||||
bochs_dump_hex((DWORD)startup_pagedirectory);
|
||||
#endif
|
||||
|
||||
// Ugly macros, I know...
|
||||
#define DEST(PAGE) startup_pagedirectory[(PAGE) + 0xc00 / 4]
|
||||
#define SRC(PAGE) (kernel_page_t*)((char*)kernel_pagetable + (PAGE)*4096 + 0x7)
|
||||
|
||||
startup_pagedirectory[0] = (kernel_page_t*)((char*)lowmem_pagetable + 0x7);
|
||||
|
||||
{
|
||||
unsigned int i;
|
||||
for (i=0; i<32; ++i)
|
||||
{
|
||||
DEST(i) = SRC(i);
|
||||
}
|
||||
}
|
||||
|
||||
DEST( 64) = (kernel_page_t*)((char*)lowmem_pagetable + 0x7);
|
||||
DEST(192) = (kernel_page_t*)((char*)startup_pagedirectory + 0x7);
|
||||
#ifdef MP
|
||||
DEST(251) = (kernel_page_t*)((char*)apic_pagetable + 0x7);
|
||||
#endif /* MP */
|
||||
DEST(252) = (kernel_page_t*)((char*)kpcr_pagetable + 0x7);
|
||||
|
||||
|
||||
{
|
||||
unsigned int i;
|
||||
/* Initialize the page table that maps low memory */
|
||||
for (i=0; i<1024; ++i) {
|
||||
lowmem_pagetable[i] = (kernel_page_t*)(i*4096 + 7);
|
||||
}
|
||||
|
||||
/* Initialize the page table that maps kernel memory */
|
||||
for (i=0; i<6144/4 /* 1536 pages = 6MB */; ++i) {
|
||||
kernel_pagetable[i] = (kernel_page_t*)(i*4096 + TARGET_LOAD_ADDR + 0x7);
|
||||
}
|
||||
|
||||
/* Initialize the page table that maps the initial KPCR (at FF000000) */
|
||||
kpcr_pagetable[0] = 0x1007;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the PDBR
|
||||
*/
|
||||
__asm mov eax, startup_pagedirectory
|
||||
__asm mov cr3, eax
|
||||
}
|
||||
|
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
||||
*
|
||||
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* FILE: ntoskrnl/ke/i386/vm86_sup.S
|
||||
* PURPOSE: V86 mode support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* Created 09/10/00
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <internal/v86m.h>
|
||||
#include <ntos/tss.h>
|
||||
//#include <ntos/service.h>
|
||||
#include <internal/trap.h>
|
||||
#include <internal/ps.h>
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/i386/segment.h>
|
||||
|
||||
|
||||
void KeReturnFromSystemCall();
|
||||
|
||||
/*
|
||||
* FUNCTION: KeStackSwitchAndRet
|
||||
* PURPOSE: Switch to a new stack and return from the first frame on
|
||||
* the new stack which was assumed to a stdcall function with
|
||||
* 8 bytes of arguments and which saved edi, esi and ebx.
|
||||
*/
|
||||
__declspec(naked)
|
||||
VOID STDCALL
|
||||
KeStackSwitchAndRet(PVOID NewStack)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
cli
|
||||
|
||||
mov esp, NewStack
|
||||
|
||||
sti
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
pop ebp
|
||||
ret 8
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
VOID STDCALL
|
||||
KePushAndStackSwitchAndSysRet(ULONG Push, PVOID NewStack)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
cli
|
||||
|
||||
push 8[ebp]
|
||||
|
||||
mov ebx, fs:KPCR_CURRENT_THREAD
|
||||
mov KTHREAD_CALLBACK_STACK[ebx], esp
|
||||
mov esp, 12[ebp]
|
||||
|
||||
sti
|
||||
|
||||
push 0
|
||||
call KeLowerIrql
|
||||
|
||||
jmp KeReturnFromSystemCall
|
||||
}
|
||||
}
|
@@ -1,325 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
||||
*
|
||||
* Converted to MSVC-compatible inline assembler by Mike Nordell, 2003.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* FILE: MSVC6/ntoskrnl/ke_i386_syscall.c
|
||||
* based on ntoskrnl/ke/i386/syscall.s
|
||||
* PURPOSE: syscall dispatching and support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* Created 09/10/00
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <internal/v86m.h>
|
||||
#include <ntos/tss.h>
|
||||
//#include <ntos/service.h>
|
||||
#include <internal/trap.h>
|
||||
#include <internal/ps.h>
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/i386/segment.h>
|
||||
|
||||
|
||||
#define KernelMode (0)
|
||||
#define UserMode (1)
|
||||
|
||||
|
||||
// TMN: Replicated here to reduce mess-time
|
||||
#ifdef STATUS_INVALID_SYSTEM_SERVICE
|
||||
#undef STATUS_INVALID_SYSTEM_SERVICE
|
||||
#endif
|
||||
#define STATUS_INVALID_SYSTEM_SERVICE 0xc000001c
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
void KiServiceCheck (ULONG Nr);
|
||||
ULONG KiAfterSystemCallHook(ULONG NtStatus, PKTRAP_FRAME TrapFrame);
|
||||
VOID KiSystemCallHook(ULONG Nr, ...);
|
||||
|
||||
void KeReturnFromSystemCallWithHook();
|
||||
void KeReturnFromSystemCall();
|
||||
|
||||
|
||||
__declspec(naked)
|
||||
void interrupt_handler2e(void)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/* Construct a trap frame on the stack */
|
||||
|
||||
/* Error code */
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
push fs
|
||||
/* Load PCR selector into fs */
|
||||
mov ebx, PCR_SELECTOR
|
||||
mov fs, bx
|
||||
|
||||
/* Save the old exception list */
|
||||
mov ebx, fs:KPCR_EXCEPTION_LIST
|
||||
push ebx
|
||||
/* Set the exception handler chain terminator */
|
||||
mov dword ptr fs:KPCR_EXCEPTION_LIST, 0xffffffff
|
||||
/* Get a pointer to the current thread */
|
||||
mov esi, fs:KPCR_CURRENT_THREAD
|
||||
/* Save the old previous mode */
|
||||
xor ebx,ebx
|
||||
mov bl, ss:KTHREAD_PREVIOUS_MODE[esi]
|
||||
push ebx
|
||||
/* Set the new previous mode based on the saved CS selector */
|
||||
mov ebx, 0x24[esp]
|
||||
and ebx, 0x0000FFFF
|
||||
cmp ebx, KERNEL_CS
|
||||
#if 0
|
||||
// TODO: Verify implementation change and use this code path
|
||||
// to remove two conditional jumps.
|
||||
setnz bl
|
||||
mov ss:KTHREAD_PREVIOUS_MODE[esi], bl
|
||||
#else
|
||||
jne L1
|
||||
mov ss:KTHREAD_PREVIOUS_MODE[esi], KernelMode
|
||||
jmp L3
|
||||
L1:
|
||||
mov ss:KTHREAD_PREVIOUS_MODE[esi], UserMode
|
||||
L3:
|
||||
|
||||
#endif
|
||||
/* Save other registers */
|
||||
push eax
|
||||
push ecx
|
||||
push edx
|
||||
push ds
|
||||
push es
|
||||
push gs
|
||||
push 0 /* DR7 */
|
||||
push 0 /* DR6 */
|
||||
push 0 /* DR3 */
|
||||
push 0 /* DR2 */
|
||||
push 0 /* DR1 */
|
||||
push 0 /* DR0 */
|
||||
push 0 /* XXX: TempESP */
|
||||
push 0 /* XXX: TempCS */
|
||||
push 0 /* XXX: DebugPointer */
|
||||
push 0 /* XXX: DebugArgMark */
|
||||
mov ebx, 0x60[esp]
|
||||
push ebx /* DebugEIP */
|
||||
push ebp /* DebugEBP */
|
||||
|
||||
/* Load the segment registers */
|
||||
mov bx, KERNEL_DS
|
||||
mov ds, bx
|
||||
mov es, bx
|
||||
mov gs, bx
|
||||
|
||||
/*
|
||||
* Save the old trap frame pointer over where we would save the EDX
|
||||
* register.
|
||||
*/
|
||||
mov ebx, KTHREAD_TRAP_FRAME[esi]
|
||||
mov 0x3C[esp], ebx
|
||||
|
||||
/* Save a pointer to the trap frame in the TCB */
|
||||
mov KTHREAD_TRAP_FRAME[esi], esp
|
||||
|
||||
/* Set ES to kernel segment */
|
||||
mov bx, KERNEL_DS
|
||||
mov es, bx
|
||||
|
||||
/* Allocate new Kernel stack frame */
|
||||
mov ebp, esp
|
||||
|
||||
/* Users's current stack frame pointer is source */
|
||||
mov esi, edx
|
||||
|
||||
/* Determine system service table to use */
|
||||
cmp eax, 0x0fff
|
||||
ja new_useShadowTable
|
||||
|
||||
/* Check to see if EAX is valid/inrange */
|
||||
cmp eax, es:KeServiceDescriptorTable + 8
|
||||
jbe new_serviceInRange
|
||||
mov eax, STATUS_INVALID_SYSTEM_SERVICE
|
||||
jmp KeReturnFromSystemCall
|
||||
|
||||
new_serviceInRange:
|
||||
|
||||
/* Allocate room for argument list from kernel stack */
|
||||
mov ecx, es:KeServiceDescriptorTable + 12
|
||||
mov ecx, es:[ecx + eax * 4]
|
||||
sub esp, ecx
|
||||
|
||||
/* Copy the arguments from the user stack to the kernel stack */
|
||||
mov edi, esp
|
||||
cld
|
||||
repe movsb
|
||||
|
||||
/* DS is now also kernel segment */
|
||||
mov ds, bx
|
||||
|
||||
/* Call system call hook */
|
||||
push eax
|
||||
call KiSystemCallHook
|
||||
pop eax
|
||||
|
||||
/* Make the system service call */
|
||||
mov ecx, es:KeServiceDescriptorTable
|
||||
mov eax, es:[ecx + eax * 4]
|
||||
call eax
|
||||
|
||||
#if CHECKED
|
||||
/* Bump Service Counter */
|
||||
#endif
|
||||
|
||||
/* Deallocate the kernel stack frame */
|
||||
mov esp, ebp
|
||||
|
||||
/* Call the post system call hook and deliver any pending APCs */
|
||||
push ebp
|
||||
push eax
|
||||
call KiAfterSystemCallHook
|
||||
add esp, 8
|
||||
|
||||
jmp KeReturnFromSystemCall
|
||||
|
||||
new_useShadowTable:
|
||||
|
||||
sub eax, 0x1000
|
||||
|
||||
/* Check to see if EAX is valid/inrange */
|
||||
cmp eax, es:KeServiceDescriptorTableShadow + 24
|
||||
jbe new_shadowServiceInRange
|
||||
mov eax, STATUS_INVALID_SYSTEM_SERVICE
|
||||
jmp KeReturnFromSystemCall
|
||||
|
||||
new_shadowServiceInRange:
|
||||
|
||||
/* Allocate room for argument list from kernel stack */
|
||||
mov ecx, es:KeServiceDescriptorTableShadow + 28
|
||||
mov ecx, es:[ecx + eax * 4]
|
||||
sub esp, ecx
|
||||
|
||||
/* Copy the arguments from the user stack to the kernel stack */
|
||||
mov edi, esp
|
||||
cld
|
||||
repe movsb
|
||||
|
||||
/* DS is now also kernel segment */
|
||||
mov ds, bx
|
||||
|
||||
/* Call system call hook */
|
||||
// pushl %eax
|
||||
// call _KiSystemCallHook
|
||||
// popl %eax
|
||||
|
||||
/* Call service check routine */
|
||||
push eax
|
||||
call KiServiceCheck
|
||||
pop eax
|
||||
|
||||
/* Make the system service call */
|
||||
mov ecx, es:KeServiceDescriptorTableShadow + 16
|
||||
mov eax, es:[ecx + eax * 4]
|
||||
call eax
|
||||
|
||||
#if CHECKED
|
||||
/* Bump Service Counter */
|
||||
#endif
|
||||
|
||||
/* Deallocate the kernel stack frame */
|
||||
mov esp, ebp
|
||||
|
||||
// TMN: Added, to be able to separate this into different functions
|
||||
jmp KeReturnFromSystemCallWithHook
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KeReturnFromSystemCallWithHook()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/* Call the post system call hook and deliver any pending APCs */
|
||||
push esp
|
||||
push eax
|
||||
call KiAfterSystemCallHook
|
||||
add esp, 8
|
||||
|
||||
// TMN: Added, to be able to separate this into different functions
|
||||
jmp KeReturnFromSystemCall
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KeReturnFromSystemCall()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/* Restore the user context */
|
||||
/* Get a pointer to the current thread */
|
||||
mov esi, fs:0x124
|
||||
|
||||
/* Restore the old trap frame pointer */
|
||||
mov ebx, 0x3c[esp]
|
||||
mov KTHREAD_TRAP_FRAME[esi], ebx
|
||||
|
||||
/* Skip debug information and unsaved registers */
|
||||
add esp, 0x30
|
||||
pop gs
|
||||
pop es
|
||||
pop ds
|
||||
pop edx
|
||||
pop ecx
|
||||
add esp, 4 /* Don't restore eax */
|
||||
|
||||
/* Restore the old previous mode */
|
||||
pop ebx
|
||||
mov ss:KTHREAD_PREVIOUS_MODE[esi], bl
|
||||
|
||||
/* Restore the old exception handler list */
|
||||
pop ebx
|
||||
mov fs:KPCR_EXCEPTION_LIST, ebx
|
||||
|
||||
pop fs
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
add esp, 4 /* Ignore error code */
|
||||
|
||||
iretd
|
||||
}
|
||||
}
|
@@ -1,468 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
||||
*
|
||||
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* FILE: ntoskrnl/ke/i386/vm86_sup.S
|
||||
* PURPOSE: V86 mode support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* Created 09/10/00
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <internal/v86m.h>
|
||||
#include <ntos/tss.h>
|
||||
#include <internal/trap.h>
|
||||
#include <internal/ps.h>
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/i386/segment.h>
|
||||
|
||||
|
||||
void KiV86Complete(void);
|
||||
void KiTrapHandler(void);
|
||||
void KiDoubleFaultHandler(void);
|
||||
|
||||
extern int KiPcrInitDone;
|
||||
|
||||
/*
|
||||
* Epilog for exception handlers
|
||||
*/
|
||||
__declspec(naked)
|
||||
void KiTrapEpilog()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
cmp eax, 1 /* Check for v86 recovery */
|
||||
jne _KiTrapRet
|
||||
jmp KiV86Complete
|
||||
_KiTrapRet:
|
||||
/* Skip debug information and unsaved registers */
|
||||
add esp, 0x30
|
||||
pop gs
|
||||
pop es
|
||||
pop ds
|
||||
pop edx
|
||||
pop ecx
|
||||
pop eax
|
||||
|
||||
/* Restore the old previous mode */
|
||||
pop ebx
|
||||
mov ss:KTHREAD_PREVIOUS_MODE[esi], bl
|
||||
|
||||
/* Restore the old exception handler list */
|
||||
pop ebx
|
||||
mov fs:KPCR_EXCEPTION_LIST, ebx
|
||||
|
||||
pop fs
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
add esp, 4 /* Ignore error code */
|
||||
|
||||
iretd
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrapProlog()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push edi
|
||||
push fs
|
||||
|
||||
/*
|
||||
* Check that the PCR exists, very early in the boot process it may
|
||||
* not
|
||||
*/
|
||||
cmp ss:KiPcrInitDone, 0
|
||||
je L5_
|
||||
|
||||
/* Load the PCR selector into fs */
|
||||
mov ebx, PCR_SELECTOR
|
||||
mov fs, bx
|
||||
|
||||
/* Save the old exception list */
|
||||
mov ebx, fs:KPCR_EXCEPTION_LIST
|
||||
push ebx
|
||||
|
||||
/* Put the exception handler chain terminator */
|
||||
mov dword ptr fs:KPCR_EXCEPTION_LIST, 0xffffffff
|
||||
|
||||
/* Get a pointer to the current thread */
|
||||
mov edi, fs:KPCR_CURRENT_THREAD
|
||||
|
||||
/* The current thread may be NULL early in the boot process */
|
||||
cmp edi, 0
|
||||
je L4_
|
||||
|
||||
/* Save the old previous mode */
|
||||
xor ebx, ebx
|
||||
mov bl, ss:KTHREAD_PREVIOUS_MODE[edi]
|
||||
push ebx
|
||||
|
||||
/* Set the new previous mode based on the saved CS selector */
|
||||
mov ebx, 0x24[esp]
|
||||
and ebx, 0x0000FFFF
|
||||
cmp ebx, KERNEL_CS
|
||||
jne L1_
|
||||
mov ss:KTHREAD_PREVIOUS_MODE[edi], KernelMode
|
||||
jmp L3_
|
||||
L1_:
|
||||
mov ss:KTHREAD_PREVIOUS_MODE[edi], UserMode
|
||||
L3_:
|
||||
|
||||
/* Save other registers */
|
||||
push eax
|
||||
push ecx
|
||||
push edx
|
||||
push ds
|
||||
push es
|
||||
push gs
|
||||
push 0 /* DR7 */
|
||||
push 0 /* DR6 */
|
||||
push 0 /* DR3 */
|
||||
push 0 /* DR2 */
|
||||
push 0 /* DR1 */
|
||||
push 0 /* DR0 */
|
||||
push 0 /* XXX: TempESP */
|
||||
push 0 /* XXX: TempCS */
|
||||
push 0 /* XXX: DebugPointer */
|
||||
push 0 /* XXX: DebugArgMark */
|
||||
mov ebx, 0x60[esp]
|
||||
push ebx /* XXX: DebugEIP */
|
||||
push ebp /* XXX: DebugEBP */
|
||||
|
||||
/* Load the segment registers */
|
||||
mov ebx, KERNEL_DS
|
||||
mov ds, bx
|
||||
mov es, bx
|
||||
mov gs, bx
|
||||
|
||||
/* Set ES to kernel segment */
|
||||
mov bx, KERNEL_DS
|
||||
mov es, bx
|
||||
|
||||
mov ebx, esp
|
||||
mov ebp, esp
|
||||
|
||||
/* Save the old trap frame. */
|
||||
cmp edi, 0
|
||||
je L7_
|
||||
mov edx, ss:KTHREAD_TRAP_FRAME[edi]
|
||||
push edx
|
||||
jmp L8_
|
||||
L7_:
|
||||
push 0
|
||||
L8_:
|
||||
|
||||
/* Save a pointer to the trap frame in the current KTHREAD */
|
||||
cmp edi, 0
|
||||
je L6_
|
||||
mov ss:KTHREAD_TRAP_FRAME[edi], ebx
|
||||
L6_:
|
||||
|
||||
/* Call the C exception handler */
|
||||
push esi
|
||||
push ebx
|
||||
call KiTrapHandler
|
||||
add esp, 8
|
||||
|
||||
/* Get a pointer to the current thread */
|
||||
mov esi, fs:KPCR_CURRENT_THREAD
|
||||
|
||||
/* Restore the old trap frame pointer */
|
||||
pop ebx
|
||||
mov KTHREAD_TRAP_FRAME[esi], ebx
|
||||
|
||||
/* Return to the caller */
|
||||
jmp KiTrapEpilog
|
||||
|
||||
/* Handle the no-pcr case out of line */
|
||||
L5_:
|
||||
push 0
|
||||
|
||||
/* Handle the no-thread case out of line */
|
||||
L4_:
|
||||
push 0
|
||||
jmp L3_
|
||||
|
||||
} // end of __asm block
|
||||
}
|
||||
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap0()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/* No error code */
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 0
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap1()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/* No error code */
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 1
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap2()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 2
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap3()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 3
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap4()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 4
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap5()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 5
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap6()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 6
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap7()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 7
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap8()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
call KiDoubleFaultHandler
|
||||
iretd
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap9()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 9
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap10()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 10
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap11()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 11
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap12()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 12
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap13()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 13
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap14()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 14
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap15()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 15
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrap16()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 16
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiTrapUnknown()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push 0
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi, 255
|
||||
jmp KiTrapProlog
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
@@ -1,217 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
||||
*
|
||||
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* FILE: ntoskrnl/ke/i386/vm86_sup.S
|
||||
* PURPOSE: V86 mode support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* Created 09/10/00
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <internal/v86m.h>
|
||||
#include <ntos/tss.h>
|
||||
//#include <ntos/service.h>
|
||||
#include <internal/trap.h>
|
||||
#include <internal/ps.h>
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/i386/segment.h>
|
||||
|
||||
|
||||
extern KSPIN_LOCK PiThreadListLock;
|
||||
extern ULONG PiNrThreadsAwaitingReaping;
|
||||
extern ULONG MmGlobalKernelPageDirectory[1024];
|
||||
|
||||
VOID STDCALL PiWakeupReaperThread(VOID);
|
||||
VOID KeSetBaseGdtSelector(ULONG Entry, PVOID Base);
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTIONS: Switches to another thread's context
|
||||
* ARGUMENTS:
|
||||
* Thread = Thread to switch to
|
||||
* OldThread = Thread to switch from
|
||||
*/
|
||||
__declspec(naked)
|
||||
VOID
|
||||
Ki386ContextSwitch(struct _KTHREAD* NewThread, struct _KTHREAD* OldThread)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
/* Save callee save registers. */
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
cli /* This is a critical section for this processor. */
|
||||
|
||||
/* Get the pointer to the new thread. */
|
||||
mov ebx, NewThread
|
||||
|
||||
/*
|
||||
* Set the base of the TEB selector to the base of the TEB for
|
||||
* this thread.
|
||||
*/
|
||||
push ebx
|
||||
push KTHREAD_TEB[ebx]
|
||||
push TEB_SELECTOR
|
||||
call KeSetBaseGdtSelector
|
||||
add esp, 8
|
||||
pop ebx
|
||||
|
||||
/*
|
||||
* Load the PCR selector.
|
||||
*/
|
||||
mov eax, PCR_SELECTOR
|
||||
mov fs, ax
|
||||
|
||||
/*
|
||||
* Set the current thread information in the PCR.
|
||||
*/
|
||||
mov fs:KPCR_CURRENT_THREAD, ebx
|
||||
|
||||
/*
|
||||
* Set the current LDT
|
||||
*/
|
||||
xor eax, eax
|
||||
mov edi, ETHREAD_THREADS_PROCESS[ebx]
|
||||
test word ptr KPROCESS_LDT_DESCRIPTOR0[edi], 0xFFFF
|
||||
jz L4
|
||||
|
||||
push KPROCESS_LDT_DESCRIPTOR1[edi]
|
||||
push KPROCESS_LDT_DESCRIPTOR0[edi]
|
||||
push LDT_SELECTOR
|
||||
call KeSetGdtSelector
|
||||
add esp, 12
|
||||
|
||||
mov eax, LDT_SELECTOR
|
||||
|
||||
L4:
|
||||
lldt ax
|
||||
|
||||
/*
|
||||
* Load up the iomap offset for this thread in
|
||||
* preparation for setting it below.
|
||||
*/
|
||||
mov eax, KPROCESS_IOPM_OFFSET[edi]
|
||||
|
||||
/*
|
||||
* FIXME: Save debugging state.
|
||||
*/
|
||||
|
||||
/*
|
||||
* FIXME: Save floating point state.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Switch stacks
|
||||
*/
|
||||
mov ebx, 12[ebp]
|
||||
mov KTHREAD_KERNEL_STACK[ebx], esp
|
||||
mov ebx, 8[ebp]
|
||||
mov esp, KTHREAD_KERNEL_STACK[ebx]
|
||||
mov edi, KTHREAD_STACK_LIMIT[ebx]
|
||||
|
||||
/*
|
||||
* Set the stack pointer in this processors TSS
|
||||
*/
|
||||
mov esi, fs:KPCR_TSS
|
||||
|
||||
/*
|
||||
* Set current IOPM offset in the TSS
|
||||
*/
|
||||
mov KTSS_IOMAPBASE[esi], ax
|
||||
|
||||
mov eax, KTHREAD_INITIAL_STACK[ebx]
|
||||
mov KTSS_ESP0[esi], eax
|
||||
|
||||
/*
|
||||
* Change the address space
|
||||
*/
|
||||
mov ebx, ETHREAD_THREADS_PROCESS[ebx]
|
||||
mov eax, KPROCESS_DIRECTORY_TABLE_BASE[ebx]
|
||||
mov cr3, eax
|
||||
|
||||
/*
|
||||
* Set up the PDE for the top of the new stack.
|
||||
*/
|
||||
mov ebx, 0
|
||||
L2:
|
||||
mov esi, edi
|
||||
shr esi, 22
|
||||
mov eax, 0xF03C0000[esi*4]
|
||||
cmp eax, 0
|
||||
jne L1
|
||||
mov eax, MmGlobalKernelPageDirectory[esi*4]
|
||||
mov 0xF03C0000[esi*4], eax
|
||||
L1:
|
||||
add edi, 4096
|
||||
inc ebx
|
||||
cmp ebx, (MM_STACK_SIZE / 4096)
|
||||
jl L2
|
||||
|
||||
/*
|
||||
* FIXME: Restore floating point state
|
||||
*/
|
||||
|
||||
/*
|
||||
* FIXME: Restore debugging state
|
||||
*/
|
||||
|
||||
/*
|
||||
* Exit the critical section
|
||||
*/
|
||||
sti
|
||||
}
|
||||
|
||||
KeReleaseSpinLockFromDpcLevel(&PiThreadListLock);
|
||||
|
||||
if (PiNrThreadsAwaitingReaping) {
|
||||
PiWakeupReaperThread();
|
||||
}
|
||||
|
||||
__asm
|
||||
{
|
||||
/*
|
||||
* Restore the saved register and exit
|
||||
*/
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
pop ebp
|
||||
ret
|
||||
}
|
||||
}
|
@@ -1,256 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
||||
*
|
||||
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-25
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* FILE: ntoskrnl/ke/i386/vm86_sup.S
|
||||
* PURPOSE: V86 mode support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* Created 09/10/00
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <internal/v86m.h>
|
||||
#include <ntos/tss.h>
|
||||
#include <internal/trap.h>
|
||||
#include <internal/ps.h>
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/ps.h>
|
||||
|
||||
|
||||
// Taken from ntoskrnl/include/internal/v86m.h, since that one must be fixed
|
||||
// a bit before it could be used from here.
|
||||
#define KV86M_REGISTERS_EBP (0x0)
|
||||
#define KV86M_REGISTERS_EDI (0x4)
|
||||
#define KV86M_REGISTERS_ESI (0x8)
|
||||
#define KV86M_REGISTERS_EDX (0xC)
|
||||
#define KV86M_REGISTERS_ECX (0x10)
|
||||
#define KV86M_REGISTERS_EBX (0x14)
|
||||
#define KV86M_REGISTERS_EAX (0x18)
|
||||
#define KV86M_REGISTERS_DS (0x1C)
|
||||
#define KV86M_REGISTERS_ES (0x20)
|
||||
#define KV86M_REGISTERS_FS (0x24)
|
||||
#define KV86M_REGISTERS_GS (0x28)
|
||||
#define KV86M_REGISTERS_EIP (0x2C)
|
||||
#define KV86M_REGISTERS_CS (0x30)
|
||||
#define KV86M_REGISTERS_EFLAGS (0x34)
|
||||
#define KV86M_REGISTERS_ESP (0x38)
|
||||
#define KV86M_REGISTERS_SS (0x3C)
|
||||
|
||||
|
||||
void KiV86Complete();
|
||||
|
||||
|
||||
/*
|
||||
* Starts in v86 mode with the registers set to the
|
||||
* specified values.
|
||||
*/
|
||||
|
||||
__declspec(naked)
|
||||
VOID Ki386RetToV86Mode(KV86M_REGISTERS* InRegs,
|
||||
KV86M_REGISTERS* OutRegs)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/*
|
||||
* Setup a stack frame
|
||||
*/
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
pushad /* Save registers */
|
||||
|
||||
mov ebx, InRegs
|
||||
|
||||
/*
|
||||
* Save ebp
|
||||
*/
|
||||
push ebp
|
||||
|
||||
/*
|
||||
* Save a pointer to IN_REGS which the v86m exception handler will
|
||||
* use to handle exceptions
|
||||
*/
|
||||
push ebx
|
||||
|
||||
/*
|
||||
* Since we are going to fiddle with the stack pointer this must be
|
||||
* a critical section for this processor
|
||||
*/
|
||||
|
||||
/*
|
||||
* Save the old initial stack
|
||||
*/
|
||||
mov esi, fs:KPCR_CURRENT_THREAD
|
||||
mov edi, KTHREAD_INITIAL_STACK[esi]
|
||||
push edi
|
||||
|
||||
/*
|
||||
* We also need to set the stack in the kthread structure
|
||||
*/
|
||||
mov KTHREAD_INITIAL_STACK[esi], esp
|
||||
|
||||
/*
|
||||
* The stack used for handling exceptions from v86 mode in this thread
|
||||
* will be the current stack adjusted so we don't overwrite the
|
||||
* existing stack frames
|
||||
*/
|
||||
mov esi, fs:KPCR_TSS
|
||||
mov KTSS_ESP0[esi], esp
|
||||
|
||||
/*
|
||||
* Create the stack frame for an iret to v86 mode
|
||||
*/
|
||||
push KV86M_REGISTERS_GS[ebx]
|
||||
push KV86M_REGISTERS_FS[ebx]
|
||||
push KV86M_REGISTERS_DS[ebx]
|
||||
push KV86M_REGISTERS_ES[ebx]
|
||||
push KV86M_REGISTERS_SS[ebx]
|
||||
push KV86M_REGISTERS_ESP[ebx]
|
||||
push KV86M_REGISTERS_EFLAGS[ebx]
|
||||
push KV86M_REGISTERS_CS[ebx]
|
||||
push KV86M_REGISTERS_EIP[ebx]
|
||||
|
||||
/*
|
||||
* Setup the CPU registers
|
||||
*/
|
||||
mov eax, KV86M_REGISTERS_EAX[ebx]
|
||||
mov ecx, KV86M_REGISTERS_ECX[ebx]
|
||||
mov edx, KV86M_REGISTERS_EDX[ebx]
|
||||
mov esi, KV86M_REGISTERS_ESI[ebx]
|
||||
mov edi, KV86M_REGISTERS_EDI[ebx]
|
||||
mov ebp, KV86M_REGISTERS_EBP[ebx]
|
||||
mov ebx, KV86M_REGISTERS_EBX[ebx]
|
||||
|
||||
/*
|
||||
* Go to v86 mode
|
||||
*/
|
||||
iretd
|
||||
|
||||
/*
|
||||
* Handle the completion of a vm86 routine. We are called from
|
||||
* an exception handler with the registers at the point of the
|
||||
* exception on the stack.
|
||||
*/
|
||||
|
||||
jmp KiV86Complete // TMN: Function-splitting
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void KiV86Complete()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/* Restore the original ebp */
|
||||
mov ebp, TF_ORIG_EBP[esp]
|
||||
|
||||
/* Get a pointer to the OUT_REGS structure */
|
||||
mov ebx, 12[ebp] // OutRegs
|
||||
|
||||
/* Skip debug information and unsaved registers */
|
||||
add esp, 0x30
|
||||
|
||||
/* Ignore 32-bit segment registers */
|
||||
add esp, 12
|
||||
|
||||
/* Save the vm86 registers into the OUT_REGS structure */
|
||||
pop dword ptr KV86M_REGISTERS_EDX[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_ECX[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_EAX[ebx]
|
||||
|
||||
/* Restore the old previous mode */
|
||||
pop eax
|
||||
mov ss:KTHREAD_PREVIOUS_MODE[esi], al
|
||||
|
||||
/* Restore the old exception handler list */
|
||||
pop eax
|
||||
mov fs:KPCR_EXCEPTION_LIST, eax
|
||||
|
||||
/* Ignore the 32-bit fs register */
|
||||
add esp, 4
|
||||
|
||||
pop dword ptr KV86M_REGISTERS_EDI[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_ESI[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_EBX[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_EBP[ebx]
|
||||
|
||||
/* Ignore error code */
|
||||
add esp, 4
|
||||
|
||||
pop dword ptr KV86M_REGISTERS_EIP[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_CS[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_EFLAGS[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_ESP[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_SS[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_ES[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_DS[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_FS[ebx]
|
||||
pop dword ptr KV86M_REGISTERS_GS[ebx]
|
||||
|
||||
/*
|
||||
* We are going to fiddle with the stack so this must be a critical
|
||||
* section for this process
|
||||
*/
|
||||
cli
|
||||
|
||||
/*
|
||||
* Restore the initial stack
|
||||
*/
|
||||
pop eax
|
||||
mov esi, fs:KPCR_TSS
|
||||
mov KTSS_ESP0[esi], eax
|
||||
|
||||
/*
|
||||
* We also need to set the stack in the kthread structure
|
||||
*/
|
||||
mov esi, fs:KPCR_CURRENT_THREAD
|
||||
mov edi, KTHREAD_INITIAL_STACK[esi]
|
||||
mov KTHREAD_INITIAL_STACK[esi], eax
|
||||
|
||||
/* Exit the critical section */
|
||||
sti
|
||||
|
||||
/* Ignore IN_REGS pointer */
|
||||
add esp, 4
|
||||
|
||||
/* Ignore ebp restored above */
|
||||
add esp, 4
|
||||
|
||||
/* Return to caller */
|
||||
popad
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
} // end of __asm block
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
; This file is vital. It tells the linker how to order some functions
|
||||
; and some data, that unfortunately is assumed to be at low location
|
||||
; and in known order to eachother respectively?
|
||||
|
||||
MultibootStub
|
||||
our_memmove
|
||||
dummy_placeholder
|
||||
NtProcessStartup@4
|
||||
initialize_page_directory
|
||||
relocate_pointer_log_to_phys
|
||||
; Order some data that there is some assumptions about...
|
||||
init_stack
|
||||
init_stack_top
|
||||
trap_stack
|
||||
trap_stack_top
|
@@ -1,126 +0,0 @@
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
|
||||
void MmSafeCopyToUserRestart();
|
||||
void MmSafeCopyToUserUnsafeStart();
|
||||
void MmSafeCopyFromUserUnsafeStart();
|
||||
void MmSafeCopyFromUserRestart();
|
||||
|
||||
/*
|
||||
* NTSTATUS MmSafeCopyFromUser(PVOID Dest, PVOID Src,
|
||||
* ULONG NumberOfBytes)
|
||||
*/
|
||||
__declspec(naked)
|
||||
NTSTATUS MmSafeCopyFromUser(PVOID Dest, const VOID *Src, ULONG Count)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
|
||||
push esi
|
||||
push edi
|
||||
push ecx
|
||||
|
||||
mov edi, 8[ebp]
|
||||
mov esi, 12[ebp]
|
||||
mov ecx, 16[ebp]
|
||||
|
||||
/*
|
||||
* Default return code
|
||||
*/
|
||||
xor eax,eax
|
||||
|
||||
jmp MmSafeCopyFromUserUnsafeStart
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__declspec(naked)
|
||||
void MmSafeCopyFromUserUnsafeStart()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/*
|
||||
* This is really a synthetic instruction since if we incur a
|
||||
* pagefault then eax will be set to an appropiate STATUS code
|
||||
*/
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
jmp MmSafeCopyFromUserRestart
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void MmSafeCopyFromUserRestart()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
pop ecx
|
||||
pop edi
|
||||
pop esi
|
||||
|
||||
pop ebp
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* NTSTATUS MmSafeCopyToUser(PVOID Dest, PVOID Src,
|
||||
* ULONG NumberOfBytes)
|
||||
*/
|
||||
NTSTATUS MmSafeCopyToUser(PVOID Dest, const VOID *Src, ULONG Count)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
mov esp,ebp
|
||||
|
||||
push esi
|
||||
push edi
|
||||
push ecx
|
||||
|
||||
mov edi, 8[ebp]
|
||||
mov esi, 12[ebp]
|
||||
mov ecx, 16[ebp]
|
||||
|
||||
/*
|
||||
* Default return code
|
||||
*/
|
||||
xor eax,eax
|
||||
|
||||
jmp MmSafeCopyToUserUnsafeStart
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void MmSafeCopyToUserUnsafeStart()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
/*
|
||||
* This is really a synthetic instruction since if we incur a
|
||||
* pagefault then eax will be set to an appropiate STATUS code
|
||||
*/
|
||||
cld
|
||||
rep movsb
|
||||
jmp MmSafeCopyToUserRestart
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
void MmSafeCopyToUserRestart()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
pop ecx
|
||||
pop edi
|
||||
pop esi
|
||||
|
||||
pop ebp
|
||||
ret
|
||||
}
|
||||
}
|
@@ -1,574 +0,0 @@
|
||||
/* $Id: mm_mminit_msvc.c,v 1.1 2004/02/06 08:22:01 fireball Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/mminit.c
|
||||
* PURPOSE: kernel memory managment initialization functions
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* Created 9/4/98
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <roscfg.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/mm.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/io.h>
|
||||
#include <internal/ps.h>
|
||||
#include <internal/pool.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* GLOBALS *****************************************************************/
|
||||
|
||||
/*
|
||||
* Size of extended memory (kb) (fixed for now)
|
||||
*/
|
||||
#define EXTENDED_MEMORY_SIZE (3*1024*1024)
|
||||
|
||||
/*
|
||||
* Compiler defined symbols
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#pragma intrinsic(strcmp)
|
||||
|
||||
static PIMAGE_SECTION_HEADER FindSection(const char* szSeg)
|
||||
{
|
||||
PIMAGE_NT_HEADERS NtHeader = RtlImageNtHeader((PVOID)KERNEL_BASE);
|
||||
PIMAGE_SECTION_HEADER Section = IMAGE_FIRST_SECTION(NtHeader);
|
||||
const int count = NtHeader->FileHeader.NumberOfSections;
|
||||
int i;
|
||||
for (i = 0; i < count; ++i, ++Section)
|
||||
{
|
||||
if (!strcmp(szSeg, Section->Name))
|
||||
{
|
||||
return Section;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void* FindSegmentStart(const char* szSeg)
|
||||
{
|
||||
PIMAGE_SECTION_HEADER Section = FindSection(szSeg);
|
||||
if (Section)
|
||||
{
|
||||
return (void*)(KERNEL_BASE + Section->VirtualAddress);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void* FindSegmentEnd(const char* szSeg)
|
||||
{
|
||||
PIMAGE_SECTION_HEADER Section = FindSection(szSeg);
|
||||
if (Section)
|
||||
{
|
||||
return (void*)(KERNEL_BASE + Section->VirtualAddress + Section->Misc.VirtualSize);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
|
||||
static BOOLEAN IsThisAnNtAsSystem = FALSE;
|
||||
static MM_SYSTEM_SIZE MmSystemSize = MmSmallSystem;
|
||||
|
||||
static MEMORY_AREA* kernel_text_desc = NULL;
|
||||
static MEMORY_AREA* kernel_init_desc = NULL;
|
||||
static MEMORY_AREA* kernel_map_desc = NULL;
|
||||
static MEMORY_AREA* kernel_kpcr_desc = NULL;
|
||||
static MEMORY_AREA* kernel_data_desc = NULL;
|
||||
static MEMORY_AREA* kernel_param_desc = NULL;
|
||||
static MEMORY_AREA* kernel_pool_desc = NULL;
|
||||
static MEMORY_AREA* kernel_shared_data_desc = NULL;
|
||||
static MEMORY_AREA* kernel_mapped_low_mem_desc = NULL;
|
||||
static MEMORY_AREA* MiKernelMapDescriptor = NULL;
|
||||
static MEMORY_AREA* MiPagedPoolDescriptor = NULL;
|
||||
|
||||
PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
|
||||
|
||||
PVOID MiNonPagedPoolStart;
|
||||
ULONG MiNonPagedPoolLength;
|
||||
PVOID MiKernelMapStart;
|
||||
ULONG MiKernelMapLength;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOLEAN STDCALL MmIsThisAnNtAsSystem(VOID)
|
||||
{
|
||||
return(IsThisAnNtAsSystem);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
MM_SYSTEM_SIZE STDCALL MmQuerySystemSize(VOID)
|
||||
{
|
||||
return(MmSystemSize);
|
||||
}
|
||||
|
||||
VOID MiShutdownMemoryManager(VOID)
|
||||
{
|
||||
}
|
||||
|
||||
VOID INIT_FUNCTION
|
||||
MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||
ULONG KernelLength)
|
||||
/*
|
||||
* FUNCTION: Intialize the memory areas list
|
||||
* ARGUMENTS:
|
||||
* bp = Pointer to the boot parameters
|
||||
* kernel_len = Length of the kernel
|
||||
*/
|
||||
{
|
||||
PVOID BaseAddress;
|
||||
ULONG Length;
|
||||
ULONG ParamLength = KernelLength;
|
||||
NTSTATUS Status;
|
||||
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||
//ULONG i;
|
||||
|
||||
DPRINT("MmInitVirtualMemory(%x, %x)\n",LastKernelAddress, KernelLength);
|
||||
|
||||
BoundaryAddressMultiple.QuadPart = 0;
|
||||
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
|
||||
|
||||
MmInitMemoryAreas();
|
||||
|
||||
/* Don't change the start of kernel map. Pte's must always exist for this region. */
|
||||
MiKernelMapStart = (char*)LastKernelAddress + PAGE_SIZE;
|
||||
MiKernelMapLength = MM_KERNEL_MAP_SIZE;
|
||||
|
||||
MiNonPagedPoolStart = (char*)MiKernelMapStart + MiKernelMapLength + PAGE_SIZE;
|
||||
MiNonPagedPoolLength = MM_NONPAGED_POOL_SIZE;
|
||||
|
||||
MmPagedPoolBase = (char*)MiNonPagedPoolStart + MiNonPagedPoolLength + PAGE_SIZE;
|
||||
MmPagedPoolSize = MM_PAGED_POOL_SIZE;
|
||||
|
||||
MiInitKernelMap();
|
||||
MiInitializeNonPagedPool();
|
||||
|
||||
/*
|
||||
* Setup the system area descriptor list
|
||||
*/
|
||||
BaseAddress = (PVOID)0xf0000000;
|
||||
MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
0x400000,
|
||||
0,
|
||||
&kernel_map_desc,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
BaseAddress = (PVOID)KPCR_BASE;
|
||||
MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
PAGE_SIZE * MAXIMUM_PROCESSORS,
|
||||
0,
|
||||
&kernel_kpcr_desc,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
BaseAddress = (PVOID)0xd0000000;
|
||||
MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
0x100000,
|
||||
0,
|
||||
&kernel_mapped_low_mem_desc,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
BaseAddress = (PVOID)KERNEL_BASE;
|
||||
Length = PAGE_ROUND_UP(((ULONG)FindSegmentEnd(".text"))) - KERNEL_BASE;
|
||||
ParamLength = ParamLength - Length;
|
||||
|
||||
/*
|
||||
* No need to lock the address space at this point since no
|
||||
* other threads are running.
|
||||
*/
|
||||
MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
Length,
|
||||
0,
|
||||
&kernel_text_desc,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
// TODO: Here we REALLY should iterate the PE's sections and set protection
|
||||
// accordingly for each and every one of them.
|
||||
|
||||
// NOTE This code ONLY works because of the assumption that the .text
|
||||
// segment is the first in the PE, and the .reloc segment is the last.
|
||||
// Link in a way to make this assumtion false, and the kernel won't work.
|
||||
BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)FindSegmentEnd(".text")));
|
||||
Length = PAGE_ROUND_UP(((ULONG)FindSegmentStart(".reloc"))) - (ULONG_PTR)BaseAddress;
|
||||
ParamLength = ParamLength - Length;
|
||||
DPRINT1("Data Length %x\n",Length);
|
||||
DPRINT1("Data BaseAddress %x\n",BaseAddress);
|
||||
|
||||
/*
|
||||
* No need to lock the address space at this point since we are
|
||||
* the only thread running.
|
||||
*/
|
||||
// For GCC-compiled, kernel_data_desc contains:
|
||||
// .data, .edata, .idata, .bss and .rsrc. E.i. all but .text and .reloc
|
||||
MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
Length,
|
||||
0,
|
||||
&kernel_data_desc,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
// BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)FindSegmentEnd(".edata")));
|
||||
BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)FindSegmentStart(".reloc")));
|
||||
Length = LastKernelAddress - (ULONG)BaseAddress;
|
||||
// For GCC-compiled, kernel_param_desc contains .reloc
|
||||
MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
Length,
|
||||
0,
|
||||
&kernel_param_desc,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
BaseAddress = MiNonPagedPoolStart;
|
||||
MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
MiNonPagedPoolLength,
|
||||
0,
|
||||
&kernel_pool_desc,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
BaseAddress = MiKernelMapStart;
|
||||
Status = MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
MiKernelMapLength,
|
||||
0,
|
||||
&MiKernelMapDescriptor,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
BaseAddress = MmPagedPoolBase;
|
||||
Status = MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_PAGED_POOL,
|
||||
&BaseAddress,
|
||||
MmPagedPoolSize,
|
||||
0,
|
||||
&MiPagedPoolDescriptor,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
MmInitializePagedPool();
|
||||
|
||||
/*
|
||||
* Create the kernel mapping of the user/kernel shared memory.
|
||||
*/
|
||||
BaseAddress = (PVOID)KI_USER_SHARED_DATA;
|
||||
Length = PAGE_SIZE;
|
||||
MmCreateMemoryArea(NULL,
|
||||
MmGetKernelAddressSpace(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&BaseAddress,
|
||||
Length,
|
||||
0,
|
||||
&kernel_shared_data_desc,
|
||||
FALSE,
|
||||
FALSE,
|
||||
BoundaryAddressMultiple);
|
||||
|
||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE,
|
||||
&MmSharedDataPagePhysicalAddress);
|
||||
Status = MmCreateVirtualMapping(NULL,
|
||||
(PVOID)KI_USER_SHARED_DATA,
|
||||
PAGE_READWRITE,
|
||||
MmSharedDataPagePhysicalAddress,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Unable to create virtual mapping\n");
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
RtlZeroMemory(BaseAddress, Length);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
|
||||
}
|
||||
|
||||
|
||||
VOID INIT_FUNCTION
|
||||
MmInit1(ULONG FirstKrnlPhysAddr,
|
||||
ULONG LastKrnlPhysAddr,
|
||||
ULONG LastKernelAddress,
|
||||
PADDRESS_RANGE BIOSMemoryMap,
|
||||
ULONG AddressRangeCount,
|
||||
ULONG MaxMem)
|
||||
/*
|
||||
* FUNCTION: Initalize memory managment
|
||||
*/
|
||||
{
|
||||
ULONG i;
|
||||
ULONG kernel_len;
|
||||
#ifndef MP
|
||||
extern unsigned int unmap_me, unmap_me2, unmap_me3;
|
||||
#endif
|
||||
|
||||
DPRINT("MmInit1(FirstKrnlPhysAddr, %x, LastKrnlPhysAddr %x, LastKernelAddress %x)\n",
|
||||
FirstKrnlPhysAddr,
|
||||
LastKrnlPhysAddr,
|
||||
LastKernelAddress);
|
||||
|
||||
|
||||
if ((BIOSMemoryMap != NULL) && (AddressRangeCount > 0))
|
||||
{
|
||||
// If we have a bios memory map, recalulate the memory size
|
||||
ULONG last = 0;
|
||||
for (i = 0; i < AddressRangeCount; i++)
|
||||
{
|
||||
if (BIOSMemoryMap[i].Type == 1
|
||||
&& (BIOSMemoryMap[i].BaseAddrLow + BIOSMemoryMap[i].LengthLow + PAGE_SIZE -1) / PAGE_SIZE > last)
|
||||
{
|
||||
last = (BIOSMemoryMap[i].BaseAddrLow + BIOSMemoryMap[i].LengthLow + PAGE_SIZE -1) / PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
if ((last - 256) * 4 > KeLoaderBlock.MemHigher)
|
||||
{
|
||||
KeLoaderBlock.MemHigher = (last - 256) * 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (KeLoaderBlock.MemHigher >= (MaxMem - 1) * 1024)
|
||||
{
|
||||
KeLoaderBlock.MemHigher = (MaxMem - 1) * 1024;
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: Set this based on the system command line
|
||||
*/
|
||||
MmSystemRangeStart = (PVOID)KERNEL_BASE; // 0xC0000000
|
||||
MmUserProbeAddress = (PVOID)0x7fff0000;
|
||||
MmHighestUserAddress = (PVOID)0x7ffeffff;
|
||||
|
||||
MmInitGlobalKernelPageDirectory();
|
||||
|
||||
/*
|
||||
* Initialize memory managment statistics
|
||||
*/
|
||||
MmStats.NrTotalPages = 0;
|
||||
MmStats.NrSystemPages = 0;
|
||||
MmStats.NrUserPages = 0;
|
||||
MmStats.NrReservedPages = 0;
|
||||
MmStats.NrUserPages = 0;
|
||||
MmStats.NrFreePages = 0;
|
||||
MmStats.NrLockedPages = 0;
|
||||
MmStats.PagingRequestsInLastMinute = 0;
|
||||
MmStats.PagingRequestsInLastFiveMinutes = 0;
|
||||
MmStats.PagingRequestsInLastFifteenMinutes = 0;
|
||||
|
||||
/*
|
||||
* Initialize the kernel address space
|
||||
*/
|
||||
MmInitializeKernelAddressSpace();
|
||||
|
||||
/*
|
||||
* Unmap low memory
|
||||
*/
|
||||
#ifndef MP
|
||||
/* In SMP mode we unmap the low memory in MmInit3.
|
||||
The APIC needs the mapping of the first pages
|
||||
while the processors are starting up. */
|
||||
MmDeletePageTable(NULL, 0);
|
||||
#endif
|
||||
/*
|
||||
* Free all pages not used for kernel memory
|
||||
* (we assume the kernel occupies a continuous range of physical
|
||||
* memory)
|
||||
*/
|
||||
DPRINT("first krnl %x\nlast krnl %x\n",FirstKrnlPhysAddr,
|
||||
LastKrnlPhysAddr);
|
||||
|
||||
/*
|
||||
* Free physical memory not used by the kernel
|
||||
*/
|
||||
MmStats.NrTotalPages = KeLoaderBlock.MemHigher/4;
|
||||
if (!MmStats.NrTotalPages)
|
||||
{
|
||||
DbgPrint("Memory not detected, default to 8 MB\n");
|
||||
MmStats.NrTotalPages = 2048;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add 1MB for standard memory (not extended) */
|
||||
MmStats.NrTotalPages += 256;
|
||||
}
|
||||
#ifdef BIOS_MEM_FIX
|
||||
MmStats.NrTotalPages += 16;
|
||||
#endif
|
||||
DbgPrint("Used memory %dKb\n", (MmStats.NrTotalPages * PAGE_SIZE) / 1024);
|
||||
|
||||
LastKernelAddress = (ULONG)MmInitializePageList((PVOID)FirstKrnlPhysAddr,
|
||||
(PVOID)LastKrnlPhysAddr,
|
||||
MmStats.NrTotalPages,
|
||||
PAGE_ROUND_UP(LastKernelAddress),
|
||||
BIOSMemoryMap,
|
||||
AddressRangeCount);
|
||||
kernel_len = LastKrnlPhysAddr - FirstKrnlPhysAddr;
|
||||
|
||||
/*
|
||||
* Create a trap for null pointer references and protect text
|
||||
* segment
|
||||
*/
|
||||
CHECKPOINT;
|
||||
#if defined(_MSC_VER)
|
||||
DPRINT(".text start: %x, .data start: %x\n",
|
||||
(int)FindSegmentStart(".text"),
|
||||
(int)FindSegmentStart(".data"));
|
||||
|
||||
{
|
||||
const char* pCode = FindSegmentStart(".text");
|
||||
const char* pData = FindSegmentEnd(".text");
|
||||
while (pCode < pData)
|
||||
{
|
||||
MmSetPageProtect(NULL, (PVOID)pCode, PAGE_EXECUTE_READ);
|
||||
pCode += PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
DPRINT("_text_start__ %x _init_end__ %x\n",(int)&_text_start__,(int)&_init_end__);
|
||||
for (i=PAGE_ROUND_DOWN(((int)&_text_start__));
|
||||
i<PAGE_ROUND_UP(((int)&_init_end__));i=i+PAGE_SIZE)
|
||||
{
|
||||
MmSetPageProtect(NULL,
|
||||
(PVOID)i,
|
||||
PAGE_EXECUTE_READ);
|
||||
}
|
||||
#endif
|
||||
|
||||
DPRINT("Invalidating between %x and %x\n",
|
||||
LastKernelAddress, 0xc0600000);
|
||||
for (i=(LastKernelAddress); i<0xc0600000; i+=PAGE_SIZE)
|
||||
{
|
||||
MmRawDeleteVirtualMapping((PVOID)(i));
|
||||
}
|
||||
|
||||
DPRINT("Invalidating between %x and %x\n",
|
||||
0xd0100000, 0xd0400000);
|
||||
for (i=0xd0100000; i<0xd0400000; i+=PAGE_SIZE)
|
||||
{
|
||||
MmRawDeleteVirtualMapping((PVOID)(i));
|
||||
}
|
||||
|
||||
DPRINT("Almost done MmInit()\n");
|
||||
#ifndef MP
|
||||
/* FIXME: This is broken in SMP mode */
|
||||
#if !defined(_MSC_VER) // FIXME: I don't trust using this from MSVC yet!
|
||||
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me, TRUE, NULL, NULL);
|
||||
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me2, TRUE, NULL, NULL);
|
||||
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me3, TRUE, NULL, NULL);
|
||||
#endif // _MSC_VER
|
||||
#endif
|
||||
/*
|
||||
* Intialize memory areas
|
||||
*/
|
||||
MmInitVirtualMemory(LastKernelAddress, kernel_len);
|
||||
|
||||
MmInitializeMdlImplementation();
|
||||
}
|
||||
|
||||
VOID INIT_FUNCTION
|
||||
MmInit2(VOID)
|
||||
{
|
||||
MmInitializeRmapList();
|
||||
MmInitializePageOp();
|
||||
MmInitSectionImplementation();
|
||||
MmInitPagingFile();
|
||||
}
|
||||
|
||||
VOID INIT_FUNCTION
|
||||
MmInit3(VOID)
|
||||
{
|
||||
/*
|
||||
* Unmap low memory
|
||||
*/
|
||||
#ifdef MP
|
||||
/* In SMP mode we can unmap the low memory
|
||||
if all processors are started. */
|
||||
MmDeletePageTable(NULL, 0);
|
||||
#endif
|
||||
MmInitZeroPageThread();
|
||||
MmCreatePhysicalMemorySection();
|
||||
MiInitBalancerThread();
|
||||
|
||||
/*
|
||||
* Initialise the modified page writer.
|
||||
*/
|
||||
MmInitMpwThread();
|
||||
|
||||
/* FIXME: Read parameters from memory */
|
||||
}
|
||||
|
||||
VOID STATIC
|
||||
MiFreeInitMemoryPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry,
|
||||
BOOLEAN Dirty)
|
||||
{
|
||||
assert(SwapEntry == 0);
|
||||
if (PhysAddr.QuadPart != 0)
|
||||
{
|
||||
MmReleasePageMemoryConsumer(MC_NPPOOL, PhysAddr);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
MiFreeInitMemory(VOID)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
DPRINT1("Can not yet free .init memory for MSVC compiled kernel\n");
|
||||
#else
|
||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||
MmFreeMemoryArea(MmGetKernelAddressSpace(),
|
||||
(PVOID)&_init_start__,
|
||||
PAGE_ROUND_UP((ULONG)&_init_end__) - (ULONG)_init_start__,
|
||||
MiFreeInitMemoryPage,
|
||||
NULL);
|
||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||
#endif
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,299 +0,0 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
||||
*
|
||||
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* FILE: ntoskrnl/ke/i386/vm86_sup.S
|
||||
* PURPOSE: V86 mode support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* Created 09/10/00
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/status.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/i386/fpu.h>
|
||||
#include <internal/ps.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <internal/v86m.h>
|
||||
#include <ntos/tss.h>
|
||||
//#include <ntos/service.h>
|
||||
#include <internal/trap.h>
|
||||
#include <internal/ps.h>
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/i386/segment.h>
|
||||
|
||||
|
||||
#define EXCEPTION_UNWINDING 0x02
|
||||
|
||||
#define EREC_FLAGS 0x04
|
||||
|
||||
#define ExceptionContinueExecution 0
|
||||
#define ExceptionContinueSearch 1
|
||||
#define ExceptionNestedException 2
|
||||
#define ExceptionCollidedUnwind 3
|
||||
|
||||
//.globl _RtlpExecuteHandlerForException
|
||||
//.globl _RtlpExecuteHandlerForUnwind
|
||||
|
||||
#define CONTEXT_FLAGS 0x00
|
||||
#define CONTEXT_SEGGS 0x8C
|
||||
#define CONTEXT_SEGFS 0x90
|
||||
#define CONTEXT_SEGES 0x94
|
||||
#define CONTEXT_SEGDS 0x98
|
||||
#define CONTEXT_EDI 0x9C
|
||||
#define CONTEXT_ESI 0xA0
|
||||
#define CONTEXT_EBX 0xA4
|
||||
#define CONTEXT_EDX 0xA8
|
||||
#define CONTEXT_ECX 0xAC
|
||||
#define CONTEXT_EAX 0xB0
|
||||
#define CONTEXT_EBP 0xB4
|
||||
#define CONTEXT_EIP 0xB8
|
||||
#define CONTEXT_SEGCS 0xBC
|
||||
#define CONTEXT_EFLAGS 0xC0
|
||||
#define CONTEXT_ESP 0xC4
|
||||
#define CONTEXT_SEGSS 0xC8
|
||||
|
||||
|
||||
#define RCC_CONTEXT 0x08
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
AsmDebug(ULONG Value);
|
||||
|
||||
|
||||
// EAX = value to print
|
||||
__declspec(naked)
|
||||
void do_debug()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
pusha
|
||||
push eax
|
||||
call AsmDebug
|
||||
popa
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define REH_ERECORD 0x08
|
||||
#define REH_RFRAME 0x0C
|
||||
#define REH_CONTEXT 0x10
|
||||
#define REH_DCONTEXT 0x14
|
||||
#define REH_EROUTINE 0x18
|
||||
|
||||
// Parameters:
|
||||
// None
|
||||
// Registers:
|
||||
// [EBP+08h] - PEXCEPTION_RECORD ExceptionRecord
|
||||
// [EBP+0Ch] - PEXCEPTION_REGISTRATION RegistrationFrame
|
||||
// [EBP+10h] - PVOID Context
|
||||
// [EBP+14h] - PVOID DispatcherContext
|
||||
// [EBP+18h] - PEXCEPTION_HANDLER ExceptionRoutine
|
||||
// EDX - Address of protecting exception handler
|
||||
// Returns:
|
||||
// EXCEPTION_DISPOSITION
|
||||
// Notes:
|
||||
// Setup the protecting exception handler and call the exception
|
||||
// handler in the right context.
|
||||
__declspec(naked)
|
||||
void RtlpExecuteHandler()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push REH_RFRAME[ebp]
|
||||
|
||||
push edx
|
||||
push fs:0x0
|
||||
mov fs:0x0, esp
|
||||
|
||||
// Prepare to call the exception handler
|
||||
push REH_DCONTEXT[ebp]
|
||||
push REH_CONTEXT[ebp]
|
||||
push REH_RFRAME[ebp]
|
||||
push REH_ERECORD[ebp]
|
||||
|
||||
// Now call the exception handler
|
||||
mov eax, REH_EROUTINE[ebp]
|
||||
call eax
|
||||
|
||||
cmp fs:0x0, -1
|
||||
jne reh_stack_looks_ok
|
||||
|
||||
// This should not happen
|
||||
push 0
|
||||
push 0
|
||||
push 0
|
||||
push 0
|
||||
call RtlAssert
|
||||
|
||||
reh_loop:
|
||||
jmp reh_loop
|
||||
|
||||
reh_stack_looks_ok:
|
||||
mov esp, fs:0x0
|
||||
|
||||
// Return to the 'front-end' for this function
|
||||
pop dword ptr fs:0x0
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
#endif // 0
|
||||
|
||||
#define REP_ERECORD 0x04
|
||||
#define REP_RFRAME 0x08
|
||||
#define REP_CONTEXT 0x0C
|
||||
#define REP_DCONTEXT 0x10
|
||||
|
||||
// Parameters:
|
||||
// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord
|
||||
// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
|
||||
// [ESP+0Ch] - PCONTEXT Context
|
||||
// [ESP+10h] - PVOID DispatcherContext
|
||||
// Registers:
|
||||
// None
|
||||
// Returns:
|
||||
// EXCEPTION_DISPOSITION
|
||||
// Notes:
|
||||
// This exception handler protects the exception handling
|
||||
// mechanism by detecting nested exceptions.
|
||||
__declspec(naked)
|
||||
void RtlpExceptionProtector()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, ExceptionContinueSearch
|
||||
mov ecx, REP_ERECORD[esp]
|
||||
test EREC_FLAGS[ecx], EXCEPTION_UNWINDING
|
||||
jnz rep_end
|
||||
|
||||
// Unwinding is not taking place, so return ExceptionNestedException
|
||||
|
||||
// Set DispatcherContext field to the exception registration for the
|
||||
// exception handler that executed when a nested exception occurred
|
||||
mov ecx, REP_DCONTEXT[esp]
|
||||
mov eax, REP_RFRAME[esp]
|
||||
mov [ecx], eax
|
||||
mov eax, ExceptionNestedException
|
||||
|
||||
rep_end:
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Parameters:
|
||||
// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord
|
||||
// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
|
||||
// [ESP+0Ch] - PCONTEXT Context
|
||||
// [ESP+10h] - PVOID DispatcherContext
|
||||
// [ESP+14h] - PEXCEPTION_HANDLER ExceptionHandler
|
||||
// Registers:
|
||||
// None
|
||||
// Returns:
|
||||
// EXCEPTION_DISPOSITION
|
||||
// Notes:
|
||||
// Front-end
|
||||
__declspec(naked)
|
||||
void RtlpExecuteHandlerForException()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov edx, RtlpExceptionProtector
|
||||
jmp RtlpExecuteHandler
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define RUP_ERECORD 0x04
|
||||
#define RUP_RFRAME 0x08
|
||||
#define RUP_CONTEXT 0x0C
|
||||
#define RUP_DCONTEXT 0x10
|
||||
|
||||
// Parameters:
|
||||
// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord
|
||||
// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
|
||||
// [ESP+0Ch] - PCONTEXT Context
|
||||
// [ESP+10h] - PVOID DispatcherContext
|
||||
// Registers:
|
||||
// None
|
||||
// Returns:
|
||||
// EXCEPTION_DISPOSITION
|
||||
// Notes:
|
||||
// This exception handler protects the exception handling
|
||||
// mechanism by detecting collided unwinds.
|
||||
__declspec(naked)
|
||||
void RtlpUnwindProtector()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, ExceptionContinueSearch
|
||||
mov RUP_ERECORD[esp], ecx
|
||||
test EREC_FLAGS[ecx], EXCEPTION_UNWINDING
|
||||
jz rup_end
|
||||
|
||||
// Unwinding is taking place, so return ExceptionCollidedUnwind
|
||||
|
||||
mov ecx, RUP_RFRAME[esp]
|
||||
mov edx, RUP_DCONTEXT[esp]
|
||||
|
||||
// Set DispatcherContext field to the exception registration for the
|
||||
// exception handler that executed when a collision occurred
|
||||
mov eax, RUP_RFRAME[ecx]
|
||||
mov [edx], eax
|
||||
mov eax, ExceptionCollidedUnwind
|
||||
|
||||
rup_end:
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Parameters:
|
||||
// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord
|
||||
// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
|
||||
// [ESP+0Ch] - PCONTEXT Context
|
||||
// [ESP+10h] - PVOID DispatcherContext
|
||||
// [ESP+14h] - PEXCEPTION_HANDLER ExceptionHandler
|
||||
// Registers:
|
||||
// None
|
||||
// Returns:
|
||||
// EXCEPTION_DISPOSITION
|
||||
__declspec(naked)
|
||||
void RtlpExecuteHandlerForUnwind()
|
||||
{
|
||||
__asm mov edx, RtlpUnwindProtector
|
||||
__asm jmp RtlpExecuteHandler
|
||||
}
|
||||
|
@@ -1,37 +0,0 @@
|
||||
# $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
|
@@ -1,20 +0,0 @@
|
||||
|
||||
#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();
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
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...
|
@@ -1,16 +0,0 @@
|
||||
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
|
@@ -1,67 +0,0 @@
|
||||
<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 "Inside
|
||||
Windows NT"-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> </p>
|
||||
<p>LPC Documentation</p>
|
||||
</body>
|
||||
</html>
|
12603
os2/include/os2.h
12603
os2/include/os2.h
File diff suppressed because it is too large
Load Diff
@@ -1,91 +0,0 @@
|
||||
/* $ $
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* 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__ */
|
@@ -1,20 +0,0 @@
|
||||
@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
|
@@ -1,65 +0,0 @@
|
||||
/* $Id: devices.cpp,v 1.5 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: 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 */
|
@@ -1,97 +0,0 @@
|
||||
/* $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 */
|
@@ -1,35 +0,0 @@
|
||||
; $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
|
@@ -1,23 +0,0 @@
|
||||
; $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
|
@@ -1,35 +0,0 @@
|
||||
; $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
|
@@ -1,38 +0,0 @@
|
||||
#include <defines.h>
|
||||
#include <reactos/resource.h>
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
|
||||
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", RES_STR_COMPANY_NAME
|
||||
VALUE "FileDescription", "OS2 subsystem base services\0"
|
||||
VALUE "FileVersion", RES_STR_FILE_VERSION
|
||||
VALUE "InternalName", "doscalls\0"
|
||||
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
|
||||
VALUE "OriginalFilename", "doscalls.dll\0"
|
||||
VALUE "ProductName", RES_STR_PRODUCT_NAME
|
||||
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
@@ -1,179 +0,0 @@
|
||||
/* $Id: directory.cpp,v 1.1 2002/09/04 22:19:47 robertk Exp $
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* 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 */
|
@@ -1,199 +0,0 @@
|
||||
/* $Id: openclose.cpp,v 1.5 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: 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
@@ -1,61 +0,0 @@
|
||||
# $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
|
@@ -1,33 +0,0 @@
|
||||
/* $Id: doscalls.cpp,v 1.1 2002/07/26 00:23:13 robertk Exp $
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
@@ -1,165 +0,0 @@
|
||||
/* $Id: error.cpp,v 1.3 2003/01/07 16:23:11 robd Exp $
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* 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 */
|
@@ -1,58 +0,0 @@
|
||||
/* $Id: process.cpp,v 1.6 2003/01/07 16:23:11 robd Exp $
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* 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: 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 */
|
||||
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 */
|
@@ -1,34 +0,0 @@
|
||||
# $Id: makefile,v 1.3 2003/01/12 02:03:06 robd Exp $
|
||||
|
||||
PATH_TO_TOP = ../../reactos
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_APPTYPE = native
|
||||
|
||||
TARGET_NAME = os2ss
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__NTAPP__
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a csrss.a
|
||||
|
||||
TARGET_GCCLIBS = stdc++
|
||||
|
||||
OBJECTS_API =
|
||||
|
||||
OBJECTS_MISC = \
|
||||
$(TARGET_NAME).o
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
$(OBJECTS_API) \
|
||||
$(OBJECTS_MISC)
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,157 +0,0 @@
|
||||
/* $Id: os2ss.cpp,v 1.2 2003/01/07 16:23:12 robd Exp $
|
||||
*
|
||||
* reactos/subsys/csrss/api/process.c
|
||||
*
|
||||
* "\windows\ApiPort" port process management functions
|
||||
*
|
||||
* ReactOS Operating System
|
||||
*/
|
||||
// TODO: Rewrite the whole file. This is just a copy
|
||||
|
||||
#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 */
|
||||
|
||||
int NumProcesses;
|
||||
|
||||
|
||||
|
||||
/* Native image's entry point */
|
||||
|
||||
void NtProcessStartup (PPEB Peb)
|
||||
{
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcParams;
|
||||
PWSTR ArgBuffer;
|
||||
PWSTR *argv;
|
||||
ULONG argc = 0;
|
||||
int i = 0;
|
||||
int afterlastspace = 0;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE CsrssInitEvent;
|
||||
UNICODE_STRING UnicodeString;
|
||||
NTSTATUS Status;
|
||||
|
||||
ProcParams = RtlNormalizeProcessParams (Peb->ProcessParameters);
|
||||
|
||||
argv = (PWSTR *)RtlAllocateHeap (Peb->ProcessHeap,
|
||||
0, 512 * sizeof(PWSTR));
|
||||
ArgBuffer = (PWSTR)RtlAllocateHeap (Peb->ProcessHeap,
|
||||
0,
|
||||
ProcParams->CommandLine.Length + sizeof(WCHAR));
|
||||
memcpy (ArgBuffer,
|
||||
ProcParams->CommandLine.Buffer,
|
||||
ProcParams->CommandLine.Length + sizeof(WCHAR));
|
||||
|
||||
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[afterlastspace] != L'\0')
|
||||
{
|
||||
argc++;
|
||||
ArgBuffer[i] = L'\0';
|
||||
argv[argc-1] = &(ArgBuffer[afterlastspace]);
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
L"\\CsrssInitDone");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
EVENT_ALL_ACCESS,
|
||||
0,
|
||||
NULL);
|
||||
Status = NtOpenEvent(&CsrssInitEvent,
|
||||
EVENT_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
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);
|
||||
|
||||
/* terminate the current thread only */
|
||||
NtTerminateThread( NtCurrentThread(), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayString( L"CSR: Subsystem initialization failed.\n" );
|
||||
|
||||
RtlFreeHeap (Peb->ProcessHeap,
|
||||
0, argv);
|
||||
RtlFreeHeap (Peb->ProcessHeap,
|
||||
0,
|
||||
ArgBuffer);
|
||||
|
||||
/*
|
||||
* Tell SM we failed.
|
||||
*/
|
||||
NtTerminateProcess( NtCurrentProcess(), 0 );
|
||||
}
|
||||
}
|
Binary file not shown.
154
posix/Makefile
154
posix/Makefile
@@ -1,154 +0,0 @@
|
||||
# $Id: Makefile,v 1.7 2003/01/05 18:29:41 robd Exp $
|
||||
#
|
||||
# ReactOS POSIX+ Personality
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../reactos
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
||||
POSIX_OTHER = server #lib
|
||||
|
||||
POSIX_TOOLS = mksystab
|
||||
|
||||
POSIX_LIBS = psxdll psxx
|
||||
|
||||
POSIX_APPS = baresh posixw32
|
||||
|
||||
POSIX_MODULES = $(POSIX_OTHER) $(POSIX_TOOLS) $(POSIX_LIBS) $(POSIX_APPS)
|
||||
|
||||
all: implib $(POSIX_MODULES)
|
||||
|
||||
implib: $(POSIX_MODULES:%=%_implib)
|
||||
|
||||
clean: $(POSIX_MODULES:%=%_clean)
|
||||
|
||||
install: $(POSIX_MODULES:%=%_install)
|
||||
|
||||
#dist: $(TOOLS_PATH)/rcopy$(EXE_POSTFIX) dist_clean dist_dirs \
|
||||
# $(POSIX_MODULES:%=%_dist)
|
||||
|
||||
.PHONY: all implib clean
|
||||
#.PHONY: all implib install dist
|
||||
|
||||
|
||||
#
|
||||
# Other POSIX+ Modules
|
||||
#
|
||||
$(POSIX_OTHER): %:
|
||||
make -f Makefile -C $(POSIX_PATH)/$*
|
||||
|
||||
$(POSIX_OTHER:%=%_implib): %_implib:
|
||||
make -f Makefile -C $(POSIX_PATH)/$* implib
|
||||
|
||||
$(POSIX_OTHER:%=%_clean): %_clean:
|
||||
make -f Makefile -C $(POSIX_PATH)/$* clean
|
||||
|
||||
$(POSIX_OTHER:%=%_dist): %_dist:
|
||||
make -f Makefile -C $(POSIX_PATH)/$* dist
|
||||
|
||||
$(POSIX_OTHER:%=%_install): %_install:
|
||||
make -f Makefile -C $(POSIX_PATH)/$* install
|
||||
|
||||
.PHONY: $(POSIX_OTHER) $(POSIX_OTHER:%=%_implib) $(POSIX_OTHER:%=%_clean) $(POSIX_OTHER:%=%_install) $(POSIX_OTHER:%=%_dist)
|
||||
|
||||
|
||||
#
|
||||
# POSIX+ Tools
|
||||
#
|
||||
$(POSIX_TOOLS): %:
|
||||
make -f Makefile -C $(POSIX_PATH)/tools/$*
|
||||
|
||||
$(POSIX_TOOLS:%=%_implib): %_implib:
|
||||
make -f Makefile -C $(POSIX_PATH)/tools/$* implib
|
||||
|
||||
$(POSIX_TOOLS:%=%_clean): %_clean:
|
||||
make -f Makefile -C $(POSIX_PATH)/tools/$* clean
|
||||
|
||||
$(POSIX_TOOLS:%=%_dist): %_dist:
|
||||
make -f Makefile -C $(POSIX_PATH)/tools/$* dist
|
||||
|
||||
$(POSIX_TOOLS:%=%_install): %_install:
|
||||
make -f Makefile -C $(POSIX_PATH)/tools/$* install
|
||||
|
||||
.PHONY: $(POSIX_LIBS) $(POSIX_LIBS:%=%_implib) $(POSIX_LIBS:%=%_clean) $(POSIX_LIBS:%=%_install) $(POSIX_LIBS:%=%_dist)
|
||||
|
||||
|
||||
#
|
||||
# POSIX+ DLLs
|
||||
#
|
||||
$(POSIX_LIBS): %:
|
||||
make -f Makefile -C $(POSIX_PATH)/lib/$*
|
||||
|
||||
$(POSIX_LIBS:%=%_implib): %_implib:
|
||||
make -f Makefile -C $(POSIX_PATH)/lib/$* implib
|
||||
|
||||
$(POSIX_LIBS:%=%_clean): %_clean:
|
||||
make -f Makefile -C $(POSIX_PATH)/lib/$* clean
|
||||
|
||||
$(POSIX_LIBS:%=%_dist): %_dist:
|
||||
make -f Makefile -C $(POSIX_PATH)/lib/$* dist
|
||||
|
||||
$(POSIX_LIBS:%=%_install): %_install:
|
||||
make -f Makefile -C $(POSIX_PATH)/lib/$* install
|
||||
|
||||
.PHONY: $(POSIX_LIBS) $(POSIX_LIBS:%=%_implib) $(POSIX_LIBS:%=%_clean) $(POSIX_LIBS:%=%_install) $(POSIX_LIBS:%=%_dist)
|
||||
|
||||
|
||||
#
|
||||
# POSIX+ Programs
|
||||
#
|
||||
$(POSIX_APPS): %:
|
||||
make -f Makefile -C $(POSIX_PATH)/apps/$*
|
||||
|
||||
$(POSIX_APPS:%=%_implib): %_implib:
|
||||
make -f Makefile -C $(POSIX_PATH)/apps/$* implib
|
||||
|
||||
$(POSIX_APPS:%=%_clean): %_clean:
|
||||
make -f Makefile -C $(POSIX_PATH)/apps/$* clean
|
||||
|
||||
$(POSIX_APPS:%=%_dist): %_dist:
|
||||
make -f Makefile -C $(POSIX_PATH)/apps/$* dist
|
||||
|
||||
$(POSIX_APPS:%=%_install): %_install:
|
||||
make -f Makefile -C $(POSIX_PATH)/apps/$* install
|
||||
|
||||
.PHONY: $(POSIX_APPS) $(POSIX_APPS:%=%_implib) $(POSIX_APPS:%=%_clean) $(POSIX_APPS:%=%_install) $(POSIX_APPS:%=%_dist)
|
||||
|
||||
|
||||
etags:
|
||||
find . -name "*.[ch]" -print | etags --language=c -
|
||||
|
||||
# EOF
|
||||
|
||||
|
||||
|
||||
#CFLAGS=-Iinclude
|
||||
|
||||
#all: lib/crt0w32.o
|
||||
# make -C tools
|
||||
# make -C lib
|
||||
# make -C server
|
||||
# make -C lib/psxdll
|
||||
# make -C lib/psxx
|
||||
# make -C apps/baresh
|
||||
# make -C apps/posixw32
|
||||
|
||||
#lib/crt0w32.o: lib/crt0w32.c
|
||||
|
||||
#implib:
|
||||
|
||||
#clean:
|
||||
# make -C lib clean
|
||||
# make -C tools clean
|
||||
# make -C server clean
|
||||
# make -C lib/psxdll clean
|
||||
# make -C lib/psxx clean
|
||||
# make -C apps/baresh clean
|
||||
# make -C apps/posixw32 clean
|
||||
# - $(RM) lib/crt0w32.o
|
||||
|
||||
#include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
# EOF
|
@@ -1,30 +0,0 @@
|
||||
# $Id: Makefile,v 1.9 2003/01/05 18:27:19 robd Exp $
|
||||
#
|
||||
# To run it in Win32 console mode, undefine __SUBSYSTEM_WINDOWS__
|
||||
# and pass "console" in the ld's --subsystem option.
|
||||
#
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../../../reactos
|
||||
|
||||
PATH_TO_PSX_TOP = ../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
#TARGET_APPTYPE = console
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = baresh
|
||||
|
||||
TARGET_CFLAGS = -D__SUBSYSTEM_WINDOWS__
|
||||
|
||||
TARGET_LIBS = $(PATH_TO_PSX_TOP)/lib/crt0w32.o \
|
||||
$(PATH_TO_TOP)/dk/psx/lib/psxdll.a
|
||||
|
||||
TARGET_OBJECTS = sh.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,38 +0,0 @@
|
||||
#include <defines.h>
|
||||
#include <reactos/resource.h>
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
|
||||
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", RES_STR_COMPANY_NAME
|
||||
VALUE "FileDescription", "Bare sh for POSIX+\0"
|
||||
VALUE "FileVersion", RES_STR_FILE_VERSION
|
||||
VALUE "InternalName", "sh\0"
|
||||
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
|
||||
VALUE "OriginalFilename", "sh\0"
|
||||
VALUE "ProductName", RES_STR_PRODUCT_NAME
|
||||
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
@@ -1,60 +0,0 @@
|
||||
/* $Id: sh.c,v 1.3 2002/10/29 04:44:59 rex Exp $
|
||||
*
|
||||
* baresh - Bare Shell for the PSX subsystem.
|
||||
* Copyright (c) 2002 Emanuele Aliberti
|
||||
* License: GNU GPL v2
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#define INPUT_BUFFER_SIZE 128
|
||||
|
||||
int run=1;
|
||||
|
||||
void cmd_exit(char*buf)
|
||||
{
|
||||
run=0;
|
||||
}
|
||||
|
||||
void cmd_pwd(char * buf)
|
||||
{
|
||||
char pwd[1024];
|
||||
|
||||
getcwd(pwd,sizeof pwd);
|
||||
printf("%s\n",pwd);
|
||||
}
|
||||
|
||||
void cmd_ls(char*buf)
|
||||
{
|
||||
char pwd[1024];
|
||||
DIR * dir;
|
||||
struct dirent * entry;
|
||||
|
||||
getcwd(pwd,sizeof pwd);
|
||||
dir=opendir(pwd);
|
||||
while (NULL!=(entry=readdir(dir)))
|
||||
{
|
||||
printf("%s\n",entry->d_name);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
int main(int argc,char*argv[])
|
||||
{
|
||||
char buf[INPUT_BUFFER_SIZE];
|
||||
|
||||
while (run)
|
||||
{
|
||||
printf("# ");
|
||||
if (gets(buf))
|
||||
{
|
||||
if (!strcmp("exit",buf)) cmd_exit(buf);
|
||||
else if (!strcmp("pwd",buf)) cmd_pwd(buf);
|
||||
else if (!strcmp("ls",buf)) cmd_ls(buf);
|
||||
else printf("%s: unknown command\n",argv[0]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* EOF */
|
@@ -1,38 +0,0 @@
|
||||
#include <defines.h>
|
||||
#include <reactos/resource.h>
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
|
||||
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", RES_STR_COMPANY_NAME
|
||||
VALUE "FileDescription", "Bare sh for POSIX+\0"
|
||||
VALUE "FileVersion", RES_STR_FILE_VERSION
|
||||
VALUE "InternalName", "sh\0"
|
||||
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
|
||||
VALUE "OriginalFilename", "sh\0"
|
||||
VALUE "ProductName", RES_STR_PRODUCT_NAME
|
||||
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
@@ -1,90 +0,0 @@
|
||||
08/08/96 - John L. Miller, johnmil@cs.cmu.edu, johnmil@jprc.com
|
||||
|
||||
FILES INCLUDED:
|
||||
00readme.txt - this file
|
||||
VT100.H - Definitions for VT-100 emulator.
|
||||
VT100.C - Front end parsing code for VT-100 emulator
|
||||
CONSOLE.C - Back-end code to allow VT-100 in WinNt/Win95 console
|
||||
|
||||
Many UNIX users take terminals for granted, as something you get for free
|
||||
with the operating system. Unfortunately, this isn't the case for many
|
||||
non-unix operating systems, especially PC-based ones. After a number of
|
||||
projects, I decided it would be nice if there was source publicly available
|
||||
for doing VT-100 emulation.
|
||||
|
||||
The files included with this distribution are not a complete implementation
|
||||
of VT-100 terminal emulation, but do provide complete enough coverage to
|
||||
use many vt-100 functions over the network. For instance, its enough to
|
||||
use EMACS to edit, or to connect up to your favorite mud with ANSI color
|
||||
and graphics characters.
|
||||
|
||||
The VT-100 emulator is broken into two parts. The first is the front end,
|
||||
vt100.c and vt100.h. These files were written to be fairly device-independant,
|
||||
though admittedly if you're running under a 16-bit operating system instead
|
||||
of a 32-bit, you might need to change some of the 'int' values to 'long.'
|
||||
Otherwise, it should work 'as-is'.
|
||||
|
||||
The second part is a back-end. The back-end is responsible for doing the
|
||||
workhorse activities. The front-end parses a character stream, and decides
|
||||
whether to clear a part of the screen, or move the cursor, or switch fonts.
|
||||
Then it calls routines in the back-end to perform these activities.
|
||||
|
||||
The back-end functions are, for the most part, very straight forward, and
|
||||
quite easy to implement compared to writing a vt-100 emulator from scratch.
|
||||
CONSOLE.C is a back-end for use in console (command, dos) windows under
|
||||
Windows 95 and Windows NT. This console vt-100 emulator is also being used
|
||||
in my TINTIN-III port and kerberized encrypted telnet port.
|
||||
|
||||
|
||||
TO USE THIS VT-100 EMULATOR:
|
||||
|
||||
First, it's intended to be linked directly into source code. You'll need
|
||||
to change printf's and puts' in your source code to call vtprintf() and
|
||||
vtputs() instead. You can add additional functions to vt100.c as you see
|
||||
fit to handle other output functions like putchar() and write(). Another
|
||||
routine you may want to use is vtProcessedTextOut(), which accepts a
|
||||
buffer to output, and a count of characters in that buffer.
|
||||
|
||||
Second, you need to make sure that your source code calls vtInitVT100()
|
||||
before it does ANYTHING else. This initializes the vt-100 emulator.
|
||||
|
||||
Third, if you want to use this VT-100 emulator with anything besides
|
||||
Windows NT and Windows 95 consoles, you'll need to implement your own
|
||||
back end. The list of functions you will need to supply, as well as what
|
||||
they need to do is contained in vt100.h. The list (minus descriptions)
|
||||
is as follows:
|
||||
|
||||
int beInitVT100Terminal();
|
||||
int beAbsoluteCursor(int row, int col);
|
||||
int beOffsetCursor(int row, int column);
|
||||
int beRestoreCursor(void);
|
||||
int beSaveCursor(void);
|
||||
int beSetTextAttributes(int fore, int back);
|
||||
int beRawTextOut(char *text, int len);
|
||||
int beEraseText(int rowFrom, int colFrom, int rowTo, int colTo);
|
||||
int beDeleteText(int rowFrom, int colFrom, int rowTo, int colTo);
|
||||
int beInsertRow(int row);
|
||||
int beTransmitText(char *text, int len);
|
||||
int beAdvanceToTab(void);
|
||||
int beClearTab(int col);
|
||||
int beSetScrollingRows(int fromRow, int toRow);
|
||||
int beRingBell(void);
|
||||
int beGetTermMode();
|
||||
int beSetTermMode(int newMode);
|
||||
|
||||
For details on what each of these does, read the descriptions of each
|
||||
function included in vt100.h, and read over CONSOLE.C for examples. I've
|
||||
included copious comments in all of these files to try to make them as
|
||||
easy to use as possible.
|
||||
|
||||
In any case, it should be easier than writing a VT-100 emulator from
|
||||
scratch.
|
||||
|
||||
KNOWN BUGS -
|
||||
|
||||
o Many features of VT-100 emulation aren't implemented. This includes
|
||||
support for graphics character set 0 and many of the
|
||||
answerback functions.
|
||||
|
||||
Well, good luck!
|
||||
|
@@ -1,29 +0,0 @@
|
||||
# $Id: Makefile,v 1.4 2003/01/05 18:27:19 robd Exp $
|
||||
#
|
||||
# Win32 Terminal Emulator for the POSIX+ subsystem.
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../../../reactos
|
||||
|
||||
PATH_TO_TOP_PSX = ../..
|
||||
|
||||
TARGET_NAME = posixw32
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_CFLAGS = -I$(PATH_TO_TOP_PSX)/include
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
$(TARGET_NAME).o \
|
||||
console.o \
|
||||
vt100.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
File diff suppressed because it is too large
Load Diff
@@ -1,612 +0,0 @@
|
||||
/* $Id: posixw32.c,v 1.4 2003/08/28 20:01:23 ea Exp $
|
||||
*
|
||||
* PROJECT : ReactOS Operating System / POSIX+ Environment Subsystem
|
||||
* DESCRIPTION: POSIXW32 - A DEC VT-100 terminal emulator for the PSX subsystem
|
||||
* DESCRIPTION: that runs in the Win32 subsystem.
|
||||
* COPYRIGHT : Copyright (c) 2001-2002 Emanuele Aliberti
|
||||
* LICENSE : GNU GPL v2
|
||||
* DATE : 2001-05-05
|
||||
* AUTHOR : Emanuele Aliberti <ea@iol.it>
|
||||
* NOTE : This IS a Win32 program, but will fail if the PSX subsystem
|
||||
* NOTE : is not installed. The PSX subsystem consists of two more
|
||||
* NOTE : files: PSXSS.EXE, PSXDLL.DLL.
|
||||
* WARNING : If you use this program under a real NT descendant, be
|
||||
* WARNING : sure to have disabled the PSX subsystem.
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* 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. If not, write
|
||||
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
|
||||
* MA 02139, USA.
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
* 2002-03-16 EA Today it actually compiled.
|
||||
* 2002-06-08 EA Renamed (old name was CSRTERM)
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ntos.h>
|
||||
#include <psx/lpcproto.h>
|
||||
|
||||
#include "vt100.h"
|
||||
#include "posixw32.h"
|
||||
|
||||
/*** OPTIONS *********************************************************/
|
||||
|
||||
#define PRIVATE static
|
||||
|
||||
#define INPUT_QUEUE_SIZE 32
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define TRACE
|
||||
#else
|
||||
#define TRACE OutputDebugString(__FUNCTION__)
|
||||
#endif
|
||||
|
||||
/*** GLOBALS *********************************************************/
|
||||
|
||||
PRIVATE LPCSTR MyName = "POSIXW32";
|
||||
PRIVATE CSRTERM_SESSION Session =
|
||||
{
|
||||
0, //Identifier
|
||||
{ //ServerPort
|
||||
{0,0,NULL},
|
||||
L"\\"PSX_NS_SUBSYSTEM_DIRECTORY_NAME"\\"PSX_NS_SESSIONAPI_PORT_NAME,
|
||||
INVALID_HANDLE_VALUE
|
||||
}
|
||||
};
|
||||
|
||||
/*** PRIVATE FUNCTIONS ***********************************************/
|
||||
VOID STDCALL Debug_Print (LPCSTR Format, ...)
|
||||
{
|
||||
CHAR Buffer [512];
|
||||
va_list ArgumentPointer;
|
||||
|
||||
va_start(ArgumentPointer, Format);
|
||||
vsprintf(Buffer, Format, ArgumentPointer);
|
||||
va_end(ArgumentPointer);
|
||||
OutputDebugStringA (Buffer);
|
||||
}
|
||||
/**********************************************************************
|
||||
* OutPort/2 PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Notify to PSXSS that input data is ready by sending a
|
||||
* software interrupt on the \POSIX+\SessionPort port.
|
||||
*/
|
||||
PRIVATE DWORD STDCALL OutPort (PCHAR Buffer, ULONG Size)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PSX_TERMINAL_READ TerminalRead;
|
||||
TRACE;
|
||||
if (Size > 0)
|
||||
{
|
||||
/* LPC */
|
||||
TerminalRead.Header.MessageType = LPC_NEW_MESSAGE;
|
||||
TerminalRead.PsxHeader.Context = PSX_CONNECTION_TYPE_TERMINAL;
|
||||
TerminalRead.PsxHeader.Procedure = PSX_TERMINAL_INTERRUPT;
|
||||
/* Terminal I/O */
|
||||
TerminalRead.Size = Size;
|
||||
#if 0
|
||||
RtlCopyMemory (TerminalRead.Buffer, Buffer, Size);
|
||||
Status = NtRequestWaitReplyPort (
|
||||
Session.ServerPort.Handle,
|
||||
& TerminalRead
|
||||
/* FIXME */
|
||||
);
|
||||
#endif
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
vtprintf ("%s: %s: NtRequestWaitReplyPort failed with %08x\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return Size;
|
||||
}
|
||||
/**********************************************************************
|
||||
* ProcessConnectionRequest/1 PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Initialize our data for managing the control connection
|
||||
* initiated by the PSXSS.EXE process.
|
||||
*/
|
||||
PRIVATE NTSTATUS STDCALL ProcessConnectionRequest (PLPC_MAX_MESSAGE Request)
|
||||
{
|
||||
PPSX_CONNECT_PORT_DATA ConnectData = (PPSX_CONNECT_PORT_DATA) & Request->Data;
|
||||
|
||||
TRACE;
|
||||
if (PSX_CONNECTION_TYPE_SERVER != ConnectData->ConnectionType)
|
||||
{
|
||||
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
if (PSX_LPC_PROTOCOL_VERSION != ConnectData->Version)
|
||||
{
|
||||
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
Session.SsLinkIsActive = TRUE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
/**********************************************************************
|
||||
* ProcessRequest/1 PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
*/
|
||||
PRIVATE NTSTATUS STDCALL ProcessRequest (PPSX_MAX_MESSAGE Request)
|
||||
{
|
||||
TRACE;
|
||||
/* TODO */
|
||||
vtprintf("TEST VT-100\n");
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
/**********************************************************************
|
||||
* PsxSessionPortListener/1 PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Manage messages from the PSXSS, that is LPC messages we get
|
||||
* from the PSXSS process to our \POSIX+\Sessions\P<pid> port.
|
||||
*
|
||||
* NOTE
|
||||
* This function is the thread 's entry point created in
|
||||
* CreateSessionObiects().
|
||||
*/
|
||||
PRIVATE DWORD STDCALL PsxSessionPortListener (LPVOID Arg)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
LPC_TYPE RequestType;
|
||||
PSX_MAX_MESSAGE Request;
|
||||
PPSX_MAX_MESSAGE Reply = NULL;
|
||||
BOOL NullReply = FALSE;
|
||||
|
||||
TRACE;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
Reply = NULL;
|
||||
NullReply = FALSE;
|
||||
while (!NullReply)
|
||||
{
|
||||
Status = NtReplyWaitReceivePort (
|
||||
Session.Port.Handle,
|
||||
0,
|
||||
(PLPC_MESSAGE) Reply,
|
||||
(PLPC_MESSAGE) & Request
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
break;
|
||||
}
|
||||
RequestType = PORT_MESSAGE_TYPE(Request);
|
||||
switch (RequestType)
|
||||
{
|
||||
case LPC_CONNECTION_REQUEST:
|
||||
ProcessConnectionRequest ((PLPC_MAX_MESSAGE) & Request);
|
||||
NullReply = TRUE;
|
||||
continue;
|
||||
case LPC_CLIENT_DIED:
|
||||
case LPC_PORT_CLOSED:
|
||||
case LPC_DEBUG_EVENT:
|
||||
case LPC_ERROR_EVENT:
|
||||
case LPC_EXCEPTION:
|
||||
NullReply = TRUE;
|
||||
continue;
|
||||
default:
|
||||
if (RequestType != LPC_REQUEST)
|
||||
{
|
||||
NullReply = TRUE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Reply = & Request;
|
||||
Reply->PsxHeader.Status = ProcessRequest (& Request);
|
||||
NullReply = FALSE;
|
||||
}
|
||||
if ((STATUS_INVALID_HANDLE == Status) ||
|
||||
(STATUS_OBJECT_TYPE_MISMATCH == Status))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
Session.SsLinkIsActive = FALSE;
|
||||
TerminateThread (GetCurrentThread(), Status);
|
||||
}
|
||||
/**********************************************************************
|
||||
* CreateSessionObiects/1 PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Create the session objects which are mananged by our side:
|
||||
*
|
||||
* \POSIX+\Sessions\P<pid>
|
||||
* \POSIX+\Sessions\D<pid>
|
||||
*/
|
||||
PRIVATE NTSTATUS STDCALL CreateSessionObjects (DWORD Pid)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG Id = 0;
|
||||
OBJECT_ATTRIBUTES Oa;
|
||||
LARGE_INTEGER SectionSize = {PSX_TERMINAL_SECTION_SIZE,0};
|
||||
|
||||
TRACE;
|
||||
|
||||
|
||||
/* Critical section */
|
||||
Status = RtlInitializeCriticalSection (& Session.Lock);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
vtprintf (
|
||||
"%s: %s: RtlInitializeCriticalSection failed with %08x\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
/* Port and port management thread */
|
||||
swprintf (
|
||||
Session.Port.NameBuffer,
|
||||
PSX_NS_SESSION_PORT_TEMPLATE,
|
||||
PSX_NS_SUBSYSTEM_DIRECTORY_NAME,
|
||||
PSX_NS_SESSION_DIRECTORY_NAME,
|
||||
Pid
|
||||
);
|
||||
OutputDebugStringW(Session.Port.NameBuffer);
|
||||
RtlInitUnicodeString (& Session.Port.Name, Session.Port.NameBuffer);
|
||||
InitializeObjectAttributes (& Oa, & Session.Port.Name, 0, NULL, NULL);
|
||||
Status = NtCreatePort (& Session.Port.Handle, & Oa, 0, 0, 0x10000);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlDeleteCriticalSection (& Session.Lock);
|
||||
vtprintf ("%s: %s: NtCreatePort failed with %08x\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
Session.Port.Thread.Handle =
|
||||
CreateThread (
|
||||
NULL,
|
||||
0,
|
||||
PsxSessionPortListener,
|
||||
0,
|
||||
CREATE_SUSPENDED,
|
||||
& Session.Port.Thread.Id
|
||||
);
|
||||
if ((HANDLE) NULL == Session.Port.Thread.Handle)
|
||||
{
|
||||
Status = (NTSTATUS) GetLastError();
|
||||
NtClose (Session.Port.Handle);
|
||||
RtlDeleteCriticalSection (& Session.Lock);
|
||||
vtprintf ("%s: %s: CreateThread failed with %d\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
/* Section */
|
||||
swprintf (
|
||||
Session.Section.NameBuffer,
|
||||
PSX_NS_SESSION_DATA_TEMPLATE,
|
||||
PSX_NS_SUBSYSTEM_DIRECTORY_NAME,
|
||||
PSX_NS_SESSION_DIRECTORY_NAME,
|
||||
Pid
|
||||
);
|
||||
OutputDebugStringW(Session.Section.NameBuffer);
|
||||
RtlInitUnicodeString (& Session.Section.Name, Session.Section.NameBuffer);
|
||||
InitializeObjectAttributes (& Oa, & Session.Section.Name, 0, 0, 0);
|
||||
Status = NtCreateSection (
|
||||
& Session.Section.Handle,
|
||||
SECTION_ALL_ACCESS, /* DesiredAccess */
|
||||
& Oa,
|
||||
& SectionSize,
|
||||
PAGE_READWRITE, /* Protect 4 */
|
||||
SEC_COMMIT, /* Attributes */
|
||||
0 /* FileHandle: 0=pagefile.sys */
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NtClose (Session.Port.Handle);
|
||||
NtTerminateThread (Session.Port.Thread.Handle, Status);
|
||||
RtlDeleteCriticalSection (& Session.Lock);
|
||||
vtprintf ("%s: %s: NtCreateSection failed with %08x\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
Session.Section.BaseAddress = NULL;
|
||||
Session.Section.ViewSize = SectionSize.u.LowPart;
|
||||
Status = NtMapViewOfSection (
|
||||
Session.Section.Handle,
|
||||
NtCurrentProcess(),
|
||||
& Session.Section.BaseAddress,
|
||||
0, /* ZeroBits */
|
||||
0, /* Commitsize */
|
||||
0, /* SectionOffset */
|
||||
& Session.Section.ViewSize,
|
||||
ViewUnmap,
|
||||
0, /* AllocationType */
|
||||
PAGE_READWRITE /* Protect 4 */
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NtClose (Session.Port.Handle);
|
||||
NtTerminateThread (Session.Port.Thread.Handle, Status);
|
||||
NtClose (Session.Section.Handle);
|
||||
RtlDeleteCriticalSection (& Session.Lock);
|
||||
vtprintf ("%s: %s: NtMapViewOfSection failed with %08x\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* CreateTerminalToPsxChannel/0 PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
*/
|
||||
PRIVATE NTSTATUS STDCALL CreateTerminalToPsxChannel (VOID)
|
||||
{
|
||||
PSX_CONNECT_PORT_DATA ConnectData;
|
||||
ULONG ConnectDataLength = sizeof ConnectData;
|
||||
SECURITY_QUALITY_OF_SERVICE Sqos;
|
||||
NTSTATUS Status;
|
||||
|
||||
TRACE;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the connection data object before
|
||||
* calling PSXSS.
|
||||
*/
|
||||
ConnectData.ConnectionType = PSX_CONNECTION_TYPE_TERMINAL;
|
||||
ConnectData.Version = PSX_LPC_PROTOCOL_VERSION;
|
||||
/*
|
||||
* Try connecting to \POSIX+\SessionPort.
|
||||
*/
|
||||
RtlInitUnicodeString (& Session.ServerPort.Name, Session.ServerPort.NameBuffer);
|
||||
OutputDebugStringW(Session.ServerPort.Name.Buffer);
|
||||
Status = NtConnectPort (
|
||||
& Session.ServerPort.Handle,
|
||||
& Session.ServerPort.Name,
|
||||
& Sqos,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
& ConnectData,
|
||||
& ConnectDataLength
|
||||
);
|
||||
if (STATUS_SUCCESS != Status)
|
||||
{
|
||||
vtprintf ("%s: %s: NtConnectPort failed with %08x\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
Session.Identifier = ConnectData.PortIdentifier;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* InitializeSsIoChannel PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Create our objects in the system name space
|
||||
* (CreateSessionObjects) and then connect to the session port
|
||||
* (CreateControChannel).
|
||||
*/
|
||||
PRIVATE NTSTATUS STDCALL InitializeSsIoChannel (VOID)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
DWORD Pid = GetCurrentProcessId();
|
||||
|
||||
TRACE;
|
||||
|
||||
|
||||
Status = CreateSessionObjects (Pid);
|
||||
if (STATUS_SUCCESS != Status)
|
||||
{
|
||||
vtprintf ("%s: %s: CreateSessionObjects failed with %08x\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
Status = CreateTerminalToPsxChannel ();
|
||||
if (STATUS_SUCCESS != Status)
|
||||
{
|
||||
vtprintf ("%s: %s: CreateTerminalToPsxChannel failed with %08x\n",
|
||||
MyName, __FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
/**********************************************************************
|
||||
* PsxCreateLeaderProcess/1 PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Create a new PSXSS process. We are running under Win32 server
|
||||
* and can not run directly a PSX image: we make SM run it for us.
|
||||
*
|
||||
*/
|
||||
PRIVATE NTSTATUS STDCALL PsxCreateLeaderProcess (char * Command)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
TRACE;
|
||||
|
||||
if (NULL == Command)
|
||||
{
|
||||
Command = "sh";
|
||||
}
|
||||
/* TODO: request SM to create the process: LPC:SmExecPgm() */
|
||||
vtprintf ("%s: %s: calling SMSS not implemented!", MyName, __FUNCTION__);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
/**********************************************************************
|
||||
* PrintInformationProcess/0
|
||||
*
|
||||
* DESCRIPTION
|
||||
*/
|
||||
PRIVATE VOID STDCALL PrintInformationProcess (VOID)
|
||||
{
|
||||
|
||||
TRACE;
|
||||
|
||||
vtputs ("Leader:");
|
||||
vtprintf (" UniqueProcess %08x\n", Session.Client.UniqueProcess);
|
||||
vtprintf (" UniqueThread %08x\n", Session.Client.UniqueThread);
|
||||
}
|
||||
/**********************************************************************
|
||||
* PostMortem/0
|
||||
*
|
||||
* DESCRIPTION
|
||||
*/
|
||||
PRIVATE INT STDCALL PostMortem (VOID)
|
||||
{
|
||||
DWORD ExitCode;
|
||||
|
||||
TRACE;
|
||||
|
||||
|
||||
PrintInformationProcess ();
|
||||
if (TRUE == GetExitCodeProcess (Session.Client.UniqueProcess, & ExitCode))
|
||||
{
|
||||
vtprintf (" ExitCode %d\n", ExitCode);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**********************************************************************
|
||||
* InputTerminalEmulator/0
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Process user terminal input.
|
||||
*
|
||||
* NOTE
|
||||
* This code is run in the main thread.
|
||||
*/
|
||||
PRIVATE BOOL STDCALL InputTerminalEmulator (VOID)
|
||||
{
|
||||
HANDLE StandardInput;
|
||||
INPUT_RECORD InputRecord [INPUT_QUEUE_SIZE];
|
||||
DWORD NumberOfEventsRead = 0;
|
||||
INT CurrentEvent;
|
||||
|
||||
|
||||
TRACE;
|
||||
|
||||
StandardInput = GetStdHandle (STD_INPUT_HANDLE);
|
||||
if (INVALID_HANDLE_VALUE == StandardInput)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
while ((TRUE == Session.SsLinkIsActive) &&
|
||||
ReadConsoleInput (
|
||||
StandardInput,
|
||||
InputRecord,
|
||||
(sizeof InputRecord) / sizeof (INPUT_RECORD),
|
||||
& NumberOfEventsRead
|
||||
))
|
||||
{
|
||||
for ( CurrentEvent = 0;
|
||||
(CurrentEvent < NumberOfEventsRead);
|
||||
CurrentEvent ++
|
||||
)
|
||||
{
|
||||
switch (InputRecord [CurrentEvent].EventType)
|
||||
{
|
||||
case KEY_EVENT:
|
||||
OutPort (& InputRecord [CurrentEvent].Event.KeyEvent.uChar.AsciiChar, 1);
|
||||
break;
|
||||
case MOUSE_EVENT:
|
||||
/* TODO: send a sequence of move cursor codes */
|
||||
/* InputRecord [CurrentEvent].Event.MouseEvent; */
|
||||
break;
|
||||
case WINDOW_BUFFER_SIZE_EVENT:
|
||||
/* TODO: send a SIGWINCH signal to the leader process. */
|
||||
/* InputRecord [CurrentEvent].Event.WindowBufferSizeEvent.dwSize; */
|
||||
break;
|
||||
/* Next events should be ignored. */
|
||||
case MENU_EVENT:
|
||||
vtprintf ("%s: %s: MENU_EVENT received from CSRSS\n", MyName, __FUNCTION__);
|
||||
case FOCUS_EVENT:
|
||||
vtprintf ("%s: %s: FOCUS_EVENT received from CSRSS\n", MyName, __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
NumberOfEventsRead = 0;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
/**********************************************************************
|
||||
* Startup/1
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Initialize the program.
|
||||
*/
|
||||
PRIVATE VOID STDCALL Startup (LPSTR Command)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
DWORD ThreadId;
|
||||
|
||||
|
||||
TRACE;
|
||||
|
||||
/* PSX process info */
|
||||
Session.Client.UniqueProcess = INVALID_HANDLE_VALUE;
|
||||
Session.Client.UniqueThread = INVALID_HANDLE_VALUE;
|
||||
/* Initialize the VT-100 emulator */
|
||||
vtInitVT100 ();
|
||||
/* Connect to PSXSS */
|
||||
Status = InitializeSsIoChannel ();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
vtprintf ("%s: failed to connect to PSXSS (Status=%08x)!\n",
|
||||
MyName, Status);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
/* Create the leading process for this session */
|
||||
Status = PsxCreateLeaderProcess (Command);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
vtprintf ("%s: failed to create the PSX process (Status=%08x)!\n",
|
||||
MyName, Status);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
/**********************************************************************
|
||||
* Shutdown/0 PRIVATE
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Shutdown the program.
|
||||
*/
|
||||
PRIVATE INT STDCALL Shutdown (VOID)
|
||||
{
|
||||
|
||||
TRACE;
|
||||
|
||||
/* TODO: try exiting cleanly: close any open resource */
|
||||
/* TODO: notify PSXSS the session is terminating */
|
||||
RtlDeleteCriticalSection (& Session.Lock);
|
||||
return PostMortem ();
|
||||
}
|
||||
/**********************************************************************
|
||||
*
|
||||
* ENTRY POINT PUBLIC
|
||||
*
|
||||
*********************************************************************/
|
||||
int main (int argc, char * argv [])
|
||||
{
|
||||
|
||||
TRACE;
|
||||
|
||||
Startup (argv[1]); /* Initialization */
|
||||
InputTerminalEmulator (); /* Process user input */
|
||||
return Shutdown ();
|
||||
}
|
||||
/* EOF */
|
@@ -1,53 +0,0 @@
|
||||
#ifndef _CSRTERM_H
|
||||
#define _CSRTERM_H
|
||||
|
||||
/* PSX session: CSR terminal emulator side */
|
||||
|
||||
#define NAME_BUFFER_SIZE 64
|
||||
|
||||
typedef struct _PSXSS_PORT
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
WCHAR NameBuffer [NAME_BUFFER_SIZE];
|
||||
HANDLE Handle;
|
||||
|
||||
} PSXSS_PORT, * PPSXSS_PORT;
|
||||
|
||||
typedef struct _CSRTERM_SESSION_PORT
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
WCHAR NameBuffer [NAME_BUFFER_SIZE];
|
||||
HANDLE Handle;
|
||||
struct {
|
||||
HANDLE Handle;
|
||||
DWORD Id;
|
||||
} Thread;
|
||||
|
||||
} CSRTERM_SESSION_PORT;
|
||||
|
||||
typedef struct _CSRTERM_SESSION_SECTION
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
WCHAR NameBuffer [NAME_BUFFER_SIZE];
|
||||
HANDLE Handle;
|
||||
ULONG Size;
|
||||
PVOID BaseAddress;
|
||||
ULONG ViewSize;
|
||||
|
||||
} CSRTERM_SESSION_SECTION;
|
||||
|
||||
typedef struct _CSRTERM_SESSION
|
||||
{
|
||||
ULONG Identifier; /* PortID for ServerPort in PSXSS */
|
||||
PSXSS_PORT ServerPort; /* \POSIX+\SessionPort */
|
||||
CSRTERM_SESSION_PORT Port; /* \POSIX+\Sessions\P<pid> */
|
||||
CSRTERM_SESSION_SECTION Section; /* \POSIX+\Sessions\D<pid> */
|
||||
CLIENT_ID Client;
|
||||
CRITICAL_SECTION Lock;
|
||||
BOOL SsLinkIsActive;
|
||||
|
||||
} CSRTERM_SESSION, * PCSRTERM_SESSION;
|
||||
|
||||
#define LOCK_SESSION RtlEnterCriticalSection(& Session.Lock)
|
||||
#define UNLOCK_SESSION RtlLeaveCriticalSection(& Session.Lock)
|
||||
#endif /* ndef _CSRTERM_H */
|
@@ -1,12 +0,0 @@
|
||||
/* $Id: posixw32.rc,v 1.5 2004/10/31 20:11:09 ea Exp $ */
|
||||
#include <defines.h>
|
||||
#include <reactos/resource.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "W32 Terminal Emulator for POSIX+\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "posixw32\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "posixw32.exe\0"
|
||||
#include <reactos/version.rc>
|
||||
|
||||
/* EOF */
|
@@ -1,80 +0,0 @@
|
||||
$Id: readme.txt,v 1.3 2002/10/29 04:45:05 rex Exp $
|
||||
|
||||
posixw32 - a Win32 client terminal emulator for the POSIX+ subsystem
|
||||
|
||||
SYNOPSYS
|
||||
|
||||
posixw32 [program]
|
||||
|
||||
program program to be run in the terminal; if none is given,
|
||||
the shell for the current user (W32 session's) is
|
||||
used.
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
posixw32 emulates a DEC VT-100 terminal (on top of the CSRSS
|
||||
subsystem, hence the name) which is the controlling terminal
|
||||
for a process [program] running in the context of the PSX
|
||||
subsystem. posixw32 is a Win32 console application, not a PSX
|
||||
application. The process created by the PSX subsystem on behalf
|
||||
of posixw32 is not the child of the posixw32 instance that
|
||||
requested it. posixw32 simply performs terminal I/O in the CSRSS
|
||||
world (the W32 world!) for [program].
|
||||
|
||||
NOTES
|
||||
|
||||
The role of posixw32 is creating a session in the PSX subsystem
|
||||
managing any I/O for it. This is how it works:
|
||||
|
||||
1. posixw32 creates two well known named objects in the system
|
||||
name space that will allow the PSX subsystem server to build
|
||||
the I/O channel for the session. To let the PSX subsystem
|
||||
process recognize the objects, they contain a numeric suffix
|
||||
which is the process identifier (n) the system gives to each
|
||||
instance of posixw32:
|
||||
|
||||
\POSIX+\Session\Pn LPC port (IPC rendez-vous object)
|
||||
\POSIX+\Session\Dn section (shared memory object)
|
||||
|
||||
posixw32 also creates a new thread to manage the calls though
|
||||
the LPC port. Port Pn is used by the subsystem to control the
|
||||
terminal which posixw32 emulates.
|
||||
|
||||
2. posixw32 connects to the PSX subsystem session port
|
||||
|
||||
\POSIX+\SessionPort
|
||||
|
||||
and asks the subsystem to create a new session.
|
||||
|
||||
3. The PSX subsystem, if it decides to accept the request, creates
|
||||
a new session for that calling instance of posixw32 (n), and in
|
||||
turn connects back to the terminal control port
|
||||
|
||||
\POSIX+\Session\Pn
|
||||
|
||||
4. When posixw32 makes the PSX subsystem create the new session, it
|
||||
also tells the subsystem what program should be the session
|
||||
leader process. The PSX subsystem creates that process (the
|
||||
image file to start must be marked IMAGE_SUBSYSTEM_POSIX_GUI or
|
||||
IMAGE_SUBSYSTEM_POSIX_CUI).
|
||||
|
||||
5. The requested process [program] runs in the context of the
|
||||
PSX subsystem and performs any terminal I/O via the channel
|
||||
posixw32 and the PSX susbstem created.
|
||||
|
||||
REVISIONS
|
||||
2001-05-05 created
|
||||
2002-03-03 simplified
|
||||
2002-06-08 renamed to avoid future name clash
|
||||
|
||||
AUTHOR
|
||||
|
||||
Emanuele Aliberti <ea@iol.it>
|
||||
|
||||
CREDITS
|
||||
|
||||
John L. Miller (johnmil@cs.cmu.edu, johnmil@jprc.com) code for
|
||||
a basic VT-100 emulator for Win32 consoles is used to process
|
||||
tc* calls output.
|
||||
|
||||
EOF
|
File diff suppressed because it is too large
Load Diff
@@ -1,320 +0,0 @@
|
||||
/* vt100.h
|
||||
*
|
||||
* AUTHOR: John L. Miller, johnmil@cs.cmu.edu / johnmil@jprc.com
|
||||
* DATE: 8/4/96
|
||||
*
|
||||
* Copyright (c) 1996 John L. Miller
|
||||
*
|
||||
* Full permission is granted to use, modify and distribute
|
||||
* this code, provided:
|
||||
* 1) This comment field is included in its entirity
|
||||
* 2) No money is charged for any work including or based on
|
||||
* portions of this code.
|
||||
*
|
||||
* If you're a nice person and find this useful, I'd appreciate a
|
||||
* note letting me know about it. e-mail is usually what spurs me
|
||||
* on to improve and support software I've written.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* This identifier should be spit back to the computer when a terminal
|
||||
* id is requested.
|
||||
*/
|
||||
#define ANSWERBACK_MESSAGE "vt100"
|
||||
|
||||
/* Various terminal-related modes Entries are as follows:
|
||||
* Identification esc. ID If set, if clear
|
||||
*/
|
||||
|
||||
/* Keyboard action 2 Locked Unlocked */
|
||||
#define CAPS_MODE 0x00000001
|
||||
/* Insertion 4 Insert Overwrite */
|
||||
#define INSERT_MODE 0x00000002
|
||||
/* Send - Receive 12 Full Echo */
|
||||
#define FULLDUPLEX_MODE 0x00000004
|
||||
/* Line feed/New line 20 New line Line feed */
|
||||
#define NEWLINE_MODE 0x00000008
|
||||
|
||||
|
||||
#define NUM_TERM_ATTR_MODES 9 /* We only track eight '?' escape sequences */
|
||||
|
||||
/* Cursor key ?1 Application Cursor */
|
||||
#define CURSORAPPL_MODE 0x00000010
|
||||
/* ANSI/VT52 ?2 ANSI VT52 */
|
||||
#define ANSI_MODE 0x00000020
|
||||
/* Column ?3 132 80 */
|
||||
#define COL132_MODE 0x00000040
|
||||
/* Scrolling ?4 Smooth Jump */
|
||||
#define SMOOTHSCROLL_MODE 0x00000080
|
||||
/* Screen ?5 Reverse Normal */
|
||||
#define REVSCREEN_MODE 0x00000100
|
||||
/* Origin ?6 Relative Absolute */
|
||||
#define ORIGINREL_MODE 0x00000200
|
||||
/* Wraparound ?7 Wrap Truncate */
|
||||
#define WRAP_MODE 0x00000400
|
||||
/* Auto key repeat ?8 Repeating No repeat */
|
||||
#define REPEAT_MODE 0x00000800
|
||||
|
||||
|
||||
/* Print form feed ?18 Yes No */
|
||||
#define PRINTFF_MODE 0x00001000
|
||||
/* Print extent ?19 Full screen Scrolling region */
|
||||
#define PRINTFULLSCR_MODE 0x00002000
|
||||
/* Keypad application 'Esc =' numeric 'Esc >' */
|
||||
#define KEYPADNUMERIC_MODE 0x00004000
|
||||
/* default mode that we start the emulator with */
|
||||
#define DEFAULT_MODE (NEWLINE_MODE|ANSI_MODE|REPEAT_MODE)
|
||||
|
||||
/* This constant is VERY important - the size of the buffer for
|
||||
* unprocessed vt-100 prints!
|
||||
*/
|
||||
#define MAXVTBUFLEN 4096
|
||||
|
||||
/* Constants used in place of actual row and column numbers
|
||||
* for the cursor movement and text erasing and deleting functions.
|
||||
*/
|
||||
#define CUR_ROW -999
|
||||
#define CUR_COL -999
|
||||
#define ALL_TABS -1999
|
||||
|
||||
#define LEFT_EDGE 0
|
||||
#define RIGHT_EDGE 12000
|
||||
#define TOP_EDGE 0
|
||||
#define BOTTOM_EDGE 12000
|
||||
|
||||
/* Text attribute definitions; color, font, bold. */
|
||||
#define NUM_SC_ATTRIBUTES 11
|
||||
|
||||
#define SC_RED 0x0001
|
||||
#define SC_GREEN 0x0002
|
||||
#define SC_BLUE 0x0004
|
||||
#define SC_BOLD 0x0010
|
||||
#define SC_UL 0x0020 /* Underlined */
|
||||
#define SC_BL 0x0040 /* Blinking */
|
||||
#define SC_RV 0x0080 /* Reverse video */
|
||||
#define SC_ASCII 0x0100 /* Normal ASCII (USASCII) */
|
||||
#define SC_G0 0x0200 /* graphics set G0 */
|
||||
#define SC_G1 0x0400 /* Graphics set G1 */
|
||||
#define SC_GRAPHICS 0x0800 /* Good question */
|
||||
|
||||
|
||||
/* forward variable declarations */
|
||||
|
||||
extern int termAttrMode[NUM_TERM_ATTR_MODES];
|
||||
extern int alltermAttrModes;
|
||||
|
||||
|
||||
/* prototypes from vt100.c */
|
||||
|
||||
/* functions meant for use outside of the emulator */
|
||||
|
||||
int vtputs(char *f);
|
||||
int vtprintf(char *format, ...);
|
||||
int vtInitVT100(void);
|
||||
int vtProcessedTextOut(char *cbuf, int count);
|
||||
|
||||
|
||||
/* Prototype for functions which MUST BE SUPPLIED BY THE BACK END!!! */
|
||||
|
||||
/* Back-end specific initialization is performed in this function.
|
||||
* this is gauranteed to be called before any other requests are made
|
||||
* of the back end.
|
||||
*/
|
||||
|
||||
/* beInitVT100Terminal() -
|
||||
*
|
||||
* This function is called by the VT100 emulator as soon as the
|
||||
* front-end terminal is initialized. It's responsible for setting
|
||||
* initial state of the terminal, and initing our many wacky variables.
|
||||
*/
|
||||
int beInitVT100Terminal();
|
||||
|
||||
|
||||
/* beAbsoluteCursor -
|
||||
*
|
||||
* Given an input row and column, move the cursor to the
|
||||
* absolute screen coordinates requested. Note that if the
|
||||
* display window has scrollbars, the column is adjusted
|
||||
* to take that into account, but the row is not. This allows
|
||||
* for large scrollback in terminal windows.
|
||||
*
|
||||
* ROW must be able to accept CUR_ROW, TOP_EDGE, BOTTOM_EDGE,
|
||||
* or a row number.
|
||||
*
|
||||
* COLUMN must be able to accept CUR_COL, LEFT_EDGE, RIGHT_EDGE,
|
||||
* or a column number.
|
||||
*/
|
||||
int beAbsoluteCursor(int row, int col);
|
||||
|
||||
|
||||
/* beOffsetCursor -
|
||||
*
|
||||
* Given an input row and column offset, move the cursor by that
|
||||
* many positions. For instance, row=0 and column=-1 would move
|
||||
* the cursor left a single column.
|
||||
*
|
||||
* If the cursor can't move the requested amount, results are
|
||||
* unpredictable.
|
||||
*/
|
||||
int beOffsetCursor(int row, int column);
|
||||
|
||||
|
||||
/* beRestoreCursor -
|
||||
*
|
||||
* Saved cursor position should be stored in a static
|
||||
* variable in the back end. This function restores the
|
||||
* cursor to the position stored in that variable.
|
||||
*/
|
||||
int beRestoreCursor(void);
|
||||
|
||||
|
||||
/* beSaveCursor -
|
||||
*
|
||||
* The back-end should maintain a static variable with the
|
||||
* last STORED cursor position in it. This function replaces
|
||||
* the contents of that variable with the current cursor position.
|
||||
* The cursor may be restored to this position by using the
|
||||
* beRestoreCursor function.
|
||||
*/
|
||||
int beSaveCursor(void);
|
||||
|
||||
|
||||
/* beGetTextAttributes -
|
||||
*
|
||||
* given a pointer to 'fore'ground and 'back'ground ints,
|
||||
* fill them with a device-independant description of the
|
||||
* current foreground and background colors, as well as any
|
||||
* font information in the foreground variable.
|
||||
*/
|
||||
int beGetTextAttributes(int *fore, int *back);
|
||||
|
||||
|
||||
/* beSetTextAttributes -
|
||||
*
|
||||
* Given a foreground and a background device independant (SC) color and font
|
||||
* specification, apply these to the display, and save the state in the
|
||||
* static screen variables.
|
||||
*
|
||||
* Note that many font-specific constants (bold/underline/reverse, G0/G1/ASCII)
|
||||
* are stored ONLY in the foreground specification.
|
||||
*/
|
||||
int beSetTextAttributes(int fore, int back);
|
||||
|
||||
|
||||
/* beRawTextOut-
|
||||
*
|
||||
* The name of this function is misleading. Given a pointer to
|
||||
* ascii text and a count of bytes to print, print them to the
|
||||
* display device. If wrapping is enabled, wrap text. If there is a
|
||||
* scrolling region set and the cursor is in it,
|
||||
* scroll only within that region. 'beRawTextOut' means that it's guaranteed
|
||||
* not to have control sequences within the text.
|
||||
*/
|
||||
int beRawTextOut(char *text, int len);
|
||||
|
||||
|
||||
/* beEraseText -
|
||||
*
|
||||
* Given a 'from' and a 'to' position in display coordinates,
|
||||
* this function will fill in all characters between the two
|
||||
* (inclusive) with spaces. Note that the coordinates do NOT
|
||||
* specify a rectangle. erasing from (1,1) to (2,2) erases
|
||||
* all of the first row, and the first two characters of the
|
||||
* second.
|
||||
*
|
||||
* Note that this routine must be able to handle TOP_EDGE,
|
||||
* BOTTOM_EDGE, LEFT_EDGE, RIGHT_EDGE, CUR_ROW, and CUR_COL
|
||||
* in the appropriate parameters.
|
||||
*/
|
||||
int beEraseText(int rowFrom, int colFrom, int rowTo, int colTo);
|
||||
|
||||
|
||||
/* beDeleteText -
|
||||
*
|
||||
* Given a screen cursor 'from' and 'to' position, this function
|
||||
* will delete all text between the two. Text will be scrolled
|
||||
* up as appropriate to fill the deleted space. Note that, as in
|
||||
* beEraseText, the two coordinates don't specify a rectangle, but
|
||||
* rather a starting position and ending position. In other words,
|
||||
* deleting from (1,1) to (2,2) should move the text from (2,3) to the
|
||||
* end of the second row to (1,1), move line 3 up to line 2, and so on.
|
||||
*
|
||||
* This function must be able to process TOP_EDGE, BOTTOM_EDGE, LEFT_EDGE,
|
||||
* RIGHT_EDGE, CUR_ROW, and CUR_COL specifications in the appropriate
|
||||
* variables as well as regular row and column specifications.
|
||||
*/
|
||||
int beDeleteText(int rowFrom, int colFrom, int rowTo, int colTo);
|
||||
|
||||
|
||||
/* beInsertRow -
|
||||
*
|
||||
* Given a row number or CUR_ROW, TOP_EDGE or BOTTOM_EDGE as an input,
|
||||
* this function will scroll all text from the current row down down by one,
|
||||
* and create a blank row under the cursor.
|
||||
*/
|
||||
int beInsertRow(int row);
|
||||
|
||||
|
||||
/* beTransmitText -
|
||||
*
|
||||
* Given a pointer to text and byte count, this routine should transmit data
|
||||
* to whatever host made the request it's responding to. Typically this routin
|
||||
* should transmit data as though the user had typed it in.
|
||||
*/
|
||||
int beTransmitText(char *text, int len);
|
||||
|
||||
|
||||
/* beAdvanceToTab -
|
||||
*
|
||||
* This routine will destructively advance the cursor to the
|
||||
* next set tab, or to the end of the line if there are no
|
||||
* more tabs to the right of the cursor.
|
||||
*/
|
||||
|
||||
int beAdvanceToTab(void);
|
||||
|
||||
|
||||
/* beClearTab -
|
||||
*
|
||||
* This function accepts a constant, and will try to clear tabs
|
||||
* appropriately. Its argument is either
|
||||
* ALL_TABS, meaning all tabs should be removed
|
||||
* CUR_COL, meaning the tab in the current column should be wiped, or
|
||||
* a column value, meaning if there's a tab there it should be wiped.
|
||||
*
|
||||
*/
|
||||
int beClearTab(int col);
|
||||
|
||||
|
||||
/* beSetScrollingRows -
|
||||
*
|
||||
* Given a pair of row numbers, this routine will set the scrolling
|
||||
* rows to those values. Note that this routine will accept
|
||||
* TOP_ROW and BOTTOM_ROW as values, meaning that scrolling should
|
||||
* be enabled for the entire display, regardless of resizing.
|
||||
*/
|
||||
int beSetScrollingRows(int fromRow, int toRow);
|
||||
|
||||
|
||||
/* beRingBell -
|
||||
*
|
||||
* Ring the system bell once.
|
||||
*/
|
||||
int beRingBell(void);
|
||||
|
||||
|
||||
/* beGetTermMode -
|
||||
*
|
||||
* Return the value of conTermMode, which is the terminal settings which
|
||||
* can be queried/set by <esc>[?#h/l.
|
||||
*/
|
||||
int beGetTermMode();
|
||||
|
||||
|
||||
/* beSetTermMode -
|
||||
*
|
||||
* Set the terminal as requested, assuming we can. Right now we only handle a
|
||||
* couple of the possible flags, but we store many of the others.
|
||||
*/
|
||||
int beSetTermMode(int newMode);
|
@@ -1,74 +0,0 @@
|
||||
/* $Id: aio.h,v 1.4 2002/10/29 04:45:06 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* aio.h
|
||||
*
|
||||
* asynchronous input and output (REALTIME). Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __AIO_H_INCLUDED__
|
||||
#define __AIO_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
typedef struct _tag_aiocb
|
||||
{
|
||||
int aio_fildes; /* file descriptor */
|
||||
off_t aio_offset; /* file offset */
|
||||
volatile void* aio_buf; /* location of buffer */
|
||||
size_t aio_nbytes; /* length of transfer */
|
||||
int aio_reqprio; /* request priority offset */
|
||||
struct sigevent aio_sigevent; /* signal number and value */
|
||||
int aio_lio_opcode; /* operation to be performed */
|
||||
} aiocb;
|
||||
|
||||
/* CONSTANTS */
|
||||
#define AIO_CANCELED 0
|
||||
#define AIO_NOTCANCELED 1
|
||||
#define AIO_ALLDONE 2
|
||||
|
||||
#define LIO_WAIT 0
|
||||
#define LIO_NOWAIT 1
|
||||
#define LIO_READ 2
|
||||
#define LIO_WRITE 3
|
||||
#define LIO_NOP 4
|
||||
|
||||
/* PROTOTYPES */
|
||||
int aio_cancel(int, struct aiocb *);
|
||||
int aio_error(const struct aiocb *);
|
||||
int aio_fsync(int, struct aiocb *);
|
||||
int aio_read(struct aiocb *);
|
||||
ssize_t aio_return(struct aiocb *);
|
||||
int aio_suspend(const struct aiocb *const[], int, const struct timespec *);
|
||||
int aio_write(struct aiocb *);
|
||||
int lio_listio(int, struct aiocb *const[], int, struct sigevent *);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __AIO_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,56 +0,0 @@
|
||||
/* $Id: inet.h,v 1.4 2002/10/29 04:45:06 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* arpa/inet.h
|
||||
*
|
||||
* definitions for internet operations. Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __ARPA_INET_H_INCLUDED__
|
||||
#define __ARPA_INET_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <netinet/in.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
uint32_t htonl(uint32_t hostlong);
|
||||
uint16_t htons(uint16_t hostshort);
|
||||
uint32_t ntohl(uint32_t netlong);
|
||||
uint16_t ntohs(uint16_t netshort);
|
||||
|
||||
in_addr_t inet_addr(const char *cp);
|
||||
in_addr_t inet_lnaof(struct in_addr in);
|
||||
struct in_addr inet_makeaddr(in_addr_t net, in_addr_t lna);
|
||||
in_addr_t inet_netof(struct in_addr in);
|
||||
in_addr_t inet_network(const char *cp);
|
||||
char *inet_ntoa(struct in_addr in);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __ARPA_INET_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,58 +0,0 @@
|
||||
/* $Id: assert.h,v 1.5 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* assert.h
|
||||
*
|
||||
* verify program assertion. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __ASSERT_H_INCLUDED__
|
||||
#define __ASSERT_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
#ifdef NDEBUG
|
||||
#define assert(IGNORE) ((void) 0)
|
||||
#else /* !NDEBUG */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define assert(EXPRESSION) \
|
||||
if(!(EXPRESSION)) \
|
||||
{ \
|
||||
fputs("__FILE__, line __LINE__: assertion \"EXPRESSION\" failed\n", stderr); \
|
||||
abort(); \
|
||||
}
|
||||
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#endif /* __ASSERT_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,63 +0,0 @@
|
||||
/* $Id: cpio.h,v 1.4 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* cpio.h
|
||||
*
|
||||
* cpio archive values. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __CPIO_H_INCLUDED__
|
||||
#define __CPIO_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
#define C_IRUSR (0000400) /* read by owner */
|
||||
#define C_IWUSR (0000200) /* write by owner */
|
||||
#define C_IXUSR (0000100) /* execute by owner */
|
||||
#define C_IRGRP (0000040) /* read by group */
|
||||
#define C_IWGRP (0000020) /* write by group */
|
||||
#define C_IXGRP (0000010) /* execute by group */
|
||||
#define C_IROTH (0000004) /* read by others */
|
||||
#define C_IWOTH (0000002) /* write by others */
|
||||
#define C_IXOTH (0000001) /* execute by others */
|
||||
#define C_ISUID (0004000) /* set user ID */
|
||||
#define C_ISGID (0002000) /* set group ID */
|
||||
#define C_ISVTX (0001000) /* on directories, restricted deletion flag */
|
||||
#define C_ISDIR (0040000) /* directory */
|
||||
#define C_ISFIFO (0010000) /* FIFO */
|
||||
#define C_ISREG (0100000) /* regular file */
|
||||
#define C_ISBLK (0060000) /* block special */
|
||||
#define C_ISCHR (0020000) /* character special */
|
||||
#define C_ISCTG (0110000) /* reserved */
|
||||
#define C_ISLNK (0120000) /* symbolic link */
|
||||
#define C_ISSOCK (0140000) /* socket */
|
||||
|
||||
#define MAGIC "070707"
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __CPIO_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,61 +0,0 @@
|
||||
/* $Id: ctype.h,v 1.4 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* ctype.h
|
||||
*
|
||||
* character types. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __CTYPE_H_INCLUDED__
|
||||
#define __CTYPE_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int isalnum(int);
|
||||
int isalpha(int);
|
||||
int isascii(int);
|
||||
int iscntrl(int);
|
||||
int isdigit(int);
|
||||
int isgraph(int);
|
||||
int islower(int);
|
||||
int isprint(int);
|
||||
int ispunct(int);
|
||||
int isspace(int);
|
||||
int isupper(int);
|
||||
int isxdigit(int);
|
||||
int toascii(int);
|
||||
int tolower(int);
|
||||
int toupper(int);
|
||||
|
||||
/* MACROS */
|
||||
/* FIXME: the standard isn't clear about these */
|
||||
#define _toupper(c) (toupper(c))
|
||||
#define _tolower(c) (tolower(c))
|
||||
|
||||
#endif /* __CTYPE_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,73 +0,0 @@
|
||||
/* $Id: dirent.h,v 1.6 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* dirent.h
|
||||
*
|
||||
* format of directory entries. Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __DIRENT_H_INCLUDED__
|
||||
#define __DIRENT_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* TYPES */
|
||||
typedef void DIR;
|
||||
|
||||
#define NAME_MAX (255)
|
||||
|
||||
struct dirent
|
||||
{
|
||||
ino_t d_ino; /* file serial number */
|
||||
char * d_name /* [NAME_MAX + 1] */; /* name of entry */
|
||||
};
|
||||
|
||||
/* for Unicode filenames */
|
||||
struct _Wdirent
|
||||
{
|
||||
ino_t d_ino; /* file serial number */
|
||||
wchar_t * d_name/* [NAME_MAX + 1] */; /* name of entry */
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int closedir(DIR *);
|
||||
DIR *opendir(const char *);
|
||||
struct dirent *readdir(DIR *);
|
||||
int readdir_r(DIR *, struct dirent *, struct dirent **);
|
||||
void rewinddir(DIR *);
|
||||
void seekdir(DIR *, long int);
|
||||
long int telldir(DIR *);
|
||||
|
||||
/* for Unicode filenames */
|
||||
DIR *_Wopendir(const wchar_t *);
|
||||
struct _Wdirent *_Wreaddir(DIR *);
|
||||
int _Wreaddir_r(DIR *, struct _Wdirent *, struct _Wdirent **);
|
||||
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __DIRENT_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,58 +0,0 @@
|
||||
/* $Id: dlfcn.h,v 1.4 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* dlfcn.h
|
||||
*
|
||||
* dynamic linking. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __DLFCN_H_INCLUDED__
|
||||
#define __DLFCN_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
#define RTLD_LAZY (0x00000000) /* Relocations are performed at an \
|
||||
implementation-dependent time. */
|
||||
#define RTLD_NOW (0x00000001) /* Relocations are performed when \
|
||||
the object is loaded. */
|
||||
|
||||
#define RTLD_GLOBAL (0x00000010) /* All symbols are available for \
|
||||
relocation processing of other \
|
||||
modules. */
|
||||
#define RTLD_LOCAL (0x00000020) /* All symbols are not made available \
|
||||
for relocation processing by other \
|
||||
modules. */
|
||||
|
||||
#define RTLD_NEXT ((void *)(-1))
|
||||
|
||||
/* PROTOTYPES */
|
||||
void *dlopen(const char *, int);
|
||||
void *dlsym(void *, const char *);
|
||||
int dlclose(void *);
|
||||
char *dlerror(void);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __DLFCN_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,131 +0,0 @@
|
||||
/* $Id: errno.h,v 1.5 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* errno.h
|
||||
*
|
||||
* system error numbers. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __ERRNO_H_INCLUDED__
|
||||
#define __ERRNO_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
/* errors from 0 to 42 are the same as in Microsoft POSIX */
|
||||
#define EZERO ( 0) /* No error. */
|
||||
#define EPERM ( 1) /* Operation not permitted. */
|
||||
#define ENOENT ( 2) /* No such file or directory. */
|
||||
#define ESRCH ( 3) /* No such process. */
|
||||
#define EINTR ( 4) /* Interrupted function. */
|
||||
#define EIO ( 5) /* I/O error. */
|
||||
#define ENXIO ( 6) /* No such device or address. */
|
||||
#define E2BIG ( 7) /* Argument list too long. */
|
||||
#define ENOEXEC ( 8) /* Executable file format error. */
|
||||
#define EBADF ( 9) /* Bad file descriptor. */
|
||||
#define ECHILD ( 10) /* No child processes. */
|
||||
#define EAGAIN ( 11) /* Resource unavailable, try again */
|
||||
#define ENOMEM ( 12) /* Not enough space. */
|
||||
#define EACCES ( 13) /* Permission denied. */
|
||||
#define EFAULT ( 14) /* Bad address. */
|
||||
#define ENOTBLK ( 15) /* Reserved. */
|
||||
#define EBUSY ( 16) /* Device or resource busy. */
|
||||
#define EEXIST ( 17) /* File exists. */
|
||||
#define EXDEV ( 18) /* Cross-device link. */
|
||||
#define ENODEV ( 19) /* No such device. */
|
||||
#define ENOTDIR ( 20) /* Not a directory. */
|
||||
#define EISDIR ( 21) /* Is a directory. */
|
||||
#define EINVAL ( 22) /* Invalid argument. */
|
||||
#define ENFILE ( 23) /* Too many files open in system. */
|
||||
#define EMFILE ( 24) /* Too many open files. */
|
||||
#define ENOTTY ( 25) /* Inappropriate I/O control operation. */
|
||||
#define ETXTBSY ( 26) /* Text file busy. */
|
||||
#define EFBIG ( 27) /* File too large. */
|
||||
#define ENOSPC ( 28) /* No space left on device. */
|
||||
#define ESPIPE ( 29) /* Invalid seek. */
|
||||
#define EROFS ( 30) /* Read-only file system. */
|
||||
#define EMLINK ( 31) /* Too many links. */
|
||||
#define EPIPE ( 32) /* Broken pipe. */
|
||||
#define EDOM ( 33) /* Mathematics argument out of domain of function. */
|
||||
#define ERANGE ( 34) /* Result too large. */
|
||||
#define EUCLEAN ( 35) /* Reserved. */
|
||||
#define EDEADLK ( 36) /* Resource deadlock would occur. */
|
||||
#define UNKNOWN ( 37) /* Reserved. */
|
||||
#define ENAMETOOLONG ( 38) /* Filename too long. */
|
||||
#define ENOLCK ( 39) /* No locks available. */
|
||||
#define ENOSYS ( 40) /* Function not supported. */
|
||||
#define ENOTEMPTY ( 41) /* Directory not empty. */
|
||||
#define EILSEQ ( 42) /* Illegal byte sequence. */
|
||||
/* from this point, constants are in no particular order */
|
||||
#define ENODATA ( 44) /* No message is available on the STREAM head read queue. */
|
||||
#define ENOSR ( 45) /* No STREAM resources. */
|
||||
#define ENOSTR ( 46) /* Not a STREAM. */
|
||||
#define ECANCELED ( 47) /* Operation canceled. */
|
||||
#define ENOBUFS ( 48) /* No buffer space available. */
|
||||
#define EOVERFLOW ( 49) /* Value too large to be stored in data type. */
|
||||
#define ENOTSUP ( 50) /* Not supported. */
|
||||
#define EADDRINUSE ( 51) /* Address in use. */
|
||||
#define EADDRNOTAVAIL ( 52) /* Address not available. */
|
||||
#define EAFNOSUPPORT ( 53) /* Address family not supported. */
|
||||
#define ECONNABORTED ( 54) /* Connection aborted. */
|
||||
#define ECONNREFUSED ( 55) /* Connection refused. */
|
||||
#define ECONNRESET ( 56) /* Connection reset. */
|
||||
#define EALREADY ( 57) /* Connection already in progress. */
|
||||
#define EDESTADDRREQ ( 58) /* Destination address required. */
|
||||
#define EHOSTUNREACH ( 59) /* Host is unreachable. */
|
||||
#define EISCONN ( 60) /* Socket is connected. */
|
||||
#define ENETDOWN ( 61) /* Network is down. */
|
||||
#define ENETUNREACH ( 62) /* Network unreachable. */
|
||||
#define ENOPROTOOPT ( 63) /* Protocol not available. */
|
||||
#define ENOTCONN ( 64) /* The socket is not connected. */
|
||||
#define ENOTSOCK ( 65) /* Not a socket. */
|
||||
#define EPROTO ( 66) /* Protocol error. */
|
||||
#define EPROTONOSUPPORT ( 67) /* Protocol not supported. */
|
||||
#define EPROTOTYPE ( 68) /* Socket type not supported. */
|
||||
#define EOPNOTSUPP ( 69) /* Operation not supported on socket. */
|
||||
#define ETIMEDOUT ( 70) /* Connection timed out. */
|
||||
#define EINPROGRESS ( 71) /* Operation in progress. */
|
||||
#define EBADMSG ( 72) /* Bad message. */
|
||||
#define EMSGSIZE ( 73) /* Message too large. */
|
||||
#define ENOMSG ( 74) /* No message of the desired type. */
|
||||
#define EDQUOT ( 75) /* Reserved. */
|
||||
#define EIDRM ( 76) /* Identifier removed. */
|
||||
#define ELOOP ( 77) /* Too many levels of symbolic links. */
|
||||
#define EMULTIHOP ( 78) /* Reserved. */
|
||||
#define ENOLINK ( 79) /* Reserved. */
|
||||
#define ESTALE ( 80) /* Reserved. */
|
||||
#define ETIME ( 81) /* Streamioctl() timeout. */
|
||||
#define EWOULDBLOCK ( 82) /* Operation would block */
|
||||
|
||||
#define EDEADLOCK EDEADLK /* Resource deadlock avoided */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int * __PdxGetThreadErrNum(void); /* returns a pointer to the current thread's errno */
|
||||
|
||||
/* MACROS */
|
||||
#define errno (*__PdxGetThreadErrNum())
|
||||
|
||||
#endif /* __ERRNO_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,149 +0,0 @@
|
||||
/* $Id: fcntl.h,v 1.6 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* fcntl.h
|
||||
*
|
||||
* file control options. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __FCNTL_H_INCLUDED__
|
||||
#define __FCNTL_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
/*
|
||||
the structure flock describes a file lock
|
||||
*/
|
||||
struct flock
|
||||
{
|
||||
short l_type; /* type of lock; F_RDLCK, F_WRLCK, F_UNLCK */
|
||||
short l_whence; /* flag for starting offset */
|
||||
off_t l_start; /* relative offset in bytes */
|
||||
off_t l_len; /* size; if 0 then until EOF */
|
||||
pid_t l_pid; /* process ID of the process holding the lock;
|
||||
returned with F_GETLK */
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
/*
|
||||
values for cmd used by fcntl()
|
||||
*/
|
||||
enum __fcntl_cmd
|
||||
{
|
||||
F_DUPFD, /* duplicate file descriptor */
|
||||
F_GETFD, /* get file descriptor flags */
|
||||
F_GETLK, /* get record locking information */
|
||||
F_SETFD, /* set file descriptor flags */
|
||||
F_GETFL, /* get file status flags and file access modes */
|
||||
F_SETFL, /* set file status flags */
|
||||
F_SETLK, /* set record locking information */
|
||||
F_SETLKW, /* set record locking information; wait if blocked */
|
||||
/* ReactOS-specific */
|
||||
F_NEWFD, /* create new file descriptor */
|
||||
F_DELFD, /* delete file descriptor */
|
||||
F_GETALL, /* get a copy of the internal descriptor object */
|
||||
F_SETALL, /* initialize internal descriptor object */
|
||||
F_GETXP, /* get file descriptor extra data pointer */
|
||||
F_SETXP, /* set file descriptor extra data pointer */
|
||||
F_GETXS, /* get file descriptor extra data size */
|
||||
F_SETXS, /* set file descriptor extra data size */
|
||||
F_GETFH, /* get file handle */
|
||||
F_SETFH /* set file handle */
|
||||
};
|
||||
|
||||
/*
|
||||
file descriptor flags used for fcntl()
|
||||
*/
|
||||
/* Close the file descriptor upon execution of an exec family function. */
|
||||
#define FD_CLOEXEC (0x00000001)
|
||||
|
||||
/*
|
||||
values for l_type used for record locking with fcntl()
|
||||
*/
|
||||
/* Shared or read lock. */
|
||||
#define F_RDLCK (1)
|
||||
/* Unlock. */
|
||||
#define F_UNLCK (2)
|
||||
/* Exclusive or write lock. */
|
||||
#define F_WRLCK (3)
|
||||
|
||||
/*
|
||||
file flags used for open()
|
||||
*/
|
||||
/* Create file if it does not exist. */
|
||||
#define O_CREAT (0x00000100)
|
||||
/* Truncate flag. */
|
||||
#define O_TRUNC (0x00000200)
|
||||
/* Exclusive use flag. */
|
||||
#define O_EXCL (0x00000400)
|
||||
/* Do not assign controlling terminal. */
|
||||
#define O_NOCTTY (0x00000800)
|
||||
/* ReactOS-specific */
|
||||
/* File must be a directory */
|
||||
#define _O_DIRFILE (0x00100000)
|
||||
|
||||
/*
|
||||
file status flags used for open() and fcntl()
|
||||
*/
|
||||
/* Set append mode. */
|
||||
#define O_APPEND (0x00000008)
|
||||
/* Non-blocking mode. */
|
||||
#define O_NONBLOCK (0x00001000)
|
||||
/* Write according to synchronised I/O data integrity completion. */
|
||||
#define O_DSYNC (0x00002000)
|
||||
/* Synchronised read I/O operations. */
|
||||
#define O_RSYNC (0x00004000)
|
||||
/* Write according to synchronised I/O file integrity completion. */
|
||||
#define O_SYNC (0x00008000)
|
||||
|
||||
/*
|
||||
file access modes used for open() and fcntl()
|
||||
*/
|
||||
/* Open for reading only. */
|
||||
#define O_RDONLY (0x00000000)
|
||||
/* Open for writing only. */
|
||||
#define O_WRONLY (0x00000001)
|
||||
/* Open for reading and writing. */
|
||||
#define O_RDWR (0x00000002)
|
||||
|
||||
/*
|
||||
mask for use with file access modes
|
||||
*/
|
||||
#define O_ACCMODE (0x00000007)
|
||||
|
||||
/* PROTOTYPES */
|
||||
int creat(const char *, mode_t);
|
||||
int fcntl(int, int, ...);
|
||||
int open(const char *, int, ...);
|
||||
|
||||
int _Wcreat(const wchar_t *, mode_t);
|
||||
int _Wopen(const wchar_t *, int, ...);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __FCNTL_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,93 +0,0 @@
|
||||
/* $Id: fmtmsg.h,v 1.4 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* fmtmsg.h
|
||||
*
|
||||
* message display structures. Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __FMTMSG_H_INCLUDED__
|
||||
#define __FMTMSG_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
/* Major Classifications */
|
||||
/* NOTE: these are unique values, not flags. Their bits can overlap, but
|
||||
cannot overlap with those of other categories */
|
||||
#define MM_HARD (0x00000001) /* Source of the condition is hardware. */
|
||||
#define MM_SOFT (0x00000002) /* Source of the condition is software. */
|
||||
#define MM_FIRM (0x00000003) /* Source of the condition is firmware. */
|
||||
|
||||
/* Message Source Subclassifications */
|
||||
/* NOTE: these are unique values, not flags. Their bits can overlap, but
|
||||
cannot overlap with those of other categories */
|
||||
#define MM_APPL (0x00000010) /* Condition detected by application. */
|
||||
#define MM_UTIL (0x00000020) /* Condition detected by utility. */
|
||||
#define MM_OPSYS (0x00000030) /* Condition detected by operating system. */
|
||||
|
||||
/* Status Subclassifications */
|
||||
/* NOTE: these are unique values, not flags. Their bits can overlap, but
|
||||
cannot overlap with those of other categories */
|
||||
#define MM_RECOVER (0x00000100) /* Recoverable error. */
|
||||
#define MM_NRECOV (0x00000200) /* Non-recoverable error. */
|
||||
|
||||
/* Display Subclassifications */
|
||||
/* NOTE: these, unlike other classification constants, are flags. Their
|
||||
bits must be distinct */
|
||||
#define MM_PRINT (0x00001000) /* Display message on standard error. */
|
||||
#define MM_CONSOLE (0x00002000) /* Display message on system console. */
|
||||
|
||||
/* Identifiers for the levels of severity */
|
||||
#define MM_NOSEV (0) /* No severity level provided for the message. */
|
||||
#define MM_INFO (1) /* Informative message. */
|
||||
#define MM_WARNING (2) /* Application has detected unusual non-error \
|
||||
condition. */
|
||||
#define MM_ERROR (3) /* Application has encountered a non-fatal fault. */
|
||||
#define MM_HALT (4) /* Error causing application to halt. */
|
||||
|
||||
/* Null values and identifiers */
|
||||
#define MM_NULLLBL ((char *)0) /* Null label */
|
||||
#define MM_NULLSEV (0) /* Null severity */
|
||||
#define MM_NULLMC (0L) /* Null class */
|
||||
#define MM_NULLTXT ((char *)0) /* Null text */
|
||||
#define MM_NULLACT ((char *)0) /* Null action */
|
||||
#define MM_NULLTAG ((char *)0) /* Null tag */
|
||||
|
||||
/* Return values */
|
||||
#define MM_OK ( 0) /* The function succeeded. */
|
||||
#define MM_NOTOK (-1) /* The function failed completely. */
|
||||
#define MM_NOMSG (-2) /* The function was unable to generate a message on \
|
||||
standard error, but otherwise succeeded. */
|
||||
#define MM_NOCON (-3) /* The function was unable to generate a console \
|
||||
message, but otherwise succeeded. */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int fmtmsg(long, const char*, int, const char*, const char*, const char*);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __FMTMSG_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,66 +0,0 @@
|
||||
/* $Id: fnmatch.h,v 1.4 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* fnmatch.h
|
||||
*
|
||||
* filename-matching types. Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __FNMATCH_H_INCLUDED__
|
||||
#define __FNMATCH_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#ifdef __PSXDLL__
|
||||
|
||||
/* headers for internal usage by psxdll.dll and ReactOS */
|
||||
|
||||
#else /* ! __PSXDLL__ */
|
||||
|
||||
/* standard POSIX headers */
|
||||
|
||||
#endif
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
/* Flags */
|
||||
#define FNM_PATHNAME (0x00000001) /* Slash in string only matches slash \
|
||||
in pattern. */
|
||||
#define FNM_PERIOD (0x00000002) /* Leading period in string must be \
|
||||
exactly matched by period in \
|
||||
pattern. */
|
||||
#define FNM_NOESCAPE (0x00000004) /* Disable backslash escaping. */
|
||||
|
||||
/* Return values */
|
||||
#define FNM_NOMATCH (1) /* The string does not match the specified \
|
||||
pattern. */
|
||||
#define FNM_NOSYS (2) /* The implementation does not support this \
|
||||
function. */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int fnmatch(const char *, const char *, int);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __FNMATCH_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,73 +0,0 @@
|
||||
/* $Id: ftw.h,v 1.4 2002/10/29 04:45:08 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* ftw.h
|
||||
*
|
||||
* file tree traversal. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __FTW_H_INCLUDED__
|
||||
#define __FTW_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
struct FTW
|
||||
{
|
||||
int base;
|
||||
int level;
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
/* Values of the third argument to the application-supplied function
|
||||
that is passed as the second argument to ftw() and nftw() */
|
||||
#define FTW_F (1) /* File. */
|
||||
#define FTW_D (2) /* Directory. */
|
||||
#define FTW_DNR (3) /* Directory without read permission. */
|
||||
#define FTW_DP (4) /* Directory with subdirectories visited. */
|
||||
#define FTW_NS (5) /* Unknown type, stat() failed. */
|
||||
#define FTW_SL (6) /* Symbolic link. */
|
||||
#define FTW_SLN (7) /* Symbolic link that names a non-existent file. */
|
||||
|
||||
/* Values of the fourth argument to nftw() */
|
||||
#define FTW_PHYS (0x00000001) /* Physical walk, does not follow symbolic \
|
||||
links. Otherwise, nftw() will follow \
|
||||
links but will not walk down any path \
|
||||
that crosses itself. */
|
||||
#define FTW_MOUNT (0x00000002) /* The walk will not cross a mount point. */
|
||||
#define FTW_DEPTH (0x00000004) /* All subdirectories will be visited before \
|
||||
the directory itself. */
|
||||
#define FTW_CHDIR (0x00000008) /* The walk will change to each directory \
|
||||
before reading it. */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int ftw(const char *,
|
||||
int (*)(const char *, const struct stat *, int), int);
|
||||
int nftw(const char *, int (*)
|
||||
(const char *, const struct stat *, int, struct FTW*),
|
||||
int, int);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __FTW_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,73 +0,0 @@
|
||||
/* $Id: glob.h,v 1.4 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* glob.h
|
||||
*
|
||||
* pathname pattern-matching types. Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __GLOB_H_INCLUDED__
|
||||
#define __GLOB_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
typedef struct __tagglob_t
|
||||
{
|
||||
size_t gl_pathc; /* count of paths matched by pattern */
|
||||
char **gl_pathv; /* pointer to a list of matched pathnames */
|
||||
size_t gl_offs; /* slots to reserve at the beginning of gl_pathv */
|
||||
} glob_t;
|
||||
|
||||
/* CONSTANTS */
|
||||
/* Values for the flags argument */
|
||||
#define GLOB_APPEND (0x00000001) /* Append generated pathnames to \
|
||||
those previously obtained. */
|
||||
#define GLOB_DOOFFS (0x00000002) /* Specify how many null pointers to \
|
||||
add to the beginning of */
|
||||
#define GLOB_ERR (0x00000004) /* Cause glob() to return on error. */
|
||||
#define GLOB_MARK (0x00000008) /* Each pathname that is a directory \
|
||||
that matches pattern has a slash \
|
||||
appended. */
|
||||
#define GLOB_NOCHECK (0x00000010) /* If pattern does not match any pathname, \
|
||||
then return a list consisting of only \
|
||||
pattern. */
|
||||
#define GLOB_NOESCAPE (0x00000020) /* Disable backslash escaping. */
|
||||
#define GLOB_NOSORT (0x00000040) /* Do not sort the pathnames returned. */
|
||||
|
||||
/* Error return values */
|
||||
#define GLOB_ABORTED (-1) /* The scan was stopped because GLOB_ERR was set \
|
||||
or errfunc returned non-zero. */
|
||||
#define GLOB_NOMATCH (-2) /* The pattern does not match any existing pathname, \
|
||||
and GLOB_NOCHECK was not set in flags. */
|
||||
#define GLOB_NOSPACE (-3) /* An attempt to allocate memory failed. */
|
||||
#define GLOB_NOSYS (-4) /* The implementation does not support this function. */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int glob(const char *, int, int (*)(const char *, int), glob_t *);
|
||||
void globfree (glob_t *);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __GLOB_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,59 +0,0 @@
|
||||
/* $Id: grp.h,v 1.4 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* grp.h
|
||||
*
|
||||
* group structure. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __GRP_H_INCLUDED__
|
||||
#define __GRP_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
struct group
|
||||
{
|
||||
char *gr_name; /* the name of the group */
|
||||
gid_t gr_gid; /* numerical group ID */
|
||||
char **gr_mem; /* pointer to a null-terminated array of character
|
||||
pointers to member names */
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
struct group *getgrgid(gid_t);
|
||||
struct group *getgrnam(const char *);
|
||||
int getgrgid_r(gid_t, struct group *, char *,
|
||||
size_t, struct group **);
|
||||
int getgrnam_r(const char *, struct group *, char *,
|
||||
size_t , struct group **);
|
||||
struct group *getgrent(void);
|
||||
void endgrent(void);
|
||||
void setgrent(void);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __GRP_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,47 +0,0 @@
|
||||
/* $Id: iconv.h,v 1.4 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* iconv.h
|
||||
*
|
||||
* codeset conversion facility. Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __ICONV_H_INCLUDED__
|
||||
#define __ICONV_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
typedef (void *) iconv_t;
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
iconv_t iconv_open(const char *, const char *);
|
||||
size_t iconv(iconv_t, char **, size_t *, char **, size_t *);
|
||||
int iconv_close(iconv_t);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __ICONV_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,60 +0,0 @@
|
||||
/* $Id: inttypes.h,v 1.4 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* inttypes.h
|
||||
*
|
||||
* fixed size integral types. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __INTTYPES_H_INCLUDED__
|
||||
#define __INTTYPES_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
/* signed */
|
||||
typedef signed char int8_t; /* 8-bit signed integral type. */
|
||||
typedef signed short int int16_t; /* 16-bit signed integral type. */
|
||||
typedef signed long int int32_t; /* 32-bit signed integral type. */
|
||||
typedef signed long long int64_t; /* 64-bit signed integral type. */
|
||||
|
||||
/* unsigned */
|
||||
typedef unsigned char uint8_t; /* 8-bit unsigned integral type. */
|
||||
typedef unsigned short int uint16_t; /* 16-bit unsigned integral type. */
|
||||
typedef unsigned long int uint32_t; /* 32-bit unsigned integral type. */
|
||||
typedef unsigned long long uint64_t; /* 64-bit unsigned integral type. */
|
||||
|
||||
/* pointer-sized */
|
||||
typedef signed long int intptr_t; /* Signed integral type large enough
|
||||
to hold any pointer. */
|
||||
typedef unsigned long int uintptr_t; /* Unsigned integral type large
|
||||
enough to hold any pointer. */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __INTTYPES_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,54 +0,0 @@
|
||||
/* $Id: iso646.h,v 1.4 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* iso646.h
|
||||
*
|
||||
* alternative spellings. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __ISO646_H_INCLUDED__
|
||||
#define __ISO646_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
#define and &&
|
||||
#define and_eq &=
|
||||
#define bitand &
|
||||
#define bitor |
|
||||
#define compl ~
|
||||
#define not !
|
||||
#define not_eq !=
|
||||
#define or ||
|
||||
#define or_eq |=
|
||||
#define xor ^
|
||||
#define xor_eq ^=
|
||||
|
||||
#endif /* __ISO646_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,52 +0,0 @@
|
||||
/* $Id: libgen.h,v 1.4 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* libgen.h
|
||||
*
|
||||
* definitions for pattern matching functions. Conforming to the Single
|
||||
* UNIX(r) Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __LIBGEN_H_INCLUDED__
|
||||
#define __LIBGEN_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <stddef.h>
|
||||
|
||||
/* OBJECTS */
|
||||
extern char *__loc1; /* LEGACY */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
char *basename(char *);
|
||||
char *dirname(char *);
|
||||
char *regcmp(const char *, ...); /* LEGACY */
|
||||
char *regex(const char *, const char *, ...); /* LEGACY */
|
||||
|
||||
wchar_t *_Wbasename(wchar_t *);
|
||||
wchar_t *_Wdirname(wchar_t *);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __LIBGEN_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,48 +0,0 @@
|
||||
/* $Id: limits.h,v 1.5 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* limits.h
|
||||
*
|
||||
* implementation-dependent constants. Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __LIMITS_H_INCLUDED__
|
||||
#define __LIMITS_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
/* TODO */
|
||||
#define OPEN_MAX (256)
|
||||
#define NAME_MAX (255)
|
||||
#define ARG_MAX (255)
|
||||
#define PATH_MAX (32768)
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __LIMITS_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,65 +0,0 @@
|
||||
/* $Id: math.h,v 1.4 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* math.h
|
||||
*
|
||||
* mathematical declarations. Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __MATH_H_INCLUDED__
|
||||
#define __MATH_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#ifdef __PSXDLL__
|
||||
|
||||
/* headers for internal usage by psxdll.dll and ReactOS */
|
||||
|
||||
#else /* ! __PSXDLL__ */
|
||||
|
||||
/* standard POSIX headers */
|
||||
|
||||
#endif
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
#define M_E ((double) 2.7182818285) /* Value of e */
|
||||
#define M_LOG2E ((double) 1.4426950419) /* Value of log2(e) */
|
||||
#define M_LOG10E ((double) 0.4342944819) /* Value of log10(e) */
|
||||
#define M_LN2 ((double)-0.6931471806) /* Value of loge2 */
|
||||
#define M_LN10 ((double) 2.3025850929) /* Value of loge10 */
|
||||
#define M_PI ((double) 3.1415926536) /* Value of Pi */
|
||||
#define M_PI_2 ((double) 1.5707963268) /* Value of Pi/2 */
|
||||
#define M_PI_4 ((double) 0.7853981634) /* Value of Pi/4 */
|
||||
#define M_1_PI ((double) 0.3183098862) /* Value of 1/Pi */
|
||||
#define M_2_PI ((double) 0.6366197724) /* Value of 2/Pi */
|
||||
#define M_2_SQRTPI ((double) 1.1283791671) /* Value of 2/Sqrt(Pi) */
|
||||
#define M_SQRT2 ((double) 1.4142135624) /* Value of Sqrt(2) */
|
||||
#define M_SQRT1_2 ((double) 0.7071067812) /* Value of Sqrt(1/2) */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __MATH_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,43 +0,0 @@
|
||||
/* $Id: in.h,v 1.4 2002/10/29 04:45:10 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* netinet/in.h
|
||||
*
|
||||
* Internet Protocol family. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __NETINET_IN_H_INCLUDED__
|
||||
#define __NETINET_IN_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __NETINET_IN_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1 +0,0 @@
|
||||
syscall.h
|
@@ -1,146 +0,0 @@
|
||||
/* $Id: debug.h,v 1.4 2002/10/29 04:45:11 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/debug.h
|
||||
*
|
||||
* debugging utilities
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_DEBUG_H_INCLUDED__
|
||||
#define __PSX_DEBUG_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#ifdef __PSX_DEBUG_TO_STDERR__
|
||||
#include <stdio.h>
|
||||
#else /* !defined(__PSX_DEBUG_TO_STDERR__) */
|
||||
#include <ddk/ntddk.h>
|
||||
#endif /* defined(__PSX_DEBUG_TO_STDERR__) */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#define __PSX_MODULE__ "psxdll.dll"
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
#ifdef __PSX_DEBUG_TO_STDERR__
|
||||
|
||||
#if 0
|
||||
#define DEBUGOUT(MODULE,TYPE,ARGS...) \
|
||||
do{ \
|
||||
fprintf(stderr,"%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
|
||||
fprintf(stderr,ARGS); \
|
||||
fprintf("\n"); \
|
||||
} \
|
||||
while(0)
|
||||
#endif
|
||||
|
||||
#define DEBUGOUT(MODULE,TYPE,ARGS...) \
|
||||
do{ \
|
||||
printf("%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
|
||||
printf(ARGS); \
|
||||
printf("\n"); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
|
||||
#else /* !defined(__PSX_DEBUG_TO_STDERR__) */
|
||||
|
||||
#define DEBUGOUT(MODULE,TYPE,ARGS...) \
|
||||
do{ \
|
||||
DbgPrint("%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
|
||||
DbgPrint(ARGS); \
|
||||
DbgPrint("\n"); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#endif /* defined(__PSX_DEBUG_TO_STDERR__) */
|
||||
|
||||
#define DEBUGOUTIF(CONDITION,MODULE,TYPE,ARGS...) \
|
||||
if((CONDITION)) \
|
||||
{ \
|
||||
DEBUGOUT((MODULE),(TYPE),ARGS); \
|
||||
}
|
||||
|
||||
#else /* defined(NDEBUG) */
|
||||
|
||||
#define DEBUGOUTIF(c,m,t,args...)
|
||||
#define DEBUGOUT(m,t,args...)
|
||||
|
||||
#endif /* !defined(NDEBUG) */
|
||||
|
||||
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_HINTS__)
|
||||
#define HINT(args...) DEBUGOUT(__PSX_MODULE__,"HINT",args)
|
||||
#define HINTIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"HINT",args)
|
||||
#else
|
||||
#define HINT(args...)
|
||||
#define HINTIF(c,args...)
|
||||
#endif
|
||||
|
||||
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_INFOS__)
|
||||
#define INFO(args...) DEBUGOUT(__PSX_MODULE__,"INFO",args)
|
||||
#define INFOIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"INFO",args)
|
||||
#else
|
||||
#define INFO(args...)
|
||||
#define INFOIF(c,args...)
|
||||
#endif
|
||||
|
||||
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_WARNS__)
|
||||
#define WARN(args...) DEBUGOUT(__PSX_MODULE__,"WARN",args)
|
||||
#define WARNIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"WARN",args)
|
||||
#else
|
||||
#define WARN(args...)
|
||||
#define WARNIF(c,args...)
|
||||
#endif
|
||||
|
||||
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_ERRS__)
|
||||
#define ERR(args...) DEBUGOUT(__PSX_MODULE__,"ERR",args)
|
||||
#define ERRIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"ERR",args)
|
||||
#else
|
||||
#define ERR(args...)
|
||||
#define ERRIF(c,args...)
|
||||
#endif
|
||||
|
||||
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_TODOS__)
|
||||
#define TODO(args...) DEBUGOUT(__PSX_MODULE__,"TODO",args)
|
||||
#define TODOIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"TODO",args)
|
||||
#else
|
||||
#define TODO(args...)
|
||||
#define TODOIF(c,args...)
|
||||
#endif
|
||||
|
||||
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_FIXMES__)
|
||||
#define FIXME(args...) DEBUGOUT(__PSX_MODULE__,"FIXME",args)
|
||||
#define FIXMEIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"FIXME",args)
|
||||
#else
|
||||
#define FIXME(args...)
|
||||
#define FIXMEIF(c,args...)
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __PSX_DEBUG_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,57 +0,0 @@
|
||||
/* $Id: dirent.h,v 1.4 2002/10/29 04:45:13 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/dirent.h
|
||||
*
|
||||
* internal dirent.h
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_DIRENT_H_INCLUDED__
|
||||
#define __PSX_DIRENT_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <ddk/ntddk.h>
|
||||
#include <dirent.h>
|
||||
#include <psx/safeobj.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
struct __internal_DIR
|
||||
{
|
||||
__magic_t signature; /* signature to verify object's validity across calls */
|
||||
union __any_dirent{
|
||||
struct dirent de_ansi;
|
||||
struct _Wdirent de_unicode;
|
||||
} ent; /* storage for return buffer of readdir() */
|
||||
int fildes; /* file descriptor of the directory */
|
||||
FILE_DIRECTORY_INFORMATION info; /* directory entry information */
|
||||
WCHAR name[MAX_PATH]; /* filename buffer */
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
#define __IDIR_MAGIC MAGIC('I', 'D', 'I', 'R')
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __PSX_DIRENT_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,53 +0,0 @@
|
||||
/* $Id: dlfcn.h,v 1.4 2002/10/29 04:45:13 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/dlfcn.h
|
||||
*
|
||||
* internal dlfcn.h
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_DLFCN_H_INCLUDED__
|
||||
#define __PSX_DLFCN_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <psx/errno.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
/* internal representation for loaded DLLs */
|
||||
/* TODO: get rid of this. The handle should be enough, with a proper PE loader */
|
||||
struct __dlobj
|
||||
{
|
||||
int global; /* if non-zero, all the other fields have no meaning */
|
||||
void *handle; /* pointer to the module mapping */
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
void __dl_set_last_error(int);
|
||||
|
||||
/* MACROS */
|
||||
#define __dl_get_reloc_flag(m) ((m) & (RTLD_LAZY | RTLD_NOW))
|
||||
#define __dl_get_scope_flag(m) ((m) & (RTLD_GLOBAL | RTLD_LOCAL))
|
||||
|
||||
#endif /* __PSX_DLFCN_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/* $Id: errno.h,v 1.4 2002/10/29 04:45:13 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/errno.h
|
||||
*
|
||||
* internal errno.h
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_ERRNO_H_INCLUDED__
|
||||
#define __PSX_ERRNO_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <errno.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
#define __status_to_errno(s) (s)
|
||||
#define __set_errno_from_status(s) (errno = __status_to_errno((s)))
|
||||
|
||||
#endif /* __PSX_ERRNO_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,73 +0,0 @@
|
||||
/* $Id: fdtable.h,v 1.5 2002/10/29 04:45:13 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/fdtable.h
|
||||
*
|
||||
* POSIX+ subsystem file descriptor table data structure
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_FDTABLE_H_INCLUDED__
|
||||
#define __PSX_FDTABLE_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <limits.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <psx/safeobj.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
typedef struct __tagfildes_t
|
||||
{
|
||||
void *FileHandle;
|
||||
int OpenFlags;
|
||||
int FdFlags;
|
||||
size_t ExtraDataSize;
|
||||
void *ExtraData;
|
||||
} __fildes_t;
|
||||
|
||||
typedef struct __tagfdtable_t
|
||||
{
|
||||
__magic_t Signature;
|
||||
int32_t LowestUnusedFileNo;
|
||||
int32_t UsedDescriptors;
|
||||
int32_t AllocatedDescriptors;
|
||||
uint32_t DescriptorsBitmap[OPEN_MAX / 32];
|
||||
__fildes_t *Descriptors;
|
||||
} __fdtable_t;
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int __fdtable_init(__fdtable_t *);
|
||||
int __fdtable_free(__fdtable_t *);
|
||||
|
||||
int __fdtable_entry_isavail(__fdtable_t *, int);
|
||||
int __fdtable_entry_nextavail(__fdtable_t *, int);
|
||||
int __fdtable_entry_add(__fdtable_t *, int, __fildes_t *, __fildes_t **);
|
||||
int __fdtable_entry_remove(__fdtable_t *, int);
|
||||
__fildes_t *__fdtable_entry_get(__fdtable_t *, int);
|
||||
|
||||
/* MACROS */
|
||||
#define __FDTABLE_MAGIC MAGIC('F', 'D', 'T', 'B')
|
||||
|
||||
#endif /* __PSX_FDTABLE_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/* $Id: interlock.h,v 1.4 2002/10/29 04:45:13 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/interlock.h
|
||||
*
|
||||
* inter-locked increment/decrement
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_INTERLOCK_H_INCLUDED__
|
||||
#define __PSX_INTERLOCK_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int __interlock_inc(int *);
|
||||
int __interlock_dec(int *);
|
||||
int __interlock_add(int *, int);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __PSX_INTERLOCK_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,91 +0,0 @@
|
||||
/* $Id: lpcproto.h,v 1.7 2004/01/18 21:27:32 ea Exp $
|
||||
*
|
||||
* ReactOS POSIX+ Environment Subsystem
|
||||
* LPC protocol spoken by PSXSS.EXE, PSXDLL.DLL, CSRTERM.EXE.
|
||||
*/
|
||||
#ifndef _PSX_LPCPROTO_H
|
||||
#define _PSX_LPCPROTO_H
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ntos.h>
|
||||
|
||||
#ifndef PRIVATE
|
||||
#define PRIVATE static
|
||||
#endif
|
||||
|
||||
/* Protocol version */
|
||||
#define PSX_LPC_PROTOCOL_VERSION 1
|
||||
|
||||
/* POSIX+ system name space */
|
||||
#define PSX_NS_SUBSYSTEM_DIRECTORY_NAME L"POSIX+"
|
||||
#define PSX_NS_SESSION_DIRECTORY_NAME L"Sessions"
|
||||
#define PSX_NS_SYSTEM_DIRECTORY_NAME L"System"
|
||||
#define PSX_NS_API_PORT_NAME L"ApiPort"
|
||||
#define PSX_NS_SBAPI_PORT_NAME L"SbApiPort"
|
||||
#define PSX_NS_SESSIONAPI_PORT_NAME L"SessionPort"
|
||||
#define PSX_NS_API_PORT_TEMPLATE L"\\%s\\%s"
|
||||
#define PSX_NS_SESSION_PORT_TEMPLATE L"\\%s\\%s\\P%d"
|
||||
#define PSX_NS_SESSION_DATA_TEMPLATE L"\\%s\\%s\\D%d"
|
||||
|
||||
/* ConnectData protocol */
|
||||
|
||||
typedef enum {
|
||||
PSX_CONNECTION_TYPE_PROCESS,
|
||||
PSX_CONNECTION_TYPE_TERMINAL,
|
||||
PSX_CONNECTION_TYPE_SERVER
|
||||
} PSX_CONNECTION_TYPE;
|
||||
|
||||
typedef struct _PSX_CONNECT_PORT_DATA
|
||||
{
|
||||
PSX_CONNECTION_TYPE ConnectionType; /* IN OUT */
|
||||
ULONG Version; /* IN OUT */
|
||||
ULONG PortIdentifier; /* OUT */
|
||||
} PSX_CONNECT_PORT_DATA, * PPSX_CONNECT_PORT_DATA;
|
||||
|
||||
/* LPC message subsystem-specific header */
|
||||
|
||||
typedef struct _PSX_MESSAGE_HEADER
|
||||
{
|
||||
WORD Context;
|
||||
WORD Procedure;
|
||||
NTSTATUS Status;
|
||||
} PSX_MESSAGE_HEADER, * PPSX_MESSAGE_HEADER;
|
||||
|
||||
typedef PSX_MESSAGE_HEADER PSX_MESSAGE, * PPSX_MESSAGE;
|
||||
|
||||
#define PSX_MAX_LPC_DATA_SIZE 128 /* compute it*/
|
||||
|
||||
typedef struct _PSX_MAX_MESSAGE
|
||||
{
|
||||
//LPC_MESSAGE_HEADER Header;
|
||||
LPC_MESSAGE Header;
|
||||
PSX_MESSAGE_HEADER PsxHeader;
|
||||
BYTE Data [PSX_MAX_LPC_DATA_SIZE];
|
||||
} PSX_MAX_MESSAGE, * PPSX_MAX_MESSAGE;
|
||||
|
||||
/* Terminal I/O */
|
||||
|
||||
/* \POSIX+\SessionPort API */
|
||||
|
||||
#define PSX_TERMINAL_SECTION_SIZE 65536L
|
||||
#define PSX_TERMINAL_SECTION_OFFSET 8192L
|
||||
|
||||
typedef enum {
|
||||
PSX_TERMINAL_INTERRUPT,
|
||||
PSX_TERMINAL_SESSION_STATUS_REQUEST
|
||||
} PSX_TERMINAL_API;
|
||||
|
||||
typedef struct _PSX_TERMINAL_IO
|
||||
{
|
||||
//LPC_MESSAGE_HEADER Header;
|
||||
LPC_MESSAGE Header;
|
||||
PSX_MESSAGE_HEADER PsxHeader;
|
||||
ULONG Size;
|
||||
ULONG Offset;
|
||||
} PSX_TERMINAL_READ, * PPSX_TERMINAL_READ;
|
||||
|
||||
/* System I/O (system calls) */
|
||||
|
||||
#include <psx/syscall.h>
|
||||
|
||||
#endif /* ndef _PSX_LPCPROTO_H */
|
@@ -1,112 +0,0 @@
|
||||
/* $Id: path.h,v 1.4 2002/10/29 04:45:13 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/path.h
|
||||
*
|
||||
* POSIX+ subsystem path functions
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_PATH_H_INCLUDED__
|
||||
#define __PSX_PATH_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
BOOLEAN
|
||||
__PdxPosixPathGetNextComponent_U
|
||||
(
|
||||
IN UNICODE_STRING PathName,
|
||||
IN OUT PUNICODE_STRING PathComponent,
|
||||
OUT PBOOLEAN TrailingDelimiter OPTIONAL
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
__PdxPosixPathResolve_U
|
||||
(
|
||||
IN UNICODE_STRING PathName,
|
||||
OUT PUNICODE_STRING ResolvedPathName,
|
||||
IN WCHAR PathDelimiter OPTIONAL
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
__PdxPosixPathGetNextComponent_A
|
||||
(
|
||||
IN ANSI_STRING PathName,
|
||||
IN OUT PANSI_STRING PathComponent,
|
||||
OUT PBOOLEAN TrailingDelimiter OPTIONAL
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
__PdxPosixPathResolve_A
|
||||
(
|
||||
IN ANSI_STRING PathName,
|
||||
OUT PANSI_STRING ResolvedPathName,
|
||||
IN CHAR PathDelimiter OPTIONAL
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
__PdxPosixPathNameToNtPathName
|
||||
(
|
||||
IN PWCHAR PosixPath,
|
||||
OUT PUNICODE_STRING NativePath,
|
||||
IN PUNICODE_STRING CurDir OPTIONAL,
|
||||
IN PUNICODE_STRING RootDir OPTIONAL
|
||||
);
|
||||
|
||||
/* MACROS */
|
||||
/* returns non-zero if the argument is a path delimiter */
|
||||
#define IS_CHAR_DELIMITER_U(WCH) (((WCH) == L'/') || ((WCH) == L'\\'))
|
||||
#define IS_CHAR_DELIMITER_A(CH) (((CH) == '/') || ((CH) == '\\'))
|
||||
|
||||
/* returns non-zero if the argument is an empty path component */
|
||||
#define IS_COMPONENT_EMPTY_U(WCOMPONENT) (WCOMPONENT.Length == 0)
|
||||
#define IS_COMPONENT_EMPTY_A(COMPONENT) (COMPONENT.Length == 0)
|
||||
|
||||
/* returns non-zero if the argument is "." */
|
||||
#define IS_COMPONENT_DOT_U(WCOMPONENT) \
|
||||
((WCOMPONENT.Length == sizeof(WCHAR)) && (WCOMPONENT.Buffer[0] == L'.'))
|
||||
|
||||
#define IS_COMPONENT_DOT_A(COMPONENT) \
|
||||
((COMPONENT.Length == 1) && (COMPONENT.Buffer[0] == '.'))
|
||||
|
||||
/* returns non-zero if the argument is ".." */
|
||||
#define IS_COMPONENT_DOTDOT_U(WCOMPONENT) \
|
||||
( \
|
||||
(WCOMPONENT.Length == (sizeof(WCHAR) * 2)) && \
|
||||
(WCOMPONENT.Buffer[0] == L'.') && \
|
||||
(WCOMPONENT.Buffer[1] == L'.') \
|
||||
)
|
||||
|
||||
#define IS_COMPONENT_DOTDOT_A(COMPONENT) \
|
||||
( \
|
||||
(COMPONENT.Length == 2) && \
|
||||
(COMPONENT.Buffer[0] == '.') && \
|
||||
(COMPONENT.Buffer[1] == '.') \
|
||||
)
|
||||
|
||||
#endif /* __PSX_PATH_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,135 +0,0 @@
|
||||
/* $Id: pdata.h,v 1.8 2002/10/29 04:45:13 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/pdata.h
|
||||
*
|
||||
* POSIX+ subsystem process environment data structure
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_PDATA_H_INCLUDED__
|
||||
#define __PSX_PDATA_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntdll/rtl.h>
|
||||
#include <limits.h>
|
||||
#include <psx/fdtable.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
typedef struct __tagPDX_PDATA
|
||||
{
|
||||
BOOL Spawned; /* TRUE if process has been created through __PdxSpawnPosixProcess() */
|
||||
int ArgCount; /* count of arguments passed to exec() */
|
||||
char **ArgVect; /* array of arguments passed to exec() */
|
||||
char ***Environment; /* pointer to user-provided environ variable */
|
||||
UNICODE_STRING NativePathBuffer; /* static buffer used by low-level calls for pathname conversions */
|
||||
UNICODE_STRING CurDir; /* current working directory */
|
||||
UNICODE_STRING RootPath; /* NT path to the process's root directory */
|
||||
HANDLE RootHandle; /* handle to the process's root directory */
|
||||
__fdtable_t FdTable; /* file descriptors table */
|
||||
/* WARNING: PRELIMINARY CODE FOR DEBUGGING PURPOSES ONLY - DO NOT CHANGE */
|
||||
CRITICAL_SECTION Lock;
|
||||
LONG TlsIndex;
|
||||
} __PDX_PDATA, * __PPDX_PDATA;
|
||||
|
||||
/* serialized process data block, used by __PdxSpawnPosixProcess() and __PdxExecThunk().
|
||||
The layout of buffers inside the Buffer byte array is as following:
|
||||
|
||||
ArgVect[0] + null byte
|
||||
ArgVect[1] + null byte
|
||||
...
|
||||
ArgVect[ArgCount - 1] + null byte
|
||||
Environment[0] + null byte
|
||||
Environment[1] + null byte
|
||||
...
|
||||
Environment[n - 1] + null byte (NOTE: the value of n is stored in ProcessData.Environment)
|
||||
CurDir.Buffer
|
||||
RootPath.Buffer
|
||||
FdTable.Descriptors[0]
|
||||
FdTable.Descriptors[1]
|
||||
...
|
||||
FdTable.Descriptors[FdTable.AllocatedDescriptors - 1]
|
||||
FdTable.Descriptors[x].ExtraData
|
||||
FdTable.Descriptors[y].ExtraData
|
||||
...
|
||||
padding for page boundary alignment
|
||||
*/
|
||||
typedef struct __tagPDX_SERIALIZED_PDATA
|
||||
{
|
||||
__PDX_PDATA ProcessData;
|
||||
ULONG AllocSize;
|
||||
BYTE Buffer[1];
|
||||
} __PDX_SERIALIZED_PDATA, *__PPDX_SERIALIZED_PDATA;
|
||||
|
||||
typedef struct __tagPDX_TDATA
|
||||
{
|
||||
__PPDX_PDATA ProcessData;
|
||||
int ErrNum;
|
||||
} __PDX_TDATA, * __PPDX_TDATA;
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
NTSTATUS STDCALL __PdxSerializeProcessData(IN __PPDX_PDATA, OUT __PPDX_SERIALIZED_PDATA *);
|
||||
NTSTATUS STDCALL __PdxUnserializeProcessData(IN OUT __PPDX_SERIALIZED_PDATA *, OUT __PPDX_PDATA * OPTIONAL);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
__PdxProcessDataToProcessParameters
|
||||
(
|
||||
OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
|
||||
IN __PPDX_PDATA ProcessData,
|
||||
IN PUNICODE_STRING ImageFile
|
||||
);
|
||||
|
||||
/* MACROS */
|
||||
/* WARNING: PRELIMINARY CODE FOR DEBUGGING PURPOSES ONLY - DO NOT CHANGE */
|
||||
VOID __PdxSetProcessData(__PPDX_PDATA);
|
||||
__PPDX_PDATA __PdxGetProcessData(VOID);
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define __PdxAcquirePdataLock() (RtlEnterCriticalSection(&__PdxGetProcessData()->Lock))
|
||||
#define __PdxReleasePdataLock() (RtlLeaveCriticalSection(&__PdxGetProcessData()->Lock))
|
||||
|
||||
#if 0
|
||||
#define __PdxAcquirePdataLock() (RtlAcquirePebLock())
|
||||
#define __PdxReleasePdataLock() (RtlReleasePebLock())
|
||||
|
||||
#define __PdxSetProcessData(PPDATA) ((void)((NtCurrentPeb()->SubSystemData) = (PPDATA)))
|
||||
#define __PdxGetProcessData() ((__PPDX_PDATA)(&(NtCurrentPeb()->SubSystemData)))
|
||||
#endif
|
||||
|
||||
#define __PdxGetNativePathBuffer() ((PUNICODE_STRING)(&(__PdxGetProcessData()->NativePathBuffer)))
|
||||
#define __PdxGetCurDir() ((PUNICODE_STRING)(&(__PdxGetProcessData()->CurDir)))
|
||||
#define __PdxGetRootPath() ((PUNICODE_STRING)(&(__PdxGetProcessData()->RootPath)))
|
||||
#define __PdxGetRootHandle() ((HANDLE)(__PdxGetProcessData()->RootHandle))
|
||||
#define __PdxGetFdTable() ((__fdtable_t *)(__PdxGetProcessData()->FdTable))
|
||||
|
||||
#define __PdxSetNativePathBuffer(BUF) ((void)((__PdxGetProcessData()->NativePathBuffer) = (BUF)))
|
||||
#define __PdxSetCurDir(CURDIR) ((void)((__PdxGetProcessData()->CurDir) = (CURDIR)))
|
||||
#define __PdxSetRootPath(ROOTPATH) ((void)((__PdxGetProcessData()->RootPath) = (ROOTPATH)))
|
||||
#define __PdxSetRootHandle(ROOTHANDLE) ((void)((__PdxGetProcessData()->RootHandle) = (ROOTHANDLE)))
|
||||
#define __PdxSetFdTable(FDTABLE) ((void)((__PdxGetProcessData()->FdTable) = (FDTABLE)))
|
||||
|
||||
#endif /* __PSX_PDATA_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,61 +0,0 @@
|
||||
/* $Id: pthread.h,v 1.4 2002/10/29 04:45:15 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/pthread.h
|
||||
*
|
||||
* internal pthread.h
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_PTHREAD_H_INCLUDED__
|
||||
#define __PSX_PTHREAD_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <psx/safeobj.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
struct __mutexattr
|
||||
{
|
||||
__magic_t signature;
|
||||
int pshared;
|
||||
int protocol;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct __mutex
|
||||
{
|
||||
__magic_t signature;
|
||||
void * handle;
|
||||
int protocol;
|
||||
int type;
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
#define __PTHREAD_MUTEX_MAGIC (MAGIC('P', 'T', 'M', 'X'))
|
||||
#define __PTHREAD_MUTEX_ATTR_MAGIC (MAGIC('P', 'T', 'M', 'A'))
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __PSX_PTHREAD_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,59 +0,0 @@
|
||||
/* $Id: safeobj.h,v 1.4 2002/10/29 04:45:15 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/safeobj.h
|
||||
*
|
||||
* types and definitions for safe checking of user-provided objects
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_SAFEOBJ_H_INCLUDED__
|
||||
#define __PSX_SAFEOBJ_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <inttypes.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
typedef uint32_t __magic_t;
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
int __safeobj_validate(void *, __magic_t);
|
||||
|
||||
/* MACROS */
|
||||
/* builds a magic number from 4 characters */
|
||||
#define MAGIC(a,b,c,d) ( \
|
||||
(((uint32_t)(uint8_t)(a)) << 24) | \
|
||||
(((uint32_t)(uint8_t)(b)) << 16) | \
|
||||
(((uint32_t)(uint8_t)(c)) << 8) | \
|
||||
(((uint32_t)(uint8_t)(d)) << 0) \
|
||||
)
|
||||
|
||||
/* retrieves a comma-separated list of the 4 characters in a magic number */
|
||||
#define MAGIC_DECOMPOSE(m) \
|
||||
((uint8_t)(m >> 24)), \
|
||||
((uint8_t)(m >> 16)), \
|
||||
((uint8_t)(m >> 8)), \
|
||||
((uint8_t)(m >> 0))
|
||||
|
||||
#endif /* __PSX_SAFEOBJ_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,54 +0,0 @@
|
||||
/* $Id: spawn.h,v 1.3 2002/10/29 04:45:15 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/spawn.h
|
||||
*
|
||||
* spawn POSIX+ processes
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PSX_SPAWN_H_INCLUDED__
|
||||
#define __PSX_SPAWN_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <ddk/ntddk.h>
|
||||
#include <psx/pdata.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
NTSTATUS STDCALL __PdxSpawnPosixProcess
|
||||
(
|
||||
OUT PHANDLE ProcessHandle,
|
||||
OUT PHANDLE ThreadHandle,
|
||||
IN POBJECT_ATTRIBUTES FileObjectAttributes,
|
||||
IN POBJECT_ATTRIBUTES ProcessObjectAttributes,
|
||||
IN HANDLE InheritFromProcessHandle,
|
||||
IN __PPDX_PDATA ProcessData
|
||||
);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __PSX_SPAWN_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,55 +0,0 @@
|
||||
/* $Id: stdlib.h,v 1.5 2003/01/05 18:27:20 robd Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/stdlib.h
|
||||
*
|
||||
* internal stdlib.h
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PSX_STDLIB_H_INCLUDED__
|
||||
#define __PSX_STDLIB_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntos/heap.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
/* FIXME? Windows NT's ntdll doesn't export RtlGetProcessHeap() */
|
||||
//#define RtlGetProcessHeap() ((HANDLE)NtCurrentPeb()->ProcessHeap)
|
||||
#ifndef _RTLGETPROCESSHEAP_DEFINED_
|
||||
#define _RTLGETPROCESSHEAP_DEFINED_
|
||||
#define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
|
||||
#endif
|
||||
|
||||
#define __malloc(SIZE) (RtlAllocateHeap(RtlGetProcessHeap(), 0, (SIZE)))
|
||||
#define __realloc(PTR,SIZE) (RtlReAllocateHeap(RtlGetProcessHeap(), 0, (PTR), (SIZE)))
|
||||
#define __free(PTR) (RtlFreeHeap(RtlGetProcessHeap(), 0, (PTR)))
|
||||
|
||||
#endif /* __PSX_STDLIB_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,83 +0,0 @@
|
||||
/* $Id: template.h,v 1.6 2002/10/29 04:45:15 rex Exp $
|
||||
How to create a new header file from this template:
|
||||
- copy the template in the new file (never edit this file directly, unless
|
||||
that's what you want)
|
||||
- search for the string "EDITME" in the file, and follow the instructions
|
||||
- remove this comment block, all blocks containing REMOVEME, and all EDITME
|
||||
instructions
|
||||
- save your file, and Have Fun! (TM)
|
||||
*/
|
||||
/* $*Id*$ (EDITME: remove asterisks from "$*Id*$")
|
||||
*/
|
||||
/*
|
||||
* psx/template.h (EDITME: replace with the real name of the header)
|
||||
*
|
||||
* template for POSIX headers (EDITME: replace this line with the real file
|
||||
* description)
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by John Doe <john.doe@mail.com> (EDITME: your name and e-mail go
|
||||
* here)
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
Tags are used to prevent double inclusion of C header files. This
|
||||
technique should be documented in all good C manuals
|
||||
|
||||
How to generate an unique tag for your header:
|
||||
- uppercase the name of the header, where "name" is the filename and
|
||||
the optional relative path (e.g. "stdio.h", "sys/types.h")
|
||||
- replace all non-alphanumeric characters in the obtained name with an
|
||||
underscore character ("_")
|
||||
- prepend a double underscore ("__"), and append the string "_INCLUDED__"
|
||||
- replace all occurrences of "__PSX_TEMPLATE_H_INCLUDED__" in this file
|
||||
with your tag
|
||||
|
||||
Example tags:
|
||||
sys/types.h -> SYS/TYPES.H -> SYS_TYPES_H -> __SYS_TYPES_H_INCLUDED__
|
||||
iso646.h -> ISO646.H -> ISO646_H -> __ISO646_H_INCLUDED__
|
||||
|
||||
(REMOVEME)
|
||||
*/
|
||||
#ifndef __PSX_TEMPLATE_H_INCLUDED__ /* EDITME: replace macro with unique tag */
|
||||
#define __PSX_TEMPLATE_H_INCLUDED__ /* EDITME: replace macro with unique tag */
|
||||
/*
|
||||
Explanation of the sections:
|
||||
INCLUDES #include directives should be grouped here
|
||||
OBJECTS declare global variables here
|
||||
TYPES types, structures and unions here
|
||||
CONSTANTS symbolic constants (simple #define's), enums, constants
|
||||
PROTOTYPES ANSI C function prototypes
|
||||
MACROS parametrized macros
|
||||
|
||||
(REMOVEME)
|
||||
*/
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __PSX_TEMPLATE_H_INCLUDED__ */ /* EDITME: replace macro with unique tag */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,48 +0,0 @@
|
||||
/* $Id: tls.h,v 1.3 2002/10/29 04:45:15 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* psx/tls.h
|
||||
*
|
||||
* types and calls for TLS management
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PSX_TLS_H_INCLUDED__
|
||||
#define __PSX_TLS_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
typedef unsigned int __tls_index_t;
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
__tls_index_t __tls_alloc();
|
||||
int __tls_free(__tls_index_t index);
|
||||
void * __tls_get_val(__tls_index_t index);
|
||||
int __tls_put_val(__tls_index_t index, void * data);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __PSX_TLS_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,141 +0,0 @@
|
||||
/* $Id: pthread.h,v 1.4 2002/10/29 04:45:16 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* pthread.h
|
||||
*
|
||||
* threads. Conforming to the Single UNIX(r) Specification Version 2,
|
||||
* System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PTHREAD_H_INCLUDED__
|
||||
#define __PTHREAD_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <sched.h>
|
||||
#include <time.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
|
||||
/* CONSTANTS */
|
||||
#define PTHREAD_MUTEX_NORMAL (1)
|
||||
#define PTHREAD_MUTEX_ERRORCHECK (2)
|
||||
#define PTHREAD_MUTEX_RECURSIVE (3)
|
||||
|
||||
#define PTHREAD_MUTEX_DEFAULT (PTHREAD_MUTEX_NORMAL)
|
||||
|
||||
#define PTHREAD_PROCESS_PRIVATE (1)
|
||||
#define PTHREAD_PROCESS_SHARED (2)
|
||||
|
||||
#define PTHREAD_PRIO_NONE (1)
|
||||
|
||||
/* PROTOTYPES */
|
||||
int pthread_attr_destroy(pthread_attr_t *);
|
||||
int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
|
||||
int pthread_attr_getguardsize(const pthread_attr_t *, size_t *);
|
||||
int pthread_attr_getinheritsched(const pthread_attr_t *, int *);
|
||||
int pthread_attr_getschedparam(const pthread_attr_t *,
|
||||
struct sched_param *);
|
||||
int pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
|
||||
int pthread_attr_getscope(const pthread_attr_t *, int *);
|
||||
int pthread_attr_getstackaddr(const pthread_attr_t *, void **);
|
||||
int pthread_attr_getstacksize(const pthread_attr_t *, size_t *);
|
||||
int pthread_attr_init(pthread_attr_t *);
|
||||
int pthread_attr_setdetachstate(pthread_attr_t *, int);
|
||||
int pthread_attr_setguardsize(pthread_attr_t *, size_t);
|
||||
int pthread_attr_setinheritsched(pthread_attr_t *, int);
|
||||
int pthread_attr_setschedparam(pthread_attr_t *,
|
||||
const struct sched_param *);
|
||||
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
|
||||
int pthread_attr_setscope(pthread_attr_t *, int);
|
||||
int pthread_attr_setstackaddr(pthread_attr_t *, void *);
|
||||
int pthread_attr_setstacksize(pthread_attr_t *, size_t);
|
||||
int pthread_cancel(pthread_t);
|
||||
void pthread_cleanup_push(void (*)(void *), void *);
|
||||
void pthread_cleanup_pop(int);
|
||||
int pthread_cond_broadcast(pthread_cond_t *);
|
||||
int pthread_cond_destroy(pthread_cond_t *);
|
||||
int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
|
||||
int pthread_cond_signal(pthread_cond_t *);
|
||||
int pthread_cond_timedwait(pthread_cond_t *,
|
||||
pthread_mutex_t *, const struct timespec *);
|
||||
int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
|
||||
int pthread_condattr_destroy(pthread_condattr_t *);
|
||||
int pthread_condattr_getpshared(const pthread_condattr_t *, int *);
|
||||
int pthread_condattr_init(pthread_condattr_t *);
|
||||
int pthread_condattr_setpshared(pthread_condattr_t *, int);
|
||||
int pthread_create(pthread_t *, const pthread_attr_t *,
|
||||
void *(*)(void *), void *);
|
||||
int pthread_detach(pthread_t);
|
||||
int pthread_equal(pthread_t, pthread_t);
|
||||
void pthread_exit(void *);
|
||||
int pthread_getconcurrency(void);
|
||||
int pthread_getschedparam(pthread_t, int *, struct sched_param *);
|
||||
void *pthread_getspecific(pthread_key_t);
|
||||
int pthread_join(pthread_t, void **);
|
||||
int pthread_key_create(pthread_key_t *, void (*)(void *));
|
||||
int pthread_key_delete(pthread_key_t);
|
||||
int pthread_mutex_destroy(pthread_mutex_t *);
|
||||
int pthread_mutex_getprioceiling(const pthread_mutex_t *, int *);
|
||||
int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
|
||||
int pthread_mutex_lock(pthread_mutex_t *);
|
||||
int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *);
|
||||
int pthread_mutex_trylock(pthread_mutex_t *);
|
||||
int pthread_mutex_unlock(pthread_mutex_t *);
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t *);
|
||||
int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *,
|
||||
int *);
|
||||
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *);
|
||||
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *);
|
||||
int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *);
|
||||
int pthread_mutexattr_init(pthread_mutexattr_t *);
|
||||
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
|
||||
int pthread_once(pthread_once_t *, void (*)(void));
|
||||
int pthread_rwlock_destroy(pthread_rwlock_t *);
|
||||
int pthread_rwlock_init(pthread_rwlock_t *,
|
||||
const pthread_rwlockattr_t *);
|
||||
int pthread_rwlock_rdlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_trywrlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_unlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_wrlock(pthread_rwlock_t *);
|
||||
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
|
||||
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *,
|
||||
int *);
|
||||
int pthread_rwlockattr_init(pthread_rwlockattr_t *);
|
||||
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
|
||||
pthread_t
|
||||
pthread_self(void);
|
||||
int pthread_setcancelstate(int, int *);
|
||||
int pthread_setcanceltype(int, int *);
|
||||
int pthread_setconcurrency(int);
|
||||
int pthread_setschedparam(pthread_t, int ,
|
||||
const struct sched_param *);
|
||||
int pthread_setspecific(pthread_key_t, const void *);
|
||||
void pthread_testcancel(void);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __PTHREAD_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,60 +0,0 @@
|
||||
/* $Id: pwd.h,v 1.4 2002/10/29 04:45:16 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* pwd.h
|
||||
*
|
||||
* password structure. Conforming to the Single UNIX(r) Specification
|
||||
* Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __PWD_H_INCLUDED__
|
||||
#define __PWD_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
struct passwd
|
||||
{
|
||||
char *pw_name; /* user's login name */
|
||||
uid_t pw_uid; /* numerical user ID */
|
||||
gid_t pw_gid; /* numerical group ID */
|
||||
char *pw_dir; /* initial working directory */
|
||||
char *pw_shell; /* program to use as shell */
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
|
||||
/* PROTOTYPES */
|
||||
struct passwd *getpwnam(const char *);
|
||||
struct passwd *getpwuid(uid_t);
|
||||
int getpwnam_r(const char *, struct passwd *, char *,
|
||||
size_t, struct passwd **);
|
||||
int getpwuid_r(uid_t, struct passwd *, char *,
|
||||
size_t, struct passwd **);
|
||||
void endpwent(void);
|
||||
struct passwd *getpwent(void);
|
||||
void setpwent(void);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __PWD_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -1,62 +0,0 @@
|
||||
/* $Id: sched.h,v 1.4 2002/10/29 04:45:18 rex Exp $
|
||||
*/
|
||||
/*
|
||||
* sched.h
|
||||
*
|
||||
* execution scheduling (REALTIME). Conforming to the Single UNIX(r)
|
||||
* Specification Version 2, System Interface & Headers Issue 5
|
||||
*
|
||||
* This file is part of the ReactOS Operating System.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by KJK::Hyperion <noog@libero.it>
|
||||
*
|
||||
* 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 WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
#ifndef __SCHED_H_INCLUDED__
|
||||
#define __SCHED_H_INCLUDED__
|
||||
|
||||
/* INCLUDES */
|
||||
#include <time.h>
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
/* TYPES */
|
||||
struct sched_param
|
||||
{
|
||||
int sched_priority; /* process execution scheduling priority */
|
||||
};
|
||||
|
||||
/* CONSTANTS */
|
||||
/* First in-first out (FIFO) scheduling policy */
|
||||
#define SCHED_FIFO (1)
|
||||
/* Round robin scheduling policy */
|
||||
#define SCHED_RR (2)
|
||||
/* Another scheduling policy */
|
||||
#define SCHED_OTHER (3)
|
||||
|
||||
/* PROTOTYPES */
|
||||
int sched_get_priority_max(int);
|
||||
int sched_get_priority_min(int);
|
||||
int sched_getparam(pid_t, struct sched_param *);
|
||||
int sched_getscheduler(pid_t);
|
||||
int sched_rr_get_interval(pid_t, struct timespec *);
|
||||
int sched_setparam(pid_t, const struct sched_param *);
|
||||
int sched_setscheduler(pid_t, int, const struct sched_param *);
|
||||
int sched_yield(void);
|
||||
|
||||
/* MACROS */
|
||||
|
||||
#endif /* __SCHED_H_INCLUDED__ */
|
||||
|
||||
/* EOF */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user