Compare commits

..

7 Commits

Author SHA1 Message Date
The ReactOS Team
5a0939913e This commit was manufactured by cvs2svn to create tag 'krnl0101'.
svn path=/tags/krnl0101/; revision=4456
2003-03-29 21:41:21 +00:00
The ReactOS Team
abc01da30c This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2401
2001-11-28 01:38:00 +00:00
The ReactOS Team
7aeca22fed This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2398
2001-11-27 14:24:15 +00:00
The ReactOS Team
36e1bb60e8 This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2320
2001-10-25 23:22:09 +00:00
The ReactOS Team
74e77bb16f This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2316
2001-10-23 21:15:45 +00:00
Casper Hornstrup
e3a75fb4da no message
svn path=/branches/avendor/; revision=1279
2000-08-01 18:43:38 +00:00
The ReactOS Team
ce122bcdea This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=1278
2000-08-01 18:43:38 +00:00
4274 changed files with 941198 additions and 19900 deletions

19
reactos/.cvsignore Normal file
View 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
View File

@@ -0,0 +1,4 @@
directory /mnt/windows/CvsHome/reactos/ntoskrnl
symbol-file ntoskrnl/ntoskrnl.nostrip.exe -mapped
set remotebaud 115200
target remote com2

340
reactos/COPYING Normal file
View File

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

41
reactos/CREDITS Normal file
View File

@@ -0,0 +1,41 @@
In no particular order
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
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.

1469
reactos/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

75
reactos/INSTALL Normal file
View File

@@ -0,0 +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.com.
2. Building ReactOS
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
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 binary
distribution. The two ways to install ReactOS are explained below.
3.1 Installation from sources
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 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.
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:
INSTALL_DIR = c:\reactos
If you are on linux this could be:
INSTALL_DIR = /mnt/windows/reactos
Save the changes to rules.mak and run 'make install' to install the files to
the new location.
3.2 Installation from binany distribution
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
surf to the address below and subscribe to one or more of the mailing lists.
http://www.reactos.com/index.php?tab=discussion&section=lists
ReactOS Development Team

504
reactos/LGPL.txt Normal file
View File

@@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
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.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

697
reactos/Makefile Normal file
View File

@@ -0,0 +1,697 @@
#
# Global makefile
#
PATH_TO_TOP = .
#
# Define to build ReactOS external targets
#
ifeq ($(ROS_BUILD_EXT),)
ROS_BUILD_EXT = no
else
ROS_BUILD_EXT = yes
endif
include $(PATH_TO_TOP)/rules.mak
# Required to run the system
COMPONENTS = iface_native iface_additional hallib ntoskrnl
# Hardware Abstraction Layers
# halx86
HALS = halx86
# Bus drivers
# acpi isapnp pci
BUS = acpi isapnp pci
# User mode libraries
# advapi32 crtdll fmifs gdi32 kernel32 libpcap packet msafd msvcrt ntdll ole32
# oleaut32 psapi rpcrt4 secur32 shell32 user32 version ws2help ws2_32 wsock32 wshirda
DLLS = advapi32 crtdll fmifs gdi32 kernel32 packet msafd msvcrt ntdll \
secur32 user32 version winedbgc ws2help ws2_32 wshirda zlib #winmm
SUBSYS = smss win32k csrss ntvdm
#
# Select the server(s) you want to build
#
#SERVERS = posix linux os2
SERVERS = win32
# Boot loaders
# dos
LOADERS = dos
# Driver support libraries
#bzip2 zlib
DRIVERS_LIB = bzip2
# Kernel mode device drivers
# Obsolete: ide
# beep blue floppy null parallel ramdrv serenum serial vga videoprt
DEVICE_DRIVERS = beep blue floppy null serial vga videoprt
# Kernel mode input drivers
# keyboard mouclass psaux sermouse
INPUT_DRIVERS = keyboard mouclass psaux
# Kernel mode file system drivers
# cdfs ext2 fs_rec ms np vfat
FS_DRIVERS = cdfs fs_rec ms np vfat mup ntfs
# Kernel mode networking drivers
# afd ndis npf tcpip tdi wshtcpip
NET_DRIVERS = afd ndis npf tcpip tdi wshtcpip
# Kernel mode networking device drivers
# ne2000
NET_DEVICE_DRIVERS = ne2000
# Kernel mode storage drivers
# atapi cdrom class2 disk scsiport
STORAGE_DRIVERS = atapi cdrom class2 disk scsiport
# System applications
# autochk lsass services shell winlogon
SYS_APPS = autochk services cmd winlogon gstart usetup
# System services
# rpcss eventlog
SYS_SVC = rpcss eventlog
APPS = tests testsets utils
# External (sub)systems for ReactOS
# rosapps wine posix os2 (requires c++) java (non-existant)
EXTERNALS = rosapps wine posix os2
ifeq ($(ROS_BUILD_EXT),yes)
EXT_MODULES = $(EXTERNALS)
else
EXT_MODULES =
endif
KERNEL_DRIVERS = $(DRIVERS_LIB) $(DEVICE_DRIVERS) $(INPUT_DRIVERS) $(FS_DRIVERS) \
$(NET_DRIVERS) $(NET_DEVICE_DRIVERS) $(STORAGE_DRIVERS)
all: tools dk implib $(COMPONENTS) $(HALS) $(BUS) $(DLLS) $(SUBSYS) \
$(LOADERS) $(KERNEL_DRIVERS) $(SYS_APPS) $(SYS_SVC) \
$(APPS) $(EXT_MODULES)
#config: $(TOOLS:%=%_config)
depends: $(DLLS:%=%_depends) $(SUBSYS:%=%_depends) $(SYS_SVC:%=%_depends) \
$(EXT_MODULES:%=%_depends) $(POSIX_LIBS:%=%_depends)
implib: $(COMPONENTS:%=%_implib) $(HALS:%=%_implib) $(BUS:%=%_implib) \
$(DLLS:%=%_implib) $(LOADERS:%=%_implib) \
$(KERNEL_DRIVERS:%=%_implib) $(SUBSYS:%=%_implib) \
$(SYS_APPS:%=%_implib) $(SYS_SVC:%=%_implib) \
$(APPS:%=%_implib) $(EXT_MODULES:%=%_implib)
clean: tools dk_clean $(HALS:%=%_clean) \
$(COMPONENTS:%=%_clean) $(BUS:%=%_clean) $(DLLS:%=%_clean) \
$(LOADERS:%=%_clean) $(KERNEL_DRIVERS:%=%_clean) $(SUBSYS:%=%_clean) \
$(SYS_APPS:%=%_clean) $(SYS_SVC:%=%_clean) \
$(NET_APPS:%=%_clean) \
$(APPS:%=%_clean) $(EXT_MODULES:%=%_clean) \
clean_after tools_clean
clean_after:
$(RM) $(PATH_TO_TOP)/include/roscfg.h
install: tools install_dirs install_before \
$(COMPONENTS:%=%_install) $(HALS:%=%_install) $(BUS:%=%_install) \
$(DLLS:%=%_install) $(LOADERS:%=%_install) \
$(KERNEL_DRIVERS:%=%_install) $(SUBSYS:%=%_install) \
$(SYS_APPS:%=%_install) $(SYS_SVC:%=%_install) \
$(APPS:%=%_install) $(EXT_MODULES:%=%_install)
dist: $(TOOLS_PATH)/rcopy$(EXE_POSTFIX) dist_clean dist_dirs \
$(HALS:%=%_dist) $(COMPONENTS:%=%_dist) $(BUS:%=%_dist) $(DLLS:%=%_dist) \
$(LOADERS:%=%_dist) $(KERNEL_DRIVERS:%=%_dist) $(SUBSYS:%=%_dist) \
$(SYS_APPS:%=%_dist) $(SYS_SVC:%=%_dist) \
$(NET_APPS:%=%_dist) \
$(APPS:%=%_dist) $(EXT_MODULES:%=%_dist)
.PHONY: all depends implib clean clean_before install dist
#
# System Applications
#
$(SYS_APPS): %:
$(MAKE) -C subsys/system/$*
$(SYS_APPS:%=%_implib): %_implib:
$(MAKE) -C subsys/system/$* implib
$(SYS_APPS:%=%_clean): %_clean:
$(MAKE) -C subsys/system/$* clean
$(SYS_APPS:%=%_dist): %_dist:
$(MAKE) -C subsys/system/$* dist
$(SYS_APPS:%=%_install): %_install:
$(MAKE) -C subsys/system/$* install
.PHONY: $(SYS_APPS) $(SYS_APPS:%=%_implib) $(SYS_APPS:%=%_clean) $(SYS_APPS:%=%_install) $(SYS_APPS:%=%_dist)
#
# System Services
#
$(SYS_SVC): %:
$(MAKE) -C services/$*
$(SYS_SVC:%=%_depends): %_depends:
$(MAKE) -C services/$* depends
$(SYS_SVC:%=%_implib): %_implib:
$(MAKE) -C services/$* implib
$(SYS_SVC:%=%_clean): %_clean:
$(MAKE) -C services/$* clean
$(SYS_SVC:%=%_dist): %_dist:
$(MAKE) -C services/$* dist
$(SYS_SVC:%=%_install): %_install:
$(MAKE) -C services/$* install
.PHONY: $(SYS_SVC) $(SYS_SVC:%=%_depends) $(SYS_SVC:%=%_implib) $(SYS_SVC:%=%_clean) $(SYS_SVC:%=%_install) $(SYS_SVC:%=%_dist)
#
# Applications
#
#
# Extra (optional system) Applications
#
$(APPS): %:
$(MAKE) -C apps/$*
$(APPS:%=%_implib): %_implib:
$(MAKE) -C apps/$* implib
$(APPS:%=%_clean): %_clean:
$(MAKE) -C apps/$* clean
$(APPS:%=%_dist): %_dist:
$(MAKE) -C apps/$* dist
$(APPS:%=%_install): %_install:
$(MAKE) -C apps/$* install
.PHONY: $(APPS) $(APPS:%=%_implib) $(APPS:%=%_clean) $(APPS:%=%_install) $(APPS:%=%_dist)
#
# External ports and subsystem personalities
#
$(EXTERNALS): %:
$(MAKE) -C $(ROOT_PATH)/$*
$(EXTERNALS:%=%_depends): %_depends:
$(MAKE) -C $(ROOT_PATH)/$* depends
$(EXTERNALS:%=%_implib): %_implib:
$(MAKE) -C $(ROOT_PATH)/$* implib
$(EXTERNALS:%=%_clean): %_clean:
$(MAKE) -C $(ROOT_PATH)/$* clean
$(EXTERNALS:%=%_dist): %_dist:
$(MAKE) -C $(ROOT_PATH)/$* dist
$(EXTERNALS:%=%_install): %_install:
$(MAKE) -C $(ROOT_PATH)/$* install
.PHONY: $(EXTERNALS) $(EXTERNALS:%=%_depends) $(EXTERNALS:%=%_implib) $(EXTERNALS:%=%_clean) $(EXTERNALS:%=%_install) $(EXTERNALS:%=%_dist)
#
# Tools
#
tools:
$(MAKE) -C tools
tools_implib:
tools_clean:
$(MAKE) -C tools clean
tools_install:
tools_dist:
.PHONY: tools tools_implib tools_clean tools_install tools_dist
#
# Developer Kits
#
dk:
$(RMKDIR) $(DK_PATH)
$(RMKDIR) $(DDK_PATH)
$(RMKDIR) $(DDK_PATH_LIB)
$(RMKDIR) $(DDK_PATH_INC)
$(RMKDIR) $(SDK_PATH)
$(RMKDIR) $(SDK_PATH_LIB)
$(RMKDIR) $(SDK_PATH_INC)
$(RMKDIR) $(XDK_PATH)
$(RMKDIR) $(XDK_PATH_LIB)
$(RMKDIR) $(XDK_PATH_INC)
dk_implib:
# WARNING! Be very sure that there are no important files
# in these directories before cleaning them!!!
dk_clean:
$(RM) $(DDK_PATH_LIB)/*.a
# $(RM) $(DDK_PATH_INC)/*.h
$(RMDIR) $(DDK_PATH_LIB)
# $(RMDIR) $(DDK_PATH_INC)
$(RM) $(SDK_PATH_LIB)/*.a
# $(RM) $(SDK_PATH_INC)/*.h
$(RMDIR) $(SDK_PATH_LIB)
# $(RMDIR) $(SDK_PATH_INC)
$(RM) $(XDK_PATH_LIB)/*.a
# $(RM) $(XDK_PATH_INC)/*.h
$(RMDIR) $(XDK_PATH_LIB)
# $(RMDIR) $(XDK_PATH_INC)
dk_install:
dk_dist:
.PHONY: dk dk_implib dk_clean dk_install dk_dist
#
# Interfaces
#
iface_native:
$(MAKE) -C iface/native
iface_native_implib:
iface_native_clean:
$(MAKE) -C iface/native clean
iface_native_install:
iface_native_dist:
iface_additional:
$(MAKE) -C iface/addsys
iface_additional_implib:
iface_additional_clean:
$(MAKE) -C iface/addsys clean
iface_additional_install:
iface_additional_dist:
.PHONY: iface_native iface_native_implib iface_native_clean iface_native_install \
iface_native_dist \
iface_additional iface_additional_implib iface_additional_clean \
iface_additional_install iface_additional_dist
#
# Bus driver rules
#
$(BUS): %:
$(MAKE) -C drivers/bus/$*
$(BUS:%=%_implib): %_implib:
$(MAKE) -C drivers/bus/$* implib
$(BUS:%=%_clean): %_clean:
$(MAKE) -C drivers/bus/$* clean
$(BUS:%=%_install): %_install:
$(MAKE) -C drivers/bus/$* install
$(BUS:%=%_dist): %_dist:
$(MAKE) -C drivers/bus/$* dist
.PHONY: $(BUS) $(BUS:%=%_implib) $(BUS:%=%_clean) \
$(BUS:%=%_install) $(BUS:%=%_dist)
#
# Driver support libraries rules
#
$(DRIVERS_LIB): %:
$(MAKE) -C drivers/lib/$*
$(DRIVERS_LIB:%=%_implib): %_implib:
$(MAKE) -C drivers/lib/$* implib
$(DRIVERS_LIB:%=%_clean): %_clean:
$(MAKE) -C drivers/lib/$* clean
$(DRIVERS_LIB:%=%_install): %_install:
$(MAKE) -C drivers/lib/$* install
$(DRIVERS_LIB:%=%_dist): %_dist:
$(MAKE) -C drivers/lib/$* dist
.PHONY: $(DRIVERS_LIB) $(DRIVERS_LIB:%=%_implib) $(DRIVERS_LIB:%=%_clean) \
$(DRIVERS_LIB:%=%_install) $(DRIVERS_LIB:%=%_dist)
#
# Device driver rules
#
$(DEVICE_DRIVERS): %:
$(MAKE) -C drivers/dd/$*
$(DEVICE_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/dd/$* implib
$(DEVICE_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/dd/$* clean
$(DEVICE_DRIVERS:%=%_install): %_install:
$(MAKE) -C drivers/dd/$* install
$(DEVICE_DRIVERS:%=%_dist): %_dist:
$(MAKE) -C drivers/dd/$* dist
.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_implib) $(DEVICE_DRIVERS:%=%_clean) \
$(DEVICE_DRIVERS:%=%_install) $(DEVICE_DRIVERS:%=%_dist)
#
# Input driver rules
#
$(INPUT_DRIVERS): %:
$(MAKE) -C drivers/input/$*
$(INPUT_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/input/$* implib
$(INPUT_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/input/$* clean
$(INPUT_DRIVERS:%=%_install): %_install:
$(MAKE) -C drivers/input/$* install
$(INPUT_DRIVERS:%=%_dist): %_dist:
$(MAKE) -C drivers/input/$* dist
.PHONY: $(INPUT_DRIVERS) $(INPUT_DRIVERS:%=%_implib) $(INPUT_DRIVERS:%=%_clean)\
$(INPUT_DRIVERS:%=%_install) $(INPUT_DRIVERS:%=%_dist)
$(FS_DRIVERS): %:
$(MAKE) -C drivers/fs/$*
$(FS_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/fs/$* implib
$(FS_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/fs/$* clean
$(FS_DRIVERS:%=%_install): %_install:
$(MAKE) -C drivers/fs/$* install
$(FS_DRIVERS:%=%_dist): %_dist:
$(MAKE) -C drivers/fs/$* dist
.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_implib) $(FS_DRIVERS:%=%_clean) \
$(FS_DRIVERS:%=%_install) $(FS_DRIVERS:%=%_dist)
#
# Network driver rules
#
$(NET_DRIVERS): %:
$(MAKE) -C drivers/net/$*
$(NET_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/net/$* implib
$(NET_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/net/$* clean
$(NET_DRIVERS:%=%_install): %_install:
$(MAKE) -C drivers/net/$* install
$(NET_DRIVERS:%=%_dist): %_dist:
$(MAKE) -C drivers/net/$* dist
.PHONY: $(NET_DRIVERS) $(NET_DRIVERS:%=%_implib) $(NET_DRIVERS:%=%_clean) \
$(NET_DRIVERS:%=%_install) $(NET_DRIVERS:%=%_dist)
$(NET_DEVICE_DRIVERS): %:
$(MAKE) -C drivers/net/dd/$*
$(NET_DEVICE_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/net/dd/$* implib
$(NET_DEVICE_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/net/dd/$* clean
$(NET_DEVICE_DRIVERS:%=%_install): %_install:
$(MAKE) -C drivers/net/dd/$* install
$(NET_DEVICE_DRIVERS:%=%_dist): %_dist:
$(MAKE) -C drivers/net/dd/$* dist
.PHONY: $(NET_DEVICE_DRIVERS) $(NET_DEVICE_DRIVERS:%=%_clean) $(NET_DEVICE_DRIVERS:%=%_implib) \
$(NET_DEVICE_DRIVERS:%=%_install) $(NET_DEVICE_DRIVERS:%=%_dist)
#
# storage driver rules
#
$(STORAGE_DRIVERS): %:
$(MAKE) -C drivers/storage/$*
$(STORAGE_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/storage/$* implib
$(STORAGE_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/storage/$* clean
$(STORAGE_DRIVERS:%=%_install): %_install:
$(MAKE) -C drivers/storage/$* install
$(STORAGE_DRIVERS:%=%_dist): %_dist:
$(MAKE) -C drivers/storage/$* dist
.PHONY: $(STORAGE_DRIVERS) $(STORAGE_DRIVERS:%=%_clean) \
$(STORAGE_DRIVERS:%=%_install) $(STORAGE_DRIVERS:%=%_dist)
#
# Kernel loaders
#
$(LOADERS): %:
$(MAKE) -C loaders/$*
$(LOADERS:%=%_implib): %_implib:
$(LOADERS:%=%_clean): %_clean:
$(MAKE) -C loaders/$* clean
$(LOADERS:%=%_install): %_install:
$(MAKE) -C loaders/$* install
$(LOADERS:%=%_dist): %_dist:
$(MAKE) -C loaders/$* dist
.PHONY: $(LOADERS) $(LOADERS:%=%_implib) $(LOADERS:%=%_clean) $(LOADERS:%=%_install) \
$(LOADERS:%=%_dist)
#
# Required system components
#
ntoskrnl:
$(MAKE) -C ntoskrnl
ntoskrnl_implib:
$(MAKE) -C ntoskrnl implib
ntoskrnl_clean:
$(MAKE) -C ntoskrnl clean
ntoskrnl_install:
$(MAKE) -C ntoskrnl install
ntoskrnl_dist:
$(MAKE) -C ntoskrnl dist
.PHONY: ntoskrnl ntoskrnl_implib ntoskrnl_clean ntoskrnl_install ntoskrnl_dist
#
# Hardware Abstraction Layer import library
#
hallib:
$(MAKE) -C hal/hal
hallib_implib:
$(MAKE) -C hal/hal implib
hallib_clean:
$(MAKE) -C hal/hal clean
hallib_install:
$(MAKE) -C hal/hal install
hallib_dist:
$(MAKE) -C hal/hal dist
.PHONY: hallib hallib_implib hallib_clean hallib_install hallib_dist
#
# Hardware Abstraction Layers
#
$(HALS): %:
$(MAKE) -C hal/$*
$(HALS:%=%_implib): %_implib:
$(MAKE) -C hal/$* implib
$(HALS:%=%_clean): %_clean:
$(MAKE) -C hal/$* clean
$(HALS:%=%_install): %_install:
$(MAKE) -C hal/$* install
$(HALS:%=%_dist): %_dist:
$(MAKE) -C hal/$* dist
.PHONY: $(HALS) $(HALS:%=%_implib) $(HALS:%=%_clean) $(HALS:%=%_install) $(HALS:%=%_dist)
#
# Required DLLs
#
$(DLLS): %:
$(MAKE) -C lib/$*
$(DLLS:%=%_depends): %_depends:
$(MAKE) -C lib/$* depends
$(DLLS:%=%_implib): %_implib:
$(MAKE) -C lib/$* implib
$(DLLS:%=%_clean): %_clean:
$(MAKE) -C lib/$* clean
$(DLLS:%=%_install): %_install:
$(MAKE) -C lib/$* install
$(DLLS:%=%_dist): %_dist:
$(MAKE) -C lib/$* dist
.PHONY: $(DLLS) $(DLLS:%=%_depends) $(DLLS:%=%_implib) $(DLLS:%=%_clean) $(DLLS:%=%_install) $(DLLS:%=%_dist)
#
# Subsystem support modules
#
$(SUBSYS): %:
$(MAKE) -C subsys/$*
$(SUBSYS:%=%_depends): %_depends:
$(MAKE) -C subsys/$* depends
$(SUBSYS:%=%_implib): %_implib:
$(MAKE) -C subsys/$* implib
$(SUBSYS:%=%_clean): %_clean:
$(MAKE) -C subsys/$* clean
$(SUBSYS:%=%_install): %_install:
$(MAKE) -C subsys/$* install
$(SUBSYS:%=%_dist): %_dist:
$(MAKE) -C subsys/$* dist
.PHONY: $(SUBSYS) $(SUBSYS:%=%_depends) $(SUBSYS:%=%_implib) $(SUBSYS:%=%_clean) $(SUBSYS:%=%_install) \
$(SUBSYS:%=%_dist)
#
# Create an installation
#
install_clean:
$(RM) $(INSTALL_DIR)/system32/drivers/*.*
$(RM) $(INSTALL_DIR)/system32/config/*.*
$(RM) $(INSTALL_DIR)/system32/*.*
$(RM) $(INSTALL_DIR)/symbols/*.*
$(RM) $(INSTALL_DIR)/media/fonts/*.*
$(RM) $(INSTALL_DIR)/media/*.*
$(RM) $(INSTALL_DIR)/bin/*.*
$(RM) $(INSTALL_DIR)/*.com
$(RM) $(INSTALL_DIR)/*.bat
$(RMDIR) $(INSTALL_DIR)/system32/drivers
$(RMDIR) $(INSTALL_DIR)/system32/config
$(RMDIR) $(INSTALL_DIR)/system32
$(RMDIR) $(INSTALL_DIR)/symbols
$(RMDIR) $(INSTALL_DIR)/media/fonts
$(RMDIR) $(INSTALL_DIR)/media
$(RMDIR) $(INSTALL_DIR)/bin
$(RMDIR) $(INSTALL_DIR)
install_dirs:
$(RMKDIR) $(INSTALL_DIR)
$(RMKDIR) $(INSTALL_DIR)/bin
$(RMKDIR) $(INSTALL_DIR)/media
$(RMKDIR) $(INSTALL_DIR)/media/fonts
$(RMKDIR) $(INSTALL_DIR)/symbols
$(RMKDIR) $(INSTALL_DIR)/system32
$(RMKDIR) $(INSTALL_DIR)/system32/config
$(RMKDIR) $(INSTALL_DIR)/system32/drivers
install_before:
$(CP) bootc.lst $(INSTALL_DIR)/bootc.lst
$(CP) boot.bat $(INSTALL_DIR)/boot.bat
$(CP) aboot.bat $(INSTALL_DIR)/aboot.bat
$(CP) system.hiv $(INSTALL_DIR)/system32/config/system.hiv
$(CP) media/fonts/helb____.ttf $(INSTALL_DIR)/media/fonts/helb____.ttf
$(CP) media/fonts/timr____.ttf $(INSTALL_DIR)/media/fonts/timr____.ttf
.PHONY: install_clean install_dirs install_before
#
# Make a distribution saveset
#
dist_clean:
$(RM) $(DIST_DIR)/symbols/*.sym
$(RM) $(DIST_DIR)/drivers/*.sys
$(RM) $(DIST_DIR)/subsys/*.exe
$(RM) $(DIST_DIR)/dlls/*.dll
$(RM) $(DIST_DIR)/apps/*.exe
$(RM) $(DIST_DIR)/*.exe
$(RMDIR) $(DIST_DIR)/symbols
$(RMDIR) $(DIST_DIR)/subsys
$(RMDIR) $(DIST_DIR)/drivers
$(RMDIR) $(DIST_DIR)/dlls
$(RMDIR) $(DIST_DIR)/apps
$(RMDIR) $(DIST_DIR)
dist_dirs:
$(RMKDIR) $(DIST_DIR)
$(RMKDIR) $(DIST_DIR)/apps
$(RMKDIR) $(DIST_DIR)/dlls
$(RMKDIR) $(DIST_DIR)/drivers
$(RMKDIR) $(DIST_DIR)/subsys
$(RMKDIR) $(DIST_DIR)/symbols
.PHONY: dist_clean dist_dirs
etags:
find . -name "*.[ch]" -print | etags --language=c -
# EOF

28
reactos/README Normal file
View File

@@ -0,0 +1,28 @@
========================
ReactOS Version 0.1.x
Updated March 19th, 2003
========================
1. What is ReactOS?
ReactOS is an Open Source effort to develop a quality operating system
that is compatible with Windows NT applications and drivers.
The ReactOS project, although currently focused on Windows 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.com.
2. Building ReactOS
See the INSTALL file for more details.
3. More information
See the doc subdirectory for some sparse notes
4. Who is responsible
See the CREDITS file

3
reactos/aboot.bat Normal file
View 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

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View 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 */

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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;
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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;
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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);
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View File

@@ -0,0 +1,8 @@
/*
*
*/
int main(int argc, char* argv[])
{
}

View 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;
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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);
}
//------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View 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);
}

View File

@@ -0,0 +1,3 @@
*.o
*.exe
*.sym

View 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

View 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;
}

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View 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 */

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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;
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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");
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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;
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View 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;
}

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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;
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View File

@@ -0,0 +1,8 @@
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
printf("Hello world\n");
return(0);
}

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

File diff suppressed because it is too large Load Diff

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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 */

View 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

View 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

View 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);
}

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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 */

View 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 */

View 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 */

View File

@@ -0,0 +1,8 @@
VOID
DumpInfo (
LPCWSTR Name,
NTSTATUS Status,
LPCWSTR Comment,
HANDLE Port
);

View 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;
}

View 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 */

View File

@@ -0,0 +1,5 @@
#ifndef _LPCTEST_H
#define _LPCTEST_H
#define TEST_PORT_NAME "\\TestPort"
#define TEST_PORT_NAME_U L"\\TestPort"
#endif

View 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

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View 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;
}

View 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

View 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;
}

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View 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 */

View 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 */

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View 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;
}

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View 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;
}

View 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);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View 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

View 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);
}
//------------------------------------------------------------------

View File

@@ -0,0 +1,5 @@
*.o
*.d
*.exe
*.coff
*.sym

View 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

View File

@@ -0,0 +1,23 @@
#include <ntos.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
int x;
PTEB Teb;
printf("TEB dumpper\n");
__asm__("movl %%fs:0x18, %0\n\t"
: "=a" (x)
: /* no inputs */);
printf("fs[0x18] %x\n", x);
Teb = (PTEB)x;
printf("StackBase: 0x%08lX\n", Teb->Tib.StackBase);
printf("StackLimit: 0x%08lX\n", Teb->Tib.StackLimit);
printf("DeallocationStack: 0x%08lX\n", Teb->DeallocationStack);
return(0);
}

View File

@@ -0,0 +1,45 @@
// main.c :
//
#include <windows.h>
#include <stdio.h>
#include "regdump.h"
HANDLE OutputHandle;
HANDLE InputHandle;
DWORD GetInput(char* Buffer, int buflen)
{
DWORD Result;
ReadConsoleA(InputHandle, Buffer, buflen, &Result, NULL);
return Result;
}
int __cdecl main(int argc, char* argv[])
{
//AllocConsole();
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
//return regmain(argc, argv);
return regdump(argc, argv);
}
#ifndef __GNUC__
//__declspec(dllimport) int __stdcall DllMain(void* hinstDll, unsigned long dwReason, void* reserved);
char* args[] = { "regdump.exe", "0", "ansi", "verbose"};
int __cdecl mainCRTStartup(void)
{
//DllMain(NULL, DLL_PROCESS_ATTACH, NULL);
main(1, args);
return 0;
}
#endif /*__GNUC__*/

View File

@@ -0,0 +1,25 @@
#
# $Id: makefile,v 1.0
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = regdump
#TARGET_CFLAGS = -DWIN32_REGDBG -DUNICODE -D_UNICODE
TARGET_CFLAGS = -DWIN32_REGDBG
TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a
TARGET_OBJECTS = $(TARGET_NAME).o regcmds.o regproc.o main.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,224 @@
/* $Id: regcmds.c,v 1.2 2003/01/01 11:16:18 robd Exp $
*
* ReactOS regedit
*
* regcmds.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Original Work Copyright 2002 Andriy Palamarchuk
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#ifdef WIN32_REGDBG
#else
#include <ctype.h>
#endif
#include "regproc.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
static char *usage =
"Usage:\n"
" regedit filename\n"
" regedit /E filename [regpath]\n"
" regedit /D regpath\n"
"\n"
"filename - registry file name\n"
"regpath - name of the registry key\n"
"\n"
"When is called without any switches adds contents of the specified\n"
"registry file to the registry\n"
"\n"
"Switches:\n"
" /E - exports contents of the specified registry key to the specified\n"
" file. Exports the whole registry if no key is specified.\n"
" /D - deletes specified registry key\n"
" /S - silent execution, can be used with any other switch.\n"
" The only existing mode, exists for compatibility with Windows regedit.\n"
" /V - advanced mode, can be used with any other switch.\n"
" Ignored, exists for compatibility with Windows regedit.\n"
" /L - location of system.dat file. Can be used with any other switch.\n"
" Ignored. Exists for compatibility with Windows regedit.\n"
" /R - location of user.dat file. Can be used with any other switch.\n"
" Ignored. Exists for compatibility with Windows regedit.\n"
" /? - print this help. Any other switches are ignored.\n"
" /C - create registry from. Not implemented.\n"
"\n"
"The switches are case-insensitive, can be prefixed either by '-' or '/'.\n"
"This program is command-line compatible with Microsoft Windows\n"
"regedit. The difference with Windows regedit - this application has\n"
"command-line interface only.\n";
typedef enum {
ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE, ACTION_VIEW
} REGEDIT_ACTION;
/**
* Process unknown switch.
*
* Params:
* chu - the switch character in upper-case.
* s - the command line string where s points to the switch character.
*/
void error_unknown_switch(char chu, char *s)
{
if (isalpha(chu)) {
printf("Undefined switch /%c!\n", chu);
} else {
printf("Alphabetic character is expected after '%c' "
"in switch specification\n", *(s - 1));
}
//exit(1);
}
BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
{
TCHAR filename[MAX_PATH];
TCHAR reg_key_name[KEY_MAX_LEN];
switch (action) {
case ACTION_ADD:
get_file_name(&s, filename, MAX_PATH);
if (!filename[0]) {
printf("No file name is specified\n%s", usage);
return FALSE;
//exit(1);
}
while (filename[0]) {
if (!import_registry_file(filename)) {
perror("");
printf("Can't open file \"%s\"\n", filename);
return FALSE;
//exit(1);
}
get_file_name(&s, filename, MAX_PATH);
}
break;
case ACTION_DELETE:
get_file_name(&s, reg_key_name, KEY_MAX_LEN);
if (!reg_key_name[0]) {
printf("No registry key is specified for removal\n%s", usage);
return FALSE;
//exit(1);
}
delete_registry_key(reg_key_name);
break;
case ACTION_EXPORT:
filename[0] = '\0';
get_file_name(&s, filename, MAX_PATH);
if (!filename[0]) {
printf("No file name is specified\n%s", usage);
return FALSE;
//exit(1);
}
if (s[0]) {
get_file_name(&s, reg_key_name, KEY_MAX_LEN);
export_registry_key(filename, reg_key_name);
} else {
export_registry_key(filename, NULL);
}
break;
default:
printf("Unhandled action!\n");
return FALSE;
}
return TRUE;
}
BOOL ProcessCmdLine(LPSTR lpCmdLine)
{
REGEDIT_ACTION action = ACTION_UNDEF;
LPSTR s = lpCmdLine; /* command line pointer */
CHAR ch = *s; /* current character */
while (ch && ((ch == '-') || (ch == '/'))) {
char chu;
char ch2;
s++;
ch = *s;
ch2 = *(s+1);
chu = toupper(ch);
if (!ch2 || isspace(ch2)) {
if (chu == 'S' || chu == 'V') {
/* ignore these switches */
} else {
switch (chu) {
case 'D':
action = ACTION_DELETE;
break;
case 'E':
action = ACTION_EXPORT;
break;
case 'V':
action = ACTION_VIEW;
break;
case '?':
printf(usage);
return FALSE;
//exit(0);
break;
default:
error_unknown_switch(chu, s);
return FALSE;
break;
}
}
s++;
} else {
if (ch2 == ':') {
switch (chu) {
case 'L':
/* fall through */
case 'R':
s += 2;
while (*s && !isspace(*s)) {
s++;
}
break;
default:
error_unknown_switch(chu, s);
return FALSE;
break;
}
} else {
/* this is a file name, starting from '/' */
s--;
break;
}
}
/* skip spaces to the next parameter */
ch = *s;
while (ch && isspace(ch)) {
s++;
ch = *s;
}
}
if (action == ACTION_UNDEF) {
action = ACTION_ADD;
}
return PerformRegAction(action, s);
}

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