mirror of
https://github.com/reactos/reactos
synced 2025-10-06 16:32:42 +02:00
Compare commits
7 Commits
backups/al
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
5a0939913e | ||
|
abc01da30c | ||
|
7aeca22fed | ||
|
36e1bb60e8 | ||
|
74e77bb16f | ||
|
e3a75fb4da | ||
|
ce122bcdea |
19
reactos/.cvsignore
Normal file
19
reactos/.cvsignore
Normal file
@@ -0,0 +1,19 @@
|
||||
dist
|
||||
reactos
|
||||
*.sys
|
||||
*.exe
|
||||
*.dll
|
||||
*.cpl
|
||||
*.a
|
||||
*.o
|
||||
*.d
|
||||
*.coff
|
||||
*.dsp
|
||||
*.dsw
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opt
|
||||
*.sym
|
||||
*.plg
|
||||
*.bak
|
||||
*.zip
|
4
reactos/.gdbinit
Normal file
4
reactos/.gdbinit
Normal file
@@ -0,0 +1,4 @@
|
||||
directory /mnt/windows/CvsHome/reactos/ntoskrnl
|
||||
symbol-file ntoskrnl/ntoskrnl.nostrip.exe -mapped
|
||||
set remotebaud 115200
|
||||
target remote com2
|
@@ -3,7 +3,7 @@
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -280,7 +280,7 @@ POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
@@ -292,7 +292,7 @@ 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>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -306,15 +306,14 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
101
reactos/CREDITS
101
reactos/CREDITS
@@ -1,68 +1,41 @@
|
||||
ReactOS is available thanks to the work of:
|
||||
In no particular order
|
||||
|
||||
Aleksey Bragin <aleksey@studiocerebral.com>
|
||||
Alex Ionescu <ionucu@videotron.ca>
|
||||
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>
|
||||
Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
Christoph von Wittich (Christoph@ApiViewer.de)
|
||||
David Welch <welch@cwcom.net>
|
||||
Emanuele Aliberti <ea@iol.it>
|
||||
Eric Kohl <ekohl@rz-online.de>
|
||||
Eugene Ingerman <geneing@myrealbox.com>
|
||||
Filip Navara <xnavara@volny.cz>
|
||||
Frederik Leemans
|
||||
Ge van Geldorp <ge@gse.nl>
|
||||
Ged Murphy <gedmurphy@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 B. Tabor <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
|
||||
Jason Eager
|
||||
Jason Filby <jasonfilby@yahoo.com>
|
||||
Jason Weiler
|
||||
Jean Michault
|
||||
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>
|
||||
Matt Pyne
|
||||
Mike Nordell ("tamlin")
|
||||
Nathan Woods <npwoods@mess.org>
|
||||
Pablo Borobia <pborobia@gmail.com>
|
||||
Paolo Pantaleo <paolopan@freemail.it>
|
||||
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>
|
||||
Saveliy Tretiakov <saveliyt@mail.ru>
|
||||
Steven Edwards <steven_ed4153@yahoo.com>
|
||||
Thomas Weidenmueller <w3seek@users.sourceforge.net>
|
||||
Victor Kirhenshtein <sauros@iname.com>
|
||||
Vizzini <vizzini@plasmic.com>
|
||||
Rex Jolliff (rex@lvcablemodem.com)
|
||||
Boudewijn Dekker (ariadne@xs4all.nl)
|
||||
Eric Kohl (ekohl@rz-online.de)
|
||||
Emanuele Aliberti (ea@iol.it)
|
||||
David Welch (welch@cwcom.net)
|
||||
Iwan Fatahi (i_fatahi@hotmail.com)
|
||||
Robert Bergkvist (fragdance@hotmail.com)
|
||||
Victor Kirhenshtein (sauros@iname.com)
|
||||
Jason Filby (jasonfilby@yahoo.com)
|
||||
Brian Palmer (brianp@sginet.com)
|
||||
Phillip Susi (phreak@iag.net)
|
||||
Paolo Pantaleo (paolopan@freemail.it)
|
||||
Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
|
||||
Source and inspiration from
|
||||
|
||||
Graphic Design from
|
||||
WINE (http://www.winehq.com)
|
||||
WinFree (http://www.stack.nl/~onno/win32/)
|
||||
Linux (http://www.kernel.org)
|
||||
|
||||
References (Rex's at least)
|
||||
|
||||
Baker, Art. The Windows NT Device Driver Book. Prentice Hall, 1997.
|
||||
Borate, Dabak & Phadke. Undocumented Windows NT. M&T Books, 1999.
|
||||
Brain, Marshall. Win32 System Services. Prentice Hall, 1996.
|
||||
Cant, Chris. Writing Windows WDM Device Drivers. R&D Books, 1999.
|
||||
Canton & Sanchez. IBM Microcomputers: A Programmer's Handbook. McGraw Hill, 1990.
|
||||
Davis & Wallace. Windows Undocumented File Formats. R&D Books, 1997.
|
||||
Mason & Viscarola. Windows NT Device Driver Development. Macmillan, 1999.
|
||||
Mitchell, Stan. Inside the Windows 95 File System. O'Reilly, 1997.
|
||||
Murray, James D. Windows NT Event Logging. O'Reilly, 1998.
|
||||
Nagar, Rajeev. Windows NT File System Internals. O'Reilly, 1997.
|
||||
Osbourne, Sandra. Windows NT Registry: A Settings Reference. New Riders, 1998.
|
||||
Pietrek, Matt. Windows 95 System Programming Secrets. IDG, 1995.
|
||||
Richter, Jeffery. Advanced Windows, 3rd ed. Microsoft, 1997.
|
||||
Simon, Richard J. Windows NT Win32 API Superbible. Waite Group, 1996.
|
||||
Solomon, David A. Inside Windows NT, 2nd Ed. Microsoft, 1998.
|
||||
"The NT Insider." Open Systems Resources, 1999-2000.
|
||||
|
||||
Mindflyer <mf@mufunyo.net>
|
||||
Tango Desktop Project (http://tango-project.org)
|
||||
Everaldo (http://everaldo.com)
|
||||
|
1469
reactos/ChangeLog
Normal file
1469
reactos/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
211
reactos/Doxyfile
211
reactos/Doxyfile
@@ -1,211 +0,0 @@
|
||||
# Doxyfile 1.3.5
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = ReactOS
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = doxy-doc
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = .
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = hal \
|
||||
subsys \
|
||||
services \
|
||||
regtests \
|
||||
iface
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = subsys/win32k \
|
||||
subsys/system/explorer
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = YES
|
||||
RTF_HYPERLINKS = YES
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = NO
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = include
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
@@ -1,80 +1,75 @@
|
||||
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/.
|
||||
cross compiler running on unix. You may obtain MinGW binaries that build
|
||||
ReactOS from http://www.reactos.com.
|
||||
|
||||
|
||||
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.
|
||||
To build from Windows run 'make' (wihout the quotes) from the top directory.
|
||||
To build from unix, edit rules.mak and change the PREFIX variable to the
|
||||
correct value for your cross-compiler, then run 'make'.
|
||||
|
||||
|
||||
3. Installation
|
||||
|
||||
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.
|
||||
The system can only be installed on the first partition on the first harddisk.
|
||||
The partition must be formatted as FAT16 or FAT32. The system can only be
|
||||
started from DOS and not from a Windows DOS-prompt.
|
||||
|
||||
ReactOS can be installed from the source distribution or from the bootable CD
|
||||
ReactOS can be installed from the source distribution or from the binary
|
||||
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.
|
||||
To install ReactOS after building it, type 'make install'. This will create
|
||||
the directory 'reactos' in the top directory. Copy this directory to the root
|
||||
of your first partition on your first harddisk. This is usually c:\ on a
|
||||
Windows machine.
|
||||
|
||||
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',
|
||||
you can specify the directory where the files are to be copied to during
|
||||
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.
|
||||
In rules.mak find the variable INSTALL_DIR and change the assigned value to the
|
||||
name of the directory where the files are to be copied to. If you are using
|
||||
Windows this could be:
|
||||
|
||||
Set the ROS_INSTALL environment variable. If you are on Windows this could be
|
||||
done by:
|
||||
INSTALL_DIR = c:\reactos
|
||||
|
||||
set ROS_INSTALL=c:\reactos
|
||||
If you are on linux this could be:
|
||||
|
||||
If you are on Linux this could be done by:
|
||||
INSTALL_DIR = /mnt/windows/reactos
|
||||
|
||||
export ROS_INSTALL=/mnt/windows/reactos
|
||||
|
||||
Now run 'make install' or 'mingw32-make install' to install the files to the
|
||||
new location.
|
||||
Save the changes to rules.mak and run 'make install' to install the files to
|
||||
the new location.
|
||||
|
||||
|
||||
3.2 Installation from bootable CD distribution
|
||||
3.2 Installation from binany distribution
|
||||
|
||||
To install ReactOS from the bootable CD distribution, extract the archive
|
||||
contents. Then burn the CD image, boot from it, and follow instructions.
|
||||
To install ReactOS from the binary distribution, extract the archive contents
|
||||
to c:\reactos. Remember to extract the files with full paths.
|
||||
|
||||
|
||||
4. Booting ReactOS
|
||||
|
||||
Startup in DOS mode. 'cd' to c:\reactos and type 'boot' and press <enter>.
|
||||
ReactOS will now boot and when it has booted, you are asked for a username and
|
||||
password. Just press <enter> twice as ReactOS does not currently have user
|
||||
validation. A simple shell is started where you can use simple commands like
|
||||
'cd' and 'dir'.
|
||||
|
||||
You may also want to try running the enhanced shell, cmd.exe, found in
|
||||
the rosapps CVS module.
|
||||
|
||||
|
||||
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
|
||||
surf to the address below and subscribe to one or more of the mailing lists.
|
||||
|
||||
http://www.reactos.org/
|
||||
http://www.reactos.com/index.php?tab=discussion§ion=lists
|
||||
|
||||
ReactOS Development Team
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -485,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the
|
||||
|
||||
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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
|
1195
reactos/Makefile
1195
reactos/Makefile
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
========================
|
||||
ReactOS Version 0.3.x
|
||||
Updated Dec 16, 2006
|
||||
ReactOS Version 0.1.x
|
||||
Updated March 19th, 2003
|
||||
========================
|
||||
|
||||
1. What is ReactOS?
|
||||
@@ -8,13 +8,12 @@ Updated Dec 16, 2006
|
||||
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.
|
||||
The ReactOS project, although currently focused on Windows NT 4.0
|
||||
compatibility, is always keeping an eye towards compatibility with
|
||||
future Windows NT releases, that is, Windows 2000 (NT 5.0) and
|
||||
Windows XP (NT 5.1).
|
||||
|
||||
More information is available at http://www.reactos.org/.
|
||||
More information is available at http://www.reactos.com.
|
||||
|
||||
2. Building ReactOS
|
||||
|
||||
@@ -22,8 +21,8 @@ See the INSTALL file for more details.
|
||||
|
||||
3. More information
|
||||
|
||||
See the media\doc subdirectory for some sparse notes.
|
||||
See the doc subdirectory for some sparse notes
|
||||
|
||||
4. Who is responsible
|
||||
|
||||
See the CREDITS file.
|
||||
See the CREDITS file
|
@@ -1,94 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
||||
<project name="ReactOS" makefile="makefile.ppc" 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="baseaddress.rbuild" />
|
||||
|
||||
<property name="BOOTPROG_PREPARE" value="ppc-le2be" />
|
||||
<property name="BOOTPROG_FLATFORMAT" value="-O elf32-powerpc -B powerpc:common" />
|
||||
<property name="BOOTPROG_LINKFORMAT" value="-melf32ppc --no-omagic -Ttext 0xe00000 -Tdata 0xe10000" />
|
||||
<property name="BOOTPROG_COPYFORMAT" value="--only-section=.text --only-section=.data --only-section=.bss -O aixcoff-rs6000" />
|
||||
|
||||
<define name="_M_PPC" />
|
||||
<define name="_PPC_" />
|
||||
<define name="__PowerPC__" />
|
||||
<define name="_REACTOS_" />
|
||||
<define name="__MINGW_IMPORT" empty="true" />
|
||||
<define name="stdcall" empty="true" />
|
||||
<define name="__stdcall__" empty="true" />
|
||||
<define name="fastcall" empty="true" />
|
||||
<define name="cdecl" empty="true" />
|
||||
<define name="__cdecl__" empty="true" />
|
||||
<define name="dllimport" empty="true" />
|
||||
<compilerflag>-v</compilerflag>
|
||||
<if property="MP" value="1">
|
||||
<define name="CONFIG_SMP" value="1" />
|
||||
</if>
|
||||
<if property="DBG" value="1">
|
||||
<define name="DBG" value="1" />
|
||||
<property name="DBG_OR_KDBG" value="true" />
|
||||
</if>
|
||||
<if property="DBG" value="0">
|
||||
<compilerflag>-Os</compilerflag>
|
||||
<compilerflag>-Wno-strict-aliasing</compilerflag>
|
||||
</if>
|
||||
<if property="KDBG" value="1">
|
||||
<define name="KDBG" value="1" />
|
||||
<property name="DBG_OR_KDBG" value="true" />
|
||||
</if>
|
||||
<compilerflag>-Wpointer-arith</compilerflag>
|
||||
|
||||
<include>.</include>
|
||||
<include>include</include>
|
||||
<include>include/reactos</include>
|
||||
<include>include/libs</include>
|
||||
<include>include/drivers</include>
|
||||
<include>include/subsys</include>
|
||||
<include>include/ndk</include>
|
||||
<include>include</include>
|
||||
<include>include/crt</include>
|
||||
<include>include/ddk</include>
|
||||
|
||||
<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" />
|
||||
</directory>
|
||||
<directory name="regtests">
|
||||
<xi:include href="regtests/directory.rbuild" />
|
||||
</directory>
|
||||
<directory name="subsystems">
|
||||
<xi:include href="subsystems/subsystems.rbuild" />
|
||||
</directory>
|
||||
|
||||
</project>
|
@@ -1,108 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
||||
<project name="ReactOS" makefile="makefile.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="baseaddress.rbuild" />
|
||||
|
||||
<define name="_M_IX86" />
|
||||
<define name="_X86_" />
|
||||
<define name="__i386__" />
|
||||
<define name="_REACTOS_" />
|
||||
<if property="MP" value="1">
|
||||
<define name="CONFIG_SMP" value="1" />
|
||||
</if>
|
||||
<if property="DBG" value="1">
|
||||
<define name="DBG" value="1" />
|
||||
<property name="DBG_OR_KDBG" value="true" />
|
||||
</if>
|
||||
<if property="KDBG" value="1">
|
||||
<define name="KDBG" value="1" />
|
||||
<property name="DBG_OR_KDBG" value="true" />
|
||||
</if>
|
||||
|
||||
<if property="GDB" value="0">
|
||||
<if property="OPTIMIZE" value="1">
|
||||
<compilerflag>-Os</compilerflag>
|
||||
<compilerflag>-Wno-strict-aliasing</compilerflag>
|
||||
<compilerflag>-ftracer</compilerflag>
|
||||
<compilerflag>-momit-leaf-frame-pointer</compilerflag>
|
||||
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
|
||||
</if>
|
||||
<if property="OPTIMIZE" value="2">
|
||||
<compilerflag>-Os</compilerflag>
|
||||
<compilerflag>-Wno-strict-aliasing</compilerflag>
|
||||
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
|
||||
</if>
|
||||
<if property="OPTIMIZE" value="3">
|
||||
<compilerflag>-O1</compilerflag>
|
||||
<compilerflag>-Wno-strict-aliasing</compilerflag>
|
||||
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
|
||||
</if>
|
||||
<if property="OPTIMIZE" value="4">
|
||||
<compilerflag>-O2</compilerflag>
|
||||
<compilerflag>-Wno-strict-aliasing</compilerflag>
|
||||
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
|
||||
</if>
|
||||
<if property="OPTIMIZE" value="5">
|
||||
<compilerflag>-O3</compilerflag>
|
||||
<compilerflag>-Wno-strict-aliasing</compilerflag>
|
||||
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
|
||||
</if>
|
||||
</if>
|
||||
|
||||
<compilerflag>-Wpointer-arith</compilerflag>
|
||||
<linkerflag>-enable-stdcall-fixup</linkerflag>
|
||||
|
||||
<include>.</include>
|
||||
<include>include</include>
|
||||
<include>include/psdk</include>
|
||||
<include>include/crt</include>
|
||||
<include>include/ddk</include>
|
||||
<include>include/GL</include>
|
||||
<include>include/ndk</include>
|
||||
<include>include/reactos</include>
|
||||
<include>include/reactos/libs</include>
|
||||
|
||||
<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" />
|
||||
</directory>
|
||||
<directory name="regtests">
|
||||
<xi:include href="regtests/directory.rbuild" />
|
||||
</directory>
|
||||
<directory name="subsystems">
|
||||
<xi:include href="subsystems/subsystems.rbuild" />
|
||||
</directory>
|
||||
|
||||
</project>
|
3
reactos/aboot.bat
Normal file
3
reactos/aboot.bat
Normal file
@@ -0,0 +1,3 @@
|
||||
loadros system32\ntoskrnl.exe system32\hal.dll system32\drivers\acpi.sys /DEBUGPORT=SCREEN bootc.lst
|
||||
rem comment added and changed for no reason
|
||||
|
@@ -1,29 +0,0 @@
|
||||
; Format:
|
||||
; COMPONENT_NAME PATH_TO_COMPONENT_SOURCES
|
||||
; COMPONENT_NAME - Name of the component. Eg. kernel32.dll.
|
||||
; PATH_TO_COMPONENT_SOURCES - Relative path to sources (relative to
|
||||
; where rgenstat is run from).
|
||||
advapi32.dll reactos/dll/win32/advapi32
|
||||
crtdll.dll reactos/dll/win32/crtdll
|
||||
gdi32.dll reactos/dll/win32/gdi32
|
||||
gdiplus.dll reactos/dll/win32/gdiplus
|
||||
iphlpapi.dll reactos/dll/win32/iphlpapi
|
||||
kernel32.dll reactos/dll/win32/kernel32
|
||||
lz32.dll reactos/dll/win32/lzexpand
|
||||
msvcrt.dll reactos/dll/win32/msvcrt
|
||||
rpcrt4.dll reactos/dll/win32/rpcrt4
|
||||
secur32.dll reactos/dll/win32/secur32
|
||||
snmpapi.dll reactos/dll/win32/snmpapi
|
||||
user32.dll reactos/dll/win32/user32
|
||||
version.dll reactos/dll/win32/version
|
||||
winspool.dll reactos/dll/win32/winspool
|
||||
ws2_32.dll reactos/dll/win32/ws2_32
|
||||
wsock32.dll reactos/dll/win32/wsock32
|
||||
videoprt.dll reactos/drivers/video/videoprt
|
||||
ndis.sys reactos/drivers/network/ndis
|
||||
tdi.sys reactos/drivers/network/tdi
|
||||
class2.sys reactos/drivers/storage/class2
|
||||
scsiport.sys reactos/drivers/storage/scsiport
|
||||
ntoskrnl.exe reactos/ntoskrnl
|
||||
ntoskrnl.exe reactos/lib/rtl
|
||||
win32k.sys reactos/subsystems/win32/win32k
|
87
reactos/apps/tests/Makefile
Normal file
87
reactos/apps/tests/Makefile
Normal file
@@ -0,0 +1,87 @@
|
||||
#
|
||||
# ReactOS test applications makefile
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
||||
# Test applications
|
||||
# alive apc args atomtest bench bitblt consume copymove count dump_shared_data
|
||||
# event file gditest hello isotest lpc messagebox mstest mutex nptest
|
||||
# patblt pteb regtest sectest shm thread vmtest winhello shaptest
|
||||
TEST_APPS = alive apc args atomtest bench consume copymove count \
|
||||
dump_shared_data event file gditest hello isotest lpc messagebox \
|
||||
mstest mutex event file gditest hello isotest lpc messagebox mstest \
|
||||
mutex nptest pteb regtest sectest shm thread tokentest vmtest \
|
||||
winhello dibtest lock hivetest shaptest
|
||||
|
||||
TEST_MISC =
|
||||
|
||||
all: $(TEST_APPS) $(TEST_MISC)
|
||||
|
||||
depends:
|
||||
|
||||
implib: $(TEST_APPS:%=%_implib) \
|
||||
$(TEST_MISC:%=%_implib)
|
||||
|
||||
clean: $(TEST_APPS:%=%_clean) \
|
||||
$(TEST_MISC:%=%_clean)
|
||||
|
||||
install: $(TEST_APPS:%=%_install) \
|
||||
$(TEST_MISC:%=%_install)
|
||||
|
||||
dist: $(TEST_APPS:%=%_dist) \
|
||||
$(TEST_MISC:%=%_dist)
|
||||
|
||||
.PHONY: all depends implib clean install dist
|
||||
|
||||
|
||||
#
|
||||
# Test Applications
|
||||
#
|
||||
$(TEST_APPS): %:
|
||||
$(MAKE) -C $*
|
||||
|
||||
$(TEST_APPS:%=%_implib): %_implib:
|
||||
$(MAKE) -C $* implib
|
||||
|
||||
$(TEST_APPS:%=%_clean): %_clean:
|
||||
$(MAKE) -C $* clean
|
||||
|
||||
$(TEST_APPS:%=%_dist): %_dist:
|
||||
$(MAKE) -C $* dist
|
||||
|
||||
$(TEST_APPS:%=%_install): %_install:
|
||||
$(MAKE) -C $* install
|
||||
|
||||
.PHONY: $(TEST_APPS) $(TEST_APPS:%=%_implib) $(TEST_APPS:%=%_clean) $(TEST_APPS:%=%_install) $(TEST_APPS:%=%_dist)
|
||||
|
||||
|
||||
#
|
||||
# Misc Test Applications
|
||||
#
|
||||
$(TEST_MISC): %:
|
||||
$(MAKE) -C tests/$*
|
||||
|
||||
$(TEST_MISC:%=%_implib): %_implib:
|
||||
$(MAKE) -C tests/$* implib
|
||||
|
||||
$(TEST_MISC:%=%_clean): %_clean:
|
||||
$(MAKE) -C tests/$* clean
|
||||
|
||||
$(TEST_MISC:%=%_dist): %_dist:
|
||||
$(MAKE) -C tests/$* dist
|
||||
|
||||
$(TEST_MISC:%=%_install): %_install:
|
||||
$(MAKE) -C tests/$* install
|
||||
|
||||
.PHONY: $(TEST_MISC) $(TEST_MISC:%=%_implib) $(TEST_MISC:%=%_clean) $(TEST_MISC:%=%_install) $(TEST_MISC:%=%_dist)
|
||||
|
||||
|
||||
etags:
|
||||
find . -name "*.[ch]" -print | etags --language=c -
|
||||
|
||||
# EOF
|
||||
|
5
reactos/apps/tests/alive/.cvsignore
Normal file
5
reactos/apps/tests/alive/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
21
reactos/apps/tests/alive/Makefile
Normal file
21
reactos/apps/tests/alive/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: Makefile,v 1.6 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = alive
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a user32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
48
reactos/apps/tests/alive/alive.c
Normal file
48
reactos/apps/tests/alive/alive.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* $Id: alive.c,v 1.2 2001/03/26 21:30:20 ea Exp $
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
HANDLE StandardOutput = INVALID_HANDLE_VALUE;
|
||||
CHAR Message [80];
|
||||
DWORD CharactersToWrite = 0;
|
||||
DWORD WrittenCharacters = 0;
|
||||
INT d = 0, h = 0, m = 0, s = 0;
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{
|
||||
StandardOutput = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
if (INVALID_HANDLE_VALUE == StandardOutput)
|
||||
{
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
while (TRUE)
|
||||
{
|
||||
/* Prepare the message and update it */
|
||||
CharactersToWrite =
|
||||
wsprintf (
|
||||
Message,
|
||||
"Alive for %dd %dh %d' %d\" \r",
|
||||
d, h, m, s
|
||||
);
|
||||
WriteConsole (
|
||||
StandardOutput,
|
||||
Message,
|
||||
CharactersToWrite,
|
||||
& WrittenCharacters,
|
||||
NULL
|
||||
);
|
||||
/* suspend the execution for 1s */
|
||||
Sleep (1000);
|
||||
/* increment seconds */
|
||||
++ s;
|
||||
if (60 == s) { s = 0; ++ m; }
|
||||
if (60 == m) { m = 0; ++ h; }
|
||||
if (24 == h) { h = 0; ++ d; }
|
||||
}
|
||||
return (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* EOF */
|
5
reactos/apps/tests/apc/.cvsignore
Normal file
5
reactos/apps/tests/apc/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
85
reactos/apps/tests/apc/apc.c
Normal file
85
reactos/apps/tests/apc/apc.c
Normal file
@@ -0,0 +1,85 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
VOID STDCALL
|
||||
ApcRoutine(PVOID Context,
|
||||
PIO_STATUS_BLOCK IoStatus,
|
||||
ULONG Reserved)
|
||||
{
|
||||
printf("(apc.exe) ApcRoutine(Context %p)\n", Context);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NTSTATUS Status;
|
||||
HANDLE FileHandle;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING FileName = UNICODE_STRING_INITIALIZER(L"\\C:\\a.txt");
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
CHAR Buffer[256];
|
||||
HANDLE EventHandle;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
printf("APC test program\n");
|
||||
|
||||
EventHandle = CreateEventW(NULL,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL);
|
||||
if (EventHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Failed to create event\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("Opening file\n");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
printf("Creating file\n");
|
||||
FileHandle = CreateFileW(L"C:\\a.txt",
|
||||
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,
|
||||
NULL);
|
||||
if (FileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Open failed\n");
|
||||
return 0;
|
||||
}
|
||||
printf("Reading file\n");
|
||||
Status = ZwReadFile(FileHandle,
|
||||
NULL,
|
||||
(PIO_APC_ROUTINE)ApcRoutine,
|
||||
(PVOID)0xdeadbeef,
|
||||
&IoStatus,
|
||||
Buffer,
|
||||
256,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("Read failed\n");
|
||||
}
|
||||
printf("Waiting\n");
|
||||
WaitForSingleObjectEx(EventHandle, INFINITE, TRUE);
|
||||
printf("Returned from wait\n");
|
||||
ZwClose(FileHandle);
|
||||
printf("Program finished\n");
|
||||
return 0;
|
||||
}
|
||||
|
21
reactos/apps/tests/apc/makefile
Normal file
21
reactos/apps/tests/apc/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.9 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = apc
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/args/.cvsignore
Normal file
5
reactos/apps/tests/args/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
39
reactos/apps/tests/args/args.c
Normal file
39
reactos/apps/tests/args/args.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
printf("GetCommandLineA() %s\n",GetCommandLineA());
|
||||
debug_printf("GetCommandLineA() %s\n",GetCommandLineA());
|
||||
debug_printf("argc %d\n", argc);
|
||||
for (i=0; i<argc; i++)
|
||||
{
|
||||
debug_printf("Argv[%d]: %x\n",i,argv[i]);
|
||||
debug_printf("Argv[%d]: '%s'\n",i,argv[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
19
reactos/apps/tests/args/makefile
Normal file
19
reactos/apps/tests/args/makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: makefile,v 1.15 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = args
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/atomtest/.cvsignore
Normal file
5
reactos/apps/tests/atomtest/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
114
reactos/apps/tests/atomtest/atomtest.c
Normal file
114
reactos/apps/tests/atomtest/atomtest.c
Normal file
@@ -0,0 +1,114 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define BUFFER_SIZE 256
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
PRTL_ATOM_TABLE AtomTable = NULL;
|
||||
RTL_ATOM AtomA = -1, AtomB = -1, AtomC = -1;
|
||||
NTSTATUS Status;
|
||||
WCHAR Buffer[BUFFER_SIZE];
|
||||
ULONG NameLength, Data1, Data2;
|
||||
|
||||
printf("Atom table test app\n\n");
|
||||
|
||||
printf("RtlCreateAtomTable()\n");
|
||||
Status = RtlCreateAtomTable(37,
|
||||
&AtomTable);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" AtomTable %p\n", AtomTable);
|
||||
|
||||
printf("RtlAddAtomToAtomTable()\n");
|
||||
Status = RtlAddAtomToAtomTable(AtomTable,
|
||||
L"TestAtomA",
|
||||
&AtomA);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" AtomA 0x%x\n", AtomA);
|
||||
}
|
||||
|
||||
printf("RtlAddAtomToAtomTable()\n");
|
||||
Status = RtlAddAtomToAtomTable(AtomTable,
|
||||
L"TestAtomB",
|
||||
&AtomB);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" AtomB 0x%x\n", AtomB);
|
||||
}
|
||||
|
||||
|
||||
printf("RtlLookupAtomInAtomTable()\n");
|
||||
Status = RtlLookupAtomInAtomTable(AtomTable,
|
||||
L"TestAtomA",
|
||||
&AtomC);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" AtomC 0x%x\n", AtomC);
|
||||
}
|
||||
|
||||
|
||||
printf("RtlPinAtomInAtomTable()\n");
|
||||
Status = RtlPinAtomInAtomTable(AtomTable,
|
||||
AtomC);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
printf("RtlPinAtomInAtomTable()\n");
|
||||
Status = RtlPinAtomInAtomTable(AtomTable,
|
||||
AtomC);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
|
||||
// printf("RtlDeleteAtomFromAtomTable()\n");
|
||||
// Status = RtlDeleteAtomFromAtomTable(AtomTable,
|
||||
// AtomC);
|
||||
// printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
|
||||
// printf("RtlEmptyAtomTable()\n");
|
||||
// Status = RtlEmptyAtomTable(AtomTable,
|
||||
// TRUE);
|
||||
// printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
|
||||
// printf("RtlLookupAtomInAtomTable()\n");
|
||||
// Status = RtlLookupAtomInAtomTable(AtomTable,
|
||||
// L"TestAtomA",
|
||||
// &AtomC);
|
||||
// printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
|
||||
printf("RtlQueryAtomInAtomTable()\n");
|
||||
NameLength = sizeof(WCHAR) * BUFFER_SIZE;
|
||||
Status = RtlQueryAtomInAtomTable(AtomTable,
|
||||
AtomC,
|
||||
&Data1,
|
||||
&Data2,
|
||||
Buffer,
|
||||
&NameLength);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" RefCount %ld\n", Data1);
|
||||
printf(" PinCount %ld\n", Data2);
|
||||
printf(" NameLength %lu\n", NameLength);
|
||||
printf(" AtomName: %S\n", Buffer);
|
||||
}
|
||||
|
||||
printf("RtlDestroyAtomTable()\n");
|
||||
RtlDestroyAtomTable(AtomTable);
|
||||
|
||||
|
||||
printf("Atom table test app finished\n");
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
21
reactos/apps/tests/atomtest/makefile
Normal file
21
reactos/apps/tests/atomtest/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.5 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = atomtest
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/bench/.cvsignore
Normal file
5
reactos/apps/tests/bench/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
8
reactos/apps/tests/bench/bench-syscall.c
Normal file
8
reactos/apps/tests/bench/bench-syscall.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
}
|
82
reactos/apps/tests/bench/bench-thread.c
Normal file
82
reactos/apps/tests/bench/bench-thread.c
Normal file
@@ -0,0 +1,82 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define NR_THREADS (30)
|
||||
|
||||
|
||||
DWORD WINAPI
|
||||
thread_main1(LPVOID param)
|
||||
{
|
||||
printf("Thread 1 running (Counter %lu)\n", (DWORD)param);
|
||||
SleepEx(INFINITE, TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
DWORD WINAPI
|
||||
thread_main2(LPVOID param)
|
||||
{
|
||||
printf("Thread 2 running (Counter %lu)\n", (DWORD)param);
|
||||
Sleep(INFINITE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
HANDLE hThread;
|
||||
DWORD i=0;
|
||||
DWORD id;
|
||||
|
||||
#if 1
|
||||
printf("Creating %d threads...\n",NR_THREADS*2);
|
||||
for (i=0;i<NR_THREADS;i++)
|
||||
{
|
||||
CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
/* CreateThread(NULL,
|
||||
0,
|
||||
thread_main2,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);*/
|
||||
}
|
||||
|
||||
printf("All threads created...\n");
|
||||
|
||||
/*
|
||||
* Waiting for threads is not implemented yet.
|
||||
* If you want to see all threads running, uncomment the
|
||||
* call to SuspendThread(). The test application will
|
||||
* freeze after all threads are created.
|
||||
*/
|
||||
/* SuspendThread (GetCurrentThread()); */
|
||||
|
||||
#else
|
||||
|
||||
printf("Creating thread...\n");
|
||||
|
||||
hThread = CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
printf("Thread created. Waiting for termination...\n");
|
||||
|
||||
WaitForSingleObject (hThread,
|
||||
-1);
|
||||
|
||||
CloseHandle (hThread);
|
||||
|
||||
printf("Thread terminated...\n");
|
||||
#endif
|
||||
printf("Exiting\n");
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/bench/makefile
Normal file
21
reactos/apps/tests/bench/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.10 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = bench-thread
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/bitblt/.cvsignore
Normal file
5
reactos/apps/tests/bitblt/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
142
reactos/apps/tests/bitblt/bitblt.cpp
Normal file
142
reactos/apps/tests/bitblt/bitblt.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Windows 2000 Graphics API Black Book
|
||||
// Chapter 1 - Listing 1.3 (BitBlt Bitmap Rendering Demo)
|
||||
//
|
||||
// Created by Damon Chandler <dmc27@ee.cornell.edu>
|
||||
// Updates can be downloaded at: <www.coriolis.com>
|
||||
//
|
||||
// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu
|
||||
// if you have any questions about this code.
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
#include <windows.h>
|
||||
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
HINSTANCE HInst;
|
||||
const char* WndClassName = "GMainWnd";
|
||||
LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
|
||||
LPARAM LParam);
|
||||
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE HPrevInstance,
|
||||
LPTSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
HInst = HInstance;
|
||||
|
||||
WNDCLASS wc;
|
||||
memset(&wc, 0, sizeof(WNDCLASS));
|
||||
|
||||
wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
|
||||
wc.lpfnWndProc = MainWndProc;
|
||||
wc.hInstance = HInstance;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1);
|
||||
wc.lpszClassName = WndClassName;
|
||||
|
||||
if (RegisterClass(&wc))
|
||||
{
|
||||
HWND HWnd =
|
||||
CreateWindow(
|
||||
WndClassName, TEXT("BitBlt Bitmap Rendering Demo"),
|
||||
WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION |
|
||||
WS_VISIBLE | WS_CLIPSIBLINGS,
|
||||
0, 0, 220, 230,
|
||||
NULL, NULL, HInst, NULL
|
||||
);
|
||||
|
||||
if (HWnd)
|
||||
{
|
||||
ShowWindow(HWnd, nCmdShow);
|
||||
UpdateWindow(HWnd);
|
||||
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
// image related
|
||||
BITMAP bmp;
|
||||
LPCSTR filename = TEXT("lena.bmp");
|
||||
HDC HMemDC = NULL;
|
||||
HBITMAP HOldBmp = NULL;
|
||||
|
||||
LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
|
||||
LPARAM LParam)
|
||||
{
|
||||
switch (Msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
// create a memory DC
|
||||
HMemDC = CreateCompatibleDC(NULL);
|
||||
if (HMemDC)
|
||||
{
|
||||
// load a bitmap from file
|
||||
HBITMAP HBmp =
|
||||
static_cast<HBITMAP>(
|
||||
LoadImage(HInst, filename, IMAGE_BITMAP,
|
||||
0, 0, LR_LOADFROMFILE)
|
||||
);
|
||||
if (HBmp)
|
||||
{
|
||||
// extract dimensions of the bitmap
|
||||
GetObject(HBmp, sizeof(BITMAP), &bmp);
|
||||
|
||||
// associate the bitmap with the memory DC
|
||||
HOldBmp = static_cast<HBITMAP>(
|
||||
SelectObject(HMemDC, HBmp)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
const HDC Hdc = BeginPaint(HWnd, &ps);
|
||||
#if 0
|
||||
try
|
||||
#endif
|
||||
{
|
||||
//
|
||||
// TODO: add palette support (see Chapter 9)...
|
||||
//
|
||||
|
||||
BitBlt(Hdc, 20, 15,
|
||||
bmp.bmWidth, bmp.bmHeight,
|
||||
HMemDC, 0, 0,
|
||||
SRCCOPY);
|
||||
}
|
||||
#if 0
|
||||
catch (...)
|
||||
#endif
|
||||
{
|
||||
EndPaint(HWnd, &ps);
|
||||
}
|
||||
EndPaint(HWnd, &ps);
|
||||
break;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
{
|
||||
// clean up
|
||||
DeleteObject(SelectObject(HMemDC, HOldBmp));
|
||||
DeleteDC(HMemDC);
|
||||
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return DefWindowProc(HWnd, Msg, WParam, LParam);
|
||||
}
|
||||
//------------------------------------------------------------------
|
BIN
reactos/apps/tests/bitblt/lena.bmp
Normal file
BIN
reactos/apps/tests/bitblt/lena.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 87 KiB |
66
reactos/apps/tests/bitblt/makefile
Normal file
66
reactos/apps/tests/bitblt/makefile
Normal file
@@ -0,0 +1,66 @@
|
||||
# Makefile - Proj_Listing1_5.dsp
|
||||
|
||||
ifndef CFG
|
||||
CFG=Proj_Listing1_5 - Win32 Debug
|
||||
endif
|
||||
CC=gcc
|
||||
CFLAGS=
|
||||
CXX=g++
|
||||
CXXFLAGS=$(CFLAGS)
|
||||
RC=windres -O COFF
|
||||
ifeq "$(CFG)" "Proj_Listing1_5 - Win32 Release"
|
||||
CFLAGS+=-fexceptions -O2 -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS -W
|
||||
LD=$(CXX) $(CXXFLAGS)
|
||||
LDFLAGS=
|
||||
LDFLAGS+=-Wl,--subsystem,windows
|
||||
LIBS+=-lkernel32 -luser32 -lgdi32
|
||||
else
|
||||
ifeq "$(CFG)" "Proj_Listing1_5 - Win32 Debug"
|
||||
CFLAGS+=-fexceptions -g -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_MBCS -W
|
||||
LD=$(CXX) $(CXXFLAGS)
|
||||
LDFLAGS=
|
||||
LDFLAGS+=-Wl,--subsystem,windows
|
||||
LIBS+=-lkernel32 -luser32 -lgdi32
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef TARGET
|
||||
TARGET=bitblt.exe
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: $(TARGET)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
%.res: %.rc
|
||||
$(RC) $(CPPFLAGS) -o $@ -i $<
|
||||
|
||||
SOURCE_FILES= \
|
||||
bitblt.cpp
|
||||
|
||||
HEADER_FILES=
|
||||
|
||||
RESOURCE_FILES=
|
||||
|
||||
SRCS=$(SOURCE_FILES) $(HEADER_FILES) $(RESOURCE_FILES)
|
||||
|
||||
OBJS=$(patsubst %.rc,%.res,$(patsubst %.cpp,%.o,$(patsubst %.c,%.o,$(filter %.c %.cpp %.rc,$(SRCS)))))
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-del $(OBJS) $(TARGET)
|
||||
|
||||
.PHONY: depends
|
||||
depends:
|
||||
-$(CXX) $(CXXFLAGS) $(CPPFLAGS) -MM $(filter %.c %.cpp,$(SRCS)) > Proj_Listing1_5.dep
|
||||
|
||||
-include Proj_Listing1_5.dep
|
||||
|
5
reactos/apps/tests/consume/.cvsignore
Normal file
5
reactos/apps/tests/consume/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
19
reactos/apps/tests/consume/Makefile
Normal file
19
reactos/apps/tests/consume/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: Makefile,v 1.7 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = consume
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
31
reactos/apps/tests/consume/consume.c
Normal file
31
reactos/apps/tests/consume/consume.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define SIZE (65*1024*1024)
|
||||
|
||||
ULONG x[SIZE / 4096];
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
PUCHAR BaseAddress;
|
||||
|
||||
BaseAddress = VirtualAlloc(NULL,
|
||||
SIZE,
|
||||
MEM_COMMIT,
|
||||
PAGE_READONLY);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to allocate virtual memory");
|
||||
return(1);
|
||||
}
|
||||
printf("BaseAddress %p\n", BaseAddress);
|
||||
for (i = 0; i < (SIZE / 4096); i++)
|
||||
{
|
||||
printf("%.8x ", i*4096);
|
||||
x[i] = BaseAddress[i*4096];
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
3
reactos/apps/tests/copymove/.cvsignore
Normal file
3
reactos/apps/tests/copymove/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
*.o
|
||||
*.exe
|
||||
*.sym
|
19
reactos/apps/tests/copymove/Makefile
Normal file
19
reactos/apps/tests/copymove/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: Makefile,v 1.1 2002/12/27 23:54:33 gvg Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = copymove
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
302
reactos/apps/tests/copymove/copymove.c
Normal file
302
reactos/apps/tests/copymove/copymove.c
Normal file
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* CopyFile, MoveFile and related routines test
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
#include <windows.h>
|
||||
|
||||
static TCHAR
|
||||
FindOtherDrive()
|
||||
{
|
||||
DWORD drives = GetLogicalDrives();
|
||||
BOOL found = FALSE;
|
||||
TCHAR drive;
|
||||
TCHAR rootdir[] = _T( "?:\\" );
|
||||
TCHAR currentdir[MAX_PATH + 1];
|
||||
|
||||
if (0 != GetCurrentDirectory(MAX_PATH + 1, currentdir)) {
|
||||
for (drive = _T('A'); ! found && drive <= _T('Z'); drive++) {
|
||||
if (0 != (drives & (1 << (drive - _T('A'))))&&
|
||||
drive != _totupper(currentdir[0])) {
|
||||
rootdir[0] = drive;
|
||||
found = (DRIVE_FIXED == GetDriveType(rootdir));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found ? drive - 1 : _T( ' ' );
|
||||
}
|
||||
|
||||
static void
|
||||
DeleteTestFile(LPCTSTR filename)
|
||||
{
|
||||
SetFileAttributes(filename, FILE_ATTRIBUTE_NORMAL);
|
||||
DeleteFile(filename);
|
||||
}
|
||||
|
||||
static void
|
||||
CreateTestFile(LPCTSTR filename, DWORD attributes)
|
||||
{
|
||||
HANDLE file;
|
||||
char buffer[4096];
|
||||
DWORD wrote;
|
||||
int c;
|
||||
|
||||
DeleteTestFile(filename);
|
||||
file = CreateFile(filename,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (INVALID_HANDLE_VALUE == file) {
|
||||
fprintf(stderr, "CreateFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
for(c = 0; c < sizeof(buffer); c++) {
|
||||
buffer[c] = (char) c;
|
||||
}
|
||||
if (! WriteFile(file, buffer, sizeof(buffer), &wrote, NULL)) {
|
||||
fprintf(stderr, "WriteFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
CloseHandle(file);
|
||||
|
||||
if (! SetFileAttributes(filename, attributes)) {
|
||||
fprintf(stderr, "SetFileAttributes failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DeleteTestDir(LPCTSTR dirname)
|
||||
{
|
||||
RemoveDirectory(dirname);
|
||||
}
|
||||
|
||||
static void
|
||||
CreateTestDir(LPCTSTR dirname)
|
||||
{
|
||||
if (! CreateDirectory(dirname, NULL)) {
|
||||
fprintf(stderr, "CreateDirectory failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
CheckTestFile(LPCTSTR filename, DWORD attributes)
|
||||
{
|
||||
HANDLE file;
|
||||
char buffer[4096];
|
||||
DWORD read;
|
||||
int c;
|
||||
DWORD diskattr;
|
||||
|
||||
file = CreateFile(filename,
|
||||
GENERIC_READ,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (INVALID_HANDLE_VALUE == file) {
|
||||
fprintf(stderr, "CreateFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (! ReadFile(file, buffer, sizeof(buffer), &read, NULL)) {
|
||||
fprintf(stderr, "ReadFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
if (read != sizeof(buffer)) {
|
||||
fprintf(stderr, "Trying to read %d bytes but got %d bytes\n", sizeof(buffer), read);
|
||||
exit(1);
|
||||
}
|
||||
for(c = 0; c < sizeof(buffer); c++) {
|
||||
if (buffer[c] != (char) c) {
|
||||
fprintf(stderr, "File contents changed at position %d\n", c);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle(file);
|
||||
|
||||
diskattr = GetFileAttributes(filename);
|
||||
if (INVALID_FILE_ATTRIBUTES == diskattr) {
|
||||
fprintf(stderr, "GetFileAttributes failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
if (diskattr != attributes) {
|
||||
fprintf(stderr, "Attribute mismatch, expected 0x%08x found 0x%08x\n", attributes, diskattr);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
TCHAR otherdrive;
|
||||
TCHAR otherfile[ ] = _T("?:\\other.dat");
|
||||
|
||||
otherdrive = FindOtherDrive();
|
||||
|
||||
printf("Testing simple move\n");
|
||||
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
if (! MoveFile(_T("begin.dat"), _T("end.dat"))) {
|
||||
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
CheckTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
|
||||
printf("Testing move of non-existing file\n");
|
||||
DeleteTestFile(_T("begin.dat"));
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
if (MoveFile(_T("begin.dat"), _T("end.dat"))) {
|
||||
fprintf(stderr, "MoveFile succeeded but shouldn't have\n");
|
||||
exit(1);
|
||||
} else if (ERROR_FILE_NOT_FOUND != GetLastError()) {
|
||||
fprintf(stderr, "MoveFile failed with unexpected code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
|
||||
/* Not correctly implemented in ros, destination file is kept open after this */
|
||||
#if 0
|
||||
printf("Testing move to existing file\n");
|
||||
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
if (MoveFile(_T("begin.dat"), _T("end.dat"))) {
|
||||
fprintf(stderr, "MoveFile succeeded but shouldn't have\n");
|
||||
exit(1);
|
||||
} else if (ERROR_ALREADY_EXISTS != GetLastError()) {
|
||||
fprintf(stderr, "MoveFile failed with unexpected code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
DeleteTestFile(_T("begin.dat"));
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
#endif
|
||||
|
||||
/* Not implemented yet in ros */
|
||||
#if 0
|
||||
printf("Testing directory move\n");
|
||||
CreateTestDir(_T("begin"));
|
||||
CreateTestFile(_T("begin\\file.dat"), FILE_ATTRIBUTE_NORMAL);
|
||||
DeleteTestDir(_T("end"));
|
||||
if (! MoveFile(_T("begin"), _T("end"))) {
|
||||
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
CheckTestFile(_T("end\\file.dat"), FILE_ATTRIBUTE_NORMAL);
|
||||
DeleteTestFile(_T("end\\file.dat"));
|
||||
DeleteTestDir(_T("end"));
|
||||
#endif
|
||||
|
||||
printf("Testing file move to different directory\n");
|
||||
CreateTestFile(_T("file.dat"), FILE_ATTRIBUTE_NORMAL);
|
||||
CreateTestDir(_T("end"));
|
||||
if (! MoveFile(_T("file.dat"), _T("end\\file.dat"))) {
|
||||
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
CheckTestFile(_T("end\\file.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
DeleteTestFile(_T("end\\file.dat"));
|
||||
DeleteTestDir(_T("end"));
|
||||
|
||||
printf("Testing move of read-only file\n");
|
||||
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_READONLY);
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
if (! MoveFile(_T("begin.dat"), _T("end.dat"))) {
|
||||
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
CheckTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY);
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
|
||||
printf("Testing move to different drive\n");
|
||||
if (_T(' ') != otherdrive) {
|
||||
otherfile[0] = otherdrive;
|
||||
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
DeleteTestFile(otherfile);
|
||||
if (! MoveFile(_T("begin.dat"), otherfile)) {
|
||||
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
CheckTestFile(otherfile, FILE_ATTRIBUTE_ARCHIVE);
|
||||
DeleteTestFile(otherfile);
|
||||
} else {
|
||||
printf(" Test skipped, no other drive available\n");
|
||||
}
|
||||
|
||||
printf("Testing move/overwrite of existing file\n");
|
||||
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
if (! MoveFileEx(_T("begin.dat"), _T("end.dat"), MOVEFILE_REPLACE_EXISTING)) {
|
||||
fprintf(stderr, "MoveFileEx failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
DeleteTestFile(_T("begin.dat"));
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
|
||||
/* Not (correctly) implemented in ros yet */
|
||||
#if 0
|
||||
printf("Testing move/overwrite of existing readonly file\n");
|
||||
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_READONLY);
|
||||
if (MoveFileEx(_T("begin.dat"), _T("end.dat"), MOVEFILE_REPLACE_EXISTING)) {
|
||||
fprintf(stderr, "MoveFileEx succeeded but shouldn't have\n");
|
||||
exit(1);
|
||||
} else if (ERROR_ALREADY_EXISTS != GetLastError() &&
|
||||
ERROR_ACCESS_DENIED != GetLastError()) {
|
||||
fprintf(stderr, "MoveFileEx failed with unexpected code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
DeleteTestFile(_T("begin.dat"));
|
||||
DeleteTestFile(_T("end.dat"));
|
||||
#endif
|
||||
|
||||
/* Not implemented in ros yet */
|
||||
#if 0
|
||||
printf("Testing move to different drive without COPY_ALLOWED\n");
|
||||
if (_T(' ') != otherdrive) {
|
||||
otherfile[0] = otherdrive;
|
||||
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
DeleteTestFile(otherfile);
|
||||
if (MoveFileEx(_T("begin.dat"), otherfile, 0)) {
|
||||
fprintf(stderr, "MoveFileEx succeeded but shouldn't have\n");
|
||||
exit(1);
|
||||
} else if (ERROR_NOT_SAME_DEVICE != GetLastError()) {
|
||||
fprintf(stderr, "MoveFileEx failed with unexpected code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
DeleteTestFile(otherfile);
|
||||
} else {
|
||||
printf(" Test skipped, no other drive available\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Testing move to different drive with COPY_ALLOWED\n");
|
||||
if (_T(' ') != otherdrive) {
|
||||
otherfile[0] = otherdrive;
|
||||
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
|
||||
DeleteTestFile(otherfile);
|
||||
if (! MoveFileEx(_T("begin.dat"), otherfile, MOVEFILE_COPY_ALLOWED)) {
|
||||
fprintf(stderr, "MoveFileEx failed with code %d\n", GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
CheckTestFile(otherfile, FILE_ATTRIBUTE_ARCHIVE);
|
||||
DeleteTestFile(otherfile);
|
||||
} else {
|
||||
printf(" Test skipped, no other drive available\n");
|
||||
}
|
||||
|
||||
printf("All tests successfully completed\n");
|
||||
|
||||
return 0;
|
||||
}
|
5
reactos/apps/tests/count/.cvsignore
Normal file
5
reactos/apps/tests/count/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
21
reactos/apps/tests/count/Makefile
Normal file
21
reactos/apps/tests/count/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: Makefile,v 1.6 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = count
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a user32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
15
reactos/apps/tests/count/count.c
Normal file
15
reactos/apps/tests/count/count.c
Normal file
@@ -0,0 +1,15 @@
|
||||
/* $Id: count.c,v 1.1 2001/03/26 21:30:20 ea Exp $
|
||||
*
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
int n = 0;
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{
|
||||
while (1) printf ("%d ", n ++ );
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* EOF */
|
5
reactos/apps/tests/dibtest/.cvsignore
Normal file
5
reactos/apps/tests/dibtest/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
196
reactos/apps/tests/dibtest/dibtest.c
Normal file
196
reactos/apps/tests/dibtest/dibtest.c
Normal file
@@ -0,0 +1,196 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CELL_SIZE 10
|
||||
|
||||
static RGBQUAD Colors[] =
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // black
|
||||
{ 0x00, 0x00, 0x80, 0x00 }, // red
|
||||
{ 0x00, 0x80, 0x00, 0x00 }, // green
|
||||
{ 0x00, 0x80, 0x80, 0x00 }, // brown
|
||||
{ 0x80, 0x00, 0x00, 0x00 }, // blue
|
||||
{ 0x80, 0x00, 0x80, 0x00 }, // magenta
|
||||
{ 0x80, 0x80, 0x00, 0x00 }, // cyan
|
||||
{ 0x80, 0x80, 0x80, 0x00 }, // dark gray
|
||||
{ 0xc0, 0xc0, 0xc0, 0x00 }, // light gray
|
||||
{ 0x00, 0x00, 0xFF, 0x00 }, // bright red
|
||||
{ 0x00, 0xFF, 0x00, 0x00 }, // bright green
|
||||
{ 0x00, 0xFF, 0xFF, 0x00 }, // bright yellow
|
||||
{ 0xFF, 0x00, 0x00, 0x00 }, // bright blue
|
||||
{ 0xFF, 0x00, 0xFF, 0x00 }, // bright magenta
|
||||
{ 0xFF, 0xFF, 0x00, 0x00 }, // bright cyan
|
||||
{ 0xFF, 0xFF, 0xFF, 0x00 } // bright white
|
||||
};
|
||||
|
||||
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
MSG msg;
|
||||
HWND hWnd;
|
||||
|
||||
wc.lpszClassName = "DibTestClass";
|
||||
wc.lpfnWndProc = MainWndProc;
|
||||
wc.style = CS_VREDRAW | CS_HREDRAW;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
if (RegisterClass(&wc) == 0)
|
||||
{
|
||||
fprintf(stderr, "RegisterClass failed (last error 0x%X)\n",
|
||||
GetLastError());
|
||||
return(1);
|
||||
}
|
||||
|
||||
hWnd = CreateWindow("DibTestClass",
|
||||
"DIB Test",
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
25 * CELL_SIZE + 5,
|
||||
25 * CELL_SIZE + 20,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
fprintf(stderr, "CreateWindow failed (last error 0x%X)\n",
|
||||
GetLastError());
|
||||
return(1);
|
||||
}
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
|
||||
while(GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
static void PaintCells(HDC WindowDC, WORD BitCount1, WORD BitCount2,
|
||||
int XDest, int YDest)
|
||||
{
|
||||
HBRUSH Brush;
|
||||
RECT Rect;
|
||||
UINT row, col;
|
||||
BITMAPINFO *BitmapInfo;
|
||||
HBITMAP DIB1, DIB2;
|
||||
HDC DC1, DC2;
|
||||
|
||||
BitmapInfo = malloc(sizeof(BITMAPINFO) + 15 * sizeof(RGBQUAD));
|
||||
BitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
BitmapInfo->bmiHeader.biWidth = 4 * CELL_SIZE + 9;
|
||||
BitmapInfo->bmiHeader.biHeight = -(4 * CELL_SIZE + 9); // it's top down (since BI_RGB is used, the sign is operative of direction)
|
||||
BitmapInfo->bmiHeader.biPlanes = 1;
|
||||
BitmapInfo->bmiHeader.biBitCount = BitCount1;
|
||||
BitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||||
BitmapInfo->bmiHeader.biSizeImage = 0;
|
||||
BitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||||
BitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||||
BitmapInfo->bmiHeader.biClrUsed = 16;
|
||||
BitmapInfo->bmiHeader.biClrImportant = 16;
|
||||
for (col = 0; col < 16; col++) {
|
||||
BitmapInfo->bmiColors[col] = Colors[col];
|
||||
}
|
||||
DIB1 = CreateDIBSection(NULL, BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
DC1 = CreateCompatibleDC(NULL);
|
||||
SelectObject(DC1, DIB1);
|
||||
|
||||
BitmapInfo->bmiHeader.biBitCount = BitCount2;
|
||||
DIB2 = CreateDIBSection(NULL, BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
DC2 = CreateCompatibleDC(NULL);
|
||||
SelectObject(DC2, DIB2);
|
||||
free(BitmapInfo);
|
||||
|
||||
/* Now paint on the first bitmap */
|
||||
for (row = 0; row < 4; row++)
|
||||
{
|
||||
for (col = 0; col < 4; col++)
|
||||
{
|
||||
Brush = CreateSolidBrush(RGB(Colors[4 * row + col].rgbRed,
|
||||
Colors[4 * row + col].rgbGreen,
|
||||
Colors[4 * row + col].rgbBlue));
|
||||
Rect.left = CELL_SIZE * col + 5;
|
||||
Rect.top = CELL_SIZE * row + 5;
|
||||
Rect.right = Rect.left + CELL_SIZE;
|
||||
Rect.bottom = Rect.top + CELL_SIZE;
|
||||
FillRect(DC1, &Rect, Brush);
|
||||
DeleteObject(Brush);
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy the first bitmap to the second */
|
||||
BitBlt(DC2, 4, 4, 4 * CELL_SIZE, 4 * CELL_SIZE, DC1, 5, 5, SRCCOPY);
|
||||
|
||||
/* Show results on screen */
|
||||
BitBlt(WindowDC, XDest, YDest, 4 * CELL_SIZE, 4 * CELL_SIZE, DC2, 4, 4, SRCCOPY);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK MainWndProc(HWND Wnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC WindowDC;
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
WindowDC = BeginPaint(Wnd, &ps);
|
||||
|
||||
PaintCells(WindowDC, 4, 4, 0, 0);
|
||||
PaintCells(WindowDC, 4, 8, 5 * CELL_SIZE, 0);
|
||||
PaintCells(WindowDC, 4, 16, 10 * CELL_SIZE, 0);
|
||||
PaintCells(WindowDC, 4, 24, 15 * CELL_SIZE, 0);
|
||||
PaintCells(WindowDC, 4, 32, 20 * CELL_SIZE, 0);
|
||||
|
||||
PaintCells(WindowDC, 8, 4, 0, 5 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 8, 8, 5 * CELL_SIZE, 5 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 8, 16, 10 * CELL_SIZE, 5 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 8, 24, 15 * CELL_SIZE, 5 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 8, 32, 20 * CELL_SIZE, 5 * CELL_SIZE);
|
||||
|
||||
PaintCells(WindowDC, 16, 4, 0, 10 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 16, 8, 5 * CELL_SIZE, 10 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 16, 16, 10 * CELL_SIZE, 10 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 16, 24, 15 * CELL_SIZE, 10 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 16, 32, 20 * CELL_SIZE, 10 * CELL_SIZE);
|
||||
|
||||
PaintCells(WindowDC, 24, 4, 0, 15 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 24, 8, 5 * CELL_SIZE, 15 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 24, 16, 10 * CELL_SIZE, 15 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 24, 24, 15 * CELL_SIZE, 15 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 24, 32, 20 * CELL_SIZE, 15 * CELL_SIZE);
|
||||
|
||||
PaintCells(WindowDC, 32, 4, 0, 20 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 32, 8, 5 * CELL_SIZE, 20 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 32, 16, 10 * CELL_SIZE, 20 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 32, 24, 15 * CELL_SIZE, 20 * CELL_SIZE);
|
||||
PaintCells(WindowDC, 32, 32, 20 * CELL_SIZE, 20 * CELL_SIZE);
|
||||
|
||||
EndPaint(Wnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(Wnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/dibtest/makefile
Normal file
21
reactos/apps/tests/dibtest/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.2 2003/03/04 10:09:00 gvg Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = dibtest
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a gdi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/dump_shared_data/.cvsignore
Normal file
5
reactos/apps/tests/dump_shared_data/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
51
reactos/apps/tests/dump_shared_data/dump_shared_data.c
Normal file
51
reactos/apps/tests/dump_shared_data/dump_shared_data.c
Normal file
@@ -0,0 +1,51 @@
|
||||
#include <stdio.h>
|
||||
#include <ntddk.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("TickCountLow: %x\n",
|
||||
SharedUserData->TickCountLow);
|
||||
printf("Drives: ");
|
||||
for (i = 0; i < 26; i++)
|
||||
{
|
||||
printf("%c", (SharedUserData->DosDeviceMap & (1 << i))?'1':'0');
|
||||
}
|
||||
printf("\n");
|
||||
for (i = 0; i < 26; i++)
|
||||
{
|
||||
if (SharedUserData->DosDeviceMap & (1 << i))
|
||||
{
|
||||
printf("%c: ", 'A'+i);
|
||||
switch(SharedUserData->DosDeviceDriveType[i])
|
||||
{
|
||||
case DOSDEVICE_DRIVE_UNKNOWN:
|
||||
printf("Unknown\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_CALCULATE:
|
||||
printf("No root\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_REMOVABLE:
|
||||
printf("Removable\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_FIXED:
|
||||
printf("Fixed\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_REMOTE:
|
||||
printf("Remote\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_CDROM:
|
||||
printf("CD-ROM\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_RAMDISK:
|
||||
printf("Ram disk\n");
|
||||
break;
|
||||
default:
|
||||
printf("undefined type\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n\n");
|
||||
}
|
20
reactos/apps/tests/dump_shared_data/makefile
Normal file
20
reactos/apps/tests/dump_shared_data/makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# $Id: makefile,v 1.6 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = dump_shared_data
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
||||
|
5
reactos/apps/tests/event/.cvsignore
Normal file
5
reactos/apps/tests/event/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
33
reactos/apps/tests/event/event.c
Normal file
33
reactos/apps/tests/event/event.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE events[2];
|
||||
|
||||
DWORD WINAPI thread( LPVOID crap )
|
||||
{
|
||||
SetEvent( events[0] );
|
||||
if( crap )
|
||||
SetEvent( events[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
DWORD id, Status;
|
||||
printf( "Creating events\n" );
|
||||
events[0] = CreateEvent( 0, TRUE, FALSE, 0 );
|
||||
events[1] = CreateEvent( 0, TRUE, FALSE, 0 );
|
||||
printf( "Created events\n" );
|
||||
CreateThread( 0, 0, thread, 0, 0, &id );
|
||||
printf( "WaitForSingleObject %s\n", ( WaitForSingleObject( events[0], INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
CreateThread( 0, 0, thread, 0, 0, &id );
|
||||
printf( "WaitForMultipleObjects with waitall = FALSE %s\n", ( WaitForMultipleObjects( 2, events, FALSE, INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
CreateThread( 0, 0, thread, (void *)1, 0, &id );
|
||||
Status = WaitForMultipleObjects( 2, events, TRUE, INFINITE );
|
||||
printf( "WaitForMultipleObjects with waitall = TRUE %s\n", ( Status == WAIT_OBJECT_0 || Status == WAIT_OBJECT_0 + 1 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
printf( "WaitForSingleObject with timeout %s\n", ( WaitForSingleObject( events[0], 100 ) == WAIT_TIMEOUT ? "worked" : "failed" ) );
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/event/makefile
Normal file
21
reactos/apps/tests/event/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.7 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = event
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/file/.cvsignore
Normal file
5
reactos/apps/tests/file/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
19
reactos/apps/tests/file/Makefile
Normal file
19
reactos/apps/tests/file/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: Makefile,v 1.8 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = file
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
54
reactos/apps/tests/file/file.c
Normal file
54
reactos/apps/tests/file/file.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/***********************************************************
|
||||
* File read/write test utility *
|
||||
**********************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main( void )
|
||||
{
|
||||
HANDLE file;
|
||||
char buffer[4096];
|
||||
DWORD wrote;
|
||||
int c;
|
||||
|
||||
file = CreateFile("test.dat",
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (file == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Error opening file (Status %x)\n", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
for( c = 0; c < sizeof( buffer ); c++ )
|
||||
buffer[c] = (char)c;
|
||||
printf("Writing file\n");
|
||||
if (WriteFile( file, buffer, 4096, &wrote, NULL) == FALSE)
|
||||
{
|
||||
printf("Error writing file (Status %x)\n", GetLastError());
|
||||
exit(2);
|
||||
}
|
||||
printf("Reading file\n");
|
||||
SetFilePointer( file, 0, 0, FILE_BEGIN );
|
||||
if (ReadFile( file, buffer, 4096, &wrote, NULL) == FALSE)
|
||||
{
|
||||
printf("Error reading file (Status %x)\n", GetLastError());
|
||||
exit(3);
|
||||
}
|
||||
for( c = 0; c < sizeof( buffer ); c++ )
|
||||
if( buffer[c] != (char)c )
|
||||
{
|
||||
printf( "Error: data read back is not what was written\n" );
|
||||
CloseHandle( file );
|
||||
return 0;
|
||||
}
|
||||
printf("Finished, works fine\n");
|
||||
CloseHandle( file );
|
||||
return 0;
|
||||
}
|
5
reactos/apps/tests/gditest/.cvsignore
Normal file
5
reactos/apps/tests/gditest/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
344
reactos/apps/tests/gditest/gditest.c
Normal file
344
reactos/apps/tests/gditest/gditest.c
Normal file
@@ -0,0 +1,344 @@
|
||||
/*
|
||||
* gditest
|
||||
dec 26, 2001 -- gditest bug fix by Richard Campbell
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
extern BOOL STDCALL GdiDllInitialize(HANDLE hInstance, DWORD Event, LPVOID Reserved);
|
||||
|
||||
void __stdcall Background (HDC Desktop)
|
||||
{
|
||||
HPEN Pen;
|
||||
int x, y;
|
||||
|
||||
Pen = CreatePen(PS_SOLID, 1, RGB(64, 64, 128));
|
||||
|
||||
SelectObject (Desktop, Pen);
|
||||
|
||||
MoveToEx (Desktop, 0, 0, NULL);
|
||||
LineTo (Desktop, 640, 480);
|
||||
for (y = 479, x = 0; x < 640; x+=42)
|
||||
{
|
||||
MoveToEx (Desktop, 0, 0, NULL);
|
||||
LineTo (Desktop, x, y);
|
||||
}
|
||||
for (y = 0, x = 639; y < 480; y+=42)
|
||||
{
|
||||
MoveToEx (Desktop, 0, 0, NULL);
|
||||
LineTo (Desktop, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void gditest( void ){
|
||||
HDC Desktop, MyDC, DC24;
|
||||
HPEN RedPen, GreenPen, BluePen, WhitePen;
|
||||
HBITMAP MyBitmap, DIB24;
|
||||
HFONT hf, tf;
|
||||
BITMAPINFOHEADER BitInf;
|
||||
BITMAPINFO BitPalInf;
|
||||
HRGN hRgn1, hRgn2, hRgn3;
|
||||
HBRUSH BlueBrush, DefBrush;
|
||||
|
||||
// Set up a DC called Desktop that accesses DISPLAY
|
||||
Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
|
||||
if (Desktop == NULL){
|
||||
printf("Can't create desktop\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Background
|
||||
Background (Desktop);
|
||||
|
||||
|
||||
//ei
|
||||
BlueBrush = CreateSolidBrush( RGB(0, 0, 0xff) );
|
||||
DefBrush = SelectObject( Desktop, BlueBrush );
|
||||
|
||||
hRgn1 = CreateRectRgn( 1, 2, 100, 101 );
|
||||
hRgn2 = CreateRectRgn( 10, 20, 150, 151 );
|
||||
hRgn3 = CreateRectRgn( 1, 1, 1, 1);
|
||||
CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR );
|
||||
|
||||
PaintRgn( Desktop, hRgn3 );
|
||||
SelectObject( Desktop, DefBrush );
|
||||
DeleteObject( BlueBrush );
|
||||
|
||||
// Create a blue pen and select it into the DC
|
||||
BluePen = CreatePen(PS_SOLID, 8, RGB(0, 0, 0xff));
|
||||
SelectObject(Desktop, BluePen);
|
||||
|
||||
// Draw a shape on the DC
|
||||
MoveToEx(Desktop, 50, 50, NULL);
|
||||
LineTo(Desktop, 200, 60);
|
||||
LineTo(Desktop, 200, 300);
|
||||
LineTo(Desktop, 50, 50);
|
||||
MoveToEx(Desktop, 50, 50, NULL);
|
||||
LineTo(Desktop, 200, 50);
|
||||
|
||||
WhitePen = CreatePen(PS_SOLID, 3, RGB(0xff, 0xff, 0xff));
|
||||
SelectObject(Desktop, WhitePen);
|
||||
|
||||
MoveToEx(Desktop, 20, 70, NULL);
|
||||
LineTo(Desktop, 500, 70);
|
||||
MoveToEx(Desktop, 70, 20, NULL);
|
||||
LineTo(Desktop, 70, 150);
|
||||
|
||||
// Test font support
|
||||
GreenPen = CreatePen(PS_SOLID, 3, RGB(0, 0xff, 0));
|
||||
RedPen = CreatePen(PS_SOLID, 3, RGB(0xff, 0, 0));
|
||||
|
||||
hf = CreateFontA(24, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Helmet");
|
||||
SelectObject(Desktop, hf);
|
||||
SetTextColor(Desktop, RGB(0xff, 0, 0));
|
||||
TextOutA(Desktop, 70, 70, "React", 5);
|
||||
SetTextColor(Desktop, RGB(0, 0xff, 0));
|
||||
TextOutA(Desktop, 140, 70, "OS", 2);
|
||||
|
||||
tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");
|
||||
SelectObject(Desktop, tf);
|
||||
SetTextColor(Desktop, RGB(0xff, 0xff, 0xff));
|
||||
TextOutA(Desktop, 70, 90, "This is a test of ReactOS text, using the FreeType 2 library!", 61);
|
||||
|
||||
// TEST 1: Copy from the VGA into a device compatible DC, draw on it, then blt it to the VGA again
|
||||
MyDC = CreateCompatibleDC(Desktop);
|
||||
MyBitmap = CreateCompatibleBitmap(Desktop, 151, 251);
|
||||
SelectObject(MyDC, MyBitmap);
|
||||
BitBlt(MyDC, 0, 0, 151, 251, Desktop, 50, 50, SRCCOPY); // can we say 151, 251 since bottom corner is not inclusive?
|
||||
|
||||
SelectObject(MyDC, GreenPen);
|
||||
Rectangle(MyDC, 10, 10, 50, 50);
|
||||
|
||||
// TEST 2: Copy from the device compatible DC into a 24BPP bitmap, draw on it, then blt to the VGA again
|
||||
BitInf.biSize = sizeof(BITMAPINFOHEADER);
|
||||
BitInf.biWidth = 152;
|
||||
BitInf.biHeight = -252; // it's top down (since BI_RGB is used, the sign is operative of direction)
|
||||
BitInf.biPlanes = 1;
|
||||
BitInf.biBitCount = 24;
|
||||
BitInf.biCompression = BI_RGB;
|
||||
BitInf.biSizeImage = 0;
|
||||
BitInf.biXPelsPerMeter = 0;
|
||||
BitInf.biYPelsPerMeter = 0;
|
||||
BitInf.biClrUsed = 0;
|
||||
BitInf.biClrImportant = 0;
|
||||
BitPalInf.bmiHeader = BitInf;
|
||||
DIB24 = (HBITMAP) CreateDIBSection(NULL, &BitPalInf, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
DC24 = CreateCompatibleDC(NULL);
|
||||
SelectObject(DC24, DIB24);
|
||||
|
||||
BitBlt(DC24, 0, 0, 101, 201, MyDC, 0, 0, SRCCOPY);
|
||||
SelectObject(DC24, RedPen);
|
||||
Rectangle(DC24, 80, 90, 100, 110);
|
||||
MoveToEx(DC24, 80, 90, NULL);
|
||||
LineTo(DC24, 100, 110);
|
||||
BitBlt(Desktop, 200, 200, 110, 120, DC24, 0, 0, SRCCOPY);
|
||||
|
||||
Sleep( 10000 ); // fixme delay only 10000 (for 10 seconds)
|
||||
// Free up everything
|
||||
DeleteDC(Desktop);
|
||||
DeleteDC(MyDC);
|
||||
}
|
||||
|
||||
void DumpRgnData( HRGN hRgn )
|
||||
{
|
||||
int size, ret, i;
|
||||
LPRGNDATA rgnData;
|
||||
|
||||
size = GetRegionData( hRgn, 0, NULL );
|
||||
if( size == 0 ){
|
||||
printf("GetRegionData returned 0\n");
|
||||
return;
|
||||
}
|
||||
rgnData = (LPRGNDATA) malloc( size );
|
||||
ret = GetRegionData( hRgn, size, rgnData );
|
||||
if( ret == 0 ){
|
||||
printf("GetRegionData( hRgn, size, rgnData ) returned 0\n");
|
||||
return;
|
||||
}
|
||||
printf("Bounds: left=%d top=%d right=%d bottom=%d, count: %d, type: %i\n\n",
|
||||
rgnData->rdh.rcBound.left, rgnData->rdh.rcBound.top, rgnData->rdh.rcBound.right, rgnData->rdh.rcBound.bottom,
|
||||
rgnData->rdh.nCount, rgnData->rdh.iType);
|
||||
printf("Rects:\t i \t left \t top \t right \t bottom\n");
|
||||
for ( i = 0; i < rgnData->rdh.nCount; i++ ) {
|
||||
PRECT pr = (PRECT) rgnData->Buffer + i;
|
||||
printf("\t %d \t %d \t %d \t %d \t %d\n", i, pr->left, pr->top, pr->right, pr->bottom );
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void rgntest( void )
|
||||
{
|
||||
HRGN hRgn1, hRgn2, hRgn3;
|
||||
RECT Rect;
|
||||
int i;
|
||||
|
||||
hRgn1 = CreateRectRgn( 1, 2, 100, 101 );
|
||||
if( hRgn1 == NULL ) {
|
||||
printf("Failed at hRgn1 = CreateRectRgn( 1, 2, 100, 101 )\n");
|
||||
return;
|
||||
}
|
||||
i = GetRgnBox( hRgn1, &Rect );
|
||||
if( i==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("GetRgnBox( hRgn1, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
|
||||
DumpRgnData( hRgn1 );
|
||||
|
||||
hRgn2 = CreateRectRgn( 51, 53, 150, 152 );
|
||||
if( hRgn2 == NULL ) {
|
||||
printf("Failed at hRgn2 = CreateRectRgn( 51, 53, 150, 152 )\n");
|
||||
return;
|
||||
}
|
||||
i = GetRgnBox( hRgn2, &Rect );
|
||||
if( i==0 ){
|
||||
printf("Failed GetRgnBox( hRgn2, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("GetRgnBox( hRgn2, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
|
||||
DumpRgnData( hRgn2 );
|
||||
|
||||
if( EqualRgn( hRgn1, hRgn2 ) == TRUE ){
|
||||
printf("\t hRgn1, hRgn2 are equal\n");
|
||||
}
|
||||
else{
|
||||
printf("\t hRgn1, hRgn2 are NOT equal\n\n");
|
||||
}
|
||||
|
||||
i = OffsetRgn(hRgn1,50,51);
|
||||
if( i==ERROR ){
|
||||
printf("Failed OffsetRgn(hRgn1,50,51)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
i = GetRgnBox( hRgn1, &Rect );
|
||||
if( i==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After offset\nGetRgnBox( hRgn1, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
|
||||
if( EqualRgn( hRgn1, hRgn2 ) == TRUE ){
|
||||
printf("\t hRgn1, hRgn2 are equal after offset\n");
|
||||
}
|
||||
else{
|
||||
printf("\t hRgn1, hRgn2 are NOT equal after offset!\n\n");
|
||||
}
|
||||
|
||||
i = SetRectRgn(hRgn1, 10, 11, 110, 111 );
|
||||
if( i==0 ){
|
||||
printf("Failed SetRectRgn(hRgn1... )\n");
|
||||
return;
|
||||
}
|
||||
i = GetRgnBox( hRgn1, &Rect );
|
||||
if( i==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("after SetRectRgn(hRgn1, 10, 11, 110, 111 ):\n i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
|
||||
hRgn3 = CreateRectRgn( 1, 1, 1, 1);
|
||||
i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn3, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn3 );
|
||||
|
||||
i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn3, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn3 );
|
||||
|
||||
i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_DIFF );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_DIFF ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn3, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_DIFF ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn3 );
|
||||
|
||||
i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn3, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn3, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn3 );
|
||||
|
||||
i = CombineRgn( hRgn1, hRgn3, hRgn2, RGN_COPY );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn1, hRgn3, hRgn2, RGN_COPY ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn1, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn1, hRgn3, hRgn2, RGN_COPY ): \nGetRgnBox( hRgn1, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn1 );
|
||||
|
||||
|
||||
DeleteObject( hRgn1 );
|
||||
DeleteObject( hRgn2 );
|
||||
DeleteObject( hRgn3 );
|
||||
printf("region test finished\n");
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
printf("Entering GDITest..\n");
|
||||
printf("use gditest for older tests\n");
|
||||
printf("use gditest 1 for region test\n");
|
||||
|
||||
GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
|
||||
if( argc < 2 )
|
||||
gditest();
|
||||
else {
|
||||
if( !strncmp( argv[1], "1", 1 ) ) {
|
||||
rgntest();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/gditest/makefile
Normal file
21
reactos/apps/tests/gditest/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.8 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = gditest
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a gdi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/hello/.cvsignore
Normal file
5
reactos/apps/tests/hello/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
8
reactos/apps/tests/hello/hello.c
Normal file
8
reactos/apps/tests/hello/hello.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("Hello world\n");
|
||||
return(0);
|
||||
}
|
19
reactos/apps/tests/hello/makefile
Normal file
19
reactos/apps/tests/hello/makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: makefile,v 1.16 2002/06/02 19:24:59 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = hello
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/hivetest/.cvsignore
Normal file
5
reactos/apps/tests/hivetest/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
1205
reactos/apps/tests/hivetest/hivetest.c
Normal file
1205
reactos/apps/tests/hivetest/hivetest.c
Normal file
File diff suppressed because it is too large
Load Diff
22
reactos/apps/tests/hivetest/makefile
Normal file
22
reactos/apps/tests/hivetest/makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# $Id: makefile,v 1.1 2003/02/09 18:26:36 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = hivetest
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
5
reactos/apps/tests/isotest/.cvsignore
Normal file
5
reactos/apps/tests/isotest/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
229
reactos/apps/tests/isotest/isotest.c
Normal file
229
reactos/apps/tests/isotest/isotest.c
Normal file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* isotest - display cdrom information
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
//#include <winioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
void HexDump(char *buffer, ULONG size)
|
||||
{
|
||||
ULONG offset = 0;
|
||||
unsigned char *ptr;
|
||||
|
||||
while (offset < (size & ~15))
|
||||
{
|
||||
ptr = (unsigned char*)((ULONG)buffer + offset);
|
||||
printf("%08lx %02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx-%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx",
|
||||
offset,
|
||||
ptr[0],
|
||||
ptr[1],
|
||||
ptr[2],
|
||||
ptr[3],
|
||||
ptr[4],
|
||||
ptr[5],
|
||||
ptr[6],
|
||||
ptr[7],
|
||||
ptr[8],
|
||||
ptr[9],
|
||||
ptr[10],
|
||||
ptr[11],
|
||||
ptr[12],
|
||||
ptr[13],
|
||||
ptr[14],
|
||||
ptr[15]);
|
||||
|
||||
printf(" %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
|
||||
isprint(ptr[0])?ptr[0]:'.',
|
||||
isprint(ptr[1])?ptr[1]:'.',
|
||||
isprint(ptr[2])?ptr[2]:'.',
|
||||
isprint(ptr[3])?ptr[3]:'.',
|
||||
isprint(ptr[4])?ptr[4]:'.',
|
||||
isprint(ptr[5])?ptr[5]:'.',
|
||||
isprint(ptr[6])?ptr[6]:'.',
|
||||
isprint(ptr[7])?ptr[7]:'.',
|
||||
isprint(ptr[8])?ptr[8]:'.',
|
||||
isprint(ptr[9])?ptr[9]:'.',
|
||||
isprint(ptr[10])?ptr[10]:'.',
|
||||
isprint(ptr[11])?ptr[11]:'.',
|
||||
isprint(ptr[12])?ptr[12]:'.',
|
||||
isprint(ptr[13])?ptr[13]:'.',
|
||||
isprint(ptr[14])?ptr[14]:'.',
|
||||
isprint(ptr[15])?ptr[15]:'.');
|
||||
|
||||
offset += 16;
|
||||
}
|
||||
|
||||
ptr = (unsigned char*)((ULONG)buffer + offset);
|
||||
if (offset < size)
|
||||
{
|
||||
printf("%08lx ", offset);
|
||||
while (offset < size)
|
||||
{
|
||||
printf(" %02hx", *ptr);
|
||||
offset++;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
|
||||
#ifndef EVENT_ALL_ACCESS
|
||||
#define EVENT_ALL_ACCESS (0x1f0003L)
|
||||
#endif
|
||||
|
||||
BOOL
|
||||
ReadBlock(HANDLE FileHandle,
|
||||
PVOID Buffer,
|
||||
PLARGE_INTEGER Offset,
|
||||
ULONG Length,
|
||||
PULONG BytesRead)
|
||||
{
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status;
|
||||
HANDLE EventHandle;
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
NULL, 0, NULL, NULL);
|
||||
|
||||
Status = NtCreateEvent(&EventHandle,
|
||||
EVENT_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
TRUE,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("NtCreateEvent() failed\n");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
Status = NtReadFile(FileHandle,
|
||||
EventHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
&IoStatusBlock,
|
||||
Buffer,
|
||||
Length,
|
||||
Offset,
|
||||
NULL);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
NtWaitForSingleObject(EventHandle, FALSE, NULL);
|
||||
Status = IoStatusBlock.Status;
|
||||
}
|
||||
|
||||
NtClose(EventHandle);
|
||||
|
||||
if (Status != STATUS_PENDING && BytesRead != NULL)
|
||||
{
|
||||
*BytesRead = IoStatusBlock.Information;
|
||||
}
|
||||
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
|
||||
{
|
||||
printf("ReadBlock() failed (Status: %lx)\n", Status);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
HANDLE hDisk;
|
||||
DWORD dwRead;
|
||||
DWORD i;
|
||||
char *Buffer;
|
||||
CHAR Filename[80];
|
||||
LARGE_INTEGER FilePosition;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: isotest [Drive:]\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
strcpy(Filename, "\\\\.\\");
|
||||
strcat(Filename, argv[1]);
|
||||
|
||||
hDisk = CreateFile(Filename,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
NULL);
|
||||
if (hDisk == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("CreateFile(): Invalid disk handle!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Buffer = (char*)malloc(2048);
|
||||
if (Buffer == NULL)
|
||||
{
|
||||
CloseHandle(hDisk);
|
||||
printf("Out of memory!\n");
|
||||
return 0;
|
||||
}
|
||||
memset(Buffer, 0, 2048);
|
||||
|
||||
|
||||
FilePosition.QuadPart = 16 * 2048;
|
||||
#if 0
|
||||
SetLastError(NO_ERROR);
|
||||
SetFilePointer(hDisk,
|
||||
FilePosition.u.LowPart,
|
||||
&FilePosition.u.HighPart,
|
||||
FILE_BEGIN);
|
||||
if (GetLastError() != NO_ERROR)
|
||||
{
|
||||
CloseHandle(hDisk);
|
||||
free(Buffer);
|
||||
printf("SetFilePointer() failed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ReadFile(hDisk,
|
||||
Buffer,
|
||||
2048,
|
||||
&dwRead,
|
||||
NULL) == FALSE)
|
||||
{
|
||||
CloseHandle(hDisk);
|
||||
free(Buffer);
|
||||
printf("ReadFile() failed!\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ReadBlock(hDisk,
|
||||
Buffer,
|
||||
&FilePosition,
|
||||
2048,
|
||||
&dwRead) == FALSE)
|
||||
{
|
||||
CloseHandle(hDisk);
|
||||
free(Buffer);
|
||||
#if 0
|
||||
printf("ReadBlock() failed!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
HexDump(Buffer, 128);
|
||||
|
||||
CloseHandle(hDisk);
|
||||
|
||||
free(Buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
23
reactos/apps/tests/isotest/makefile
Normal file
23
reactos/apps/tests/isotest/makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
# $Id: makefile,v 1.2 2002/06/02 19:24:59 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = isotest
|
||||
|
||||
#TARGET_CFLAGS = -fnative_struct
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
21
reactos/apps/tests/lock/Makefile
Normal file
21
reactos/apps/tests/lock/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: Makefile,v 1.1 2003/01/25 15:46:52 hbirr Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = lock
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a user32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
112
reactos/apps/tests/lock/lock.c
Normal file
112
reactos/apps/tests/lock/lock.c
Normal file
@@ -0,0 +1,112 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE hFile;
|
||||
|
||||
BOOL Slock(DWORD start,DWORD len)
|
||||
{
|
||||
|
||||
OVERLAPPED overl;
|
||||
BOOL stat;
|
||||
overl.Offset = start;
|
||||
overl.OffsetHigh = 0;
|
||||
overl.hEvent = 0;
|
||||
|
||||
|
||||
stat = LockFileEx(hFile,LOCKFILE_FAIL_IMMEDIATELY,0,len,0,&overl) ;
|
||||
printf("Slock %i-%i %s\n",start,start+len,stat!=0 ? "OK" : "FAILED");
|
||||
return stat;
|
||||
|
||||
}
|
||||
|
||||
BOOL Xlock(DWORD start,DWORD len)
|
||||
{
|
||||
|
||||
OVERLAPPED overl;
|
||||
BOOL stat;
|
||||
|
||||
overl.Offset = start;
|
||||
overl.OffsetHigh = 0;
|
||||
overl.hEvent = 0;
|
||||
|
||||
stat = LockFileEx(hFile,LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY,0,len,0,&overl);
|
||||
|
||||
printf("Xlock %i-%i %s\n",start,start+len,stat!=0 ? "OK" : "FAILED");
|
||||
return stat;
|
||||
|
||||
|
||||
}
|
||||
|
||||
BOOL unlock(DWORD start,DWORD len)
|
||||
{
|
||||
|
||||
OVERLAPPED overl;
|
||||
BOOL stat;
|
||||
overl.Offset = start;
|
||||
overl.OffsetHigh = 0;
|
||||
overl.hEvent = 0;
|
||||
|
||||
stat = UnlockFileEx(hFile,0,len,0,&overl) ;
|
||||
printf("unlock %i-%i %s\n",start,start+len,stat!=0 ? "OK" : "FAILED");
|
||||
return stat;
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOL mkfile()
|
||||
{
|
||||
hFile = CreateFile("C:\\lock.test",
|
||||
GENERIC_READ|GENERIC_WRITE,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
OPEN_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL);
|
||||
|
||||
printf("mkfile %s\n",(hFile == INVALID_HANDLE_VALUE) ? "FAILED" : "OK");
|
||||
return !(hFile == INVALID_HANDLE_VALUE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
DWORD ass;
|
||||
|
||||
printf("enter main\n");
|
||||
|
||||
mkfile();
|
||||
|
||||
Slock(8,10);
|
||||
Slock(10,5);
|
||||
Slock(10,5);
|
||||
Slock(15,5);
|
||||
Slock(5,10);
|
||||
Slock(0,100);
|
||||
Xlock(30,10);
|
||||
Xlock(30,1);
|
||||
unlock(30,1);
|
||||
unlock(30,10);
|
||||
Xlock(30,5);
|
||||
Slock(35,5);
|
||||
unlock(50,5);
|
||||
unlock(0,100);
|
||||
unlock(10,5);
|
||||
|
||||
if (WriteFile(hFile,"ass",4,&ass,NULL) == 0) printf("write 1 failed\n");
|
||||
else printf("write 1 success\n");
|
||||
|
||||
CloseHandle(hFile);
|
||||
mkfile();
|
||||
Slock(0,100);
|
||||
|
||||
if (WriteFile(hFile,"ass",4,&ass,NULL) == 0) printf("write 2 failed\n");
|
||||
else printf("write 2 success\n");
|
||||
|
||||
|
||||
CloseHandle(hFile);
|
||||
Sleep(10000);
|
||||
|
||||
|
||||
}
|
5
reactos/apps/tests/lpc/.cvsignore
Normal file
5
reactos/apps/tests/lpc/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
205
reactos/apps/tests/lpc/conport.c
Normal file
205
reactos/apps/tests/lpc/conport.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/* $Id: conport.c,v 1.6 2000/04/25 23:22:46 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/conport.c
|
||||
*
|
||||
* To be run in a real WNT 4.0 system with
|
||||
* "\SmApiPort" as argument. Do not try to
|
||||
* connect to "\Windows\ApiPort" since that
|
||||
* reboots immeditely.
|
||||
*
|
||||
* Use Russinovich' HandleEx to verify
|
||||
* conport.exe owns two unnamed LPC ports:
|
||||
* the one created by kernel32.dll connecting
|
||||
* to csrss.exe, and one connected to here.
|
||||
*
|
||||
* 19990627 (Emanuele Aliberti)
|
||||
* Initial implementation.
|
||||
* 19990704 (EA)
|
||||
* Dump object's attributes moved in dumpinfo.c.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define PROTO_LPC
|
||||
#include <ddk/ntddk.h>
|
||||
#include "dumpinfo.h"
|
||||
|
||||
#define LPC_CONNECT_FLAG1 0x00000001
|
||||
#define LPC_CONNECT_FLAG2 0x00000010
|
||||
#define LPC_CONNECT_FLAG3 0x00000100
|
||||
#define LPC_CONNECT_FLAG4 0x00001000
|
||||
#define LPC_CONNECT_FLAG5 0x00010000
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * ConnectPort)(
|
||||
OUT PHANDLE PortHandle,
|
||||
IN PUNICODE_STRING PortName,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN DWORD Unknown3,
|
||||
IN DWORD Unknown4,
|
||||
IN DWORD Unknown5,
|
||||
IN DWORD Unknown6,
|
||||
IN ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * YieldExecution)(VOID);
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAXARG 1000000
|
||||
|
||||
|
||||
VOID
|
||||
TryConnectPort(char *port_name)
|
||||
{
|
||||
DWORD Status = 0;
|
||||
HANDLE Port = 0;
|
||||
int i;
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
WORD Name [BUF_SIZE] = {0};
|
||||
int dwx = 0;
|
||||
char * port_name_save = port_name;
|
||||
|
||||
/*
|
||||
* Convert the port's name to Unicode.
|
||||
*/
|
||||
for (
|
||||
PortName.Length = 0;
|
||||
( *port_name
|
||||
&& (PortName.Length < BUF_SIZE)
|
||||
);
|
||||
)
|
||||
{
|
||||
Name[PortName.Length++] = (WORD) *port_name++;
|
||||
}
|
||||
Name[PortName.Length] = 0;
|
||||
|
||||
PortName.Length = PortName.Length * sizeof (WORD);
|
||||
PortName.MaximumLength = PortName.Length + sizeof (WORD);
|
||||
PortName.Buffer = (PWSTR) Name;
|
||||
/*
|
||||
* Prepare the port object attributes.
|
||||
*/
|
||||
ObjectAttributes.Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory =
|
||||
NULL;
|
||||
ObjectAttributes.ObjectName =
|
||||
NULL /*& PortName */;
|
||||
ObjectAttributes.Attributes =
|
||||
OBJ_CASE_INSENSITIVE;
|
||||
ObjectAttributes.SecurityDescriptor =
|
||||
NULL;
|
||||
ObjectAttributes.SecurityQualityOfService =
|
||||
NULL;
|
||||
/*
|
||||
* Try to issue a connection request.
|
||||
*/
|
||||
Port = 0;
|
||||
Status = ConnectPort(
|
||||
& Port, /* & PortHandle */
|
||||
& PortName, /* & PortName */
|
||||
& ObjectAttributes, /* & PortAttributes */
|
||||
NULL, /* & SecurityQos */
|
||||
NULL, /* & SectionInfo */
|
||||
NULL, /* & MapInfo */
|
||||
NULL, /* & MaxMessageSize */
|
||||
LPC_CONNECT_FLAG5 /* & ConnectInfoLength */
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DumpInfo(
|
||||
Name,
|
||||
Status,
|
||||
"connected",
|
||||
Port
|
||||
);
|
||||
/* Hot waiting */
|
||||
for (dwx=0; dwx<MAXARG; ++dwx)
|
||||
{
|
||||
YieldExecution();
|
||||
}
|
||||
if (FALSE == CloseHandle(Port))
|
||||
{
|
||||
printf(
|
||||
"Could not close the port handle %08X.\n",
|
||||
Port
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
printf(
|
||||
"Connection to port \"%s\" failed (Status = %08X).\n",
|
||||
port_name_save,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
main( int argc, char * argv[] )
|
||||
{
|
||||
HINSTANCE ntdll;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("WNT LPC Port Connector\n");
|
||||
printf("Usage: %s [port_name]\n",argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("LoadLibrary(NTDLL)\n");
|
||||
ntdll = LoadLibrary("NTDLL");
|
||||
if (ntdll == NULL)
|
||||
{
|
||||
printf("Could not load NTDLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtConnectPort)\n");
|
||||
ConnectPort = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtConnectPort"
|
||||
);
|
||||
if (ConnectPort == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtConnectPort\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
|
||||
QueryObject = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtQueryObject"
|
||||
);
|
||||
if (QueryObject == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtQueryObject\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
|
||||
YieldExecution = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtYieldExecution"
|
||||
);
|
||||
if (YieldExecution == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtYieldExecution\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("TryConnectPort(%s)\n",argv[1]);
|
||||
TryConnectPort(argv[1]);
|
||||
printf("Done\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
192
reactos/apps/tests/lpc/creport.c
Normal file
192
reactos/apps/tests/lpc/creport.c
Normal file
@@ -0,0 +1,192 @@
|
||||
/* $Id: creport.c,v 1.2 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/creport.c
|
||||
*
|
||||
* To be run in a real WNT 4.0 system to
|
||||
* create an LPC named port.
|
||||
*
|
||||
* Use Russinovich' HandleEx to verify
|
||||
* creport.exe owns the named LPC port
|
||||
* you asked to create.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define PROTO_LPC
|
||||
#include <ddk/ntddk.h>
|
||||
#include "dumpinfo.h"
|
||||
|
||||
#define LPC_CONNECT_FLAG1 0x00000001
|
||||
#define LPC_CONNECT_FLAG2 0x00000010
|
||||
#define LPC_CONNECT_FLAG3 0x00000100
|
||||
#define LPC_CONNECT_FLAG4 0x00001000
|
||||
#define LPC_CONNECT_FLAG5 0x00010000
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * CreatePort)(
|
||||
/*OUT PHANDLE PortHandle,*/
|
||||
PVOID Buffer,
|
||||
IN POBJECT_ATTRIBUTES PortAttributes OPTIONAL,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN DWORD Unknown3,
|
||||
IN ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * YieldExecution)(VOID);
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAXARG 5000000
|
||||
|
||||
|
||||
VOID
|
||||
TryCreatePort(char *port_name)
|
||||
{
|
||||
DWORD Status = 0;
|
||||
HANDLE Port = 0;
|
||||
int i;
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
WORD Name [BUF_SIZE] = {0};
|
||||
int dwx = 0;
|
||||
char * port_name_save = port_name;
|
||||
|
||||
/*
|
||||
* Convert the port's name to Unicode.
|
||||
*/
|
||||
for (
|
||||
PortName.Length = 0;
|
||||
( *port_name
|
||||
&& (PortName.Length < BUF_SIZE)
|
||||
);
|
||||
)
|
||||
{
|
||||
Name[PortName.Length++] = (WORD) *port_name++;
|
||||
}
|
||||
Name[PortName.Length] = 0;
|
||||
|
||||
PortName.Length = PortName.Length * sizeof (WORD);
|
||||
PortName.MaximumLength = PortName.Length + sizeof (WORD);
|
||||
PortName.Buffer = (PWSTR) Name;
|
||||
/*
|
||||
* Prepare the port object attributes.
|
||||
*/
|
||||
ObjectAttributes.Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory =
|
||||
NULL;
|
||||
ObjectAttributes.ObjectName =
|
||||
& PortName;
|
||||
ObjectAttributes.Attributes =
|
||||
0; //OBJ_CASE_INSENSITIVE --> STATUS_INVALID_PARAMETER ==> case sensitive!;
|
||||
ObjectAttributes.SecurityDescriptor =
|
||||
NULL;
|
||||
ObjectAttributes.SecurityQualityOfService =
|
||||
NULL;
|
||||
/*
|
||||
* Try to issue a connection request.
|
||||
*/
|
||||
Port = 0;
|
||||
Status = CreatePort(
|
||||
& Port,
|
||||
& ObjectAttributes,
|
||||
0, /* ACCESS_MASK? */
|
||||
0, /* Unknown3 */
|
||||
LPC_CONNECT_FLAG5
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DumpInfo(
|
||||
Name,
|
||||
Status,
|
||||
"created",
|
||||
Port
|
||||
);
|
||||
/* Hot waiting */
|
||||
for (dwx=0; dwx<MAXARG; ++dwx)
|
||||
{
|
||||
YieldExecution();
|
||||
}
|
||||
if (FALSE == CloseHandle(Port))
|
||||
{
|
||||
printf(
|
||||
"Could not close the port handle %08X.\n",
|
||||
Port
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
printf(
|
||||
"Creating port \"%s\" failed (Status = %08X).\n",
|
||||
port_name_save,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
main( int argc, char * argv[] )
|
||||
{
|
||||
HINSTANCE ntdll;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("WNT LPC Port Creator\n");
|
||||
printf("Usage: %s [port_name]\n",argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("LoadLibrary(NTDLL)\n");
|
||||
ntdll = LoadLibrary("NTDLL");
|
||||
if (ntdll == NULL)
|
||||
{
|
||||
printf("Could not load NTDLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtCreatePort)\n");
|
||||
CreatePort = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtCreatePort"
|
||||
);
|
||||
if (CreatePort == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtCreatePort\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
|
||||
QueryObject = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtQueryObject"
|
||||
);
|
||||
if (QueryObject == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtQueryObject\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
|
||||
YieldExecution = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtYieldExecution"
|
||||
);
|
||||
if (YieldExecution == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtYieldExecution\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("TryCreatePort(%s)\n",argv[1]);
|
||||
TryCreatePort(argv[1]);
|
||||
printf("Done\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
239
reactos/apps/tests/lpc/dumpinfo.c
Normal file
239
reactos/apps/tests/lpc/dumpinfo.c
Normal file
@@ -0,0 +1,239 @@
|
||||
/* $Id: dumpinfo.c,v 1.2 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/dumpinfo.c
|
||||
*
|
||||
* ReactOS Operating System
|
||||
*
|
||||
* Dump a kernel object's attributes by its handle.
|
||||
*
|
||||
* 19990627 (Emanuele Aliberti)
|
||||
* Initial implementation.
|
||||
* 19990704 (EA)
|
||||
* Added code to find the basic information buffer size
|
||||
* for the LPC port object.
|
||||
* 19990710 (EA)
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAX_BASIC_INFO_SIZE 512
|
||||
|
||||
|
||||
extern
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
extern
|
||||
NTSTATUS
|
||||
(STDCALL * QueryInformationPort)(
|
||||
IN HANDLE PortHandle,
|
||||
IN CINT PortInformationClass, /* guess */
|
||||
OUT PVOID PortInformation, /* guess */
|
||||
IN ULONG PortInformationLength, /* guess */
|
||||
OUT PULONG ReturnLength /* guess */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
static
|
||||
VOID
|
||||
DumpBuffer(
|
||||
char *Name,
|
||||
BYTE *buffer,
|
||||
ULONG size
|
||||
)
|
||||
{
|
||||
register ULONG i = 0;
|
||||
|
||||
printf("%s [%d] = ",Name,size);
|
||||
for ( i = 0;
|
||||
i != size;
|
||||
++i
|
||||
)
|
||||
{
|
||||
printf("%02X",buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
*/
|
||||
|
||||
VOID
|
||||
DumpInfo (
|
||||
LPCWSTR Name,
|
||||
NTSTATUS Status,
|
||||
LPCWSTR Comment,
|
||||
HANDLE Port
|
||||
)
|
||||
{
|
||||
BYTE ObjectInformation [BUF_SIZE] = {0};
|
||||
ULONG ResultLength;
|
||||
|
||||
wprintf(
|
||||
L"Port \"%s\" %s:\n",
|
||||
Name,
|
||||
Comment
|
||||
);
|
||||
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
printf("\tPort = %08X\n\n",Port);
|
||||
/*
|
||||
* Query object information.
|
||||
*/
|
||||
printf("Basic Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectBasicInformation,
|
||||
ObjectInformation,
|
||||
sizeof (LPC_PORT_BASIC_INFORMATION),
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
PLPC_PORT_BASIC_INFORMATION i;
|
||||
|
||||
i = (PLPC_PORT_BASIC_INFORMATION) ObjectInformation;
|
||||
|
||||
printf( "\tUnknown01 = 0x%08X\n", i->Unknown0 );
|
||||
printf( "\tUnknown02 = 0x%08X\n", i->Unknown1 );
|
||||
printf( "\tUnknown03 = 0x%08X\n", i->Unknown2 );
|
||||
printf( "\tUnknown04 = 0x%08X\n", i->Unknown3 );
|
||||
printf( "\tUnknown05 = 0x%08X\n", i->Unknown4 );
|
||||
printf( "\tUnknown06 = 0x%08X\n", i->Unknown5 );
|
||||
printf( "\tUnknown07 = 0x%08X\n", i->Unknown6 );
|
||||
printf( "\tUnknown08 = 0x%08X\n", i->Unknown7 );
|
||||
printf( "\tUnknown09 = 0x%08X\n", i->Unknown8 );
|
||||
printf( "\tUnknown10 = 0x%08X\n", i->Unknown9 );
|
||||
printf( "\tUnknown11 = 0x%08X\n", i->Unknown10 );
|
||||
printf( "\tUnknown12 = 0x%08X\n", i->Unknown11 );
|
||||
printf( "\tUnknown13 = 0x%08X\n", i->Unknown12 );
|
||||
printf( "\tUnknown14 = 0x%08X\n", i->Unknown13 );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Type Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectTypeInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_TYPE_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_TYPE_INFORMATION *) ObjectInformation;
|
||||
|
||||
wprintf(
|
||||
L"\tName: \"%s\"\n",
|
||||
(i->Name.Length ? i->Name.Buffer : L"")
|
||||
);
|
||||
/*
|
||||
FIXME: why this always raise an access violation exception?
|
||||
wprintf(
|
||||
L"\tType: \"%s\"\n",
|
||||
(i->Type.Length ? i->Type.Buffer : L"")
|
||||
);
|
||||
/**/
|
||||
printf(
|
||||
"\tTotal Handles: %d\n",
|
||||
i->TotalHandles
|
||||
);
|
||||
printf(
|
||||
"\tReference Count: %d\n",
|
||||
i->ReferenceCount
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Name Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectNameInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_NAME_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_NAME_INFORMATION *) ObjectInformation;
|
||||
wprintf(
|
||||
L"\tName: \"%s\"\n",
|
||||
(i->Name.Length ? i->Name.Buffer : L"")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Data Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectDataInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_DATA_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_DATA_INFORMATION *) ObjectInformation;
|
||||
printf(
|
||||
"\tInherit Handle: %s\n",
|
||||
(i->bInheritHandle ? "TRUE" : "FALSE")
|
||||
);
|
||||
printf(
|
||||
"\tProtect from Close: %s\n",
|
||||
(i->bProtectFromClose ? "TRUE" : "FALSE")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
//---
|
||||
printf("Port Information:\n");
|
||||
/* Status = QueryInformationPort(
|
||||
Port,
|
||||
1, /* info class * /
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DWORD * i = ObjectInformation;
|
||||
int j = 0;
|
||||
|
||||
while (j < ResultLength / sizeof (DWORD))
|
||||
{
|
||||
printf("\t%08X\n",i[j]);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
8
reactos/apps/tests/lpc/dumpinfo.h
Normal file
8
reactos/apps/tests/lpc/dumpinfo.h
Normal file
@@ -0,0 +1,8 @@
|
||||
VOID
|
||||
DumpInfo (
|
||||
LPCWSTR Name,
|
||||
NTSTATUS Status,
|
||||
LPCWSTR Comment,
|
||||
HANDLE Port
|
||||
);
|
||||
|
92
reactos/apps/tests/lpc/lpcclt.c
Normal file
92
reactos/apps/tests/lpc/lpcclt.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* $Id: lpcclt.c,v 1.12 2002/11/03 20:01:04 chorns Exp $
|
||||
*
|
||||
* DESCRIPTION: Simple LPC Client
|
||||
* PROGRAMMER: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <napi/lpc.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lpctest.h"
|
||||
|
||||
const char * MyName = "LPC-CLI";
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName = UNICODE_STRING_INITIALIZER(TEST_PORT_NAME_U);
|
||||
NTSTATUS Status;
|
||||
HANDLE PortHandle;
|
||||
LPC_MAX_MESSAGE Request;
|
||||
ULONG ConnectInfo;
|
||||
ULONG ConnectInfoLength = 0;
|
||||
SECURITY_QUALITY_OF_SERVICE Sqos;
|
||||
|
||||
printf("%s: Lpc test client\n", MyName);
|
||||
|
||||
printf("%s: Connecting to port \"%s\"...\n", MyName, TEST_PORT_NAME);
|
||||
ConnectInfoLength = 0;
|
||||
ZeroMemory (& Sqos, sizeof Sqos);
|
||||
Status = NtConnectPort(&PortHandle,
|
||||
&PortName,
|
||||
& Sqos,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
&ConnectInfoLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtConnectPort() failed with status = 0x%08X.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s: Connected to \"%s\" with anonymous port 0x%x.\n", MyName, TEST_PORT_NAME, PortHandle);
|
||||
|
||||
ZeroMemory(& Request, sizeof Request);
|
||||
strcpy(Request.Data, GetCommandLineA());
|
||||
Request.Header.DataSize = strlen(Request.Data);
|
||||
Request.Header.MessageSize = sizeof(LPC_MESSAGE) +
|
||||
Request.Header.DataSize;
|
||||
|
||||
printf("%s: Sending to port 0x%x message \"%s\"...\n",
|
||||
MyName,
|
||||
PortHandle,
|
||||
(char *) Request.Data);
|
||||
Status = NtRequestPort(PortHandle,
|
||||
&Request.Header);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtRequestPort(0x%x) failed with status = 0x%8X.\n",
|
||||
MyName,
|
||||
PortHandle,
|
||||
Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s: Sending datagram to port 0x%x succeeded.\n", MyName, PortHandle);
|
||||
|
||||
Sleep(2000);
|
||||
|
||||
printf("%s: Disconnecting...", MyName);
|
||||
NtClose (PortHandle);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
139
reactos/apps/tests/lpc/lpcsrv.c
Normal file
139
reactos/apps/tests/lpc/lpcsrv.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/* $Id: lpcsrv.c,v 1.11 2002/09/08 10:21:58 chorns Exp $
|
||||
*
|
||||
* DESCRIPTION: Simple LPC Server
|
||||
* PROGRAMMER: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <napi/lpc.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lpctest.h"
|
||||
|
||||
static const char * MyName = "LPC-SRV";
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName = UNICODE_STRING_INITIALIZER(TEST_PORT_NAME_U);
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status;
|
||||
HANDLE NamedPortHandle;
|
||||
HANDLE PortHandle;
|
||||
LPC_MAX_MESSAGE ConnectMsg;
|
||||
|
||||
printf("%s: Lpc test server\n", MyName);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&PortName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
printf("%s: Creating port \"%s\"...\n", MyName, TEST_PORT_NAME);
|
||||
Status = NtCreatePort(&NamedPortHandle,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtCreatePort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("%s: Port \"%s\" created (0x%x).\n\n", MyName, TEST_PORT_NAME, NamedPortHandle);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
printf("%s: Listening for connections requests on port 0x%x...\n", MyName, NamedPortHandle);
|
||||
Status = NtListenPort(NamedPortHandle,
|
||||
&ConnectMsg.Header);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtListenPort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s: Received connection request 0x%08x on port 0x%x.\n", MyName,
|
||||
ConnectMsg.Header.MessageId, NamedPortHandle);
|
||||
printf("%s: Request from: PID=%x, TID=%x.\n", MyName,
|
||||
ConnectMsg.Header.Cid.UniqueProcess, ConnectMsg.Header.Cid.UniqueThread);
|
||||
|
||||
printf("%s: Accepting connection request 0x%08x...\n", MyName,
|
||||
ConnectMsg.Header.MessageId);
|
||||
Status = NtAcceptConnectPort(&PortHandle,
|
||||
NamedPortHandle,
|
||||
& ConnectMsg.Header,
|
||||
TRUE,
|
||||
0,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtAcceptConnectPort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("%s: Connection request 0x%08x accepted as port 0x%x.\n", MyName,
|
||||
ConnectMsg.Header.MessageId, PortHandle);
|
||||
|
||||
printf("%s: Completing connection for port 0x%x (0x%08x).\n", MyName,
|
||||
PortHandle, ConnectMsg.Header.MessageId);
|
||||
Status = NtCompleteConnectPort(PortHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtCompleteConnectPort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s: Entering server loop for port 0x%x...\n", MyName, PortHandle);
|
||||
for(;;)
|
||||
{
|
||||
LPC_MAX_MESSAGE Request;
|
||||
|
||||
Status = NtReplyWaitReceivePort(PortHandle,
|
||||
0,
|
||||
NULL,
|
||||
&Request.Header);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtReplyWaitReceivePort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (LPC_DATAGRAM == PORT_MESSAGE_TYPE(Request))
|
||||
{
|
||||
printf("%s: Datagram message contents are <%s>.\n",
|
||||
MyName,
|
||||
Request.Data);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s: Message with type %d received on port 0x%x.\n", MyName,
|
||||
PORT_MESSAGE_TYPE(Request), PortHandle);
|
||||
NtClose(PortHandle);
|
||||
printf("%s: Connected port 0x%x closed.\n\n", MyName, PortHandle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
5
reactos/apps/tests/lpc/lpctest.h
Normal file
5
reactos/apps/tests/lpc/lpctest.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifndef _LPCTEST_H
|
||||
#define _LPCTEST_H
|
||||
#define TEST_PORT_NAME "\\TestPort"
|
||||
#define TEST_PORT_NAME_U L"\\TestPort"
|
||||
#endif
|
45
reactos/apps/tests/lpc/makefile
Normal file
45
reactos/apps/tests/lpc/makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
SRV_OBJECTS= lpcsrv.o
|
||||
CLT_OBJECTS= lpcclt.o
|
||||
|
||||
PROGS= lpcsrv.exe lpcclt.exe
|
||||
|
||||
BASE_CFLAGS = -I$(PATH_TO_TOP)/include
|
||||
|
||||
LIBS = $(SDK_PATH_LIB)/kernel32.a \
|
||||
$(SDK_PATH_LIB)/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
implib:
|
||||
|
||||
clean:
|
||||
- $(RM) lpcsrv.o lpcsrv.exe lpcsrv.sym lpcclt.o lpcclt.exe lpcsrv.sym
|
||||
|
||||
.phony: implib clean
|
||||
|
||||
install: $(PROGS:%=$(INSTALL_DIR)/bin/%)
|
||||
|
||||
$(PROGS:%=$(INSTALL_DIR)/bin/%): $(INSTALL_DIR)/bin/%: %
|
||||
$(CP) $* $(INSTALL_DIR)/bin/$*
|
||||
|
||||
dist: $(PROGS:%=$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(DIST_DIR)/apps/%): $(DIST_DIR)/apps/%: %
|
||||
$(CP) $* $(DIST_DIR)/apps/$*
|
||||
|
||||
lpcsrv.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(CC) $(SRV_OBJECTS) $(LIBS) -o lpcsrv.exe
|
||||
$(NM) --numeric-sort lpcsrv.exe > lpcsrv.sym
|
||||
|
||||
lpcclt.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(CC) $(CLT_OBJECTS) $(LIBS) -o lpcclt.exe
|
||||
$(NM) --numeric-sort lpcclt.exe > lpcclt.sym
|
5
reactos/apps/tests/messagebox/.cvsignore
Normal file
5
reactos/apps/tests/messagebox/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
20
reactos/apps/tests/messagebox/makefile
Normal file
20
reactos/apps/tests/messagebox/makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = simple
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a gdi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
15
reactos/apps/tests/messagebox/simple.c
Normal file
15
reactos/apps/tests/messagebox/simple.c
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* The simplest Windows program you will ever write.
|
||||
*
|
||||
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
|
||||
*
|
||||
* Colin Peters <colinp at ma.kcom.ne.jp>, July 1, 2001.
|
||||
*/
|
||||
#include <windows.h>
|
||||
|
||||
int STDCALL
|
||||
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
|
||||
{
|
||||
MessageBox (NULL, "Hello, ReactOS!", "Hello", MB_OK);
|
||||
return 0;
|
||||
}
|
19
reactos/apps/tests/mktime/makefile
Normal file
19
reactos/apps/tests/mktime/makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: makefile,v 1.1 2002/09/25 01:09:49 sedwards Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = mktime
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
28
reactos/apps/tests/mktime/mktime.c
Normal file
28
reactos/apps/tests/mktime/mktime.c
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
struct tm time_str;
|
||||
|
||||
char daybuf[20];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Testing mktime() by asking\n");
|
||||
printf("What day of the week is July 4, 2001?\n");
|
||||
|
||||
time_str.tm_year = 2001 - 1900;
|
||||
time_str.tm_mon = 7 - 1;
|
||||
time_str.tm_mday = 4;
|
||||
time_str.tm_hour = 0;
|
||||
time_str.tm_min = 0;
|
||||
time_str.tm_sec = 1;
|
||||
time_str.tm_isdst = -1;
|
||||
if (mktime(&time_str) == -1)
|
||||
(void)puts("-unknown-");
|
||||
else {
|
||||
(void)strftime(daybuf, sizeof(daybuf), "%A", &time_str);
|
||||
(void)puts(daybuf);
|
||||
}
|
||||
return 0;
|
||||
}
|
5
reactos/apps/tests/mstest/.cvsignore
Normal file
5
reactos/apps/tests/mstest/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
45
reactos/apps/tests/mstest/Makefile
Normal file
45
reactos/apps/tests/mstest/Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
SRV_OBJECTS = msserver.o
|
||||
CLT_OBJECTS = msclient.o
|
||||
|
||||
PROGS = msserver.exe msclient.exe
|
||||
|
||||
BASE_CFLAGS = -I$(PATH_TO_TOP)/include
|
||||
|
||||
LIBS = $(SDK_PATH_LIB)/kernel32.a \
|
||||
$(SDK_PATH_LIB)/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
implib:
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: implib clean
|
||||
|
||||
install: $(PROGS:%=$(INSTALL_DIR)/bin/%)
|
||||
|
||||
$(PROGS:%=$(INSTALL_DIR)/bin/%): $(INSTALL_DIR)/bin/%: %
|
||||
$(CP) $* $(INSTALL_DIR)/bin/$*
|
||||
|
||||
dist: $(PROGS:%=$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(DIST_DIR)/apps/%): $(DIST_DIR)/apps/%: %
|
||||
$(CP) $* $(DIST_DIR)/apps/$*
|
||||
|
||||
msserver.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(CC) $(SRV_OBJECTS) $(LIBS) -o msserver.exe
|
||||
$(NM) --numeric-sort msserver.exe > msserver.sym
|
||||
|
||||
msclient.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(CC) $(CLT_OBJECTS) $(LIBS) -o msclient.exe
|
||||
$(NM) --numeric-sort msclient.exe > msclient.sym
|
46
reactos/apps/tests/mstest/msclient.c
Normal file
46
reactos/apps/tests/mstest/msclient.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define BUFSIZE 1024
|
||||
#define MAILSLOT_TIMEOUT 1000
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE hMailslot;
|
||||
LPSTR lpszMailslotName = "\\\\.\\MAILSLOT\\mymailslot";
|
||||
LPSTR lpszTestMessage = "Mailslot test message!";
|
||||
DWORD cbLength, cbWritten;
|
||||
|
||||
hMailslot = CreateFile(lpszMailslotName,
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_READ,
|
||||
(LPSECURITY_ATTRIBUTES)NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
(HANDLE)NULL);
|
||||
printf("hMailslot %x\n", (DWORD)hMailslot);
|
||||
if (hMailslot == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("CreateFile() failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbLength = (ULONG)strlen(lpszTestMessage)+1;
|
||||
|
||||
WriteFile(hMailslot,
|
||||
lpszTestMessage,
|
||||
cbLength,
|
||||
&cbWritten,
|
||||
NULL);
|
||||
|
||||
CloseHandle(hMailslot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
40
reactos/apps/tests/mstest/msserver.c
Normal file
40
reactos/apps/tests/mstest/msserver.c
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE hMailslot;
|
||||
CHAR chBuf[512];
|
||||
BOOL fResult;
|
||||
DWORD cbRead;
|
||||
LPTSTR lpszMailslotName = "\\\\.\\mailslot\\mymailslot";
|
||||
|
||||
hMailslot = CreateMailslot(lpszMailslotName,
|
||||
512,
|
||||
MAILSLOT_WAIT_FOREVER,
|
||||
NULL);
|
||||
for (;;)
|
||||
{
|
||||
fResult = ReadFile(hMailslot,
|
||||
chBuf,
|
||||
512,
|
||||
&cbRead,
|
||||
NULL);
|
||||
if (fResult == FALSE)
|
||||
{
|
||||
printf("ReadFile() failed!\n");
|
||||
CloseHandle(hMailslot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("Data read: %s\n", chBuf);
|
||||
}
|
||||
|
||||
CloseHandle(hMailslot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
5
reactos/apps/tests/mutex/.cvsignore
Normal file
5
reactos/apps/tests/mutex/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
22
reactos/apps/tests/mutex/makefile
Normal file
22
reactos/apps/tests/mutex/makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# $Id: makefile,v 1.2 2002/06/02 19:24:59 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = mutex
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
116
reactos/apps/tests/mutex/mutex.c
Normal file
116
reactos/apps/tests/mutex/mutex.c
Normal file
@@ -0,0 +1,116 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
HANDLE hThread[2];
|
||||
DWORD dwCounter = 0;
|
||||
HANDLE hMutex;
|
||||
|
||||
|
||||
void dprintf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
DWORD WINAPI thread1(LPVOID crap)
|
||||
{
|
||||
DWORD dwError = 0;
|
||||
DWORD i;
|
||||
|
||||
dprintf("Thread 1 running!\n");
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
dwError = WaitForSingleObject(hMutex, INFINITE);
|
||||
if (dwError == WAIT_FAILED)
|
||||
{
|
||||
dprintf("Thread2: WaitForSingleObject failed!\n");
|
||||
return 1;
|
||||
}
|
||||
else if (dwError == WAIT_ABANDONED_0)
|
||||
{
|
||||
dprintf("Thread2: WaitForSingleObject returned WAIT_ABANDONED_0\n");
|
||||
}
|
||||
|
||||
dprintf("Thread1: dwCounter : %lu -->", dwCounter);
|
||||
dwCounter++;
|
||||
dprintf(" %lu\n", dwCounter);
|
||||
ReleaseMutex(hMutex);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DWORD WINAPI thread2(LPVOID crap)
|
||||
{
|
||||
DWORD dwError = 0;
|
||||
DWORD i;
|
||||
dprintf("Thread 2 running!\n");
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
dwError = WaitForSingleObject(hMutex, INFINITE);
|
||||
if (dwError == WAIT_FAILED)
|
||||
{
|
||||
dprintf("Thread2: WaitForSingleObject failed!\n");
|
||||
return 1;
|
||||
}
|
||||
else if (dwError == WAIT_ABANDONED_0)
|
||||
{
|
||||
dprintf("Thread2: WaitForSingleObject returned WAIT_ABANDONED_0\n");
|
||||
}
|
||||
|
||||
dprintf("Thread2: dwCounter : %lu -->", dwCounter);
|
||||
dwCounter++;
|
||||
dprintf(" %lu\n", dwCounter);
|
||||
ReleaseMutex(hMutex);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
DWORD dwError;
|
||||
DWORD id1,id2;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
dprintf("Calling CreateMutex()\n");
|
||||
hMutex = CreateMutexW(NULL, FALSE, L"TestMutex");
|
||||
if (hMutex == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
dprintf("CreateMutex() failed! Error: %lu\n", GetLastError);
|
||||
return 0;
|
||||
}
|
||||
dprintf("CreateMutex() succeeded!\n");
|
||||
|
||||
hThread[0] = CreateThread(0, 0, thread1, 0, 0, &id1);
|
||||
hThread[1] = CreateThread(0, 0, thread2, 0, 0, &id2);
|
||||
|
||||
dprintf("Calling WaitForMultipleObject()\n");
|
||||
dwError = WaitForMultipleObjects(2, hThread, TRUE, INFINITE);
|
||||
dprintf("WaitForMultipleObject() Error: %lu\n", dwError);
|
||||
|
||||
CloseHandle(hThread[0]);
|
||||
CloseHandle(hThread[1]);
|
||||
|
||||
CloseHandle(hMutex);
|
||||
|
||||
return 0;
|
||||
}
|
5
reactos/apps/tests/nptest/.cvsignore
Normal file
5
reactos/apps/tests/nptest/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
44
reactos/apps/tests/nptest/Makefile
Normal file
44
reactos/apps/tests/nptest/Makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
SRV_OBJECTS = npserver.o
|
||||
CLT_OBJECTS = npclient.o
|
||||
|
||||
PROGS = npserver.exe npclient.exe
|
||||
|
||||
BASE_CFLAGS = -I$(PATH_TO_TOP)/include
|
||||
|
||||
LIBS = $(SDK_PATH_LIB)/kernel32.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
implib:
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: implib clean
|
||||
|
||||
install: $(PROGS:%=$(INSTALL_DIR)/bin/%)
|
||||
|
||||
$(PROGS:%=$(INSTALL_DIR)/bin/%): $(INSTALL_DIR)/bin/%: %
|
||||
$(CP) $* $(INSTALL_DIR)/bin/$*
|
||||
|
||||
dist: $(PROGS:%=$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(DIST_DIR)/apps/%): $(DIST_DIR)/apps/%: %
|
||||
$(CP) $* $(DIST_DIR)/apps/$*
|
||||
|
||||
npserver.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(CC) $(SRV_OBJECTS) $(LIBS) -o npserver.exe
|
||||
$(NM) --numeric-sort npserver.exe > npserver.sym
|
||||
|
||||
npclient.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(CC) $(CLT_OBJECTS) $(LIBS) -o npclient.exe
|
||||
$(NM) --numeric-sort npclient.exe > npclient.sym
|
100
reactos/apps/tests/nptest/npclient.c
Normal file
100
reactos/apps/tests/nptest/npclient.c
Normal file
@@ -0,0 +1,100 @@
|
||||
#include <windows.h>
|
||||
|
||||
VOID MyErrExit(LPTSTR Message)
|
||||
{
|
||||
// MessageBox(NULL, Message, NULL, MB_OK);
|
||||
puts(Message);
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE hPipe;
|
||||
LPVOID lpvMessage;
|
||||
CHAR chBuf[512];
|
||||
BOOL fSuccess;
|
||||
DWORD cbRead, cbWritten, dwMode;
|
||||
LPTSTR lpszPipename = "\\\\.\\pipe\\mynamedpipe";
|
||||
|
||||
// Try to open a named pipe; wait for it, if necessary.
|
||||
|
||||
while (1)
|
||||
{
|
||||
hPipe = CreateFile(
|
||||
lpszPipename, // pipe name
|
||||
GENERIC_READ | // read and write access
|
||||
GENERIC_WRITE,
|
||||
0, // no sharing
|
||||
NULL, // no security attributes
|
||||
OPEN_EXISTING, // opens existing pipe
|
||||
0, // default attributes
|
||||
NULL); // no template file
|
||||
|
||||
// Break if the pipe handle is valid.
|
||||
|
||||
if (hPipe != INVALID_HANDLE_VALUE)
|
||||
break;
|
||||
|
||||
// Exit if an error other than ERROR_PIPE_BUSY occurs.
|
||||
|
||||
if (GetLastError() != ERROR_PIPE_BUSY)
|
||||
MyErrExit("Could not open pipe");
|
||||
|
||||
// All pipe instances are busy, so wait for 20 seconds.
|
||||
|
||||
if (! WaitNamedPipe(lpszPipename, 20000) )
|
||||
MyErrExit("Could not open pipe");
|
||||
}
|
||||
|
||||
// The pipe connected; change to message-read mode.
|
||||
|
||||
dwMode = PIPE_READMODE_MESSAGE;
|
||||
fSuccess = SetNamedPipeHandleState(
|
||||
hPipe, // pipe handle
|
||||
&dwMode, // new pipe mode
|
||||
NULL, // don't set maximum bytes
|
||||
NULL); // don't set maximum time
|
||||
if (!fSuccess)
|
||||
MyErrExit("SetNamedPipeHandleState");
|
||||
|
||||
// Send a message to the pipe server.
|
||||
|
||||
lpvMessage = (argc > 1) ? argv[1] : "default message";
|
||||
|
||||
fSuccess = WriteFile(
|
||||
hPipe, // pipe handle
|
||||
lpvMessage, // message
|
||||
strlen(lpvMessage) + 1, // message length
|
||||
&cbWritten, // bytes written
|
||||
NULL); // not overlapped
|
||||
if (! fSuccess)
|
||||
MyErrExit("WriteFile");
|
||||
|
||||
do
|
||||
{
|
||||
// Read from the pipe.
|
||||
|
||||
fSuccess = ReadFile(
|
||||
hPipe, // pipe handle
|
||||
chBuf, // buffer to receive reply
|
||||
512, // size of buffer
|
||||
&cbRead, // number of bytes read
|
||||
NULL); // not overlapped
|
||||
|
||||
if (! fSuccess && GetLastError() != ERROR_MORE_DATA)
|
||||
break;
|
||||
|
||||
// Reply from the pipe is written to STDOUT.
|
||||
|
||||
if (! WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
chBuf, cbRead, &cbWritten, NULL))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
} while (! fSuccess); // repeat loop if ERROR_MORE_DATA
|
||||
|
||||
CloseHandle(hPipe);
|
||||
|
||||
return 0;
|
||||
}
|
120
reactos/apps/tests/nptest/npserver.c
Normal file
120
reactos/apps/tests/nptest/npserver.c
Normal file
@@ -0,0 +1,120 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define BUFSIZE 1024
|
||||
#define PIPE_TIMEOUT 1000
|
||||
|
||||
VOID InstanceThread (LPVOID);
|
||||
|
||||
VOID
|
||||
GetAnswerToRequest(LPTSTR lpRequest,
|
||||
LPTSTR lpReply,
|
||||
LPDWORD lpcbReplyBytes)
|
||||
{
|
||||
}
|
||||
|
||||
VOID MyErrExit(LPTSTR Message)
|
||||
{
|
||||
// MessageBox(NULL, Message, NULL, MB_OK);
|
||||
puts(Message);
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int xx = 0;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BOOL fConnected;
|
||||
DWORD dwThreadId;
|
||||
HANDLE hPipe, hThread;
|
||||
LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe");
|
||||
|
||||
// for (;;)
|
||||
// {
|
||||
hPipe = CreateNamedPipe(lpszPipename,
|
||||
PIPE_ACCESS_DUPLEX,
|
||||
PIPE_TYPE_MESSAGE |
|
||||
PIPE_READMODE_MESSAGE |
|
||||
PIPE_WAIT,
|
||||
PIPE_UNLIMITED_INSTANCES,
|
||||
BUFSIZE,
|
||||
BUFSIZE,
|
||||
PIPE_TIMEOUT,
|
||||
NULL);
|
||||
if (hPipe == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("CreateNamedPipe() failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
fConnected = ConnectNamedPipe(hPipe,
|
||||
NULL) ? TRUE : (GetLastError () ==
|
||||
ERROR_PIPE_CONNECTED);
|
||||
if (fConnected)
|
||||
{
|
||||
printf("Pipe connected!\n");
|
||||
|
||||
DisconnectNamedPipe(hPipe);
|
||||
|
||||
#if 0
|
||||
hThread = CreateThread(NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) InstanceThread,
|
||||
(LPVOID) hPipe,
|
||||
0,
|
||||
&dwThreadId);
|
||||
if (hThread == NULL)
|
||||
MyErrExit("CreateThread");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// CloseHandle(hPipe);
|
||||
}
|
||||
// }
|
||||
|
||||
CloseHandle(hPipe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID InstanceThread (LPVOID lpvParam)
|
||||
{
|
||||
CHAR chRequest[BUFSIZE];
|
||||
CHAR chReply[BUFSIZE];
|
||||
DWORD cbBytesRead, cbReplyBytes, cbWritten;
|
||||
BOOL fSuccess;
|
||||
HANDLE hPipe;
|
||||
|
||||
hPipe = (HANDLE)lpvParam;
|
||||
while (1)
|
||||
{
|
||||
fSuccess = ReadFile(hPipe,
|
||||
chRequest,
|
||||
BUFSIZE,
|
||||
&cbBytesRead,
|
||||
NULL);
|
||||
if (!fSuccess || cbBytesRead == 0)
|
||||
break;
|
||||
|
||||
GetAnswerToRequest(chRequest, chReply, &cbReplyBytes);
|
||||
|
||||
fSuccess = WriteFile(hPipe,
|
||||
chReply,
|
||||
cbReplyBytes,
|
||||
&cbWritten,
|
||||
NULL);
|
||||
if (!fSuccess || cbReplyBytes != cbWritten)
|
||||
break;
|
||||
}
|
||||
|
||||
FlushFileBuffers(hPipe);
|
||||
DisconnectNamedPipe(hPipe);
|
||||
CloseHandle(hPipe);
|
||||
}
|
BIN
reactos/apps/tests/patblt/Penguin.bmp
Normal file
BIN
reactos/apps/tests/patblt/Penguin.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 104 KiB |
66
reactos/apps/tests/patblt/makefile
Normal file
66
reactos/apps/tests/patblt/makefile
Normal file
@@ -0,0 +1,66 @@
|
||||
# Makefile - Proj_Listing2_1.dsp
|
||||
|
||||
ifndef CFG
|
||||
CFG=Proj_Listing2_1 - Win32 Debug
|
||||
endif
|
||||
CC=gcc
|
||||
CFLAGS=
|
||||
CXX=g++
|
||||
CXXFLAGS=$(CFLAGS)
|
||||
RC=windres -O COFF
|
||||
ifeq "$(CFG)" "Proj_Listing2_1 - Win32 Release"
|
||||
CFLAGS+=-fexceptions -O2 -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS -W
|
||||
LD=$(CXX) $(CXXFLAGS)
|
||||
LDFLAGS=
|
||||
LDFLAGS+=-Wl,--subsystem,windows
|
||||
LIBS+=-lkernel32 -luser32 -lgdi32
|
||||
else
|
||||
ifeq "$(CFG)" "Proj_Listing2_1 - Win32 Debug"
|
||||
CFLAGS+=-fexceptions -g -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_MBCS -W
|
||||
LD=$(CXX) $(CXXFLAGS)
|
||||
LDFLAGS=
|
||||
LDFLAGS+=-Wl,--subsystem,windows
|
||||
LIBS+=-lkernel32 -luser32 -lgdi32
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef TARGET
|
||||
TARGET=patblt.exe
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: $(TARGET)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
%.res: %.rc
|
||||
$(RC) $(CPPFLAGS) -o $@ -i $<
|
||||
|
||||
SOURCE_FILES= \
|
||||
patblt.cpp
|
||||
|
||||
HEADER_FILES=
|
||||
|
||||
RESOURCE_FILES=
|
||||
|
||||
SRCS=$(SOURCE_FILES) $(HEADER_FILES) $(RESOURCE_FILES)
|
||||
|
||||
OBJS=$(patsubst %.rc,%.res,$(patsubst %.cpp,%.o,$(patsubst %.c,%.o,$(filter %.c %.cpp %.rc,$(SRCS)))))
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-del $(OBJS) $(TARGET)
|
||||
|
||||
.PHONY: depends
|
||||
depends:
|
||||
-$(CXX) $(CXXFLAGS) $(CPPFLAGS) -MM $(filter %.c %.cpp,$(SRCS)) > Proj_Listing2_1.dep
|
||||
|
||||
-include Proj_Listing2_1.dep
|
||||
|
274
reactos/apps/tests/patblt/patblt.cpp
Normal file
274
reactos/apps/tests/patblt/patblt.cpp
Normal file
@@ -0,0 +1,274 @@
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Windows 2000 Graphics API Black Book
|
||||
// Chapter 2 - Listing 2.1 (PatBlt Tracking Rect Demo)
|
||||
//
|
||||
// Created by Damon Chandler <dmc27@ee.cornell.edu>
|
||||
// Updates can be downloaded at: <www.coriolis.com>
|
||||
//
|
||||
// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu
|
||||
// if you have any questions about this code.
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
#include <windows.h>
|
||||
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
HINSTANCE HInst;
|
||||
const char* WndClassName = "GMainWnd";
|
||||
LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
|
||||
LPARAM LParam);
|
||||
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE, LPTSTR,
|
||||
int nCmdShow)
|
||||
{
|
||||
HInst = HInstance;
|
||||
|
||||
WNDCLASS wc;
|
||||
memset(&wc, 0, sizeof(WNDCLASS));
|
||||
|
||||
wc.style = CS_VREDRAW | CS_HREDRAW;
|
||||
wc.lpszClassName = WndClassName;
|
||||
wc.lpfnWndProc = MainWndProc;
|
||||
wc.hInstance = HInstance;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = static_cast<HBRUSH>(
|
||||
GetStockObject(BLACK_BRUSH)
|
||||
);
|
||||
|
||||
if (RegisterClass(&wc))
|
||||
{
|
||||
HWND HWnd =
|
||||
CreateWindow(WndClassName,
|
||||
TEXT("PatBlt Tracking Rect Demo"),
|
||||
WS_OVERLAPPEDWINDOW | WS_CAPTION |
|
||||
WS_VISIBLE | WS_CLIPCHILDREN,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
|
||||
NULL, NULL, HInst, NULL);
|
||||
|
||||
if (HWnd)
|
||||
{
|
||||
ShowWindow(HWnd, nCmdShow);
|
||||
UpdateWindow(HWnd);
|
||||
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
// image related
|
||||
HDC HMemDC = NULL;
|
||||
HBITMAP HOldBmp = NULL;
|
||||
const char* filename = "PENGUIN.BMP";
|
||||
RECT RImage = {225, 110, 225, 110};
|
||||
|
||||
// tracking related
|
||||
bool is_tracking = false;
|
||||
HDC HScreenDC = NULL;
|
||||
POINT PMouse = {0, 0};
|
||||
RECT RTrack = {0, 0, 0, 0};
|
||||
const int line_width = 5;
|
||||
|
||||
|
||||
// utility function to map to/from window coordinates
|
||||
void MapRect(IN HWND HWndFrom, IN HWND HWndTo, IN OUT RECT& RMap)
|
||||
{
|
||||
MapWindowPoints(
|
||||
HWndFrom, HWndTo,
|
||||
reinterpret_cast<LPPOINT>(&RMap), 2
|
||||
);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
// utility function that uses the PatBlt function to
|
||||
// render a tracking rectangle
|
||||
void RenderTrackingRect(IN HDC HDestDC, IN const RECT& RRender)
|
||||
{
|
||||
const int width = RRender.right - RRender.left;
|
||||
const int height = RRender.bottom - RRender.top;
|
||||
const DWORD dwROP3 = DSTINVERT; // experiment with others
|
||||
|
||||
// render top bar
|
||||
PatBlt(HDestDC,
|
||||
RRender.left, RRender.top,
|
||||
width, line_width,
|
||||
dwROP3);
|
||||
// render bottom bar
|
||||
PatBlt(HDestDC,
|
||||
RRender.left, RRender.bottom - line_width,
|
||||
width, line_width,
|
||||
dwROP3);
|
||||
// render left bar
|
||||
PatBlt(HDestDC,
|
||||
RRender.left, RRender.top + line_width,
|
||||
line_width, height - (2 * line_width),
|
||||
dwROP3);
|
||||
// render right bar
|
||||
PatBlt(HDestDC,
|
||||
RRender.right - line_width, RRender.top + line_width,
|
||||
line_width, height - (2 * line_width),
|
||||
dwROP3);
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
|
||||
LPARAM LParam)
|
||||
{
|
||||
switch (Msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
// create a memory DC
|
||||
HMemDC = CreateCompatibleDC(NULL);
|
||||
if (HMemDC)
|
||||
{
|
||||
// load the penguin bitmap
|
||||
HBITMAP HBmp = static_cast<HBITMAP>(
|
||||
LoadImage(HInst, filename, IMAGE_BITMAP, 0, 0,
|
||||
LR_LOADFROMFILE | LR_DEFAULTSIZE)
|
||||
);
|
||||
if (HBmp)
|
||||
{
|
||||
// get the bitmap's dimensions
|
||||
BITMAP bmp;
|
||||
if (GetObject(HBmp, sizeof(BITMAP), &bmp))
|
||||
{
|
||||
RImage.right += bmp.bmWidth;
|
||||
RImage.bottom += bmp.bmHeight;
|
||||
|
||||
// realize the bitmap
|
||||
HOldBmp = static_cast<HBITMAP>(
|
||||
SelectObject(HMemDC, HBmp)
|
||||
);
|
||||
}
|
||||
else DeleteObject(HBmp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
PMouse.x = LOWORD(LParam);
|
||||
PMouse.y = HIWORD(LParam);
|
||||
|
||||
RECT RClient;
|
||||
if (PtInRect(&RImage, PMouse) &&
|
||||
GetClientRect(HWnd, &RClient))
|
||||
{
|
||||
MapRect(HWnd, HWND_DESKTOP, RClient);
|
||||
ClipCursor(&RClient);
|
||||
|
||||
// grab a handle to the screen DC and clip
|
||||
// all output to the client area of our window
|
||||
HScreenDC = GetDC(NULL);
|
||||
HRGN HClipRgn = CreateRectRgnIndirect(&RClient);
|
||||
SelectClipRgn(HScreenDC, HClipRgn);
|
||||
DeleteObject(HClipRgn);
|
||||
|
||||
CopyRect(&RTrack, &RImage);
|
||||
MapRect(HWnd, HWND_DESKTOP, RTrack);
|
||||
|
||||
// render the first tracking rect
|
||||
RenderTrackingRect(HScreenDC, RTrack);
|
||||
is_tracking = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (HScreenDC && is_tracking)
|
||||
{
|
||||
POINT PCurrent = {LOWORD(LParam), HIWORD(LParam)};
|
||||
const int dX = PCurrent.x - PMouse.x;
|
||||
const int dY = PCurrent.y - PMouse.y;
|
||||
|
||||
// erase the previous rectangle
|
||||
RenderTrackingRect(HScreenDC, RTrack);
|
||||
// update the postion
|
||||
OffsetRect(&RTrack, dX, dY);
|
||||
// render the new tracking rectangle
|
||||
RenderTrackingRect(HScreenDC, RTrack);
|
||||
|
||||
// update the mouse position
|
||||
memcpy(&PMouse, &PCurrent, sizeof(POINT));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
// clean up
|
||||
if (is_tracking)
|
||||
{
|
||||
is_tracking = false;
|
||||
SelectClipRgn(HScreenDC, NULL);
|
||||
ReleaseDC(NULL, HScreenDC);
|
||||
|
||||
InvalidateRect(HWnd, &RImage, true);
|
||||
CopyRect(&RImage, &RTrack);
|
||||
MapRect(HWND_DESKTOP, HWnd, RImage);
|
||||
InvalidateRect(HWnd, &RImage, true);
|
||||
|
||||
ClipCursor(NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC Hdc = BeginPaint(HWnd, &ps);
|
||||
#if 0
|
||||
try
|
||||
#endif
|
||||
{
|
||||
//
|
||||
// TODO: Add palette support...
|
||||
//
|
||||
|
||||
// render the penguin
|
||||
BitBlt(Hdc, RImage.left, RImage.top,
|
||||
RImage.right - RImage.left,
|
||||
RImage.bottom - RImage.top,
|
||||
HMemDC, 0, 0,
|
||||
SRCCOPY);
|
||||
}
|
||||
#if 0
|
||||
catch (...)
|
||||
#endif
|
||||
{
|
||||
EndPaint(HWnd, &ps);
|
||||
}
|
||||
EndPaint(HWnd, &ps);
|
||||
break;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
{
|
||||
// clean up
|
||||
if (HOldBmp)
|
||||
{
|
||||
DeleteObject(SelectObject(HMemDC, HOldBmp));
|
||||
}
|
||||
if (HMemDC)
|
||||
{
|
||||
DeleteDC(HMemDC);
|
||||
}
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return DefWindowProc(HWnd, Msg, WParam, LParam);
|
||||
}
|
||||
//------------------------------------------------------------------
|
5
reactos/apps/tests/pteb/.cvsignore
Normal file
5
reactos/apps/tests/pteb/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
21
reactos/apps/tests/pteb/Makefile
Normal file
21
reactos/apps/tests/pteb/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: Makefile,v 1.8 2002/06/02 19:25:00 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = pteb
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user