Compare commits

..

24 Commits

Author SHA1 Message Date
David Welch
72d86ddffb Added this to compile kernel32 as a dll
svn path=/branches/mingw32/; revision=337
1999-03-24 10:18:49 +00:00
David Welch
f0c44628b3 Removed redundant file
svn path=/branches/mingw32/; revision=336
1999-03-24 10:17:42 +00:00
David Welch
6f09ababf5 Deleted redundant driver
svn path=/branches/mingw32/; revision=335
1999-03-24 10:15:36 +00:00
David Welch
d6a08a5446 Made kernel32 compile as a dll
svn path=/branches/mingw32/; revision=334
1999-03-24 10:13:27 +00:00
David Welch
29179770fc This shouldn't be in the repository
svn path=/branches/mingw32/; revision=320
1999-03-17 12:49:06 +00:00
David Welch
a70e3087f3 Fixed remaining bugs in PE loader for user programs
svn path=/branches/mingw32/; revision=318
1999-03-17 12:46:49 +00:00
David Welch
92f71b7235 Updated header file usage
svn path=/branches/mingw32/; revision=316
1999-03-15 16:29:46 +00:00
David Welch
a4b4ff1ffb Corrected header file usage and file names
svn path=/branches/mingw32/; revision=315
1999-03-15 16:27:49 +00:00
David Welch
ad2ffa4236 Updated header file usage and corrected bugs in loader
svn path=/branches/mingw32/; revision=313
1999-03-15 16:25:59 +00:00
David Welch
e2e21b38cf Changed base address of ntdll.dll and changed Makefile name
svn path=/branches/mingw32/; revision=312
1999-03-15 16:24:15 +00:00
David Welch
78f48c804f Moved headers file into dll specific directory
svn path=/branches/mingw32/; revision=310
1999-03-15 16:22:57 +00:00
David Welch
f3d61a9d91 Moved include files to dll specific directory
svn path=/branches/mingw32/; revision=309
1999-03-15 16:19:26 +00:00
David Welch
79f21187a9 Moved include files to dll specific directory
svn path=/branches/mingw32/; revision=308
1999-03-15 16:18:41 +00:00
Rex Jolliff
5b2e338ce6 changed the name for consistancy
svn path=/branches/mingw32/; revision=303
1999-03-12 22:35:39 +00:00
Rex Jolliff
9feaf7da61 Changed to copy PE files
svn path=/branches/mingw32/; revision=302
1999-03-12 22:33:28 +00:00
Rex Jolliff
2b40da68c8 we can boot now!
svn path=/branches/mingw32/; revision=289
1999-03-10 08:16:51 +00:00
The ReactOS Team
a1719f3e2b This commit was manufactured by cvs2svn to create branch 'mingw32'.
svn path=/branches/mingw32/; revision=288
1999-03-10 07:18:38 +00:00
Rex Jolliff
f775cf142c more changes to compile under mingw32
svn path=/branches/mingw32/; revision=287
1999-03-10 07:18:38 +00:00
Rex Jolliff
52ef8d2d16 added config to generate NTDLL.DLL under mingw32
svn path=/branches/mingw32/; revision=279
1999-03-06 21:44:41 +00:00
Rex Jolliff
87709c4ca5 Changed function for use as initial process loader
svn path=/branches/mingw32/; revision=277
1999-03-03 02:56:25 +00:00
Rex Jolliff
041895f643 Added code for image startup
svn path=/branches/mingw32/; revision=276
1999-03-03 01:30:40 +00:00
Rex Jolliff
c791abd0c0 Added rules to compile using MingW32 under windows
svn path=/branches/mingw32/; revision=274
1999-02-27 00:30:19 +00:00
Rex Jolliff
57c894ef14 Changes to support compilation under mingw32
svn path=/branches/mingw32/; revision=273
1999-02-26 19:03:22 +00:00
The ReactOS Team
f81c666055 This commit was manufactured by cvs2svn to create branch 'mingw32'.
svn path=/branches/mingw32/; revision=272
1999-02-26 19:03:22 +00:00
4028 changed files with 55395 additions and 792289 deletions

View File

@@ -1,18 +0,0 @@
dist
reactos
*.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,74 +0,0 @@
1. Build environment
To build the system you need either mingw32 installed on Windows or a mingw32
cross compiler running on unix.
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

View File

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

View File

@@ -1,788 +0,0 @@
#
# Global makefile
#
PATH_TO_TOP = .
#
# Define to build WINE modules
#
ifeq ($(ROS_BUILD_WINE),)
ROS_BUILD_WINE = no
else
ROS_BUILD_WINE = 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 winmm ws2help ws2_32 wshirda
SUBSYS = smss win32k csrss
#
# 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 zlib
# Kernel mode device drivers
# beep blue floppy ide keyboard mouse null parallel ramdrv serenum serial vga vidport
DEVICE_DRIVERS = beep blue floppy ide null serial vga vidport
# 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 packet tcpip tdi wshtcpip
NET_DRIVERS = afd ndis packet 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 shell winlogon gstart usetup
# System services
# rpcss eventlog
SYS_SVC = rpcss eventlog
# Test applications
# alive apc args atomtest bench consume count dump_shared_data
# event file gditest hello isotest lpc mstest mutex nptest
# pteb regtest sectest shm simple thread vmtest winhello
TEST_APPS = alive apc args atomtest bench consume count dump_shared_data \
event file gditest hello isotest lpc mstest mutex nptest \
pteb regtest sectest shm simple thread tokentest vmtest winhello dibtest
# Test applications
# cabman cat net objdir partinfo pice ps stats
UTIL_APPS = cat objdir partinfo stats
#
# Win32 Subsystem support (Based on WINE)
# FIXME: Move to this its own Makefile
#
WINE_OTHER = unicode library
WINE_TOOLS = bin2res wrc winebuild
WINE_DLLS = comcat crtdll comctl32 commdlg dsound dplayx imagehlp ole32 richedit \
shlwapi shell32 shdocvw twain urlmon winspool \
rpcrt4 # needed to make rcprt4 implib
# mapi32 oleaut32 oledlg olepro32 olecli olesvr shfolder
# winmm ddraw dinput dplay serialui tapi32 urlmon wintrust
# msinfo lzexpand (missing imports)
WINE_PROGS = control expand osversioncheck regedit regsvr32 winver uninstaller
# (waiting on wrc fix for the rest of these)
# clock cmdlgtst notepad progman wcmd
# winefile winemine winetest uninstaller
ifeq ($(ROS_BUILD_WINE),yes)
WINE_MODULES = $(WINE_OTHER) $(WINE_TOOLS) $(WINE_DLLS) $(WINE_PROGS)
else
WINE_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) $(TEST_APPS) \
$(UTIL_APPS) $(WINE_MODULES)
implib: $(COMPONENTS:%=%_implib) $(HALS:%=%_implib) $(BUS:%=%_implib) \
$(DLLS:%=%_implib) $(LOADERS:%=%_implib) \
$(KERNEL_DRIVERS:%=%_implib) $(SUBSYS:%=%_implib) \
$(SYS_APPS:%=%_implib) $(SYS_SVC:%=%_implib) \
$(TEST_APPS:%=%_implib) $(UTIL_APPS:%=%_implib) \
$(WINE_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) $(TEST_APPS:%=%_clean) \
$(UTIL_APPS:%=%_clean) $(NET_APPS:%=%_clean) $(WINE_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) \
$(TEST_APPS:%=%_install) $(UTIL_APPS:%=%_install) \
$(WINE_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) $(TEST_APPS:%=%_dist) \
$(UTIL_APPS:%=%_dist) $(NET_APPS:%=%_dist) $(WINE_MODULES:%=%_dist)
.PHONY: all 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:%=%_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:%=%_implib) $(SYS_SVC:%=%_clean) $(SYS_SVC:%=%_install) $(SYS_SVC:%=%_dist)
#
# Test Applications
#
$(TEST_APPS): %:
make -C apps/tests/$*
$(TEST_APPS:%=%_implib): %_implib:
make -C apps/tests/$* implib
$(TEST_APPS:%=%_clean): %_clean:
make -C apps/tests/$* clean
$(TEST_APPS:%=%_dist): %_dist:
make -C apps/tests/$* dist
$(TEST_APPS:%=%_install): %_install:
make -C apps/tests/$* install
.PHONY: $(TEST_APPS) $(TEST_APPS:%=%_implib) $(TEST_APPS:%=%_clean) $(TEST_APPS:%=%_install) $(TEST_APPS:%=%_dist)
#
# Utility Applications
#
$(UTIL_APPS): %:
make -C apps/utils/$*
$(UTIL_APPS:%=%_implib): %_implib:
make -C apps/utils/$* implib
$(UTIL_APPS:%=%_clean): %_clean:
make -C apps/utils/$* clean
$(UTIL_APPS:%=%_dist): %_dist:
make -C apps/utils/$* dist
$(UTIL_APPS:%=%_install): %_install:
make -C apps/utils/$* install
.PHONY: $(UTIL_APPS) $(UTIL_APPS:%=%_implib) $(UTIL_APPS:%=%_clean) $(UTIL_APPS:%=%_install) $(UTIL_APPS:%=%_dist)
#
# Other Wine Modules
#
$(WINE_OTHER): %:
make -f makefile.ros -C $(WINE_PATH)/$*
$(WINE_OTHER:%=%_implib): %_implib:
make -f makefile.ros -C $(WINE_PATH)/$* implib
$(WINE_OTHER:%=%_clean): %_clean:
make -f makefile.ros -C $(WINE_PATH)/$* clean
$(WINE_OTHER:%=%_dist): %_dist:
make -f makefile.ros -C $(WINE_PATH)/$* dist
$(WINE_OTHER:%=%_install): %_install:
make -f makefile.ros -C $(WINE_PATH)/$* install
.PHONY: $(WINE_OTHER) $(WINE_OTHER:%=%_implib) $(WINE_OTHER:%=%_clean) $(WINE_OTHER:%=%_install) $(WINE_OTHER:%=%_dist)
#
# Wine Tools
#
$(WINE_TOOLS): %:
make -f makefile.ros -C $(WINE_PATH)/tools/$*
$(WINE_TOOLS:%=%_implib): %_implib:
make -f makefile.ros -C $(WINE_PATH)/tools/$* implib
$(WINE_TOOLS:%=%_clean): %_clean:
make -f makefile.ros -C $(WINE_PATH)/tools/$* clean
$(WINE_TOOLS:%=%_dist): %_dist:
make -f makefile.ros -C $(WINE_PATH)/tools/$* dist
$(WINE_TOOLS:%=%_install): %_install:
make -f makefile.ros -C $(WINE_PATH)/tools/$* install
.PHONY: $(WINE_DLLS) $(WINE_DLLS:%=%_implib) $(WINE_DLLS:%=%_clean) $(WINE_DLLS:%=%_install) $(WINE_DLLS:%=%_dist)
#
# Wine DLLs
#
$(WINE_DLLS): %:
make -f makefile.ros -C $(WINE_PATH)/dlls/$*
$(WINE_DLLS:%=%_implib): %_implib:
make -f makefile.ros -C $(WINE_PATH)/dlls/$* implib
$(WINE_DLLS:%=%_clean): %_clean:
make -f makefile.ros -C $(WINE_PATH)/dlls/$* clean
$(WINE_DLLS:%=%_dist): %_dist:
make -f makefile.ros -C $(WINE_PATH)/dlls/$* dist
$(WINE_DLLS:%=%_install): %_install:
make -f makefile.ros -C $(WINE_PATH)/dlls/$* install
.PHONY: $(WINE_DLLS) $(WINE_DLLS:%=%_implib) $(WINE_DLLS:%=%_clean) $(WINE_DLLS:%=%_install) $(WINE_DLLS:%=%_dist)
#
# Wine programs
#
$(WINE_PROGS): %:
make -f makefile.ros -C $(WINE_PATH)/programs/$*
$(WINE_PROGS:%=%_implib): %_implib:
make -f makefile.ros -C $(WINE_PATH)/programs/$* implib
$(WINE_PROGS:%=%_clean): %_clean:
make -f makefile.ros -C $(WINE_PATH)/programs/$* clean
$(WINE_PROGS:%=%_dist): %_dist:
make -f makefile.ros -C $(WINE_PATH)/programs/$* dist
$(WINE_PROGS:%=%_install): %_install:
make -f makefile.ros -C $(WINE_PATH)/programs/$* install
.PHONY: $(WINE_PROGS) $(WINE_PROGS:%=%_implib) $(WINE_PROGS:%=%_clean) $(WINE_PROGS:%=%_install) $(WINE_PROGS:%=%_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:%=%_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:%=%_implib) $(DLLS:%=%_clean) $(DLLS:%=%_install) $(DLLS:%=%_dist)
#
# Subsystem support modules
#
$(SUBSYS): %:
make -C subsys/$*
$(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:%=%_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

View File

@@ -1,6 +1,5 @@
0.0.14: Converted to PE format
All system libraries are now dlls
0.0.14 (so far):
0.0.13: Mostly bugfixes (I think)
0.0.12: Added support for multiple processes (not really tested)

View File

@@ -1,24 +1,21 @@
About Reactos
DIRECTORIES
1. What is Reactos
A project aiming to make an approximate clone of Windows NT, compatible
with most Windows applications.
The project has a website at http://www.reactos.com/
2. Building Reactos
See the INSTALL file for more details.
3. More information
See the doc subdirectory for some sparse notes
4. Who is responsible
See the CREDITS file
5. Recent developments
See the NEWS file
system : compiled versions of the various system components and
libraries
ntoskrnl : microkernel source
ntoskrnl/hal : hardware abstraction layer source
ntoskrnl/mm : memory managment subsystem source
ntoskrnl/io : IO manager subsystem source
include : win32 headers
include/internal : kernel private header files
include/ntdll : system library private header files
include/kernel32 : system library private header files
include/user32 : user interface private header files
include/gdi32 : graphics interface private header files
include/ddk : header files for modules
lib/ntdll : NT dll source
lib/kernel32 : kernel32 source
doc : documentation
loaders/dos : DOS based loader
loaders/boot : boot loader
services : various services (device drivers, filesystems etc)

View File

@@ -1,3 +0,0 @@
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,33 @@
#include <windows.h>
extern int main(int args, char* argv[], char* environ[]);
static unsigned int _argc = 0;
static char** _argv = NULL;
static char** _environ = NULL;
int mainCRTStartup(PWSTR args)
{
int nRet;
// SetUnhandledExceptionFilter(NULL);
// _fpreset();
// __GetMainArgs(&_argc, &_argv, &_environ, 0);
nRet = main(_argc, _argv, _environ);
// _cexit();
ExitProcess(nRet);
}
int WinMainCRTStartup()
{
return mainCRTStartup(NULL);
}
void __main(void)
{
}

View File

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

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

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

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

@@ -1,7 +1,8 @@
#include <internal/mmhal.h>
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
HANDLE OutputHandle;
HANDLE InputHandle;
@@ -10,7 +11,7 @@ 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);
@@ -18,22 +19,17 @@ void debug_printf(char* fmt, ...)
}
int main(int argc, char* argv[])
void 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]);
debug_printf("Args: '%s'\n",argv[i]);
}
return 0;
}

View File

@@ -1,19 +1,10 @@
# $Id: makefile,v 1.15 2002/06/02 19:24:57 chorns Exp $
all: args.exe
PATH_TO_TOP = ../../..
OBJECTS= ../common/crt0.o args.o
LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a
TARGET_NORC = yes
args.exe: $(OBJECTS) $(LIBS)
$(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o args.exe
$(NM) --numeric-sort args.exe > args.sym
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
include ../../rules.mak

View File

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

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

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

View File

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

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

@@ -1,138 +0,0 @@
// ------------------------------------------------------------------
// 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);
try
{
//
// TODO: add palette support (see Chapter 9)...
//
BitBlt(Hdc, 20, 15,
bmp.bmWidth, bmp.bmHeight,
HMemDC, 0, 0,
SRCCOPY);
}
catch (...)
{
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.

Before

Width:  |  Height:  |  Size: 87 KiB

View File

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

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

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

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

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

@@ -1,81 +0,0 @@
#include <windows.h>
extern BOOL STDCALL GdiDllInitialize(HANDLE hInstance, DWORD Event, LPVOID Reserved);
void __stdcall Test1BPP (HDC Desktop)
{
HDC TestDC;
HPEN WhitePen;
HBITMAP DIB1;
BITMAPINFOHEADER BitInf;
PBITMAPINFO BitPalInf;
DWORD bmiSize = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 2;
// Create a 1BPP DIB
BitPalInf = (PBITMAPINFO)malloc(bmiSize);
BitInf.biSize = sizeof(BITMAPINFOHEADER);
BitInf.biWidth = 50;
BitInf.biHeight = -50; // it's top down (since BI_RGB is used, the sign is operative of direction)
BitInf.biPlanes = 1;
BitInf.biBitCount = 1;
BitInf.biCompression = BI_RGB;
BitInf.biSizeImage = 0;
BitInf.biXPelsPerMeter = 0;
BitInf.biYPelsPerMeter = 0;
BitInf.biClrUsed = 0;
BitInf.biClrImportant = 0;
BitPalInf->bmiHeader = BitInf;
BitPalInf->bmiColors[1].rgbBlue = 255;
BitPalInf->bmiColors[1].rgbGreen = 255;
BitPalInf->bmiColors[1].rgbRed = 255;
BitPalInf->bmiColors[1].rgbReserved = 255;
BitPalInf->bmiColors[0].rgbBlue = 0;
BitPalInf->bmiColors[0].rgbGreen = 0;
BitPalInf->bmiColors[0].rgbRed = 0;
BitPalInf->bmiColors[0].rgbReserved = 0;
DIB1 = (HBITMAP) CreateDIBSection(NULL, BitPalInf, DIB_RGB_COLORS, NULL, NULL, 0);
TestDC = CreateCompatibleDC(NULL);
SelectObject(TestDC, DIB1);
// Draw a white rectangle on the 1BPP DIB
WhitePen = CreatePen(PS_SOLID, 1, RGB(255, 255, 255));
SelectObject(TestDC, WhitePen);
Rectangle(TestDC, 0, 0, 40, 40);
// Blt the 1BPP DIB to the display
BitBlt(Desktop, 0, 0, 50, 50, TestDC, 0, 0, SRCCOPY);
free(BitPalInf);
// Rectangle(Desktop, 50, 50, 200, 200);
}
void DIBTest(void)
{
HDC Desktop;
// 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;
}
// 1BPP Test
Test1BPP(Desktop);
Sleep(50000);
// Free up everything
DeleteDC(Desktop);
}
int main(int argc, char* argv[])
{
printf("Entering DIBTest..\n");
GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
DIBTest();
return 0;
}

View File

@@ -1,21 +0,0 @@
# $Id: makefile,v 1.1 2002/09/22 20:09:01 jfilby Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
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

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

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

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

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

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

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

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

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

@@ -1,5 +1,4 @@
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{

View File

@@ -1,19 +1,8 @@
# $Id: makefile,v 1.16 2002/06/02 19:24:59 chorns Exp $
all: hello.exe
PATH_TO_TOP = ../../..
OBJECTS = hello.o
TARGET_NORC = yes
hello.exe: $(OBJECTS) $(LIBS)
$(CC) $(OBJECTS) -o hello.exe
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
include ../../rules.mak

View File

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

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

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

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

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

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

View File

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

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

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

View File

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

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

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

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

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

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

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

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

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

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

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

Before

Width:  |  Height:  |  Size: 104 KiB

View File

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

@@ -1,270 +0,0 @@
// ------------------------------------------------------------------
// 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);
try
{
//
// 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);
}
catch (...)
{
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

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

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

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

View File

@@ -1,234 +0,0 @@
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
#include <ddk/ntddk.h>
HANDLE OutputHandle;
HANDLE InputHandle;
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);
}
#define MAX_NAME_LEN 500
/*
BOOL DumpRegKey(TCHAR* KeyPath, HKEY hKey)
{
TCHAR keyPath[1000];
int keyPathLen = 0;
keyPath[0] = _T('\0');
dprintf("\n[%s]\n", KeyPath);
if (hKey != NULL) {
HKEY hNewKey;
LONG errCode = RegOpenKeyEx(hKey, keyPath, 0, KEY_READ, &hNewKey);
if (errCode == ERROR_SUCCESS) {
TCHAR Name[MAX_NAME_LEN];
DWORD cName = MAX_NAME_LEN;
FILETIME LastWriteTime;
DWORD dwIndex = 0L;
while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) {
HKEY hSubKey;
DWORD dwCount = 0L;
dprintf("\n[%s\\%s]\n", KeyPath, Name);
errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hSubKey);
if (errCode == ERROR_SUCCESS) {
TCHAR SubName[MAX_NAME_LEN];
DWORD cSubName = MAX_NAME_LEN;
// if (RegEnumKeyEx(hSubKey, 0, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
while (RegEnumKeyEx(hSubKey, dwCount, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
dprintf("\t%s (%d)\n", SubName, dwCount);
cSubName = MAX_NAME_LEN;
++dwCount;
}
}
RegCloseKey(hSubKey);
//AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwCount);
cName = MAX_NAME_LEN;
++dwIndex;
}
RegCloseKey(hNewKey);
}
} else {
}
dprintf("\n");
return TRUE;
}
*/
BOOL _DumpRegKey(TCHAR* KeyPath, HKEY hKey)
{
if (hKey != NULL) {
HKEY hNewKey;
LONG errCode = RegOpenKeyEx(hKey, NULL, 0, KEY_READ, &hNewKey);
if (errCode == ERROR_SUCCESS) {
TCHAR Name[MAX_NAME_LEN];
DWORD cName = MAX_NAME_LEN;
FILETIME LastWriteTime;
DWORD dwIndex = 0L;
TCHAR* pKeyName = &KeyPath[_tcslen(KeyPath)];
while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) {
HKEY hSubKey;
DWORD dwCount = 0L;
_tcscat(KeyPath, _T("\\"));
_tcscat(KeyPath, Name);
dprintf("\n[%s]\n", KeyPath);
errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hSubKey);
if (errCode == ERROR_SUCCESS) {
#if 1
_DumpRegKey(KeyPath, hSubKey);
#else
TCHAR SubName[MAX_NAME_LEN];
DWORD cSubName = MAX_NAME_LEN;
// if (RegEnumKeyEx(hSubKey, 0, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
while (RegEnumKeyEx(hSubKey, dwCount, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
dprintf("\t%s (%d)\n", SubName, dwCount);
cSubName = MAX_NAME_LEN;
++dwCount;
}
#endif
}
RegCloseKey(hSubKey);
cName = MAX_NAME_LEN;
*pKeyName = _T('\0');
++dwIndex;
}
RegCloseKey(hNewKey);
}
} else {
}
return TRUE;
}
BOOL DumpRegKey(TCHAR* KeyPath, HKEY hKey)
{
dprintf("\n[%s]\n", KeyPath);
return _DumpRegKey(KeyPath, hKey);
}
void RegKeyPrint(int which)
{
TCHAR szKeyPath[1000];
switch (which) {
case '1':
strcpy(szKeyPath, _T("HKEY_CLASSES_ROOT"));
DumpRegKey(szKeyPath, HKEY_CLASSES_ROOT);
break;
case '2':
strcpy(szKeyPath, _T("HKEY_CURRENT_USER"));
DumpRegKey(szKeyPath, HKEY_CURRENT_USER);
break;
case '3':
strcpy(szKeyPath, _T("HKEY_LOCAL_MACHINE"));
DumpRegKey(szKeyPath, HKEY_LOCAL_MACHINE);
break;
case '4':
strcpy(szKeyPath, _T("HKEY_USERS"));
DumpRegKey(szKeyPath, HKEY_USERS);
break;
case '5':
strcpy(szKeyPath, _T("HKEY_CURRENT_CONFIG"));
DumpRegKey(szKeyPath, HKEY_CURRENT_CONFIG);
break;
case '6':
// DumpRegKey(szKeyPath, HKEY_CLASSES_ROOT);
// DumpRegKey(szKeyPath, HKEY_CURRENT_USER);
// DumpRegKey(szKeyPath, HKEY_LOCAL_MACHINE);
// DumpRegKey(szKeyPath, HKEY_USERS);
// DumpRegKey(szKeyPath, HKEY_CURRENT_CONFIG);
dprintf("unimplemented...\n");
break;
}
}
int main(int argc, char* argv[])
{
char Buffer[10];
TCHAR szKeyPath[1000];
DWORD Result;
AllocConsole();
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
if (argc > 1) {
// if (0 == _tcsstr(argv[1], _T("HKLM"))) {
if (strstr(argv[1], _T("help"))) {
} else if (strstr(argv[1], _T("HKCR"))) {
RegKeyPrint('1');
} else if (strstr(argv[1], _T("HKCU"))) {
RegKeyPrint('2');
} else if (strstr(argv[1], _T("HKLM"))) {
RegKeyPrint('3');
} else if (strstr(argv[1], _T("HKU"))) {
RegKeyPrint('4');
} else if (strstr(argv[1], _T("HKCC"))) {
RegKeyPrint('5');
} else if (strstr(argv[1], _T("HKRR"))) {
RegKeyPrint('6');
} else {
dprintf("started with argc = %d, argv[1] = %s (unknown?)\n", argc, argv[1]);
}
} else while (1) {
dprintf("choose test :\n");
dprintf(" 0 = Exit\n");
dprintf(" 1 = HKEY_CLASSES_ROOT\n");
dprintf(" 2 = HKEY_CURRENT_USER\n");
dprintf(" 3 = HKEY_LOCAL_MACHINE\n");
dprintf(" 4 = HKEY_USERS\n");
dprintf(" 5 = HKEY_CURRENT_CONFIG\n");
dprintf(" 6 = REGISTRY ROOT\n");
ReadConsoleA(InputHandle, Buffer, 3, &Result, NULL) ;
switch (Buffer[0]) {
case '0':
return(0);
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
RegKeyPrint(Buffer[0]/* - '0'*/);
break;
default:
dprintf("invalid input.\n");
break;
}
}
return 0;
}
/*
[HKEY_LOCAL_MACHINE]
[HKEY_LOCAL_MACHINE\HARDWARE]
[HKEY_LOCAL_MACHINE\HARDWARE\ACPI]
[HKEY_LOCAL_MACHINE\HARDWARE\ACPI\DSDT]
[HKEY_LOCAL_MACHINE\HARDWARE\ACPI\DSDT\VIA694]
[HKEY_LOCAL_MACHINE\HARDWARE\ACPI\DSDT\VIA694\AWRDACPI]
*/

View File

@@ -1,22 +0,0 @@
#
# $Id: makefile,v 1.7 2002/06/02 19:25:00 chorns Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = regtest
TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -1,882 +0,0 @@
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <ddk/ntddk.h>
HANDLE OutputHandle;
HANDLE InputHandle;
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);
}
void do_enumeratekey(PWSTR Name)
{
ULONG Index,Length,i;
KEY_BASIC_INFORMATION KeyInformation[5];
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE hKey1;
UNICODE_STRING KeyName;
RtlInitUnicodeString(&KeyName, Name);
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes);
dprintf("NtEnumerateKey : \n");
Index=0;
while(Status == STATUS_SUCCESS)
{
Status=NtEnumerateKey(hKey1,Index++,KeyBasicInformation
,&KeyInformation[0], sizeof(KeyInformation)
,&Length);
if(Status== STATUS_SUCCESS)
{
dprintf("\tSubKey Name = ");
for (i=0;i<KeyInformation[0].NameLength/2;i++)
dprintf("%C",KeyInformation[0].Name[i]);
dprintf("\n");
}
}
NtClose(hKey1);
}
void test1(void)
{
HKEY hKey = NULL,hKey1;
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
UNICODE_STRING KeyName = UNICODE_STRING_INITIALIZER(L"\\Registry");
ULONG Index,Length,i;
KEY_BASIC_INFORMATION KeyInformation[5];
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
dprintf("NtOpenKey \\Registry : ");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
if(Status==0)
{
dprintf("NtQueryKey : ");
Status=NtQueryKey(hKey1,KeyBasicInformation
,&KeyInformation[0], sizeof(KeyInformation)
,&Length);
dprintf("\t\t\t\t\tStatus =%x\n",Status);
if (Status == STATUS_SUCCESS)
{
dprintf("\tKey Name = ");
for (i=0;i<KeyInformation[0].NameLength/2;i++)
dprintf("%C",KeyInformation[0].Name[i]);
dprintf("\n");
}
dprintf("NtEnumerateKey : \n");
Index=0;
while(Status == STATUS_SUCCESS)
{
Status=NtEnumerateKey(hKey1,Index++,KeyBasicInformation
,&KeyInformation[0], sizeof(KeyInformation)
,&Length);
if(Status== STATUS_SUCCESS)
{
dprintf("\tSubKey Name = ");
for (i=0;i<KeyInformation[0].NameLength/2;i++)
dprintf("%C",KeyInformation[0].Name[i]);
dprintf("\n");
}
}
dprintf("NtClose : ");
Status = NtClose( hKey1 );
dprintf("\t\t\t\t\tStatus =%x\n",Status);
}
NtClose(hKey);
dprintf("NtOpenKey \\Registry\\Machine : ");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes);
dprintf("\t\t\tStatus =%x\n",Status);
dprintf("NtOpenKey System\\Setup : ");
RtlInitUnicodeStringFromLiteral(&KeyName, L"System\\Setup");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, hKey1 , NULL);
Status = NtOpenKey ( &hKey, KEY_READ , &ObjectAttributes);
dprintf("\t\t\tStatus =%x\n",Status);
if(Status==0)
{
dprintf("NtQueryValueKey : ");
RtlInitUnicodeStringFromLiteral(&KeyName, L"CmdLine");
Status=NtQueryValueKey(hKey,&KeyName,KeyValueFullInformation
,&KeyValueInformation[0], sizeof(KeyValueInformation)
,&Length);
dprintf("\t\t\t\tStatus =%x\n",Status);
if (Status == STATUS_SUCCESS)
{
dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
,KeyValueInformation[0].DataOffset
,KeyValueInformation[0].DataLength
,KeyValueInformation[0].NameLength);
for (i=0;i<10 && i<KeyValueInformation[0].NameLength/2;i++)
dprintf("%C",KeyValueInformation[0].Name[i]);
dprintf("\n");
dprintf("\t\tType = %d\n",KeyValueInformation[0].Type);
if (KeyValueInformation[0].Type == REG_SZ)
dprintf("\t\tValue = %S\n",KeyValueInformation[0].Name+1
+KeyValueInformation[0].NameLength/2);
}
dprintf("NtEnumerateValueKey : \n");
Index=0;
while(Status == STATUS_SUCCESS)
{
Status=NtEnumerateValueKey(hKey,Index++,KeyValueFullInformation
,&KeyValueInformation[0], sizeof(KeyValueInformation)
,&Length);
if(Status== STATUS_SUCCESS)
{
dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
,KeyValueInformation[0].DataOffset
,KeyValueInformation[0].DataLength
,KeyValueInformation[0].NameLength);
for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
dprintf("%C",KeyValueInformation[0].Name[i]);
dprintf(", Type = %d\n",KeyValueInformation[0].Type);
if (KeyValueInformation[0].Type == REG_SZ)
dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
+KeyValueInformation[0].DataOffset));
}
}
dprintf("NtClose : ");
Status = NtClose( hKey );
dprintf("\t\t\t\t\tStatus =%x\n",Status);
}
NtClose( hKey1 );
}
void test2(void)
{
HKEY hKey,hKey1;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName,ValueName;
NTSTATUS Status;
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
ULONG Index,Length,i;
char Buffer[10];
DWORD Result;
dprintf("NtCreateKey volatile: \n");
dprintf(" \\Registry\\Machine\\Software\\test2reactos: ");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
,0,NULL,REG_OPTION_VOLATILE,NULL);
dprintf("\t\tStatus=%x\n",Status);
NtClose(hKey);
do_enumeratekey(L"\\Registry\\Machine\\Software");
dprintf(" ...\\test2 :");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status = NtCreateKey ( &hKey1, KEY_ALL_ACCESS , &ObjectAttributes
,0,NULL,REG_OPTION_VOLATILE,NULL);
dprintf("\t\t\t\t\tStatus=%x\n",Status);
dprintf(" ...\\TestVolatile :");
RtlInitUnicodeStringFromLiteral(&KeyName, L"TestVolatile");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, hKey1, NULL);
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
,0,NULL,REG_OPTION_VOLATILE,NULL);
dprintf("\t\t\t\tStatus=%x\n",Status);
NtClose(hKey1);
RtlInitUnicodeStringFromLiteral(&ValueName, L"TestREG_SZ");
dprintf("NtSetValueKey reg_sz: ");
Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"Test Reg_sz",24);
dprintf("\t\t\t\tStatus=%x\n",Status);
RtlInitUnicodeStringFromLiteral(&ValueName, L"TestDWORD");
dprintf("NtSetValueKey reg_dword: ");
Status=NtSetValueKey(hKey,&ValueName,0,REG_DWORD,(PVOID)"reac",4);
dprintf("\t\t\tStatus=%x\n",Status);
NtClose(hKey);
dprintf("NtOpenKey \\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile : ");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status=NtOpenKey( &hKey, MAXIMUM_ALLOWED, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
if(Status==0)
{
dprintf("NtEnumerateValueKey : \n");
Index=0;
while(Status == STATUS_SUCCESS)
{
Status=NtEnumerateValueKey(hKey,Index++,KeyValueFullInformation
,&KeyValueInformation[0], sizeof(KeyValueInformation)
,&Length);
if(Status== STATUS_SUCCESS)
{
dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
,KeyValueInformation[0].DataOffset
,KeyValueInformation[0].DataLength
,KeyValueInformation[0].NameLength);
for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
dprintf("%C",KeyValueInformation[0].Name[i]);
dprintf(", Type = %d\n",KeyValueInformation[0].Type);
if (KeyValueInformation[0].Type == REG_SZ)
dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
+KeyValueInformation[0].DataOffset));
}
}
}
NtClose(hKey);
dprintf("delete \\Registry\\Machine\\software\\test2reactos ?");
ReadConsoleA(InputHandle, Buffer, 3, &Result, NULL) ;
if (Buffer[0] != 'y' && Buffer[0] != 'Y') return;
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
dprintf("NtOpenKey : ");
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
dprintf("NtDeleteKey : ");
Status=NtDeleteKey(hKey);
dprintf("\t\t\t\tStatus =%x\n",Status);
NtClose(hKey);
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
dprintf("NtOpenKey : ");
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
dprintf("NtDeleteKey : ");
Status=NtDeleteKey(hKey);
dprintf("\t\t\t\tStatus =%x\n",Status);
NtClose(hKey);
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
dprintf("NtOpenKey : ");
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
dprintf("NtDeleteKey : ");
Status=NtDeleteKey(hKey);
dprintf("\t\t\t\tStatus =%x\n",Status);
NtClose(hKey);
}
void test3(void)
{
HKEY hKey,hKey1;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName,ValueName;
NTSTATUS Status;
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
ULONG Index,Length,i;
char Buffer[10];
DWORD Result;
dprintf("NtCreateKey non volatile: \n");
dprintf(" \\Registry\\Machine\\Software\\test3reactos: ");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
,0,NULL,REG_OPTION_NON_VOLATILE,NULL);
dprintf("\t\tStatus=%x\n",Status);
NtClose(hKey);
do_enumeratekey(L"\\Registry\\Machine\\Software");
dprintf("NtOpenKey: ");
Status=NtOpenKey( &hKey, MAXIMUM_ALLOWED, &ObjectAttributes);
dprintf("\t\tStatus=%x\n",Status);
NtClose(hKey);
dprintf(" ...\\test3 :");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
,0,NULL,REG_OPTION_NON_VOLATILE,NULL);
dprintf("\t\t\t\t\tStatus=%x\n",Status);
dprintf("NtOpenKey: ");
Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes);
dprintf("\t\tStatus=%x\n",Status);
NtClose(hKey);
dprintf(" ...\\testNonVolatile :");
RtlInitUnicodeStringFromLiteral(&KeyName, L"TestNonVolatile");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, hKey1, NULL);
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
,0,NULL,REG_OPTION_NON_VOLATILE,NULL);
dprintf("\t\t\t\tStatus=%x\n",Status);
NtClose(hKey1);
RtlInitUnicodeStringFromLiteral(&ValueName, L"TestREG_SZ");
dprintf("NtSetValueKey reg_sz: ");
Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"Test Reg_sz",24);
dprintf("\t\t\t\tStatus=%x\n",Status);
RtlInitUnicodeStringFromLiteral(&ValueName, L"TestDWORD");
dprintf("NtSetValueKey reg_dword: ");
Status=NtSetValueKey(hKey,&ValueName,0,REG_DWORD,(PVOID)"reac",4);
dprintf("\t\t\tStatus=%x\n",Status);
NtClose(hKey);
dprintf("NtOpenKey \\Registry\\Machine\\Software\\test3reactos\\test3\\testNonVolatile : ");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3\\testNonVolatile");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status=NtOpenKey( &hKey, MAXIMUM_ALLOWED, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
if(Status==0)
{
dprintf("NtEnumerateValueKey : \n");
Index=0;
while(Status == STATUS_SUCCESS)
{
Status=NtEnumerateValueKey(hKey,Index++,KeyValueFullInformation
,&KeyValueInformation[0], sizeof(KeyValueInformation)
,&Length);
if(Status== STATUS_SUCCESS)
{
dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
,KeyValueInformation[0].DataOffset
,KeyValueInformation[0].DataLength
,KeyValueInformation[0].NameLength);
for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
dprintf("%C",KeyValueInformation[0].Name[i]);
dprintf(", Type = %d\n",KeyValueInformation[0].Type);
if (KeyValueInformation[0].Type == REG_SZ)
dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
+KeyValueInformation[0].DataOffset));
}
}
}
NtClose(hKey);
dprintf("delete \\Registry\\Machine\\software\\test3reactos ?");
ReadConsoleA(InputHandle, Buffer, 3, &Result, NULL) ;
if (Buffer[0] != 'y' && Buffer[0] != 'Y') return;
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3\\testNonvolatile");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
dprintf("NtOpenKey : ");
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
dprintf("NtDeleteKey : ");
Status=NtDeleteKey(hKey);
dprintf("\t\t\t\tStatus =%x\n",Status);
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
dprintf("NtOpenKey : ");
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
dprintf("NtDeleteKey : ");
Status=NtDeleteKey(hKey);
dprintf("\t\t\t\tStatus =%x\n",Status);
NtClose(hKey);
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
dprintf("NtOpenKey : ");
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
dprintf("NtDeleteKey : ");
Status=NtDeleteKey(hKey);
dprintf("\t\t\t\tStatus =%x\n",Status);
NtClose(hKey);
}
void test4(void)
{
HKEY hKey = NULL,hKey1;
DWORD dwDisposition;
DWORD dwError;
DWORD RegDataType, RegDataSize;
BOOL GlobalFifoEnable;
HKEY hPortKey;
DWORD RegDisposition;
WCHAR szClass[260];
DWORD cchClass;
DWORD cSubKeys;
DWORD cchMaxSubkey;
DWORD cchMaxClass;
DWORD cValues;
DWORD cchMaxValueName;
DWORD cbMaxValueData;
DWORD cbSecurityDescriptor;
FILETIME ftLastWriteTime;
SYSTEMTIME LastWriteTime;
dprintf ("RegOpenKeyExW HKLM\\System\\Setup: ");
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"System\\Setup",
0,
KEY_ALL_ACCESS,
&hKey1);
dprintf("\t\tdwError =%x\n",dwError);
if (dwError == ERROR_SUCCESS)
{
dprintf("RegQueryInfoKeyW: ");
cchClass=260;
dwError = RegQueryInfoKeyW(hKey1
, szClass, &cchClass, NULL, &cSubKeys
, &cchMaxSubkey, &cchMaxClass, &cValues, &cchMaxValueName
, &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime);
dprintf ("\t\t\t\tdwError %x\n", dwError);
FileTimeToSystemTime(&ftLastWriteTime,&LastWriteTime);
dprintf ("\tnb of subkeys=%d,last write : %d/%d/%d %d:%02.2d'%02.2d''%03.3d\n",cSubKeys
,LastWriteTime.wMonth
,LastWriteTime.wDay
,LastWriteTime.wYear
,LastWriteTime.wHour
,LastWriteTime.wMinute
,LastWriteTime.wSecond
,LastWriteTime.wMilliseconds
);
}
dprintf ("RegOpenKeyExW: ");
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"System\\ControlSet001\\Services\\Serial",
0,
KEY_ALL_ACCESS,
&hKey);
dprintf ("\t\t\t\t\tdwError %x\n", dwError);
RegDataSize = sizeof(GlobalFifoEnable);
if (dwError == ERROR_SUCCESS)
{
dprintf ("RegQueryValueExW: ");
dwError = RegQueryValueExW(hKey,
L"ForceFifoEnable",
NULL,
&RegDataType,
(PBYTE)&GlobalFifoEnable,
&RegDataSize);
dprintf("\t\t\t\tdwError =%x\n",dwError);
if (dwError == 0)
{
dprintf("\tValue:DT=%d, DS=%d, Value=%d\n"
,RegDataType
,RegDataSize
,GlobalFifoEnable);
}
}
dprintf ("RegCreateKeyExW: ");
dwError = RegCreateKeyExW(hKey,
L"Parameters\\Serial001",
0,
NULL,
0,
KEY_ALL_ACCESS,
NULL,
&hPortKey,
&RegDisposition
);
dprintf ("\t\t\t\tdwError %x\n", dwError);
dprintf ("RegCreateKeyExW: ");
dwError = RegCreateKeyExW (HKEY_LOCAL_MACHINE,
L"Software\\test4reactos\\test",
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hKey,
&dwDisposition);
dprintf ("\t\t\t\tdwError %x ", dwError);
dprintf ("dwDisposition %x\n", dwDisposition);
if (dwError == ERROR_SUCCESS)
{
dprintf ("RegSetValueExW: ");
dwError = RegSetValueExW (hKey,
L"TestValue",
0,
REG_SZ,
(BYTE*)L"TestString",
20);
dprintf ("\t\t\t\tdwError %x\n", dwError);
dprintf ("RegCloseKey: ");
dwError = RegCloseKey (hKey);
dprintf ("\t\t\t\t\tdwError %x\n", dwError);
}
dprintf ("\n\n");
hKey = NULL;
dprintf ("RegCreateKeyExW: ");
dwError = RegCreateKeyExW (HKEY_LOCAL_MACHINE,
L"software\\Test",
0,
NULL,
REG_OPTION_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hKey,
&dwDisposition);
dprintf ("\t\t\t\tdwError %x ", dwError);
dprintf ("dwDisposition %x\n", dwDisposition);
if (dwError == ERROR_SUCCESS)
{
dprintf("RegQueryInfoKeyW: ");
cchClass=260;
dwError = RegQueryInfoKeyW(hKey
, szClass, &cchClass, NULL, &cSubKeys
, &cchMaxSubkey, &cchMaxClass, &cValues, &cchMaxValueName
, &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime);
dprintf ("\t\t\t\tdwError %x\n", dwError);
FileTimeToSystemTime(&ftLastWriteTime,&LastWriteTime);
dprintf ("\tnb of subkeys=%d,last write : %d/%d/%d %d:%02.2d'%02.2d''%03.3d\n",cSubKeys
,LastWriteTime.wMonth
,LastWriteTime.wDay
,LastWriteTime.wYear
,LastWriteTime.wHour
,LastWriteTime.wMinute
,LastWriteTime.wSecond
,LastWriteTime.wMilliseconds
);
dprintf ("RegCloseKey: ");
dwError = RegCloseKey (hKey);
dprintf ("\t\t\t\t\tdwError %x\n", dwError);
}
dprintf ("\nTests done...\n");
}
void test5(void)
{
HKEY hKey,hKey1;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName,ValueName;
NTSTATUS Status;
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
ULONG Index,Length,i;
char Buffer[10];
DWORD Result;
dprintf("NtOpenKey : \n");
dprintf(" \\Registry\\Machine\\Software\\reactos : ");
RtlInitUnicodeStringFromLiteral(&KeyName,L"\\Registry\\Machine\\Software\\reactos");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
dprintf("\t\tStatus=%x\n",Status);
dprintf("NtFlushKey : \n");
Status = NtFlushKey(hKey);
dprintf("\t\tStatus=%x\n",Status);
dprintf("NtCloseKey : \n");
Status=NtClose(hKey);
dprintf("\t\tStatus=%x\n",Status);
}
/* registry link create test */
void test6(void)
{
HKEY hKey;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName,ValueName;
NTSTATUS Status;
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
ULONG Index,Length,i;
char Buffer[10];
DWORD Result;
dprintf("Create target key\n");
dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Reactos\n");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Reactos");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status = NtCreateKey(&hKey, KEY_ALL_ACCESS , &ObjectAttributes
,0,NULL, REG_OPTION_VOLATILE,NULL);
dprintf(" NtCreateKey() called (Status %lx)\n",Status);
if (!NT_SUCCESS(Status))
return;
dprintf("Create target value\n");
dprintf(" Value: TestValue = 'Test String'\n");
RtlInitUnicodeStringFromLiteral(&ValueName, L"TestValue");
Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"TestString",22);
dprintf(" NtSetValueKey() called (Status %lx)\n",Status);
if (!NT_SUCCESS(Status))
return;
dprintf("Close target key\n");
NtClose(hKey);
dprintf("Create link key\n");
dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE | OBJ_OPENLINK,
NULL,
NULL);
Status = NtCreateKey(&hKey,
KEY_ALL_ACCESS | KEY_CREATE_LINK,
&ObjectAttributes,
0,
NULL,
REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK,
NULL);
dprintf(" NtCreateKey() called (Status %lx)\n",Status);
if (!NT_SUCCESS(Status))
return;
dprintf("Create link value\n");
dprintf(" Value: SymbolicLinkValue = '\\Registry\\Machine\\SOFTWARE\\Reactos'\n");
RtlInitUnicodeStringFromLiteral(&ValueName, L"SymbolicLinkValue");
Status=NtSetValueKey(hKey,&ValueName,0,REG_LINK,(PVOID)L"\\Registry\\Machine\\SOFTWARE\\Reactos",68);
dprintf(" NtSetValueKey() called (Status %lx)\n",Status);
if (!NT_SUCCESS(Status))
{
dprintf("Creating link value failed! Test failed!\n");
NtClose(hKey);
return;
}
dprintf("Close link key\n");
NtClose(hKey);
dprintf("Open link key\n");
dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE | OBJ_OPENIF
, NULL, NULL);
Status = NtCreateKey(&hKey, KEY_ALL_ACCESS , &ObjectAttributes
,0,NULL, REG_OPTION_VOLATILE, NULL);
dprintf(" NtCreateKey() called (Status %lx)\n",Status);
if (!NT_SUCCESS(Status))
return;
dprintf("Query value\n");
dprintf(" Value: TestValue\n");
RtlInitUnicodeStringFromLiteral(&ValueName, L"TestValue");
Status=NtQueryValueKey(hKey,
&ValueName,
KeyValueFullInformation,
&KeyValueInformation[0],
sizeof(KeyValueInformation),
&Length);
dprintf(" NtQueryValueKey() called (Status %lx)\n",Status);
if (Status == STATUS_SUCCESS)
{
dprintf(" Value: Type %d DataLength %d NameLength %d Name '",
KeyValueInformation[0].Type,
KeyValueInformation[0].DataLength,
KeyValueInformation[0].NameLength);
for (i=0; i < KeyValueInformation[0].NameLength / sizeof(WCHAR); i++)
dprintf("%C",KeyValueInformation[0].Name[i]);
dprintf("'\n");
if (KeyValueInformation[0].Type == REG_SZ)
dprintf(" Value '%S'\n",
KeyValueInformation[0].Name+1
+KeyValueInformation[0].NameLength/2);
}
dprintf("Close link key\n");
NtClose(hKey);
dprintf("Test successful!\n");
}
/* registry link delete test */
void test7(void)
{
HKEY hKey;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName,ValueName;
NTSTATUS Status;
dprintf("Open link key\n");
dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_OPENLINK,
NULL,
NULL);
Status = NtCreateKey(&hKey,
KEY_ALL_ACCESS,
&ObjectAttributes,
0,
NULL,
REG_OPTION_VOLATILE | REG_OPTION_OPEN_LINK,
NULL);
dprintf(" NtCreateKey() called (Status %lx)\n",Status);
if (!NT_SUCCESS(Status))
{
dprintf("Could not open the link key. Please run the link create test first!\n");
return;
}
dprintf("Delete link value\n");
RtlInitUnicodeStringFromLiteral(&ValueName, L"SymbolicLinkValue");
Status = NtDeleteValueKey(hKey,
&ValueName);
dprintf(" NtDeleteValueKey() called (Status %lx)\n",Status);
dprintf("Delete link key\n");
Status=NtDeleteKey(hKey);
dprintf(" NtDeleteKey() called (Status %lx)\n",Status);
dprintf("Close link key\n");
NtClose(hKey);
}
void test8(void)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName;
NTSTATUS Status;
LONG dwError;
TOKEN_PRIVILEGES NewPrivileges;
HANDLE Token,hKey;
LUID Luid;
BOOLEAN bRes;
Status=NtOpenProcessToken(GetCurrentProcess()
,TOKEN_ADJUST_PRIVILEGES,&Token);
// ,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&Token);
dprintf("\t\t\t\tStatus =%x\n",Status);
// bRes=LookupPrivilegeValueA(NULL,SE_RESTORE_NAME,&Luid);
// dprintf("\t\t\t\tbRes =%x\n",bRes);
NewPrivileges.PrivilegeCount = 1;
NewPrivileges.Privileges[0].Luid = Luid;
// NewPrivileges.Privileges[0].Luid.u.LowPart=18;
// NewPrivileges.Privileges[0].Luid.u.HighPart=0;
NewPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Status = NtAdjustPrivilegesToken(
bRes = AdjustTokenPrivileges(
Token,
FALSE,
&NewPrivileges,
0,
NULL,
NULL
);
dprintf("\t\t\t\tbRes =%x\n",bRes);
// Status=NtClose(Token);
// dprintf("\t\t\t\tStatus =%x\n",Status);
RtlInitUnicodeStringFromLiteral(&KeyName,L"test5");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status = NtLoadKey(HKEY_LOCAL_MACHINE,&ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
dwError=RegLoadKey(HKEY_LOCAL_MACHINE,"def"
,"test5");
dprintf("\t\t\t\tdwError =%x\n",dwError);
dprintf("NtOpenKey \\Registry\\Machine : ");
RtlInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status=NtOpenKey( &hKey, MAXIMUM_ALLOWED, &ObjectAttributes);
dprintf("\t\t\tStatus =%x\n",Status);
RtlInitUnicodeStringFromLiteral(&KeyName,L"test5");
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
, NULL, NULL);
Status = NtLoadKey(hKey,&ObjectAttributes);
dprintf("\t\t\t\tStatus =%x\n",Status);
}
int main(int argc, char* argv[])
{
char Buffer[10];
DWORD Result;
AllocConsole();
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
while(1)
{
dprintf("choose test :\n");
dprintf(" 0=Exit\n");
dprintf(" 1=Ntxxx read functions\n");
dprintf(" 2=Ntxxx write functions : volatile keys\n");
dprintf(" 3=Ntxxx write functions : non volatile keys\n");
dprintf(" 4=Regxxx functions\n");
dprintf(" 5=FlushKey \n");
dprintf(" 6=Registry link create test\n");
dprintf(" 7=Registry link delete test\n");
ReadConsoleA(InputHandle, Buffer, 3, &Result, NULL) ;
switch (Buffer[0])
{
case '0':
return(0);
case '1':
test1();
break;
case '2':
test2();
break;
case '3':
test3();
break;
case '4':
test4();
break;
case '5':
test5();
break;
case '6':
test6();
break;
case '7':
test7();
break;
#if 0
case '8':
test8();
break;
#endif
}
}
return 0;
}

View File

@@ -1,19 +0,0 @@
# $Id: Makefile,v 1.3 2002/06/02 19:25:00 chorns Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = sectest
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -1,71 +0,0 @@
/* $Id: sectest.c,v 1.4 2002/09/08 10:22:01 chorns Exp $ */
#define UNICODE
#define _UNICODE
#include <windows.h>
int main(int argc, char* argv[])
{
HANDLE hFile;
HANDLE Section;
PVOID BaseAddress;
printf("Section Test\n");
hFile = CreateFile(_T("sectest.txt"),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
0,
0);
if (hFile == INVALID_HANDLE_VALUE)
{
printf("Failed to create file (err=%d)", GetLastError());
return 1;
}
Section = CreateFileMapping(hFile,
NULL,
PAGE_READWRITE,
0,
4096,
NULL);
if (Section == NULL)
{
printf("Failed to create section (err=%d)", GetLastError());
return 1;
}
printf("Mapping view of section\n");
BaseAddress = MapViewOfFile(Section,
FILE_MAP_ALL_ACCESS,
0,
0,
4096);
printf("BaseAddress %x\n", (UINT) BaseAddress);
if (BaseAddress == NULL)
{
printf("Failed to map section (%d)\n", GetLastError());
return 1;
}
printf("Clearing section\n");
FillMemory(BaseAddress, 4096, ' ');
printf("Copying test data to section\n");
strcpy(BaseAddress, "test data");
if (!UnmapViewOfFile(BaseAddress))
{
printf("Failed to unmap view of file (%d)\n", GetLastError());
return 1;
}
if (!CloseHandle(hFile))
{
printf("Failed to close file (%d)\n", GetLastError());
return 1;
}
return 0;
}

View File

@@ -1,22 +0,0 @@
#
# $Id: makefile,v 1.0
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = sertest
TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -1,113 +0,0 @@
#include <windows.h>
#include <stdio.h>
#define BUFSIZE 128
#define MAX_PORTNAME_LEN 20
#define APP_VERSION_STR "0.01"
int main(int argc, char *argv[])
{
CHAR txBuffer[BUFSIZE];
CHAR rxBuffer[BUFSIZE];
DWORD dwBaud = 9600;
DWORD dwNumWritten;
DWORD dwNumRead;
DWORD dwErrors;
DCB dcb;
BOOL bResult;
HANDLE hPort;
int i;
int nPortNum = 1;
TCHAR szPortName[MAX_PORTNAME_LEN];
if (argc > 1) {
//sscanf(argv[1], "%d", &dwBaud);
sscanf(argv[1], "%d", &nPortNum);
}
sprintf(szPortName, _T("COM%d"), nPortNum);
printf("Serial Port Test Application Version %s\n", APP_VERSION_STR);
printf("Attempting to open serial port %d - %s\n", nPortNum, szPortName);
hPort = CreateFile(szPortName,
GENERIC_READ|GENERIC_WRITE,
0, // exclusive
NULL, // sec attr
OPEN_EXISTING,
0, // no attributes
NULL); // no template
if (hPort == (HANDLE)-1) {
printf("ERROR: CreateFile() failed with result: %lx\n", hPort);
return 1;
}
printf("CreateFile() returned: %lx\n", hPort);
printf("Fiddling with DTR and RTS control lines...\n");
bResult = EscapeCommFunction(hPort, SETDTR);
if (!bResult) {
printf("WARNING: EscapeCommFunction(SETDTR) failed: %lx\n", bResult);
}
bResult = EscapeCommFunction(hPort, SETRTS);
if (!bResult) {
printf("WARNING: EscapeCommFunction(SETRTS) failed: %lx\n", bResult);
}
printf("Getting the default line characteristics...\n");
dcb.DCBlength = sizeof(DCB);
if (!GetCommState(hPort, &dcb)) {
printf("ERROR: failed to get the dcb: %d\n", GetLastError());
return 2;
}
printf("Setting the line characteristics to 9600,8,N,1\n");
dcb.BaudRate = dwBaud;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
bResult = SetCommState(hPort, &dcb);
if (!bResult) {
printf("ERROR: failed to set the comm state: %lx\n", bResult);
return 3;
}
printf("INFO: preparing the transmit buffer: %lx\n", bResult);
for (i = 0; i < BUFSIZE; i++) {
txBuffer[i] = (CHAR)i;
}
for (i = 0; i < BUFSIZE; i++) {
printf(" %d ", txBuffer[i]);
}
for (i = 0; i < BUFSIZE; i++) {
rxBuffer[i] = 0xFF;
}
printf("\n");
printf("Writting transmit buffer to the serial port\n");
bResult = WriteFile(hPort, txBuffer, BUFSIZE, &dwNumWritten, NULL);
if (!bResult) {
printf("ERROR: failed to write to the serial port: %lx\n", bResult);
return 4;
}
printf("WriteFile() returned: %lx, byteswritten: %lx\n", bResult, dwNumWritten);
#if 0
printf("Attempting to read %d bytes from the serial port\n", BUFSIZE);
bResult = ReadFile(hPort, rxBuffer, BUFSIZE, &dwNumRead, NULL);
if (!bResult) {
printf("ERROR: failed to read from the serial port: %lx\n", bResult);
return 5;
}
printf("ReadFile() returned: %lx, bytesread: %lx\n", bResult, dwNumRead);
for (i = 0; i < BUFSIZE; i++) {
printf(" %d ",rxBuffer[i]);
}
#endif
printf("Attempting to close the serial port\n");
bResult = ClearCommError(hPort, &dwErrors, NULL);
printf("ClearCommError returned: %lx, dwErrors: %lx\n", bResult, dwErrors);
bResult = CloseHandle(hPort);
if (!bResult) {
printf("ERROR: failed to close the serial port: %lx\n", bResult);
return 6;
}
printf("Finished\n");
return 0;
}

View File

@@ -1,47 +0,0 @@
#
#
#
PATH_TO_TOP = ../../..
include $(PATH_TO_TOP)/rules.mak
SRV_OBJECTS= shmsrv.o
CLT_OBJECTS= shmclt.o
PROGS= shmsrv.exe shmclt.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/$*
shmsrv.exe: $(SRV_OBJECTS) $(LIBS)
$(CC) $(SRV_OBJECTS) $(LIBS) -o shmsrv.exe
$(NM) --numeric-sort shmsrv.exe > shmsrv.sym
shmclt.exe: $(CLT_OBJECTS) $(LIBS)
$(CC) $(CLT_OBJECTS) $(LIBS) -o shmclt.exe
$(NM) --numeric-sort shmsrv.exe > shmclt.sym
# EOF

View File

@@ -1,61 +0,0 @@
#include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
HANDLE OutputHandle;
HANDLE InputHandle;
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
va_end(args);
}
int
main(int argc, char* argv[])
{
HANDLE Section;
PVOID BaseAddress;
char buffer[256];
printf("Shm test server\n");
Section = OpenFileMappingW (
// PAGE_EXECUTE_READWRITE, invalid parameter
FILE_MAP_WRITE,
FALSE,
L"TestSection"
);
if (Section == NULL)
{
printf("Failed to open section (err=%d)", GetLastError());
return 1;
}
BaseAddress = MapViewOfFile(Section,
FILE_MAP_ALL_ACCESS,
0,
0,
8192);
if (BaseAddress == NULL)
{
printf("Failed to map section (err=%d)\n", GetLastError());
return 1;
}
printf("BaseAddress %x\n", (UINT) BaseAddress);
printf("Copying from section\n");
strcpy(buffer, BaseAddress);
printf("Copyed <%s>\n", buffer);
// for(;;);
return 0;
}

View File

@@ -1,53 +0,0 @@
/* $Id: shmsrv.c,v 1.5 2000/06/29 23:35:10 dwelch Exp $
*
* FILE : reactos/apps/shm/shmsrv.c
* AUTHOR: David Welch
*/
#include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
HANDLE Section;
PVOID BaseAddress;
printf("Shm test server\n");
Section = CreateFileMappingW (
(HANDLE) 0xFFFFFFFF,
NULL,
PAGE_READWRITE,
0,
8192,
L"TestSection"
);
if (Section == NULL)
{
printf("Failed to create section (err=%d)", GetLastError());
return 1;
}
printf("Mapping view of section\n");
BaseAddress = MapViewOfFile(Section,
FILE_MAP_ALL_ACCESS,
0,
0,
8192);
printf("BaseAddress %x\n", (UINT) BaseAddress);
if (BaseAddress == NULL)
{
printf("Failed to map section\n");
}
printf("Copying to section\n");
printf("Copying %s\n", GetCommandLineA());
strcpy(BaseAddress, GetCommandLineA());
Sleep(INFINITE);
return 0;
}

View File

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

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

View File

@@ -1,66 +0,0 @@
# 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=stretchblt.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= \
stretchblt.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

@@ -1,258 +0,0 @@
// ------------------------------------------------------------------
// Windows 2000 Graphics API Black Book
// Chapter 1 - Listing 1.5 (StretchBlt Zooming 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>
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
HWND HListBox = NULL;
const int ID_LISTBOX = 101;
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("StretchBlt Zooming Demo"),
WS_OVERLAPPEDWINDOW | WS_CAPTION |
WS_VISIBLE | WS_CLIPSIBLINGS,
0, 0, 675, 560,
NULL, NULL, HInst, NULL);
if (HWnd)
{
HListBox =
CreateWindowEx(WS_EX_CLIENTEDGE, "LISTBOX", "",
LBS_NOTIFY | WS_CHILD | WS_VISIBLE,
530, 5, 130, 150, HWnd,
reinterpret_cast<HMENU>(ID_LISTBOX),
HInst, NULL);
if (HListBox)
{
SNDMSG(HListBox, LB_ADDSTRING, 0,
reinterpret_cast<LPARAM>("Zoom 25%"));
SNDMSG(HListBox, LB_ADDSTRING, 0,
reinterpret_cast<LPARAM>("Zoom 50%"));
SNDMSG(HListBox, LB_ADDSTRING, 0,
reinterpret_cast<LPARAM>("Zoom 75%"));
SNDMSG(HListBox, LB_ADDSTRING, 0,
reinterpret_cast<LPARAM>("Zoom 100%"));
SNDMSG(HListBox, LB_ADDSTRING, 0,
reinterpret_cast<LPARAM>("Zoom 125%"));
SNDMSG(HListBox, LB_ADDSTRING, 0,
reinterpret_cast<LPARAM>("Zoom 150%"));
SNDMSG(HListBox, LB_ADDSTRING, 0,
reinterpret_cast<LPARAM>("Zoom 200%"));
SNDMSG(HListBox, LB_ADDSTRING, 0,
reinterpret_cast<LPARAM>("Zoom 300%"));
}
ShowWindow(HWnd, nCmdShow);
UpdateWindow(HWnd);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
return 0;
}
//------------------------------------------------------------------
// image related
BITMAP bmp;
const char* filename = "LENA.BMP";
HDC HMemDC = NULL;
HBITMAP HOldBmp = NULL;
// zooming related
float zoom_factor = 0.5;
RECT RDest = {5, 5, 0, 0};
enum {ID_ZOOM25, ID_ZOOM50, ID_ZOOM75, ID_ZOOM100,
ID_ZOOM125, ID_ZOOM150, ID_ZOOM200, ID_ZOOM300};
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_COMMAND:
{
if (WParam == MAKEWPARAM(ID_LISTBOX, LBN_SELCHANGE))
{
switch (SNDMSG(HListBox, LB_GETCURSEL, 0, 0))
{
case ID_ZOOM25: zoom_factor = 0.25; break;
case ID_ZOOM50: zoom_factor = 0.50; break;
case ID_ZOOM75: zoom_factor = 0.75; break;
case ID_ZOOM100: zoom_factor = 1.00; break;
case ID_ZOOM125: zoom_factor = 1.25; break;
case ID_ZOOM150: zoom_factor = 1.50; break;
case ID_ZOOM200: zoom_factor = 2.00; break;
case ID_ZOOM300: zoom_factor = 3.00; break;
}
// calculate the new width and height
const int new_width =
static_cast<int>(zoom_factor * bmp.bmWidth);
const int new_height =
static_cast<int>(zoom_factor * bmp.bmHeight);
// is zooming in?
bool zoom_in = (new_width > RDest.right - RDest.left);
// caculate the area that needs to be updated
RECT RUpdate = {
RDest.left, RDest.top,
RDest.left + max(new_width, RDest.right - RDest.left),
RDest.top + max(new_height, RDest.bottom - RDest.top)
};
// adjust the dimenstions of the
// destination rectangle
RDest.right = RDest.left + new_width;
RDest.bottom = RDest.top + new_height;
// create an update region from the XOR combination
// of the update and destination rectangles
HRGN HUpdateRgn = CreateRectRgnIndirect(&RUpdate);
HRGN HDestRgn = CreateRectRgnIndirect(&RDest);
int result =
CombineRgn(HUpdateRgn, HUpdateRgn, HDestRgn, RGN_XOR);
// incite a repaint
if (result != NULLREGION && result != ERROR)
{
InvalidateRgn(HWnd, HUpdateRgn, true);
RedrawWindow(HWnd, &RDest, NULL, RDW_NOERASE | RDW_INVALIDATE);
}
else if (result == NULLREGION)
{
InvalidateRect(HWnd, &RUpdate, zoom_in ? false : true);
}
// clean up
DeleteObject(HUpdateRgn);
DeleteObject(HDestRgn);
}
break;
}
case WM_PAINT:
{
PAINTSTRUCT ps;
const HDC Hdc = BeginPaint(HWnd, &ps);
try
{
//
// TODO: add palette support (see Chapter 9)...
//
if (RDest.right - RDest.left > 0)
{
// use BitBlt when not zooming
if (zoom_factor == 1.0)
{
BitBlt(Hdc, RDest.left, RDest.top,
RDest.right - RDest.left,
RDest.bottom - RDest.top,
HMemDC, 0, 0,
SRCCOPY);
}
else
{
if (zoom_factor < 1.0)
{
SetStretchBltMode(Hdc, COLORONCOLOR);
}
// render the zoomed image
StretchBlt(Hdc, RDest.left, RDest.top,
RDest.right - RDest.left,
RDest.bottom - RDest.top,
HMemDC, 0, 0,
bmp.bmWidth, bmp.bmHeight,
SRCCOPY);
}
}
}
catch (...)
{
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);
}
//------------------------------------------------------------------

View File

@@ -1,21 +0,0 @@
# $Id: makefile,v 1.1 2002/06/17 06:01:17 sedwards Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = tcpsvr
TARGET_SDKLIBS = kernel32.a ws2_32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -1,173 +0,0 @@
/* tcpServer.c
*
* Simple Winsock TCP server test.
* Later will be used as base for ReactOS telnetd
*
* HISTORY:
* 6-15-02 - Added Winsock support to UNIX tcp test
* 6-16-02 - Removed Unix support
* 6-17-02 - Added extra comments to code
*
*/
#include <winsock2.h>
#include <stdio.h>
#undef ERROR
#define SUCCESS 0
#define ERROR 1
#define END_LINE 0x0A
#define SERVER_PORT 23
#define MAX_MSG 100
/* function readline */
int read_line();
int main (int argc, char *argv[]) {
WORD wVersionRequested;
WSADATA WsaData;
INT Status;
int sd, newSd, cliLen;
struct sockaddr_in cliAddr, servAddr;
char line[MAX_MSG];
wVersionRequested = MAKEWORD(2, 2);
Status = WSAStartup(wVersionRequested, &WsaData);
if (Status != 0) {
printf("Could not initialize winsock dll.\n");
return FALSE;
}
/* create socket */
sd = socket(AF_INET, SOCK_STREAM, 0);
if(sd<0) {
perror("cannot open socket ");
WSACleanup();
return ERROR;
}
/* bind server port */
servAddr.sin_family = AF_INET;
servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
servAddr.sin_port = htons(SERVER_PORT);
if(bind(sd, (struct sockaddr *) &servAddr, sizeof(servAddr))<0) {
perror("cannot bind port ");
WSACleanup();
return ERROR;
}
listen(sd,5);
while(1) {
printf("%s: \n
To start test, Please telnet to localhost (127.0.0.1) port 23 \n
When connected input raw data followed by End of Line\n
Test is now running on TCP port %u\n",argv[0],SERVER_PORT);
cliLen = sizeof(cliAddr);
newSd = accept(sd, (struct sockaddr *) &cliAddr, &cliLen);
if(newSd<0) {
perror("cannot accept connection ");
WSACleanup();
return ERROR;
}
/* init line */
memset(line,0x0,MAX_MSG);
/* receive segments */
while(read_line(newSd,line)!=ERROR) {
printf("%s: received from %s:TCP%d : %s\n", argv[0],
inet_ntoa(cliAddr.sin_addr),
ntohs(cliAddr.sin_port), line);
/* init line */
memset(line,0x0,MAX_MSG);
} /* while(read_line) */
} /* while (1) */
}
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
/* this function is experimental.. I don't know yet if it works */
/* correctly or not. Use Steven's readline() function to have */
/* something robust. */
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
/* rcv_line is my function readline(). Data is read from the socket when */
/* needed, but not byte after bytes. All the received data is read. */
/* This means only one call to recv(), instead of one call for */
/* each received byte. */
/* You can set END_CHAR to whatever means endofline for you. (0x0A is \n)*/
/* read_lin returns the number of bytes returned in line_to_return */
int read_line(int newSd, char *line_to_return) {
static int rcv_ptr=0;
static char rcv_msg[MAX_MSG];
static int n;
int offset;
offset=0;
while(1) {
if(rcv_ptr==0) {
/* read data from socket */
memset(rcv_msg,0x0,MAX_MSG); /* init buffer */
n = recv(newSd, rcv_msg, MAX_MSG, 0); /* wait for data */
if (n<0) {
perror(" cannot receive data ");
return ERROR;
} else if (n==0) {
printf(" connection closed by client\n");
close(newSd);
WSACleanup();
return ERROR;
}
}
/* if new data read on socket */
/* OR */
/* if another line is still in buffer */
/* copy line into 'line_to_return' */
while(*(rcv_msg+rcv_ptr)!=END_LINE && rcv_ptr<n) {
memcpy(line_to_return+offset,rcv_msg+rcv_ptr,1);
offset++;
rcv_ptr++;
}
/* end of line + end of buffer => return line */
if(rcv_ptr==n-1) {
/* set last byte to END_LINE */
*(line_to_return+offset)=END_LINE;
rcv_ptr=0;
return ++offset;
}
/* end of line but still some data in buffer => return line */
if(rcv_ptr <n-1) {
/* set last byte to END_LINE */
*(line_to_return+offset)=END_LINE;
rcv_ptr++;
return ++offset;
}
/* end of buffer but line is not ended => */
/* wait for more data to arrive on socket */
if(rcv_ptr == n) {
rcv_ptr = 0;
}
} /* while */
}

View File

@@ -1,11 +0,0 @@
#include <stdio.h>
int
main (void)
{
int i;
puts ("This should print \"wow = I\" for I from 0 to 39 inclusive.");
for (i = 0; i < 40; i++)
printf ("%s = %d\n", "wow", i);
return 0;
}

View File

@@ -1,53 +0,0 @@
#include <stdio.h>
#include <string.h>
int
main (void)
{
FILE *f;
int i;
const char filename[] = "/tmp/bug3.test";
f = fopen(filename, "w+");
for (i=0; i<9000; i++)
putc ('x', f);
fseek (f, 8180L, 0);
fwrite ("Where does this text go?", 1, 24, f);
fflush (f);
rewind (f);
for (i=0; i<9000; i++)
{
int j;
if ((j = getc(f)) != 'x')
{
if (i != 8180)
{
printf ("Test FAILED!");
return 1;
}
else
{
char buf[25];
buf[0] = j;
fread (buf + 1, 1, 23, f);
buf[24] = '\0';
if (strcmp (buf, "Where does this text go?") != 0)
{
printf ("%s\nTest FAILED!\n", buf);
return 1;
}
i += 23;
}
}
}
fclose(f);
remove(filename);
puts ("Test succeeded.");
return 0;
}

View File

@@ -1,73 +0,0 @@
#
#
#
PATH_TO_TOP = ../..
PROGS= test-stdio tst-printf tstdiomisc bug2 bug3 \
temptest test-fseek test_rdwr testfsd time_t
all: $(PROGS:%=%.exe)
.phony: all
implib:
clean:
- $(RM) *.o *.exe *.sym
.phony: implib clean
install: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
dist: $(PROGS:%=$(DIST_DIR)/apps/%.exe)
$(PROGS:%=$(DIST_DIR)/apps/%.exe): $(DIST_DIR)/apps/%.exe: %.exe
$(CP) $*.exe $(DIST_DIR)/apps/$*.exe
bug2.exe: bug2.c
$(CC) bug2.c -lkernel32 -o bug2.exe
$(NM) --numeric-sort bug2.exe > bug2.sym
bug3.exe: bug3.c
$(CC) bug3.c -lkernel32 -o bug3.exe
$(NM) --numeric-sort bug3.exe > bug3.sym
temptest.exe: temptest.c
$(CC) temptest.c -lkernel32 -o temptest.exe
$(NM) --numeric-sort temptest.exe > temptest.sym
test-fseek.exe: test-fseek.c
$(CC) test-fseek.c -lkernel32 -o test-fseek.exe
$(NM) --numeric-sort test-fseek.exe > test-fseek.sym
test-fwrite.exe: test-fwrite.c
$(CC) test-fwrite.c -lkernel32 -o test-fwrite.exe
$(NM) --numeric-sort test-fwrite.exe > test-fwrite.sym
test_rdwr.exe: test_rdwr.c
$(CC) test_rdwr.c -lkernel32 -o test_rdwr.exe
$(NM) --numeric-sort test_rdwr.exe > test_rdwr.sym
test-stdio.exe: test-stdio.c
$(CC) test-stdio.c -lkernel32 -o test-stdio.exe
$(NM) --numeric-sort test-stdio.exe > test-stdio.sym
tst-printf.exe: tst-printf.c
$(CC) tst-printf.c -lkernel32 -o tst-printf.exe
$(NM) --numeric-sort tst-printf.exe > tst-printf.sym
tstdiomisc.exe: tstdiomisc.c
$(CC) tstdiomisc.c -lkernel32 -o tstdiomisc.exe
$(NM) --numeric-sort tstdiomisc.exe > tstdiomisc.sym
testfsd.exe: testfsd.c testsuite.c
$(CC) testfsd.c testsuite.c -lkernel32 -o testfsd.exe
$(NM) --numeric-sort testfsd.exe > testfsd.sym
time_t.exe: time_t.c
$(CC) time_t.c -lkernel32 -o time_t.exe
$(NM) --numeric-sort time_t.exe > time_t.sym
include ../../rules.mak

View File

@@ -1,27 +0,0 @@
#include <stdio.h>
#include <string.h>
char *files[500];
int
main (int argc, char *argv[])
{
FILE *fp;
int i;
for (i = 0; i < 500; i++) {
files[i] = tempnam (NULL, "file");
if (files[i] == NULL) {
printf ("tempnam failed\n");
exit (1);
}
printf ("file: %s\n", files[i]);
fp = fopen (files[i], "w");
fclose (fp);
}
for (i = 0; i < 500; i++)
remove (files[i]);
exit (0);
}

View File

@@ -1,85 +0,0 @@
/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#define TESTFILE "/tmp/test.dat"
int
main (void)
{
FILE *fp;
int i, j;
puts ("\nFile seek test");
fp = fopen (TESTFILE, "w");
if (fp == NULL)
{
perror (TESTFILE);
return 1;
}
for (i = 0; i < 256; i++)
putc (i, fp);
if (freopen (TESTFILE, "r", fp) != fp)
{
perror ("Cannot open file for reading");
return 1;
}
for (i = 1; i <= 255; i++)
{
printf ("%3d\n", i);
fseek (fp, (long) -i, SEEK_END);
if ((j = getc (fp)) != 256 - i)
{
printf ("SEEK_END failed %d\n", j);
break;
}
if (fseek (fp, (long) i, SEEK_SET))
{
puts ("Cannot SEEK_SET");
break;
}
if ((j = getc (fp)) != i)
{
printf ("SEEK_SET failed %d\n", j);
break;
}
if (fseek (fp, (long) i, SEEK_SET))
{
puts ("Cannot SEEK_SET");
break;
}
if (fseek (fp, (long) (i >= 128 ? -128 : 128), SEEK_CUR))
{
puts ("Cannot SEEK_CUR");
break;
}
if ((j = getc (fp)) != (i >= 128 ? i - 128 : i + 128))
{
printf ("SEEK_CUR failed %d\n", j);
break;
}
}
fclose (fp);
remove (TESTFILE);
puts ((i > 255) ? "Test succeeded." : "Test FAILED!");
return (i > 255) ? 0 : 1;
}

View File

@@ -1,68 +0,0 @@
#include <stdio.h>
#include <string.h>
int
main (int argc, char *argv[])
{
FILE *f = tmpfile ();
char obuf[99999], ibuf[sizeof obuf];
char *line;
size_t linesz;
if (! f)
{
perror ("tmpfile");
return 1;
}
if (fputs ("line\n", f) == EOF)
{
perror ("fputs");
return 1;
}
memset (obuf, 'z', sizeof obuf);
memset (ibuf, 'y', sizeof ibuf);
if (fwrite (obuf, sizeof obuf, 1, f) != 1)
{
perror ("fwrite");
return 1;
}
rewind (f);
line = NULL;
linesz = 0;
if (getline (&line, &linesz, f) != 5)
{
perror ("getline");
return 1;
}
if (strcmp (line, "line\n"))
{
puts ("Lines differ. Test FAILED!");
return 1;
}
if (fread (ibuf, sizeof ibuf, 1, f) != 1)
{
perror ("fread");
return 1;
}
if (memcmp (ibuf, obuf, sizeof ibuf))
{
puts ("Buffers differ. Test FAILED!");
return 1;
}
asprintf (&line, "\
GDB is free software and you are welcome to distribute copies of it\n\
under certain conditions; type \"show copying\" to see the conditions.\n\
There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
");
puts ("Test succeeded.");
return 0;
}

View File

@@ -1,55 +0,0 @@
#include <stdio.h>
#include <string.h>
int main()
{
char msg1[] = "testing _write\n";
char msg2[] = "testing putchar.";
char msg3[] = "testing printf.";
char tmpbuf[255];
FILE* f1;
write(1, msg1, strlen(msg1));
write(1, msg2, strlen(msg2));
putchar('o'); putchar('k'); putchar('\n');
write(1, msg3, strlen(msg3));
printf("ok\n");
printf("Testing fopen\n");
f1 = fopen("tmp.txt","w+b");
if (f1 == NULL)
{
printf("fopen failed\n");
return(1);
}
printf("Testing fwrite\n");
if (fwrite(msg1, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
{
printf("fwrite failed\n");
return(1);
}
printf("Testing fread\n");
fseek(f1, 0, SEEK_SET);
if (fread(tmpbuf, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
{
printf("fread failed\n");
return(1);
}
if (strcmp(tmpbuf,msg1) != 0)
{
printf("fread failed, data corrupt\n");
return(1);
}
printf("Testing fclose\n");
if (fclose(f1) != 0)
{
printf("fclose failed\n");
return(1);
}
return(0);
}

View File

@@ -1,129 +0,0 @@
/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main (int argc, char **argv)
{
static const char hello[] = "Hello, world.\n";
static const char replace[] = "Hewwo, world.\n";
static const size_t replace_from = 2, replace_to = 4;
char filename[FILENAME_MAX];
char *name = strrchr (*argv, '/');
char buf[BUFSIZ];
FILE *f;
int lose = 0;
if (name != NULL)
++name;
else
name = *argv;
(void) sprintf (filename, "/tmp/%s.test", name);
f = fopen (filename, "w+");
if (f == NULL)
{
perror (filename);
exit (1);
}
(void) fputs (hello, f);
rewind (f);
(void) fgets (buf, sizeof (buf), f);
rewind (f);
(void) fputs (buf, f);
rewind (f);
{
size_t i;
for (i = 0; i < replace_from; ++i)
{
int c = getc (f);
if (c == EOF)
{
printf ("EOF at %Zu.\n", i);
lose = 1;
break;
}
else if (c != hello[i])
{
printf ("Got '%c' instead of '%c' at %Zu.\n",
(unsigned char) c, hello[i], i);
lose = 1;
break;
}
}
}
{
long int where = ftell (f);
if (where == (long int) replace_from)
{
register size_t i;
for (i = replace_from; i < replace_to; ++i)
if (putc(replace[i], f) == EOF)
{
printf ("putc('%c') got %s at %Zu.\n",
replace[i], strerror (errno), i);
lose = 1;
break;
}
}
else if (where == -1L)
{
printf ("ftell got %s (should be at %Zu).\n",
strerror (errno), replace_from);
lose = 1;
}
else
{
printf ("ftell returns %lu; should be %Zu.\n", where, replace_from);
lose = 1;
}
}
if (!lose)
{
rewind (f);
if (fgets (buf, sizeof (buf), f) == NULL)
{
printf ("fgets got %s.\n", strerror(errno));
lose = 1;
}
else if (strcmp (buf, replace))
{
printf ("Read \"%s\" instead of \"%s\".\n", buf, replace);
lose = 1;
}
}
if (lose)
printf ("Test FAILED! Losing file is \"%s\".\n", filename);
else
{
(void) remove (filename);
puts ("Test succeeded.");
}
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
}

View File

@@ -1,315 +0,0 @@
/* $Id: testfsd.c,v 1.4 2001/07/04 03:07:54 rex Exp $
*
* FILE: testFSD.c
* PURPOSE: A test set for the File System Driver
* PROJECT: ReactOS kernel
* COPYRIGHT: See COPYING in the top level directory
* PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com)
*
*/
#include <errno.h>
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include "testsuite.h"
const char *rootDir = "c:\\";
const char *systemRootDir = "c:\\ReactOS";
const char *systemDllDir = "c:\\ReactOS\\System32";
const char *bogusRootFile = "c:\\bogus";
const char *bogusDirAndFile = "c:\\bogus\\bogus";
const char *bogusSystemRootFile = "c:\\ReactOS\\bogus";
const char *bogusSystemDllFile = "c:\\ReactOS\\System32\\bogus";
const char *shortFile = "c:\\ReactOS\\boot.bat";
const char *longFile = "c:\\ReactOS\\loadros.com";
void testOpenExistant (void)
{
HANDLE fileHandle;
fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile (systemRootDir, GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile (systemDllDir, GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
}
void testOpenNonExistant (void)
{
DWORD status;
HANDLE fileHandle;
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
status = GetLastError ();
ASSERT (status == ERROR_FILE_NOT_FOUND);
CloseHandle (fileHandle);
fileHandle = CreateFile (bogusDirAndFile, GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
status = GetLastError ();
ASSERT (status == ERROR_PATH_NOT_FOUND);
CloseHandle (fileHandle);
fileHandle = CreateFile (bogusSystemRootFile, GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
status = GetLastError ();
ASSERT (status == ERROR_FILE_NOT_FOUND);
CloseHandle (fileHandle);
fileHandle = CreateFile (bogusSystemDllFile, GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
status = GetLastError ();
ASSERT (status == ERROR_FILE_NOT_FOUND);
CloseHandle (fileHandle);
}
void testCreateExistant (void)
{
DWORD status;
HANDLE fileHandle;
fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
status = GetLastError ();
ASSERT (status == ERROR_ALREADY_EXISTS);
fileHandle = CreateFile (systemRootDir, GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
status = GetLastError ();
ASSERT (status == ERROR_ALREADY_EXISTS);
fileHandle = CreateFile (systemDllDir, GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
status = GetLastError ();
ASSERT (status == ERROR_ALREADY_EXISTS);
}
void testCreateNonExistant (void)
{
DWORD status;
HANDLE fileHandle;
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile (bogusSystemRootFile, GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile (bogusSystemDllFile, GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
#if 0
fileHandle = CreateFile (bogusDirAndFile, GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
status = GetLastError ();
ASSERT (status == ERROR_PATH_NOT_FOUND);
CloseHandle (fileHandle);
#endif
}
void testDeleteFiles (void)
{
BOOL returnValue;
HANDLE fileHandle;
fileHandle = CreateFile ("bogus", GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
returnValue = DeleteFile ("bogus");
ASSERT_MSG (returnValue,
"Delete of bogus failed, error:%d",
GetLastError ());
#if 0
returnValue = DeleteFile (bogusRootFile);
ASSERT_MSG (returnValue,
"Delete of %s failed, error:%d",
bogusRootFile,
GetLastError ());
returnValue = DeleteFile (bogusRootFile);
ASSERT_MSG (!returnValue,
"2nd Delete of %s succeeded but should fail",
bogusRootFile);
returnValue = DeleteFile (bogusSystemRootFile);
ASSERT_MSG (returnValue,
"Delete of %s failed, error:%d",
bogusSystemRootFile,
GetLastError ());
returnValue = DeleteFile (bogusSystemRootFile);
ASSERT_MSG (!returnValue,
"2nd Delete of %s succeeded but should fail",
bogusSystemRootFile);
returnValue = DeleteFile (bogusSystemDllFile);
ASSERT_MSG (returnValue,
"Delete of %s failed, error:%d",
bogusSystemDllFile,
GetLastError ());
returnValue = DeleteFile (bogusSystemDllFile);
ASSERT_MSG (!returnValue,
"2nd Delete of %s succeeded but should fail",
bogusSystemDllFile);
returnValue = DeleteFile (bogusDirAndFile);
ASSERT_MSG (!returnValue,
"Delete of %s succeded but should fail",
bogusDirAndFile);
#endif
}
void testOpenWithBlankPathElements (void)
{
HANDLE fileHandle;
fileHandle = CreateFile ("c:", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile ("c:\\\\", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile ("c:\\\\reactos\\", GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile ("c:\\reactos\\\\", GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile ("c:\\reactos\\\\system32\\", GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile ("c:\\reactos\\system32\\\\", GENERIC_READ, 0, 0,
OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
}
void testReadOnInvalidHandle (void)
{
BOOL returnValue;
char buffer [256];
DWORD bytesRead;
returnValue = ReadFile (INVALID_HANDLE_VALUE,
buffer,
256,
&bytesRead,
NULL);
ASSERT_MSG (!returnValue,
"Read from invalid handle succeeded but should fail",0);
ASSERT (GetLastError () != ENOFILE);
}
void testReadOnZeroLengthFile (void)
{
BOOL returnValue;
HANDLE fileHandle;
char buffer [256];
DWORD bytesRead;
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
CREATE_NEW, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
CloseHandle (fileHandle);
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
returnValue = ReadFile (fileHandle, buffer, 256, &bytesRead, NULL);
ASSERT_MSG (!returnValue,
"Read from zero length file succeeded but should fail",0);
ASSERT (GetLastError () != ERROR_HANDLE_EOF);
CloseHandle (fileHandle);
returnValue = DeleteFile (bogusRootFile);
ASSERT_MSG (returnValue,
"Delete of %s failed, error:%d",
bogusRootFile,
GetLastError ());
}
void testReadOnShortFile (void)
{
BOOL returnValue;
HANDLE fileHandle;
char buffer [256];
DWORD bytesRead;
fileHandle = CreateFile (shortFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
returnValue = ReadFile (fileHandle,
buffer,
256,
&bytesRead,
NULL);
ASSERT_MSG (returnValue,
"Read from short length file failed, error:%d",
GetLastError ());
ASSERT (bytesRead > 0 && bytesRead < 256);
CloseHandle (fileHandle);
}
void testReadOnLongFile (void)
{
BOOL returnValue;
HANDLE fileHandle;
char buffer [256];
DWORD bytesRead;
int count;
fileHandle = CreateFile (longFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
for (count = 0; count < 20; count++)
{
returnValue = ReadFile (fileHandle,
buffer,
256,
&bytesRead,
NULL);
ASSERT_MSG (returnValue,
"Read from short length file failed, error:%d",
GetLastError ());
ASSERT (bytesRead == 256);
}
CloseHandle (fileHandle);
}
int main (void)
{
TEST_RUNNER testRunner;
TEST_SUITE testsToRun [] =
{
ADD_TEST (testOpenExistant),
ADD_TEST (testOpenNonExistant),
ADD_TEST (testCreateExistant),
ADD_TEST (testCreateNonExistant),
ADD_TEST (testDeleteFiles),
/* ADD_TEST (testOverwriteExistant),*/
/* ADD_TEST (testOverwriteNonExistant),*/
ADD_TEST (testOpenWithBlankPathElements),
ADD_TEST (testReadOnInvalidHandle),
ADD_TEST (testReadOnZeroLengthFile),
ADD_TEST (testReadOnShortFile),
ADD_TEST (testReadOnLongFile),
/* ADD_TEST (test), */
END_TESTS
};
memset (&testRunner, 0, sizeof (TEST_RUNNER));
tsRunTests (&testRunner, testsToRun);
tsReportResults (&testRunner);
}

View File

@@ -1,65 +0,0 @@
#include <windows.h>
#include <stdio.h>
#include "testsuite.h"
static PTEST_RUNNER iTestRunner = 0;
void tsRunTests (PTEST_RUNNER pTestRunner, PTEST_SUITE pTests)
{
int testIndex;
iTestRunner = pTestRunner;
for (testIndex = 0; pTests [testIndex].testFunc != 0; testIndex++)
{
pTests [testIndex].testFunc ();
pTestRunner->tests++;
}
}
void tsReportResults (PTEST_RUNNER pTestRunner)
{
printf ("\nTotal of %d tests.\n"
"Assertions: %d\n"
" Assertions which passed: %d\n"
" Assertions which failed: %d\n",
pTestRunner->tests,
pTestRunner->assertions,
pTestRunner->successes,
pTestRunner->failures);
if (pTestRunner->failures == 0)
{
printf ("\n*** OK ***\n");
}
else
{
printf ("\n*** FAIL ***\n");
}
}
void tsDoAssertion (BOOL pTest,
PCHAR pTestText,
PCHAR pFunction,
int pLine,
...)
{
va_list ap;
iTestRunner->assertions++;
if (!pTest)
{
va_start (ap, pLine);
printf ("%s(%d): ", pFunction, pLine);
vprintf (pTestText, ap);
printf ("\n");
va_end(ap);
iTestRunner->failures++;
}
else
{
iTestRunner->successes++;
}
}

View File

@@ -1,44 +0,0 @@
#ifndef H_TESTSUITE_H
#define H_TESTSUITE_H
struct TestSuite
{
char *name;
void (*testFunc)(void);
};
typedef struct TestSuite TEST_SUITE, *PTEST_SUITE;
#define ADD_TEST(x) {#x, x}
#define END_TESTS {0, 0}
#define COUNT_TESTS(x) (sizeof x/sizeof (struct TestSuite))
struct TestRunner
{
int tests;
int assertions;
int failures;
int successes;
};
typedef struct TestRunner TEST_RUNNER, *PTEST_RUNNER;
void tsDoAssertion (BOOL pTest,
PCHAR pTestText,
PCHAR pFunction,
int pLine,
...);
#ifdef ASSERT
#undef ASSERT
#endif
#define ASSERT(x) tsDoAssertion (x, "assertion \"" ## #x ## "\" failed", __FUNCTION__, __LINE__)
#define ASSERT_MSG(x,y,a...) tsDoAssertion (x, y, __FUNCTION__, __LINE__,a)
void tsRunTests (PTEST_RUNNER pTestRunner, PTEST_SUITE pTests);
void tsReportResults (PTEST_RUNNER pTestRunner);
#endif

View File

@@ -1,12 +0,0 @@
#include <stdio.h>
#include <time.h>
int main(void)
{
struct tm *ptr;
time_t lt;
lt = time(NULL);
ptr = localtime(&lt);
printf(asctime(ptr));
}

View File

@@ -1,311 +0,0 @@
/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef BSD
#include </usr/include/stdio.h>
#define EXIT_SUCCESS 0
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
#include <float.h>
void rfg1 (void);
void rfg2 (void);
void
fmtchk (const char *fmt)
{
(void) fputs(fmt, stdout);
(void) printf(":\t`");
(void) printf(fmt, 0x12);
(void) printf("'\n");
}
void
fmtst1chk (const char *fmt)
{
(void) fputs(fmt, stdout);
(void) printf(":\t`");
(void) printf(fmt, 4, 0x12);
(void) printf("'\n");
}
void
fmtst2chk (const char *fmt)
{
(void) fputs(fmt, stdout);
(void) printf(":\t`");
(void) printf(fmt, 4, 4, 0x12);
(void) printf("'\n");
}
/* This page is covered by the following copyright: */
/* (C) Copyright C E Chew
*
* Feel free to copy, use and distribute this software provided:
*
* 1. you do not pretend that you wrote it
* 2. you leave this copyright notice intact.
*/
/*
* Extracted from exercise.c for glibc-1.05 bug report by Bruce Evans.
*/
#define DEC -123
#define INT 255
#define UNS (~0)
/* Formatted Output Test
*
* This exercises the output formatting code.
*/
void
fp_test (void)
{
int i, j, k, l;
char buf[7];
char *prefix = buf;
char tp[20];
puts("\nFormatted output test");
printf("prefix 6d 6o 6x 6X 6u\n");
strcpy(prefix, "%");
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
for (l = 0; l < 2; l++) {
strcpy(prefix, "%");
if (i == 0) strcat(prefix, "-");
if (j == 0) strcat(prefix, "+");
if (k == 0) strcat(prefix, "#");
if (l == 0) strcat(prefix, "0");
printf("%5s |", prefix);
strcpy(tp, prefix);
strcat(tp, "6d |");
printf(tp, DEC);
strcpy(tp, prefix);
strcat(tp, "6o |");
printf(tp, INT);
strcpy(tp, prefix);
strcat(tp, "6x |");
printf(tp, INT);
strcpy(tp, prefix);
strcat(tp, "6X |");
printf(tp, INT);
strcpy(tp, prefix);
strcat(tp, "6u |");
printf(tp, UNS);
printf("\n");
}
}
}
}
printf("%10s\n", (char *) NULL);
printf("%-10s\n", (char *) NULL);
}
int
main (int argc, char *argv[])
{
static char shortstr[] = "Hi, Z.";
static char longstr[] = "Good morning, Doctor Chandra. This is Hal. \
I am ready for my first lesson today.";
fmtchk("%.4x");
fmtchk("%04x");
fmtchk("%4.4x");
fmtchk("%04.4x");
fmtchk("%4.3x");
fmtchk("%04.3x");
fmtst1chk("%.*x");
fmtst1chk("%0*x");
fmtst2chk("%*.*x");
fmtst2chk("%0*.*x");
#ifndef BSD
printf("bad format:\t\"%b\"\n");
printf("nil pointer (padded):\t\"%10p\"\n", (void *) NULL);
#endif
printf("decimal negative:\t\"%d\"\n", -2345);
printf("octal negative:\t\"%o\"\n", -2345);
printf("hex negative:\t\"%x\"\n", -2345);
printf("long decimal number:\t\"%ld\"\n", -123456L);
printf("long octal negative:\t\"%lo\"\n", -2345L);
printf("long unsigned decimal number:\t\"%lu\"\n", -123456L);
printf("zero-padded LDN:\t\"%010ld\"\n", -123456L);
printf("left-adjusted ZLDN:\t\"%-010ld\"\n", -123456);
printf("space-padded LDN:\t\"%10ld\"\n", -123456L);
printf("left-adjusted SLDN:\t\"%-10ld\"\n", -123456L);
printf("zero-padded string:\t\"%010s\"\n", shortstr);
printf("left-adjusted Z string:\t\"%-010s\"\n", shortstr);
printf("space-padded string:\t\"%10s\"\n", shortstr);
printf("left-adjusted S string:\t\"%-10s\"\n", shortstr);
printf("null string:\t\"%s\"\n", (char *)NULL);
printf("limited string:\t\"%.22s\"\n", longstr);
printf("e-style >= 1:\t\"%e\"\n", 12.34);
printf("e-style >= .1:\t\"%e\"\n", 0.1234);
printf("e-style < .1:\t\"%e\"\n", 0.001234);
printf("e-style big:\t\"%.60e\"\n", 1e20);
printf ("e-style == .1:\t\"%e\"\n", 0.1);
printf("f-style >= 1:\t\"%f\"\n", 12.34);
printf("f-style >= .1:\t\"%f\"\n", 0.1234);
printf("f-style < .1:\t\"%f\"\n", 0.001234);
printf("g-style >= 1:\t\"%g\"\n", 12.34);
printf("g-style >= .1:\t\"%g\"\n", 0.1234);
printf("g-style < .1:\t\"%g\"\n", 0.001234);
printf("g-style big:\t\"%.60g\"\n", 1e20);
printf (" %6.5f\n", .099999999860301614);
printf (" %6.5f\n", .1);
printf ("x%5.4fx\n", .5);
printf ("%#03x\n", 1);
{
double d = FLT_MIN;
int niter = 17;
while (niter-- != 0)
printf ("%.17e\n", d / 2);
fflush (stdout);
}
printf ("%15.5e\n", 4.9406564584124654e-324);
#define FORMAT "|%12.4f|%12.4e|%12.4g|\n"
printf (FORMAT, 0.0, 0.0, 0.0);
printf (FORMAT, 1.0, 1.0, 1.0);
printf (FORMAT, -1.0, -1.0, -1.0);
printf (FORMAT, 100.0, 100.0, 100.0);
printf (FORMAT, 1000.0, 1000.0, 1000.0);
printf (FORMAT, 10000.0, 10000.0, 10000.0);
printf (FORMAT, 12345.0, 12345.0, 12345.0);
printf (FORMAT, 100000.0, 100000.0, 100000.0);
printf (FORMAT, 123456.0, 123456.0, 123456.0);
#undef FORMAT
{
char buf[20];
printf ("sprintf (\"%%30s\", \"foo\") == %d, \"%.*s\"\n",
sprintf (buf, "%30s", "foo"), sizeof (buf), buf);
}
fp_test ();
printf ("%e should be 1.234568e+06\n", 1234567.8);
printf ("%f should be 1234567.800000\n", 1234567.8);
printf ("%g should be 1.23457e+06\n", 1234567.8);
printf ("%g should be 123.456\n", 123.456);
printf ("%g should be 1e+06\n", 1000000.0);
printf ("%g should be 10\n", 10.0);
printf ("%g should be 0.02\n", 0.02);
{
double x=1.0;
printf("%.17f\n",(1.0/x/10.0+1.0)*x-x);
}
puts ("--- Should be no further output. ---");
rfg1 ();
rfg2 ();
{
char buf[200];
int result;
sprintf(buf,"%*s%*s%*s",-1,"one",-20,"two",-30,"three");
result = strcmp (buf,
"onetwo three ");
puts (result != 0 ? "Test failed!" : "Test ok.");
return result != 0;
}
}
void
rfg1 (void)
{
char buf[100];
sprintf (buf, "%5.s", "xyz");
if (strcmp (buf, " ") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " ");
sprintf (buf, "%5.f", 33.3);
if (strcmp (buf, " 33") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 33");
sprintf (buf, "%8.e", 33.3e7);
if (strcmp (buf, " 3e+08") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 3e+08");
sprintf (buf, "%8.E", 33.3e7);
if (strcmp (buf, " 3E+08") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 3E+08");
sprintf (buf, "%.g", 33.3);
if (strcmp (buf, "3e+01") != 0)
printf ("got: '%s', expected: '%s'\n", buf, "3e+01");
sprintf (buf, "%.G", 33.3);
if (strcmp (buf, "3E+01") != 0)
printf ("got: '%s', expected: '%s'\n", buf, "3E+01");
}
void
rfg2 (void)
{
int prec;
char buf[100];
prec = 0;
sprintf (buf, "%.*g", prec, 3.3);
if (strcmp (buf, "3") != 0)
printf ("got: '%s', expected: '%s'\n", buf, "3");
prec = 0;
sprintf (buf, "%.*G", prec, 3.3);
if (strcmp (buf, "3") != 0)
printf ("got: '%s', expected: '%s'\n", buf, "3");
prec = 0;
sprintf (buf, "%7.*G", prec, 3.33);
if (strcmp (buf, " 3") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 3");
prec = 3;
sprintf (buf, "%04.*o", prec, 33);
if (strcmp (buf, " 041") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 041");
prec = 7;
sprintf (buf, "%09.*u", prec, 33);
if (strcmp (buf, " 0000033") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 0000033");
prec = 3;
sprintf (buf, "%04.*x", prec, 33);
if (strcmp (buf, " 021") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 021");
prec = 3;
sprintf (buf, "%04.*X", prec, 33);
if (strcmp (buf, " 021") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 021");
}

View File

@@ -1,56 +0,0 @@
#include <stdio.h>
int
t1 (void)
{
int n = -1;
sscanf ("abc ", "abc %n", &n);
printf ("t1: count=%d\n", n);
return n != 5;
}
int
t2 (void)
{
int result = 0;
int n;
long N;
int retval;
#define SCAN(INPUT, FORMAT, VAR, EXP_RES, EXP_VAL) \
VAR = -1; \
retval = sscanf (INPUT, FORMAT, &VAR); \
printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
INPUT, FORMAT, retval, (long int) VAR); \
result |= retval != EXP_RES || VAR != EXP_VAL
SCAN ("12345", "%ld", N, 1, 12345);
SCAN ("12345", "%llllld", N, 0, -1);
SCAN ("12345", "%LLLLLd", N, 0, -1);
SCAN ("test ", "%*s%n", n, 0, 4);
SCAN ("test ", "%2*s%n", n, 0, -1);
SCAN ("12 ", "%l2d", n, 0, -1);
SCAN ("12 ", "%2ld", N, 1, 12);
n = -1;
N = -1;
retval = sscanf ("1 1", "%d %Z", &n, &N);
printf ("sscanf (\"1 1\", \"%%d %%Z\", &n, &N) => %d, n = %d, N = %ld\n", \
retval, n, N); \
result |= retval != 1 || n != 1 || N != -1;
return result;
}
int
main (int argc, char *argv[])
{
int result = 0;
result |= t1 ();
result |= t2 ();
result |= fflush (stdout) == EOF;
return result;
}

View File

@@ -1,102 +0,0 @@
/*
* Simple program to display the Windows System Metrics.
*
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
*
* Robert Dickenson <robd@reactos.org>, July 11, 2002.
*/
#include <stdio.h>
#include <windows.h>
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
{
fprintf(stderr,"Windows System Metric:\t Value\n");
fprintf(stderr," SM_ARRANGE:\t\t %d\n", GetSystemMetrics(SM_ARRANGE));
fprintf(stderr," SM_CLEANBOOT:\t %d\n", GetSystemMetrics(SM_CLEANBOOT));
// fprintf(stderr," SM_CMONITORS:\t %d\n", GetSystemMetrics(SM_CMONITORS));
fprintf(stderr," SM_CMOUSEBUTTONS:\t %d\n", GetSystemMetrics(SM_CMOUSEBUTTONS));
fprintf(stderr," SM_CXBORDER:\t %d\n", GetSystemMetrics(SM_CXBORDER));
fprintf(stderr," SM_CYBORDER:\t %d\n", GetSystemMetrics(SM_CYBORDER));
fprintf(stderr," SM_CXCURSOR:\t %d\n", GetSystemMetrics(SM_CXCURSOR));
fprintf(stderr," SM_CYCURSOR:\t %d\n", GetSystemMetrics(SM_CYCURSOR));
fprintf(stderr," SM_CXDLGFRAME:\t %d\n", GetSystemMetrics(SM_CXDLGFRAME));
fprintf(stderr," SM_CYDLGFRAME:\t %d\n", GetSystemMetrics(SM_CYDLGFRAME));
fprintf(stderr," SM_CXDOUBLECLK:\t %d\n", GetSystemMetrics(SM_CXDOUBLECLK));
fprintf(stderr," SM_CYDOUBLECLK:\t %d\n", GetSystemMetrics(SM_CYDOUBLECLK));
fprintf(stderr," SM_CXDRAG:\t\t %d\n", GetSystemMetrics(SM_CXDRAG));
fprintf(stderr," SM_CYDRAG:\t\t %d\n", GetSystemMetrics(SM_CYDRAG));
fprintf(stderr," SM_CXEDGE:\t\t %d\n", GetSystemMetrics(SM_CXEDGE));
fprintf(stderr," SM_CYEDGE:\t\t %d\n", GetSystemMetrics(SM_CYEDGE));
fprintf(stderr," SM_CXFIXEDFRAME:\t %d\n", GetSystemMetrics(SM_CXFIXEDFRAME));
fprintf(stderr," SM_CYFIXEDFRAME:\t %d\n", GetSystemMetrics(SM_CYFIXEDFRAME));
fprintf(stderr," SM_CXFRAME:\t\t %d\n", GetSystemMetrics(SM_CXFRAME));
fprintf(stderr," SM_CYFRAME:\t\t %d\n", GetSystemMetrics(SM_CYFRAME));
fprintf(stderr," SM_CXFULLSCREEN:\t %d\n", GetSystemMetrics(SM_CXFULLSCREEN));
fprintf(stderr," SM_CYFULLSCREEN:\t %d\n", GetSystemMetrics(SM_CYFULLSCREEN));
fprintf(stderr," SM_CXHSCROLL:\t %d\n", GetSystemMetrics(SM_CXHSCROLL));
fprintf(stderr," SM_CYHSCROLL:\t %d\n", GetSystemMetrics(SM_CYHSCROLL));
fprintf(stderr," SM_CXHTHUMB:\t %d\n", GetSystemMetrics(SM_CXHTHUMB));
fprintf(stderr," SM_CXICON:\t\t %d\n", GetSystemMetrics(SM_CXICON));
fprintf(stderr," SM_CYICON:\t\t %d\n", GetSystemMetrics(SM_CYICON));
fprintf(stderr," SM_CXICONSPACING:\t %d\n", GetSystemMetrics(SM_CXICONSPACING));
fprintf(stderr," SM_CYICONSPACING:\t %d\n", GetSystemMetrics(SM_CYICONSPACING));
fprintf(stderr," SM_CXMAXIMIZED:\t %d\n", GetSystemMetrics(SM_CXMAXIMIZED));
fprintf(stderr," SM_CYMAXIMIZED:\t %d\n", GetSystemMetrics(SM_CYMAXIMIZED));
fprintf(stderr," SM_CXMAXTRACK:\t %d\n", GetSystemMetrics(SM_CXMAXTRACK));
fprintf(stderr," SM_CYMAXTRACK:\t %d\n", GetSystemMetrics(SM_CYMAXTRACK));
fprintf(stderr," SM_CXMENUCHECK:\t %d\n", GetSystemMetrics(SM_CXMENUCHECK));
fprintf(stderr," SM_CYMENUCHECK:\t %d\n", GetSystemMetrics(SM_CYMENUCHECK));
fprintf(stderr," SM_CXMENUSIZE:\t %d\n", GetSystemMetrics(SM_CXMENUSIZE));
fprintf(stderr," SM_CYMENUSIZE:\t %d\n", GetSystemMetrics(SM_CYMENUSIZE));
fprintf(stderr," SM_CXMIN:\t\t %d\n", GetSystemMetrics(SM_CXMIN));
fprintf(stderr," SM_CYMIN:\t\t %d\n", GetSystemMetrics(SM_CYMIN));
fprintf(stderr," SM_CXMINIMIZED:\t %d\n", GetSystemMetrics(SM_CXMINIMIZED));
fprintf(stderr," SM_CYMINIMIZED:\t %d\n", GetSystemMetrics(SM_CYMINIMIZED));
fprintf(stderr," SM_CXMINSPACING:\t %d\n", GetSystemMetrics(SM_CXMINSPACING));
fprintf(stderr," SM_CYMINSPACING:\t %d\n", GetSystemMetrics(SM_CYMINSPACING));
fprintf(stderr," SM_CXMINTRACK:\t %d\n", GetSystemMetrics(SM_CXMINTRACK));
fprintf(stderr," SM_CYMINTRACK:\t %d\n", GetSystemMetrics(SM_CYMINTRACK));
fprintf(stderr," SM_CXSCREEN:\t %d\n", GetSystemMetrics(SM_CXSCREEN));
fprintf(stderr," SM_CYSCREEN:\t %d\n", GetSystemMetrics(SM_CYSCREEN));
fprintf(stderr," SM_CXSIZE:\t\t %d\n", GetSystemMetrics(SM_CXSIZE));
fprintf(stderr," SM_CYSIZE:\t\t %d\n", GetSystemMetrics(SM_CYSIZE));
fprintf(stderr," SM_CXSIZEFRAME:\t %d\n", GetSystemMetrics(SM_CXSIZEFRAME));
fprintf(stderr," SM_CYSIZEFRAME:\t %d\n", GetSystemMetrics(SM_CYSIZEFRAME));
fprintf(stderr," SM_CXSMICON:\t %d\n", GetSystemMetrics(SM_CXSMICON));
fprintf(stderr," SM_CYSMICON:\t %d\n", GetSystemMetrics(SM_CYSMICON));
fprintf(stderr," SM_CXSMSIZE:\t %d\n", GetSystemMetrics(SM_CXSMSIZE));
fprintf(stderr," SM_CYSMSIZE:\t %d\n", GetSystemMetrics(SM_CYSMSIZE));
// fprintf(stderr," SM_CXVIRTUALSCREEN:\t %d\n", GetSystemMetrics(SM_CXVIRTUALSCREEN));
// fprintf(stderr," SM_CYVIRTUALSCREEN:\t %d\n", GetSystemMetrics(SM_CYVIRTUALSCREEN));
fprintf(stderr," SM_CXVSCROLL:\t %d\n", GetSystemMetrics(SM_CXVSCROLL));
fprintf(stderr," SM_CYVSCROLL:\t %d\n", GetSystemMetrics(SM_CYVSCROLL));
fprintf(stderr," SM_CYCAPTION:\t %d\n", GetSystemMetrics(SM_CYCAPTION));
fprintf(stderr," SM_CYKANJIWINDOW:\t %d\n", GetSystemMetrics(SM_CYKANJIWINDOW));
fprintf(stderr," SM_CYMENU:\t\t %d\n", GetSystemMetrics(SM_CYMENU));
fprintf(stderr," SM_CYSMCAPTION:\t %d\n", GetSystemMetrics(SM_CYSMCAPTION));
fprintf(stderr," SM_CYVTHUMB:\t %d\n", GetSystemMetrics(SM_CYVTHUMB));
fprintf(stderr," SM_DBCSENABLED:\t %d\n", GetSystemMetrics(SM_DBCSENABLED));
fprintf(stderr," SM_DEBUG:\t\t %d\n", GetSystemMetrics(SM_DEBUG));
// fprintf(stderr," SM_IMMENABLED:\t %d\n", GetSystemMetrics(SM_IMMENABLED));
fprintf(stderr," SM_MENUDROPALIGNMENT: %d\n", GetSystemMetrics(SM_MENUDROPALIGNMENT));
fprintf(stderr," SM_MIDEASTENABLED:\t %d\n", GetSystemMetrics(SM_MIDEASTENABLED));
fprintf(stderr," SM_MOUSEPRESENT:\t %d\n", GetSystemMetrics(SM_MOUSEPRESENT));
#ifndef _MSC_VER
fprintf(stderr," SM_MOUSEWHEELPRESENT: %d\n", GetSystemMetrics(SM_MOUSEWHEELPRESENT));
#endif
fprintf(stderr," SM_NETWORK:\t\t %d\n", GetSystemMetrics(SM_NETWORK));
fprintf(stderr," SM_PENWINDOWS:\t %d\n", GetSystemMetrics(SM_PENWINDOWS));
// fprintf(stderr," SM_REMOTESESSION:\t %d\n", GetSystemMetrics(SM_REMOTESESSION));
fprintf(stderr," SM_SECURE:\t\t %d\n", GetSystemMetrics(SM_SECURE));
// fprintf(stderr," SM_SAMEDISPLAYFORMAT: %d\n", GetSystemMetrics(SM_SAMEDISPLAYFORMAT));
fprintf(stderr," SM_SHOWSOUNDS:\t %d\n", GetSystemMetrics(SM_SHOWSOUNDS));
fprintf(stderr," SM_SLOWMACHINE:\t %d\n", GetSystemMetrics(SM_SLOWMACHINE));
fprintf(stderr," SM_SWAPBUTTON:\t %d\n", GetSystemMetrics(SM_SWAPBUTTON));
// fprintf(stderr," SM_XVIRTUALSCREEN: %d\n", GetSystemMetrics(SM_XVIRTUALSCREEN));
// fprintf(stderr," SM_YVIRTUALSCREEN: %d\n", GetSystemMetrics(SM_YVIRTUALSCREEN));
return 0;
}

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