mirror of
https://github.com/reactos/reactos
synced 2025-10-08 17:32:43 +02:00
Compare commits
1 Commits
backups/av
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
6caaf63c2c |
@@ -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,3 +0,0 @@
|
||||
Debug
|
||||
Release
|
||||
hal.def
|
@@ -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
|
||||
}
|
||||
|
2
reactos/.cvsignore
Normal file
2
reactos/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
dist
|
||||
errors
|
340
reactos/COPYING
Normal file
340
reactos/COPYING
Normal file
@@ -0,0 +1,340 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
14
reactos/CREDITS
Normal file
14
reactos/CREDITS
Normal file
@@ -0,0 +1,14 @@
|
||||
In no particular order
|
||||
|
||||
Rex Jolliff (rex@lvcablemodem.com)
|
||||
Boudewijn Dekker (ariadne@xs4all.nl)
|
||||
Eric Kohl (ekohl@abo.rhein-zeitung.de)
|
||||
Emanuele Aliberti (ea@iol.it)
|
||||
David Welch (welch@cwcom.net)
|
||||
Iwan Fatahi (i_fatahi@hotmail.com)
|
||||
Robert Bergkvist (fragdance@hotmail.com)
|
||||
Victor Kirhenshtein (sauros@iname.com)
|
||||
Jason Filby (jasonfilby@yahoo.com)
|
||||
Brian Palmer (brianp@sginet.com)
|
||||
Phillip Susi (phreak@iag.net)
|
||||
Paolo Pantaleo (paolopan@freemail.it)
|
12
reactos/ChangeLog
Normal file
12
reactos/ChangeLog
Normal file
@@ -0,0 +1,12 @@
|
||||
9/6/99: Implemented ZwOpenProcess
|
||||
Partially implemented killing other threads (possible memory
|
||||
leaks)
|
||||
Made a start on a proper implemention of APCs (based on
|
||||
article in NT insider)
|
||||
|
||||
8/12/98: Corrected bug in shell (Read two keypresses and assumed they
|
||||
where the key going up and down respectively)
|
||||
Corrected race in dpc handling
|
||||
Took out cleanup sections in ZwReadFile (now handled by the APC)
|
||||
Disabled broken code in kernel32
|
||||
|
31
reactos/INSTALL
Normal file
31
reactos/INSTALL
Normal file
@@ -0,0 +1,31 @@
|
||||
1. Build environment
|
||||
|
||||
To build the system you need either mingw32 installed on Windows or a
|
||||
mingw32 cross compiler running on unix.
|
||||
|
||||
2. Building
|
||||
|
||||
To build from Windows run make. To build from unix, edit rules.mak and change
|
||||
the PREFIX variable to the correct value for your cross-compiler, then run
|
||||
'make'.
|
||||
|
||||
3. Installation
|
||||
|
||||
Installation isn't yet automated, sorry. The system can only be installed on
|
||||
the first partition which must be formatted for DOS. Set up a directory
|
||||
structure like the following
|
||||
|
||||
make directories C:\reactos,C:\reactos\system,C:\reactos\system\drivers
|
||||
|
||||
Copy apps/shell/shell.exe to C:\reactos\system32
|
||||
Copy subsys/smss/smss.exe to C:\reactos\system32
|
||||
Copy services/dd/keyboard/keyboard.sys to C:\reactos\system32\drivers
|
||||
Copy services/dd/blue/blue.sys to C:\reactos\system32\drivers
|
||||
Copy lib/ntdll/ntdll.dll to C:\reactos\system32
|
||||
Copy lib/kernel32/kernel32.dll to C:\reactos\system32
|
||||
Copy lib/crtdll/crtdll.dll to C:\reactos\system32
|
||||
|
||||
The system can only be started from DOS. Copy the following files,
|
||||
services/dd/ide/ide.sys, services/fs/vfat/vfatfsd.sys and
|
||||
loaders/dos/loadros.com, to a suitable directory. The system can then be
|
||||
booted with the command 'loadros.com ide.sys vfatfsd.sys'.
|
280
reactos/Makefile
Normal file
280
reactos/Makefile
Normal file
@@ -0,0 +1,280 @@
|
||||
#
|
||||
# Global makefile
|
||||
#
|
||||
|
||||
#
|
||||
# Select your host
|
||||
#
|
||||
#HOST = mingw32-linux
|
||||
#HOST = djgpp-msdos
|
||||
#HOST = mingw32-windows
|
||||
|
||||
include rules.mak
|
||||
|
||||
#
|
||||
# Required to run the system
|
||||
#
|
||||
COMPONENTS = iface_native ntoskrnl
|
||||
DLLS = ntdll kernel32 crtdll advapi32 fmifs gdi32
|
||||
#DLLS = mingw32 user32
|
||||
SUBSYS = smss win32k
|
||||
#SUBSYS = csrss
|
||||
|
||||
#
|
||||
# Select the server(s) you want to build
|
||||
#
|
||||
SERVERS = win32
|
||||
# SERVERS = posix linux os2
|
||||
|
||||
#
|
||||
# Select the loader(s) you want to build
|
||||
#
|
||||
LOADERS = dos
|
||||
# LOADERS = boot
|
||||
|
||||
#
|
||||
# Select the device drivers and filesystems you want
|
||||
#
|
||||
DEVICE_DRIVERS = blue ide keyboard null parallel serial
|
||||
# DEVICE_DRIVERS = beep event floppy ide_test mouse sound test test1
|
||||
FS_DRIVERS = vfat
|
||||
# FS_DRIVERS = minix ext2 template
|
||||
KERNEL_SERVICES = $(DEVICE_DRIVERS) $(FS_DRIVERS)
|
||||
|
||||
APPS = args hello shell test cat bench apc shm lpc thread event
|
||||
|
||||
all: buildno $(COMPONENTS) $(DLLS) $(SUBSYS) $(LOADERS) $(KERNEL_SERVICES) $(APPS)
|
||||
|
||||
.PHONY: all
|
||||
|
||||
clean: buildno_clean $(COMPONENTS:%=%_clean) $(DLLS:%=%_clean) $(LOADERS:%=%_clean) \
|
||||
$(KERNEL_SERVICES:%=%_clean) $(SUBSYS:%=%_clean) $(APPS:%=%_clean)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
floppy: make_floppy_dirs autoexec_floppy $(COMPONENTS:%=%_floppy) \
|
||||
$(DLLS:%=%_floppy) $(LOADERS:%=%_floppy) \
|
||||
$(KERNEL_SERVICES:%=%_floppy) $(SUBSYS:%=%_floppy) \
|
||||
$(APPS:%=%_floppy)
|
||||
|
||||
dist: clean_dist_dir make_dist_dirs $(COMPONENTS:%=%_dist) $(DLLS:%=%_dist) \
|
||||
$(LOADERS:%=%_dist) $(KERNEL_SERVICES:%=%_dist) $(SUBSYS:%=%_dist) \
|
||||
$(APPS:%=%_dist)
|
||||
|
||||
#
|
||||
# Build number generator
|
||||
#
|
||||
buildno: include/reactos/version.h
|
||||
make -C apps/buildno
|
||||
|
||||
buildno_clean:
|
||||
make -C apps/buildno clean
|
||||
|
||||
buildno_floppy:
|
||||
|
||||
buildno_dist:
|
||||
|
||||
.PHONY: buildno buildno_clean buildno_floppy buildno_dist
|
||||
|
||||
#
|
||||
# Applications
|
||||
#
|
||||
$(APPS): %:
|
||||
make -C apps/$*
|
||||
|
||||
$(APPS:%=%_clean): %_clean:
|
||||
make -C apps/$* clean
|
||||
|
||||
$(APPS:%=%_floppy): %_floppy:
|
||||
make -C apps/$* floppy
|
||||
|
||||
$(APPS:%=%_dist): %_dist:
|
||||
make -C apps/$* dist
|
||||
|
||||
.PHONY: $(APPS) $(APPS:%=%_clean) $(APPS:%=%_floppy) $(APPS:%=%_dist)
|
||||
|
||||
#
|
||||
# Interfaces
|
||||
#
|
||||
iface_native:
|
||||
make -C iface/native
|
||||
|
||||
iface_native_clean:
|
||||
make -C iface/native clean
|
||||
|
||||
iface_native_floppy:
|
||||
|
||||
iface_native_dist:
|
||||
|
||||
.PHONY: iface_native iface_native_clean iface_native_floppy \
|
||||
iface_native_dist
|
||||
|
||||
#
|
||||
# Device driver rules
|
||||
#
|
||||
$(DEVICE_DRIVERS): %:
|
||||
make -C services/dd/$*
|
||||
|
||||
$(DEVICE_DRIVERS:%=%_clean): %_clean:
|
||||
make -C services/dd/$* clean
|
||||
|
||||
$(DEVICE_DRIVERS:%=%_floppy): %_floppy:
|
||||
make -C services/dd/$* floppy
|
||||
|
||||
$(DEVICE_DRIVERS:%=%_dist): %_dist:
|
||||
make -C services/dd/$* dist
|
||||
|
||||
.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_clean) \
|
||||
$(DEVICE_DRIVERS:%=%_floppy) $(DEVICE_DRIVERS:%=%_dist)
|
||||
|
||||
$(FS_DRIVERS): %:
|
||||
make -C services/fs/$*
|
||||
|
||||
$(FS_DRIVERS:%=%_clean): %_clean:
|
||||
make -C services/fs/$* clean
|
||||
|
||||
$(FS_DRIVERS:%=%_floppy): %_floppy:
|
||||
make -C services/fs/$* floppy
|
||||
|
||||
$(FS_DRIVERS:%=%_dist): %_dist:
|
||||
make -C services/fs/$* dist
|
||||
|
||||
.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_clean) $(FS_DRIVERS:%=%_floppy) \
|
||||
$(FS_DRIVERS:%=%_dist)
|
||||
|
||||
#
|
||||
# Kernel loaders
|
||||
#
|
||||
|
||||
$(LOADERS): %:
|
||||
make -C loaders/$*
|
||||
|
||||
$(LOADERS:%=%_clean): %_clean:
|
||||
make -C loaders/$* clean
|
||||
|
||||
$(LOADERS:%=%_floppy): %_floppy:
|
||||
make -C loaders/$* floppy
|
||||
|
||||
$(LOADERS:%=%_dist): %_dist:
|
||||
make -C loaders/$* dist
|
||||
|
||||
.PHONY: $(LOADERS) $(LOADERS:%=%_clean) $(LOADERS:%=%_floppy) \
|
||||
$(LOADERS:%=%_dist)
|
||||
|
||||
#
|
||||
# Required system components
|
||||
#
|
||||
|
||||
ntoskrnl:
|
||||
make -C ntoskrnl
|
||||
|
||||
ntoskrnl_clean:
|
||||
make -C ntoskrnl clean
|
||||
|
||||
ntoskrnl_floppy:
|
||||
make -C ntoskrnl floppy
|
||||
|
||||
ntoskrnl_dist:
|
||||
make -C ntoskrnl dist
|
||||
|
||||
.PHONY: ntoskrnl ntoskrnl_clean ntoskrnl_floppy ntoskrnl_dist
|
||||
|
||||
#
|
||||
# Required DLLs
|
||||
#
|
||||
|
||||
$(DLLS): %:
|
||||
make -C lib/$*
|
||||
|
||||
$(DLLS:%=%_clean): %_clean:
|
||||
make -C lib/$* clean
|
||||
|
||||
$(DLLS:%=%_floppy): %_floppy:
|
||||
make -C lib/$* floppy
|
||||
|
||||
$(DLLS:%=%_dist): %_dist:
|
||||
make -C lib/$* dist
|
||||
|
||||
.PHONY: $(DLLS) $(DLLS:%=%_clean) $(DLLS:%=%_floppy) $(DLLS:%=%_dist)
|
||||
|
||||
#
|
||||
# Kernel Subsystems
|
||||
#
|
||||
$(SUBSYS): %:
|
||||
make -C subsys/$*
|
||||
|
||||
$(SUBSYS:%=%_clean): %_clean:
|
||||
make -C subsys/$* clean
|
||||
|
||||
$(SUBSYS:%=%_floppy): %_floppy:
|
||||
make -C subsys/$* floppy
|
||||
|
||||
$(SUBSYS:%=%_dist): %_dist:
|
||||
make -C subsys/$* dist
|
||||
|
||||
.PHONY: $(SUBSYS) $(SUBSYS:%=%_clean) $(SUBSYS:%=%_floppy) \
|
||||
$(SUBSYS:%=%_dist)
|
||||
|
||||
#
|
||||
# Make an install floppy
|
||||
#
|
||||
|
||||
install: all
|
||||
./install.sh /mnt/hda1
|
||||
|
||||
make_floppy_dirs:
|
||||
ifeq ($(DOSCLI),yes)
|
||||
mkdir $(FLOPPY_DIR)\dlls
|
||||
mkdir $(FLOPPY_DIR)\apps
|
||||
mkdir $(FLOPPY_DIR)\drivers
|
||||
mkdir $(FLOPPY_DIR)\subsys
|
||||
else
|
||||
mkdir $(FLOPPY_DIR)/dlls $(FLOPPY_DIR)/apps $(FLOPPY_DIR)/drivers
|
||||
mkdir $(FLOPPY_DIR)/subsys
|
||||
endif
|
||||
|
||||
.PHONY: make_floppy_dirs
|
||||
|
||||
autoexec_floppy: $(FLOPPY_DIR)/autoexec.bat
|
||||
|
||||
$(FLOPPY_DIR)/autoexec.bat: bootflop.bat
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) bootflop.bat $(FLOPPY_DIR)\autoexec.bat
|
||||
else
|
||||
$(CP) bootflop.bat $(FLOPPY_DIR)/autoexec.bat
|
||||
endif
|
||||
|
||||
#
|
||||
# Make a distribution saveset
|
||||
#
|
||||
|
||||
clean_dist_dir:
|
||||
ifeq ($(DOSCLI),yes)
|
||||
- $(RM) $(DIST_DIR)\dlls\*.dll
|
||||
- $(RM) $(DIST_DIR)\apps\*.exe
|
||||
- $(RM) $(DIST_DIR)\drivers\*.sys
|
||||
- $(RM) $(DIST_DIR)\subsys\*.exe
|
||||
- $(RMDIR) $(DIST_DIR)\dlls
|
||||
- $(RMDIR) $(DIST_DIR)\apps
|
||||
- $(RMDIR) $(DIST_DIR)\drivers
|
||||
- $(RMDIR) $(DIST_DIR)\subsys
|
||||
- $(RMDIR) $(DIST_DIR)
|
||||
else
|
||||
$(RM) -r $(DIST_DIR)
|
||||
endif
|
||||
|
||||
make_dist_dirs:
|
||||
ifeq ($(DOSCLI),yes)
|
||||
mkdir $(DIST_DIR)
|
||||
mkdir $(DIST_DIR)\dlls
|
||||
mkdir $(DIST_DIR)\apps
|
||||
mkdir $(DIST_DIR)\drivers
|
||||
mkdir $(DIST_DIR)\dlls
|
||||
mkdir $(DIST_DIR)\subsys
|
||||
else
|
||||
mkdir $(DIST_DIR) $(DIST_DIR)/dlls $(DIST_DIR)/apps $(DIST_DIR)/drivers
|
||||
mkdir $(DIST_DIR)/subsys
|
||||
endif
|
||||
|
||||
.PHONY: clean_dist_dir make_dist_dirs
|
||||
|
15
reactos/NEWS
Normal file
15
reactos/NEWS
Normal file
@@ -0,0 +1,15 @@
|
||||
0.0.14: Converted to PE format
|
||||
All system libraries are now dlls
|
||||
|
||||
0.0.13: Mostly bugfixes (I think)
|
||||
|
||||
0.0.12: Added support for multiple processes (not really tested)
|
||||
System calls
|
||||
kernel32 now compiles (only as a static library)
|
||||
Fixed invalid tss bug (hopefully)
|
||||
Added section support
|
||||
Added some of the ZwxxxVirtual calls
|
||||
Added prototype caching functions (only the Minix fsd actually
|
||||
uses them)
|
||||
Added handle access and type checking
|
||||
Prototype APC implementation (no support for user APCs)
|
24
reactos/README
Normal file
24
reactos/README
Normal file
@@ -0,0 +1,24 @@
|
||||
About Reactos
|
||||
|
||||
1. What is Reactos
|
||||
|
||||
A project aiming to make an approximate clone of Windows NT, compatible
|
||||
with most Windows applications.
|
||||
|
||||
The project has a website at http://www.reactos.com/
|
||||
|
||||
2. Building Reactos
|
||||
|
||||
See the INSTALL file for more details.
|
||||
|
||||
3. More information
|
||||
|
||||
See the doc subdirectory for some sparse notes
|
||||
|
||||
4. Who is responsible
|
||||
|
||||
See the CREDITS file
|
||||
|
||||
5. Recent developments
|
||||
|
||||
See the NEWS file
|
33
reactos/apps/common/crt0.c
Normal file
33
reactos/apps/common/crt0.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <windows.h>
|
||||
|
||||
extern int main(int args, char* argv[], char* environ[]);
|
||||
|
||||
static unsigned int _argc = 0;
|
||||
static char** _argv = NULL;
|
||||
static char** _environ = NULL;
|
||||
|
||||
int mainCRTStartup(PWSTR args)
|
||||
{
|
||||
int nRet;
|
||||
|
||||
// SetUnhandledExceptionFilter(NULL);
|
||||
|
||||
// _fpreset();
|
||||
|
||||
// __GetMainArgs(&_argc, &_argv, &_environ, 0);
|
||||
|
||||
nRet = main(_argc, _argv, _environ);
|
||||
|
||||
// _cexit();
|
||||
|
||||
ExitProcess(nRet);
|
||||
}
|
||||
|
||||
int WinMainCRTStartup()
|
||||
{
|
||||
return mainCRTStartup(NULL);
|
||||
}
|
||||
|
||||
void __main(void)
|
||||
{
|
||||
}
|
97
reactos/apps/tests/apc/apc.c
Normal file
97
reactos/apps/tests/apc/apc.c
Normal file
@@ -0,0 +1,97 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
VOID STDCALL ApcRoutine(PVOID Context,
|
||||
PIO_STATUS_BLOCK IoStatus,
|
||||
ULONG Reserved)
|
||||
{
|
||||
printf("(apc.exe) ApcRoutine(Context %x)\n", Context);
|
||||
}
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
NTSTATUS Status;
|
||||
HANDLE FileHandle;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING FileName;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
CHAR Buffer[256];
|
||||
HANDLE EventHandle;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
printf("APC test program\n");
|
||||
|
||||
EventHandle = CreateEventW(NULL,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL);
|
||||
if (EventHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Failed to create event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Opening file\n");
|
||||
RtlInitUnicodeString(&FileName,
|
||||
L"\\C:\\a.txt");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
printf("Creating file\n");
|
||||
FileHandle = CreateFileW(L"C:\\a.txt",
|
||||
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,
|
||||
NULL);
|
||||
if (FileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Open failed\n");
|
||||
return;
|
||||
}
|
||||
printf("Reading file\n");
|
||||
Status = ZwReadFile(FileHandle,
|
||||
NULL,
|
||||
ApcRoutine,
|
||||
0xdeadbeef,
|
||||
&IoStatus,
|
||||
Buffer,
|
||||
256,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("Read failed\n");
|
||||
}
|
||||
printf("Waiting\n");
|
||||
WaitForSingleObjectEx(EventHandle, INFINITE, TRUE);
|
||||
printf("Returned from wait\n");
|
||||
ZwClose(FileHandle);
|
||||
printf("Program finished\n");
|
||||
for(;;);
|
||||
}
|
||||
|
44
reactos/apps/tests/apc/makefile
Normal file
44
reactos/apps/tests/apc/makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
OBJECTS= ../common/crt0.o apc.o
|
||||
PROGS= apc.exe
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
|
||||
../../lib/ntdll/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) apc.o
|
||||
- $(RM) apc.exe
|
||||
- $(RM) apc.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
apc.exe: $(OBJECTS) $(LIBS)
|
||||
$(LD) $(OBJECTS) $(LIBS) -o apc.exe
|
||||
$(NM) --numeric-sort apc.exe > apc.sym
|
||||
|
||||
include ../../rules.mak
|
39
reactos/apps/tests/args/args.c
Normal file
39
reactos/apps/tests/args/args.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
printf("GetCommandLineA() %s\n",GetCommandLineA());
|
||||
debug_printf("GetCommandLineA() %s\n",GetCommandLineA());
|
||||
debug_printf("argc %d\n", argc);
|
||||
for (i=0; i<argc; i++)
|
||||
{
|
||||
debug_printf("Argv[%d]: %x\n",i,argv[i]);
|
||||
debug_printf("Argv[%d]: '%s'\n",i,argv[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
42
reactos/apps/tests/args/makefile
Normal file
42
reactos/apps/tests/args/makefile
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
OBJECTS= args.o
|
||||
PROGS= args.exe
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) args.o
|
||||
- $(RM) args.exe
|
||||
- $(RM) args.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
args.exe: $(OBJECTS)
|
||||
$(CC) $(OBJECTS) -o args.exe
|
||||
$(NM) --numeric-sort args.exe > args.sym
|
||||
|
||||
include ../../rules.mak
|
8
reactos/apps/tests/bench/bench-syscall.c
Normal file
8
reactos/apps/tests/bench/bench-syscall.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
}
|
82
reactos/apps/tests/bench/bench-thread.c
Normal file
82
reactos/apps/tests/bench/bench-thread.c
Normal file
@@ -0,0 +1,82 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define NR_THREADS (0x1)
|
||||
|
||||
|
||||
DWORD WINAPI
|
||||
thread_main1(LPVOID param)
|
||||
{
|
||||
printf("Thread 1 running (Counter %lu)\n", (DWORD)param);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
DWORD WINAPI
|
||||
thread_main2(LPVOID param)
|
||||
{
|
||||
printf("Thread 2 running (Counter %lu)\n", (DWORD)param);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
HANDLE hThread;
|
||||
DWORD i=0;
|
||||
DWORD id;
|
||||
|
||||
#if 1
|
||||
printf("Creating %d threads...\n",NR_THREADS*2);
|
||||
for (i=0;i<NR_THREADS;i++)
|
||||
{
|
||||
CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
/* CreateThread(NULL,
|
||||
0,
|
||||
thread_main2,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);*/
|
||||
}
|
||||
|
||||
printf("All threads created...\n");
|
||||
|
||||
/*
|
||||
* Waiting for threads is not implemented yet.
|
||||
* If you want to see all threads running, uncomment the
|
||||
* call to SuspendThread(). The test application will
|
||||
* freeze after all threads are created.
|
||||
*/
|
||||
/* SuspendThread (GetCurrentThread()); */
|
||||
|
||||
#else
|
||||
|
||||
printf("Creating thread...\n");
|
||||
|
||||
hThread = CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
printf("Thread created. Waiting for termination...\n");
|
||||
|
||||
WaitForSingleObject (hThread,
|
||||
-1);
|
||||
|
||||
CloseHandle (hThread);
|
||||
|
||||
printf("Thread terminated...\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
41
reactos/apps/tests/bench/makefile
Normal file
41
reactos/apps/tests/bench/makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PROGS = bench-thread
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean: $(PROGS:%=%_clean)
|
||||
|
||||
$(PROGS:%=%_clean): %_clean:
|
||||
- $(RM) $*.o
|
||||
- $(RM) $*.exe
|
||||
- $(RM) $*.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
bench-thread.exe: bench-thread.c
|
||||
$(CC) $(CFLAGS) bench-thread.c -lkernel32 -o bench-thread.exe
|
||||
$(NM) --numeric-sort bench-thread.exe > bench-thread.sym
|
||||
|
||||
include ../../rules.mak
|
33
reactos/apps/tests/event/event.c
Normal file
33
reactos/apps/tests/event/event.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE events[2];
|
||||
|
||||
DWORD WINAPI thread( LPVOID crap )
|
||||
{
|
||||
SetEvent( events[0] );
|
||||
if( crap )
|
||||
SetEvent( events[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
DWORD id, Status;
|
||||
printf( "Creating events\n" );
|
||||
events[0] = CreateEvent( 0, TRUE, FALSE, 0 );
|
||||
events[1] = CreateEvent( 0, TRUE, FALSE, 0 );
|
||||
printf( "Created events\n" );
|
||||
CreateThread( 0, 0, thread, 0, 0, &id );
|
||||
printf( "WaitForSingleObject %s\n", ( WaitForSingleObject( events[0], INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
CreateThread( 0, 0, thread, 0, 0, &id );
|
||||
printf( "WaitForMultipleObjects with waitall = FALSE %s\n", ( WaitForMultipleObjects( 2, events, FALSE, INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
CreateThread( 0, 0, thread, (void *)1, 0, &id );
|
||||
Status = WaitForMultipleObjects( 2, events, TRUE, INFINITE );
|
||||
printf( "WaitForMultipleObjects with waitall = TRUE %s\n", ( Status == WAIT_OBJECT_0 || Status == WAIT_OBJECT_0 + 1 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
printf( "WaitForSingleObject with timeout %s\n", ( WaitForSingleObject( events[0], 100 ) == WAIT_TIMEOUT ? "worked" : "failed" ) );
|
||||
return 0;
|
||||
}
|
41
reactos/apps/tests/event/makefile
Normal file
41
reactos/apps/tests/event/makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PROGS = event
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean: $(PROGS:%=%_clean)
|
||||
|
||||
$(PROGS:%=%_clean): %_clean:
|
||||
- $(RM) $*.o
|
||||
- $(RM) $*.exe
|
||||
- $(RM) $*.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
event.exe: event.c
|
||||
$(CC) $(CFLAGS) event.c -lkernel32 -o event.exe
|
||||
$(NM) --numeric-sort event.exe > event.sym
|
||||
|
||||
include ../../rules.mak
|
8
reactos/apps/tests/hello/hello.c
Normal file
8
reactos/apps/tests/hello/hello.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("Hello world\n");
|
||||
return(0);
|
||||
}
|
39
reactos/apps/tests/hello/makefile
Normal file
39
reactos/apps/tests/hello/makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
OBJECTS = hello.o
|
||||
PROGS = hello.exe
|
||||
LIBS =
|
||||
CLEAN_FILES = hello.o hello.exe
|
||||
|
||||
all: hello.exe
|
||||
|
||||
clean: $(CLEAN_FILES:%=%_clean)
|
||||
|
||||
$(CLEAN_FILES:%=%_clean): %_clean:
|
||||
- $(RM) $*
|
||||
|
||||
.phony: clean $(CLEAN_FILES:%=%_clean)
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
hello.exe: $(OBJECTS)
|
||||
$(CC) $(OBJECTS) -o hello.exe
|
||||
|
||||
include ../../rules.mak
|
@@ -1,58 +0,0 @@
|
||||
/* Kill for Win32 by chris@dbn.lia.net
|
||||
* http://users.lia.net/chris/win32/
|
||||
* Public domain
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
inline int h2i(char x)
|
||||
{
|
||||
return (x + ((x & 0x40) >> 6) | ((x & 0x40) >> 3)) & 0x0f;
|
||||
}
|
||||
|
||||
void msg(HANDLE out, LPCTSTR fmt...)
|
||||
{
|
||||
char tmp[256];
|
||||
wvsprintf(tmp,fmt,(char*)&fmt+sizeof(fmt));
|
||||
DWORD w;
|
||||
WriteFile(out,tmp,lstrlen(tmp),&w,NULL);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
HANDLE stderr = GetStdHandle(STD_ERROR_HANDLE);
|
||||
|
||||
LPTSTR cmdline = GetCommandLine();
|
||||
|
||||
//Scan command line to end of program name
|
||||
while(*cmdline && *cmdline != ' ')
|
||||
if(*cmdline++ == '"')
|
||||
while(*cmdline && *cmdline++ != '"');
|
||||
|
||||
// Loop while we have parameters.
|
||||
while(*cmdline)
|
||||
{
|
||||
//scan past spaces..
|
||||
while(*cmdline == ' ')
|
||||
cmdline++;
|
||||
|
||||
//read in pid
|
||||
int pid = 0;
|
||||
while(*cmdline)
|
||||
pid = (pid << 4) + h2i(*cmdline++);
|
||||
|
||||
HANDLE p = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid);
|
||||
if(p)
|
||||
{
|
||||
if(TerminateProcess(p,(unsigned int)-9))
|
||||
msg(stdout,"Terminated PID: %08X\n",pid);
|
||||
else
|
||||
msg(stdout,"Couldn't kill PID: %08X, error=%d\n",pid,GetLastError());
|
||||
CloseHandle(p);
|
||||
}
|
||||
else
|
||||
msg(stderr,"No such PID: %08X, error=%d\n",pid,GetLastError());
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = kill
|
||||
|
||||
TARGET_SDKLIBS =
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
205
reactos/apps/tests/lpc/conport.c
Normal file
205
reactos/apps/tests/lpc/conport.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/* $Id: conport.c,v 1.5 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/conport.c
|
||||
*
|
||||
* To be run in a real WNT 4.0 system with
|
||||
* "\SmApiPort" as argument. Do not try to
|
||||
* connect to "\Windows\ApiPort" since that
|
||||
* reboots immeditely.
|
||||
*
|
||||
* Use Russinovich' HandleEx to verify
|
||||
* conport.exe owns two unnamed LPC ports:
|
||||
* the one created by kernel32.dll connecting
|
||||
* to csrss.exe, and one connected to here.
|
||||
*
|
||||
* 19990627 (Emanuele Aliberti)
|
||||
* Initial implementation.
|
||||
* 19990704 (EA)
|
||||
* Dump object's attributes moved in dumpinfo.c.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define PROTO_LPC
|
||||
#include <ddk/ntddk.h>
|
||||
#include "dumpinfo.h"
|
||||
|
||||
#define LPC_CONNECT_FLAG1 0x00000001
|
||||
#define LPC_CONNECT_FLAG2 0x00000010
|
||||
#define LPC_CONNECT_FLAG3 0x00000100
|
||||
#define LPC_CONNECT_FLAG4 0x00001000
|
||||
#define LPC_CONNECT_FLAG5 0x00010000
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * ConnectPort)(
|
||||
OUT PHANDLE PortHandle,
|
||||
IN PUNICODE_STRING PortName,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN DWORD Unknown3,
|
||||
IN DWORD Unknown4,
|
||||
IN DWORD Unknown5,
|
||||
IN DWORD Unknown6,
|
||||
IN ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * YieldExecution)(VOID);
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAXARG 1000000
|
||||
|
||||
|
||||
VOID
|
||||
TryConnectPort(char *port_name)
|
||||
{
|
||||
DWORD Status = 0;
|
||||
HANDLE Port = 0;
|
||||
int i;
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
WORD Name [BUF_SIZE] = {0};
|
||||
int dwx = 0;
|
||||
char * port_name_save = port_name;
|
||||
|
||||
/*
|
||||
* Convert the port's name to Unicode.
|
||||
*/
|
||||
for (
|
||||
PortName.Length = 0;
|
||||
( *port_name
|
||||
&& (PortName.Length < BUF_SIZE)
|
||||
);
|
||||
)
|
||||
{
|
||||
Name[PortName.Length++] = (WORD) *port_name++;
|
||||
}
|
||||
Name[PortName.Length] = 0;
|
||||
|
||||
PortName.Length = PortName.Length * sizeof (WORD);
|
||||
PortName.MaximumLength = PortName.Length + sizeof (WORD);
|
||||
PortName.Buffer = (PWSTR) Name;
|
||||
/*
|
||||
* Prepare the port object attributes.
|
||||
*/
|
||||
ObjectAttributes.Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory =
|
||||
NULL;
|
||||
ObjectAttributes.ObjectName =
|
||||
NULL /*& PortName */;
|
||||
ObjectAttributes.Attributes =
|
||||
OBJ_CASE_INSENSITIVE;
|
||||
ObjectAttributes.SecurityDescriptor =
|
||||
NULL;
|
||||
ObjectAttributes.SecurityQualityOfService =
|
||||
NULL;
|
||||
/*
|
||||
* Try to issue a connection request.
|
||||
*/
|
||||
Port = 0;
|
||||
Status = ConnectPort(
|
||||
& Port,
|
||||
& PortName,
|
||||
& ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
LPC_CONNECT_FLAG5
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DumpInfo(
|
||||
Name,
|
||||
Status,
|
||||
"connected",
|
||||
Port
|
||||
);
|
||||
/* Hot waiting */
|
||||
for (dwx=0; dwx<MAXARG; ++dwx)
|
||||
{
|
||||
YieldExecution();
|
||||
}
|
||||
if (FALSE == CloseHandle(Port))
|
||||
{
|
||||
printf(
|
||||
"Could not close the port handle %08X.\n",
|
||||
Port
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
printf(
|
||||
"Connection to port \"%s\" failed (Status = %08X).\n",
|
||||
port_name_save,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
main( int argc, char * argv[] )
|
||||
{
|
||||
HINSTANCE ntdll;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("WNT LPC Port Connector\n");
|
||||
printf("Usage: %s [port_name]\n",argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("LoadLibrary(NTDLL)\n");
|
||||
ntdll = LoadLibrary("NTDLL");
|
||||
if (ntdll == NULL)
|
||||
{
|
||||
printf("Could not load NTDLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtConnectPort)\n");
|
||||
ConnectPort = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtConnectPort"
|
||||
);
|
||||
if (ConnectPort == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtConnectPort\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
|
||||
QueryObject = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtQueryObject"
|
||||
);
|
||||
if (QueryObject == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtQueryObject\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
|
||||
YieldExecution = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtYieldExecution"
|
||||
);
|
||||
if (YieldExecution == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtYieldExecution\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("TryConnectPort(%s)\n",argv[1]);
|
||||
TryConnectPort(argv[1]);
|
||||
printf("Done\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
192
reactos/apps/tests/lpc/creport.c
Normal file
192
reactos/apps/tests/lpc/creport.c
Normal file
@@ -0,0 +1,192 @@
|
||||
/* $Id: creport.c,v 1.2 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/creport.c
|
||||
*
|
||||
* To be run in a real WNT 4.0 system to
|
||||
* create an LPC named port.
|
||||
*
|
||||
* Use Russinovich' HandleEx to verify
|
||||
* creport.exe owns the named LPC port
|
||||
* you asked to create.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define PROTO_LPC
|
||||
#include <ddk/ntddk.h>
|
||||
#include "dumpinfo.h"
|
||||
|
||||
#define LPC_CONNECT_FLAG1 0x00000001
|
||||
#define LPC_CONNECT_FLAG2 0x00000010
|
||||
#define LPC_CONNECT_FLAG3 0x00000100
|
||||
#define LPC_CONNECT_FLAG4 0x00001000
|
||||
#define LPC_CONNECT_FLAG5 0x00010000
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * CreatePort)(
|
||||
/*OUT PHANDLE PortHandle,*/
|
||||
PVOID Buffer,
|
||||
IN POBJECT_ATTRIBUTES PortAttributes OPTIONAL,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN DWORD Unknown3,
|
||||
IN ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * YieldExecution)(VOID);
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAXARG 5000000
|
||||
|
||||
|
||||
VOID
|
||||
TryCreatePort(char *port_name)
|
||||
{
|
||||
DWORD Status = 0;
|
||||
HANDLE Port = 0;
|
||||
int i;
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
WORD Name [BUF_SIZE] = {0};
|
||||
int dwx = 0;
|
||||
char * port_name_save = port_name;
|
||||
|
||||
/*
|
||||
* Convert the port's name to Unicode.
|
||||
*/
|
||||
for (
|
||||
PortName.Length = 0;
|
||||
( *port_name
|
||||
&& (PortName.Length < BUF_SIZE)
|
||||
);
|
||||
)
|
||||
{
|
||||
Name[PortName.Length++] = (WORD) *port_name++;
|
||||
}
|
||||
Name[PortName.Length] = 0;
|
||||
|
||||
PortName.Length = PortName.Length * sizeof (WORD);
|
||||
PortName.MaximumLength = PortName.Length + sizeof (WORD);
|
||||
PortName.Buffer = (PWSTR) Name;
|
||||
/*
|
||||
* Prepare the port object attributes.
|
||||
*/
|
||||
ObjectAttributes.Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory =
|
||||
NULL;
|
||||
ObjectAttributes.ObjectName =
|
||||
& PortName;
|
||||
ObjectAttributes.Attributes =
|
||||
0; //OBJ_CASE_INSENSITIVE --> STATUS_INVALID_PARAMETER ==> case sensitive!;
|
||||
ObjectAttributes.SecurityDescriptor =
|
||||
NULL;
|
||||
ObjectAttributes.SecurityQualityOfService =
|
||||
NULL;
|
||||
/*
|
||||
* Try to issue a connection request.
|
||||
*/
|
||||
Port = 0;
|
||||
Status = CreatePort(
|
||||
& Port,
|
||||
& ObjectAttributes,
|
||||
0, /* ACCESS_MASK? */
|
||||
0, /* Unknown3 */
|
||||
LPC_CONNECT_FLAG5
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DumpInfo(
|
||||
Name,
|
||||
Status,
|
||||
"created",
|
||||
Port
|
||||
);
|
||||
/* Hot waiting */
|
||||
for (dwx=0; dwx<MAXARG; ++dwx)
|
||||
{
|
||||
YieldExecution();
|
||||
}
|
||||
if (FALSE == CloseHandle(Port))
|
||||
{
|
||||
printf(
|
||||
"Could not close the port handle %08X.\n",
|
||||
Port
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
printf(
|
||||
"Creating port \"%s\" failed (Status = %08X).\n",
|
||||
port_name_save,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
main( int argc, char * argv[] )
|
||||
{
|
||||
HINSTANCE ntdll;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("WNT LPC Port Creator\n");
|
||||
printf("Usage: %s [port_name]\n",argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("LoadLibrary(NTDLL)\n");
|
||||
ntdll = LoadLibrary("NTDLL");
|
||||
if (ntdll == NULL)
|
||||
{
|
||||
printf("Could not load NTDLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtCreatePort)\n");
|
||||
CreatePort = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtCreatePort"
|
||||
);
|
||||
if (CreatePort == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtCreatePort\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
|
||||
QueryObject = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtQueryObject"
|
||||
);
|
||||
if (QueryObject == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtQueryObject\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
|
||||
YieldExecution = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtYieldExecution"
|
||||
);
|
||||
if (YieldExecution == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtYieldExecution\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("TryCreatePort(%s)\n",argv[1]);
|
||||
TryCreatePort(argv[1]);
|
||||
printf("Done\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
239
reactos/apps/tests/lpc/dumpinfo.c
Normal file
239
reactos/apps/tests/lpc/dumpinfo.c
Normal file
@@ -0,0 +1,239 @@
|
||||
/* $Id: dumpinfo.c,v 1.2 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/dumpinfo.c
|
||||
*
|
||||
* ReactOS Operating System
|
||||
*
|
||||
* Dump a kernel object's attributes by its handle.
|
||||
*
|
||||
* 19990627 (Emanuele Aliberti)
|
||||
* Initial implementation.
|
||||
* 19990704 (EA)
|
||||
* Added code to find the basic information buffer size
|
||||
* for the LPC port object.
|
||||
* 19990710 (EA)
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAX_BASIC_INFO_SIZE 512
|
||||
|
||||
|
||||
extern
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
extern
|
||||
NTSTATUS
|
||||
(STDCALL * QueryInformationPort)(
|
||||
IN HANDLE PortHandle,
|
||||
IN CINT PortInformationClass, /* guess */
|
||||
OUT PVOID PortInformation, /* guess */
|
||||
IN ULONG PortInformationLength, /* guess */
|
||||
OUT PULONG ReturnLength /* guess */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
static
|
||||
VOID
|
||||
DumpBuffer(
|
||||
char *Name,
|
||||
BYTE *buffer,
|
||||
ULONG size
|
||||
)
|
||||
{
|
||||
register ULONG i = 0;
|
||||
|
||||
printf("%s [%d] = ",Name,size);
|
||||
for ( i = 0;
|
||||
i != size;
|
||||
++i
|
||||
)
|
||||
{
|
||||
printf("%02X",buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
*/
|
||||
|
||||
VOID
|
||||
DumpInfo (
|
||||
LPCWSTR Name,
|
||||
NTSTATUS Status,
|
||||
LPCWSTR Comment,
|
||||
HANDLE Port
|
||||
)
|
||||
{
|
||||
BYTE ObjectInformation [BUF_SIZE] = {0};
|
||||
ULONG ResultLength;
|
||||
|
||||
wprintf(
|
||||
L"Port \"%s\" %s:\n",
|
||||
Name,
|
||||
Comment
|
||||
);
|
||||
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
printf("\tPort = %08X\n\n",Port);
|
||||
/*
|
||||
* Query object information.
|
||||
*/
|
||||
printf("Basic Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectBasicInformation,
|
||||
ObjectInformation,
|
||||
sizeof (LPC_PORT_BASIC_INFORMATION),
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
PLPC_PORT_BASIC_INFORMATION i;
|
||||
|
||||
i = (PLPC_PORT_BASIC_INFORMATION) ObjectInformation;
|
||||
|
||||
printf( "\tUnknown01 = 0x%08X\n", i->Unknown0 );
|
||||
printf( "\tUnknown02 = 0x%08X\n", i->Unknown1 );
|
||||
printf( "\tUnknown03 = 0x%08X\n", i->Unknown2 );
|
||||
printf( "\tUnknown04 = 0x%08X\n", i->Unknown3 );
|
||||
printf( "\tUnknown05 = 0x%08X\n", i->Unknown4 );
|
||||
printf( "\tUnknown06 = 0x%08X\n", i->Unknown5 );
|
||||
printf( "\tUnknown07 = 0x%08X\n", i->Unknown6 );
|
||||
printf( "\tUnknown08 = 0x%08X\n", i->Unknown7 );
|
||||
printf( "\tUnknown09 = 0x%08X\n", i->Unknown8 );
|
||||
printf( "\tUnknown10 = 0x%08X\n", i->Unknown9 );
|
||||
printf( "\tUnknown11 = 0x%08X\n", i->Unknown10 );
|
||||
printf( "\tUnknown12 = 0x%08X\n", i->Unknown11 );
|
||||
printf( "\tUnknown13 = 0x%08X\n", i->Unknown12 );
|
||||
printf( "\tUnknown14 = 0x%08X\n", i->Unknown13 );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Type Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectTypeInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_TYPE_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_TYPE_INFORMATION *) ObjectInformation;
|
||||
|
||||
wprintf(
|
||||
L"\tName: \"%s\"\n",
|
||||
(i->Name.Length ? i->Name.Buffer : L"")
|
||||
);
|
||||
/*
|
||||
FIXME: why this always raise an access violation exception?
|
||||
wprintf(
|
||||
L"\tType: \"%s\"\n",
|
||||
(i->Type.Length ? i->Type.Buffer : L"")
|
||||
);
|
||||
/**/
|
||||
printf(
|
||||
"\tTotal Handles: %d\n",
|
||||
i->TotalHandles
|
||||
);
|
||||
printf(
|
||||
"\tReference Count: %d\n",
|
||||
i->ReferenceCount
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Name Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectNameInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_NAME_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_NAME_INFORMATION *) ObjectInformation;
|
||||
wprintf(
|
||||
L"\tName: \"%s\"\n",
|
||||
(i->Name.Length ? i->Name.Buffer : L"")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Data Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectDataInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_DATA_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_DATA_INFORMATION *) ObjectInformation;
|
||||
printf(
|
||||
"\tInherit Handle: %s\n",
|
||||
(i->bInheritHandle ? "TRUE" : "FALSE")
|
||||
);
|
||||
printf(
|
||||
"\tProtect from Close: %s\n",
|
||||
(i->bProtectFromClose ? "TRUE" : "FALSE")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
//---
|
||||
printf("Port Information:\n");
|
||||
/* Status = QueryInformationPort(
|
||||
Port,
|
||||
1, /* info class * /
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DWORD * i = ObjectInformation;
|
||||
int j = 0;
|
||||
|
||||
while (j < ResultLength / sizeof (DWORD))
|
||||
{
|
||||
printf("\t%08X\n",i[j]);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
8
reactos/apps/tests/lpc/dumpinfo.h
Normal file
8
reactos/apps/tests/lpc/dumpinfo.h
Normal file
@@ -0,0 +1,8 @@
|
||||
VOID
|
||||
DumpInfo (
|
||||
LPCWSTR Name,
|
||||
NTSTATUS Status,
|
||||
LPCWSTR Comment,
|
||||
HANDLE Port
|
||||
);
|
||||
|
62
reactos/apps/tests/lpc/lpcclt.c
Normal file
62
reactos/apps/tests/lpc/lpcclt.c
Normal file
@@ -0,0 +1,62 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName;
|
||||
NTSTATUS Status;
|
||||
HANDLE PortHandle;
|
||||
LPCMESSAGE Request;
|
||||
ULONG ConnectInfoLength;
|
||||
|
||||
printf("(lpcclt.exe) Lpc client\n");
|
||||
|
||||
RtlInitUnicodeString(&PortName, L"\\TestPort");
|
||||
|
||||
printf("(lpcclt.exe) Connecting to port\n");
|
||||
ConnectInfoLength = 0;
|
||||
Status = NtConnectPort(&PortHandle,
|
||||
&PortName,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
&ConnectInfoLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcclt.exe) Failed to connect\n");
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(Request.MessageData, GetCommandLineA());
|
||||
Request.ActualMessageLength = strlen(Request.MessageData);
|
||||
Request.TotalMessageLength = sizeof(LPCMESSAGE);
|
||||
|
||||
printf("(lpcclt.exe) Sending message\n");
|
||||
Status = NtRequestPort(PortHandle, &Request);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcclt.exe) Failed to send request\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(lpcclt.exe) Succeeded\n");
|
||||
}
|
98
reactos/apps/tests/lpc/lpcsrv.c
Normal file
98
reactos/apps/tests/lpc/lpcsrv.c
Normal file
@@ -0,0 +1,98 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status;
|
||||
HANDLE NamedPortHandle;
|
||||
HANDLE PortHandle;
|
||||
LPCMESSAGE ConnectMsg;
|
||||
|
||||
printf("(lpcsrv.exe) Lpc test server\n");
|
||||
|
||||
RtlInitUnicodeString(&PortName, L"\\TestPort");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&PortName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
printf("(lpcsrv.exe) Creating port\n");
|
||||
Status = NtCreatePort(&NamedPortHandle,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to create port\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
printf("(lpcsrv.exe) Listening for connections\n");
|
||||
Status = NtListenPort(NamedPortHandle,
|
||||
&ConnectMsg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to listen for connections\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Accepting connections\n");
|
||||
Status = NtAcceptConnectPort(&PortHandle,
|
||||
NamedPortHandle,
|
||||
NULL,
|
||||
1,
|
||||
0,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to accept connection\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Completing connection\n");
|
||||
Status = NtCompleteConnectPort(PortHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to complete connection\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
LPCMESSAGE Request;
|
||||
|
||||
Status = NtReplyWaitReceivePort(PortHandle,
|
||||
0,
|
||||
NULL,
|
||||
&Request);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("(lpcsrv.exe) Failed to receive request\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(lpcsrv.exe) Message contents are <%s>\n", Request.MessageData);
|
||||
}
|
||||
}
|
51
reactos/apps/tests/lpc/makefile
Normal file
51
reactos/apps/tests/lpc/makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
SRV_OBJECTS= ../common/crt0.o lpcsrv.o
|
||||
CLT_OBJECTS= ../common/crt0.o lpcclt.o
|
||||
|
||||
PROGS= lpcsrv.exe lpcclt.exe
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
|
||||
../../lib/ntdll/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) lpcsrv.o
|
||||
- $(RM) lpcsrv.exe
|
||||
- $(RM) lpcsrv.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
lpcsrv.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(LD) $(SRV_OBJECTS) $(LIBS) -o lpcsrv.exe
|
||||
$(NM) --numeric-sort lpcsrv.exe > lpcsrv.sym
|
||||
|
||||
lpcclt.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(LD) $(CLT_OBJECTS) $(LIBS) -o lpcclt.exe
|
||||
$(NM) --numeric-sort lpcclt.exe > lpcclt.sym
|
||||
|
||||
|
||||
include ../../rules.mak
|
51
reactos/apps/tests/shm/makefile
Normal file
51
reactos/apps/tests/shm/makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
SRV_OBJECTS= ../common/crt0.o shmsrv.o
|
||||
CLT_OBJECTS= ../common/crt0.o shmclt.o
|
||||
|
||||
PROGS= shmsrv.exe shmclt.exe
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
|
||||
../../lib/ntdll/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o
|
||||
- $(RM) *.exe
|
||||
- $(RM) *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
shmsrv.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(LD) $(SRV_OBJECTS) $(LIBS) -o shmsrv.exe
|
||||
$(NM) --numeric-sort shmsrv.exe > shmsrv.sym
|
||||
|
||||
shmclt.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(LD) $(CLT_OBJECTS) $(LIBS) -o shmclt.exe
|
||||
$(NM) --numeric-sort shmsrv.exe > shmclt.sym
|
||||
|
||||
|
||||
include ../../rules.mak
|
60
reactos/apps/tests/shm/shmclt.c
Normal file
60
reactos/apps/tests/shm/shmclt.c
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
HANDLE Section;
|
||||
PVOID BaseAddress;
|
||||
char buffer[256];
|
||||
|
||||
printf("Shm test server\n");
|
||||
|
||||
Section = OpenFileMappingW (
|
||||
// PAGE_EXECUTE_READWRITE, invalid parameter
|
||||
FILE_MAP_WRITE,
|
||||
FALSE,
|
||||
L"TestSection"
|
||||
);
|
||||
if (Section == NULL)
|
||||
{
|
||||
printf("Failed to open section (err=%d)", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
BaseAddress = MapViewOfFile(Section,
|
||||
FILE_MAP_ALL_ACCESS,
|
||||
0,
|
||||
0,
|
||||
8192);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to map section (err=%d)\n", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
printf("BaseAddress %x\n", (UINT) BaseAddress);
|
||||
printf("Copying from section\n");
|
||||
strcpy(buffer, BaseAddress);
|
||||
printf("Copyed <%s>\n", buffer);
|
||||
|
||||
// for(;;);
|
||||
return 0;
|
||||
}
|
||||
|
52
reactos/apps/tests/shm/shmsrv.c
Normal file
52
reactos/apps/tests/shm/shmsrv.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/* $Id: shmsrv.c,v 1.3 1999/12/30 01:51:36 dwelch Exp $
|
||||
*
|
||||
* FILE : reactos/apps/shm/shmsrv.c
|
||||
* AUTHOR: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
HANDLE Section;
|
||||
PVOID BaseAddress;
|
||||
|
||||
printf("Shm test server\n");
|
||||
|
||||
Section = CreateFileMappingW (
|
||||
(HANDLE) 0xFFFFFFFF,
|
||||
NULL,
|
||||
PAGE_READWRITE,
|
||||
0,
|
||||
8192,
|
||||
L"TestSection"
|
||||
);
|
||||
if (Section == NULL)
|
||||
{
|
||||
printf("Failed to create section (err=%d)", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Mapping view of section\n");
|
||||
BaseAddress = MapViewOfFile(Section,
|
||||
FILE_MAP_ALL_ACCESS,
|
||||
0,
|
||||
0,
|
||||
8192);
|
||||
printf("BaseAddress %x\n", (UINT) BaseAddress);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to map section\n");
|
||||
}
|
||||
|
||||
printf("Copying to section\n");
|
||||
printf("Copying %s\n", GetCommandLineA());
|
||||
strcpy(BaseAddress, GetCommandLineA());
|
||||
|
||||
for(;;);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
11
reactos/apps/tests/test_old/bug2.c
Normal file
11
reactos/apps/tests/test_old/bug2.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int i;
|
||||
puts ("This should print \"wow = I\" for I from 0 to 39 inclusive.");
|
||||
for (i = 0; i < 40; i++)
|
||||
printf ("%s = %d\n", "wow", i);
|
||||
return 0;
|
||||
}
|
53
reactos/apps/tests/test_old/bug3.c
Normal file
53
reactos/apps/tests/test_old/bug3.c
Normal file
@@ -0,0 +1,53 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
const char filename[] = "/tmp/bug3.test";
|
||||
|
||||
f = fopen(filename, "w+");
|
||||
for (i=0; i<9000; i++)
|
||||
putc ('x', f);
|
||||
fseek (f, 8180L, 0);
|
||||
fwrite ("Where does this text go?", 1, 24, f);
|
||||
fflush (f);
|
||||
|
||||
rewind (f);
|
||||
for (i=0; i<9000; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
if ((j = getc(f)) != 'x')
|
||||
{
|
||||
if (i != 8180)
|
||||
{
|
||||
printf ("Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[25];
|
||||
|
||||
buf[0] = j;
|
||||
fread (buf + 1, 1, 23, f);
|
||||
buf[24] = '\0';
|
||||
if (strcmp (buf, "Where does this text go?") != 0)
|
||||
{
|
||||
printf ("%s\nTest FAILED!\n", buf);
|
||||
return 1;
|
||||
}
|
||||
i += 23;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
remove(filename);
|
||||
|
||||
puts ("Test succeeded.");
|
||||
|
||||
return 0;
|
||||
}
|
74
reactos/apps/tests/test_old/makefile
Normal file
74
reactos/apps/tests/test_old/makefile
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PROGS= test-stdio tst-printf tstdiomisc bug2 bug3 \
|
||||
temptest test-fseek test_rdwr
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
$(PROGS:%=%_clean): %_clean:
|
||||
- $(RM) $*.o
|
||||
- $(RM) $*.exe
|
||||
- $(RM) $*.sym
|
||||
|
||||
clean: $(PROGS:%=%_clean)
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
bug2.exe: bug2.c
|
||||
$(CC) bug2.c -lkernel32 -o bug2.exe
|
||||
$(NM) --numeric-sort bug2.exe > bug2.sym
|
||||
|
||||
bug3.exe: bug3.c
|
||||
$(CC) bug3.c -lkernel32 -o bug3.exe
|
||||
$(NM) --numeric-sort bug3.exe > bug3.sym
|
||||
|
||||
temptest.exe: temptest.c
|
||||
$(CC) temptest.c -lkernel32 -o temptest.exe
|
||||
$(NM) --numeric-sort temptest.exe > temptest.sym
|
||||
|
||||
test-fseek.exe: test-fseek.c
|
||||
$(CC) test-fseek.c -lkernel32 -o test-fseek.exe
|
||||
$(NM) --numeric-sort test-fseek.exe > test-fseek.sym
|
||||
|
||||
test-fwrite.exe: test-fwrite.c
|
||||
$(CC) test-fwrite.c -lkernel32 -o test-fwrite.exe
|
||||
$(NM) --numeric-sort test-fwrite.exe > test-fwrite.sym
|
||||
|
||||
test_rdwr.exe: test_rdwr.c
|
||||
$(CC) test_rdwr.c -lkernel32 -o test_rdwr.exe
|
||||
$(NM) --numeric-sort test_rdwr.exe > test_rdwr.sym
|
||||
|
||||
test-stdio.exe: test-stdio.c
|
||||
$(CC) test-stdio.c -lkernel32 -o test-stdio.exe
|
||||
$(NM) --numeric-sort test-stdio.exe > test-stdio.sym
|
||||
|
||||
tst-printf.exe: tst-printf.c
|
||||
$(CC) tst-printf.c -lkernel32 -o tst-printf.exe
|
||||
$(NM) --numeric-sort tst-printf.exe > tst-printf.sym
|
||||
|
||||
tstdiomisc.exe: tstdiomisc.c
|
||||
$(CC) tstdiomisc.c -lkernel32 -o tstdiomisc.exe
|
||||
$(NM) --numeric-sort tstdiomisc.exe > tstdiomisc.sym
|
||||
|
||||
include ../../rules.mak
|
27
reactos/apps/tests/test_old/temptest.c
Normal file
27
reactos/apps/tests/test_old/temptest.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *files[500];
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 500; i++) {
|
||||
files[i] = tempnam (NULL, "file");
|
||||
if (files[i] == NULL) {
|
||||
printf ("tempnam failed\n");
|
||||
exit (1);
|
||||
}
|
||||
printf ("file: %s\n", files[i]);
|
||||
fp = fopen (files[i], "w");
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
for (i = 0; i < 500; i++)
|
||||
remove (files[i]);
|
||||
|
||||
exit (0);
|
||||
}
|
85
reactos/apps/tests/test_old/test-fseek.c
Normal file
85
reactos/apps/tests/test_old/test-fseek.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define TESTFILE "/tmp/test.dat"
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
FILE *fp;
|
||||
int i, j;
|
||||
|
||||
puts ("\nFile seek test");
|
||||
fp = fopen (TESTFILE, "w");
|
||||
if (fp == NULL)
|
||||
{
|
||||
perror (TESTFILE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
putc (i, fp);
|
||||
if (freopen (TESTFILE, "r", fp) != fp)
|
||||
{
|
||||
perror ("Cannot open file for reading");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 1; i <= 255; i++)
|
||||
{
|
||||
printf ("%3d\n", i);
|
||||
fseek (fp, (long) -i, SEEK_END);
|
||||
if ((j = getc (fp)) != 256 - i)
|
||||
{
|
||||
printf ("SEEK_END failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) i, SEEK_SET))
|
||||
{
|
||||
puts ("Cannot SEEK_SET");
|
||||
break;
|
||||
}
|
||||
if ((j = getc (fp)) != i)
|
||||
{
|
||||
printf ("SEEK_SET failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) i, SEEK_SET))
|
||||
{
|
||||
puts ("Cannot SEEK_SET");
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) (i >= 128 ? -128 : 128), SEEK_CUR))
|
||||
{
|
||||
puts ("Cannot SEEK_CUR");
|
||||
break;
|
||||
}
|
||||
if ((j = getc (fp)) != (i >= 128 ? i - 128 : i + 128))
|
||||
{
|
||||
printf ("SEEK_CUR failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose (fp);
|
||||
remove (TESTFILE);
|
||||
|
||||
puts ((i > 255) ? "Test succeeded." : "Test FAILED!");
|
||||
return (i > 255) ? 0 : 1;
|
||||
}
|
68
reactos/apps/tests/test_old/test-fwrite.c
Normal file
68
reactos/apps/tests/test_old/test-fwrite.c
Normal file
@@ -0,0 +1,68 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
FILE *f = tmpfile ();
|
||||
char obuf[99999], ibuf[sizeof obuf];
|
||||
char *line;
|
||||
size_t linesz;
|
||||
|
||||
if (! f)
|
||||
{
|
||||
perror ("tmpfile");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fputs ("line\n", f) == EOF)
|
||||
{
|
||||
perror ("fputs");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset (obuf, 'z', sizeof obuf);
|
||||
memset (ibuf, 'y', sizeof ibuf);
|
||||
|
||||
if (fwrite (obuf, sizeof obuf, 1, f) != 1)
|
||||
{
|
||||
perror ("fwrite");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rewind (f);
|
||||
|
||||
line = NULL;
|
||||
linesz = 0;
|
||||
if (getline (&line, &linesz, f) != 5)
|
||||
{
|
||||
perror ("getline");
|
||||
return 1;
|
||||
}
|
||||
if (strcmp (line, "line\n"))
|
||||
{
|
||||
puts ("Lines differ. Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fread (ibuf, sizeof ibuf, 1, f) != 1)
|
||||
{
|
||||
perror ("fread");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (memcmp (ibuf, obuf, sizeof ibuf))
|
||||
{
|
||||
puts ("Buffers differ. Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
asprintf (&line, "\
|
||||
GDB is free software and you are welcome to distribute copies of it\n\
|
||||
under certain conditions; type \"show copying\" to see the conditions.\n\
|
||||
There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
|
||||
");
|
||||
|
||||
puts ("Test succeeded.");
|
||||
return 0;
|
||||
}
|
55
reactos/apps/tests/test_old/test-stdio.c
Normal file
55
reactos/apps/tests/test_old/test-stdio.c
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char msg1[] = "testing _write\n";
|
||||
char msg2[] = "testing putchar.";
|
||||
char msg3[] = "testing printf.";
|
||||
char tmpbuf[255];
|
||||
FILE* f1;
|
||||
|
||||
write(1, msg1, strlen(msg1));
|
||||
|
||||
write(1, msg2, strlen(msg2));
|
||||
putchar('o'); putchar('k'); putchar('\n');
|
||||
|
||||
write(1, msg3, strlen(msg3));
|
||||
printf("ok\n");
|
||||
|
||||
printf("Testing fopen\n");
|
||||
f1 = fopen("tmp.txt","w+b");
|
||||
if (f1 == NULL)
|
||||
{
|
||||
printf("fopen failed\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fwrite\n");
|
||||
if (fwrite(msg1, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
|
||||
{
|
||||
printf("fwrite failed\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fread\n");
|
||||
fseek(f1, 0, SEEK_SET);
|
||||
if (fread(tmpbuf, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
|
||||
{
|
||||
printf("fread failed\n");
|
||||
return(1);
|
||||
}
|
||||
if (strcmp(tmpbuf,msg1) != 0)
|
||||
{
|
||||
printf("fread failed, data corrupt\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fclose\n");
|
||||
if (fclose(f1) != 0)
|
||||
{
|
||||
printf("fclose failed\n");
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
129
reactos/apps/tests/test_old/test_rdwr.c
Normal file
129
reactos/apps/tests/test_old/test_rdwr.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
static const char hello[] = "Hello, world.\n";
|
||||
static const char replace[] = "Hewwo, world.\n";
|
||||
static const size_t replace_from = 2, replace_to = 4;
|
||||
char filename[FILENAME_MAX];
|
||||
char *name = strrchr (*argv, '/');
|
||||
char buf[BUFSIZ];
|
||||
FILE *f;
|
||||
int lose = 0;
|
||||
|
||||
if (name != NULL)
|
||||
++name;
|
||||
else
|
||||
name = *argv;
|
||||
|
||||
(void) sprintf (filename, "/tmp/%s.test", name);
|
||||
|
||||
f = fopen (filename, "w+");
|
||||
if (f == NULL)
|
||||
{
|
||||
perror (filename);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
(void) fputs (hello, f);
|
||||
rewind (f);
|
||||
(void) fgets (buf, sizeof (buf), f);
|
||||
rewind (f);
|
||||
(void) fputs (buf, f);
|
||||
rewind (f);
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < replace_from; ++i)
|
||||
{
|
||||
int c = getc (f);
|
||||
if (c == EOF)
|
||||
{
|
||||
printf ("EOF at %Zu.\n", i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
else if (c != hello[i])
|
||||
{
|
||||
printf ("Got '%c' instead of '%c' at %Zu.\n",
|
||||
(unsigned char) c, hello[i], i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
long int where = ftell (f);
|
||||
if (where == (long int) replace_from)
|
||||
{
|
||||
register size_t i;
|
||||
for (i = replace_from; i < replace_to; ++i)
|
||||
if (putc(replace[i], f) == EOF)
|
||||
{
|
||||
printf ("putc('%c') got %s at %Zu.\n",
|
||||
replace[i], strerror (errno), i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (where == -1L)
|
||||
{
|
||||
printf ("ftell got %s (should be at %Zu).\n",
|
||||
strerror (errno), replace_from);
|
||||
lose = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("ftell returns %lu; should be %Zu.\n", where, replace_from);
|
||||
lose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!lose)
|
||||
{
|
||||
rewind (f);
|
||||
if (fgets (buf, sizeof (buf), f) == NULL)
|
||||
{
|
||||
printf ("fgets got %s.\n", strerror(errno));
|
||||
lose = 1;
|
||||
}
|
||||
else if (strcmp (buf, replace))
|
||||
{
|
||||
printf ("Read \"%s\" instead of \"%s\".\n", buf, replace);
|
||||
lose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (lose)
|
||||
printf ("Test FAILED! Losing file is \"%s\".\n", filename);
|
||||
else
|
||||
{
|
||||
(void) remove (filename);
|
||||
puts ("Test succeeded.");
|
||||
}
|
||||
|
||||
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
311
reactos/apps/tests/test_old/tst-printf.c
Normal file
311
reactos/apps/tests/test_old/tst-printf.c
Normal file
@@ -0,0 +1,311 @@
|
||||
/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef BSD
|
||||
#include </usr/include/stdio.h>
|
||||
#define EXIT_SUCCESS 0
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <float.h>
|
||||
|
||||
void rfg1 (void);
|
||||
void rfg2 (void);
|
||||
|
||||
|
||||
void
|
||||
fmtchk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
void
|
||||
fmtst1chk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 4, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
void
|
||||
fmtst2chk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 4, 4, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
/* This page is covered by the following copyright: */
|
||||
|
||||
/* (C) Copyright C E Chew
|
||||
*
|
||||
* Feel free to copy, use and distribute this software provided:
|
||||
*
|
||||
* 1. you do not pretend that you wrote it
|
||||
* 2. you leave this copyright notice intact.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Extracted from exercise.c for glibc-1.05 bug report by Bruce Evans.
|
||||
*/
|
||||
|
||||
#define DEC -123
|
||||
#define INT 255
|
||||
#define UNS (~0)
|
||||
|
||||
/* Formatted Output Test
|
||||
*
|
||||
* This exercises the output formatting code.
|
||||
*/
|
||||
|
||||
void
|
||||
fp_test (void)
|
||||
{
|
||||
int i, j, k, l;
|
||||
char buf[7];
|
||||
char *prefix = buf;
|
||||
char tp[20];
|
||||
|
||||
puts("\nFormatted output test");
|
||||
printf("prefix 6d 6o 6x 6X 6u\n");
|
||||
strcpy(prefix, "%");
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
for (k = 0; k < 2; k++) {
|
||||
for (l = 0; l < 2; l++) {
|
||||
strcpy(prefix, "%");
|
||||
if (i == 0) strcat(prefix, "-");
|
||||
if (j == 0) strcat(prefix, "+");
|
||||
if (k == 0) strcat(prefix, "#");
|
||||
if (l == 0) strcat(prefix, "0");
|
||||
printf("%5s |", prefix);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6d |");
|
||||
printf(tp, DEC);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6o |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6x |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6X |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6u |");
|
||||
printf(tp, UNS);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("%10s\n", (char *) NULL);
|
||||
printf("%-10s\n", (char *) NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
static char shortstr[] = "Hi, Z.";
|
||||
static char longstr[] = "Good morning, Doctor Chandra. This is Hal. \
|
||||
I am ready for my first lesson today.";
|
||||
|
||||
fmtchk("%.4x");
|
||||
fmtchk("%04x");
|
||||
fmtchk("%4.4x");
|
||||
fmtchk("%04.4x");
|
||||
fmtchk("%4.3x");
|
||||
fmtchk("%04.3x");
|
||||
|
||||
fmtst1chk("%.*x");
|
||||
fmtst1chk("%0*x");
|
||||
fmtst2chk("%*.*x");
|
||||
fmtst2chk("%0*.*x");
|
||||
|
||||
#ifndef BSD
|
||||
printf("bad format:\t\"%b\"\n");
|
||||
printf("nil pointer (padded):\t\"%10p\"\n", (void *) NULL);
|
||||
#endif
|
||||
|
||||
printf("decimal negative:\t\"%d\"\n", -2345);
|
||||
printf("octal negative:\t\"%o\"\n", -2345);
|
||||
printf("hex negative:\t\"%x\"\n", -2345);
|
||||
printf("long decimal number:\t\"%ld\"\n", -123456L);
|
||||
printf("long octal negative:\t\"%lo\"\n", -2345L);
|
||||
printf("long unsigned decimal number:\t\"%lu\"\n", -123456L);
|
||||
printf("zero-padded LDN:\t\"%010ld\"\n", -123456L);
|
||||
printf("left-adjusted ZLDN:\t\"%-010ld\"\n", -123456);
|
||||
printf("space-padded LDN:\t\"%10ld\"\n", -123456L);
|
||||
printf("left-adjusted SLDN:\t\"%-10ld\"\n", -123456L);
|
||||
|
||||
printf("zero-padded string:\t\"%010s\"\n", shortstr);
|
||||
printf("left-adjusted Z string:\t\"%-010s\"\n", shortstr);
|
||||
printf("space-padded string:\t\"%10s\"\n", shortstr);
|
||||
printf("left-adjusted S string:\t\"%-10s\"\n", shortstr);
|
||||
printf("null string:\t\"%s\"\n", (char *)NULL);
|
||||
printf("limited string:\t\"%.22s\"\n", longstr);
|
||||
|
||||
printf("e-style >= 1:\t\"%e\"\n", 12.34);
|
||||
printf("e-style >= .1:\t\"%e\"\n", 0.1234);
|
||||
printf("e-style < .1:\t\"%e\"\n", 0.001234);
|
||||
printf("e-style big:\t\"%.60e\"\n", 1e20);
|
||||
printf ("e-style == .1:\t\"%e\"\n", 0.1);
|
||||
printf("f-style >= 1:\t\"%f\"\n", 12.34);
|
||||
printf("f-style >= .1:\t\"%f\"\n", 0.1234);
|
||||
printf("f-style < .1:\t\"%f\"\n", 0.001234);
|
||||
printf("g-style >= 1:\t\"%g\"\n", 12.34);
|
||||
printf("g-style >= .1:\t\"%g\"\n", 0.1234);
|
||||
printf("g-style < .1:\t\"%g\"\n", 0.001234);
|
||||
printf("g-style big:\t\"%.60g\"\n", 1e20);
|
||||
|
||||
printf (" %6.5f\n", .099999999860301614);
|
||||
printf (" %6.5f\n", .1);
|
||||
printf ("x%5.4fx\n", .5);
|
||||
|
||||
printf ("%#03x\n", 1);
|
||||
|
||||
{
|
||||
double d = FLT_MIN;
|
||||
int niter = 17;
|
||||
|
||||
while (niter-- != 0)
|
||||
printf ("%.17e\n", d / 2);
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
printf ("%15.5e\n", 4.9406564584124654e-324);
|
||||
|
||||
#define FORMAT "|%12.4f|%12.4e|%12.4g|\n"
|
||||
printf (FORMAT, 0.0, 0.0, 0.0);
|
||||
printf (FORMAT, 1.0, 1.0, 1.0);
|
||||
printf (FORMAT, -1.0, -1.0, -1.0);
|
||||
printf (FORMAT, 100.0, 100.0, 100.0);
|
||||
printf (FORMAT, 1000.0, 1000.0, 1000.0);
|
||||
printf (FORMAT, 10000.0, 10000.0, 10000.0);
|
||||
printf (FORMAT, 12345.0, 12345.0, 12345.0);
|
||||
printf (FORMAT, 100000.0, 100000.0, 100000.0);
|
||||
printf (FORMAT, 123456.0, 123456.0, 123456.0);
|
||||
#undef FORMAT
|
||||
|
||||
{
|
||||
char buf[20];
|
||||
printf ("sprintf (\"%%30s\", \"foo\") == %d, \"%.*s\"\n",
|
||||
sprintf (buf, "%30s", "foo"), sizeof (buf), buf);
|
||||
}
|
||||
|
||||
fp_test ();
|
||||
|
||||
printf ("%e should be 1.234568e+06\n", 1234567.8);
|
||||
printf ("%f should be 1234567.800000\n", 1234567.8);
|
||||
printf ("%g should be 1.23457e+06\n", 1234567.8);
|
||||
printf ("%g should be 123.456\n", 123.456);
|
||||
printf ("%g should be 1e+06\n", 1000000.0);
|
||||
printf ("%g should be 10\n", 10.0);
|
||||
printf ("%g should be 0.02\n", 0.02);
|
||||
|
||||
{
|
||||
double x=1.0;
|
||||
printf("%.17f\n",(1.0/x/10.0+1.0)*x-x);
|
||||
}
|
||||
|
||||
puts ("--- Should be no further output. ---");
|
||||
rfg1 ();
|
||||
rfg2 ();
|
||||
|
||||
{
|
||||
char buf[200];
|
||||
int result;
|
||||
|
||||
sprintf(buf,"%*s%*s%*s",-1,"one",-20,"two",-30,"three");
|
||||
|
||||
result = strcmp (buf,
|
||||
"onetwo three ");
|
||||
|
||||
puts (result != 0 ? "Test failed!" : "Test ok.");
|
||||
return result != 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rfg1 (void)
|
||||
{
|
||||
char buf[100];
|
||||
|
||||
sprintf (buf, "%5.s", "xyz");
|
||||
if (strcmp (buf, " ") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " ");
|
||||
sprintf (buf, "%5.f", 33.3);
|
||||
if (strcmp (buf, " 33") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 33");
|
||||
sprintf (buf, "%8.e", 33.3e7);
|
||||
if (strcmp (buf, " 3e+08") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3e+08");
|
||||
sprintf (buf, "%8.E", 33.3e7);
|
||||
if (strcmp (buf, " 3E+08") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3E+08");
|
||||
sprintf (buf, "%.g", 33.3);
|
||||
if (strcmp (buf, "3e+01") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3e+01");
|
||||
sprintf (buf, "%.G", 33.3);
|
||||
if (strcmp (buf, "3E+01") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3E+01");
|
||||
}
|
||||
|
||||
void
|
||||
rfg2 (void)
|
||||
{
|
||||
int prec;
|
||||
char buf[100];
|
||||
|
||||
prec = 0;
|
||||
sprintf (buf, "%.*g", prec, 3.3);
|
||||
if (strcmp (buf, "3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3");
|
||||
prec = 0;
|
||||
sprintf (buf, "%.*G", prec, 3.3);
|
||||
if (strcmp (buf, "3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3");
|
||||
prec = 0;
|
||||
sprintf (buf, "%7.*G", prec, 3.33);
|
||||
if (strcmp (buf, " 3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*o", prec, 33);
|
||||
if (strcmp (buf, " 041") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 041");
|
||||
prec = 7;
|
||||
sprintf (buf, "%09.*u", prec, 33);
|
||||
if (strcmp (buf, " 0000033") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 0000033");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*x", prec, 33);
|
||||
if (strcmp (buf, " 021") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 021");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*X", prec, 33);
|
||||
if (strcmp (buf, " 021") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 021");
|
||||
}
|
56
reactos/apps/tests/test_old/tstdiomisc.c
Normal file
56
reactos/apps/tests/test_old/tstdiomisc.c
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
t1 (void)
|
||||
{
|
||||
int n = -1;
|
||||
sscanf ("abc ", "abc %n", &n);
|
||||
printf ("t1: count=%d\n", n);
|
||||
|
||||
return n != 5;
|
||||
}
|
||||
|
||||
int
|
||||
t2 (void)
|
||||
{
|
||||
int result = 0;
|
||||
int n;
|
||||
long N;
|
||||
int retval;
|
||||
#define SCAN(INPUT, FORMAT, VAR, EXP_RES, EXP_VAL) \
|
||||
VAR = -1; \
|
||||
retval = sscanf (INPUT, FORMAT, &VAR); \
|
||||
printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
|
||||
INPUT, FORMAT, retval, (long int) VAR); \
|
||||
result |= retval != EXP_RES || VAR != EXP_VAL
|
||||
|
||||
SCAN ("12345", "%ld", N, 1, 12345);
|
||||
SCAN ("12345", "%llllld", N, 0, -1);
|
||||
SCAN ("12345", "%LLLLLd", N, 0, -1);
|
||||
SCAN ("test ", "%*s%n", n, 0, 4);
|
||||
SCAN ("test ", "%2*s%n", n, 0, -1);
|
||||
SCAN ("12 ", "%l2d", n, 0, -1);
|
||||
SCAN ("12 ", "%2ld", N, 1, 12);
|
||||
|
||||
n = -1;
|
||||
N = -1;
|
||||
retval = sscanf ("1 1", "%d %Z", &n, &N);
|
||||
printf ("sscanf (\"1 1\", \"%%d %%Z\", &n, &N) => %d, n = %d, N = %ld\n", \
|
||||
retval, n, N); \
|
||||
result |= retval != 1 || n != 1 || N != -1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
result |= t1 ();
|
||||
result |= t2 ();
|
||||
|
||||
result |= fflush (stdout) == EOF;
|
||||
|
||||
return result;
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* This example demonstrates dynamical loading of (internal) Win32 DLLS.
|
||||
* I dont know why this was called hello5 in the wine tree - sedwards
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
void CALLBACK (*fnGetSystemInfo)(LPSYSTEM_INFO si);
|
||||
HMODULE kernel32;
|
||||
|
||||
kernel32 = LoadLibrary("KERNEL32");
|
||||
if (kernel32<32) {
|
||||
fprintf(stderr,"FATAL: could not load KERNEL32!\n");
|
||||
return 0;
|
||||
}
|
||||
fnGetSystemInfo = (void*)GetProcAddress(kernel32,"GetSystemInfo");
|
||||
if (!fnGetSystemInfo) {
|
||||
fprintf(stderr,"FATAL: could not find GetSystemInfo!\n");
|
||||
return 0;
|
||||
}
|
||||
fnGetSystemInfo(&si);
|
||||
fprintf(stderr,"QuerySystemInfo returns:\n");
|
||||
fprintf(stderr," wProcessorArchitecture: %d\n",si.u.s.wProcessorArchitecture);
|
||||
fprintf(stderr," dwPageSize: %ld\n",si.dwPageSize);
|
||||
fprintf(stderr," lpMinimumApplicationAddress: %p\n",si.lpMinimumApplicationAddress);
|
||||
fprintf(stderr," lpMaximumApplicationAddress: %p\n",si.lpMaximumApplicationAddress);
|
||||
fprintf(stderr," dwActiveProcessorMask: %ld\n",si.dwActiveProcessorMask);
|
||||
fprintf(stderr," dwNumberOfProcessors: %ld\n",si.dwNumberOfProcessors);
|
||||
fprintf(stderr," dwProcessorType: %ld\n",si.dwProcessorType);
|
||||
fprintf(stderr," dwAllocationGranularity: %ld\n",si.dwAllocationGranularity);
|
||||
fprintf(stderr," wProcessorLevel: %d\n",si.wProcessorLevel);
|
||||
fprintf(stderr," wProcessorRevision: %d\n",si.wProcessorRevision);
|
||||
return 0;
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = GetSystemInfo
|
||||
|
||||
OBJECTS = GetSystemInfo.o
|
||||
|
||||
LIBS =
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
GetSystemInfo.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o GetSystemInfo.exe
|
||||
$(NM) --numeric-sort GetSystemInfo.exe > GetSystemInfo.sym
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,26 +0,0 @@
|
||||
# 10-11-01 Steven Edwards <Steven.Edwards@KnowledgeSentry.net>
|
||||
# Mutex Benchmarks from the Wineserver Linux Kernel Module
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = fivemutex rapidmutex
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
fivemutex.exe: fivemutex.c
|
||||
$(CC) fivemutex.c -lkernel32 -o fivemutex.exe
|
||||
$(NM) --numeric-sort fivemutex.exe > fivemutex.sym
|
||||
|
||||
rapidmutex.exe: rapidmutex.c
|
||||
$(CC) rapidmutex.c -lkernel32 -o rapidmutex.exe
|
||||
$(NM) --numeric-sort rapidmutex.exe > rapidmutex.sym
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,124 +0,0 @@
|
||||
/* fivemutex.c: hungry philosophers problem
|
||||
*
|
||||
* (c) Copyright D.W.Howells 2000.
|
||||
* All rights reserved
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ERR(X,Y) do { if (X) { perror(""Y""); return 1; } } while(0)
|
||||
#define RUNLENGTH 4
|
||||
|
||||
int count[5];
|
||||
|
||||
const char *names[] = {
|
||||
"five/1", "five/2", "five/3", "five/4", "five/5"
|
||||
};
|
||||
|
||||
DWORD WINAPI child(LPVOID tparam)
|
||||
{
|
||||
HANDLE left, right, first, second;
|
||||
const char *lname, *rname;
|
||||
int pid = (int) tparam;
|
||||
int wt;
|
||||
|
||||
lname = names[pid%5];
|
||||
rname = names[(pid+1)%5];
|
||||
|
||||
/* create a mutex */
|
||||
left = CreateMutex(NULL,0,lname); ERR(!left,"create left");
|
||||
right = CreateMutex(NULL,0,rname); ERR(!left,"create right");
|
||||
|
||||
printf("[%d] left: %p [%s]\n",pid,left,lname);
|
||||
printf("[%d] right: %p [%s]\n",pid,right,rname);
|
||||
|
||||
/* pick the forks up in numerical order, else risk starvation */
|
||||
if (pid%5 < (pid+1)%5) {
|
||||
first = left;
|
||||
second = right;
|
||||
}
|
||||
else {
|
||||
first = right;
|
||||
second = left;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
/* grab the left mutex */
|
||||
wt = WaitForMultipleObjects(1,&first,0,INFINITE);
|
||||
if (wt!=WAIT_OBJECT_0)
|
||||
goto wait_failed;
|
||||
|
||||
/* grab the right mutex */
|
||||
wt = WaitForMultipleObjects(1,&second,0,INFINITE);
|
||||
if (wt!=WAIT_OBJECT_0)
|
||||
goto wait_failed;
|
||||
|
||||
/* got it */
|
||||
count[pid]++;
|
||||
|
||||
/* pass the mutexes */
|
||||
ERR(!ReleaseMutex(left),"release left");
|
||||
ERR(!ReleaseMutex(right),"release right");
|
||||
continue;
|
||||
|
||||
wait_failed:
|
||||
switch (wt) {
|
||||
case WAIT_OBJECT_0+1:
|
||||
printf("[%d] obtained mutex __1__\n",pid);
|
||||
exit(1);
|
||||
case WAIT_ABANDONED_0:
|
||||
case WAIT_ABANDONED_0+1:
|
||||
printf("[%d] abandoned wait\n",pid);
|
||||
continue;
|
||||
case WAIT_TIMEOUT:
|
||||
printf("[%d] wait timed out\n",pid);
|
||||
exit(1);
|
||||
default:
|
||||
ERR(1,"WaitForMultipleObjects");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* close the handles */
|
||||
ERR(!CloseHandle(left),"close left");
|
||||
ERR(!CloseHandle(right),"close right");
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
HANDLE hThread[5];
|
||||
DWORD tid;
|
||||
int loop;
|
||||
|
||||
for (loop=0; loop<5; loop++) {
|
||||
|
||||
hThread[loop] = CreateThread(NULL, /* thread attributes */
|
||||
0, /* stack size */
|
||||
child, /* start address */
|
||||
(void*)loop, /* parameter */
|
||||
0, /* creation flags */
|
||||
&tid /* thread ID */
|
||||
);
|
||||
if (!hThread[loop])
|
||||
{
|
||||
ERR(1,"CreateThread");
|
||||
}
|
||||
}
|
||||
|
||||
WaitForMultipleObjects(5,hThread,0,RUNLENGTH*1000);
|
||||
|
||||
for (loop=0; loop<5; loop++)
|
||||
TerminateThread(hThread[loop],0);
|
||||
|
||||
for (loop=0; loop<5; loop++)
|
||||
printf("[%d] ate %d times (%d times per second)\n",
|
||||
loop,count[loop],count[loop]/RUNLENGTH
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,89 +0,0 @@
|
||||
/* rapidmutex.c: rapid mutex passing test client [Win32 threaded]
|
||||
*
|
||||
* (c) Copyright D.W.Howells 2000.
|
||||
* All rights reserved
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ERR(X,Y) do { if (X) { perror(Y); return 1; } } while(0)
|
||||
#define RUNLENGTH 4
|
||||
|
||||
int count[5];
|
||||
|
||||
DWORD WINAPI child(LPVOID tparam)
|
||||
{
|
||||
HANDLE mymutex;
|
||||
int pid = (int) tparam;
|
||||
|
||||
/* create a mutex */
|
||||
mymutex = CreateMutex(NULL,0,"wibble");
|
||||
ERR(!mymutex,"create mutex");
|
||||
printf("[%d] Handle: %p\n",pid,mymutex);
|
||||
|
||||
for (;;) {
|
||||
/* grab the mutex */
|
||||
switch (WaitForMultipleObjects(1,&mymutex,0,INFINITE))
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
/* got it */
|
||||
count[pid]++;
|
||||
|
||||
/* pass the mutex */
|
||||
ERR(!ReleaseMutex(mymutex),"release mutex");
|
||||
break;
|
||||
|
||||
case WAIT_OBJECT_0+1:
|
||||
printf("[%d] obtained mutex __1__\n",pid);
|
||||
exit(0);
|
||||
case WAIT_ABANDONED_0:
|
||||
case WAIT_ABANDONED_0+1:
|
||||
printf("[%d] abandoned wait\n",pid);
|
||||
exit(0);
|
||||
case WAIT_TIMEOUT:
|
||||
printf("[%d] wait timed out\n",pid);
|
||||
exit(0);
|
||||
default:
|
||||
ERR(1,"WaitForMultipleObjects");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
HANDLE hThread[5];
|
||||
DWORD tid;
|
||||
int loop;
|
||||
|
||||
for (loop=0; loop<5; loop++) {
|
||||
|
||||
hThread[loop] =
|
||||
CreateThread(NULL, /* thread attributes */
|
||||
0, /* stack size */
|
||||
child, /* start address */
|
||||
(void*)loop, /* parameter */
|
||||
0, /* creation flags */
|
||||
&tid /* thread ID */
|
||||
);
|
||||
if (!hThread[loop])
|
||||
{
|
||||
ERR(1,"CreateThread");
|
||||
}
|
||||
}
|
||||
|
||||
WaitForMultipleObjects(5,hThread,0,RUNLENGTH*1000);
|
||||
|
||||
for (loop=0; loop<5; loop++)
|
||||
TerminateThread(hThread[loop],0);
|
||||
|
||||
for (loop=0; loop<5; loop++)
|
||||
printf("[%d] obtained the mutex %d times"
|
||||
" (%d times per second)\n",
|
||||
loop,count[loop],count[loop]/RUNLENGTH
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = Parent_Child
|
||||
|
||||
OBJECTS = Parent_Child.o
|
||||
|
||||
LIBS = ../../../dk/w32/lib/gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
Parent_Child.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o Parent_Child.exe
|
||||
$(NM) --numeric-sort Parent_Child.exe > Parent_Child.sym
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,151 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
/* Win32 counterpart for CalcChildScroll16 is not implemented */
|
||||
/* even in MS Visual C++ */
|
||||
// #include "windef.h"
|
||||
// #include "wingdi.h"
|
||||
/*#include <wine/winuser16.h>*/
|
||||
|
||||
void Write (HDC dc, int x, int y, char *s)
|
||||
{
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
TextOut (dc, x, y, s, strlen (s));
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
|
||||
{
|
||||
static short xChar, yChar;
|
||||
static RECT rectHola;
|
||||
static char* strHola = "Hola";
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
TEXTMETRIC tm;
|
||||
|
||||
switch (msg){
|
||||
case WM_CREATE:
|
||||
dc = GetDC (wnd);
|
||||
GetTextMetrics (dc, &tm);
|
||||
xChar = tm.tmAveCharWidth;
|
||||
yChar = tm.tmHeight;
|
||||
GetTextExtentPoint32( dc, strHola, strlen(strHola), ((LPSIZE)&rectHola) + 1 );
|
||||
OffsetRect( &rectHola, xChar, yChar );
|
||||
ReleaseDC (wnd, dc);
|
||||
break;
|
||||
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
InvalidateRect(wnd, &rectHola, TRUE );
|
||||
// ScrollChildren(wnd, msg, w, l);
|
||||
return 0;
|
||||
|
||||
case WM_PAINT:
|
||||
dc = BeginPaint (wnd, &ps);
|
||||
Write (dc, xChar, yChar, strHola);
|
||||
EndPaint (wnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage (0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc (wnd, msg, w, l);
|
||||
}
|
||||
return 0l;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l)
|
||||
{
|
||||
static short xChar, yChar;
|
||||
static RECT rectInfo;
|
||||
char buf[128];
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
TEXTMETRIC tm;
|
||||
|
||||
switch (msg){
|
||||
case WM_CREATE:
|
||||
dc = GetDC (wnd);
|
||||
GetTextMetrics (dc, &tm);
|
||||
xChar = tm.tmAveCharWidth;
|
||||
yChar = tm.tmHeight;
|
||||
ReleaseDC (wnd, dc);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
dc = BeginPaint (wnd, &ps);
|
||||
sprintf(buf,"ps.rcPaint = {left = %d, top = %d, right = %d, bottom = %d}",
|
||||
ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom);
|
||||
rectInfo.left = rectInfo.top = 0;
|
||||
GetTextExtentPoint32 (dc, buf, strlen(buf), ((LPSIZE)&rectInfo) + 1 );
|
||||
OffsetRect (&rectInfo, xChar, yChar );
|
||||
Write (dc, xChar, yChar, buf);
|
||||
EndPaint (wnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_MOVE:
|
||||
case WM_SIZE:
|
||||
InvalidateRect( wnd, &rectInfo, TRUE );
|
||||
/*CalcChildScroll16( (UINT16)GetParent(wnd), SB_BOTH );*/
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage (0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc (wnd, msg, w, l);
|
||||
}
|
||||
return 0l;
|
||||
}
|
||||
|
||||
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
HWND wnd,wnd2;
|
||||
MSG msg;
|
||||
WNDCLASS class;
|
||||
char className[] = "class"; /* To make sure className >= 0x10000 */
|
||||
char class2Name[] = "class2";
|
||||
char winName[] = "Test app";
|
||||
|
||||
if (!prev){
|
||||
class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
class.lpfnWndProc = WndProc;
|
||||
class.cbClsExtra = 0;
|
||||
class.cbWndExtra = 0;
|
||||
class.hInstance = inst;
|
||||
class.hIcon = LoadIcon (0, IDI_APPLICATION);
|
||||
class.hCursor = LoadCursor (0, IDC_ARROW);
|
||||
class.hbrBackground = GetStockObject (WHITE_BRUSH);
|
||||
class.lpszMenuName = NULL;
|
||||
class.lpszClassName = className;
|
||||
if (!RegisterClass (&class))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
|
||||
0, inst, 0);
|
||||
|
||||
if (!prev){
|
||||
class.lpfnWndProc = WndProc2;
|
||||
class.lpszClassName = class2Name;
|
||||
class.hbrBackground = GetStockObject(GRAY_BRUSH);
|
||||
if (!RegisterClass (&class))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wnd2= CreateWindow (class2Name,"Child window", WS_CAPTION | WS_CHILD | WS_THICKFRAME,
|
||||
50, 50, 350, 100, wnd, 0, inst, 0);
|
||||
|
||||
ShowWindow (wnd, show);
|
||||
UpdateWindow (wnd);
|
||||
ShowWindow (wnd2, show);
|
||||
UpdateWindow (wnd2);
|
||||
|
||||
while (GetMessage (&msg, 0, 0, 0)){
|
||||
TranslateMessage (&msg);
|
||||
DispatchMessage (&msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = guitest
|
||||
|
||||
OBJECTS = guitest.o
|
||||
|
||||
LIBS = ../../../dk/w32/lib/gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
install: $(PROGS:%=$(FLOPPY_DIR)/apps/tests/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/tests/%.exe): $(FLOPPY_DIR)/apps/tests/%.exe: %.exe
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/tests/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/tests/%.exe): ../../$(DIST_DIR)/apps/tests/%.exe: %.exe
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
|
||||
guitest.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o guitest.exe
|
||||
$(NM) --numeric-sort guitest.exe > guitest.sym
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,751 +0,0 @@
|
||||
/* Windows GUI Behaviour Tester */
|
||||
/* by Ove K<>ven */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "guitest.rc"
|
||||
|
||||
/* checks to include */
|
||||
#define LOGGING /* can be undefined under Wine and use -debugmsg +message instead */
|
||||
#define MAIN_STYLE WS_OVERLAPPEDWINDOW|WS_HSCROLL
|
||||
#define MAIN_EXSTYLE 0
|
||||
#undef TEST_DESTROY_MAIN
|
||||
#define SHOW_SUB
|
||||
#undef TEST_DIALOG
|
||||
#define RESIZE_DIALOG
|
||||
#undef TEST_SUBDIALOG
|
||||
#undef TEST_COMMCTL
|
||||
|
||||
/************************/
|
||||
/*** GLOBAL VARIABLES ***/
|
||||
/************************/
|
||||
|
||||
HINSTANCE hInst;
|
||||
DWORD StartTime;
|
||||
HWND hListBox,hMainWnd,hSubWnd;
|
||||
HWND hButton[4]={0,0,0,0};
|
||||
HWND hDialog=0,hGroup=0,hSubDlg=0;
|
||||
WNDPROC wndButton[4],wndDialog,wndGroup,wndSubDlg;
|
||||
BOOL Clicked=0,Ready=0;
|
||||
int State=0,Rec=0;
|
||||
#define STATE_CREATE 0
|
||||
#define STATE_DESTROY 1
|
||||
#define STATE_SHOW 2
|
||||
#define STATE_UPDATE 3
|
||||
#define STATE_DIALOG 4
|
||||
#define STATE_TEST 5
|
||||
#define STATE_DIRECT 6
|
||||
#define STATE_DISPATCH 7
|
||||
#define STATE_RECURS 8
|
||||
char*StateName[]={
|
||||
"Creat",
|
||||
"Destr",
|
||||
"Show ",
|
||||
"Updat",
|
||||
"Dialg",
|
||||
"Test ",
|
||||
"Call ",
|
||||
"Disp ",
|
||||
"RCall"
|
||||
};
|
||||
|
||||
static char wclassname[] = "GUITestClass";
|
||||
static char wcclassname[] = "GUITestChildClass";
|
||||
static char winname[] = "GUITest";
|
||||
|
||||
/**************************/
|
||||
/*** LOGGING FACILITIES ***/
|
||||
/**************************/
|
||||
|
||||
struct MSGNAMES {
|
||||
int msg;
|
||||
char*name;
|
||||
} MsgNames[]={
|
||||
#define MSG(x) {x,#x},
|
||||
#define MSG2(x,y) {y,#x},
|
||||
#define ENDMSG {0}
|
||||
|
||||
/* we get these in CreateWindow */
|
||||
MSG(WM_GETMINMAXINFO)
|
||||
MSG(WM_NCCREATE)
|
||||
MSG(WM_NCCALCSIZE)
|
||||
MSG(WM_CREATE)
|
||||
MSG(WM_PARENTNOTIFY)
|
||||
|
||||
/* we get these in ShowWindow */
|
||||
MSG(WM_SHOWWINDOW)
|
||||
MSG(WM_WINDOWPOSCHANGING)
|
||||
MSG(WM_QUERYNEWPALETTE)
|
||||
MSG(WM_ACTIVATEAPP)
|
||||
MSG(WM_NCACTIVATE)
|
||||
MSG(WM_GETTEXT)
|
||||
MSG(WM_ACTIVATE)
|
||||
MSG(WM_SETFOCUS)
|
||||
MSG(WM_NCPAINT)
|
||||
MSG(WM_ERASEBKGND)
|
||||
MSG(WM_WINDOWPOSCHANGED)
|
||||
MSG(WM_SIZE)
|
||||
MSG(WM_MOVE)
|
||||
|
||||
/* we get these in DestroyWindow */
|
||||
MSG(WM_KILLFOCUS)
|
||||
MSG(WM_DESTROY)
|
||||
MSG(WM_NCDESTROY)
|
||||
|
||||
/* we get these directly sent */
|
||||
MSG(WM_NCHITTEST)
|
||||
MSG(WM_SETCURSOR)
|
||||
MSG(WM_MOUSEACTIVATE)
|
||||
MSG(WM_CHILDACTIVATE)
|
||||
MSG(WM_COMMAND)
|
||||
MSG(WM_SYSCOMMAND)
|
||||
|
||||
/* posted events */
|
||||
MSG(WM_MOUSEMOVE)
|
||||
MSG(WM_NCMOUSEMOVE)
|
||||
MSG(WM_PAINT)
|
||||
MSG(WM_LBUTTONDOWN)
|
||||
MSG(WM_LBUTTONUP)
|
||||
MSG(WM_LBUTTONDBLCLK)
|
||||
MSG(WM_NCLBUTTONDOWN)
|
||||
MSG(WM_NCLBUTTONUP)
|
||||
MSG(WM_NCLBUTTONDBLCLK)
|
||||
|
||||
MSG(WM_KEYDOWN)
|
||||
MSG(WM_KEYUP)
|
||||
MSG(WM_CHAR)
|
||||
|
||||
#ifdef WIN32
|
||||
MSG(WM_CTLCOLORBTN)
|
||||
MSG(WM_CTLCOLORDLG)
|
||||
MSG(WM_CTLCOLORSTATIC)
|
||||
#else
|
||||
MSG(WM_CTLCOLOR)
|
||||
#endif
|
||||
|
||||
/* moving and sizing */
|
||||
MSG2(WM_ENTERSIZEMOVE,0x0231)
|
||||
MSG2(WM_EXITSIZEMOVE,0x0232)
|
||||
#ifdef WIN32
|
||||
MSG(WM_SIZING)
|
||||
#endif
|
||||
|
||||
/* menus/dialog boxes */
|
||||
MSG(WM_CANCELMODE)
|
||||
MSG(WM_ENABLE)
|
||||
MSG(WM_SETFONT)
|
||||
MSG(WM_INITDIALOG)
|
||||
MSG(WM_GETDLGCODE)
|
||||
MSG(WM_ENTERIDLE)
|
||||
|
||||
/* scroll bars */
|
||||
MSG(WM_HSCROLL)
|
||||
MSG(WM_VSCROLL)
|
||||
|
||||
/* getting these from Wine but not from Windows */
|
||||
MSG2(WM_SETVISIBLE,0x0009) /* unheard of in BC++ 4.52 */
|
||||
#ifdef WIN32
|
||||
MSG(WM_CAPTURECHANGED)
|
||||
#endif
|
||||
|
||||
ENDMSG};
|
||||
|
||||
struct MSGNAMES ButMsgs[]={
|
||||
MSG(BM_SETSTATE)
|
||||
MSG(BM_SETSTYLE)
|
||||
|
||||
ENDMSG};
|
||||
|
||||
char*MsgName(UINT msg,HWND hWnd)
|
||||
{
|
||||
int i;
|
||||
static char buffer[64],wclass[64];
|
||||
GetClassName(hWnd,wclass,sizeof(wclass));
|
||||
|
||||
#define MSGSEARCH(msgs) { \
|
||||
for (i=0; msgs[i].name&&msgs[i].msg!=msg; i++); \
|
||||
if (msgs[i].name) return msgs[i].name; \
|
||||
}
|
||||
|
||||
if (!stricmp(wclass,"Button")) MSGSEARCH(ButMsgs);
|
||||
MSGSEARCH(MsgNames);
|
||||
/* WM_USER */
|
||||
if (msg>=WM_USER) {
|
||||
sprintf(buffer,"WM_USER+%04x{%s}",msg-WM_USER,wclass);
|
||||
return buffer;
|
||||
}
|
||||
/* message not found */
|
||||
sprintf(buffer,"%04x{%s}",msg,wclass);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
char*WndName(HWND hWnd,int state)
|
||||
{
|
||||
static char buffer[16];
|
||||
if (!hWnd) return "0000";
|
||||
if (hWnd==hMainWnd || (state==STATE_CREATE && !hMainWnd)) return "main";
|
||||
if (hWnd==hSubWnd || (state==STATE_CREATE && !hSubWnd)) return "chld";
|
||||
if (hWnd==hDialog || (state==STATE_DIALOG && !hDialog)) return "tdlg";
|
||||
if (hWnd==hGroup) return "tgrp";
|
||||
if (hWnd==hButton[0]) return "but1";
|
||||
if (hWnd==hButton[1]) return "but2";
|
||||
if (hWnd==hButton[2]) return "but3";
|
||||
if (hWnd==hButton[3]) return "but4";
|
||||
if (hWnd==hSubDlg || (state==STATE_CREATE && !hSubDlg)) return "sdlg";
|
||||
if (hDialog) {
|
||||
int id=GetDlgCtrlID(hWnd);
|
||||
if (id) {
|
||||
sprintf(buffer,"dlgitem(%d)",id);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
sprintf(buffer,"%04x",hWnd);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void Log(const char*fmt)
|
||||
{
|
||||
#ifdef LOGGING
|
||||
if (!Clicked) SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)fmt);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logf(const char*fmt,...)
|
||||
{
|
||||
va_list par;
|
||||
static char buffer[256];
|
||||
|
||||
va_start(par,fmt);
|
||||
vsprintf(buffer,fmt,par);
|
||||
va_end(par);
|
||||
Log(buffer);
|
||||
}
|
||||
|
||||
void LogChildOrder(HWND hWnd)
|
||||
{
|
||||
HWND hWndChild = GetWindow(hWnd,GW_CHILD);
|
||||
static char buffer[256];
|
||||
|
||||
strcpy(buffer,"child list:");
|
||||
while (hWndChild) {
|
||||
strcat(strcat(buffer," "),WndName(hWndChild,State));
|
||||
hWndChild=GetWindow(hWndChild,GW_HWNDNEXT);
|
||||
}
|
||||
Log(buffer);
|
||||
}
|
||||
|
||||
void LogMessage(int state,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam,char*name)
|
||||
{
|
||||
static char buffer[256];
|
||||
DWORD tick=GetTickCount()-StartTime;
|
||||
char*msgname=MsgName(msg,hWnd);
|
||||
if (!name) name=WndName(hWnd,state);
|
||||
switch (msg) {
|
||||
case WM_SETFOCUS:
|
||||
case WM_KILLFOCUS:
|
||||
case WM_SETCURSOR:
|
||||
Logf("%04d[%s(%d):%s]%s(%s,%08x)",tick,StateName[state],Rec,
|
||||
name,msgname,WndName((HWND)wParam,State),lParam);
|
||||
break;
|
||||
#ifdef WIN32
|
||||
case WM_ENTERIDLE:
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORDLG:
|
||||
Logf("%04d[%s(%d):%s]%s(%08x,%s)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,WndName((HWND)lParam,State));
|
||||
break;
|
||||
#else
|
||||
case WM_ENTERIDLE:
|
||||
case WM_CTLCOLOR:
|
||||
Logf("%04d[%s(%d):%s]%s(%08x,%04x:%s)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,HIWORD(lParam),WndName((HWND)LOWORD(lParam),State));
|
||||
break;
|
||||
#endif
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
WINDOWPOS*pos=(WINDOWPOS*)lParam;
|
||||
#ifdef WIN32
|
||||
Logf("%04d[%s(%d):%s]%s(%08x,%p)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,pos);
|
||||
#else
|
||||
Logf("%04d[%s(%d):%s]%s(%04x,%p)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,pos);
|
||||
#endif
|
||||
strcpy(buffer,"FLAGS:");
|
||||
if (pos->flags&SWP_DRAWFRAME) strcat(buffer," DRAWFRAME");
|
||||
if (pos->flags&SWP_HIDEWINDOW) strcat(buffer," HIDEWINDOW");
|
||||
if (pos->flags&SWP_NOACTIVATE) strcat(buffer," NOACTIVATE");
|
||||
if (pos->flags&SWP_NOCOPYBITS) strcat(buffer," NOCOPYBITS");
|
||||
if (pos->flags&SWP_NOMOVE) strcat(buffer," NOMOVE");
|
||||
if (pos->flags&SWP_NOOWNERZORDER) strcat(buffer," NOOWNERZORDER");
|
||||
if (pos->flags&SWP_NOSIZE) strcat(buffer," NOSIZE");
|
||||
if (pos->flags&SWP_NOREDRAW) strcat(buffer," NOREDRAW");
|
||||
if (pos->flags&SWP_NOZORDER) strcat(buffer," NOZORDER");
|
||||
if (pos->flags&SWP_SHOWWINDOW) strcat(buffer," SHOWWINDOW");
|
||||
Log(buffer);
|
||||
}
|
||||
break;
|
||||
case WM_SYSCOMMAND:
|
||||
{
|
||||
char*cmd=NULL;
|
||||
switch (wParam&0xFFF0) {
|
||||
#define CASE(x) case SC_##x: cmd=#x; break;
|
||||
CASE(CLOSE)
|
||||
CASE(DEFAULT)
|
||||
CASE(HOTKEY)
|
||||
CASE(HSCROLL)
|
||||
CASE(KEYMENU)
|
||||
CASE(MAXIMIZE)
|
||||
CASE(MINIMIZE)
|
||||
CASE(MOUSEMENU)
|
||||
CASE(MOVE)
|
||||
CASE(NEXTWINDOW)
|
||||
CASE(PREVWINDOW)
|
||||
CASE(RESTORE)
|
||||
CASE(SCREENSAVE)
|
||||
CASE(SIZE)
|
||||
CASE(TASKLIST)
|
||||
CASE(VSCROLL)
|
||||
#undef CASE
|
||||
}
|
||||
if (cmd) {
|
||||
Logf("%04d[%s(%d):%s]%s(%s+%x,%08x)",tick,StateName[state],Rec,
|
||||
name,msgname,cmd,wParam&0xF,lParam);
|
||||
} else goto GENERIC_MSG;
|
||||
}
|
||||
break;
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
{
|
||||
char*cmd=NULL;
|
||||
switch (LOWORD(wParam)) {
|
||||
#define CASE(x) case SB_##x: cmd=#x; break;
|
||||
#define CASE2(h,v) case SB_##h: if (msg==WM_HSCROLL) cmd=#h; else cmd=#v; break;
|
||||
CASE(BOTTOM)
|
||||
CASE(ENDSCROLL)
|
||||
CASE2(LINELEFT,LINEUP)
|
||||
CASE2(LINERIGHT,LINEDOWN)
|
||||
CASE2(PAGELEFT,PAGEUP)
|
||||
CASE2(PAGERIGHT,PAGEDOWN)
|
||||
CASE(THUMBPOSITION)
|
||||
CASE(THUMBTRACK)
|
||||
CASE(TOP)
|
||||
#undef CASE
|
||||
}
|
||||
if (cmd) {
|
||||
#ifdef WIN32
|
||||
Logf("%04d[%s(%d):%s]%s(%s,%04x,%s)",tick,StateName[state],Rec,
|
||||
name,msgname,cmd,HIWORD(wParam),WndName((HWND)lParam,State));
|
||||
#else
|
||||
Logf("%04d[%s(%d):%s]%s(%04x,%04x,%s)",tick,StateName[state],Rec,
|
||||
name,msgname,cmd,LOWORD(lParam),WndName((HWND)HIWORD(lParam),State));
|
||||
#endif
|
||||
} else goto GENERIC_MSG;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
GENERIC_MSG:
|
||||
#ifdef WIN32
|
||||
Logf("%04d[%s(%d):%s]%s(%08x,%08x)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,lParam);
|
||||
#else
|
||||
Logf("%04d[%s(%d):%s]%s(%04x,%08x)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,lParam);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/***************************/
|
||||
/*** GRAPHICS FACILITIES ***/
|
||||
/***************************/
|
||||
|
||||
void Paint(HWND hWnd)
|
||||
{
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
dc=BeginPaint(hWnd,&ps);
|
||||
EndPaint(hWnd,&ps);
|
||||
}
|
||||
|
||||
void FillPattern(HWND hWnd,HDC pdc)
|
||||
{
|
||||
HDC dc=pdc?pdc:GetDC(hWnd);
|
||||
HBRUSH oldbrush;
|
||||
RECT rect;
|
||||
if (!dc) {
|
||||
Logf("failed to acquire DC for window %s",WndName(hWnd,State));
|
||||
return;
|
||||
} else {
|
||||
Logf("acquired DC for %s window %s, painting",
|
||||
IsWindowVisible(hWnd)?"visible":"invisible",WndName(hWnd,State));
|
||||
}
|
||||
GetClientRect(hWnd,&rect);
|
||||
oldbrush=SelectObject(dc,GetStockObject(LTGRAY_BRUSH));
|
||||
PatBlt(dc,0,0,rect.right,rect.bottom,PATCOPY);
|
||||
SelectObject(dc,oldbrush);
|
||||
if (!pdc) ReleaseDC(hWnd,dc);
|
||||
}
|
||||
|
||||
void PaintPattern(HWND hWnd)
|
||||
{
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
dc=BeginPaint(hWnd,&ps);
|
||||
FillPattern(hWnd,dc);
|
||||
EndPaint(hWnd,&ps);
|
||||
}
|
||||
|
||||
/*************************/
|
||||
/*** WINDOW PROCEDURES ***/
|
||||
/*************************/
|
||||
|
||||
/* MAIN WINDOW */
|
||||
LRESULT FAR CALLBACK _export MainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT lResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) LogMessage(OldState,hWnd,msg,wParam,lParam,NULL);
|
||||
switch (msg) {
|
||||
case WM_NCHITTEST:
|
||||
lResult=DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
break;
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_CHAR:
|
||||
if (!Clicked) {
|
||||
SetParent(hListBox,hWnd);
|
||||
GetClientRect(hWnd,&rect);
|
||||
MoveWindow(hListBox,0,0,rect.right,rect.bottom,TRUE);
|
||||
ShowWindow(hListBox,SW_SHOW);
|
||||
SetFocus(hListBox);
|
||||
Clicked=TRUE;
|
||||
}
|
||||
break;
|
||||
case WM_SIZE:
|
||||
GetClientRect(hWnd,&rect);
|
||||
if (Clicked) {
|
||||
MoveWindow(hListBox,0,0,rect.right,rect.bottom,TRUE);
|
||||
}
|
||||
MoveWindow(hSubWnd,0,rect.bottom/2,rect.right,rect.bottom-(rect.bottom/2),TRUE);
|
||||
break;
|
||||
case WM_PAINT:
|
||||
Paint(hWnd);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
default:
|
||||
lResult=DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return lResult;
|
||||
}
|
||||
|
||||
/* CHILD WINDOW */
|
||||
LRESULT FAR CALLBACK _export SubWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT lResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) LogMessage(OldState,hWnd,msg,wParam,lParam,NULL);
|
||||
switch (msg) {
|
||||
case WM_PAINT:
|
||||
Paint(hWnd);
|
||||
break;
|
||||
default:
|
||||
lResult=DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return lResult;
|
||||
}
|
||||
|
||||
BOOL FAR CALLBACK _export SubDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* SUBCLASSED CONTROLS */
|
||||
LRESULT FAR CALLBACK _export SubClassWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT lResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
int But=-1;
|
||||
|
||||
if (hWnd==hButton[0]) But=0; else
|
||||
if (hWnd==hButton[1]) But=1; else
|
||||
if (hWnd==hButton[2]) But=2; else
|
||||
if (hWnd==hButton[3]) But=3;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) {
|
||||
LogMessage(OldState,hWnd,msg,wParam,lParam,NULL);
|
||||
if (But!=-1) {
|
||||
lResult=CallWindowProc((FARPROC)wndButton[But],hWnd,msg,wParam,lParam);
|
||||
if (msg==WM_LBUTTONUP) {
|
||||
LogChildOrder(GetParent(hWnd));
|
||||
}
|
||||
}
|
||||
else if (hWnd==hDialog) {
|
||||
lResult=CallWindowProc((FARPROC)wndDialog,hWnd,msg,wParam,lParam);
|
||||
}
|
||||
else if (hWnd==hSubDlg) {
|
||||
lResult=CallWindowProc((FARPROC)wndSubDlg,hWnd,msg,wParam,lParam);
|
||||
}
|
||||
else if (hWnd==hGroup) {
|
||||
lResult=CallWindowProc((FARPROC)wndGroup,hWnd,msg,wParam,lParam);
|
||||
if (msg==WM_SETFOCUS) {
|
||||
/* create subdialog */
|
||||
if (hSubDlg) {
|
||||
#if 0
|
||||
SetRect(&rect,0,0,1,1);
|
||||
InvalidateRect(hWnd,&rect,FALSE);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef TEST_SUBDIALOG
|
||||
State=STATE_CREATE;
|
||||
hSubDlg=CreateDialog(hInst,MAKEINTRESOURCE(2),hWnd,(FARPROC)SubDialogProc);
|
||||
State=STATE_RECURS;
|
||||
#else
|
||||
#ifdef RESIZE_DIALOG
|
||||
GetWindowRect(GetParent(hWnd),&rect);
|
||||
rect.right++;
|
||||
SetWindowPos(GetParent(hWnd),0,0,0,
|
||||
rect.right-rect.left,rect.bottom-rect.top,
|
||||
SWP_NOMOVE|SWP_NOZORDER);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return lResult;
|
||||
}
|
||||
|
||||
/* MAIN DIALOG PROCEDURE */
|
||||
BOOL FAR CALLBACK _export TestDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
BOOL bResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
int But=-1;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) LogMessage(OldState,hWndDlg,msg,wParam,lParam,"dlgp");
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
hDialog = hWndDlg;
|
||||
/* subclass dialog window proc */
|
||||
wndDialog = (WNDPROC)SetWindowLong(hDialog,GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
Logf("dialog visible=%s",IsWindowVisible(hWndDlg)?"TRUE":"FALSE");
|
||||
/* subclass OK button */
|
||||
hButton[3] = GetDlgItem(hWndDlg,IDOK);
|
||||
wndButton[3] = (WNDPROC)SetWindowLong(hButton[3],GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
/* subclass group box */
|
||||
hGroup = GetDlgItem(hWndDlg,IDC_GROUPBOX1);
|
||||
wndGroup = (WNDPROC)SetWindowLong(hGroup,GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
|
||||
#ifdef RESIZE_DIALOG
|
||||
GetWindowRect(hWndDlg,&rect);
|
||||
rect.right--;
|
||||
SetWindowPos(hWndDlg,0,0,0,
|
||||
rect.right-rect.left,rect.bottom-rect.top,
|
||||
SWP_NOMOVE|SWP_NOZORDER);
|
||||
// ShowWindow(GetDlgItem(hWndDlg,IDCANCEL),SW_HIDE);
|
||||
#endif
|
||||
|
||||
bResult=TRUE; /* we don't do SetFocus */
|
||||
break;
|
||||
case WM_PAINT:
|
||||
PaintPattern(hWndDlg);
|
||||
bResult=TRUE;
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
EndDialog(hWndDlg,LOWORD(wParam));
|
||||
bResult=TRUE;
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
EndDialog(hWndDlg,IDCANCEL);
|
||||
bResult=TRUE;
|
||||
break;
|
||||
case WM_NCDESTROY:
|
||||
hDialog = 0;
|
||||
break;
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/* SUBDIALOG PROCEDURE */
|
||||
BOOL FAR CALLBACK _export SubDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
BOOL bResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
int But=-1;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) LogMessage(OldState,hWndDlg,msg,wParam,lParam,NULL);
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
hSubDlg = hWndDlg;
|
||||
/* subclass dialog window proc */
|
||||
wndSubDlg = (WNDPROC)SetWindowLong(hDialog,GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
|
||||
bResult=TRUE; /* we don't do SetFocus */
|
||||
break;
|
||||
case WM_NCDESTROY:
|
||||
hSubDlg = 0;
|
||||
break;
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/********************/
|
||||
/*** MAIN PROGRAM ***/
|
||||
/********************/
|
||||
|
||||
BOOL AppInit(void)
|
||||
{
|
||||
WNDCLASS wclass;
|
||||
|
||||
wclass.style = CS_HREDRAW|CS_VREDRAW;
|
||||
wclass.lpfnWndProc = MainWindowProc;
|
||||
wclass.cbClsExtra = 0;
|
||||
wclass.cbWndExtra = 0;
|
||||
wclass.hInstance = hInst;
|
||||
wclass.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(1));
|
||||
wclass.hCursor = LoadCursor(0,IDC_ARROW);
|
||||
wclass.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
wclass.lpszMenuName = NULL;
|
||||
wclass.lpszClassName = wclassname;
|
||||
if (!RegisterClass(&wclass)) return FALSE;
|
||||
wclass.lpfnWndProc = SubWindowProc;
|
||||
wclass.lpszClassName = wcclassname;
|
||||
if (!RegisterClass(&wclass)) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
RECT rect;
|
||||
|
||||
hInst = hInstance;
|
||||
if (!hPrevInstance)
|
||||
if (!AppInit())
|
||||
return 0;
|
||||
|
||||
StartTime=GetTickCount();
|
||||
hListBox = CreateWindow("LISTBOX","Messages",WS_BORDER|WS_VSCROLL|WS_CHILD|
|
||||
LBS_HASSTRINGS|LBS_NOTIFY|LBS_WANTKEYBOARDINPUT,
|
||||
0,0,0,0,GetDesktopWindow(),0,hInst,0);
|
||||
if (!hListBox) {
|
||||
MessageBox(0,"Could not create list box","Error",MB_OK);
|
||||
}
|
||||
|
||||
State=STATE_CREATE;
|
||||
hMainWnd = CreateWindowEx(MAIN_EXSTYLE,wclassname,winname,MAIN_STYLE,
|
||||
CW_USEDEFAULT,0,400,300,0,0,hInst,0);
|
||||
if (!hMainWnd) return 0;
|
||||
State=STATE_SHOW;
|
||||
ShowWindow(hMainWnd,nCmdShow);
|
||||
#ifdef TEST_DESTROY_MAIN
|
||||
State=STATE_DESTROY;
|
||||
DestroyWindow(hMainWnd);
|
||||
State=STATE_DIRECT;
|
||||
while (GetMessage(&msg,0,0,0)) {
|
||||
TranslateMessage(&msg);
|
||||
State=STATE_DISPATCH;
|
||||
DispatchMessage(&msg);
|
||||
State=STATE_DIRECT;
|
||||
}
|
||||
State=STATE_CREATE;
|
||||
hMainWnd = CreateWindowEx(MAIN_EXSTYLE,wclassname,winname,MAIN_STYLE,
|
||||
CW_USEDEFAULT,0,400,300,0,0,hInst,0);
|
||||
if (!hMainWnd) return 0;
|
||||
State=STATE_SHOW;
|
||||
ShowWindow(hMainWnd,nCmdShow);
|
||||
#endif
|
||||
/* update, so no WM_PAINTs are pending */
|
||||
State=STATE_UPDATE;
|
||||
// UpdateWindow(hMainWnd);
|
||||
Ready=TRUE;
|
||||
/* fill client area with a pattern */
|
||||
FillPattern(hMainWnd,0);
|
||||
/* create subwindow */
|
||||
State=STATE_CREATE;
|
||||
GetClientRect(hMainWnd,&rect);
|
||||
hSubWnd = CreateWindow(wcclassname,winname,WS_CHILD|WS_BORDER|WS_CLIPSIBLINGS,
|
||||
0,rect.bottom/2,rect.right,rect.bottom-(rect.bottom/2),hMainWnd,0,hInst,0);
|
||||
if (!hSubWnd) return 0;
|
||||
/* create buttons */
|
||||
hButton[0] = CreateWindow("BUTTON","1",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE,
|
||||
8,8,48,20,hMainWnd,0,hInst,0);
|
||||
hButton[1] = CreateWindow("BUTTON","2",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE,
|
||||
32,12,48,20,hMainWnd,0,hInst,0);
|
||||
hButton[2] = CreateWindow("BUTTON","3",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE,
|
||||
56,16,48,20,hMainWnd,0,hInst,0);
|
||||
/* subclass them */
|
||||
wndButton[0] = (WNDPROC)SetWindowLong(hButton[0],GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
wndButton[1] = (WNDPROC)SetWindowLong(hButton[1],GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
wndButton[2] = (WNDPROC)SetWindowLong(hButton[2],GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
/* show them */
|
||||
State=STATE_UPDATE;
|
||||
UpdateWindow(hButton[0]);
|
||||
LogChildOrder(hMainWnd);
|
||||
Logf("but1 visible=%d",IsWindowVisible(hButton[0]));
|
||||
|
||||
/* now reparent the button to our (invisible) subwindow */
|
||||
State=STATE_TEST;
|
||||
/* in different order, seeing who gets topmost */
|
||||
SetParent(hButton[0],hSubWnd);
|
||||
SetParent(hButton[2],hSubWnd);
|
||||
SetParent(hButton[1],hSubWnd);
|
||||
LogChildOrder(hSubWnd);
|
||||
/* the button should now be invisible */
|
||||
Logf("but1 visible=%d",IsWindowVisible(hButton[0]));
|
||||
/* see if we can draw on them */
|
||||
FillPattern(hButton[0],0);
|
||||
|
||||
#ifdef SHOW_SUB
|
||||
State=STATE_SHOW;
|
||||
ShowWindow(hSubWnd,SW_SHOWNORMAL);
|
||||
State=STATE_UPDATE;
|
||||
UpdateWindow(hSubWnd);
|
||||
FillPattern(hSubWnd,0);
|
||||
// InvalidateRect(hMainWnd,NULL,TRUE);
|
||||
Logf("but1 visible=%d",IsWindowVisible(hButton[0]));
|
||||
#endif
|
||||
|
||||
#ifdef TEST_DIALOG
|
||||
State=STATE_DIALOG;
|
||||
DialogBox(hInst,MAKEINTRESOURCE(1),hMainWnd,(FARPROC)TestDialogProc);
|
||||
#endif
|
||||
#ifdef TEST_COMMCTL
|
||||
{
|
||||
DWORD arr[16];
|
||||
CHOOSECOLOR cc={sizeof(cc),0,hInst,0,arr,0};
|
||||
ChooseColor(&cc);
|
||||
}
|
||||
#endif
|
||||
|
||||
State=STATE_DIRECT;
|
||||
while (GetMessage(&msg,0,0,0)) {
|
||||
TranslateMessage(&msg);
|
||||
State=STATE_DISPATCH;
|
||||
DispatchMessage(&msg);
|
||||
State=STATE_DIRECT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -1,17 +0,0 @@
|
||||
/****************************************************************************
|
||||
|
||||
|
||||
guitest.rh
|
||||
|
||||
produced by Borland Resource Workshop
|
||||
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#define IDC_CHECKBOX1 104
|
||||
#define IDC_CHECKBOX2 105
|
||||
#define IDC_CHECKBOX3 106
|
||||
#define DIALOG_2 2
|
||||
#define IDC_GROUPBOX1 10
|
||||
#define DIALOG_1 1
|
||||
#define ICON_1 1
|
@@ -1,26 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = hello
|
||||
|
||||
OBJECTS = hello.o
|
||||
|
||||
LIBS = ../../../dk/w32/lib/gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
hello.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o hello.exe
|
||||
$(NM) --numeric-sort hello.exe > hello.sym
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,83 +0,0 @@
|
||||
#include <windows.h>
|
||||
|
||||
char szAppName[] = "Hello";
|
||||
|
||||
long FAR PASCAL WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpszCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
HWND hwnd;
|
||||
MSG msg;
|
||||
WNDCLASS wndclass;
|
||||
|
||||
if(!hPrevInst) {
|
||||
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wndclass.lpfnWndProc = WndProc;
|
||||
wndclass.cbClsExtra = 0;
|
||||
wndclass.cbWndExtra = 0;
|
||||
wndclass.hInstance = hInstance;
|
||||
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
wndclass.lpszMenuName = NULL;
|
||||
wndclass.lpszClassName = szAppName;
|
||||
|
||||
RegisterClass(&wndclass);
|
||||
|
||||
|
||||
}
|
||||
|
||||
hwnd = CreateWindow(szAppName, szAppName,
|
||||
WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 600,
|
||||
400, NULL, NULL, hInstance, NULL);
|
||||
|
||||
ShowWindow(hwnd, nCmdShow);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
|
||||
while(GetMessage(&msg, NULL, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
long FAR PASCAL WndProc(HWND hwnd, UINT message, WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
SIZE size;
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
switch(message) {
|
||||
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
GetClientRect(hwnd, &rect);
|
||||
InflateRect(&rect, -10, -10);
|
||||
if( !IsRectEmpty( &rect ) )
|
||||
{
|
||||
GetTextExtentPoint32(hdc, szAppName, strlen(szAppName), &size);
|
||||
SelectObject(hdc, GetStockObject(LTGRAY_BRUSH));
|
||||
Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
|
||||
rect.left = (rect.right + rect.left - size.cx) / 2;
|
||||
rect.top = (rect.bottom + rect.top - size.cy) / 2;
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
TextOut(hdc, rect.left, rect.top, szAppName, strlen(szAppName) );
|
||||
}
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
@@ -1,26 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = hello2
|
||||
|
||||
OBJECTS = hello2.o
|
||||
|
||||
LIBS = # gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
hello2.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o hello2.exe
|
||||
$(NM) --numeric-sort hello2.exe > hello2.sym
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,9 +0,0 @@
|
||||
#include "windows.h"
|
||||
|
||||
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
return MessageBox((HWND)0,
|
||||
(LPSTR)"Hello, hello!",
|
||||
(LPSTR)"Hello Wine Application",
|
||||
(MB_OK | MB_ICONEXCLAMATION));
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
echo off
|
||||
REM
|
||||
REM - This is kinda dirty, I might fix it up later. - SE
|
||||
REM
|
||||
|
||||
REM - Make System
|
||||
|
||||
cd GetSystemInfo
|
||||
make
|
||||
cd ..
|
||||
cd guitest
|
||||
make
|
||||
cd ..
|
||||
cd hello
|
||||
make
|
||||
cd ..
|
||||
cd hello2
|
||||
make
|
||||
cd ..
|
||||
cd Mutex
|
||||
make
|
||||
cd ..
|
||||
cd new
|
||||
make
|
||||
cd ..
|
||||
cd Parent_Child
|
||||
make
|
||||
cd ..
|
||||
cd rolex
|
||||
make
|
||||
cd ..
|
||||
cd volinfo
|
||||
make
|
||||
cd ..
|
||||
|
||||
REM - installs
|
||||
|
||||
mkdir C:\tests
|
||||
copy GetSystemInfo\GetSystemInfo.exe C:\tests
|
||||
copy guitest\guitest.exe C:\tests
|
||||
copy hello\hello.exe C:\tests
|
||||
copy hello2\hello2.exe C:\tests
|
||||
copy Mutex\fivemutex.exe C:\tests
|
||||
copy Mutex\rapidmutex.exe C:\tests
|
||||
copy Parent_Child\Parent_Child.exe C:\tests
|
||||
copy rolex\rolex.exe C:\tests
|
||||
copy volinfo\volinfo.exe C:\tests
|
||||
|
@@ -1,26 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = new
|
||||
|
||||
OBJECTS = new.o
|
||||
|
||||
LIBS = ../../../dk/w32/lib/gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
new.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o new.exe
|
||||
$(NM) --numeric-sort new.exe > new.sym
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,154 +0,0 @@
|
||||
#include <windows.h>
|
||||
|
||||
HANDLE ghInstance;
|
||||
|
||||
|
||||
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK ChildProc (HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdParam, int nCmdShow)
|
||||
{
|
||||
char szAppName[] = "ClassLook" ;
|
||||
HWND hwnd ;
|
||||
MSG msg ;
|
||||
WNDCLASS wndclass ;
|
||||
|
||||
ghInstance = hInstance;
|
||||
if (!hPrevInstance)
|
||||
{
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
|
||||
wndclass.lpfnWndProc = WndProc ;
|
||||
wndclass.cbClsExtra = 0 ;
|
||||
wndclass.cbWndExtra = 0 ;
|
||||
wndclass.hInstance = hInstance ;
|
||||
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
|
||||
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
|
||||
wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ;
|
||||
wndclass.lpszMenuName = NULL ;
|
||||
wndclass.lpszClassName = szAppName ;
|
||||
|
||||
RegisterClass (&wndclass) ;
|
||||
}
|
||||
|
||||
hwnd = CreateWindow (szAppName, /* window class name */
|
||||
szAppName, /* window caption */
|
||||
WS_OVERLAPPEDWINDOW, /* window style */
|
||||
CW_USEDEFAULT, /* initial x position */
|
||||
CW_USEDEFAULT, /* initial y position */
|
||||
600, /* initial x size */
|
||||
400, /* initial y size */
|
||||
NULL, /* parent window handle */
|
||||
NULL, /* window menu handle */
|
||||
hInstance, /* program instance handle */
|
||||
NULL) ; /* creation parameters */
|
||||
|
||||
ShowWindow (hwnd, nCmdShow) ;
|
||||
UpdateWindow (hwnd) ;
|
||||
|
||||
while (GetMessage (&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage (&msg) ;
|
||||
DispatchMessage (&msg) ;
|
||||
}
|
||||
return msg.wParam ;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HDC hdc ;
|
||||
PAINTSTRUCT ps ;
|
||||
RECT rect ;
|
||||
WNDCLASS wndclass ;
|
||||
char clsName[] = "SecondClass";
|
||||
|
||||
static HWND hChild;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE :
|
||||
wndclass.style = CS_PARENTDC | CS_HREDRAW | CS_VREDRAW;
|
||||
wndclass.lpfnWndProc = ChildProc ;
|
||||
wndclass.cbClsExtra = 0 ;
|
||||
wndclass.cbWndExtra = 0 ;
|
||||
wndclass.hInstance = ghInstance ;
|
||||
wndclass.hIcon = NULL ;
|
||||
wndclass.hCursor = LoadCursor (NULL, IDC_CROSS) ;
|
||||
wndclass.hbrBackground = GetStockObject (LTGRAY_BRUSH) ;
|
||||
wndclass.lpszMenuName = NULL ;
|
||||
wndclass.lpszClassName = clsName;
|
||||
|
||||
RegisterClass (&wndclass);
|
||||
|
||||
hChild = CreateWindow(clsName,"Child Window",
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER,
|
||||
10, 10, 580, 380, hwnd, NULL, ghInstance, NULL);
|
||||
ShowWindow(hChild, SW_SHOW);
|
||||
case WM_PAINT :
|
||||
hdc = BeginPaint (hwnd, &ps) ;
|
||||
|
||||
GetClientRect (hwnd, &rect) ;
|
||||
|
||||
DrawText (hdc, "Hello, Windows!", -1, &rect,
|
||||
DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
|
||||
|
||||
EndPaint (hwnd, &ps);
|
||||
return 0 ;
|
||||
|
||||
case WM_DESTROY :
|
||||
PostQuitMessage (0) ;
|
||||
return 0 ;
|
||||
}
|
||||
return DefWindowProc (hwnd, message, wParam, lParam) ;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK ChildProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HDC hDC;
|
||||
PAINTSTRUCT ps;
|
||||
WNDCLASS wndClass;
|
||||
char *classes[]={"EDIT","BUTTON","LISTBOX","STATIC","SCROLLBAR","COMBOBOX","COMBOLBOX", NULL};
|
||||
char** curr;
|
||||
char buf[256];
|
||||
RECT rect ;
|
||||
int i;
|
||||
|
||||
switch (message) {
|
||||
case WM_PAINT:
|
||||
curr = classes;
|
||||
i=0;
|
||||
hDC = BeginPaint(hwnd, &ps);
|
||||
SelectObject(hDC,GetStockObject(ANSI_FIXED_FONT));
|
||||
while (*curr) {
|
||||
wsprintf(buf,"%12s:",*curr);
|
||||
GetClassInfo(NULL, *curr, &wndClass);
|
||||
if(wndClass.style&CS_VREDRAW) lstrcat(buf," | CS_VREDRAW");
|
||||
if(wndClass.style&CS_HREDRAW) lstrcat(buf," | CS_HREDRAW" );
|
||||
if(wndClass.style&CS_KEYCVTWINDOW) lstrcat(buf," | CS_KEYCVTWINDOW" );
|
||||
if(wndClass.style&CS_DBLCLKS) lstrcat(buf," | CS_DBLCLKS" );
|
||||
if(wndClass.style&CS_OWNDC) lstrcat(buf," | CS_OWNDC" );
|
||||
if(wndClass.style&CS_CLASSDC) lstrcat(buf," | CS_CLASSDC" );
|
||||
if(wndClass.style&CS_PARENTDC) lstrcat(buf," | CS_PARENTDC" );
|
||||
if(wndClass.style&CS_NOKEYCVT) lstrcat(buf," | CS_NOKEYCVT" );
|
||||
if(wndClass.style&CS_NOCLOSE) lstrcat(buf," | CS_NOCLOSE" );
|
||||
if(wndClass.style&CS_SAVEBITS) lstrcat(buf," | CS_SAVEBITS" );
|
||||
if(wndClass.style&CS_GLOBALCLASS) lstrcat(buf," | CS_GLOBALCLASS");
|
||||
GetClientRect (hwnd, &rect) ;
|
||||
TextOut (hDC, 5,20+i,buf,lstrlen(buf)) ;
|
||||
i += 15;
|
||||
curr++;
|
||||
}
|
||||
/* EndPaint(hwnd, &ps);
|
||||
break;
|
||||
hDC = BeginPaint(hwnd, &ps);
|
||||
*/
|
||||
MoveToEx(hDC, 0, 0, NULL);
|
||||
LineTo(hDC, 500, 500);
|
||||
EndPaint(hwnd, &ps);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc (hwnd, message, wParam, lParam) ;
|
||||
}
|
||||
return (0L);
|
||||
}
|
||||
|
@@ -1,31 +0,0 @@
|
||||
This is a collection of simple tests apps I have ported to the
|
||||
ros build system from wine and other places. Most if not all
|
||||
work great under Win9x,NT,2k and XP. I've fixed and renamed a few
|
||||
of these because the old names didn't really describe them.
|
||||
|
||||
If you feel like messing with this just type make_install and
|
||||
everything will be installed to C:\tests
|
||||
|
||||
TESTS -
|
||||
GetSystemInfo: Reads from kernel32.dll
|
||||
|
||||
guitest: simple win32 gui test
|
||||
|
||||
hello: another win32 hello window test
|
||||
|
||||
hello2: yet another win32 hello window test
|
||||
|
||||
Mutex: Mutex benchmarks from the wineserver kernel module
|
||||
|
||||
new: example of create new window
|
||||
|
||||
Parent_Child: example of child windows inside of parents
|
||||
|
||||
rolex: a clock program worth $30,000
|
||||
|
||||
volinfo - This gets the volume info for all local and network drives
|
||||
AVOID THIS ON 9X, it works but its very slow.
|
||||
|
||||
|
||||
|
||||
|
@@ -1,39 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = rolex
|
||||
|
||||
OBJECTS = rolex.o
|
||||
|
||||
LIBS = ../../../dk/w32/lib/gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
install: $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
|
||||
rolex.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o rolex.exe
|
||||
$(NM) --numeric-sort rolex.exe > rolex.sym
|
||||
|
||||
#%.coff: %.rc
|
||||
# $(RC) $(RCINC) $< -o $@
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,254 +0,0 @@
|
||||
/*********************************************************************
|
||||
* *
|
||||
* rolex.c: Windows clock application for WINE (by Jim Peterson) *
|
||||
* *
|
||||
* This is a translation of a Turbo Pascal OWL application I made *
|
||||
* once, so it's a little flaky (tons of globals, functions that *
|
||||
* could have been in-lined, etc.). The source code should easily *
|
||||
* compile with a standard Win32 C compiler. *
|
||||
* *
|
||||
* To try it out, type 'make rolex'. *
|
||||
* *
|
||||
*********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "windows.h"
|
||||
|
||||
char AppName[] = "Rolex";
|
||||
char WindowName[] = "Rolex";
|
||||
int WindowWidth = 100;
|
||||
int WindowHeight = 121;
|
||||
COLORREF FaceColor = RGB(192,192,192);
|
||||
COLORREF HandColor = RGB(0,0,0);
|
||||
COLORREF EtchColor = RGB(0,0,0);
|
||||
|
||||
float Pi=3.1415926;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int StartX,StartY,EndX,EndY;
|
||||
} HandData;
|
||||
|
||||
int MaxX,MaxY;
|
||||
HandData OldSecond,OldHour,OldMinute;
|
||||
|
||||
HWND HWindow;
|
||||
|
||||
void DrawFace(HDC dc)
|
||||
{
|
||||
int MidX, MidY, t;
|
||||
|
||||
MidX=MaxX/2;
|
||||
MidY=MaxY/2;
|
||||
SelectObject(dc,CreateSolidBrush(FaceColor));
|
||||
SelectObject(dc,CreatePen(PS_SOLID,1,EtchColor));
|
||||
Ellipse(dc,0,0,MaxX,MaxY);
|
||||
|
||||
for(t=0; t<12; t++)
|
||||
{
|
||||
MoveToEx(dc,MidX+sin(t*Pi/6)*0.9*MidX,MidY-cos(t*Pi/6)*0.9*MidY,NULL);
|
||||
LineTo(dc,MidX+sin(t*Pi/6)*0.8*MidX,MidY-cos(t*Pi/6)*0.8*MidY);
|
||||
}
|
||||
if(MaxX>64 && MaxY>64)
|
||||
for(t=0; t<60; t++)
|
||||
SetPixel(dc,MidX+sin(t*Pi/30)*0.9*MidX,MidY-cos(t*Pi/30)*0.9*MidY
|
||||
,EtchColor);
|
||||
DeleteObject(SelectObject(dc,GetStockObject(NULL_BRUSH)));
|
||||
DeleteObject(SelectObject(dc,GetStockObject(NULL_PEN)));
|
||||
memset(&OldSecond,0,sizeof(OldSecond));
|
||||
memset(&OldMinute,0,sizeof(OldMinute));
|
||||
memset(&OldHour,0,sizeof(OldHour));
|
||||
}
|
||||
|
||||
void DrawHourHand(HDC dc)
|
||||
{
|
||||
MoveToEx(dc, OldHour.StartX, OldHour.StartY, NULL);
|
||||
LineTo(dc, OldHour.EndX, OldHour.EndY);
|
||||
}
|
||||
|
||||
void DrawMinuteHand(HDC dc)
|
||||
{
|
||||
MoveToEx(dc, OldMinute.StartX, OldMinute.StartY, NULL);
|
||||
LineTo(dc, OldMinute.EndX, OldMinute.EndY);
|
||||
}
|
||||
|
||||
void DrawSecondHand(HDC dc)
|
||||
{
|
||||
MoveToEx(dc, OldSecond.StartX, OldSecond.StartY, NULL);
|
||||
LineTo(dc, OldSecond.EndX, OldSecond.EndY);
|
||||
}
|
||||
|
||||
BOOL UpdateHourHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos)
|
||||
{
|
||||
int Sx, Sy, Ex, Ey;
|
||||
BOOL rv;
|
||||
|
||||
rv = FALSE;
|
||||
Sx = MidX; Sy = MidY;
|
||||
Ex = MidX+sin(Pos*Pi/6000)*XExt;
|
||||
Ey = MidY-cos(Pos*Pi/6000)*YExt;
|
||||
rv = ( Sx!=OldHour.StartX || Ex!=OldHour.EndX ||
|
||||
Sy!=OldHour.StartY || Ey!=OldHour.EndY );
|
||||
if(rv)DrawHourHand(dc);
|
||||
OldHour.StartX = Sx; OldHour.EndX = Ex;
|
||||
OldHour.StartY = Sy; OldHour.EndY = Ey;
|
||||
return rv;
|
||||
}
|
||||
|
||||
BOOL UpdateMinuteHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos)
|
||||
{
|
||||
int Sx, Sy, Ex, Ey;
|
||||
BOOL rv;
|
||||
|
||||
rv = FALSE;
|
||||
Sx = MidX; Sy = MidY;
|
||||
Ex = MidX+sin(Pos*Pi/30000)*XExt;
|
||||
Ey = MidY-cos(Pos*Pi/30000)*YExt;
|
||||
rv = ( Sx!=OldMinute.StartX || Ex!=OldMinute.EndX ||
|
||||
Sy!=OldMinute.StartY || Ey!=OldMinute.EndY );
|
||||
if(rv)DrawMinuteHand(dc);
|
||||
OldMinute.StartX = Sx; OldMinute.EndX = Ex;
|
||||
OldMinute.StartY = Sy; OldMinute.EndY = Ey;
|
||||
return rv;
|
||||
}
|
||||
|
||||
BOOL UpdateSecondHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos)
|
||||
{
|
||||
int Sx, Sy, Ex, Ey;
|
||||
BOOL rv;
|
||||
|
||||
rv = FALSE;
|
||||
Sx = MidX; Sy = MidY;
|
||||
Ex = MidX+sin(Pos*Pi/3000)*XExt;
|
||||
Ey = MidY-cos(Pos*Pi/3000)*YExt;
|
||||
rv = ( Sx!=OldSecond.StartX || Ex!=OldSecond.EndX ||
|
||||
Sy!=OldSecond.StartY || Ey!=OldSecond.EndY );
|
||||
if(rv)DrawSecondHand(dc);
|
||||
OldSecond.StartX = Sx; OldSecond.EndX = Ex;
|
||||
OldSecond.StartY = Sy; OldSecond.EndY = Ey;
|
||||
return rv;
|
||||
}
|
||||
|
||||
void Idle(HDC idc)
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
WORD H, M, S, F;
|
||||
int MidX, MidY;
|
||||
HDC dc;
|
||||
BOOL Redraw;
|
||||
|
||||
if(idc)
|
||||
dc=idc;
|
||||
else
|
||||
dc=GetDC(HWindow);
|
||||
if(!dc)return;
|
||||
|
||||
GetLocalTime(&st);
|
||||
H = st.wHour;
|
||||
M = st.wMinute;
|
||||
S = st.wSecond;
|
||||
F = st.wMilliseconds / 10;
|
||||
F = F + S*100;
|
||||
M = M*1000+F/6;
|
||||
H = H*1000+M/60;
|
||||
MidX = MaxX/2;
|
||||
MidY = MaxY/2;
|
||||
SelectObject(dc,CreatePen(PS_SOLID,1,FaceColor));
|
||||
Redraw = FALSE;
|
||||
if(UpdateHourHand(dc,MidX,MidY,MidX*0.5,MidY*0.5,H)) Redraw = TRUE;
|
||||
if(UpdateMinuteHand(dc,MidX,MidY,MidX*0.65,MidY*0.65,M)) Redraw = TRUE;
|
||||
if(UpdateSecondHand(dc,MidX,MidY,MidX*0.79,MidY*0.79,F)) Redraw = TRUE;
|
||||
DeleteObject(SelectObject(dc,CreatePen(PS_SOLID,1,HandColor)));
|
||||
if(Redraw)
|
||||
{
|
||||
DrawSecondHand(dc);
|
||||
DrawMinuteHand(dc);
|
||||
DrawHourHand(dc);
|
||||
}
|
||||
DeleteObject(SelectObject(dc,GetStockObject(NULL_PEN)));
|
||||
if(!idc) ReleaseDC(HWindow,dc);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK ProcessAppMsg(HWND wnd,UINT msg,WPARAM w,LPARAM l)
|
||||
{
|
||||
PAINTSTRUCT PaintInfo;
|
||||
HDC dc;
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
if(GetUpdateRect(wnd,NULL,FALSE))
|
||||
{
|
||||
dc=BeginPaint(wnd,&PaintInfo);
|
||||
DrawFace(dc);
|
||||
Idle(dc);
|
||||
EndPaint(wnd,&PaintInfo);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
MaxX = LOWORD(l);
|
||||
MaxY = HIWORD(l);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage (0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc (wnd, msg, w, l);
|
||||
}
|
||||
return 0l;
|
||||
}
|
||||
|
||||
WPARAM MessageLoop()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while(1)
|
||||
{
|
||||
Sleep(1); /* sleep 1 millisecond */
|
||||
if(PeekMessage(&msg,0,0,0,PM_REMOVE))
|
||||
{
|
||||
if(msg.message == WM_QUIT) return msg.wParam;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
Idle(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
WNDCLASS class;
|
||||
if(!prev)
|
||||
{
|
||||
class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
class.lpfnWndProc = ProcessAppMsg;
|
||||
class.cbClsExtra = 0;
|
||||
class.cbWndExtra = 0;
|
||||
class.hInstance = inst;
|
||||
class.hIcon = 0; /* Draw my own icon */
|
||||
class.hCursor = LoadCursor (0, IDC_ARROW);
|
||||
class.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1);
|
||||
class.lpszMenuName = 0;
|
||||
class.lpszClassName = AppName;
|
||||
}
|
||||
if (!RegisterClass (&class)) return -1;
|
||||
|
||||
HWindow=CreateWindowEx(WS_EX_TOPMOST,AppName,WindowName,WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,CW_USEDEFAULT,WindowWidth,WindowHeight,
|
||||
0,0,inst,0);
|
||||
memset(&OldSecond,0,sizeof(OldSecond));
|
||||
memset(&OldMinute,0,sizeof(OldMinute));
|
||||
memset(&OldHour,0,sizeof(OldHour));
|
||||
MaxX = WindowWidth;
|
||||
MaxY = WindowHeight;
|
||||
|
||||
ShowWindow (HWindow, show);
|
||||
UpdateWindow (HWindow);
|
||||
|
||||
return MessageLoop();
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
name rolex
|
||||
mode guiexe
|
||||
type win32
|
||||
|
||||
import user32.dll
|
||||
import gdi32.dll
|
||||
import kernel32.dll
|
||||
import ntdll.dll
|
@@ -1,36 +0,0 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
PROGS = volinfo
|
||||
|
||||
OBJECTS = volinfo.o
|
||||
|
||||
LIBS =
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
install: $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
|
||||
volinfo.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o volinfo.exe
|
||||
$(NM) --numeric-sort volinfo.exe > volinfo.sym
|
||||
|
||||
include ../../../rules.mak
|
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* This test program was copied from the former file documentation/cdrom-label
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* for strcat() */
|
||||
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
char drive, root[]="C:\\", label[1002], fsname[1002];
|
||||
DWORD serial, flags, filenamelen, labellen = 1000, fsnamelen = 1000;
|
||||
|
||||
printf("Drive Serial Flags Filename-Length "
|
||||
"Label Fsname\n");
|
||||
for (drive = 'A'; drive <= 'Z'; drive++)
|
||||
{
|
||||
root[0] = drive;
|
||||
if (GetVolumeInformation(root,label,labellen,&serial,
|
||||
&filenamelen,&flags,fsname,fsnamelen))
|
||||
{
|
||||
strcat(label,"\""); strcat (fsname,"\"");
|
||||
printf("%c:\\ 0x%08lx 0x%08lx %15ld \"%-20s \"%-20s\n",
|
||||
drive, (long) serial, (long) flags, (long) filenamelen,
|
||||
label, fsname);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
41
reactos/apps/tests/thread/makefile
Normal file
41
reactos/apps/tests/thread/makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PROGS = thread
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean: $(PROGS:%=%_clean)
|
||||
|
||||
$(PROGS:%=%_clean): %_clean:
|
||||
- $(RM) $*.o
|
||||
- $(RM) $*.exe
|
||||
- $(RM) $*.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
|
||||
else
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
endif
|
||||
|
||||
thread.exe: thread.c
|
||||
$(CC) $(CFLAGS) thread.c -lkernel32 -o thread.exe
|
||||
$(NM) --numeric-sort thread.exe > thread.sym
|
||||
|
||||
include ../../rules.mak
|
46
reactos/apps/tests/thread/thread.c
Normal file
46
reactos/apps/tests/thread/thread.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define NR_THREADS (10)
|
||||
|
||||
ULONG nr;
|
||||
|
||||
DWORD WINAPI thread_main1(LPVOID param)
|
||||
{
|
||||
ULONG s;
|
||||
|
||||
printf("Thread %d running\n", (DWORD)param);
|
||||
s = nr = ((nr * 1103515245) + 12345) & 0x7fffffff;
|
||||
s = s % 10;
|
||||
printf("s %d\n", s);
|
||||
Sleep(s);
|
||||
printf("Thread %d finished\n", (DWORD)param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
HANDLE hThread;
|
||||
DWORD i=0;
|
||||
DWORD id;
|
||||
ULONG nr;
|
||||
|
||||
nr = atoi(argv[1]);
|
||||
printf("Seed %d\n", nr);
|
||||
|
||||
printf("Creating %d threads...\n",NR_THREADS*2);
|
||||
for (i=0;i<NR_THREADS;i++)
|
||||
{
|
||||
CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
}
|
||||
|
||||
printf("All threads created...\n");
|
||||
for(;;);
|
||||
return 0;
|
||||
}
|
2
reactos/apps/utils/buildno/.cvsignore
Normal file
2
reactos/apps/utils/buildno/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
buildno
|
||||
buildno.exe
|
26
reactos/apps/utils/buildno/Makefile
Normal file
26
reactos/apps/utils/buildno/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
# $Id: Makefile,v 1.3 1999/11/12 12:01:09 dwelch Exp $
|
||||
#
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
TARGETNAME=buildno
|
||||
CLEAN_FILES= $(TARGETNAME).o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).sym
|
||||
|
||||
all: $(TARGETNAME)$(EXE_POSTFIX)
|
||||
$(EXE_PREFIX)$(TARGETNAME)$(EXE_POSTFIX) -q
|
||||
|
||||
|
||||
$(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c ../../include/reactos/version.h
|
||||
$(NATIVE_CC) -I../../include -o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).c
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) $(TARGETNAME).o
|
||||
$(RM) $(TARGETNAME).sym
|
||||
$(RM) $(TARGETNAME)$(EXE_POSTFIX)
|
||||
|
||||
.phony: clean
|
||||
|
||||
include ../../rules.mak
|
||||
|
||||
# EOF
|
262
reactos/apps/utils/buildno/buildno.c
Normal file
262
reactos/apps/utils/buildno/buildno.c
Normal file
@@ -0,0 +1,262 @@
|
||||
/* $Id: buildno.c,v 1.2 1999/12/26 20:21:02 ea Exp $
|
||||
*
|
||||
* buildno - Generate the build number for ReactOS
|
||||
*
|
||||
* Copyright (c) 1999 Emanuele Aliberti
|
||||
*
|
||||
*
|
||||
* It assumes the last release date is defined in
|
||||
* <reactos/version.h> as a macro named
|
||||
*
|
||||
* KERNEL_RELEASE_DATE
|
||||
*
|
||||
* as a 32-bit unsigned long YYYYMMDD (UTC).
|
||||
*
|
||||
* The build number is the number of full days
|
||||
* elapsed since the last release date (UTC).
|
||||
*
|
||||
* The build number is stored in the file
|
||||
* <reactos/buildno.h> as a set of macros:
|
||||
*
|
||||
* KERNEL_VERSION_BUILD
|
||||
* KERNEL_VERSION_BUILD_STR
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <reactos/version.h>
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
/* File to (over)write */
|
||||
#define BUILDNO_INCLUDE_FILE "../../include/reactos/buildno.h"
|
||||
|
||||
static char * argv0 = "";
|
||||
|
||||
|
||||
int
|
||||
elapsed_days (
|
||||
time_t t_today,
|
||||
time_t t_release_day
|
||||
)
|
||||
{
|
||||
double seconds = difftime (t_today, t_release_day);
|
||||
double days = seconds / (double) 86400.0;
|
||||
char buf [32];
|
||||
char * dot = buf;
|
||||
|
||||
sprintf (buf, "%f", days );
|
||||
|
||||
while ( *dot && *dot != '.') ++dot;
|
||||
*dot = '\0';
|
||||
|
||||
return atol (buf);
|
||||
}
|
||||
|
||||
void
|
||||
write_h (int build)
|
||||
{
|
||||
FILE *h = NULL;
|
||||
|
||||
h = fopen ( BUILDNO_INCLUDE_FILE, "w");
|
||||
if (!h)
|
||||
{
|
||||
fprintf (
|
||||
stderr,
|
||||
"%s: can not create file \"%s\"!\n",
|
||||
argv0,
|
||||
BUILDNO_INCLUDE_FILE
|
||||
);
|
||||
return;
|
||||
}
|
||||
fprintf (
|
||||
h,
|
||||
"/* Do not edit - Machine generated */\n"
|
||||
);
|
||||
|
||||
fprintf (h, "#ifndef _INC_REACTOS_BUILDNO\n" );
|
||||
fprintf (h, "#define _INC_REACTOS_BUILDNO\n" );
|
||||
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_VERSION_BUILD\t%d\n",
|
||||
build
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_VERSION_BUILD_STR\t\"%d\"\n",
|
||||
build
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_RELEASE_RC\t\"%d.%d.%d.%d\\0\"\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL,
|
||||
build
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_RELEASE_STR\t\"%d.%d.%d.%d\"\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL,
|
||||
build
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_VERSION_RC\t\"%d.%d.%d\\0\"\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#define KERNEL_VERSION_STR\t\"%d.%d.%d\"\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL
|
||||
);
|
||||
fprintf (
|
||||
h,
|
||||
"#endif\n/* EOF */\n"
|
||||
);
|
||||
|
||||
fclose (h);
|
||||
}
|
||||
|
||||
void
|
||||
usage (void)
|
||||
{
|
||||
fprintf (
|
||||
stderr,
|
||||
"Usage: %s [-q]\n",
|
||||
argv0
|
||||
);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{
|
||||
int quiet = FALSE;
|
||||
|
||||
int year = 0;
|
||||
int month = 0;
|
||||
int day = 0;
|
||||
int build = 0;
|
||||
|
||||
time_t t0 = 0;
|
||||
struct tm t0_tm = {0};
|
||||
time_t t1 = 0;
|
||||
struct tm * t1_tm = NULL;
|
||||
|
||||
argv0 = argv[0];
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (argv[1][0] == '-')
|
||||
{
|
||||
if (argv[1][1] == 'q')
|
||||
{
|
||||
quiet = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
usage ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usage ();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage ();
|
||||
}
|
||||
/*
|
||||
* We are building TODAY!
|
||||
*/
|
||||
time (& t0);
|
||||
/*
|
||||
* "Parse" the release date.
|
||||
*/
|
||||
day = KERNEL_RELEASE_DATE % 100;
|
||||
month = ( ( KERNEL_RELEASE_DATE
|
||||
% 10000
|
||||
)
|
||||
- day
|
||||
)
|
||||
/ 100;
|
||||
year =
|
||||
( KERNEL_RELEASE_DATE
|
||||
- (month * 100)
|
||||
- day
|
||||
)
|
||||
/ 10000;
|
||||
if (FALSE == quiet)
|
||||
{
|
||||
printf ( "\n\
|
||||
ReactOS Build Number Generator\n\n\
|
||||
Last release: %4d-%02d-%02d\n",
|
||||
year,
|
||||
month,
|
||||
day
|
||||
);
|
||||
}
|
||||
t0_tm.tm_year = year - ((year > 1999) ? 2000 : 1900);
|
||||
t0_tm.tm_mon = month;
|
||||
t0_tm.tm_mday = day;
|
||||
|
||||
t0 = mktime (& t0_tm);
|
||||
|
||||
time (& t1); /* current build time */
|
||||
t1_tm = gmtime (& t1);
|
||||
|
||||
t1_tm->tm_year +=
|
||||
(t1_tm->tm_year < 70)
|
||||
? 2000
|
||||
: 1900;
|
||||
if (FALSE == quiet)
|
||||
{
|
||||
printf (
|
||||
"Current date: %4d-%02d-%02d\n\n",
|
||||
t1_tm->tm_year,
|
||||
t1_tm->tm_mon,
|
||||
t1_tm->tm_mday
|
||||
);
|
||||
}
|
||||
/*
|
||||
* Compute delta days.
|
||||
*/
|
||||
build = elapsed_days (t1, t0);
|
||||
|
||||
if (FALSE == quiet)
|
||||
{
|
||||
printf (
|
||||
"Build number: %d (elapsed days since last release)\n",
|
||||
build
|
||||
);
|
||||
printf (
|
||||
"ROS Version : %d.%d.%d.%d\n",
|
||||
KERNEL_VERSION_MAJOR,
|
||||
KERNEL_VERSION_MINOR,
|
||||
KERNEL_VERSION_PATCH_LEVEL,
|
||||
build
|
||||
);
|
||||
}
|
||||
/*
|
||||
* (Over)write the include file.
|
||||
*/
|
||||
write_h (build);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
26
reactos/apps/utils/cat/cat.c
Normal file
26
reactos/apps/utils/cat/cat.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
FILE* in;
|
||||
char ch;
|
||||
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
in = fopen(argv[i],"r");
|
||||
if (in == NULL)
|
||||
{
|
||||
printf("Failed to open file %s\n", argv[i]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
while ((ch = fgetc(in)) != EOF)
|
||||
{
|
||||
putchar(ch);
|
||||
}
|
||||
fclose(in);
|
||||
}
|
||||
return 0;
|
||||
}
|
42
reactos/apps/utils/cat/makefile
Normal file
42
reactos/apps/utils/cat/makefile
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
OBJECTS= cat.o
|
||||
PROGS= cat.exe
|
||||
|
||||
all: cat.exe
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) cat.o
|
||||
- $(RM) cat.exe
|
||||
- $(RM) cat.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* $(FLOPPY_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* $(FLOPPY_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
|
||||
else
|
||||
$(CP) $* ../../$(DIST_DIR)/apps/$*
|
||||
endif
|
||||
|
||||
.PHONY: floppy dist
|
||||
|
||||
cat.exe: $(OBJECTS) $(LIBS)
|
||||
$(CC) $(OBJECTS) -o cat.exe
|
||||
$(NM) --numeric-sort cat.exe > cat.sym
|
||||
|
||||
include ../../rules.mak
|
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Notepad (Danish resources)
|
||||
*
|
||||
* Copyright 1998 Henrik Olsen <henrik@iaeste.dk>
|
||||
*/
|
||||
|
||||
#define LANGUAGE_ID Da
|
||||
#define LANGUAGE_NUMBER 6
|
||||
#define LANGUAGE_MENU_ITEM "&Dansk"
|
||||
|
||||
/* Menu */
|
||||
|
||||
#define MENU_FILE "&Filef"
|
||||
#define MENU_FILE_NEW "&Ny..."
|
||||
#define MENU_FILE_OPEN "<22>&bn\tEnter"
|
||||
#define MENU_FILE_SAVE "&Gem"
|
||||
#define MENU_FILE_SAVEAS "Gem so&m..."
|
||||
#define MENU_FILE_PRINT "&Udskriv"
|
||||
#define MENU_FILE_PAGESETUP "Side&ops<70>tning..."
|
||||
#define MENU_FILE_PRINTSETUP "&Indstil printer..."
|
||||
#define MENU_FILE_EXIT "&Afslut"
|
||||
|
||||
#define MENU_EDIT "&Rediger"
|
||||
#define MENU_EDIT_UNDO "&Fortryd\tCtrl+Z"
|
||||
#define MENU_EDIT_CUT "&Klip\tCtrl+X"
|
||||
#define MENU_EDIT_COPY "K&opier\tCtrl+C"
|
||||
#define MENU_EDIT_PASTE "S<>t &ind\tCtrl+V"
|
||||
#define MENU_EDIT_DELETE "&Slet\tDel"
|
||||
#define MENU_EDIT_SELECTALL "Marker &alt"
|
||||
#define MENU_EDIT_TIMEDATE "&Dato/tid\tF5"
|
||||
#define MENU_EDIT_WRAP "Automatisk &linjeskift"
|
||||
|
||||
#define MENU_SEARCH "&S<>g"
|
||||
#define MENU_SEARCH_SEARCH "&S<>g..."
|
||||
#define MENU_SEARCH_NEXT "&Find n<>ste\tF3"
|
||||
|
||||
#define MENU_LANGUAGE "S&prog"
|
||||
|
||||
#define MENU_HELP "&Hj<48>lp"
|
||||
#define MENU_HELP_CONTENTS "&Indhold"
|
||||
#define MENU_HELP_SEARCH "&S<>g efter hj<68>lp om..."
|
||||
#define MENU_HELP_HELP_ON_HELP "&Brug af Hj<48>lp"
|
||||
|
||||
#define MENU_INFO "&Om Notesblok..."
|
||||
#define MENU_INFO_LICENSE "&Licens"
|
||||
#define MENU_INFO_NO_WARRANTY "&NO WARRANTY"
|
||||
#define MENU_INFO_ABOUT_WINE "&Om WINE"
|
||||
|
||||
|
||||
/* Dialogs */
|
||||
|
||||
#define DIALOG_OK "OK"
|
||||
#define DIALOG_CANCEL "Annuller"
|
||||
#define DIALOG_BROWSE "&Gennemse..."
|
||||
#define DIALOG_HELP "&Hj<48>lp"
|
||||
|
||||
#define DIALOG_PAGESETUP_CAPTION "Sideops<70>tning"
|
||||
#define DIALOG_PAGESETUP_HEAD "&Sidehoved:"
|
||||
#define DIALOG_PAGESETUP_TAIL "Side&fod:"
|
||||
#define DIALOG_PAGESETUP_MARGIN "Margener:"
|
||||
#define DIALOG_PAGESETUP_LEFT "&Venstre:"
|
||||
#define DIALOG_PAGESETUP_RIGHT "&H<>jre:"
|
||||
#define DIALOG_PAGESETUP_TOP "&Top:"
|
||||
#define DIALOG_PAGESETUP_BOTTOM "&Bund:"
|
||||
|
||||
|
||||
/* Strings */
|
||||
|
||||
#define STRING_PAGESETUP_HEADERVALUE "&n" /* FIXME */
|
||||
#define STRING_PAGESETUP_FOOTERVALUE "Page &s" /* FIXME */
|
||||
#define STRING_PAGESETUP_LEFTVALUE "20 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_RIGHTVALUE "20 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_TOPVALUE "25 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_BOTTOMVALUE "25 mm" /* FIXME */
|
||||
|
||||
#define STRING_NOTEPAD "Notesblok"
|
||||
#define STRING_ERROR "FEJL"
|
||||
#define STRING_WARNING "ADVARSEL"
|
||||
#define STRING_INFO "Information"
|
||||
|
||||
#define STRING_UNTITLED "(ikke-navngivet)"
|
||||
|
||||
#define STRING_ALL_FILES "Alle filer (*.*)"
|
||||
#define STRING_TEXT_FILES_TXT "Tekst filer (*.txt)"
|
||||
|
||||
#define STRING_TOOLARGE "Filen '%s' er for stor til Notesblok. \
|
||||
\nBrug en anden editor til at redigere filen."
|
||||
|
||||
#define STRING_NOTEXT "Du har ikke skrevet noget tekst. \
|
||||
\nSkriv noget tekst, og pr<70>v s<> igen"
|
||||
|
||||
/* FIXME: */
|
||||
|
||||
#define STRING_NOTSAVED "Filen '%s'\n has been modified.\n\n \
|
||||
Would you like to save the changes ?"
|
||||
|
||||
#define STRING_NOTFOUND "Kan ikke finde '%s'."
|
||||
|
||||
#define STRING_OUT_OF_MEMORY "Der er ikke nok hukommelse til at udf<64>re \
|
||||
denne operation. \nAfslut et eller flere aktive programmer for at frig<69>re \
|
||||
hukommelse, og pr<70>v s<> igen."
|
||||
|
||||
#include "notepad.rc"
|
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Notepad (German resources)
|
||||
*
|
||||
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
|
||||
* To be distributed under the Wine License
|
||||
*/
|
||||
|
||||
#define LANGUAGE_ID De
|
||||
#define LANGUAGE_NUMBER 2
|
||||
#define LANGUAGE_MENU_ITEM "&Deutsch"
|
||||
|
||||
|
||||
/* Menu */
|
||||
|
||||
#define MENU_FILE "&Datei"
|
||||
#define MENU_FILE_NEW "&Neu..."
|
||||
#define MENU_FILE_OPEN "<22>&ffnen..."
|
||||
#define MENU_FILE_SAVE "&Speichern"
|
||||
#define MENU_FILE_SAVEAS "Speichern &unter..."
|
||||
#define MENU_FILE_PRINT "&Drucken"
|
||||
#define MENU_FILE_PAGESETUP "Seite ein&richten..."
|
||||
#define MENU_FILE_PRINTSETUP "Drucker&einrichtung..."
|
||||
#define MENU_FILE_EXIT "&Beenden"
|
||||
|
||||
#define MENU_EDIT "&Bearbeiten"
|
||||
#define MENU_EDIT_UNDO "&R<>ckg<6B>ngig\tStrg+Z"
|
||||
#define MENU_EDIT_CUT "&Ausschneiden\tStrg+X"
|
||||
#define MENU_EDIT_COPY "&Kopieren\tStrg+C"
|
||||
#define MENU_EDIT_PASTE "&Einf<6E>gen\tStrg+V"
|
||||
#define MENU_EDIT_DELETE "&L<>schen\tEntf"
|
||||
#define MENU_EDIT_SELECTALL "Alles &markieren"
|
||||
#define MENU_EDIT_TIMEDATE "&Uhrzeit/Datum\tF5"
|
||||
#define MENU_EDIT_WRAP "&Zeilenumbruch"
|
||||
|
||||
#define MENU_SEARCH "&Suchen"
|
||||
#define MENU_SEARCH_SEARCH "Suchen..."
|
||||
#define MENU_SEARCH_NEXT "&Weitersuchen\tF3"
|
||||
|
||||
#define MENU_LANGUAGE "&Sprache"
|
||||
|
||||
#define MENU_HELP "&Hilfe"
|
||||
#define MENU_HELP_CONTENTS "&Inhalt"
|
||||
#define MENU_HELP_SEARCH "&Suchen..."
|
||||
#define MENU_HELP_HELP_ON_HELP "&Hilfe benutzen"
|
||||
|
||||
#define MENU_INFO "Inf&o..."
|
||||
#define MENU_INFO_LICENSE "&Lizenz"
|
||||
#define MENU_INFO_NO_WARRANTY "&KEINE GARANTIE"
|
||||
#define MENU_INFO_ABOUT_WINE "&<26>ber WINE"
|
||||
|
||||
|
||||
/* Dialogs */
|
||||
|
||||
#define DIALOG_OK "OK"
|
||||
#define DIALOG_CANCEL "Abbrechen"
|
||||
#define DIALOG_BROWSE "&Durchsuchen..."
|
||||
#define DIALOG_HELP "&Hilfe"
|
||||
|
||||
#define DIALOG_PAGESETUP_CAPTION "Seite einrichten"
|
||||
#define DIALOG_PAGESETUP_HEAD "&Kopfzeile:"
|
||||
#define DIALOG_PAGESETUP_TAIL "&Fu<46>zeile:"
|
||||
#define DIALOG_PAGESETUP_MARGIN "R<>nder"
|
||||
#define DIALOG_PAGESETUP_LEFT "&Links:"
|
||||
#define DIALOG_PAGESETUP_RIGHT "&Rechts:"
|
||||
#define DIALOG_PAGESETUP_TOP "&Oben:"
|
||||
#define DIALOG_PAGESETUP_BOTTOM "&Unten:"
|
||||
|
||||
|
||||
/* Strings */
|
||||
|
||||
#define STRING_PAGESETUP_HEADERVALUE "&n"
|
||||
#define STRING_PAGESETUP_FOOTERVALUE "Page &s"
|
||||
#define STRING_PAGESETUP_LEFTVALUE "20 mm"
|
||||
#define STRING_PAGESETUP_RIGHTVALUE "20 mm"
|
||||
#define STRING_PAGESETUP_TOPVALUE "25 mm"
|
||||
#define STRING_PAGESETUP_BOTTOMVALUE "25 mm"
|
||||
|
||||
#define STRING_NOTEPAD "Editor"
|
||||
#define STRING_ERROR "FEHLER"
|
||||
#define STRING_WARNING "ACHTUNG"
|
||||
#define STRING_INFO "Information"
|
||||
|
||||
#define STRING_UNTITLED "(unbenannt)"
|
||||
|
||||
#define STRING_ALL_FILES "Alle Dateien (*.*)"
|
||||
#define STRING_TEXT_FILES_TXT "Textdateien (*.txt)"
|
||||
|
||||
#define STRING_TOOLARGE "'%s' ist zu gross f<>r den Editor\n \
|
||||
Benutzen Sie bitte einen anderen Editor, um diese Datei zu bearbeiten."
|
||||
|
||||
#define STRING_NOTEXT "Sie haben keinen Text eingegeben, der \
|
||||
gespeichert\n werden k<>nnte. Geben Sie Text ein, und versuchen Sie es \
|
||||
\nerneut."
|
||||
|
||||
#define STRING_NOTSAVED "Datei %s\n wurde geaendert.\n\n \
|
||||
Moechten Sie die Aenderungen speichern ?"
|
||||
|
||||
#define STRING_NOTFOUND "'%s' kann nicht gefunden werden."
|
||||
|
||||
#define STRING_OUT_OF_MEMORY "Nicht gen<65>gend Arbeitsspeicher, \
|
||||
um diese Funktion \nabzuschlie<69>en. Beenden Sie eine oder mehrere \
|
||||
\nAnwendungen, um den verf<72>gbaren Arbeitsspeicher zu \nerh<72>hen."
|
||||
|
||||
#include "notepad.rc"
|
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Notepad (English resources)
|
||||
*
|
||||
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
|
||||
* Proofread 1998 by David Lee Lambert <lamber45@egr.msu.edu>
|
||||
*/
|
||||
|
||||
#define LANGUAGE_ID En
|
||||
#define LANGUAGE_NUMBER 0
|
||||
#define LANGUAGE_MENU_ITEM "&English"
|
||||
|
||||
|
||||
/* Menu */
|
||||
|
||||
#define MENU_FILE "&File"
|
||||
#define MENU_FILE_NEW "&New..."
|
||||
#define MENU_FILE_OPEN "&Open"
|
||||
#define MENU_FILE_SAVE "&Save"
|
||||
#define MENU_FILE_SAVEAS "Save &as..."
|
||||
#define MENU_FILE_PRINT "&Print"
|
||||
#define MENU_FILE_PAGESETUP "Page Se&tup..."
|
||||
#define MENU_FILE_PRINTSETUP "P&rinter Setup..."
|
||||
#define MENU_FILE_EXIT "&Exit"
|
||||
|
||||
#define MENU_EDIT "&Edit"
|
||||
#define MENU_EDIT_UNDO "&Undo\tCtrl+Z"
|
||||
#define MENU_EDIT_CUT "Cu&t\tCtrl+X"
|
||||
#define MENU_EDIT_COPY "&Copy\tCtrl+C"
|
||||
#define MENU_EDIT_PASTE "&Paste\tCtrl+V"
|
||||
#define MENU_EDIT_DELETE "&Delete\tDel"
|
||||
#define MENU_EDIT_SELECTALL "Select &all"
|
||||
#define MENU_EDIT_TIMEDATE "&Time/Date\tF5"
|
||||
#define MENU_EDIT_WRAP "&Wrap long lines"
|
||||
|
||||
#define MENU_SEARCH "&Search"
|
||||
#define MENU_SEARCH_SEARCH "Search..."
|
||||
#define MENU_SEARCH_NEXT "&Search next\tF3"
|
||||
|
||||
#define MENU_LANGUAGE "&Language"
|
||||
|
||||
#define MENU_HELP "&Help"
|
||||
#define MENU_HELP_CONTENTS "&Contents"
|
||||
#define MENU_HELP_SEARCH "&Search..."
|
||||
#define MENU_HELP_HELP_ON_HELP "&Help on help"
|
||||
|
||||
#define MENU_INFO "Inf&o..."
|
||||
#define MENU_INFO_LICENSE "&License"
|
||||
#define MENU_INFO_NO_WARRANTY "&NO WARRANTY"
|
||||
#define MENU_INFO_ABOUT_WINE "&About Wine"
|
||||
|
||||
|
||||
/* Dialogs */
|
||||
|
||||
#define DIALOG_OK "OK"
|
||||
#define DIALOG_CANCEL "Cancel"
|
||||
#define DIALOG_BROWSE "&Browse..."
|
||||
#define DIALOG_HELP "&Help"
|
||||
|
||||
#define DIALOG_PAGESETUP_CAPTION "Page Setup"
|
||||
#define DIALOG_PAGESETUP_HEAD "&Header:"
|
||||
#define DIALOG_PAGESETUP_TAIL "&Footer:"
|
||||
#define DIALOG_PAGESETUP_MARGIN "&Margins:"
|
||||
#define DIALOG_PAGESETUP_LEFT "&Left:"
|
||||
#define DIALOG_PAGESETUP_RIGHT "&Right:"
|
||||
#define DIALOG_PAGESETUP_TOP "&Top:"
|
||||
#define DIALOG_PAGESETUP_BOTTOM "&Bottom:"
|
||||
|
||||
|
||||
/* Strings */
|
||||
|
||||
#define STRING_PAGESETUP_HEADERVALUE "&n" /* FIXME */
|
||||
#define STRING_PAGESETUP_FOOTERVALUE "Page &s" /* FIXME */
|
||||
#define STRING_PAGESETUP_LEFTVALUE "20 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_RIGHTVALUE "20 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_TOPVALUE "25 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_BOTTOMVALUE "25 mm" /* FIXME */
|
||||
|
||||
#define STRING_NOTEPAD "Notepad"
|
||||
#define STRING_ERROR "ERROR"
|
||||
#define STRING_WARNING "WARNING"
|
||||
#define STRING_INFO "Information"
|
||||
|
||||
#define STRING_UNTITLED "(untitled)"
|
||||
|
||||
#define STRING_ALL_FILES "All files (*.*)"
|
||||
#define STRING_TEXT_FILES_TXT "Text files (*.txt)"
|
||||
|
||||
#define STRING_TOOLARGE "File '%s' is too large for notepad.\n \
|
||||
Please use a different editor."
|
||||
|
||||
#define STRING_NOTEXT "You didn't enter any text. \
|
||||
\nPlease type something and try again"
|
||||
|
||||
#define STRING_NOTSAVED "File '%s'\nhas been modified\n\n \
|
||||
Would you like to save the changes ?"
|
||||
|
||||
#define STRING_NOTFOUND "'%s' can not be found."
|
||||
|
||||
#define STRING_OUT_OF_MEMORY "Not enough memory to complete this \
|
||||
task. \nClose one or more applications to increase the amount of \nfree \
|
||||
memory."
|
||||
|
||||
#include "notepad.rc"
|
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Notepad (English resources)
|
||||
*
|
||||
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
|
||||
* Proofread 1998 by David Lee Lambert <lamber45@egr.msu.edu>
|
||||
* Proofread 1999 by Jose Marcos Lopez <jose.lopez@upcnet.upc.es>
|
||||
*/
|
||||
|
||||
#define LANGUAGE_ID Es
|
||||
#define LANGUAGE_NUMBER d
|
||||
#define LANGUAGE_MENU_ITEM "Castellano"
|
||||
|
||||
|
||||
/* Menu */
|
||||
|
||||
#define MENU_FILE "&Archivo"
|
||||
#define MENU_FILE_NEW "&Nuevo"
|
||||
#define MENU_FILE_OPEN "&Abrir"
|
||||
#define MENU_FILE_SAVE "&Guardar"
|
||||
#define MENU_FILE_SAVEAS "Guardar co&mo..."
|
||||
#define MENU_FILE_PAGESETUP "&Configurar p<>gina..."
|
||||
#define MENU_FILE_PRINT "&Imprimir"
|
||||
#define MENU_FILE_PRINTSETUP "&Configuraci<63>n impresora..."
|
||||
#define MENU_FILE_EXIT "&Salir"
|
||||
|
||||
#define MENU_EDIT "&Editar"
|
||||
#define MENU_EDIT_UNDO "&Deshacer\tCtrl+Z"
|
||||
#define MENU_EDIT_CUT "Cor&tar\tCtrl+X"
|
||||
#define MENU_EDIT_COPY "&Copiar\tCtrl+C"
|
||||
#define MENU_EDIT_PASTE "&Pegar\tCtrl+V"
|
||||
#define MENU_EDIT_DELETE "&Borrar\tDel"
|
||||
#define MENU_EDIT_SELECTALL "Seleccionar t&odo"
|
||||
#define MENU_EDIT_TIMEDATE "&Hora y Fecha\tF5"
|
||||
#define MENU_EDIT_WRAP "&Ajuste de l<>nea autom<6F>tico"
|
||||
|
||||
#define MENU_SEARCH "&Buscar"
|
||||
#define MENU_SEARCH_SEARCH "&Buscar..."
|
||||
#define MENU_SEARCH_NEXT "Buscar &siguiente\tF3"
|
||||
|
||||
#define MENU_LANGUAGE "&Idioma"
|
||||
|
||||
#define MENU_HELP "&Ayuda"
|
||||
#define MENU_HELP_CONTENTS "&Indice"
|
||||
#define MENU_HELP_SEARCH "&Buscar..."
|
||||
#define MENU_HELP_HELP_ON_HELP "&Ayuda sobre la ayuda"
|
||||
|
||||
#define MENU_INFO "Inf&ormaci<63>n..."
|
||||
#define MENU_INFO_LICENSE "&Licencia"
|
||||
#define MENU_INFO_NO_WARRANTY "SIN &GARANT<4E>A"
|
||||
#define MENU_INFO_ABOUT_WINE "&Acerca de Wine"
|
||||
|
||||
|
||||
/* Dialogs */
|
||||
|
||||
#define DIALOG_OK "OK"
|
||||
#define DIALOG_CANCEL "Cancelar"
|
||||
#define DIALOG_BROWSE "&Buscar..."
|
||||
#define DIALOG_HELP "&Ayuda"
|
||||
|
||||
#define DIALOG_PAGESETUP_CAPTION "&Ajuste de p<>gina"
|
||||
#define DIALOG_PAGESETUP_HEAD "&Cabecera:"
|
||||
#define DIALOG_PAGESETUP_TAIL "&Pi<50>:"
|
||||
#define DIALOG_PAGESETUP_MARGIN "&Margenes:"
|
||||
#define DIALOG_PAGESETUP_LEFT "&Izquierda:"
|
||||
#define DIALOG_PAGESETUP_RIGHT "&Derecha:"
|
||||
#define DIALOG_PAGESETUP_TOP "A&rriba:"
|
||||
#define DIALOG_PAGESETUP_BOTTOM "Aba&jo:"
|
||||
|
||||
|
||||
/* Strings */
|
||||
|
||||
#define STRING_PAGESETUP_HEADERVALUE "&n" /* FIXME */
|
||||
#define STRING_PAGESETUP_FOOTERVALUE "P<>gina &s" /* FIXME */
|
||||
#define STRING_PAGESETUP_LEFTVALUE "20 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_RIGHTVALUE "20 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_TOPVALUE "25 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_BOTTOMVALUE "25 mm" /* FIXME */
|
||||
|
||||
#define STRING_NOTEPAD "Bloc de Notas"
|
||||
#define STRING_ERROR "ERROR"
|
||||
#define STRING_WARNING "CUIDADO"
|
||||
#define STRING_INFO "Informaci<63>n"
|
||||
|
||||
#define STRING_UNTITLED "(sin t<>tulo)"
|
||||
|
||||
#define STRING_ALL_FILES "Todos los archivos (*.*)"
|
||||
#define STRING_TEXT_FILES_TXT "Documentos de texto (*.txt)"
|
||||
|
||||
#define STRING_TOOLARGE "El archivo '%s' es demasiado grande para el bloc de notas.\n \
|
||||
Use otro editor."
|
||||
|
||||
#define STRING_NOTEXT "Ud. no escribi<62> nada. \
|
||||
\nPor favor escriba algo y pruebe de nuevo"
|
||||
|
||||
/* FIXME */
|
||||
|
||||
#define STRING_NOTSAVED "El texto en el archivo '%s' ha cambiado\n\n \
|
||||
<EFBFBD>Desea guardar los cambios?"
|
||||
|
||||
#define STRING_NOTFOUND "no se encontr<74> '%s'."
|
||||
|
||||
#define STRING_OUT_OF_MEMORY "No hay suficiente memoria para terminar \
|
||||
esta tarea. \nCierre una o m<>s aplicaciones para aumentar la cantidad \nde \
|
||||
memoria libre."
|
||||
|
||||
#include "notepad.rc"
|
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Notepad (Finnish resources)
|
||||
*
|
||||
* Copyright 1999 by Jukka Iivonen <iivonen@iki.fi>
|
||||
*/
|
||||
|
||||
#define LANGUAGE_ID Fi
|
||||
#define LANGUAGE_NUMBER b
|
||||
#define LANGUAGE_MENU_ITEM "&Finnish"
|
||||
|
||||
|
||||
/* Menu */
|
||||
|
||||
#define MENU_FILE "&Tiedosto"
|
||||
#define MENU_FILE_NEW "&Uusi..."
|
||||
#define MENU_FILE_OPEN "&Avaa"
|
||||
#define MENU_FILE_SAVE "Ta&lleta"
|
||||
#define MENU_FILE_SAVEAS "Talleta &nimell<6C>..."
|
||||
#define MENU_FILE_PRINT "T&ulosta"
|
||||
#define MENU_FILE_PAGESETUP "&Sivun asetukset..."
|
||||
#define MENU_FILE_PRINTSETUP "&Kirjoittimen asetukset..."
|
||||
#define MENU_FILE_EXIT "&Poistu"
|
||||
|
||||
#define MENU_EDIT "&Muokkaa"
|
||||
#define MENU_EDIT_UNDO "&Palauta\tCtrl+Z"
|
||||
#define MENU_EDIT_CUT "&Leikkaa\tCtrl+X"
|
||||
#define MENU_EDIT_COPY "&Kopioi\tCtrl+C"
|
||||
#define MENU_EDIT_PASTE "L&iit<69>\tCtrl+V"
|
||||
#define MENU_EDIT_DELETE "P&oista\tDel"
|
||||
#define MENU_EDIT_SELECTALL "&Valitse kaikki"
|
||||
#define MENU_EDIT_TIMEDATE "&Aika/P<>iv<69>m<EFBFBD><6D>r<EFBFBD>\tF5"
|
||||
#define MENU_EDIT_WRAP "Ka&tkaise pitk<74> rivi"
|
||||
|
||||
#define MENU_SEARCH "&Etsi"
|
||||
#define MENU_SEARCH_SEARCH "Etsi..."
|
||||
#define MENU_SEARCH_NEXT "Etsi &seuraava\tF3"
|
||||
|
||||
#define MENU_LANGUAGE "&Kieli"
|
||||
|
||||
#define MENU_HELP "&Apua"
|
||||
#define MENU_HELP_CONTENTS "&Sis<69>lt<6C>"
|
||||
#define MENU_HELP_SEARCH "&Etsi..."
|
||||
#define MENU_HELP_HELP_ON_HELP "Apua &Opastuksesta"
|
||||
|
||||
#define MENU_INFO "Inf&o..."
|
||||
#define MENU_INFO_LICENSE "&Lisenssi"
|
||||
#define MENU_INFO_NO_WARRANTY "&EI TAKUUTA"
|
||||
#define MENU_INFO_ABOUT_WINE "&Tietoja Wine:ista"
|
||||
|
||||
|
||||
/* Dialogs */
|
||||
|
||||
#define DIALOG_OK "OK"
|
||||
#define DIALOG_CANCEL "Peruuta"
|
||||
#define DIALOG_BROWSE "&Selaa..."
|
||||
#define DIALOG_HELP "&Apua"
|
||||
|
||||
#define DIALOG_PAGESETUP_CAPTION "Sivun asetukset"
|
||||
#define DIALOG_PAGESETUP_HEAD "&Yl<59>otsikko:"
|
||||
#define DIALOG_PAGESETUP_TAIL "Alao&tsikko:"
|
||||
#define DIALOG_PAGESETUP_MARGIN "&Marginaali:"
|
||||
#define DIALOG_PAGESETUP_LEFT "&Vasen:"
|
||||
#define DIALOG_PAGESETUP_RIGHT "&Oikea:"
|
||||
#define DIALOG_PAGESETUP_TOP "Y&l<>:"
|
||||
#define DIALOG_PAGESETUP_BOTTOM "&Ala:"
|
||||
|
||||
|
||||
/* Strings */
|
||||
|
||||
#define STRING_PAGESETUP_HEADERVALUE "&n" /* FIXME */
|
||||
#define STRING_PAGESETUP_FOOTERVALUE "Sivu &s" /* FIXME */
|
||||
#define STRING_PAGESETUP_LEFTVALUE "20 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_RIGHTVALUE "20 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_TOPVALUE "25 mm" /* FIXME */
|
||||
#define STRING_PAGESETUP_BOTTOMVALUE "25 mm" /* FIXME */
|
||||
|
||||
#define STRING_NOTEPAD "Notepad"
|
||||
#define STRING_ERROR "VIRHE"
|
||||
#define STRING_WARNING "VAROITUS"
|
||||
#define STRING_INFO "Tiedoitus"
|
||||
|
||||
#define STRING_UNTITLED "(otsikoimaton)"
|
||||
|
||||
#define STRING_ALL_FILES "Kaikki tiedostot (*.*)"
|
||||
#define STRING_TEXT_FILES_TXT "Teksti tiedostot (*.txt)"
|
||||
|
||||
#define STRING_TOOLARGE "Tiedosto '%s' on liian suuri.\n \
|
||||
Please use a different editor."
|
||||
|
||||
#define STRING_NOTEXT "Et sy<73>tt<74>nyt lainkaan teksti<74>. \
|
||||
\nKirjoita jotain ja yrit<69> uudelleen"
|
||||
|
||||
/* FIXME */
|
||||
|
||||
#define STRING_NOTSAVED "File '%s'\nhas been modified\n\n \
|
||||
Would you like to save your changes ?"
|
||||
|
||||
#define STRING_NOTFOUND "'%s' ei l<>ydy."
|
||||
|
||||
#define STRING_OUT_OF_MEMORY "Muistia ei ole riitt<74>v<EFBFBD>sti t<>m<EFBFBD>n \
|
||||
\nteht<68>v<EFBFBD>n tekemiseksi. Sulje jokin sovellus vapauttaaksesi\n \
|
||||
muistia."
|
||||
|
||||
#include "notepad.rc"
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user