Compare commits

..

7 Commits

Author SHA1 Message Date
The ReactOS Team
d4a3555442 This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=8047
2004-02-06 08:21:52 +00:00
The ReactOS Team
abc01da30c This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2401
2001-11-28 01:38:00 +00:00
The ReactOS Team
7aeca22fed This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2398
2001-11-27 14:24:15 +00:00
The ReactOS Team
36e1bb60e8 This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2320
2001-10-25 23:22:09 +00:00
The ReactOS Team
74e77bb16f This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2316
2001-10-23 21:15:45 +00:00
Casper Hornstrup
e3a75fb4da no message
svn path=/branches/avendor/; revision=1279
2000-08-01 18:43:38 +00:00
The ReactOS Team
ce122bcdea This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=1278
2000-08-01 18:43:38 +00:00
21018 changed files with 20029 additions and 8193753 deletions

2
msvc6/.cvsignore Normal file
View File

@@ -0,0 +1,2 @@
*.ncb
*.opt

102
msvc6/README.txt Normal file
View File

@@ -0,0 +1,102 @@
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.

41
msvc6/ReactOS.dsw Normal file
View File

@@ -0,0 +1,41 @@
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>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,64 @@
// 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;
}

View File

@@ -0,0 +1,19 @@
# $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

3
msvc6/hal/.cvsignore Normal file
View File

@@ -0,0 +1,3 @@
Debug
Release
hal.def

243
msvc6/hal/hal.dsp Normal file
View File

@@ -0,0 +1,243 @@
# 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

View File

@@ -0,0 +1,392 @@
/* $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);
}

View File

@@ -0,0 +1,22 @@
# $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)

View File

@@ -0,0 +1,4 @@
Debug
Release
nt_zw_msvc.c
ntoskrnl.def

View File

@@ -0,0 +1,167 @@
/*
* 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
}
}

View File

@@ -0,0 +1,114 @@
/*
* 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)
}

View File

@@ -0,0 +1,655 @@
/*
* 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
}

View File

@@ -0,0 +1,110 @@
/*
* 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
}
}

View File

@@ -0,0 +1,325 @@
/*
* 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
}
}

View File

@@ -0,0 +1,468 @@
/*
* 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 */

View File

@@ -0,0 +1,217 @@
/*
* 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
}
}

View File

@@ -0,0 +1,256 @@
/*
* 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
}

View File

@@ -0,0 +1,15 @@
; 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

View File

@@ -0,0 +1,126 @@
#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
}
}

View File

@@ -0,0 +1,574 @@
/* $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
}

3271
msvc6/ntoskrnl/ntoskrnl.dsp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,299 @@
/*
* 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
}

View File

@@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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
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) <year> <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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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) year 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 Lesser General
Public License instead of this License.

View File

@@ -1,23 +0,0 @@
Copyright 2008 ReactOS Portable Systems Group. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE REACTOS PORTABLE SYSTEMS GROUP ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REACTOS PORTABLE SYSTEMS GROUP
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and
should not be interpreted as representing official policies, either expressed or implied, of the ReactOS
Project.

View File

@@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, 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 library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete 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 distribute a copy of this License along with the
Library.
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 Library or any portion
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
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 Library, 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 Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you 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.
If distribution of 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 satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be 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.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library 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.
9. 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 Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
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 with
this License.
11. 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 Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library 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 Library.
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.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library 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.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
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 Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
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
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. 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 LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. 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
them 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 prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. 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.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey 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;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
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.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
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
state 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) <year> <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 3 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, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program 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, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU 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 Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -1,165 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser 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
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@@ -1,80 +0,0 @@
ReactOS is available thanks to the work of:
Aleksey Bragin <aleksey at reactos org>
Alex Ionescu <alex.ionescu@reactos.org>
Andrew Greenwood <lists@silverblade.co.uk>
Andrew Munger <waxdragon@gmail.com>
Arindam Das
Art Yerkes <ayerkes@speakeasy.net>
Ariadne
Brandon Turner <turnerb7@msu.edu>
Brian Palmer <brianp@sginet.com>
Cameron M. Gutman <cgutman@reactos.org>
Casper S. Hornstrup <chorns@users.sourceforge.net>
Christoph von Wittich <christoph_vw@reactos.org>
Daniel Reimer <reimer.daniel@freenet.de>
David Welch <welch@cwcom.net>
Dmitry Chapyshev <dmitry@reactos.org>
Emanuele Aliberti <ea@iol.it>
Eric Kohl
Eugene Ingerman <geneing@myrealbox.com>
Filip Navara <xnavara@volny.cz>
Frederik Leemans
Ge van Geldorp <ge@gse.nl>
Ged Murphy <gedmurphy@reactos.org>
Gregor Brunmar <gregor brunmar at home se>
Gregor Schneider <grschneider@gmail.com>
Guido de Jong
Gunnar Andre' Dalsnes <hardon@online.no>
Hans Kremer
Hartmut Birr <hartmut.birr@gmx.de>
Hernan Ochoa
Herve Poussineau <hpoussin@reactos.com>
Iwan Fatahi <i_fatahi@hotmail.com>
James Tabor <james.tabor@reactos.org> <jimtabor.rosdev@gmail.com> <jamestabor_rosdev@yahoo.com>
Jason Eager
Jason Filby <jasonfilby@yahoo.com>
Jason Weiler
Jean Michault
Jeffrey Morlan <mrnobo1024@yahoo.com>
Jim Noeth
Johannes Anderwald <johannes.anderwald@student.tugraz.at>
Jonathan Wilson <jonwil@tpgi.com.au>
Jurgen van Gael <jurgen.vangael@student.kuleuven.ac.be>
KJK::Hyperion <noog@libero.it>
Klemens R. Friedl <klemens_friedl@gmx.net>
Maarten Bosma <maarten.paul@bosma.de>
Magnus Olsen <magnus@greatlord.com>
Mark Tempel <mtempel@visi.com>
Mark Weaver <mark@npsl.co.uk>
Martin Fuchs <martin-fuchs@gmx.net>
Marty Dill <mdill@uvic.ca>
Matthias Kupfer <mkupfer@reactos.org>
Matt Pyne
Mike Nordell <"tamlin">
Nathan Woods <npwoods@mess.org>
Pablo Borobia <pborobia@gmail.com>
Paolo Pantaleo <paolopan@freemail.it>
Peter Ward <dralnix@gmail.com>
Pierre Schweitzer <pschweitzer@reactos.org>
Phillip Susi <phreak@iag.net>
Rex Jolliff <rex@lvcablemodem.com>
Richard Campbell <betam4x@gmail.com>
Robert Bergkvist <fragdance@hotmail.com>
Robert Dickenson <robd@reactos.org>
Royce Mitchell III <royce3@ev1.net>
Samuel Serapi<70>n <samdwise51@gmail.com>
Saveliy Tretiakov <saveliyt@mail.ru>
Stefan Ginsberg <stefan__100__@hotmail.com>
Steven Edwards <winehacker@gmail.com>
Thomas Weidenmueller <w3seek@users.sourceforge.net>
Timo Kreuzer <timo.kreuzer@reactos.org>
Victor Kirhenshtein <sauros@iname.com>
Vizzini <vizzini@plasmic.com>
Graphic Design from
Mindflyer <mf@mufunyo.net>
Tango Desktop Project <http://tango-project.org>
Everaldo <http://everaldo.com>

File diff suppressed because it is too large Load Diff

View File

@@ -1,80 +0,0 @@
1. Build environment
To build the system you need either mingw32 installed on Windows or a mingw32
cross compiler running on unix. You may obtain MinGW binaries that build
ReactOS from http://www.reactos.org/.
2. Building ReactOS
2.1 Building the binaries
To build ReactOS run 'make' (without the quotes) if you are building on Linux
or 'mingw32-make' if you are building on Windows (or ReactOS) from the top
directory. If you are using RosBE, follow on-screen instructions.
2.2 Building a bootable CD image
To build a bootable CD image run 'make bootcd' (without the quotes) if you are
building on Linux or 'mingw32-make bootcd' if you are building on Windows (or
ReactOS) from the top directory. This will create a CD image with a filename,
ReactOS.iso, in the top directory.
3. Installation
ReactOS can only be installed on a machine that has a FAT16 or FAT32 partition
as the active (bootable) partition. The partition on which ReactOS is to be
installed (which may or may not be the bootable partition) must also be
formatted as FAT16 or FAT32. ReactOS Setup can format the partitions if
needed.
ReactOS can be installed from the source distribution or from the bootable CD
distribution. The two ways to install ReactOS are explained below.
3.1 Installation from sources
If you don't have an existing ReactOS installation you want to upgrade, then
build a bootable CD as described above. Burn the CD image, boot from it, and
follow the instructions to install ReactOS.
If you have an existing ReactOS installation you want to upgrade, then to
install ReactOS after building it, type 'make install' or
'mingw32-make install'. This will create the directory 'reactos' in the top
directory. Copy the contents of this directory over the existing installation.
If you don't want to copy the files manually every time you run a
'make install' or 'mingw32-make install', then you can specify the directory
where the files are to be copied to during installation.
Set the ROS_INSTALL environment variable. If you are on Windows this could be
done by:
set ROS_INSTALL=c:\reactos
If you are on Linux this could be done by:
export ROS_INSTALL=/mnt/windows/reactos
Now run 'make install' or 'mingw32-make install' to install the files to the
new location.
3.2 Installation from bootable CD distribution
To install ReactOS from the bootable CD distribution, extract the archive
contents. Then burn the CD image, boot from it, and follow instructions.
5. Help
If you run into problems or have suggestions for making ReactOS better, please
visit the address below. Mailing lists are available for a variety of topics,
bugs should be submitted to bugzilla and general chat takes place in the forums,
or #reactos on freenode
http://www.reactos.org/
ReactOS Development Team

View File

@@ -1,633 +0,0 @@
# Well-known targets:
#
# all (default target)
# This target builds all of ReactOS.
#
# module
# These targets builds a single module. Replace module with the name of
# the module you want to build.
#
# bootcd
# This target builds an ISO (ReactOS.iso) from which ReactOS can be booted
# and installed.
#
# livecd
# This target builds an ISO (ReactOS-Live.iso) from which ReactOS can be
# booted, but not installed.
#
# install
# This target installs all of ReactOS to a location specified by the
# ROS_INSTALL environment variable.
#
# module_install
# These targets installs a single module to a location specified by the
# ROS_INSTALL environment variable. Replace module with the name of the
# module you want to install.
#
# clean
# This target cleans (deletes) all files that are generated when building
# ReactOS.
#
# module_clean
# These targets cleans (deletes) files that are generated when building a
# single module. Replace module with the name of the module you want to
# clean.
#
# depends
# This target does a complete dependency check of the ReactOS codebase.
# This can require several minutes to complete. If you only need to check
# dependencies for a single or few modules then you can use the
# module_depends targets instead. This target can also repair a damaged or
# missing makefile-${ROS_ARCH}.auto if needed.
#
# module_depends
# These targets do a dependency check of individual modules. Replace module
# with the name of the module for which you want to check dependencies.
# This is faster than the depends target which does a complete dependency
# check of the ReactOS codebase.
#
# bootcdregtest
# This target builds an ISO (ReactOS-RegTest.ISO) which is used for unattended
# regression testing.
#
#
# Accepted environment variables:
#
# ROS_ARCH
# This variable specifies the name of the architecture to build ReactOS for.
# The variable defaults to i386.
#
# ROS_PREFIX
# This variable specifies the prefix of the MinGW installation. On Windows
# a prefix is usually not needed, but on linux it is usually "mingw32". If
# not present and no executable named "gcc" can be found, then the prefix is
# assumed to be "mingw32". If your gcc is named i386-mingw32-gcc then set
# ROS_PREFIX to i386-mingw32. Don't include the dash (-) before gcc.
#
# ROS_INTERMEDIATE
# This variable controls where to put intermediate files. Intermediate
# files are generated files that are needed to generate the final
# output files. Examples of intermediate files include *.o, *.a, and
# *.coff. N.B. Don't put a path separator at the end. The variable
# defaults to .\obj-{ROS_ARCH}.
#
# ROS_OUTPUT
# This variable controls where to put output files. Output files are
# generated files that makes up the result of the build process.
# Examples of output files include *.exe, *.dll, and *.sys. N.B. Don't
# put a path separator at the end. The variable defaults to .\output-{ROS_ARCH}.
#
# ROS_CDOUTPUT
# This variable controls the name of the ReactOS directory on cdrom.
# The variable defaults to reactos.
# Warning: setting this value may lead to a not bootable/installable cdrom.
#
# ROS_TEMPORARY
# This variable controls where to put temporary files. Temporary files
# are (usually small) generated files that are needed to generate the
# intermediate or final output files. Examples of temporary files include
# *.rci (preprocessed .rc files for wrc), *.tmp, and *.exp. N.B. Don't put
# a path separator at the end. The variable defaults to {ROS_INTERMEDIATE}
# directory.
#
# ROS_INSTALL
# This variable controls where to install output files to when using
# 'make install'. N.B. Don't put a path separator at the end. The variable
# defaults to .\{ROS_CDOUTPUT}.
#
# ROS_BUILDMAP
# This variable controls if map files are to be generated for executable
# output files. Map files have the extension .map. The value can be either
# full (to build map files with assembly code), yes (to build map files
# without source code) or no (to not build any map files). The variable
# defaults to no.
#
# ROS_BUILDNOSTRIP
# This variable controls if non-symbol-stripped versions are to be built
# of executable output files. Non-symbol-stripped executable output files
# have .nostrip added to the filename just before the extension. The value
# can be either yes (to build non-symbol-stripped versions of executable
# output files) or no (to not build non-symbol-stripped versions of
# executable output files). The variable defaults to no.
#
# ROS_LEAN_AND_MEAN
# This variable controls if all binaries should be stripped out of useless
# data added by GCC/LD as well as of RSYM symbol data. Output binary size
# will go from 80 to 40MB, memory usage from 58 to 38MB and the install CD
# from 18 to 13MB. The variable defaults to no.
#
# ROS_GENERATE_RSYM
# This variable controls generation of RSYM symbol data. The value can be
# either yes (to generate symbol data) or no. The variable defaults to yes.
#
# ROS_RBUILDFLAGS
# Pass parameters to rbuild.
# -v Be verbose.
# -c Clean as you go. Delete generated files as soon as they are not needed anymore.
# -dd Disable automatic dependencies.
# -da Enable automatic dependencies.
# -df Enable full dependencies.
# -dm{module} Check only automatic dependencies for this module.
# -hd Disable precompiled headers.
# -mi Let make handle creation of install directories. Rbuild will not generate the directories.
# -ps Generate proxy makefiles in source tree instead of the output tree.
# -ud Disable compilation units.
# -r Input XML
#
# ROS_AUTOMAKE
# Alternate name of makefile-${ROS_ARCH}.auto
#
# ROS_BUILDENGINE
# The Build engine to be used. The variable defaults to rbuild (RBUILD_TARGET)
#
# check for versions of make that don't have features we need...
# the function "eval" is only available in 3.80+, which happens to be the minimum
# version that has the features we use...
# THIS CHECK IS BORROWED FROM THE "GMSL" PROJECT, AND IS COVERED BY THE GPL LICENSE
# YOU CAN FIND OUT MORE ABOUT GMSL - A VERY COOL PROJECT - AT:
# http://gmsl.sourceforge.net/
__gmsl_have_eval :=
__gmsl_ignore := $(eval __gmsl_have_eval := T)
ifndef __gmsl_have_eval
$(error ReactOS's makefiles use GNU Make 3.80+ features, you have $(MAKE_VERSION), you MUST UPGRADE in order to build ReactOS - Sorry)
endif
# END of code borrowed from GMSL ( http://gmsl.sourceforge.net/ )
define NL
endef
.PHONY: all
.PHONY: clean
.PHONY: world
.PHONY: universe
ifneq ($(ROS_ARCH),)
ARCH := $(ROS_ARCH)
else
ARCH := i386
endif
ifeq ($(ROS_AUTOMAKE),)
ROS_AUTOMAKE=makefile-$(ARCH).auto
endif
all: $(ROS_AUTOMAKE)
.SUFFIXES:
ifeq ($(HOST),)
ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
export OSTYPE = msys
HOST=mingw32-linux
HOST_CFLAGS+=-fshort-wchar
HOST_CPPFLAGS+=-fshort-wchar
else
HOST=mingw32-windows
endif
else
HOST=mingw32-linux
HOST_CFLAGS+=-fshort-wchar
HOST_CPPFLAGS+=-fshort-wchar
endif
endif
# Default to half-verbose mode
ifeq ($(VERBOSE),no)
Q = @
HALFVERBOSEECHO = no
BUILDNO_QUIET = -q
else
ifeq ($(VERBOSE),full)
Q =
HALFVERBOSEECHO = no
BUILDNO_QUIET =
else
Q = @
HALFVERBOSEECHO = yes
BUILDNO_QUIET = -q
endif
endif
ifeq ($(HOST),mingw32-linux)
QUOTE = "
else
QUOTE =
endif
ifeq ($(HALFVERBOSEECHO),yes)
ECHO_CP =@echo $(QUOTE)[COPY] $@$(QUOTE)
ECHO_MKDIR =@echo $(QUOTE)[MKDIR] $@$(QUOTE)
ECHO_BUILDNO =@echo $(QUOTE)[BUILDNO] $@$(QUOTE)
ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE)
ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE)
ECHO_CPP =@echo $(QUOTE)[CPP] $@$(QUOTE)
ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE)
ECHO_HOSTCC =@echo $(QUOTE)[HOST-CC] $<$(QUOTE)
ECHO_CL =@echo $(QUOTE)[CL] $<$(QUOTE)
ECHO_AS =@echo $(QUOTE)[AS] $<$(QUOTE)
ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE)
ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE)
ECHO_HOSTAR =@echo $(QUOTE)[HOST-AR] $@$(QUOTE)
ECHO_WINEBLD =@echo $(QUOTE)[WINEBLD] $@$(QUOTE)
ECHO_WRC =@echo $(QUOTE)[WRC] $@$(QUOTE)
ECHO_RC =@echo $(QUOTE)[RC] $@$(QUOTE)
ECHO_CVTRES =@echo $(QUOTE)[CVTRES] $@$(QUOTE)
ECHO_WIDL =@echo $(QUOTE)[WIDL] $@$(QUOTE)
ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE)
ECHO_IMPLIB =@echo $(QUOTE)[IMPLIB] $@$(QUOTE)
ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE)
ECHO_HOSTLD =@echo $(QUOTE)[HOST-LD] $@$(QUOTE)
ECHO_LINK =@echo $(QUOTE)[LINK] $@$(QUOTE)
ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE)
ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
ECHO_PEFIXUP =@echo $(QUOTE)[PEFIXUP] $@$(QUOTE)
ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)
ECHO_CDMAKE =@echo $(QUOTE)[CDMAKE] $@$(QUOTE)
ECHO_MKHIVE =@echo $(QUOTE)[MKHIVE] $@$(QUOTE)
ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
ECHO_STRIP =@echo $(QUOTE)[STRIP] $@$(QUOTE)
ECHO_RGENSTAT=@echo $(QUOTE)[RGENSTAT] $@$(QUOTE)
ECHO_DEPENDS =@echo $(QUOTE)[DEPENDS] $<$(QUOTE)
ECHO_RSP =@echo $(QUOTE)[RSP] $@$(QUOTE)
else
ECHO_CP =
ECHO_MKDIR =
ECHO_BUILDNO =
ECHO_INVOKE =
ECHO_PCH =
ECHO_CPP =
ECHO_CC =
ECHO_HOSTCC =
ECHO_AS =
ECHO_NASM =
ECHO_AR =
ECHO_HOSTAR =
ECHO_WINEBLD =
ECHO_WRC =
ECHO_RC =
ECHO_CVTRES =
ECHO_WIDL =
ECHO_BIN2RES =
ECHO_IMPLIB =
ECHO_LD =
ECHO_HOSTLD =
ECHO_NM =
ECHO_OBJDUMP =
ECHO_RBUILD =
ECHO_RSYM =
ECHO_WMC =
ECHO_NCI =
ECHO_CABMAN =
ECHO_CDMAKE =
ECHO_MKHIVE =
ECHO_REGTESTS=
ECHO_TEST =
ECHO_GENDIB =
ECHO_STRIP =
ECHO_RGENSTAT=
ECHO_DEPENDS =
ECHO_RSP =
endif
# Set host compiler/linker
ifeq ($(HOST_CC),)
HOST_CC = gcc
endif
ifeq ($(HOST_CPP),)
HOST_CPP = g++
endif
host_gcc = $(Q)$(HOST_CC)
host_gpp = $(Q)$(HOST_CPP)
host_ld = $(Q)ld
host_ar = $(Q)ar
host_objcopy = $(Q)objcopy
# Set target compiler/linker
ifneq ($(ROS_PREFIX),)
PREFIX_ := $(ROS_PREFIX)-
else
ifeq ($(HOST),mingw32-linux)
PREFIX_ := mingw32-
else
PREFIX_ :=
endif
endif
ifeq ($(TARGET_CC),)
TARGET_CC = $(PREFIX_)gcc
endif
ifeq ($(TARGET_CPP),)
TARGET_CPP = $(PREFIX_)g++
endif
gcc = $(Q)$(TARGET_CC)
gpp = $(Q)$(TARGET_CPP)
gas = $(Q)$(TARGET_CC) -x assembler-with-cpp
ld = $(Q)$(PREFIX_)ld
nm = $(Q)$(PREFIX_)nm
objdump = $(Q)$(PREFIX_)objdump
ar = $(Q)$(PREFIX_)ar
objcopy = $(Q)$(PREFIX_)objcopy
dlltool = $(Q)$(PREFIX_)dlltool
strip = $(Q)$(PREFIX_)strip
windres = $(Q)$(PREFIX_)windres
# Set utilities
ifeq ($(OSTYPE),msys)
HOST=mingw32-linux
endif
ifeq ($(HOST),mingw32-linux)
ifeq ($(OSTYPE),msys)
export EXEPOSTFIX = .exe
else
export EXEPOSTFIX =
endif
export SEP = /
mkdir = -$(Q)mkdir -p
checkpoint = $(Q)touch
rm = $(Q)rm -f
cp = $(Q)cp
NUL = /dev/null
else # mingw32-windows
export EXEPOSTFIX = .exe
ROS_EMPTY =
export SEP = \$(ROS_EMPTY)
mkdir = -$(Q)mkdir
checkpoint = $(Q)copy /y NUL
rm = $(Q)del /f /q
cp = $(Q)copy /y
NUL = NUL
endif
ifneq ($(ROS_INTERMEDIATE),)
INTERMEDIATE := $(ROS_INTERMEDIATE)
else
INTERMEDIATE := obj-$(ARCH)
endif
INTERMEDIATE_ := $(INTERMEDIATE)$(SEP)
ifneq ($(ROS_OUTPUT),)
OUTPUT := $(ROS_OUTPUT)
else
OUTPUT := output-$(ARCH)
endif
OUTPUT_ := $(OUTPUT)$(SEP)
ifneq ($(ROS_CDOUTPUT),)
CDOUTPUT := $(ROS_CDOUTPUT)
else
CDOUTPUT := reactos
endif
CDOUTPUT_ := $(CDOUTPUT)$(SEP)
ifneq ($(ROS_TEMPORARY),)
TEMPORARY := $(ROS_TEMPORARY)
else
TEMPORARY := $(INTERMEDIATE)
endif
TEMPORARY_ := $(TEMPORARY)$(SEP)
ifneq ($(ROS_INSTALL),)
INSTALL := $(ROS_INSTALL)
else
INSTALL := $(CDOUTPUT)
endif
INSTALL_ := $(INSTALL)$(SEP)
RBUILD_FLAGS := -rReactOS-$(ARCH).rbuild -DARCH=$(ARCH)
$(INTERMEDIATE):
$(ECHO_MKDIR)
${mkdir} $@
ifneq ($(INTERMEDIATE),$(OUTPUT))
$(OUTPUT):
$(ECHO_MKDIR)
${mkdir} $@
endif
ifneq ($(TEMPORARY),$(INTERMEDIATE))
ifneq ($(TEMPORARY),$(OUTPUT))
$(TEMPORARY):
$(ECHO_MKDIR)
${mkdir} $@
endif
endif
BUILDNO_H = $(INTERMEDIATE_)include$(SEP)reactos$(SEP)buildno.h
include lib/lib.mak
include tools/tools.mak
-include $(ROS_AUTOMAKE)
PREAUTO := \
$(BIN2C_TARGET) \
$(BIN2RES_TARGET) \
$(BUILDNO_H) \
$(GENDIB_DIB_FILES) \
$(NCI_SERVICE_FILES)
ifeq ($(ARCH),powerpc)
PREAUTO += $(OFW_INTERFACE_SERVICE_FILES) $(PPCMMU_TARGETS)
endif
ifeq ($(ROS_BUILDENGINE),)
ROS_BUILDENGINE=$(RBUILD_TARGET)
endif
$(ROS_AUTOMAKE): $(ROS_BUILDENGINE) $(XMLBUILDFILES) | $(PREAUTO)
${mkdir} $(OUTPUT_)media$(SEP)inf 2>$(NUL)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) mingw
world: all bootcd livecd
universe:
$(MAKE) KDBG=1 DBG=1 \
ROS_AUTOMAKE=makefile-$(ARCH)-kd.auto \
ROS_INSTALL=reactos-$(ARCH)-kd \
ROS_INTERMEDIATE=obj-$(ARCH)-kd \
ROS_OUTPUT=output-$(ARCH)-kd \
world
$(MAKE) KDBG=0 DBG=1 \
ROS_AUTOMAKE=makefile-$(ARCH)-d.auto \
ROS_INSTALL=reactos-$(ARCH)-d \
ROS_INTERMEDIATE=obj-$(ARCH)-d \
ROS_OUTPUT=output-$(ARCH)-d \
world
$(MAKE) KDBG=0 DBG=0 \
ROS_AUTOMAKE=makefile-$(ARCH)-r.auto \
ROS_INSTALL=reactos-$(ARCH)-r \
ROS_INTERMEDIATE=obj-$(ARCH)-r \
ROS_OUTPUT=output-$(ARCH)-r \
world
.PHONY: rgenstat
rgenstat: $(RGENSTAT_TARGET)
$(ECHO_RGENSTAT)
$(Q)$(RGENSTAT_TARGET) apistatus.lst apistatus.xml
.PHONY: msbuild
msbuild: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) msbuild
.PHONY: msbuild_clean
msbuild_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c msbuild
.PHONY: depmap
depmap: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) depmap
.PHONY: vreport
vreport:$(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) vreport
.PHONY: msvc
msvc: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) msvc
.PHONY: msvc6
msvc6: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs6.00 -voversionconfiguration msvc
.PHONY: msvc7
msvc7: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -voversionconfiguration msvc
.PHONY: msvc71
msvc71: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -voversionconfiguration msvc
.PHONY: msvc8
msvc8: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -voversionconfiguration msvc
.PHONY: msvc9
msvc9: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs9.00 -voversionconfiguration msvc
.PHONY: msvc10
msvc10: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs10.00 -voversionconfiguration msvc
.PHONY: msvc6_clean
msvc6_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs6.00 -voversionconfiguration msvc
.PHONY: msvc7_clean
msvc7_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.00 -voversionconfiguration msvc
.PHONY: msvc71_clean
msvc71_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.10 -voversionconfiguration msvc
.PHONY: msvc8_clean
msvc8_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs8.00 -voversionconfiguration msvc
.PHONY: msvc9_clean
msvc9_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs9.00 -voversionconfiguration msvc
.PHONY: msvc10_clean
msvc10_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs10.00 -voversionconfiguration msvc
.PHONY: msvc_clean
msvc_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c msvc
.PHONY: msvc_clean_all
msvc_clean_all: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs6.00 -voversionconfiguration msvc
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.00 -voversionconfiguration msvc
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.10 -voversionconfiguration msvc
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs8.10 -voversionconfiguration msvc
.PHONY: msvc7_install_debug
msvc7_install_debug: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcdebug -voversionconfiguration msvc
.PHONY: msvc7_install_release
msvc7_install_release: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcrelease -voversionconfiguration msvc
.PHONY: msvc7_install_speed
msvc7_install_speed: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcspeed -voversionconfiguration msvc
.PHONY: msvc71_install_debug
msvc71_install_debug: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcdebug -voversionconfiguration msvc
.PHONY: msvc71_install_release
msvc71_install_release: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcrelease -voversionconfiguration msvc
.PHONY: msvc71_install_speed
msvc71_install_speed: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcspeed -voversionconfiguration msvc
.PHONY: msvc8_install_debug
msvc8_install_debug: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcdebug -voversionconfiguration msvc
.PHONY: msvc8_install_release
msvc8_install_release: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcrelease -voversionconfiguration msvc
.PHONY: msvc8_install_speed
msvc8_install_speed: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcspeed -voversionconfiguration msvc
.PHONY: makefile_auto_clean
makefile_auto_clean:
-@$(rm) $(ROS_AUTOMAKE) $(PREAUTO) 2>$(NUL)
.PHONY: clean
clean: makefile_auto_clean
.PHONY: depends
depends: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) mingw

View File

@@ -1,29 +0,0 @@
========================
ReactOS Version 0.3.x
Updated Dec 16, 2006
========================
1. What is ReactOS?
ReactOS is an Open Source effort to develop a quality operating system
that is compatible with Windows NT applications and drivers.
The ReactOS project, although currently focused on Windows XP/2003
drivers compatibility, is always keeping an eye toward compatibility with
older version of Windows NT family ( NT 4.0, 2000 (NT 5.0)) and new
Windows NT releases (Vista, etc). Applications (Win32 API) compatibility
focus is Windows XP.
More information is available at http://www.reactos.org/.
2. Building ReactOS
See the INSTALL file for more details.
3. More information
See the media\doc subdirectory for some sparse notes.
4. Who is responsible
See the CREDITS file.

View File

@@ -1,113 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<project name="ReactOS" makefile="makefile-amd64.auto" xmlns:xi="http://www.w3.org/2001/XInclude" allowwarnings="true">
<xi:include href="config-amd64.rbuild">
<xi:fallback>
<xi:include href="config-amd64.template.rbuild" />
</xi:fallback>
</xi:include>
<xi:include href="ReactOS-generic.rbuild" />
<define name="_M_AMD64" />
<define name="_AMD64_" />
<define name="_M_AXP64" />
<define name="__x86_64__" />
<!-- define name="_X86AMD64_" / FIXME: what is this used for? -->
<define name="_WIN64" />
<define name="TARGET_amd64" host="true" />
<define name="USE_COMPILER_EXCEPTIONS" />
<define name ="NO_UNDERSCORE_PREFIX" />
<property name="PLATFORM" value="PC"/>
<property name="usewrc" value="false"/>
<property name="WINEBUILD_FLAGS" value="--kill-at"/>
<group compilerset="gcc">
<if property="OPTIMIZE" value="1">
<compilerflag>-ftracer</compilerflag>
<compilerflag>-momit-leaf-frame-pointer</compilerflag>
</if>
<compilerflag>-fms-extensions</compilerflag>
<compilerflag>-mpreferred-stack-boundary=4</compilerflag>
<compilerflag compiler="midl">-m64 --win64</compilerflag>
<!-- compilerflag compiler="cc,cxx">-gstabs+</compilerflag -->
<!-- compilerflag compiler="as">-gstabs+</compilerflag -->
<compilerflag>-U_X86_</compilerflag>
<compilerflag>-UWIN32</compilerflag>
<compilerflag>-Wno-format</compilerflag>
</group>
<group linkerset="ld">
<linkerflag>-disable-stdcall-fixup</linkerflag>
<linkerflag>-file-alignment=0x1000</linkerflag>
<linkerflag>-section-alignment=0x1000</linkerflag>
<linkerflag>--unique=.eh_frame</linkerflag>
<linkerflag>-static</linkerflag>
<linkerflag>--exclude-all-symbols</linkerflag>
</group>
<if property="USERMODE" value="1">
<directory name="base">
<directory name="applications">
<xi:include href="base/applications/applications.rbuild" />
</directory>
<directory name="services">
<xi:include href="base/services/services.rbuild" />
</directory>
<directory name="setup">
<xi:include href="base/setup/setup.rbuild" />
</directory>
<directory name="shell">
<directory name="cmd">
<xi:include href="base/shell/cmd/cmd.rbuild" />
</directory>
<directory name="explorer-new">
<xi:include href="base/shell/explorer-new/explorer.rbuild" />
</directory>
</directory>
<directory name="system">
<xi:include href="base/system/system.rbuild" />
</directory>
</directory>
<directory name="dll">
<xi:include href="dll/dll.rbuild" />
</directory>
</if>
<directory name="boot">
<xi:include href="boot/boot.rbuild" />
</directory>
<directory name="drivers">
<xi:include href="drivers/drivers.rbuild" />
</directory>
<directory name="hal">
<xi:include href="hal/hal.rbuild" />
</directory>
<directory name="include">
<xi:include href="include/directory.rbuild" />
</directory>
<directory name="lib">
<xi:include href="lib/lib.rbuild" />
</directory>
<directory name="media">
<xi:include href="media/media.rbuild" />
</directory>
<directory name="modules">
<xi:include href="modules/directory.rbuild" />
</directory>
<directory name="ntoskrnl">
<xi:include href="ntoskrnl/ntoskrnl.rbuild" />
<if property="BUILD_MP" value="1">
<xi:include href="ntoskrnl/ntkrnlmp.rbuild" />
</if>
</directory>
<directory name="subsystems">
<xi:include href="subsystems/subsystems.rbuild" />
</directory>
<directory name="tools">
<xi:include href="tools/tools.rbuild" />
</directory>
</project>

View File

@@ -1,160 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<project name="ReactOS" makefile="makefile-arm.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config-arm.rbuild">
<xi:fallback>
<xi:include href="config-arm.template.rbuild" />
</xi:fallback>
</xi:include>
<xi:include href="ReactOS-generic.rbuild" />
<!-- <define name="_M_ARM" /> Already defined by toolchain -->
<define name="_ARM_" />
<define name="__arm__" />
<define name="TARGET_arm" host="true" />
<define name="USE_COMPILER_EXCEPTIONS" />
<property name="WINEBUILD_FLAGS" value="--kill-at"/>
<include>include/reactos/arm</include>
<if property="SARCH" value="versatile">
<define name="BOARD_CONFIG_VERSATILE"/>
</if>
<group compilerset="gcc">
<if property="OPTIMIZE" value="1">
<compilerflag>-ftracer</compilerflag>
</if>
<compilerflag>-fms-extensions</compilerflag>
<compilerflag>-Wno-attributes</compilerflag>
<compilerflag>-U_UNICODE</compilerflag>
<compilerflag>-UUNICODE</compilerflag>
</group>
<define name="__MSVCRT__"/> <!-- DUBIOUS -->
<group linkerset="ld">
<linkerflag>--strip-debug</linkerflag> <!-- INVESTIGATE -->
<linkerflag>-static</linkerflag> <!-- INVESTIGATE -->
<linkerflag>-file-alignment=0x1000</linkerflag>
<linkerflag>-section-alignment=0x1000</linkerflag>
</group>
<directory name="media">
<directory name="nls">
<xi:include href="media/nls/nls.rbuild" />
</directory>
</directory>
<directory name="lib">
<directory name="drivers">
<directory name="csq">
<xi:include href="lib/drivers/csq/csq.rbuild" />
</directory>
</directory>
<directory name="cportlib">
<xi:include href="lib/cportlib/cportlib.rbuild" />
</directory>
<directory name="debugsup">
<xi:include href="lib/debugsup/debugsup.rbuild" />
</directory>
<directory name="3rdparty">
<directory name="zlib">
<xi:include href="lib/3rdparty/zlib/zlib.rbuild" />
</directory>
</directory>
<directory name="rtl">
<xi:include href="lib/rtl/rtl.rbuild" />
</directory>
<directory name="host">
<directory name="wcsfuncs">
<xi:include href="lib/host/wcsfuncs/wcsfuncs.rbuild" />
</directory>
</directory>
<directory name="inflib">
<xi:include href="lib/inflib/inflib.rbuild" />
</directory>
<directory name="newinflib">
<xi:include href="lib/newinflib/inflib.rbuild" />
</directory>
<directory name="cmlib">
<xi:include href="lib/cmlib/cmlib.rbuild" />
</directory>
<directory name="pseh">
<xi:include href="lib/pseh/pseh.rbuild" />
</directory>
<directory name="rossym">
<xi:include href="lib/rossym/rossym.rbuild" />
</directory>
<directory name="sdk">
<directory name="crt">
<xi:include href="lib/sdk/crt/crt.rbuild" />
<xi:include href="lib/sdk/crt/libcntpr.rbuild" />
</directory>
<directory name="ioevent">
<xi:include href="lib/sdk/ioevent/ioevent.rbuild" />
</directory>
<directory name="nt">
<xi:include href="lib/sdk/nt/nt.rbuild" />
</directory>
<directory name="wdmguid">
<xi:include href="lib/sdk/wdmguid/wdmguid.rbuild" />
</directory>
</directory>
<directory name="smlib">
<xi:include href="lib/smlib/smlib.rbuild" />
</directory>
</directory>
<directory name="include">
<xi:include href="include/directory.rbuild" />
</directory>
<directory name="tools">
<xi:include href="tools/tools.rbuild" />
</directory>
<directory name="ntoskrnl">
<xi:include href="ntoskrnl/ntoskrnl.rbuild" />
</directory>
<directory name="hal">
<xi:include href="hal/hal.rbuild" />
</directory>
<directory name="boot">
<xi:include href="boot/boot.rbuild" />
</directory>
<directory name="drivers">
<directory name="storage">
<directory name="class">
<directory name="ramdisk">
<xi:include href="drivers/storage/class/ramdisk/ramdisk.rbuild" />
</directory>
</directory>
</directory>
<directory name="filesystems">
<directory name="fastfat">
<xi:include href="drivers/filesystems/fastfat/vfatfs.rbuild" />
</directory>
</directory>
<directory name="base">
<directory name="kdcom">
<xi:include href="drivers/base/kdcom/kdcom.rbuild" />
</directory>
<directory name="bootvid">
<xi:include href="drivers/base/bootvid/bootvid.rbuild" />
</directory>
</directory>
</directory>
<directory name="dll">
<directory name="ntdll">
<xi:include href="dll/ntdll/ntdll.rbuild" />
</directory>
</directory>
<directory name="base">
<directory name="system">
<directory name="smss">
<xi:include href="base/system/smss/smss.rbuild" />
</directory>
</directory>
</directory>
</project>

View File

@@ -1,153 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "tools/rbuild/project.dtd">
<group xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="baseaddress.rbuild" />
<define name="__REACTOS__" />
<define name="__REACTOS__" host="true" />
<if property="DBG" value="1">
<define name="DBG">1</define>
<define name="_SEH_ENABLE_TRACE" />
<property name="DBG_OR_KDBG" value="true" />
</if>
<if property="DBG" value="0">
<define name="DBG">0</define>
</if>
<if property="KDBG" value="1">
<define name="KDBG">1</define>
<property name="DBG_OR_KDBG" value="true" />
</if>
<!-- The version target valid values are: Nt4 , NT5 , NT51 -->
<property name="VERSION_TARGET" value="NT52" />
<if property="VERSION_TARGET" value="NT4">
<define name="WINVER">0x400</define>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x400</define>
<define name="_WIN32_WINDOWS">0x400</define>
<define name="_SETUPAPI_VER">0x400</define>
</if>
<if property="VERSION_TARGET" value="NT5">
<define name="WINVER">0x500</define>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x500</define>
<define name="_WIN32_WINDOWS">0x500</define>
<define name="_SETUPAPI_VER">0x500</define>
</if>
<if property="VERSION_TARGET" value="NT51">
<define name="WINVER">0x501</define>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="_WIN32_WINDOWS">0x501</define>
<define name="_SETUPAPI_VER">0x501</define>
</if>
<if property="VERSION_TARGET" value="NT52">
<define name="WINVER">0x502</define>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x502</define>
<define name="_WIN32_WINDOWS">0x502</define>
<define name="_SETUPAPI_VER">0x502</define>
</if>
<if property="VERSION_TARGET" value="NT6">
<define name="WINVER">0x600</define>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<define name="_WIN32_WINDOWS">0x600</define>
<define name="_SETUPAPI_VER">0x600</define>
</if>
<include>.</include>
<include>include</include>
<include root="intermediate">include</include>
<include>include/psdk</include>
<include root="intermediate">include/psdk</include>
<include>include/dxsdk</include>
<include root="intermediate">include/dxsdk</include>
<include>include/crt</include>
<include compilerset="gcc">include/crt/mingw32</include>
<include compilerset="msc">include/crt/msc</include>
<include>include/ddk</include>
<include>include/GL</include>
<include>include/ndk</include>
<include>include/reactos</include>
<include root="intermediate">include/reactos</include>
<include root="intermediate">include/reactos/mc</include>
<include>include/reactos/libs</include>
<include host="true">include</include>
<include host="true" root="intermediate">include</include>
<include host="true">include/reactos</include>
<include host="true">include/reactos/wine</include>
<group compilerset="gcc">
<compilerflag>-Wall</compilerflag>
<compilerflag>-Wno-char-subscripts</compilerflag>
<compilerflag compiler="cxx">-Wno-non-virtual-dtor</compilerflag>
</group>
<group compilerset="msc">
<define name="inline" compiler="cc">__inline</define>
<define name="__STDC__" compiler="cc">1</define>
<compilerflag>/Zl</compilerflag>
<compilerflag>/Zi</compilerflag>
<compilerflag>/W1</compilerflag>
</group>
<group compilerset="gcc">
<if property="OPTIMIZE" value="1">
<compilerflag>-Os</compilerflag>
</if>
<if property="OPTIMIZE" value="2">
<compilerflag>-Os</compilerflag>
</if>
<if property="OPTIMIZE" value="3">
<compilerflag>-O1</compilerflag>
</if>
<if property="OPTIMIZE" value="4">
<compilerflag>-O2</compilerflag>
</if>
<if property="OPTIMIZE" value="5">
<compilerflag>-O3</compilerflag>
</if>
<compilerflag>-fno-strict-aliasing</compilerflag>
<compilerflag>-Wpointer-arith</compilerflag>
<compilerflag>-Wno-multichar</compilerflag>
<compilerflag>-Wno-error=uninitialized</compilerflag>
<!-- compilerflag>-H</compilerflag> enable this for header traces -->
</group>
<group compilerset="msc">
<if property="OPTIMIZE" value="1">
<compilerflag>/O1</compilerflag>
</if>
<if property="OPTIMIZE" value="2">
<compilerflag>/O2</compilerflag>
</if>
<if property="OPTIMIZE" value="3">
<compilerflag>/Ox /GS-</compilerflag>
<compilerflag>/Ot</compilerflag>
</if>
<if property="OPTIMIZE" value="4">
<compilerflag>/Ox /GS-</compilerflag>
<compilerflag>/Os</compilerflag>
</if>
<if property="OPTIMIZE" value="5">
<compilerflag>/Ox /GS-</compilerflag>
<compilerflag>/Os</compilerflag>
<compilerflag>/Ob2</compilerflag>
<compilerflag>/GF</compilerflag>
<compilerflag>/Gy</compilerflag>
</if>
<compilerflag>/GS-</compilerflag>
</group>
</group>

View File

@@ -1,81 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<project name="ReactOS" makefile="makefile-i386.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config.rbuild">
<xi:fallback>
<xi:include href="config.template.rbuild" />
</xi:fallback>
</xi:include>
<xi:include href="ReactOS-generic.rbuild" />
<define name="_M_IX86" />
<define name="_X86_" />
<define name="__i386__" />
<define name="TARGET_i386" host="true" />
<define name="USE_COMPILER_EXCEPTIONS" />
<define name="_USE_32BIT_TIME_T" />
<property name="PLATFORM" value="PC"/>
<group compilerset="gcc">
<if property="OPTIMIZE" value="1">
<compilerflag>-ftracer</compilerflag>
<compilerflag>-momit-leaf-frame-pointer</compilerflag>
</if>
<compilerflag>-fms-extensions</compilerflag>
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
<compilerflag compiler="midl">-m32 --win32</compilerflag>
<compilerflag compiler="cc,cxx">-gstabs+</compilerflag>
<compilerflag compiler="cc,cxx">-fno-set-stack-executable</compilerflag>
<compilerflag compiler="cc,cxx">-fno-optimize-sibling-calls</compilerflag>
<compilerflag compiler="as">-gstabs+</compilerflag>
</group>
<group linkerset="ld">
<linkerflag>-disable-stdcall-fixup</linkerflag>
<linkerflag>-file-alignment=0x1000</linkerflag>
<linkerflag>-section-alignment=0x1000</linkerflag>
</group>
<directory name="base">
<xi:include href="base/base.rbuild" />
</directory>
<directory name="boot">
<xi:include href="boot/boot.rbuild" />
</directory>
<directory name="dll">
<xi:include href="dll/dll.rbuild" />
</directory>
<directory name="drivers">
<xi:include href="drivers/drivers.rbuild" />
</directory>
<directory name="hal">
<xi:include href="hal/hal.rbuild" />
</directory>
<directory name="include">
<xi:include href="include/directory.rbuild" />
</directory>
<directory name="lib">
<xi:include href="lib/lib.rbuild" />
</directory>
<directory name="media">
<xi:include href="media/media.rbuild" />
</directory>
<directory name="modules">
<xi:include href="modules/directory.rbuild" />
</directory>
<directory name="ntoskrnl">
<xi:include href="ntoskrnl/ntoskrnl.rbuild" />
<if property="BUILD_MP" value="1">
<xi:include href="ntoskrnl/ntkrnlmp.rbuild" />
</if>
</directory>
<directory name="subsystems">
<xi:include href="subsystems/subsystems.rbuild" />
</directory>
<directory name="tools">
<xi:include href="tools/tools.rbuild" />
</directory>
</project>

View File

@@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<project name="ReactOS" makefile="makefile-ppc.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config-ppc.rbuild">
<xi:fallback>
<xi:include href="config-ppc.template.rbuild" />
</xi:fallback>
</xi:include>
<xi:include href="ReactOS-generic.rbuild" />
<property name="MKHIVE_OPTIONS" value="-be" />
<property name="OFWLDR_LINKFORMAT" value="-L$(INTERMEDIATE)/lib/ppcmmu -lppcmmu_code -nostdlib -nostartfiles -lgcc -Wl,-e,__start -Wl,-Ttext,0xe00000 -N"/>
<property name="NTOSKRNL_SHARED" value="-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared"/>
<define name="__MSVCRT__"/>
<compilerflag>-fshort-wchar</compilerflag>
<compilerflag>-fsigned-char</compilerflag>
<compilerflag>-mfull-toc</compilerflag>
<compilerflag>-meabi</compilerflag>
<compilerflag>-O2</compilerflag>
<compilerflag>-Wno-strict-aliasing</compilerflag>
<compilerflag compiler="cc,cxx">-gstabs+</compilerflag>
<compilerflag compiler="as">-gstabs+</compilerflag>
</project>

View File

@@ -1,30 +0,0 @@
; Format:
; COMPONENT_NAME PATH_TO_COMPONENT_SOURCES
; COMPONENT_NAME - Name of the module. Eg. kernel32.
; PATH_TO_COMPONENT_SOURCES - Relative path to sources (relative to where rgenstat is run from).
advapi32 ../reactos/dll/win32/advapi32
crtdll ../reactos/dll/win32/crtdll
gdi32 ../reactos/dll/win32/gdi32
gdiplus ../reactos/dll/win32/gdiplus
iphlpapi ../reactos/dll/win32/iphlpapi
kernel32 ../reactos/dll/win32/kernel32
msvcrt ../reactos/dll/win32/msvcrt
rasapi32 ../reactos/dll/win32/rasapi32
rasdlg ../reactos/dll/win32/rasdlg
rasman ../reactos/dll/win32/rasman
rpcrt4 ../reactos/dll/win32/rpcrt4
secur32 ../reactos/dll/win32/secur32
snmpapi ../reactos/dll/win32/snmpapi
user32 ../reactos/dll/win32/user32
version ../reactos/dll/win32/version
winspool ../reactos/dll/win32/winspool
ws2_32 ../reactos/dll/win32/ws2_32
wsock32 ../reactos/dll/win32/wsock32
videoprt ../reactos/drivers/video/videoprt
ndis ../reactos/drivers/network/ndis
tdi ../reactos/drivers/network/tdi
scsiport ../reactos/drivers/storage/scsiport
ntoskrnl ../reactos/ntoskrnl
rtl ../reactos/lib/rtl
win32k ../reactos/subsystems/win32/win32k

View File

@@ -0,0 +1,58 @@
/* 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());
}
}

View File

@@ -0,0 +1,21 @@
#
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

View File

@@ -0,0 +1,37 @@
/*
* 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;
}

View File

@@ -0,0 +1,26 @@
#
#
#
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

View File

@@ -0,0 +1,26 @@
# 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

View File

@@ -0,0 +1,124 @@
/* 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;
}

View File

@@ -0,0 +1,89 @@
/* 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;
}

View File

@@ -0,0 +1,26 @@
#
#
#
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

View File

@@ -0,0 +1,151 @@
#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;
}

View File

@@ -0,0 +1,36 @@
#
#
#
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

View File

@@ -0,0 +1,751 @@
/* 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;
}

View File

@@ -0,0 +1,17 @@
/****************************************************************************
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

View File

@@ -0,0 +1,26 @@
#
#
#
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

View File

@@ -0,0 +1,83 @@
#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);
}

View File

@@ -0,0 +1,26 @@
#
#
#
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

View File

@@ -0,0 +1,9 @@
#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));
}

View File

@@ -0,0 +1,48 @@
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

View File

@@ -0,0 +1,26 @@
#
#
#
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

View File

@@ -0,0 +1,154 @@
#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);
}

View File

@@ -0,0 +1,31 @@
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.

View File

@@ -0,0 +1,39 @@
#
#
#
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

View File

@@ -0,0 +1,254 @@
/*********************************************************************
* *
* 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();
}

View File

@@ -0,0 +1,8 @@
name rolex
mode guiexe
type win32
import user32.dll
import gdi32.dll
import kernel32.dll
import ntdll.dll

View File

@@ -0,0 +1,36 @@
#
#
#
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

View File

@@ -0,0 +1,29 @@
/*
* 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;
}

View File

@@ -0,0 +1,103 @@
/*
* 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"

View File

@@ -0,0 +1,104 @@
/*
* 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"

View File

@@ -0,0 +1,103 @@
/*
* 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"

View File

@@ -0,0 +1,106 @@
/*
* 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"

View File

@@ -0,0 +1,104 @@
/*
* 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"

View File

@@ -0,0 +1,108 @@
/*
* Notepad (French resources)
*
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* Translation by Laurent Buffler <laurent@bluewin.ch>
*/
#define LANGUAGE_ID Fr
#define LANGUAGE_NUMBER 3
#define LANGUAGE_MENU_ITEM "&Fran<61>ais"
/* Menu */
#define MENU_FILE "&Fichier"
#define MENU_FILE_NEW "&Nouveau..."
#define MENU_FILE_OPEN "&Ouvrir"
#define MENU_FILE_SAVE "&Sauver"
#define MENU_FILE_SAVEAS "S&auver sous..."
#define MENU_FILE_PRINT "Im&primer"
#define MENU_FILE_PAGESETUP "&Mise en page..."
#define MENU_FILE_PRINTSETUP "Imp&rimante..."
#define MENU_FILE_EXIT "&Quitter"
#define MENU_EDIT "&Edition"
#define MENU_EDIT_UNDO "&Annuler\tCtrl+Z"
#define MENU_EDIT_CUT "Coupe&r\tCtrl+X"
#define MENU_EDIT_COPY "&Copier\tCtrl+C"
#define MENU_EDIT_PASTE "C&oller\tCtrl+V"
#define MENU_EDIT_DELETE "E&ffacer\tDel"
#define MENU_EDIT_SELECTALL "Tout &selectionner"
#define MENU_EDIT_TIMEDATE "&Heure/Date\tF5"
#define MENU_EDIT_WRAP "&Retour <20> la ligne"
#define MENU_SEARCH "&Recherche"
#define MENU_SEARCH_SEARCH "&Chercher..."
#define MENU_SEARCH_NEXT "&Suivant\tF3"
#define MENU_LANGUAGE "&Langue"
#define MENU_HELP "&Aide"
#define MENU_HELP_CONTENTS "&Sommaire"
#define MENU_HELP_SEARCH "&Chercher..."
#define MENU_HELP_HELP_ON_HELP "&Aide sur l'aide"
#define MENU_INFO "Inf&o..."
#define MENU_INFO_LICENSE "&License"
#define MENU_INFO_NO_WARRANTY "&SANS GARANTIE"
#define MENU_INFO_ABOUT_WINE "&A propos de Wine"
/* Dialogs */
#define DIALOG_OK "OK"
#define DIALOG_CANCEL "Annuler"
#define DIALOG_BROWSE "&Parcourir..."
#define DIALOG_HELP "&Aide"
#define DIALOG_PAGESETUP_CAPTION "Mise en page"
#define DIALOG_PAGESETUP_HEAD "&En-t<>te:"
#define DIALOG_PAGESETUP_TAIL "&Pied de page:"
#define DIALOG_PAGESETUP_MARGIN "&Marges:"
#define DIALOG_PAGESETUP_LEFT "&Gauche:"
#define DIALOG_PAGESETUP_RIGHT "&Droite:"
#define DIALOG_PAGESETUP_TOP "&Haut:"
#define DIALOG_PAGESETUP_BOTTOM "&Bas:"
/* 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 "ERREUR"
#define STRING_WARNING "AVERTISSEMENT"
#define STRING_INFO "Information"
#define STRING_UNTITLED "(sans titre)"
#define STRING_ALL_FILES "Tous (*.*)"
#define STRING_TEXT_FILES_TXT "Fichiers texte (*.txt)"
#define STRING_TOOLARGE "Le fichier '%s' est trop grand pour le bloc note.\n \
Veuillez utiliser un autre <20>diteur."
#define STRING_NOTEXT "Vous n'avez pas entr<74> de texte. \
\nVeuillez taper quelque chose et recommencer"
/* FIXME */
#define STRING_NOTSAVED "Le fichier '%s'\n\n a change\n \
Would you like to save your changes ?"
#define STRING_NOTFOUND "'%s' introuvable."
#define STRING_OUT_OF_MEMORY "Pas assez de m<>moire pour finir cette t<>che. \
\nFermez une ou plusier applications pour lib<69>rer \n \
de la m<>moire."
#include "notepad.rc"
/* Strings */

View File

@@ -0,0 +1,48 @@
#include "windows.h"
#include "license.h"
static CHAR LicenseCaption_En[] = "LICENSE";
static CHAR License_En[] = "\
You may without charge, royalty or other payment, copy and\
distribute copies of this work and derivative works of this work\
in source or binary form provided that: (1)\
you appropriately publish on each copy an appropriate copyright\
notice; (2) faithfully reproduce all prior copyright notices\
included in the original work (you may also add your own\
copyright notice); and (3) agree to indemnify and hold all prior\
authors, copyright holders and licensors of the work harmless\
from and against all damages arising from use of the work.\
\n\
You may distribute sources of derivative works of the work\
provided that (1) (a) all source files of the original work that\
have been modified, (b) all source files of the derivative work\
that contain any party of the original work, and (c) all source\
files of the derivative work that are necessary to compile, link\
and run the derivative work without unresolved external calls and\
with the same functionality of the original work (\"Necessary\
Sources\") carry a prominent notice explaining the nature and date\
of the modification and/or creation. You are encouraged to make\
the Necessary Sources available under this license in order to\
further the development and acceptance of the work.\
\n\
EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED\
WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING\
BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A\
PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE. EXCEPT AS\
OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR\
LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF\
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.";
static CHAR NoWarrantyCaption_En[] = "NO WARRANTY";
static CHAR NoWarranty_En[] = "\
EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED\
WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING\
BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A\
PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE. EXCEPT AS\
OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR\
LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF\
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.";
LICENSE WineLicense_En = {License_En, LicenseCaption_En,
NoWarranty_En, NoWarrantyCaption_En};

View File

@@ -0,0 +1,41 @@
#
#
#
PATH_TO_TOP = ../..
PROGS = notepad
OBJECTS = dialog.o language.o license.o License_En.o main.o search.o rsrc.coff
LIBS = ../../dk/w32/lib/kernel32.a ../../dk/w32/lib/gdi32.a \
../../dk/w32/lib/libcomdlg32.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
notepad.exe: $(OBJECTS)
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o notepad.exe
$(NM) --numeric-sort notepad.exe > notepad.sym
%.coff: %.rc
$(RC) $(RCINC) $< -o $@
include ../../rules.mak

View File

@@ -0,0 +1,102 @@
/*
* Notepad (English resources)
*
* Copyright 1999 Marcel Baur <alves@correionet.com.br>
*/
#define LANGUAGE_ID Pt
#define LANGUAGE_NUMBER 16
#define LANGUAGE_MENU_ITEM "&Portugu<67>s"
/* Menu */
#define MENU_FILE "&Arquivo"
#define MENU_FILE_NEW "&Novo..."
#define MENU_FILE_OPEN "A&brir"
#define MENU_FILE_SAVE "&Salvar"
#define MENU_FILE_SAVEAS "Salvar &como..."
#define MENU_FILE_PRINT "&Imprimir"
#define MENU_FILE_PAGESETUP "C&onfigurar P<>gina..."
#define MENU_FILE_PRINTSETUP "Configurar I&mpressora..."
#define MENU_FILE_EXIT "&Sair"
#define MENU_EDIT "&Editar"
#define MENU_EDIT_UNDO "&Desfazer\tCtrl+Z"
#define MENU_EDIT_CUT "C&ortar\tCtrl+X"
#define MENU_EDIT_COPY "&Copiar\tCtrl+C"
#define MENU_EDIT_PASTE "Co&lar\tCtrl+V"
#define MENU_EDIT_DELETE "&Delete\tDel"
#define MENU_EDIT_SELECTALL "Selecionar &Tudo"
#define MENU_EDIT_TIMEDATE "&Data/Hora\tF5"
#define MENU_EDIT_WRAP "&Quebrar linhas longas"
#define MENU_SEARCH "&Pesquisa"
#define MENU_SEARCH_SEARCH "Pesquisar..."
#define MENU_SEARCH_NEXT "&Procurar Pr<50>xima\tF3"
#define MENU_LANGUAGE "&Linguagem"
#define MENU_HELP "&Ajuda"
#define MENU_HELP_CONTENTS "&Conte<74>do"
#define MENU_HELP_SEARCH "&Procurar..."
#define MENU_HELP_HELP_ON_HELP "&Ajuda na ajuda"
#define MENU_INFO "Inf&orma<6D><61>es..."
#define MENU_INFO_LICENSE "&Licen<65>a"
#define MENU_INFO_NO_WARRANTY "&SEM GARANTIA"
#define MENU_INFO_ABOUT_WINE "&Sobre Wine"
/* Dialogs */
#define DIALOG_OK "OK"
#define DIALOG_CANCEL "Cancelar"
#define DIALOG_BROWSE "&Procurar..."
#define DIALOG_HELP "&Ajuda"
#define DIALOG_PAGESETUP_CAPTION "Configurar P<>gina"
#define DIALOG_PAGESETUP_HEAD "&Cabe<62>alho:"
#define DIALOG_PAGESETUP_TAIL "&Rodap<61>:"
#define DIALOG_PAGESETUP_MARGIN "&Margens:"
#define DIALOG_PAGESETUP_LEFT "&Esquerda:"
#define DIALOG_PAGESETUP_RIGHT "&Direita:"
#define DIALOG_PAGESETUP_TOP "&Superior:"
#define DIALOG_PAGESETUP_BOTTOM "&Inferior:"
/* 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 "Notepad"
#define STRING_ERROR "ERRO"
#define STRING_WARNING "AVISO"
#define STRING_INFO "Informa<6D><61>o"
#define STRING_UNTITLED "(sem nome)"
#define STRING_ALL_FILES "Todos os arquivos (*.*)"
#define STRING_TEXT_FILES_TXT "Arquivos texto (*.txt)"
#define STRING_TOOLARGE "Arquivo '%s' <20> muito longo para o notepad.\n \
Por favor use um editor diferente."
#define STRING_NOTEXT "Voc<6F> n<>o digitou nenhum texto. \
\nPor favor digite alguma coisa e tente novamente"
#define STRING_NOTSAVED "Arquivo '%s'\nfoi modificado\n\n \
Gostaria de salvar as altera<72><61>es ?"
#define STRING_NOTFOUND "'%s' n<>o pode ser encontrado."
#define STRING_OUT_OF_MEMORY "N<>o h<> mem<65>ria suficiente para completar essa \
tarefa. \nFeche uma ou mais aplica<63><61>es para aumentar a quantidade de mem<65>ria \
livre."
#include "notepad.rc"

View File

@@ -0,0 +1,103 @@
/*
* 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 Sk
#define LANGUAGE_NUMBER 10
#define LANGUAGE_MENU_ITEM "&Slovensky"
/* Menu */
#define MENU_FILE "&S<>bor"
#define MENU_FILE_NEW "&Nov<6F>..."
#define MENU_FILE_OPEN "&Otvori<72>"
#define MENU_FILE_SAVE "U&lo<6C>i<EFBFBD>"
#define MENU_FILE_SAVEAS "Ulo<6C>&i<> ako..."
#define MENU_FILE_PRINT "&Tla<6C>i<EFBFBD>"
#define MENU_FILE_PAGESETUP "&Nastavenie tla<6C>e..."
#define MENU_FILE_PRINTSETUP "Nastavenie tla<6C>iar&ne..."
#define MENU_FILE_EXIT "U&kon<6F>i<EFBFBD>"
#define MENU_EDIT "&Upravi<76>"
#define MENU_EDIT_UNDO "&Krok sp<73><70>\tCtrl+Z"
#define MENU_EDIT_CUT "V&ystrihn<68><6E>\tCtrl+X"
#define MENU_EDIT_COPY "&Kop<6F>rova<76>\tCtrl+C"
#define MENU_EDIT_PASTE "V&lepi<70>\tCtrl+V"
#define MENU_EDIT_DELETE "&Zmaza<7A>\tDel"
#define MENU_EDIT_SELECTALL "Vybr&a<> v<>etko"
#define MENU_EDIT_TIMEDATE "<22>as&/D<>tum\tF5"
#define MENU_EDIT_WRAP "&Zalomi<6D> dlh<6C> riadky"
#define MENU_SEARCH "&H<>ada<64>"
#define MENU_SEARCH_SEARCH "H<>ada<64>..."
#define MENU_SEARCH_NEXT "&H<>ada<64> <20>a<EFBFBD><61><EFBFBD>\tF3"
#define MENU_LANGUAGE "&Jazyk"
#define MENU_HELP "&Pomoc"
#define MENU_HELP_CONTENTS "&Obsah"
#define MENU_HELP_SEARCH "&H<>ada<64>..."
#define MENU_HELP_HELP_ON_HELP "&Pomoc na pomoci"
#define MENU_INFO "Inf&o..."
#define MENU_INFO_LICENSE "&Licencia"
#define MENU_INFO_NO_WARRANTY "&BEZ Z<>RUKY"
#define MENU_INFO_ABOUT_WINE "O &Wine"
/* Dialogs */
#define DIALOG_OK "OK"
#define DIALOG_CANCEL "Zru<72>i<EFBFBD>"
#define DIALOG_BROWSE "&Listova<76>..."
#define DIALOG_HELP "&Pomoc"
#define DIALOG_PAGESETUP_CAPTION "Nastavenie str<74>nky"
#define DIALOG_PAGESETUP_HEAD "&Hlavi<76>ka:"
#define DIALOG_PAGESETUP_TAIL "&P<>ta:"
#define DIALOG_PAGESETUP_MARGIN "&Okraje:"
#define DIALOG_PAGESETUP_LEFT "<22>a&v<>:"
#define DIALOG_PAGESETUP_RIGHT "P&rav<61>:"
#define DIALOG_PAGESETUP_TOP "H&ore:"
#define DIALOG_PAGESETUP_BOTTOM "Do&lu:"
/* Strings */
#define STRING_PAGESETUP_HEADERVALUE "&n" /* FIXME */
#define STRING_PAGESETUP_FOOTERVALUE "Strana &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 "CHYBA"
#define STRING_WARNING "VAROVANIE"
#define STRING_INFO "Inform<72>cie"
#define STRING_UNTITLED "(nepomenovan<61>)"
#define STRING_ALL_FILES "V<>etky s<>bory (*.*)"
#define STRING_TEXT_FILES_TXT "Textov<6F> s<>bory (*.txt)"
#define STRING_TOOLARGE "File '%s' is too large for notepad.\n \
Please use a different editor."
#define STRING_NOTEXT "Ni<4E> ste nenap<61>sali. \
\nPros<6F>m, nap<61><70>te nejak<61> text a pok<6F>ste sa znovu."
#define STRING_NOTSAVED "S<>bor '%s'\nbol zmenen<65>n\n \
Prajete si ulo<6C>i<EFBFBD> zmeny ?"
#define STRING_NOTFOUND "'%s' nem<65><6D>e by<62> n<>jden<65>."
#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"

View File

@@ -0,0 +1,105 @@
/*
* Notepad (Swedish resources)
*
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* Swedish language by Karl Backstr<74>m <karl_b@geocities.com>
*/
#define LANGUAGE_ID Sw
#define LANGUAGE_NUMBER 1d
#define LANGUAGE_MENU_ITEM "&Svenska"
/* Menu */
#define MENU_FILE "&Arkiv"
#define MENU_FILE_NEW "&Ny..."
#define MENU_FILE_OPEN "<22>&ppna"
#define MENU_FILE_SAVE "&Spara"
#define MENU_FILE_SAVEAS "Spara &som..."
#define MENU_FILE_PRINT "&Skriv ut"
#define MENU_FILE_PAGESETUP "Sid La&yout..."
#define MENU_FILE_PRINTSETUP "Skrivar &inst<73>llningar..."
#define MENU_FILE_EXIT "&Avsluta"
#define MENU_EDIT "&Redigera"
#define MENU_EDIT_UNDO "&Undo\tCtrl+Z"
#define MENU_EDIT_CUT "Klippa\tCtrl+X"
#define MENU_EDIT_COPY "&Kopiera\tCtrl+C"
#define MENU_EDIT_PASTE "&Klistra in\tCtrl+V"
#define MENU_EDIT_DELETE "&Ta bort\tDel"
#define MENU_EDIT_SELECTALL "Markera &allt"
#define MENU_EDIT_TIMEDATE "&Tid/Datum\tF5"
#define MENU_EDIT_WRAP "&Dela l<>nga meningar"
#define MENU_SEARCH "&S<>k"
#define MENU_SEARCH_SEARCH "S<>k..."
#define MENU_SEARCH_NEXT "&S<>k n<>sta\tF3"
#define MENU_LANGUAGE "&Spr<70>k"
#define MENU_HELP "&Hj<48>lp"
#define MENU_HELP_CONTENTS "&Inneh<65>ll"
#define MENU_HELP_SEARCH "&S<>k..."
#define MENU_HELP_HELP_ON_HELP "Anv<6E>ndningen &av hj<68>lp"
#define MENU_INFO "Inf&ormation..."
#define MENU_INFO_LICENSE "&Licens"
#define MENU_INFO_NO_WARRANTY "&INGEN GARANTI"
#define MENU_INFO_ABOUT_WINE "&Om Wine"
/* Dialogs */
#define DIALOG_OK "OK"
#define DIALOG_CANCEL "Avbryt"
#define DIALOG_BROWSE "&Bl<42>ddra..."
#define DIALOG_HELP "&Hj<48>lp"
#define DIALOG_PAGESETUP_CAPTION "Sid Layout"
#define DIALOG_PAGESETUP_HEAD "&Huvudnot:"
#define DIALOG_PAGESETUP_TAIL "&Fotnot:"
#define DIALOG_PAGESETUP_MARGIN "Kanter:"
#define DIALOG_PAGESETUP_LEFT "&V<>nster:"
#define DIALOG_PAGESETUP_RIGHT "&H<>ger:"
#define DIALOG_PAGESETUP_TOP "&<26>ver:"
#define DIALOG_PAGESETUP_BOTTOM "&Under:"
/* 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 "Anteckningar"
#define STRING_ERROR "FEL"
#define STRING_WARNING "VARNING"
#define STRING_INFO "Information"
#define STRING_UNTITLED "(untitled)"
#define STRING_ALL_FILES "Alla filer (*.*)"
#define STRING_TEXT_FILES_TXT "Text filer (*.txt)"
#define STRING_TOOLARGE "Filen '%s' <20>r f<>r stor f<>r notepad.\n \
Anv<EFBFBD>nd en annan editor."
#define STRING_NOTEXT "Du skrev inte in n<>gon text. \
\nSkriv n<>got och f<>rs<72>k sedan igen"
/* FIXME */
#define STRING_NOTSAVED "Filen '%s'\nhas been modified\n\n \
Would you like to save your changes ?"
#define STRING_NOTFOUND "'%s' hittades inte."
#define STRING_OUT_OF_MEMORY "Inte tillr<6C>kligt med minne f<>r att slutf<74>ra \
den h<>r uppgiften. \nAvsluta ett eller flera program f<>r att <20>ka m<>ngden \nfritt \
minne."
#include "notepad.rc"

View File

@@ -0,0 +1,104 @@
/*
* Notepad (Walloon resources)
*
* Si vos voloz aider avou li rato<74>rnaedje des libes programes <20> walon,
* vos poloz scr<63>re a l' adresse emile <linux-wa@chanae.alphanet.ch>
*/
#define LANGUAGE_ID Wa
#define LANGUAGE_NUMBER 90
#define LANGUAGE_MENU_ITEM "&Walon"
/* Menu */
#define MENU_FILE "&Fitch<63>"
#define MENU_FILE_NEW "&Novea..."
#define MENU_FILE_OPEN "&Drov<6F>"
#define MENU_FILE_SAVE "&Schaper"
#define MENU_FILE_SAVEAS "Schaper <20>t r&lomer..."
#define MENU_FILE_PRINT "&Rexhe"
#define MENU_FILE_PAGESETUP "Arrandjmint del &P<>dje..."
#define MENU_FILE_PRINTSETUP "&Apontiaedje del scrirece..."
#define MENU_FILE_EXIT "Mouss<73> &Fo<46>"
#define MENU_EDIT "&Candj<64>"
#define MENU_EDIT_UNDO "&Disf<73>\tCtrl+Z"
#define MENU_EDIT_CUT "C<>&per\tCtrl+X"
#define MENU_EDIT_COPY "&Copy<70>\tCtrl+C"
#define MENU_EDIT_PASTE "C&laper\tCtrl+V"
#define MENU_EDIT_DELETE "&Rafacer\tDel"
#define MENU_EDIT_SELECTALL "&Tchwezi totafwait"
#define MENU_EDIT_TIMEDATE "&Eure/Date\tF5"
#define MENU_EDIT_WRAP "C<>per les ro&yes"
#define MENU_SEARCH "C&wer<65>"
#define MENU_SEARCH_SEARCH "Cwer<65>..."
#define MENU_SEARCH_NEXT "&Sh<53>vant\tF3"
#define MENU_LANGUAGE "&Lingaedje"
#define MENU_HELP "&Aide"
#define MENU_HELP_CONTENTS "<22>&dvins"
#define MENU_HELP_SEARCH "C&wer<65>..."
#define MENU_HELP_HELP_ON_HELP "&Aide so l' Aide"
#define MENU_INFO "&Inform<72>cion..."
#define MENU_INFO_LICENSE "&Licinse"
#define MENU_INFO_NO_WARRANTY "&NOLE WARANTEYE"
#define MENU_INFO_ABOUT_WINE "<22> &dfait di Wine"
/* Dialogs */
#define DIALOG_OK "I Va"
#define DIALOG_CANCEL "Rinonc<6E>"
#define DIALOG_BROWSE "&Foyer..."
#define DIALOG_HELP "&Aide"
#define DIALOG_PAGESETUP_CAPTION "Arindjmint del P<>dje"
/* "Tite" ni va n<>n vraiymint, i f<>t ene sacwe d' meyeu [header] */
#define DIALOG_PAGESETUP_HEAD "&Tite:"
#define DIALOG_PAGESETUP_TAIL "&P<>note:"
/* "mardjes" ? [marges] */
#define DIALOG_PAGESETUP_MARGIN "&Mardjes:"
#define DIALOG_PAGESETUP_LEFT "&Hintche:"
#define DIALOG_PAGESETUP_RIGHT "&Droete:"
#define DIALOG_PAGESETUP_TOP "&Copete:"
#define DIALOG_PAGESETUP_BOTTOM "&Bas:"
/* Strings */
#define STRING_PAGESETUP_HEADERVALUE "&n" /* FIXME */
#define STRING_PAGESETUP_FOOTERVALUE "P<>dje &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 "AROKE"
#define STRING_WARNING "ADVERTIXHMINT"
#define STRING_INFO "Inform<72>cion"
#define STRING_UNTITLED "(sin tite)"
#define STRING_ALL_FILES "Tos les fitch<63>s (*.*)"
#define STRING_TEXT_FILES_TXT "Fitch<63>s tekse (*.txt)"
#define STRING_TOOLARGE "Li fitch<63> '%s' est trop gros pol notepad.\n \
Eployoz on <20>te aspougneu di tekse."
#define STRING_NOTEXT "Vos n' avoz r<>n sicr<63>t. \
\nTapez ene sacwe <20>t rasayez"
#define STRING_NOTSAVED "Li fitch<63> '%s'\na candj<64>\n\n \
El voloz schaper ?"
#define STRING_NOTFOUND "'%s' pout n<>n esse trov<6F>."
#define STRING_OUT_OF_MEMORY "Li memwere est plinne. \n\
Cloyoz on programe ou pus po monter li memwere libe."
#include "notepad.rc"

View File

@@ -0,0 +1,667 @@
/*
* Notepad (dialog.c)
*
* Copyright 1998,99 Marcel Baur <mbaur@g26.ethz.ch>
* To be distributed under the Wine License
*/
#include <assert.h>
#include <stdio.h>
#include <windows.h>
/* temp for ROS */
#include "ros.h"
#include "main.h"
#include "license.h"
#include "language.h"
#include "dialog.h"
#define LCC_HASASSERT
#include "lcc.h"
static LRESULT WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int AlertIDS(UINT ids_message, UINT ids_caption, WORD type) {
/*
* Given some ids strings, this acts as a language-aware wrapper for
* "MessageBox"
*/
CHAR szMessage[MAX_STRING_LEN];
CHAR szCaption[MAX_STRING_LEN];
LoadString(Globals.hInstance, ids_message, szMessage, sizeof(szMessage));
LoadString(Globals.hInstance, ids_caption, szCaption, sizeof(szCaption));
return (MessageBox(Globals.hMainWnd, szMessage, szCaption, type));
}
void AlertFileNotFound(LPSTR szFileName) {
int nResult;
CHAR szMessage[MAX_STRING_LEN];
CHAR szRessource[MAX_STRING_LEN];
/* Load and format szMessage */
LoadString(Globals.hInstance, IDS_NOTFOUND, szRessource, sizeof(szRessource));
wsprintf(szMessage, szRessource, szFileName);
/* Load szCaption */
LoadString(Globals.hInstance, IDS_ERROR, szRessource, sizeof(szRessource));
/* Display Modal Dialog */
nResult = MessageBox(Globals.hMainWnd, szMessage, szRessource, MB_ICONEXCLAMATION);
}
int AlertFileNotSaved(LPSTR szFileName) {
int nResult;
CHAR szMessage[MAX_STRING_LEN];
CHAR szRessource[MAX_STRING_LEN];
/* Load and format Message */
LoadString(Globals.hInstance, IDS_NOTSAVED, szRessource, sizeof(szRessource));
wsprintf(szMessage, szRessource, szFileName);
/* Load Caption */
LoadString(Globals.hInstance, IDS_ERROR, szRessource, sizeof(szRessource));
/* Display modal */
nResult = MessageBox(Globals.hMainWnd, szMessage, szRessource, MB_ICONEXCLAMATION|MB_YESNOCANCEL);
return(nResult);
}
VOID AlertOutOfMemory(void) {
int nResult;
nResult = AlertIDS(IDS_OUT_OF_MEMORY, IDS_ERROR, MB_ICONEXCLAMATION);
PostQuitMessage(1);
}
BOOL ExistFile(LPCSTR szFilename) {
/*
* Returns: TRUE - if "szFileName" exists
* FALSE - if it does not
*/
WIN32_FIND_DATA entry;
HANDLE hFile;
hFile = FindFirstFile(szFilename, &entry);
return (hFile!=INVALID_HANDLE_VALUE);
}
VOID DoSaveFile(VOID) {
/* FIXME: Really Save the file */
/* ... (Globals.szFileName); */
}
BOOL DoCloseFile(void) {
/* Return value: TRUE - User agreed to close (both save/don't save) */
/* FALSE - User cancelled close by selecting "Cancel" */
int nResult;
if (strlen(Globals.szFileName)>0) {
/* prompt user to save changes */
nResult = AlertFileNotSaved(Globals.szFileName);
switch (nResult) {
case IDYES: DoSaveFile();
break;
case IDNO: break;
case IDCANCEL: return(FALSE);
break;
default: return(FALSE);
break;
} /* switch */
} /* if */
/* Forget file name */
lstrcpy(Globals.szFileName, "");
LANGUAGE_UpdateWindowCaption();
return(TRUE);
}
void DoOpenFile(LPCSTR szFileName) {
/* Close any files and prompt to save changes */
if (DoCloseFile()) {
GetFileTitle(szFileName, Globals.szFileName, sizeof(Globals.szFileName));
LANGUAGE_UpdateWindowCaption();
LoadBufferFromFile(szFileName);
}
}
VOID DIALOG_FileNew(VOID)
{
/* Close any files and promt to save changes */
if (DoCloseFile()) {
TrashBuffer();
}
}
VOID DIALOG_FileOpen(VOID)
{
OPENFILENAME openfilename;
CHAR szPath[MAX_PATHNAME_LEN];
CHAR szDir[MAX_PATHNAME_LEN];
CHAR szzFilter[2 * MAX_STRING_LEN + 100];
CHAR szDefaultExt[4];
LPSTR p = szzFilter;
lstrcpy(szDefaultExt, "txt");
LoadString(Globals.hInstance, IDS_TEXT_FILES_TXT, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.txt");
p += strlen(p) + 1;
LoadString(Globals.hInstance, IDS_ALL_FILES, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.*");
p += strlen(p) + 1;
*p = '\0';
GetCurrentDirectory(sizeof(szDir), szDir);
lstrcpy(szPath,"*.txt");
openfilename.lStructSize = sizeof(OPENFILENAME);
openfilename.hwndOwner = Globals.hMainWnd;
openfilename.hInstance = Globals.hInstance;
openfilename.lpstrFilter = szzFilter;
openfilename.lpstrCustomFilter = 0;
openfilename.nMaxCustFilter = 0;
openfilename.nFilterIndex = 0;
openfilename.lpstrFile = szPath;
openfilename.nMaxFile = sizeof(szPath);
openfilename.lpstrFileTitle = 0;
openfilename.nMaxFileTitle = 0;
openfilename.lpstrInitialDir = szDir;
openfilename.lpstrTitle = 0;
openfilename.Flags = OFN_FILEMUSTEXIST + OFN_PATHMUSTEXIST;
openfilename.nFileOffset = 0;
openfilename.nFileExtension = 0;
openfilename.lpstrDefExt = szDefaultExt;
openfilename.lCustData = 0;
openfilename.lpfnHook = 0;
openfilename.lpTemplateName = 0;
if (GetOpenFileName(&openfilename)) {
if (ExistFile(openfilename.lpstrFile))
DoOpenFile(openfilename.lpstrFile);
else
AlertFileNotFound(openfilename.lpstrFile);
}
}
VOID DIALOG_FileSave(VOID)
{
/* FIXME: Save File */
DIALOG_FileSaveAs();
}
VOID DIALOG_FileSaveAs(VOID)
{
OPENFILENAME saveas;
CHAR szPath[MAX_PATHNAME_LEN];
CHAR szDir[MAX_PATHNAME_LEN];
CHAR szDefaultExt[4];
CHAR szzFilter[2 * MAX_STRING_LEN + 100];
LPSTR p = szzFilter;
lstrcpy(szDefaultExt, "txt");
LoadString(Globals.hInstance, IDS_TEXT_FILES_TXT, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.txt");
p += strlen(p) + 1;
LoadString(Globals.hInstance, IDS_ALL_FILES, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.*");
p += strlen(p) + 1;
*p = '\0';
lstrcpy(szPath,"*.*");
GetCurrentDirectory(sizeof(szDir), szDir);
saveas.lStructSize = sizeof(OPENFILENAME);
saveas.hwndOwner = Globals.hMainWnd;
saveas.hInstance = Globals.hInstance;
saveas.lpstrFilter = szzFilter;
saveas.lpstrCustomFilter = 0;
saveas.nMaxCustFilter = 0;
saveas.nFilterIndex = 0;
saveas.lpstrFile = szPath;
saveas.nMaxFile = sizeof(szPath);
saveas.lpstrFileTitle = 0;
saveas.nMaxFileTitle = 0;
saveas.lpstrInitialDir = szDir;
saveas.lpstrTitle = 0;
saveas.Flags = OFN_PATHMUSTEXIST + OFN_OVERWRITEPROMPT + OFN_HIDEREADONLY;
saveas.nFileOffset = 0;
saveas.nFileExtension = 0;
saveas.lpstrDefExt = szDefaultExt;
saveas.lCustData = 0;
saveas.lpfnHook = 0;
saveas.lpTemplateName = 0;
if (GetSaveFileName(&saveas)) {
lstrcpy(Globals.szFileName, saveas.lpstrFile);
LANGUAGE_UpdateWindowCaption();
DIALOG_FileSave();
}
}
VOID DIALOG_FilePrint(VOID)
{
LONG bFlags, nBase;
WORD nOffset;
DOCINFO di;
int nResult;
HDC hContext;
PRINTDLG printer;
CHAR szDocumentName[MAX_STRING_LEN]; /* Name of document */
CHAR szPrinterName[MAX_STRING_LEN]; /* Name of the printer */
CHAR szDeviceName[MAX_STRING_LEN]; /* Name of the printer device */
CHAR szOutput[MAX_STRING_LEN]; /* in which file/device to print */
/* LPDEVMODE hDevMode; */
/* LPDEVNAMES hDevNames; */
/* hDevMode = GlobalAlloc(GMEM_MOVEABLE + GMEM_ZEROINIT, sizeof(DEVMODE)); */
/* hDevNames = GlobalAlloc(GMEM_MOVEABLE + GMEM_ZEROINIT, sizeof(DEVNAMES)); */
/* Get Current Settings */
printer.lStructSize = sizeof(PRINTDLG);
printer.hwndOwner = Globals.hMainWnd;
printer.hInstance = Globals.hInstance;
/* Let PrintDlg create a DEVMODE structure */
printer.hDevMode = 0;
printer.hDevNames = 0;
printer.hDC = 0;
printer.Flags = PD_RETURNDEFAULT;
printer.nFromPage = 0;
printer.nToPage = 0;
printer.nMinPage = 0;
printer.nMaxPage = 0;
printer.nCopies = 0;
printer.lCustData = 0;
printer.lpfnPrintHook = 0;
printer.lpfnSetupHook = 0;
printer.lpPrintTemplateName = 0;
printer.lpSetupTemplateName = 0;
printer.hPrintTemplate = 0;
printer.hSetupTemplate = 0;
nResult = PrintDlg(&printer);
/* hContext = CreateDC(, szDeviceName, "TEST.TXT", 0); */
/* Congratulations to those Microsoft Engineers responsable */
/* for the following pointer acrobatics */
assert(printer.hDevNames!=0);
nBase = (LONG)(printer.hDevNames);
nOffset = (WORD)((LPDEVNAMES) printer.hDevNames)->wDriverOffset;
lstrcpy(szPrinterName, (LPCSTR) (nBase + nOffset));
nOffset = (WORD)((LPDEVNAMES) printer.hDevNames)->wDeviceOffset;
lstrcpy(szDeviceName, (LPCSTR) (nBase + nOffset));
nOffset = (WORD)((LPDEVNAMES) printer.hDevNames)->wOutputOffset;
lstrcpy(szOutput, (LPCSTR) (nBase + nOffset));
MessageBox(Globals.hMainWnd, szPrinterName, "Printer Name", MB_ICONEXCLAMATION);
MessageBox(Globals.hMainWnd, szDeviceName, "Device Name", MB_ICONEXCLAMATION);
MessageBox(Globals.hMainWnd, szOutput, "Output", MB_ICONEXCLAMATION);
/* Set some default flags */
bFlags = PD_RETURNDC + PD_SHOWHELP;
if (TRUE) {
/* Remove "Print Selection" if there is no selection */
bFlags = bFlags + PD_NOSELECTION;
}
printer.Flags = bFlags;
/*
printer.nFromPage = 0;
printer.nToPage = 0;
printer.nMinPage = 0;
printer.nMaxPage = 0;
*/
/* Let commdlg manage copy settings */
printer.nCopies = (WORD)PD_USEDEVMODECOPIES;
if (PrintDlg(&printer)) {
/* initialize DOCINFO */
di.cbSize = sizeof(DOCINFO);
lstrcpy((LPSTR)di.lpszDocName, szDocumentName);
lstrcpy((LPSTR)di.lpszOutput, szOutput);
hContext = printer.hDC;
assert(hContext!=0);
assert( (int) hContext!=PD_RETURNDC);
SetMapMode(hContext, MM_LOMETRIC);
/* SetViewPortExExt(hContext, 10, 10, 0); */
SetBkMode(hContext, OPAQUE);
nResult = TextOut(hContext, 0, 0, " ", 1);
assert(nResult != 0);
nResult = StartDoc(hContext, &di);
assert(nResult != SP_ERROR);
nResult = StartPage(hContext);
assert(nResult >0);
/* FIXME: actually print */
nResult = EndPage(hContext);
switch (nResult) {
case SP_ERROR:
MessageBox(Globals.hMainWnd, "Generic Error", "Print Engine Error", MB_ICONEXCLAMATION);
break;
case SP_APPABORT:
MessageBox(Globals.hMainWnd, "The print job was aborted.", "Print Engine Error", MB_ICONEXCLAMATION);
break;
case SP_USERABORT:
MessageBox(Globals.hMainWnd, "The print job was aborted using the Print Manager ", "Print Engine Error", MB_ICONEXCLAMATION);
break;
case SP_OUTOFDISK:
MessageBox(Globals.hMainWnd, "Out of disk space", "Print Engine Error", MB_ICONEXCLAMATION);
break;
case SP_OUTOFMEMORY:
AlertOutOfMemory();
break;
default:
MessageBox(Globals.hMainWnd, "Default", "Print", MB_ICONEXCLAMATION);
} /* switch */
nResult = EndDoc(hContext);
assert(nResult>=0);
nResult = DeleteDC(hContext);
assert(nResult!=0);
} /* if */
/* GlobalFree(hDevNames); */
/* GlobalFree(hDevMode); */
}
VOID DIALOG_FilePageSetup(VOID)
{
DIALOG_PageSetup();
}
VOID DIALOG_FilePrinterSetup(VOID)
{
PRINTDLG printer;
printer.lStructSize = sizeof(PRINTDLG);
printer.hwndOwner = Globals.hMainWnd;
printer.hInstance = Globals.hInstance;
printer.hDevMode = 0;
printer.hDevNames = 0;
printer.hDC = 0;
printer.Flags = PD_PRINTSETUP;
printer.nFromPage = 0;
printer.nToPage = 0;
printer.nMinPage = 0;
printer.nMaxPage = 0;
printer.nCopies = 1;
printer.lCustData = 0;
printer.lpfnPrintHook = 0;
printer.lpfnSetupHook = 0;
printer.lpPrintTemplateName = 0;
printer.lpSetupTemplateName = 0;
printer.hPrintTemplate = 0;
printer.hSetupTemplate = 0;
if (PrintDlg(&printer)) {
/* do nothing */
};
}
VOID DIALOG_FileExit(VOID)
{
if (DoCloseFile()) {
PostQuitMessage(0);
}
}
VOID DIALOG_EditUndo(VOID)
{
MessageBox(Globals.hMainWnd, "Undo", "Debug", MB_ICONEXCLAMATION);
/* undo */
}
VOID DIALOG_EditCut(VOID)
{
HANDLE hMem;
hMem = GlobalAlloc(GMEM_ZEROINIT, 99);
OpenClipboard(Globals.hMainWnd);
EmptyClipboard();
/* FIXME: Get text */
lstrcpy((CHAR *)hMem, "Hello World");
SetClipboardData(CF_TEXT, hMem);
CloseClipboard();
GlobalFree(hMem);
}
VOID DIALOG_EditCopy(VOID)
{
HANDLE hMem;
hMem = GlobalAlloc(GMEM_ZEROINIT, 99);
OpenClipboard(Globals.hMainWnd);
EmptyClipboard();
/* FIXME: Get text */
lstrcpy((CHAR *)hMem, "Hello World");
SetClipboardData(CF_TEXT, hMem);
CloseClipboard();
GlobalFree(hMem);
}
VOID DIALOG_EditPaste(VOID)
{
HANDLE hClipText;
if (IsClipboardFormatAvailable(CF_TEXT)) {
OpenClipboard(Globals.hMainWnd);
hClipText = GetClipboardData(CF_TEXT);
CloseClipboard();
MessageBox(Globals.hMainWnd, (CHAR *)hClipText, "PASTE", MB_ICONEXCLAMATION);
}
}
VOID DIALOG_EditDelete(VOID)
{
/* Delete */
}
VOID DIALOG_EditSelectAll(VOID)
{
/* Select all */
}
VOID DIALOG_EditTimeDate(VOID)
{
SYSTEMTIME st;
LPSYSTEMTIME lpst = &st;
CHAR szDate[MAX_STRING_LEN];
LPSTR date = szDate;
GetLocalTime(&st);
GetDateFormat(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, lpst, NULL, date, MAX_STRING_LEN);
GetTimeFormat(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, lpst, NULL, date, MAX_STRING_LEN);
}
VOID DIALOG_EditWrap(VOID)
{
Globals.bWrapLongLines = !Globals.bWrapLongLines;
CheckMenuItem(Globals.hEditMenu, NP_EDIT_WRAP, MF_BYCOMMAND |
(Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED));
}
VOID DIALOG_Search(VOID)
{
Globals.find.lStructSize = sizeof(Globals.find);
Globals.find.hwndOwner = Globals.hMainWnd;
Globals.find.hInstance = Globals.hInstance;
Globals.find.lpstrFindWhat = (CHAR *) &Globals.szFindText;
Globals.find.wFindWhatLen = sizeof(Globals.szFindText);
Globals.find.lpstrReplaceWith = 0;
Globals.find.wReplaceWithLen = 0;
Globals.find.Flags = FR_DOWN;
Globals.find.lCustData = 0;
Globals.find.lpfnHook = 0;
Globals.find.lpTemplateName = 0;
/* We only need to create the modal FindReplace dialog which will */
/* notify us of incoming events using hMainWnd Window Messages */
Globals.hFindReplaceDlg = FindText(&Globals.find);
assert(Globals.hFindReplaceDlg !=0);
}
VOID DIALOG_SearchNext(VOID)
{
/* Search Next */
}
VOID DIALOG_HelpContents(VOID)
{
WinHelp(Globals.hMainWnd, HELPFILE, HELP_INDEX, 0);
}
VOID DIALOG_HelpSearch(VOID)
{
/* Search Help */
}
VOID DIALOG_HelpHelp(VOID)
{
WinHelp(Globals.hMainWnd, HELPFILE, HELP_HELPONHELP, 0);
}
VOID DIALOG_HelpLicense(VOID)
{
WineLicense(Globals.hMainWnd);
}
VOID DIALOG_HelpNoWarranty(VOID)
{
WineWarranty(Globals.hMainWnd);
}
VOID DIALOG_HelpAboutWine(VOID)
{
CHAR szNotepad[MAX_STRING_LEN];
LoadString(Globals.hInstance, IDS_NOTEPAD, szNotepad, sizeof(szNotepad));
ShellAbout(Globals.hMainWnd, szNotepad, "Notepad\n" /* WINE_RELEASE_INFO */, 0);
}
/***********************************************************************
*
* DIALOG_PageSetup
*/
VOID DIALOG_PageSetup(VOID)
{
WNDPROC lpfnDlg;
lpfnDlg = MakeProcInstance(DIALOG_PAGESETUP_DlgProc, Globals.hInstance);
DialogBox(Globals.hInstance, STRING_PAGESETUP_Xx, Globals.hMainWnd, (DLGPROC)lpfnDlg);
FreeProcInstance(lpfnDlg);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* DIALOG_PAGESETUP_DlgProc
*/
static LRESULT WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_COMMAND:
switch (wParam)
{
case IDOK:
/* save user input and close dialog */
GetDlgItemText(hDlg, NP_PAGESETUP_HEAD, Globals.szHeader, sizeof(Globals.szHeader));
GetDlgItemText(hDlg, NP_PAGESETUP_TAIL, Globals.szFooter, sizeof(Globals.szFooter));
GetDlgItemText(hDlg, NP_PAGESETUP_TOP, Globals.szMarginTop, sizeof(Globals.szMarginTop));
GetDlgItemText(hDlg, NP_PAGESETUP_BOTTOM, Globals.szMarginBottom, sizeof(Globals.szMarginBottom));
GetDlgItemText(hDlg, NP_PAGESETUP_LEFT, Globals.szMarginLeft, sizeof(Globals.szMarginLeft));
GetDlgItemText(hDlg, NP_PAGESETUP_RIGHT, Globals.szMarginRight, sizeof(Globals.szMarginRight));
EndDialog(hDlg, IDOK);
return TRUE;
case IDCANCEL:
/* discard user input and close dialog */
EndDialog(hDlg, IDCANCEL);
return TRUE;
case IDHELP:
/* FIXME: Bring this to work */
MessageBox(Globals.hMainWnd, "Sorry, no help available", "Help", MB_ICONEXCLAMATION);
return TRUE;
}
break;
case WM_INITDIALOG:
/* fetch last user input prior to display dialog */
SetDlgItemText(hDlg, NP_PAGESETUP_HEAD, Globals.szHeader);
SetDlgItemText(hDlg, NP_PAGESETUP_TAIL, Globals.szFooter);
SetDlgItemText(hDlg, NP_PAGESETUP_TOP, Globals.szMarginTop);
SetDlgItemText(hDlg, NP_PAGESETUP_BOTTOM, Globals.szMarginBottom);
SetDlgItemText(hDlg, NP_PAGESETUP_LEFT, Globals.szMarginLeft);
SetDlgItemText(hDlg, NP_PAGESETUP_RIGHT, Globals.szMarginRight);
break;
}
return FALSE;
}

View File

@@ -0,0 +1,39 @@
/*
* Notepad (dialog.h)
*
* Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
*/
#include "windows.h"
VOID DIALOG_FileNew(VOID);
VOID DIALOG_FileOpen(VOID);
VOID DIALOG_FileSave(VOID);
VOID DIALOG_FileSaveAs(VOID);
VOID DIALOG_FilePrint(VOID);
VOID DIALOG_FilePageSetup(VOID);
VOID DIALOG_FilePrinterSetup(VOID);
VOID DIALOG_FileExit(VOID);
VOID DIALOG_EditUndo(VOID);
VOID DIALOG_EditCut(VOID);
VOID DIALOG_EditCopy(VOID);
VOID DIALOG_EditPaste(VOID);
VOID DIALOG_EditDelete(VOID);
VOID DIALOG_EditSelectAll(VOID);
VOID DIALOG_EditTimeDate(VOID);
VOID DIALOG_EditWrap(VOID);
VOID DIALOG_Search(VOID);
VOID DIALOG_SearchNext(VOID);
VOID DIALOG_HelpContents(VOID);
VOID DIALOG_HelpSearch(VOID);
VOID DIALOG_HelpHelp(VOID);
VOID DIALOG_HelpLicense(VOID);
VOID DIALOG_HelpNoWarranty(VOID);
VOID DIALOG_HelpAboutWine(VOID);
VOID DIALOG_PageSetup(VOID);
VOID DIALOG_TimeDate(VOID);

View File

@@ -0,0 +1,79 @@
Tue Oct 12 20:31:00 1999 Gustavo Junior Alves <alves@correionet.com.br>
* [Pt.rc] [Makefile.in]
Added Portuguese language support.
Fri Mar 5 22:14:13 1999 Marcel Baur <mbaur@g26.ethz.ch>
* NEW [search.c] - Added Boyer-Moore text search
Sat Feb 6 20:25:25 1999 Marcel Baur <mbaur@g26.ethz.ch>
- Added new IDS_NOTSAVED ressource (needs translation in *.rc)
- Improved printing support (not yet complete)
- Improved file drag and drop (should now work) - General code cleanup
Thu Jan 28 18:17:08 1999 Jukka Iivonen <iivonen@iki.fi>
* [Fi.rc] [main.c] [Makefile.in]
- Added Finnish language support.
Sun Oct 18 14:11:42 1998 Marcel Baur <mbaur@g26.ethz.ch>
* [??.rc], [TODO], [dialog.c], [dialog.h], [language.c],
[language.h], [license.c], [license.h], [main.c], [main.h],
[notepad.rc]:
- Fixed GetOpenFileName and GetSaveFileName dialogs.
- Fixed Print dialog and introduced PrinterSetup dialog.
- Fixed PageSetup dialog: values are now correctly initialized
(had to change all *.rc files)
- Preliminary file drag and drop support.
Fri Jun 12 23:29:44 1998 Marcel Baur <mbaur@g26.ethz.ch>
- Fixed GetDateFormat()->GetTimeFormat() for locale time.
Mon May 25 14:30:00 1998 Henrik Olsen <henrik@iaeste.dk>
* [Da.rc]
- Added Danish language support.
Fri May 15 23:59:22 1998 Marcel Baur <mbaur@g26.ethz.ch>
- Date/Time now uses locale-specific formats
- Language-specific window caption, displays file being edited.
- Started with parsing of command line settings
- Started with DoOpenFile, DoCloseFile, DoSaveFile logics
- Prompt user to save settings when closing a file
-> Introduced a new message box (not yet finished)
- Fixed minor features (missing IDS in main.h, ...)
Sun Mar 29 20:29:41 1998 Laurent Buffler <laurent@bluewin.ch>
* [Fr.rc]
- Added French language support.
Fri Feb 27 21:03:37 1998 Karl Backstr<74>m <karl_b@geocities.com>
- Fixed some minor features.
Sat Feb 14 17:42:29 1998 Karl Backstr<74>m <karl_b@geocities.com>
* NEW [language.c] [language.h]
- Takes care of all language related stuff.
- A new [programs] in .winerc is in use.
Tue Feb 10 23:34:08 1998 Marcel Baur <mbaur@g26.ethz.ch>
- Fixed broken language menus
Fri Feb 06 23.54.35 1998 Karl Backstr<74>m <karl_b@geocities.com>
* [main.c] [main.h] [notepad.rc]
- Fixed language support for menus.
* NEW [dialog.c] [dialog.h]
- Moved all menu and dialog related stuff here.
Sun Jan 18 23:05:04 1998 Karl Backstr<74>m <karl_b@geocities.com>
* [Sw.rc]
- Added/updated Swedish language support.
Tue Dec 23 23:35:04 1997 Marcel Baur <mbaur@g26.ethz.ch>
- Fixed lots of bugs w/ resources in *.rc
- moved [notepad.c] into [main.c]
- moved [notepad.h] into [main.h]
Fri Dec 05 20:51:55 1997 Marcel Baur <mbaur@g26.ethz.ch>
* [notepad.c] [notepad.h] [notepad.rc] [En.rc] [De.rc]
[license.c] [license.h] [License_En.c]
[README] [TODO] [ChangeLog]
- Originals by Marcel Baur

View File

@@ -0,0 +1,10 @@
NOTEPAD for WINE
================
There is now a web page dedicated to Notepad for Wine I am maintaing.
Please see http://www.vis.inf.ethz.ch/students/mbaur/notepad
for latest info about Notepad.
This page also includes screenshots.
This is an early release of notepad and most of the code is still broken.
It will probably compile but the application will not make much sense yet.
Please see file TODO for things to do and keep the file ChangeLog
up to date.I also try to read wine-devel@winehq.com frequently.

View File

@@ -0,0 +1,21 @@
FIXME - and list:
* - use scroll bars (vertical done)
* - cut 'n paste
* - save file (Not started)
* - print file (Crashes Win9x)
* - find dialog
* - encapsulate data structures (?) - half done
* - free unused memory
* - solve Open problems (This seems to work)
* - smoother scrolling
* - separate view code and document code
TODO -
- Logfile feature
if Notepad opens a file with ".LOG" (really?) in the first line, the
current date/time should automatically be inserted into the last line
of the file at startup.
- Upgrade Language Support

View File

@@ -0,0 +1,132 @@
/*
* Notepad
*
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* Copyright 1998 Karl Backstr<74>m <karl_b@geocities.com>
*/
#include <stdio.h>
#include "windows.h"
#include "main.h"
#include "language.h"
CHAR STRING_MENU_Xx[] = "MENU_Xx";
CHAR STRING_PAGESETUP_Xx[] = "DIALOG_PAGESETUP_Xx";
void LANGUAGE_UpdateWindowCaption(void) {
/* Sets the caption of the main window according to Globals.szFileName:
Notepad - (untitled) if no file is open
Notepad - [filename] if a file is given
*/
CHAR szCaption[MAX_STRING_LEN];
CHAR szUntitled[MAX_STRING_LEN];
LoadString(Globals.hInstance, IDS_NOTEPAD, szCaption, sizeof(szCaption));
if (strlen(Globals.szFileName)>0) {
lstrcat(szCaption, " - [");
lstrcat(szCaption, Globals.szFileName);
lstrcat(szCaption, "]");
}
else
{
LoadString(Globals.hInstance, IDS_UNTITLED, szUntitled, sizeof(szUntitled));
lstrcat(szCaption, " - ");
lstrcat(szCaption, szUntitled);
}
SetWindowText(Globals.hMainWnd, szCaption);
}
static BOOL LANGUAGE_LoadStringOther(UINT num, UINT ids, LPSTR str, UINT len)
{
BOOL bOk;
ids -= Globals.wStringTableOffset;
ids += num * 0x100;
bOk = LoadString(Globals.hInstance, ids, str, len);
return(bOk);
}
VOID LANGUAGE_SelectByName(LPCSTR lang)
{
INT i;
CHAR newlang[3];
for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
if (LANGUAGE_LoadStringOther(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)) &&
!lstrcmp(lang, newlang))
{
LANGUAGE_SelectByNumber(i);
return;
}
/* Fallback */
for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
if (LANGUAGE_LoadStringOther(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)))
{
LANGUAGE_SelectByNumber(i);
return;
}
MessageBox(Globals.hMainWnd, "No language found", "FATAL ERROR", MB_OK);
PostQuitMessage(1);
}
VOID LANGUAGE_SelectByNumber(UINT num)
{
INT i;
CHAR lang[3];
CHAR item[MAX_STRING_LEN];
HMENU hMainMenu;
/* Select string table */
Globals.wStringTableOffset = num * 0x100;
/* Get Language id */
LoadString(Globals.hInstance, IDS_LANGUAGE_ID, lang, sizeof(lang));
/* Set frame caption */
LANGUAGE_UpdateWindowCaption();
/* Change Resource names */
lstrcpyn(STRING_MENU_Xx + sizeof(STRING_MENU_Xx) - 3, lang, 3);
lstrcpyn(STRING_PAGESETUP_Xx + sizeof(STRING_PAGESETUP_Xx) - 3, lang, 3);
/* Create menu */
hMainMenu = LoadMenu(Globals.hInstance, STRING_MENU_Xx);
Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
Globals.hEditMenu = GetSubMenu(hMainMenu, 1);
Globals.hSearchMenu = GetSubMenu(hMainMenu, 2);
Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
Globals.hHelpMenu = GetSubMenu(hMainMenu, 4);
/* Remove dummy item */
RemoveMenu(Globals.hLanguageMenu, 0, MF_BYPOSITION);
/* Add language items */
for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
if (LANGUAGE_LoadStringOther(i, IDS_LANGUAGE_MENU_ITEM, item, sizeof(item)))
AppendMenu(Globals.hLanguageMenu, MF_STRING | MF_BYCOMMAND,
NP_FIRST_LANGUAGE + i, item);
SetMenu(Globals.hMainWnd, hMainMenu);
/* Destroy old menu */
if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
Globals.hMainMenu = hMainMenu;
}
VOID LANGUAGE_DefaultHandle(WPARAM wParam)
{
if ((wParam >=NP_FIRST_LANGUAGE) && (wParam<=NP_LAST_LANGUAGE))
LANGUAGE_SelectByNumber(wParam - NP_FIRST_LANGUAGE);
else printf("Unimplemented menu command %i\n", wParam);
}

View File

@@ -0,0 +1,12 @@
/*
* Notepad
*
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* Copyright 1998 Karl Backstr<74>m <karl_b@geocities.com>
*/
VOID LANGUAGE_UpdateWindowCaption(VOID);
VOID LANGUAGE_SelectByNumber(UINT num);
VOID LANGUAGE_SelectByName(LPCSTR lang);
VOID LANGUAGE_DefaultHandle(WPARAM wParam);

View File

@@ -0,0 +1,39 @@
/*
* lcc.h
*
* Copyright 1999 by Marcel Baur <mbaur@g26.ethz.ch>
* To be distributed under the Wine license
*
* This file is only required when compiling Notepad using LCC-WIN32
*/
#ifdef LCC
#include <assert.h>
#include "shellapi.h"
#define HANDLE HANDLE
#define INVALID_HANDLE_VALUE INVALID_HANDLE_VALUE
#define WINE_RELEASE_INFO "Compiled using LCC"
#define OIC_WINLOGO 0
#ifndef LCC_HASASSERT
/* prevent multiple inclusion of assert methods */
int _assertfail(char *__msg, char *__cond, char *__file, int __line) {
CHAR szMessage[255];
strcat(szMessage, "Assert failure ");
strcat(szMessage, __msg);
strcat(szMessage, "\n");
strcat(szMessage, "in line ");
strcat(szMessage, "of file ");
strcat(szMessage, __line);
MessageBox(0, szMessage, "ERROR: ASSERT FAILURE", MB_ICONEXCLAMATION);
}
#endif
#endif

View File

@@ -0,0 +1,89 @@
#
# Makefile for LCC-WIN32
#
# Copyright 1999 Marcel Baur (mbaur@g26.ethz.ch)
# To be distributed under the Wine License
#
# Use lccmake -f lccmake to use this makefile
#
# See http://www.cs.virgina.edu/~lcc-win32 for
# information about LCC-WIN32
#
#
# LCC home directory
#
LCCHOME=C:\LCC
#
# individual flags for LCC, LCCLNK, LRC
#
CFLAGS=-O -DLCC -g2
LNKFLAGS=-O winepad.exe -subsystem windows
LRCFLAGS=/r /v /m
#
# available languages
#
LANGUAGES=Da De En Es Fi Fr Sw
#
# default language
#
LANGUAGE=En
#
# required include libraries
#
LIBS=SHELL32.LIB
#
# object files
#
OBJS=main.obj dialog.obj license.obj license_En.obj language.obj
#
# ---[ it is save not to change anything behind this line ]--- #
#
winepad.exe: $(OBJS) resources
$(LCCHOME)\bin\lcclnk $(LNKFLAGS) $(OBJS) notepad.res $(LIBS)
@echo *** "winepad.exe" successfully created
resources: $(RESOURCES)
FOR %%i IN ($(LANGUAGES)) DO $(LCCHOME)\bin\lrc $(LRCFLAGS) %%i.rc
copy /b $(LANGUAGE).res notepad.res
clean:
if exist winepad.exe erase winepad.exe
if exist main.obj erase main.obj
if exist dialog.obj erase dialog.obj
if exist license.obj erase license.obj
if exist license_En.obj erase license_En.obj
if exist language.obj erase language.obj
if exist notepad.res erase notepad.res
FOR %%i IN ($(LANGUAGES)) DO IF EXIST %%i.res erase %%i.res
FOR %%i IN ($(LANGUAGES)) DO IF EXIST %%i.map erase %%i.map
help:
@echo lccmake help - display this help
@echo lccmake - to compile winepad.exe
@echo lccmake resources - to compile .res files
@echo lccmake clean - to clean up
#
# some more targets (for novice users and compatibility reasons only)
#
distclean: clean
@echo *** next time please use "lccmake clean"
all: winepad.exe
@echo *** next time please use "lccmake" (without parameters)
#
# please make sure that at least one empty line follows this statement
#

View File

@@ -0,0 +1,27 @@
/*
* Notepad (license.h)
*
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* To be distributed under the Wine License
*/
#include "windows.h"
#include "license.h"
VOID WineLicense(HWND Wnd)
{
/* FIXME: should load strings from resources */
LICENSE *License = &WineLicense_En;
MessageBox(Wnd, License->License, License->LicenseCaption,
MB_ICONINFORMATION | MB_OK);
}
VOID WineWarranty(HWND Wnd)
{
/* FIXME: should load strings from resources */
LICENSE *License = &WineLicense_En;
MessageBox(Wnd, License->Warranty, License->WarrantyCaption,
MB_ICONEXCLAMATION | MB_OK);
}

View File

@@ -0,0 +1,39 @@
/*
* Notepad (license.h)
*
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* To be distributed under the Wine License
*/
VOID WineLicense(HWND hWnd);
VOID WineWarranty(HWND hWnd);
typedef struct
{
LPCSTR License, LicenseCaption;
LPCSTR Warranty, WarrantyCaption;
} LICENSE;
/*
extern LICENSE WineLicense_Ca;
extern LICENSE WineLicense_Cz;
extern LICENSE WineLicense_Da;
extern LICENSE WineLicense_De;
*/
extern LICENSE WineLicense_En;
/*
extern LICENSE WineLicense_Eo;
extern LICENSE WineLicense_Es;
extern LICENSE WineLicense_Fi;
extern LICENSE WineLicense_Fr;
extern LICENSE WineLicense_Hu;
extern LICENSE WineLicense_It;
extern LICENSE WineLicense_Ko;
extern LICENSE WineLicense_No;
extern LICENSE WineLicense_Pl;
extern LICENSE WineLicense_Po;
extern LICENSE WineLicense_Sw;
extern LICENSE WineLicense_Va;
*/

View File

@@ -0,0 +1,982 @@
/*
* Notepad
*
* Copyright 2000 Mike McCormack <Mike_McCormack@looksmart.com.au>
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* To be distributed under the Wine License
*
* FIXME,TODO list:
* - Use wine Heap instead of malloc/free (done)
* - use scroll bars (vertical done)
* - cut 'n paste (clipboard)
* - save file
* - print file
* - find dialog
* - encapsulate data structures (?) - half done
* - free unused memory
* - solve Open problems
* - smoother scrolling
* - separate view code and document code
*
* This program is intended as a testbed for winelib as much as
* a useful application.
*/
#include <stdio.h>
#include "windows.h"
#ifdef LCC
#include "lcc.h"
#endif
#include "main.h"
#include "license.h"
#include "dialog.h"
#include "language.h"
extern BOOL DoCloseFile(void);
extern void DoOpenFile(LPCSTR szFileName);
NOTEPAD_GLOBALS Globals;
/* Using a pointer to pointer data structure to
achieve a little more efficiency. Hopefully
it will be worth it, because it complicates the
code - mjm 26 Jun 2000 */
#define BUFFERCHUNKSIZE 0xe0
typedef struct TAGLine {
LPSTR lpLine;
DWORD dwWidth;
DWORD dwMaxWidth;
} LINE, *LPLINE;
/* FIXME: make this info into a structure */
/* typedef struct tagBUFFER { */
DWORD dwVOffset=0;
DWORD dwLines=0;
DWORD dwMaxLines=0;
LPLINE lpBuffer=NULL;
DWORD dwXpos=0,dwYpos=0; /* position of caret in char coords */
DWORD dwCaretXpos=0,dwCaretYpos=0; /* position of caret in pixel coords */
TEXTMETRIC tm; /* textmetric for current font */
RECT rectClient; /* client rectangle of the window we're drawing in */
/* } BUFFER, *LPBUFFER */
VOID InitFontInfo(HWND hWnd)
{
HDC hDC = GetDC(hWnd);
if(hDC)
{
GetTextMetrics(hDC, &tm);
ReleaseDC(hWnd,hDC);
}
}
void InitBuffer(void)
{
lpBuffer = NULL;
dwLines = 0;
dwMaxLines = 0;
dwXpos=0;
dwYpos=0;
}
/* convert x,y character co-ords into x pixel co-ord */
DWORD CalcStringWidth(HDC hDC, DWORD x, DWORD y)
{
DWORD len;
SIZE size;
size.cx = 0;
size.cy = 0;
if(y>dwLines)
return size.cx;
if(lpBuffer == NULL)
return size.cx;
if(lpBuffer[y].lpLine == NULL)
return size.cx;
len = (x<lpBuffer[y].dwWidth) ?
x : lpBuffer[y].dwWidth;
GetTextExtentPoint(hDC, lpBuffer[y].lpLine, len, &size);
return size.cx;
}
void CalcCaretPos(HDC hDC, DWORD dwXpos, DWORD dwYpos)
{
dwCaretXpos = CalcStringWidth(hDC, dwXpos, dwYpos);
dwCaretYpos = tm.tmHeight*(dwYpos-dwVOffset);
SetCaretPos(dwCaretXpos,dwCaretYpos);
}
DWORD GetLinesPerPage(HWND hWnd)
{
return (rectClient.bottom/tm.tmHeight); /* round down */
}
/* render one line of text and blank space */
void RenderLine(HDC hDC, DWORD lineno)
{
RECT rect;
HBRUSH hPrev;
if(!hDC)
return;
/* erase the space at the end of a line using a white rectangle */
rect.top = tm.tmHeight*(lineno-dwVOffset);
rect.bottom = tm.tmHeight*(lineno-dwVOffset+1);
if(lpBuffer && (lineno<dwLines))
rect.left = CalcStringWidth(hDC, lpBuffer[lineno].dwWidth,lineno);
else
rect.left = 0;
rect.right = rectClient.right;
/* use the white pen so there's not outline */
hPrev = SelectObject(hDC, GetStockObject(WHITE_PEN));
Rectangle(hDC, rect.left, rect.top, rect.right, rect.bottom);
SelectObject(hDC, hPrev);
if(lpBuffer && lpBuffer[lineno].lpLine)
{
TextOut(hDC, 0, rect.top, lpBuffer[lineno].lpLine,
lpBuffer[lineno].dwWidth);
}
}
/*
* Paint the buffer onto the window.
*/
void RenderWindow(HDC hDC) {
DWORD i;
if(!hDC)
return;
/* FIXME: render only necessary lines */
for(i = dwVOffset; i < (dwVOffset+GetLinesPerPage(0)); i++)
{
RenderLine(hDC,i);
}
}
/*
* Check that correct buffers exist to access line y pos x
* Only manages memory.
*
* Returns TRUE if the line is accessable
* FALSE if there is a problem
*/
BOOL ValidateLine(DWORD y,DWORD x)
{
DWORD max;
/* check to see that the BUFFER has enough lines */
max = dwMaxLines;
if( (max<=y) || (lpBuffer == NULL))
{
while(max<=y)
max += BUFFERCHUNKSIZE;
/* use GlobalAlloc first time round */
if(lpBuffer)
lpBuffer = (LPLINE) GlobalReAlloc((HGLOBAL)lpBuffer,GMEM_FIXED,
max*sizeof(LINE)) ;
else
lpBuffer = (LPLINE) GlobalAlloc(GMEM_FIXED, max*sizeof(LINE));
if(lpBuffer == NULL)
return FALSE;
ZeroMemory(&lpBuffer[dwLines], sizeof(LINE)*(max-dwLines) );
dwMaxLines = max;
}
/* check to see that the LINE is wide enough */
max = lpBuffer[y].dwMaxWidth;
if( (max <= x) || (lpBuffer[y].lpLine == NULL) )
{
while(max <= x)
max += BUFFERCHUNKSIZE;
/* use GlobalAlloc first */
if(lpBuffer[y].lpLine)
lpBuffer[y].lpLine = (LPSTR)GlobalReAlloc((HGLOBAL)lpBuffer[y].lpLine,
GMEM_FIXED, max) ;
else
lpBuffer[y].lpLine = (LPSTR)GlobalAlloc( GMEM_FIXED, max);
if(lpBuffer[y].lpLine == NULL)
return FALSE;
lpBuffer[y].dwWidth = 0;
lpBuffer[y].dwMaxWidth = max;
}
return TRUE;
}
/* inserts a new line into the buffer */
BOOL DoNewLine(HDC hDC)
{
DWORD i,cnt;
LPSTR src,dst;
/* check to see if we need more memory for the buffer pointers */
if(!ValidateLine(dwLines,0))
return FALSE;
/* shuffle up all the lines */
for(i=dwLines; i>(dwYpos+1); i--)
{
lpBuffer[i] = lpBuffer[i-1];
RenderLine(hDC,i);
}
ZeroMemory(&lpBuffer[dwYpos+1],sizeof(LINE));
/* copy the characters after the carat (if any) to the next line */
src = &lpBuffer[dwYpos].lpLine[dwXpos];
cnt = lpBuffer[dwYpos].dwWidth-dwXpos;
if(!ValidateLine(dwYpos+1,cnt)) /* allocates the buffer */
return FALSE; /* FIXME */
dst = &lpBuffer[dwYpos+1].lpLine[0];
memcpy(dst, src, cnt);
lpBuffer[dwYpos+1].dwWidth = cnt;
lpBuffer[dwYpos].dwWidth -= cnt;
/* move the cursor */
dwLines++;
dwXpos = 0;
dwYpos++;
/* update the window */
RenderLine(hDC, dwYpos-1);
RenderLine(hDC, dwYpos);
CalcCaretPos(hDC, dwXpos, dwYpos);
/* FIXME: don't use globals */
SetScrollRange(Globals.hMainWnd, SB_VERT, 0, dwLines, TRUE);
return TRUE;
}
/*
* Attempt a basic edit buffer
*/
BOOL AddCharToBuffer(HDC hDC, char ch)
{
/* we can use lpBuffer[dwYpos] */
if(!ValidateLine(dwYpos,0))
return FALSE;
/* shuffle the rest of the line*/
if(!ValidateLine(dwYpos, lpBuffer[dwYpos].dwWidth))
return FALSE;
lpBuffer[dwYpos].dwWidth++;
memmove(&lpBuffer[dwYpos].lpLine[dwXpos+1],
&lpBuffer[dwYpos].lpLine[dwXpos],
lpBuffer[dwYpos].dwWidth-dwXpos);
/* add the character */
lpBuffer[dwYpos].lpLine[dwXpos] = ch;
if(dwLines == 0)
dwLines++;
dwXpos++;
/* update the window and cursor position */
RenderLine(hDC,dwYpos);
CalcCaretPos(hDC,dwXpos,dwYpos);
return TRUE;
}
/* erase a character */
BOOL DoBackSpace(HDC hDC)
{
DWORD i;
if(lpBuffer == NULL)
return FALSE;
if(lpBuffer[dwYpos].lpLine && (dwXpos>0))
{
dwXpos --;
/* FIXME: use memmove */
for(i=dwXpos; i<(lpBuffer[dwYpos].dwWidth-1); i++)
lpBuffer[dwYpos].lpLine[i]=lpBuffer[dwYpos].lpLine[i+1];
lpBuffer[dwYpos].dwWidth--;
RenderLine(hDC, dwYpos);
CalcCaretPos(hDC,dwXpos,dwYpos);
}
else
{
/* Erase a newline. To do this we join two lines */
LPSTR src, dest;
DWORD len, oldlen;
if(dwYpos==0)
return FALSE;
oldlen = lpBuffer[dwYpos-1].dwWidth;
if(lpBuffer[dwYpos-1].lpLine&&lpBuffer[dwYpos].lpLine)
{
/* concatonate to the end of the line above line */
src = &lpBuffer[dwYpos].lpLine[0];
dest = &lpBuffer[dwYpos-1].lpLine[lpBuffer[dwYpos-1].dwWidth];
len = lpBuffer[dwYpos].dwWidth;
/* check the length of the new line */
if(!ValidateLine(dwYpos-1,lpBuffer[dwYpos-1].dwWidth + len))
return FALSE;
memcpy(dest,src,len);
lpBuffer[dwYpos-1].dwWidth+=len;
GlobalFree( (HGLOBAL)lpBuffer[dwYpos].lpLine);
}
else if (!lpBuffer[dwYpos-1].lpLine)
{
lpBuffer[dwYpos-1]=lpBuffer[dwYpos];
} /* else both are NULL */
RenderLine(hDC,dwYpos-1);
/* don't zero - it's going to get trashed anyhow */
/* shuffle up all the lines below this one */
for(i=dwYpos; i<(dwLines-1); i++)
{
lpBuffer[i] = lpBuffer[i+1];
RenderLine(hDC,i);
}
/* clear the last line */
ZeroMemory(&lpBuffer[dwLines-1],sizeof (LINE));
RenderLine(hDC,dwLines-1);
dwLines--;
/* adjust the cursor position to joining point */
dwYpos--;
dwXpos = oldlen;
CalcCaretPos(hDC,dwXpos,dwYpos);
SetScrollRange(Globals.hMainWnd, SB_VERT, 0, dwLines, TRUE);
}
return TRUE;
}
/* as used by File->New */
void TrashBuffer(void)
{
DWORD i;
/* variables belonging to the buffer */
if(lpBuffer)
{
for(i=0; i<dwLines; i++)
{
if(lpBuffer[i].lpLine)
GlobalFree ((HGLOBAL)lpBuffer[i].lpLine);
ZeroMemory(&lpBuffer[i],sizeof (LINE));
}
GlobalFree((HGLOBAL)lpBuffer);
lpBuffer=NULL;
}
dwLines = 0;
dwMaxLines = 0;
/* variables belonging to the view */
dwXpos = 0;
dwYpos = 0;
dwVOffset = 0 ;
/* FIXME: don't use globals */
SetScrollPos(Globals.hMainWnd, SB_VERT, dwVOffset, FALSE);
SetScrollRange(Globals.hMainWnd, SB_VERT, 0, dwLines, TRUE);
}
/*
* Add a line to the buffer
*/
/* FIXME: this breaks lines longer than BUFFERCHUNKSIZE */
DWORD CreateLine(
LPSTR buffer, /* pointer to buffer with file data */
DWORD size, /* number of bytes available in buffer */
BOOL nomore)
{
DWORD i;
if(size == 0)
return 0;
for(i=0; i<size; i++)
{
if(buffer[i]==0x0a)
{
if(ValidateLine(dwLines,i))
{
memcpy(&lpBuffer[dwLines].lpLine[0],&buffer[0],i);
lpBuffer[dwLines].dwWidth = i;
dwLines++;
}
return i+1;
}
}
/* make a line of the rest */
if( (i == BUFFERCHUNKSIZE) || nomore )
{
if(ValidateLine(dwLines,i))
{
memcpy(&lpBuffer[dwLines].lpLine[0],&buffer[0],i);
lpBuffer[dwLines].dwWidth = i;
dwLines++;
}
return i;
}
return 0;
}
/*
* This is probably overcomplicated by lpBuffer data structure...
* Read blocks from the file, then add each line from the
* block to the buffer until there is none left. If all
* a slab isn't used, try load some more data from the file.
*/
void LoadBufferFromFile(LPCSTR szFileName)
{
HANDLE hFile;
CHAR *pTemp;
DWORD size,i,len,bytes_left,bytes_read;
hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
return;
size = BUFFERCHUNKSIZE;
pTemp = (LPSTR) GlobalAlloc(GMEM_FIXED, size);
if(!pTemp)
return;
bytes_read = 1; /* anything non-zero */
bytes_left = 0;
while(bytes_read)
{
if(!ReadFile(hFile,
&pTemp[bytes_left],
size-bytes_left,
&bytes_read, NULL))
break;
bytes_left+=bytes_read;
/* add strings to buffer */
for(i = 0;
(i<size) &&
(len = CreateLine(&pTemp[i], bytes_left, !bytes_read));
i+= len,bytes_left-=len );
/* move leftover to front of buffer */
if(bytes_left)
memmove(&pTemp[0],&pTemp[i], bytes_left);
}
CloseHandle(hFile);
MessageBox(Globals.hMainWnd, "Finished", "Info", MB_OK);
}
BOOL DoInput(HDC hDC, WPARAM wParam, LPARAM lParam)
{
switch(wParam)
{
case 0x08:
return DoBackSpace(hDC);
case 0x0d:
return DoNewLine(hDC);
default:
return AddCharToBuffer(hDC,wParam);
}
}
BOOL GotoHome(HWND hWnd)
{
dwXpos = 0;
dwYpos = 0;
dwVOffset = 0;
return TRUE;
}
BOOL GotoEndOfLine(HWND hWnd)
{
dwXpos = lpBuffer[dwYpos].dwWidth;
return TRUE;
}
BOOL GotoDown(HWND hWnd)
{
if((dwYpos+1) >= dwLines)
{
return FALSE;
}
dwYpos++;
if (dwXpos>lpBuffer[dwYpos].dwWidth)
GotoEndOfLine(hWnd);
return TRUE;
}
BOOL GotoUp(HWND hWnd)
{
if(dwYpos==0)
return FALSE;
dwYpos--;
if (dwXpos>lpBuffer[dwYpos].dwWidth)
GotoEndOfLine(hWnd);
return TRUE;
}
BOOL GotoLeft(HWND hWnd)
{
if(dwXpos > 0)
{
dwXpos--;
return TRUE;
}
if(GotoUp(hWnd))
return GotoEndOfLine(hWnd);
return FALSE;
}
BOOL GotoRight(HWND hWnd)
{
if(dwXpos<lpBuffer[dwYpos].dwWidth)
{
dwXpos++;
return TRUE;
}
if(!GotoDown(hWnd))
return FALSE;
dwXpos=0;
return TRUE;
}
/* check the caret is still on the screen */
BOOL ScrollABit(HWND hWnd)
{
if(dwYpos<dwVOffset)
{
dwVOffset = dwYpos;
return TRUE;
}
if(dwYpos>(dwVOffset+GetLinesPerPage(hWnd)))
{
dwVOffset = dwYpos - GetLinesPerPage(hWnd) + 1;
return TRUE;
}
return FALSE;
}
/* FIXME: move the window around so we can still see the caret */
VOID DoEdit(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
HDC hDC;
if(lpBuffer==NULL)
return;
switch(wParam)
{
case VK_HOME: GotoHome(hWnd);
break;
case VK_END: GotoEndOfLine(hWnd);
break;
case VK_LEFT: GotoLeft(hWnd);
break;
case VK_RIGHT: GotoRight(hWnd);
break;
case VK_DOWN: GotoDown(hWnd);
break;
case VK_UP: GotoUp(hWnd);
break;
default:
return;
}
hDC = GetDC(hWnd);
if(hDC)
{
CalcCaretPos(hDC, dwXpos, dwYpos);
ReleaseDC(hWnd,hDC);
}
if(ScrollABit(hWnd))
InvalidateRect(hWnd, NULL, FALSE);
}
void ButtonDownToCaretPos(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
DWORD x, y, caretx, carety;
BOOL refine_guess = TRUE;
HDC hDC;
x = LOWORD(lParam);
y = HIWORD(lParam);
caretx = x/tm.tmAveCharWidth; /* guess */
carety = dwVOffset + y/tm.tmHeight;
hDC = GetDC(hWnd);
if(lpBuffer == NULL)
{
caretx = 0;
carety = 0;
refine_guess = FALSE;
}
/* if the cursor is past the bottom, put it after the last char */
if(refine_guess && (carety>=dwLines) )
{
carety=dwLines-1;
caretx=lpBuffer[carety].dwWidth;
refine_guess = FALSE;
}
/* cursor past end of line? */
if(refine_guess && (x>CalcStringWidth(hDC,lpBuffer[carety].dwWidth,carety)))
{
caretx = lpBuffer[carety].dwWidth;
refine_guess = FALSE;
}
/* FIXME: doesn't round properly */
if(refine_guess)
{
if(CalcStringWidth(hDC,caretx,carety)<x)
{
while( (caretx<lpBuffer[carety].dwWidth) &&
(CalcStringWidth(hDC,caretx+1,carety)<x))
caretx++;
}
else
{
while((caretx>0)&&(CalcStringWidth(hDC,caretx-1,carety)>x))
caretx--;
}
}
/* set the caret's position */
dwXpos = caretx;
dwYpos = carety;
CalcCaretPos(hDC, caretx, carety);
ReleaseDC(hWnd,hDC);
}
void DoScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
DWORD dy = GetLinesPerPage(hWnd);
switch(wParam) /* vscroll code */
{
case SB_LINEUP:
if(dwVOffset)
dwVOffset--;
break;
case SB_LINEDOWN:
if(dwVOffset<dwLines)
dwVOffset++;
break;
case SB_PAGEUP:
if( (dy+dwVOffset) > dwLines)
dwVOffset = dwLines - 1;
break;
case SB_PAGEDOWN:
if( dy > dwVOffset)
dwVOffset=0;
break;
}
/* position scroll */
SetScrollPos(hWnd, SB_VERT, dwVOffset, TRUE);
}
/***********************************************************************
*
* NOTEPAD_MenuCommand
*
* All handling of main menu events
*/
int NOTEPAD_MenuCommand (WPARAM wParam)
{
switch (wParam) {
case NP_FILE_NEW: DIALOG_FileNew(); break;
case NP_FILE_OPEN: DIALOG_FileOpen(); break;
case NP_FILE_SAVE: DIALOG_FileSave(); break;
case NP_FILE_SAVEAS: DIALOG_FileSaveAs(); break;
case NP_FILE_PRINT: DIALOG_FilePrint(); break;
case NP_FILE_PAGESETUP: DIALOG_FilePageSetup(); break;
case NP_FILE_PRINTSETUP: DIALOG_FilePrinterSetup();break;
case NP_FILE_EXIT: DIALOG_FileExit(); break;
case NP_EDIT_UNDO: DIALOG_EditUndo(); break;
case NP_EDIT_CUT: DIALOG_EditCut(); break;
case NP_EDIT_COPY: DIALOG_EditCopy(); break;
case NP_EDIT_PASTE: DIALOG_EditPaste(); break;
case NP_EDIT_DELETE: DIALOG_EditDelete(); break;
case NP_EDIT_SELECTALL: DIALOG_EditSelectAll(); break;
case NP_EDIT_TIMEDATE: DIALOG_EditTimeDate();break;
case NP_EDIT_WRAP: DIALOG_EditWrap(); break;
case NP_SEARCH_SEARCH: DIALOG_Search(); break;
case NP_SEARCH_NEXT: DIALOG_SearchNext(); break;
case NP_HELP_CONTENTS: DIALOG_HelpContents(); break;
case NP_HELP_SEARCH: DIALOG_HelpSearch(); break;
case NP_HELP_ON_HELP: DIALOG_HelpHelp(); break;
case NP_HELP_LICENSE: DIALOG_HelpLicense(); break;
case NP_HELP_NO_WARRANTY: DIALOG_HelpNoWarranty(); break;
case NP_HELP_ABOUT_WINE: DIALOG_HelpAboutWine(); break;
/* Handle languages */
default:
LANGUAGE_DefaultHandle(wParam);
}
return 0;
}
/***********************************************************************
*
* NOTEPAD_WndProc
*/
LRESULT WINAPI NOTEPAD_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hContext;
HANDLE hDrop; /* drag & drop */
CHAR szFileName[MAX_STRING_LEN];
RECT Windowsize;
lstrcpy(szFileName, "");
switch (msg) {
case WM_CREATE:
GetClientRect(hWnd, &rectClient);
InitFontInfo(hWnd);
break;
case WM_SETFOCUS:
CreateCaret(Globals.hMainWnd, 0, 1, tm.tmHeight);
SetCaretPos(dwCaretXpos, dwCaretYpos);
ShowCaret(Globals.hMainWnd);
break;
case WM_KILLFOCUS:
DestroyCaret();
break;
case WM_PAINT:
GetClientRect(hWnd, &rectClient);
hContext = BeginPaint(hWnd, &ps);
RenderWindow(hContext);
EndPaint(hWnd, &ps);
break;
case WM_KEYDOWN:
DoEdit(hWnd, wParam, lParam);
break;
case WM_CHAR:
GetClientRect(hWnd, &rectClient);
HideCaret(hWnd);
hContext = GetDC(hWnd);
DoInput(hContext,wParam,lParam);
ReleaseDC(hWnd,hContext);
ShowCaret(hWnd);
break;
case WM_LBUTTONDOWN:
/* figure out where the mouse was clicked */
ButtonDownToCaretPos(hWnd, wParam, lParam);
break;
case WM_VSCROLL:
DoScroll(hWnd, wParam, lParam);
InvalidateRect(hWnd, NULL, FALSE); /* force a redraw */
break;
case WM_COMMAND:
/* FIXME: this is a bit messy */
NOTEPAD_MenuCommand(wParam);
InvalidateRect(hWnd, NULL, FALSE); /* force a redraw */
hContext = GetDC(hWnd);
CalcCaretPos(hContext,dwXpos,dwYpos);
ReleaseDC(hWnd,hContext);
break;
case WM_DESTROYCLIPBOARD:
MessageBox(Globals.hMainWnd, "Empty clipboard", "Debug", MB_ICONEXCLAMATION);
break;
case WM_CLOSE:
if (DoCloseFile()) {
PostQuitMessage(0);
}
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_SIZE:
GetClientRect(Globals.hMainWnd, &Windowsize);
break;
case WM_DROPFILES:
/* User has dropped a file into main window */
hDrop = (HANDLE) wParam;
DragQueryFile(hDrop, 0, (CHAR *) &szFileName, sizeof(szFileName));
DragFinish(hDrop);
DoOpenFile(szFileName);
break;
default:
return DefWindowProc (hWnd, msg, wParam, lParam);
}
return 0l;
}
/***********************************************************************
*
* WinMain
*/
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
{
MSG msg;
WNDCLASS class;
char className[] = "NPClass"; /* To make sure className >= 0x10000 */
char winName[] = "Notepad";
/* setup buffer */
InitBuffer();
/* Setup Globals */
Globals.lpszIniFile = "notepad.ini";
Globals.lpszIcoFile = "notepad.ico";
Globals.hInstance = hInstance;
#ifndef LCC
Globals.hMainIcon = ExtractIcon(Globals.hInstance,
Globals.lpszIcoFile, 0);
#endif
/* icon breakage in ros
if (!Globals.hMainIcon) {
Globals.hMainIcon = LoadIcon(0, MAKEINTRESOURCE(DEFAULTICON));
}
*/
lstrcpy(Globals.szFindText, "");
lstrcpy(Globals.szFileName, "");
lstrcpy(Globals.szMarginTop, "25 mm");
lstrcpy(Globals.szMarginBottom, "25 mm");
lstrcpy(Globals.szMarginLeft, "20 mm");
lstrcpy(Globals.szMarginRight, "20 mm");
lstrcpy(Globals.szHeader, "&n");
lstrcpy(Globals.szFooter, "Page &s");
lstrcpy(Globals.Buffer, "Hello World");
if (!prev){
class.style = CS_HREDRAW | CS_VREDRAW;
class.lpfnWndProc = NOTEPAD_WndProc;
class.cbClsExtra = 0;
class.cbWndExtra = 0;
class.hInstance = Globals.hInstance;
class.hIcon = LoadIcon (0, IDI_APPLICATION);
class.hCursor = LoadCursor (0, IDC_ARROW);
class.hbrBackground = GetStockObject (WHITE_BRUSH);
class.lpszMenuName = 0;
class.lpszClassName = className;
}
if (!RegisterClass (&class)) return FALSE;
/* Setup windows */
Globals.hMainWnd = CreateWindow (className, winName,
WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
LoadMenu(Globals.hInstance, STRING_MENU_Xx),
Globals.hInstance, 0);
Globals.hFindReplaceDlg = 0;
LANGUAGE_SelectByNumber(0);
SetMenu(Globals.hMainWnd, Globals.hMainMenu);
ShowWindow (Globals.hMainWnd, show);
UpdateWindow (Globals.hMainWnd);
/* Set up dialogs */
/* Identify Messages originating from FindReplace */
Globals.nCommdlgFindReplaceMsg = RegisterWindowMessage("commdlg_FindReplace");
if (Globals.nCommdlgFindReplaceMsg==0) {
MessageBox(Globals.hMainWnd, "Could not register commdlg_FindReplace window message",
"Error", MB_ICONEXCLAMATION);
}
/* now handle command line */
while (*cmdline && (*cmdline == ' ' || *cmdline == '-'))
{
CHAR option;
/* LPCSTR topic_id; */
if (*cmdline++ == ' ') continue;
option = *cmdline;
if (option) cmdline++;
while (*cmdline && *cmdline == ' ') cmdline++;
switch(option)
{
case 'p':
case 'P': printf("Print file: ");
/* Not yet able to print a file */
break;
}
}
/* Set up Drag&Drop */
DragAcceptFiles(Globals.hMainWnd, TRUE);
/* now enter mesage loop */
while (GetMessage (&msg, 0, 0, 0)) {
/* Message belongs to FindReplace dialog */
/* We just let IsDialogMessage handle it */
/* BTW - DnD is broken under ROS */
/* if (IsDialogMessage(Globals.hFindReplaceDlg, &msg)!=0) {
}
else */
{
/* Message belongs to the Notepad Main Window */
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
return 0;
}

View File

@@ -0,0 +1,148 @@
/*
* Notepad (notepad.h)
*
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* To be distributed under the Wine License
*/
#define MAX_STRING_LEN 255
#define MAX_PATHNAME_LEN 1024
#define MAX_LANGUAGE_NUMBER (NP_LAST_LANGUAGE - NP_FIRST_LANGUAGE)
#define HELPFILE "notepad.hlp"
#define LOGPREFIX ".LOG"
#define DEFAULTICON OIC_WINLOGO
/* hide the following from winerc */
#ifndef RC_INVOKED
typedef struct
{
HANDLE hInstance;
HWND hMainWnd;
HWND hFindReplaceDlg;
HICON hMainIcon;
HICON hDefaultIcon;
HMENU hMainMenu;
HMENU hFileMenu;
HMENU hEditMenu;
HMENU hSearchMenu;
HMENU hLanguageMenu;
HMENU hHelpMenu;
LPCSTR lpszIniFile;
LPCSTR lpszIcoFile;
UINT wStringTableOffset;
BOOL bWrapLongLines;
CHAR szFindText[MAX_PATHNAME_LEN];
CHAR szReplaceText[MAX_PATHNAME_LEN];
CHAR szFileName[MAX_PATHNAME_LEN];
CHAR szMarginTop[MAX_PATHNAME_LEN];
CHAR szMarginBottom[MAX_PATHNAME_LEN];
CHAR szMarginLeft[MAX_PATHNAME_LEN];
CHAR szMarginRight[MAX_PATHNAME_LEN];
CHAR szHeader[MAX_PATHNAME_LEN];
CHAR szFooter[MAX_PATHNAME_LEN];
FINDREPLACE find;
WORD nCommdlgFindReplaceMsg;
CHAR Buffer[12000];
} NOTEPAD_GLOBALS;
extern NOTEPAD_GLOBALS Globals;
/* function prototypes */
void TrashBuffer(void);
void LoadBufferFromFile(LPCSTR lpFileName);
/* class names */
/* Resource names */
extern CHAR STRING_MENU_Xx[];
extern CHAR STRING_PAGESETUP_Xx[];
#define STRINGID(id) (0x##id + Globals.wStringTableOffset)
#else /* RC_INVOKED */
#define STRINGID(id) id
#endif
/* string table index */
#define IDS_LANGUAGE_ID STRINGID(00)
#define IDS_LANGUAGE_MENU_ITEM STRINGID(01)
#define IDS_NOTEPAD STRINGID(02)
#define IDS_TEXT_FILES_TXT STRINGID(03)
#define IDS_ALL_FILES STRINGID(04)
#define IDS_ERROR STRINGID(05)
#define IDS_WARNING STRINGID(06)
#define IDS_INFO STRINGID(07)
#define IDS_TOOLARGE STRINGID(08)
#define IDS_NOTEXT STRINGID(09)
#define IDS_NOTSAVED STRINGID(0A)
#define IDS_NOTFOUND STRINGID(0B)
#define IDS_OUT_OF_MEMORY STRINGID(0C)
#define IDS_UNTITLED STRINGID(0D)
#define IDS_PAGESETUP_HEADERVALUE STRINGID(0E)
#define IDS_PAGESETUP_FOOTERVALUE STRINGID(0F)
#define IDS_PAGESETUP_LEFTVALUE STRINGID(10)
#define IDS_PAGESETUP_RIGHTVALUE STRINGID(11)
#define IDS_PAGESETUP_TOPVALUE STRINGID(12)
#define IDS_PAGESETUP_BOTTOMVALUE STRINGID(13)
/* main menu */
#define NP_FILE_NEW 100
#define NP_FILE_OPEN 101
#define NP_FILE_SAVE 102
#define NP_FILE_SAVEAS 103
#define NP_FILE_PRINT 104
#define NP_FILE_PAGESETUP 105
#define NP_FILE_PRINTSETUP 106
#define NP_FILE_EXIT 107
#define NP_EDIT_UNDO 200
#define NP_EDIT_CUT 201
#define NP_EDIT_COPY 202
#define NP_EDIT_PASTE 203
#define NP_EDIT_DELETE 204
#define NP_EDIT_SELECTALL 205
#define NP_EDIT_TIMEDATE 206
#define NP_EDIT_WRAP 207
#define NP_SEARCH_SEARCH 300
#define NP_SEARCH_NEXT 301
#define NP_FIRST_LANGUAGE 400
#define NP_LAST_LANGUAGE 499
#define NP_HELP_CONTENTS 500
#define NP_HELP_SEARCH 501
#define NP_HELP_ON_HELP 502
#define NP_HELP_LICENSE 503
#define NP_HELP_NO_WARRANTY 504
#define NP_HELP_ABOUT_WINE 505
/* Dialog `Page Setup' */
#define NP_PAGESETUP_HEAD 1000
#define NP_PAGESETUP_HEAD_TXT 1001
#define NP_PAGESETUP_TAIL 1002
#define NP_PAGESETUP_TAIL_TXT 1003
#define NP_PAGESETUP_LEFT 1004
#define NP_PAGESETUP_LEFT_TXT 1005
#define NP_PAGESETUP_RIGHT 1006
#define NP_PAGESETUP_RIGHT_TXT 1007
#define NP_PAGESETUP_TOP 1008
#define NP_PAGESETUP_TOP_TXT 1009
#define NP_PAGESETUP_BOTTOM 1010
#define NP_PAGESETUP_BOTTOM_TXT 1011
#define NP_HELP 1012
#define NP_PAGESETUP_MARGIN 1013
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */

View File

@@ -0,0 +1,188 @@
/*
* Notepad (notepad.rc)
*
* Copyright 1997,98 Marcel Baur <mbaur@g26.ethz.ch>
* To be distributed under the Wine License
*/
/* Main Menu */
CONCAT(MENU_, LANGUAGE_ID) MENU
{
POPUP MENU_FILE {
MENUITEM MENU_FILE_NEW, NP_FILE_NEW
MENUITEM MENU_FILE_OPEN, NP_FILE_OPEN
MENUITEM MENU_FILE_SAVE, NP_FILE_SAVE
MENUITEM MENU_FILE_SAVEAS, NP_FILE_SAVEAS
MENUITEM MENU_FILE_PRINT, NP_FILE_PRINT
MENUITEM MENU_FILE_PAGESETUP, NP_FILE_PAGESETUP
MENUITEM MENU_FILE_PRINTSETUP, NP_FILE_PRINTSETUP
MENUITEM SEPARATOR
MENUITEM MENU_FILE_EXIT, NP_FILE_EXIT
}
POPUP MENU_EDIT {
MENUITEM MENU_EDIT_UNDO, NP_EDIT_UNDO
MENUITEM SEPARATOR
MENUITEM MENU_EDIT_CUT, NP_EDIT_CUT
MENUITEM MENU_EDIT_COPY, NP_EDIT_COPY
MENUITEM MENU_EDIT_PASTE, NP_EDIT_PASTE
MENUITEM MENU_EDIT_DELETE, NP_EDIT_DELETE
MENUITEM SEPARATOR
MENUITEM MENU_EDIT_SELECTALL, NP_EDIT_SELECTALL
MENUITEM MENU_EDIT_TIMEDATE, NP_EDIT_TIMEDATE
MENUITEM SEPARATOR
MENUITEM MENU_EDIT_WRAP, NP_EDIT_WRAP
}
POPUP MENU_SEARCH {
MENUITEM MENU_SEARCH_SEARCH, NP_SEARCH_SEARCH
MENUITEM MENU_SEARCH_NEXT, NP_SEARCH_NEXT
}
POPUP MENU_LANGUAGE {
/* Dummy item, will be removed */
MENUITEM SEPARATOR
}
POPUP MENU_HELP {
MENUITEM MENU_HELP_CONTENTS, NP_HELP_CONTENTS
MENUITEM MENU_HELP_SEARCH, NP_HELP_SEARCH
MENUITEM MENU_HELP_HELP_ON_HELP, NP_HELP_ON_HELP
MENUITEM SEPARATOR
POPUP MENU_INFO {
MENUITEM MENU_INFO_LICENSE, NP_HELP_LICENSE
MENUITEM MENU_INFO_NO_WARRANTY, NP_HELP_NO_WARRANTY
MENUITEM MENU_INFO_ABOUT_WINE, NP_HELP_ABOUT_WINE
}
}
}
/* Dialog `Page setup' */
CONCAT(DIALOG_PAGESETUP_, LANGUAGE_ID) DIALOG 0, 0, 225, 95
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
FONT 8, "Helv"
CAPTION DIALOG_PAGESETUP_CAPTION
{
LTEXT DIALOG_PAGESETUP_HEAD, NP_PAGESETUP_HEAD_TXT, 10, 07, 40, 15
EDITTEXT NP_PAGESETUP_HEAD, 60, 05,110, 12, WS_BORDER | WS_TABSTOP
LTEXT DIALOG_PAGESETUP_TAIL, NP_PAGESETUP_TAIL_TXT, 10, 24, 40, 15
EDITTEXT NP_PAGESETUP_TAIL, 60, 22,110, 12, WS_BORDER | WS_TABSTOP
GROUPBOX DIALOG_PAGESETUP_MARGIN, NP_PAGESETUP_MARGIN, 10, 43,160, 45
LTEXT DIALOG_PAGESETUP_LEFT, NP_PAGESETUP_LEFT_TXT, 20, 55, 30, 10, WS_CHILD
EDITTEXT /*STRING_PAGESETUP_LEFTVALUE,*/ NP_PAGESETUP_LEFT, 50, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP
LTEXT DIALOG_PAGESETUP_TOP, NP_PAGESETUP_TOP_TXT, 20, 73, 30, 10, WS_CHILD
EDITTEXT /*STRING_PAGESETUP_TOPVALUE,*/ NP_PAGESETUP_TOP, 50, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP
LTEXT DIALOG_PAGESETUP_RIGHT, NP_PAGESETUP_RIGHT_TXT, 100, 55, 30, 10, WS_CHILD
EDITTEXT /*STRING_PAGESETUP_RIGHTVALUE,*/ NP_PAGESETUP_RIGHT, 130, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP
LTEXT DIALOG_PAGESETUP_BOTTOM, NP_PAGESETUP_BOTTOM_TXT,100, 73, 30, 10, WS_CHILD
EDITTEXT /*STRING_PAGESETUP_BOTTOMVALUE,*/ NP_PAGESETUP_BOTTOM, 130, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP
DEFPUSHBUTTON DIALOG_OK, IDOK, 180, 3, 40, 15, WS_TABSTOP
PUSHBUTTON DIALOG_CANCEL, IDCANCEL, 180, 21, 40, 15, WS_TABSTOP
PUSHBUTTON DIALOG_HELP, NP_HELP, 180, 39, 40, 15, WS_TABSTOP
}
/* Strings */
#define STRING_LANGUAGE_ID STRINGIFY(LANGUAGE_ID)
#define STRING_LANGUAGE_MENU_ITEM LANGUAGE_MENU_ITEM
STRINGTABLE
{
ADDSTRING(LANGUAGE_ID)
ADDSTRING(LANGUAGE_MENU_ITEM)
ADDSTRING(NOTEPAD)
ADDSTRING(TEXT_FILES_TXT)
ADDSTRING(ALL_FILES)
ADDSTRING(ERROR)
ADDSTRING(WARNING)
ADDSTRING(INFO)
ADDSTRING(TOOLARGE)
ADDSTRING(NOTEXT)
ADDSTRING(NOTSAVED)
ADDSTRING(NOTFOUND)
ADDSTRING(OUT_OF_MEMORY)
ADDSTRING(UNTITLED)
ADDSTRING(PAGESETUP_HEADERVALUE)
ADDSTRING(PAGESETUP_FOOTERVALUE)
ADDSTRING(PAGESETUP_LEFTVALUE)
ADDSTRING(PAGESETUP_RIGHTVALUE)
ADDSTRING(PAGESETUP_TOPVALUE)
ADDSTRING(PAGESETUP_BOTTOMVALUE)
}
/* Undefine all language-specific strings */
#undef LANGUAGE_ID
#undef LANGUAGE_NUMBER
#undef LANGUAGE_MENU_ITEM
#undef MENU_FILE
#undef MENU_FILE_NEW
#undef MENU_FILE_OPEN
#undef MENU_FILE_SAVE
#undef MENU_FILE_SAVEAS
#undef MENU_FILE_PRINT
#undef MENU_FILE_PAGESETUP
#undef MENU_FILE_PRINTSETUP
#undef MENU_FILE_EXIT
#undef MENU_EDIT
#undef MENU_EDIT_UNDO
#undef MENU_EDIT_CUT
#undef MENU_EDIT_COPY
#undef MENU_EDIT_PASTE
#undef MENU_EDIT_DELETE
#undef MENU_EDIT_SELECTALL
#undef MENU_EDIT_TIMEDATE
#undef MENU_EDIT_WRAP
#undef MENU_SEARCH
#undef MENU_SEARCH_SEARCH
#undef MENU_SEARCH_NEXT
#undef MENU_LANGUAGE
#undef MENU_HELP
#undef MENU_HELP_CONTENTS
#undef MENU_HELP_SEARCH
#undef MENU_HELP_HELP_ON_HELP
#undef MENU_INFO
#undef MENU_INFO_LICENSE
#undef MENU_INFO_NO_WARRANTY
#undef MENU_INFO_ABOUT_WINE
#undef DIALOG_OK
#undef DIALOG_CANCEL
#undef DIALOG_BROWSE
#undef DIALOG_HELP
#undef DIALOG_PAGESETUP_CAPTION
#undef DIALOG_PAGESETUP_HEAD
#undef DIALOG_PAGESETUP_TAIL
#undef DIALOG_PAGESETUP_MARGIN
#undef DIALOG_PAGESETUP_LEFT
#undef DIALOG_PAGESETUP_RIGHT
#undef DIALOG_PAGESETUP_TOP
#undef DIALOG_PAGESETUP_BOTTOM
#undef STRING_LANGUAGE_ID
#undef STRING_LANGUAGE_MENU_ITEM
#undef STRING_PAGESETUP_HEADERVALUE
#undef STRING_PAGESETUP_FOOTERVALUE
#undef STRING_PAGESETUP_LEFTVALUE
#undef STRING_PAGESETUP_RIGHTVALUE
#undef STRING_PAGESETUP_TOPVALUE
#undef STRING_PAGESETUP_BOTTOMVALUE
#undef STRING_NOTEPAD
#undef STRING_ERROR
#undef STRING_WARNING
#undef STRING_INFO
#undef STRING_UNTITLED
#undef STRING_ALL_FILES
#undef STRING_TEXT_FILES_TXT
#undef STRING_TOOLARGE
#undef STRING_NOTEXT
#undef STRING_NOTSAVED
#undef STRING_NOTFOUND
#undef STRING_OUT_OF_MEMORY

View File

@@ -0,0 +1,4 @@
/* Missing Functions in ros */
#define HFILE_ERROR ((HFILE)-1) /* Should be in winbase.h */
#define SP_APPABORT (-2) /* wingdi.h */

View File

@@ -0,0 +1,27 @@
/* This works under windows but were not going to worry about icons under ros yet. */
/* 500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "C:/BIN/COMPILER/Icon/Mainicon.ico" */
#include "windows.h"
#include "main.h"
#define CONCAT(a, b) CONCAT1(a, b)
#define CONCAT1(a, b) a##b
#define ADDSTRING(str) ADDSTRING1(LANGUAGE_NUMBER, IDS_ ## str) STRING_ ## str
#define ADDSTRING1(langnum, ids) ADDSTRING2(langnum, ids)
#define ADDSTRING2(langnum, ids) 0x ## langnum ## ids
#define STRINGIFY(str) STRINGIFY1(str)
#define STRINGIFY1(str) #str
#include "Da.rc"
#include "De.rc"
#include "En.rc"
#include "Es.rc"
#include "Fi.rc"
#include "Fr.rc"
#include "Pt.rc"
#include "Sk.rc"
#include "Sw.rc"
#include "Wa.rc"

View File

@@ -0,0 +1,56 @@
/*
* Notepad (search.c)
* Copyright (C) 1999 by Marcel Baur
* To be distributed under the Wine license
*
* This file features Heuristic Boyer-Moore Text Search
*
* Always: - Buf is the Buffer containing the whole text
* ======= - SP is the Search Pattern, which has to be found in Buf.
*
*/
#include <windows.h>
#define CHARSETSIZE 255
int delta[CHARSETSIZE];
/* rightmostpos: return rightmost position of ch in szSP (or -1) */
int rightmostpos(char ch, LPSTR szSP, int nSPLen) {
int i = nSPLen;
while ((i>0) & (szSP[i]!=ch)) i--;
return(i);
}
/* setup_delta: setup delta1 cache */
void setup_delta(LPSTR szSP, int nSPLen) {
int i;
for (i=0; i<CHARSETSIZE; i++) {
delta[i] = nSPLen;
}
for (i=0; i<nSPLen; i++) {
delta[(int)szSP[i]] = (nSPLen - rightmostpos(szSP[i], szSP, nSPLen));
}
}
int bm_search(LPSTR szBuf, int nBufLen, LPSTR szSP, int nSPLen) {
int i = nSPLen;
int j = nSPLen;
do {
if ((szBuf[i] = szSP[j])) {
i--; j--;
} else {
if ((nSPLen-j+1) > delta[(int)szBuf[i]]) {
i+= (nSPLen-j+1);
} else {
i+= delta[(int)szBuf[i]];
}
}
} while (j>0 && i<=nBufLen);
return(i+1);
}

View File

@@ -0,0 +1,21 @@
#
PATH_TO_TOP = ../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = ps
TARGET_SDKLIBS = kernel32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,42 @@
#include <windows.h>
#include <tlhelp32.h>
static char* title = " PID PARENT TIME NAME\n";
char buf[256];
void main()
{
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD r;
WriteFile(stdout,title,lstrlen(title),&r,NULL);
HANDLE pl = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
PROCESSENTRY32 pe;
pe.dwSize = sizeof(PROCESSENTRY32);
pe.th32ParentProcessID = 0;
if(Process32First(pl,&pe)) do
{
HANDLE p =OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,pe.th32ProcessID);
FILETIME cr;
FILETIME ex;
FILETIME kt;
FILETIME ut;
GetProcessTimes(p,&cr,&ex,&kt,&ut);
WORD fatdate;
WORD fattime;
FileTimeToDosDateTime(&cr,&fatdate,&fattime);
int hour = (fattime & 0xf800) >> 11;
int minute = (fattime & 0x07e0) >> 5;
wsprintf(buf,"%08X %08X %2d:%02d %s\n",pe.th32ProcessID,pe.th32ParentProcessID,hour,minute,pe.szExeFile);
WriteFile(stdout,buf,lstrlen(buf),&r,NULL);
CloseHandle(p);
pe.th32ParentProcessID = 0;
} while( Process32Next(pl,&pe));
CloseHandle(pl);
}

View File

@@ -1,109 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../tools/rbuild/project.dtd">
<group xmlns:xi="http://www.w3.org/2001/XInclude">
<directory name="cacls">
<xi:include href="cacls/cacls.rbuild" />
</directory>
<directory name="calc">
<xi:include href="calc/calc.rbuild" />
</directory>
<directory name="charmap">
<xi:include href="charmap/charmap.rbuild" />
</directory>
<directory name="cmdutils">
<xi:include href="cmdutils/cmdutils.rbuild" />
</directory>
<directory name="control">
<xi:include href="control/control.rbuild" />
</directory>
<directory name="dxdiag">
<xi:include href="dxdiag/dxdiag.rbuild" />
</directory>
<directory name="extrac32">
<xi:include href="extrac32/extrac32.rbuild" />
</directory>
<directory name="findstr">
<xi:include href="findstr/findstr.rbuild" />
</directory>
<directory name="fontview">
<xi:include href="fontview/fontview.rbuild" />
</directory>
<directory name="games">
<xi:include href="games/games.rbuild" />
</directory>
<directory name="hh">
<xi:include href="hh/hh.rbuild" />
</directory>
<directory name="iexplore">
<xi:include href="iexplore/iexplore.rbuild" />
</directory>
<directory name="kbswitch">
<xi:include href="kbswitch/kbswitch.rbuild" />
</directory>
<directory name="logoff">
<xi:include href="logoff/logoff.rbuild" />
</directory>
<directory name="magnify">
<xi:include href="magnify/magnify.rbuild" />
</directory>
<directory name="mplay32">
<xi:include href="mplay32/mplay32.rbuild" />
</directory>
<directory name="msconfig">
<xi:include href="msconfig/msconfig.rbuild" />
</directory>
<directory name="mscutils">
<xi:include href="mscutils/directory.rbuild" />
</directory>
<directory name="mstsc">
<xi:include href="mstsc/mstsc.rbuild" />
</directory>
<directory name="network">
<xi:include href="network/network.rbuild" />
</directory>
<directory name="notepad">
<xi:include href="notepad/notepad.rbuild" />
</directory>
<directory name="paint">
<xi:include href="paint/paint.rbuild" />
</directory>
<directory name="regedit">
<xi:include href="regedit/regedit.rbuild" />
</directory>
<directory name="regedt32">
<xi:include href="regedt32/regedt32.rbuild" />
</directory>
<directory name="sc">
<xi:include href="sc/sc.rbuild" />
</directory>
<directory name="screensavers">
<xi:include href="screensavers/screensavers.rbuild" />
</directory>
<directory name="shutdown">
<xi:include href="shutdown/shutdown.rbuild" />
</directory>
<directory name="sndrec32">
<xi:include href="sndrec32/sndrec32.rbuild" />
</directory>
<directory name="sndvol32">
<xi:include href="sndvol32/sndvol32.rbuild" />
</directory>
<directory name="taskmgr">
<xi:include href="taskmgr/taskmgr.rbuild" />
</directory>
<directory name="winhlp32">
<xi:include href="winhlp32/winhlp32.rbuild" />
</directory>
<directory name="winver">
<xi:include href="winver/winver.rbuild" />
</directory>
<directory name="wordpad">
<xi:include href="wordpad/wordpad.rbuild" />
</directory>
<directory name="write">
<xi:include href="write/write.rbuild" />
</directory>
<directory name="rapps">
<xi:include href="rapps/rapps.rbuild" />
</directory>
</group>

View File

@@ -1,604 +0,0 @@
/*
* ReactOS Control ACLs Program
* Copyright (C) 2006 Thomas Weidenmueller
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <precomp.h>
static GENERIC_MAPPING FileGenericMapping =
{
FILE_GENERIC_READ,
FILE_GENERIC_WRITE,
FILE_GENERIC_EXECUTE,
FILE_ALL_ACCESS
};
static
INT
LengthOfStrResource(IN HINSTANCE hInst,
IN UINT uID)
{
HRSRC hrSrc;
HGLOBAL hRes;
LPWSTR lpName, lpStr;
if (hInst == NULL)
{
hInst = GetModuleHandle(NULL);
}
/* There are always blocks of 16 strings */
lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
/* Find the string table block */
hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING);
if (hrSrc)
{
hRes = LoadResource(hInst, hrSrc);
if (hRes)
{
lpStr = LockResource(hRes);
if (lpStr)
{
UINT x;
/* Find the string we're looking for */
uID &= 0xF; /* position in the block, same as % 16 */
for (x = 0; x < uID; x++)
{
lpStr += (*lpStr) + 1;
}
/* Found the string */
return (int)(*lpStr);
}
}
}
return -1;
}
static
INT
AllocAndLoadString(OUT LPTSTR *lpTarget,
IN HINSTANCE hInst,
IN UINT uID)
{
INT ln;
ln = LengthOfStrResource(hInst,
uID);
if (ln++ > 0)
{
(*lpTarget) = (LPTSTR)HeapAlloc(GetProcessHeap(),
0,
ln * sizeof(TCHAR));
if ((*lpTarget) != NULL)
{
INT Ret;
Ret = LoadString(hInst,
uID,
*lpTarget,
ln);
if (!Ret)
{
HeapFree(GetProcessHeap(),
0,
*lpTarget);
}
return Ret;
}
}
return 0;
}
static
VOID
PrintHelp(VOID)
{
LPTSTR szHelp;
if (AllocAndLoadString(&szHelp,
NULL,
IDS_HELP) != 0)
{
_tprintf(_T("%s"),
szHelp);
HeapFree(GetProcessHeap(),
0,
szHelp);
}
}
static
VOID
PrintErrorMessage(IN DWORD dwError)
{
LPTSTR szError;
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwError,
MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT),
(LPTSTR)&szError,
0,
NULL) != 0)
{
_tprintf(_T("%s"),
szError);
LocalFree((HLOCAL)szError);
}
}
static
DWORD
LoadAndPrintString(IN HINSTANCE hInst,
IN UINT uID)
{
TCHAR szTemp[255];
DWORD Len;
Len = (DWORD)LoadString(hInst,
uID,
szTemp,
sizeof(szTemp) / sizeof(szTemp[0]));
if (Len != 0)
{
_tprintf(_T("%s"),
szTemp);
}
return Len;
}
static
BOOL
PrintFileDacl(IN LPTSTR FilePath,
IN LPTSTR FileName)
{
SIZE_T Length;
PSECURITY_DESCRIPTOR SecurityDescriptor;
DWORD SDSize = 0;
TCHAR FullFileName[MAX_PATH + 1];
BOOL Error = FALSE, Ret = FALSE;
Length = _tcslen(FilePath) + _tcslen(FileName);
if (Length > MAX_PATH)
{
/* file name too long */
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
_tcscpy(FullFileName,
FilePath);
_tcscat(FullFileName,
FileName);
/* find out how much memory we need */
if (!GetFileSecurity(FullFileName,
DACL_SECURITY_INFORMATION,
NULL,
0,
&SDSize) &&
GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
return FALSE;
}
SecurityDescriptor = (PSECURITY_DESCRIPTOR)HeapAlloc(GetProcessHeap(),
0,
SDSize);
if (SecurityDescriptor != NULL)
{
if (GetFileSecurity(FullFileName,
DACL_SECURITY_INFORMATION,
SecurityDescriptor,
SDSize,
&SDSize))
{
PACL Dacl;
BOOL DaclPresent;
BOOL DaclDefaulted;
if (GetSecurityDescriptorDacl(SecurityDescriptor,
&DaclPresent,
&Dacl,
&DaclDefaulted))
{
if (DaclPresent)
{
PACCESS_ALLOWED_ACE Ace;
DWORD AceIndex = 0;
/* dump the ACL */
while (GetAce(Dacl,
AceIndex,
(PVOID*)&Ace))
{
SID_NAME_USE Use;
DWORD NameSize = 0;
DWORD DomainSize = 0;
LPTSTR Name = NULL;
LPTSTR Domain = NULL;
LPTSTR SidString = NULL;
DWORD IndentAccess;
DWORD AccessMask = Ace->Mask;
PSID Sid = (PSID)&Ace->SidStart;
/* attempt to translate the SID into a readable string */
if (!LookupAccountSid(NULL,
Sid,
Name,
&NameSize,
Domain,
&DomainSize,
&Use))
{
if (GetLastError() == ERROR_NONE_MAPPED || NameSize == 0)
{
goto BuildSidString;
}
else
{
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
Error = TRUE;
break;
}
Name = (LPTSTR)HeapAlloc(GetProcessHeap(),
0,
(NameSize + DomainSize) * sizeof(TCHAR));
if (Name == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
Error = TRUE;
break;
}
Domain = Name + NameSize;
Name[0] = _T('\0');
if (DomainSize != 0)
Domain[0] = _T('\0');
if (!LookupAccountSid(NULL,
Sid,
Name,
&NameSize,
Domain,
&DomainSize,
&Use))
{
HeapFree(GetProcessHeap(),
0,
Name);
Name = NULL;
goto BuildSidString;
}
}
}
else
{
BuildSidString:
if (!ConvertSidToStringSid(Sid,
&SidString))
{
Error = TRUE;
break;
}
}
/* print the file name or space */
_tprintf(_T("%s "),
FullFileName);
/* attempt to map the SID to a user name */
if (AceIndex == 0)
{
DWORD i = 0;
/* overwrite the full file name with spaces so we
only print the file name once */
while (FullFileName[i] != _T('\0'))
FullFileName[i++] = _T(' ');
}
/* print the domain and/or user if possible, or the SID string */
if (Name != NULL && Domain[0] != _T('\0'))
{
_tprintf(_T("%s\\%s:"),
Domain,
Name);
IndentAccess = (DWORD)_tcslen(Domain) + _tcslen(Name);
}
else
{
LPTSTR DisplayString = (Name != NULL ? Name : SidString);
_tprintf(_T("%s:"),
DisplayString);
IndentAccess = (DWORD)_tcslen(DisplayString);
}
/* print the ACE Flags */
if (Ace->Header.AceFlags & CONTAINER_INHERIT_ACE)
{
IndentAccess += LoadAndPrintString(NULL,
IDS_ABBR_CI);
}
if (Ace->Header.AceFlags & OBJECT_INHERIT_ACE)
{
IndentAccess += LoadAndPrintString(NULL,
IDS_ABBR_OI);
}
if (Ace->Header.AceFlags & INHERIT_ONLY_ACE)
{
IndentAccess += LoadAndPrintString(NULL,
IDS_ABBR_IO);
}
IndentAccess += 2;
/* print the access rights */
MapGenericMask(&AccessMask,
&FileGenericMapping);
if (Ace->Header.AceType & ACCESS_DENIED_ACE_TYPE)
{
if (AccessMask == FILE_ALL_ACCESS)
{
LoadAndPrintString(NULL,
IDS_ABBR_NONE);
}
else
{
LoadAndPrintString(NULL,
IDS_DENY);
goto PrintSpecialAccess;
}
}
else
{
if (AccessMask == FILE_ALL_ACCESS)
{
LoadAndPrintString(NULL,
IDS_ABBR_FULL);
}
else if (!(Ace->Mask & (GENERIC_READ | GENERIC_EXECUTE)) &&
AccessMask == (FILE_GENERIC_READ | FILE_EXECUTE))
{
LoadAndPrintString(NULL,
IDS_ABBR_READ);
}
else if (AccessMask == (FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_EXECUTE | DELETE))
{
LoadAndPrintString(NULL,
IDS_ABBR_CHANGE);
}
else if (AccessMask == FILE_GENERIC_WRITE)
{
LoadAndPrintString(NULL,
IDS_ABBR_WRITE);
}
else
{
DWORD x, x2;
static const struct
{
DWORD Access;
UINT uID;
}
AccessRights[] =
{
{FILE_WRITE_ATTRIBUTES, IDS_FILE_WRITE_ATTRIBUTES},
{FILE_READ_ATTRIBUTES, IDS_FILE_READ_ATTRIBUTES},
{FILE_DELETE_CHILD, IDS_FILE_DELETE_CHILD},
{FILE_EXECUTE, IDS_FILE_EXECUTE},
{FILE_WRITE_EA, IDS_FILE_WRITE_EA},
{FILE_READ_EA, IDS_FILE_READ_EA},
{FILE_APPEND_DATA, IDS_FILE_APPEND_DATA},
{FILE_WRITE_DATA, IDS_FILE_WRITE_DATA},
{FILE_READ_DATA, IDS_FILE_READ_DATA},
{FILE_GENERIC_EXECUTE, IDS_FILE_GENERIC_EXECUTE},
{FILE_GENERIC_WRITE, IDS_FILE_GENERIC_WRITE},
{FILE_GENERIC_READ, IDS_FILE_GENERIC_READ},
{GENERIC_ALL, IDS_GENERIC_ALL},
{GENERIC_EXECUTE, IDS_GENERIC_EXECUTE},
{GENERIC_WRITE, IDS_GENERIC_WRITE},
{GENERIC_READ, IDS_GENERIC_READ},
{MAXIMUM_ALLOWED, IDS_MAXIMUM_ALLOWED},
{ACCESS_SYSTEM_SECURITY, IDS_ACCESS_SYSTEM_SECURITY},
{SPECIFIC_RIGHTS_ALL, IDS_SPECIFIC_RIGHTS_ALL},
{STANDARD_RIGHTS_REQUIRED, IDS_STANDARD_RIGHTS_REQUIRED},
{SYNCHRONIZE, IDS_SYNCHRONIZE},
{WRITE_OWNER, IDS_WRITE_OWNER},
{WRITE_DAC, IDS_WRITE_DAC},
{READ_CONTROL, IDS_READ_CONTROL},
{DELETE, IDS_DELETE},
{STANDARD_RIGHTS_ALL, IDS_STANDARD_RIGHTS_ALL},
};
LoadAndPrintString(NULL,
IDS_ALLOW);
PrintSpecialAccess:
LoadAndPrintString(NULL,
IDS_SPECIAL_ACCESS);
/* print the special access rights */
x = sizeof(AccessRights) / sizeof(AccessRights[0]);
while (x-- != 0)
{
if ((Ace->Mask & AccessRights[x].Access) == AccessRights[x].Access)
{
_tprintf(_T("\n%s "),
FullFileName);
for (x2 = 0;
x2 < IndentAccess;
x2++)
{
_tprintf(_T(" "));
}
LoadAndPrintString(NULL,
AccessRights[x].uID);
}
}
_tprintf(_T("\n"));
}
}
_tprintf(_T("\n"));
/* free up all resources */
if (Name != NULL)
{
HeapFree(GetProcessHeap(),
0,
Name);
}
if (SidString != NULL)
{
LocalFree((HLOCAL)SidString);
}
AceIndex++;
}
if (!Error)
Ret = TRUE;
}
else
{
SetLastError(ERROR_NO_SECURITY_ON_OBJECT);
}
}
}
HeapFree(GetProcessHeap(),
0,
SecurityDescriptor);
}
else
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
}
return Ret;
}
int
__cdecl
_tmain(int argc, const TCHAR *argv[])
{
if (argc < 2)
{
PrintHelp();
return 1;
}
else
{
TCHAR FullPath[MAX_PATH + 1];
TCHAR *FilePart = NULL;
WIN32_FIND_DATA FindData;
HANDLE hFind;
DWORD LastError;
if (argc > 2)
{
/* FIXME - parse arguments */
}
/* get the full path of where we're searching in */
if (GetFullPathName(argv[1],
sizeof(FullPath) / sizeof(FullPath[0]),
FullPath,
&FilePart) != 0)
{
if (FilePart != NULL)
*FilePart = _T('\0');
}
else
goto Error;
/* find the file(s) */
hFind = FindFirstFile(argv[1],
&FindData);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
if (!(FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
(_tcscmp(FindData.cFileName,
_T(".")) &&
_tcscmp(FindData.cFileName,
_T(".."))))
{
if (argc > 2)
{
/* FIXME - edit or replace the descriptor */
}
else
{
if (!PrintFileDacl(FullPath,
FindData.cFileName))
{
LastError = GetLastError();
if (LastError == ERROR_ACCESS_DENIED)
{
PrintErrorMessage(LastError);
}
else
break;
}
else
_tprintf(_T("\n"));
}
}
} while (FindNextFile(hFind,
&FindData));
FindClose(hFind);
if (GetLastError() != ERROR_NO_MORE_FILES)
{
goto Error;
}
}
else
{
Error:
PrintErrorMessage(GetLastError());
return 1;
}
}
return 0;
}

View File

@@ -1,12 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="cacls" type="win32cui" installbase="system32" installname="cacls.exe" unicode="true">
<include base="cacls">.</include>
<library>advapi32</library>
<library>ntdll</library>
<library>user32</library>
<library>shell32</library>
<file>cacls.c</file>
<file>cacls.rc</file>
<pch>precomp.h</pch>
</module>

View File

@@ -1,10 +0,0 @@
#include <windows.h>
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Control ACLs Program\0"
#define REACTOS_STR_INTERNAL_NAME "cacls\0"
#define REACTOS_STR_ORIGINAL_FILENAME "cacls.exe\0"
#include <reactos/version.rc>
#include "rsrc.rc"

Some files were not shown because too many files have changed in this diff Show More