mirror of
https://github.com/reactos/reactos
synced 2025-10-07 08:52:45 +02:00
Compare commits
1 Commits
backups/al
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
d7d72444fb |
0
.gitignore
vendored
0
.gitignore
vendored
340
reactos/COPYING
340
reactos/COPYING
@@ -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.
|
@@ -1,78 +0,0 @@
|
||||
ReactOS is available thanks to the work of
|
||||
|
||||
Emanuele Aliberti <ea@iol.it>
|
||||
Robert Bergkvist <fragdance@hotmail.com>
|
||||
Hartmut Birr <hartmut.birr@gmx.de>
|
||||
Aleksey Bragin <aleksey@studiocerebral.com>
|
||||
Richard Campbell <eek2121@comcast.net>
|
||||
Gunnar Andre' Dalsnes <hardon@online.no>
|
||||
Arindam Das
|
||||
Boudewijn Dekker <ariadne@xs4all.nl>
|
||||
Robert Dickenson <robd@reactos.org>
|
||||
Marty Dill <mdill@uvic.ca>
|
||||
Jason Eager
|
||||
Steven Edwards <steven_ed4153@yahoo.com>
|
||||
Iwan Fatahi <i_fatahi@hotmail.com>
|
||||
Jason Filby <jasonfilby@yahoo.com>
|
||||
Martin Fuchs <martin-fuchs@gmx.net>
|
||||
Jurgen van Gael <jurgen.vangael@student.kuleuven.ac.be>
|
||||
Ge van Geldorp <ge@gse.nl>
|
||||
Andrew Greenwood <lists@silverblade.co.uk>
|
||||
Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
KJK::Hyperion <noog@libero.it>
|
||||
Eugene Ingerman <geneing@myrealbox.com>
|
||||
Rex Jolliff <rex@lvcablemodem.com>
|
||||
Guido de Jong
|
||||
Victor Kirhenshtein <sauros@iname.com>
|
||||
Eric Kohl <ekohl@rz-online.de>
|
||||
Hans Kremer
|
||||
Frederik Leemans
|
||||
Jean Michault
|
||||
Royce Mitchell III <royce3@ev1.net>
|
||||
Filip Navara <xnavara@volny.cz>
|
||||
Jim Noeth
|
||||
Mike Nordell ("tamlin")
|
||||
Hernan Ochoa
|
||||
Brian Palmer <brianp@sginet.com>
|
||||
Paolo Pantaleo <paolopan@freemail.it>
|
||||
Matt Pyne
|
||||
Phillip Susi <phreak@iag.net>
|
||||
James B. Tabor <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
|
||||
Mark Tempel <mtempel@visi.com>
|
||||
Vizzini <vizzini@plasmic.com>
|
||||
Mark Weaver <mark@npsl.co.uk>
|
||||
Thomas Weidenmueller <w3seek@users.sourceforge.net>
|
||||
Jason Weiler
|
||||
David Welch <welch@cwcom.net>
|
||||
Jonathan Wilson <jonwil@tpgi.com.au>
|
||||
Art Yerkes <ayerkes@speakeasy.net>
|
||||
|
||||
Graphic Design from
|
||||
|
||||
Everaldo (http://everaldo.com) for Explorer icons
|
||||
|
||||
Source and inspiration from
|
||||
|
||||
WINE (http://www.winehq.com)
|
||||
WinFree (http://www.stack.nl/~onno/win32/)
|
||||
Linux (http://www.kernel.org)
|
||||
XFree86 (http://www.xfree86.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.
|
211
reactos/Doxyfile
211
reactos/Doxyfile
@@ -1,211 +0,0 @@
|
||||
# Doxyfile 1.3.5
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = ReactOS
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = doxy-doc
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = .
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = hal \
|
||||
subsys \
|
||||
services \
|
||||
regtests \
|
||||
iface
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = subsys/win32k \
|
||||
subsys/system/explorer
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = YES
|
||||
RTF_HYPERLINKS = YES
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = NO
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = include
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
@@ -1,73 +0,0 @@
|
||||
1. Build environment
|
||||
|
||||
To build the system you need either mingw32 installed on Windows or a mingw32
|
||||
cross compiler running on unix. You may obtain MinGW binaries that build
|
||||
ReactOS from http://www.reactos.com.
|
||||
|
||||
|
||||
2. Building ReactOS
|
||||
|
||||
To build from Windows run 'make' (wihout the quotes) from the top directory.
|
||||
To build from unix, edit rules.mak and change the PREFIX variable to the
|
||||
correct value for your cross-compiler. Run 'export HOST=mingw32-linux' to
|
||||
tell the ReactOS build system that it is building ReactOS on a linux machine.
|
||||
Now 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. If you don't want to change rules.mak, you can specify the
|
||||
installtion directory when invoking make. Run
|
||||
'make INSTALL_DIR=c:\reactos install' to install to c:\reactos.
|
||||
|
||||
|
||||
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>.
|
||||
A simple shell is started where you can use simple commands like 'cd' and 'dir'.
|
||||
|
||||
|
||||
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§ion=lists
|
||||
|
||||
ReactOS Development Team
|
@@ -1,5 +0,0 @@
|
||||
# Main jamfile for ReactOS
|
||||
|
||||
SubDir ROS_TOP ;
|
||||
|
||||
SubInclude ROS_TOP Lib ;
|
@@ -1,54 +0,0 @@
|
||||
# customization for ReactOS goes here
|
||||
|
||||
# The SharedLibrary and SharedLibraryFromObjects rules were
|
||||
# borrowed from here:
|
||||
# http://www.differentpla.net/~roger/devel/jam/tutorial/shared_lib/index.html
|
||||
|
||||
SUFSHR = .dll ;
|
||||
RM = rm ; # rm comes with MinGW, and the default del doesn't work in some cases
|
||||
|
||||
rule SharedLibrary
|
||||
{
|
||||
SharedLibraryFromObjects $(<) : $(>:S=$(SUFOBJ)) ;
|
||||
Objects $(>) ;
|
||||
}
|
||||
|
||||
rule SharedLibraryFromObjects
|
||||
{
|
||||
local _s _t ;
|
||||
|
||||
# Add grist to file names
|
||||
# Add suffix to dll
|
||||
|
||||
_s = [ FGristFiles $(>) ] ;
|
||||
_t = [ FAppendSuffix $(<) : $(SUFSHR) ] ;
|
||||
|
||||
if $(_t) != $(<)
|
||||
{
|
||||
DEPENDS $(<) : $(_t) ;
|
||||
NOTFILE $(<) ;
|
||||
}
|
||||
|
||||
# make compiled sources a dependency of target
|
||||
|
||||
DEPENDS exe : $(_t) ;
|
||||
DEPENDS $(_t) : $(_s) ;
|
||||
MakeLocate $(_t) : $(LOCATE_TARGET) ;
|
||||
|
||||
Clean clean : $(_t) ;
|
||||
|
||||
Link $(_t) : $(_s) ;
|
||||
}
|
||||
|
||||
# nasm needs to know the output file first, or it doesn't
|
||||
# recognize -I :(
|
||||
actions As
|
||||
{
|
||||
$(AS) -o $(<) $(ASFLAGS) -I$(HDRS) $(>)
|
||||
}
|
||||
|
||||
AS = nasm ;
|
||||
|
||||
# why isn't DEFINES working? :(
|
||||
#DEFINES += _M_IX86 ;
|
||||
CCFLAGS += -D_M_IX86 ;
|
504
reactos/LGPL.txt
504
reactos/LGPL.txt
@@ -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!
|
||||
|
||||
|
1088
reactos/Makefile
1088
reactos/Makefile
File diff suppressed because it is too large
Load Diff
@@ -1,28 +0,0 @@
|
||||
========================
|
||||
ReactOS Version 0.2.x
|
||||
Updated June 23rd, 2004
|
||||
========================
|
||||
|
||||
1. What is ReactOS?
|
||||
|
||||
ReactOS is an Open Source effort to develop a quality operating system
|
||||
that is compatible with Windows NT applications and drivers.
|
||||
|
||||
The ReactOS project, although currently focused on Windows NT 4.0
|
||||
compatibility, is always keeping an eye towards compatibility with
|
||||
future Windows NT releases, that is, Windows 2000 (NT 5.0) and
|
||||
Windows XP (NT 5.1).
|
||||
|
||||
More information is available at http://www.reactos.com.
|
||||
|
||||
2. Building ReactOS
|
||||
|
||||
See the INSTALL file for more details.
|
||||
|
||||
3. More information
|
||||
|
||||
See the doc subdirectory for some sparse notes
|
||||
|
||||
4. Who is responsible
|
||||
|
||||
See the CREDITS file
|
@@ -1,33 +0,0 @@
|
||||
; Format:
|
||||
; COMPONENT_NAME PATH_TO_COMPONENT_SOURCES
|
||||
; COMPONENT_NAME - Name of the component. Eg. kernel32.dll.
|
||||
; PATH_TO_COMPONENT_SOURCES - Relative path to sources (relative to
|
||||
; where rgenstat is run from).
|
||||
advapi32.dll reactos/lib/advapi32
|
||||
crtdll.dll reactos/lib/crtdll
|
||||
gdi32.dll reactos/lib/gdi32
|
||||
gdiplus.dll reactos/lib/gdiplus
|
||||
iphlpapi.dll reactos/lib/iphlpapi
|
||||
kernel32.dll reactos/lib/kernel32
|
||||
lz32.dll reactos/lib/lzexpand
|
||||
msvcrt.dll reactos/lib/msvcrt
|
||||
ole32.dll reactos/lib/ole32
|
||||
oleaut32.dll reactos/lib/oleaut32
|
||||
rpcrt4.dll reactos/lib/rpcrt4
|
||||
secur32.dll reactos/lib/secur32
|
||||
shell32.dll reactos/lib/shell32
|
||||
snmpapi.dll reactos/lib/snmpapi
|
||||
user32.dll reactos/lib/user32
|
||||
version.dll reactos/lib/version
|
||||
winmm.dll reactos/lib/winmm
|
||||
winspool.dll reactos/lib/winspool
|
||||
ws2_32.dll reactos/lib/ws2_32
|
||||
wsock32.dll reactos/lib/wsock32
|
||||
videoprt.dll reactos/drivers/video/videoprt
|
||||
ndis.sys reactos/drivers/net/ndis
|
||||
tdi.sys reactos/drivers/net/tdi
|
||||
class2.sys reactos/drivers/storage/class2
|
||||
scsiport.sys reactos/drivers/storage/scsiport
|
||||
ntoskrnl.exe reactos/ntoskrnl
|
||||
ntoskrnl.exe reactos/lib/rtl
|
||||
win32k.sys reactos/subsys/win32k
|
@@ -1,207 +0,0 @@
|
||||
# Doxyfile 1.3.5
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ReactOS Apps & Tools"
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = doxy-doc
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = ..
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = . \
|
||||
../tools
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 200
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = YES
|
||||
RTF_HYPERLINKS = YES
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = NO
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = ../include
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
@@ -1,13 +0,0 @@
|
||||
# $Id$
|
||||
#
|
||||
# ReactOS apps and tools makefile to generate Doxygen documentation
|
||||
#
|
||||
|
||||
|
||||
docu:
|
||||
doxygen Doxyfile
|
||||
|
||||
.PHONY: docu
|
||||
|
||||
|
||||
# EOF
|
@@ -1,162 +0,0 @@
|
||||
#
|
||||
# ReactOS system testsets makefile
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
||||
# Testset applications
|
||||
TEST_SETS = loadlib
|
||||
|
||||
TEST_KERNEL32 =
|
||||
|
||||
TEST_MSVCRT =
|
||||
|
||||
TEST_COM =
|
||||
|
||||
TEST_SEH =
|
||||
|
||||
TEST_REGRESSIONS =
|
||||
|
||||
all: $(TEST_SETS) $(TEST_KERNEL32) $(TEST_MSVCRT) $(TEST_COM) $(TEST_SEH) $(TEST_REGRESSIONS)
|
||||
|
||||
depends:
|
||||
|
||||
implib: $(TEST_SETS:%=%_implib) \
|
||||
$(TEST_KERNEL32:%=%_implib) \
|
||||
$(TEST_MSVCRT:%=%_implib) \
|
||||
$(TEST_COM:%=%_implib) \
|
||||
$(TEST_SEH:%=%_implib) \
|
||||
$(TEST_REGRESSIONS:%=%_implib)
|
||||
|
||||
clean: $(TEST_SETS:%=%_clean) \
|
||||
$(TEST_KERNEL32:%=%_clean) \
|
||||
$(TEST_MSVCRT:%=%_clean) \
|
||||
$(TEST_COM:%=%_clean) \
|
||||
$(TEST_SEH:%=%_clean) \
|
||||
$(TEST_REGRESSIONS:%=%_clean)
|
||||
|
||||
install: $(TEST_SETS:%=%_install) \
|
||||
$(TEST_KERNEL32:%=%_install) \
|
||||
$(TEST_MSVCRT:%=%_install) \
|
||||
$(TEST_COM:%=%_install) \
|
||||
$(TEST_SEH:%=%_install) \
|
||||
$(TEST_REGRESSIONS:%=%_install)
|
||||
|
||||
.PHONY: all depends implib clean install
|
||||
|
||||
|
||||
#
|
||||
# Testset Applications
|
||||
#
|
||||
$(TEST_SETS): %:
|
||||
$(MAKE) -C $*
|
||||
|
||||
$(TEST_SETS:%=%_implib): %_implib:
|
||||
$(MAKE) -C $* implib
|
||||
|
||||
$(TEST_SETS:%=%_clean): %_clean:
|
||||
$(MAKE) -C $* clean
|
||||
|
||||
$(TEST_SETS:%=%_install): %_install:
|
||||
$(MAKE) -C $* install
|
||||
|
||||
.PHONY: $(TEST_SETS) $(TEST_SETS:%=%_implib) $(TEST_SETS:%=%_clean) $(TEST_SETS:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# Kernel32 Test Applications
|
||||
#
|
||||
$(TEST_KERNEL32): %:
|
||||
$(MAKE) -C kernel32/$*
|
||||
|
||||
$(TEST_KERNEL32:%=%_implib): %_implib:
|
||||
$(MAKE) -C kernel32/$* implib
|
||||
|
||||
$(TEST_KERNEL32:%=%_clean): %_clean:
|
||||
$(MAKE) -C kernel32/$* clean
|
||||
|
||||
$(TEST_KERNEL32:%=%_install): %_install:
|
||||
$(MAKE) -C kernel32/$* install
|
||||
|
||||
.PHONY: $(TEST_KERNEL32) $(TEST_KERNEL32:%=%_implib) $(TEST_KERNEL32:%=%_clean) $(TEST_KERNEL32:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# msvcrt Test Applications
|
||||
#
|
||||
$(TEST_MSVCRT): %:
|
||||
$(MAKE) -C msvcrt/$*
|
||||
|
||||
$(TEST_MSVCRT:%=%_implib): %_implib:
|
||||
$(MAKE) -C msvcrt/$* implib
|
||||
|
||||
$(TEST_MSVCRT:%=%_clean): %_clean:
|
||||
$(MAKE) -C msvcrt/$* clean
|
||||
|
||||
$(TEST_MSVCRT:%=%_install): %_install:
|
||||
$(MAKE) -C msvcrt/$* install
|
||||
|
||||
.PHONY: $(TEST_MSVCRT) $(TEST_MSVCRT:%=%_implib) $(TEST_MSVCRT:%=%_clean) $(TEST_MSVCRT:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# COM Test Applications
|
||||
#
|
||||
$(TEST_COM): %:
|
||||
$(MAKE) -C com/$*
|
||||
|
||||
$(TEST_COM:%=%_implib): %_implib:
|
||||
$(MAKE) -C com/$* implib
|
||||
|
||||
$(TEST_COM:%=%_clean): %_clean:
|
||||
$(MAKE) -C com/$* clean
|
||||
|
||||
$(TEST_COM:%=%_install): %_install:
|
||||
$(MAKE) -C com/$* install
|
||||
|
||||
.PHONY: $(TEST_COM) $(TEST_COM:%=%_implib) $(TEST_COM:%=%_clean) $(TEST_COM:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# SEH Test Applications
|
||||
#
|
||||
$(TEST_SEH): %:
|
||||
$(MAKE) -C seh/$*
|
||||
|
||||
$(TEST_SEH:%=%_implib): %_implib:
|
||||
$(MAKE) -C seh/$* implib
|
||||
|
||||
$(TEST_SEH:%=%_clean): %_clean:
|
||||
$(MAKE) -C seh/$* clean
|
||||
|
||||
$(TEST_SEH:%=%_install): %_install:
|
||||
$(MAKE) -C seh/$* install
|
||||
|
||||
.PHONY: $(TEST_SEH) $(TEST_SEH:%=%_implib) $(TEST_SEH:%=%_clean) $(TEST_SEH:%=%_install)
|
||||
|
||||
|
||||
#
|
||||
# Regression Test Applications
|
||||
#
|
||||
$(TEST_REGRESSIONS): %:
|
||||
$(MAKE) -C regres/$*
|
||||
|
||||
$(TEST_REGRESSIONS:%=%_implib): %_implib:
|
||||
$(MAKE) -C regres/$* implib
|
||||
|
||||
$(TEST_REGRESSIONS:%=%_clean): %_clean:
|
||||
$(MAKE) -C regres/$* clean
|
||||
|
||||
$(TEST_REGRESSIONS:%=%_install): %_install:
|
||||
$(MAKE) -C regres/$* install
|
||||
|
||||
.PHONY: $(TEST_REGRESSIONS) $(TEST_REGRESSIONS:%=%_implib) $(TEST_REGRESSIONS:%=%_clean) $(TEST_REGRESSIONS:%=%_install)
|
||||
|
||||
|
||||
etags:
|
||||
find . -name "*.[ch]" -print | etags --language=c -
|
||||
|
||||
# EOF
|
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* loadlib.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "loadlib.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#define APP_VERSION 1
|
||||
#define MAX_LIBS 25
|
||||
|
||||
#ifdef UNICODE
|
||||
#define TARGET "UNICODE"
|
||||
BOOL bUseAnsi = FALSE;
|
||||
#else
|
||||
#define TARGET "MBCS"
|
||||
BOOL bUseAnsi = TRUE;
|
||||
#endif
|
||||
BOOL verbose_flagged = FALSE;
|
||||
BOOL debug_flagged = FALSE;
|
||||
BOOL loop_flagged = FALSE;
|
||||
BOOL recursive_flagged = FALSE;
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
|
||||
void dprintf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args, fmt);
|
||||
wvsprintfA(buffer, fmt, args);
|
||||
WriteConsoleA(OutputHandle, buffer, lstrlenA(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
long getinput(char* buf, int buflen)
|
||||
{
|
||||
DWORD result;
|
||||
|
||||
ReadConsoleA(InputHandle, buf, buflen, &result, NULL);
|
||||
return (long)result;
|
||||
}
|
||||
|
||||
DWORD ReportLastError(void)
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
if (dwError != ERROR_SUCCESS) {
|
||||
PSTR msg = NULL;
|
||||
if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, dwError, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PSTR)&msg, 0, NULL)) {
|
||||
if (msg != NULL) {
|
||||
dprintf("ReportLastError() %d - %s\n", dwError, msg);
|
||||
} else {
|
||||
dprintf("ERROR: ReportLastError() %d - returned TRUE but with no msg string!\n", dwError);
|
||||
}
|
||||
} else {
|
||||
dprintf("ReportLastError() %d - unknown error\n", dwError);
|
||||
}
|
||||
if (msg != NULL) {
|
||||
LocalFree(msg);
|
||||
}
|
||||
}
|
||||
return dwError;
|
||||
}
|
||||
|
||||
const char* appName(const char* argv0)
|
||||
{
|
||||
const char* name;
|
||||
|
||||
name = (const char*)strrchr(argv0, '\\');
|
||||
if (name != NULL)
|
||||
return name + 1;
|
||||
return argv0;
|
||||
}
|
||||
|
||||
int usage(const char* appName)
|
||||
{
|
||||
dprintf("USAGE: %s libname [libname ...] [unicode]|[ansi] [loop][recurse]\n", appName);
|
||||
dprintf("\tWhere libname(s) is one or more libraries to load.\n");
|
||||
dprintf("\t[unicode] - perform tests using UNICODE api calls\n");
|
||||
dprintf("\t[ansi] - perform tests using ANSI api calls\n");
|
||||
dprintf("\t default is %s\n", TARGET);
|
||||
dprintf("\t[loop] - run test process in continuous loop\n");
|
||||
dprintf("\t[recurse] - load libraries recursively rather than sequentually\n");
|
||||
dprintf("\t[debug] - enable debug mode (unused)\n");
|
||||
dprintf("\t[verbose] - enable verbose output (unused)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD LoadLibraryList(char** libnames, int counter, BOOL bUseAnsi)
|
||||
{
|
||||
HMODULE hModule;
|
||||
|
||||
dprintf("Attempting to LoadLibrary");
|
||||
if (bUseAnsi) {
|
||||
dprintf("A(%s) - ", *libnames);
|
||||
hModule = LoadLibraryA(*libnames);
|
||||
} else {
|
||||
int len;
|
||||
wchar_t libnameW[500];
|
||||
len = mbstowcs(libnameW, *libnames, strlen(*libnames));
|
||||
if (len) {
|
||||
libnameW[len] = L'\0';
|
||||
dprintf("W(%S) - ", libnameW);
|
||||
hModule = LoadLibraryW(libnameW);
|
||||
} else {
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
if (hModule == NULL) {
|
||||
dprintf("\nERROR: failed to obtain handle to module %s - %x\n", *libnames, hModule);
|
||||
return ReportLastError();
|
||||
}
|
||||
dprintf("%x\n", hModule);
|
||||
|
||||
if (counter--) {
|
||||
LoadLibraryList(++libnames, counter, bUseAnsi);
|
||||
}
|
||||
|
||||
if (!FreeLibrary(hModule)) {
|
||||
dprintf("ERROR: failed to free module %s - %x\n", *libnames, hModule);
|
||||
return ReportLastError();
|
||||
} else {
|
||||
dprintf("FreeLibrary(%x) - successfull.\n", hModule);
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
{
|
||||
char* libs[MAX_LIBS];
|
||||
int lib_count = 0;
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
dprintf("%s application - build %03d (default: %s)\n", appName(argv[0]), APP_VERSION, TARGET);
|
||||
if (argc < 2) {
|
||||
/*return */usage(appName(argv[0]));
|
||||
}
|
||||
memset(libs, 0, sizeof(libs));
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (lstrcmpiA(argv[i], "ansi") == 0) {
|
||||
bUseAnsi = TRUE;
|
||||
} else if (lstrcmpiA(argv[i], "unicode") == 0) {
|
||||
bUseAnsi = FALSE;
|
||||
} else if (lstrcmpiA(argv[i], "loop") == 0) {
|
||||
loop_flagged = 1;
|
||||
} else if (lstrcmpiA(argv[i], "recurse") == 0) {
|
||||
recursive_flagged = 1;
|
||||
} else if (lstrcmpiA(argv[i], "verbose") == 0) {
|
||||
verbose_flagged = 1;
|
||||
} else if (lstrcmpiA(argv[i], "debug") == 0) {
|
||||
debug_flagged = 1;
|
||||
} else {
|
||||
if (lib_count < MAX_LIBS) {
|
||||
libs[lib_count] = argv[i];
|
||||
++lib_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lib_count) {
|
||||
do {
|
||||
if (recursive_flagged) {
|
||||
result = LoadLibraryList(libs, lib_count - 1, bUseAnsi);
|
||||
} else {
|
||||
for (i = 0; i < lib_count; i++) {
|
||||
result = LoadLibraryList(&libs[i], 0, bUseAnsi);
|
||||
//if (result != 0) break;
|
||||
}
|
||||
}
|
||||
} while (loop_flagged);
|
||||
} else {
|
||||
int len;
|
||||
char buffer[500];
|
||||
do {
|
||||
dprintf("\nEnter library name to attempt loading: ");
|
||||
len = getinput(buffer, sizeof(buffer) - 1);
|
||||
if (len > 2) {
|
||||
char* buf = buffer;
|
||||
buffer[len-2] = '\0';
|
||||
result = LoadLibraryList(&buf, 0, bUseAnsi);
|
||||
} else break;
|
||||
} while (!result && len);
|
||||
}
|
||||
dprintf("finished\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _NOCRT
|
||||
char* args[] = { "loadlib.exe", "advapi32.dll", "user32.dll", "recurse"};
|
||||
int __cdecl mainCRTStartup(void)
|
||||
{
|
||||
return main(3, args);
|
||||
}
|
||||
#endif /*__GNUC__*/
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* loadlib.h
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LOADLIB_H__
|
||||
#define __LOADLIB_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
extern BOOL verbose_flagged;
|
||||
extern BOOL debug_flagged;
|
||||
extern BOOL loop_flagged;
|
||||
extern BOOL recursive_flagged;
|
||||
|
||||
DWORD ReportLastError(void);
|
||||
long getinput(char* Buffer, int buflen);
|
||||
void dprintf(char* fmt, ...);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // __LOADLIB_H__
|
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# $Id: makefile,v 1.0
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = loadlib
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D_USE_W32API -DUNICODE -D_UNICODE
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a ntdll.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,421 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* _tfileio.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef UNICODE
|
||||
#define _tfopen _wfopen
|
||||
#define _tunlink _wunlink
|
||||
#define _TEOF WEOF
|
||||
#define _gettchar getwchar
|
||||
#define _puttchar putwchar
|
||||
#define _THEX_FORMAT _T("0x%04x ")
|
||||
#else /*UNICODE*/
|
||||
#define _tfopen fopen
|
||||
#define _tunlink _unlink
|
||||
#define _TEOF EOF
|
||||
#define _gettchar getchar
|
||||
#define _puttchar putchar
|
||||
#define _THEX_FORMAT "0x%02x "
|
||||
#endif /*UNICODE*/
|
||||
|
||||
|
||||
#define TEST_BUFFER_SIZE 200
|
||||
#define TEST_FILE_LINES 4
|
||||
|
||||
extern BOOL verbose_flagged;
|
||||
extern BOOL status_flagged;
|
||||
|
||||
static TCHAR test_buffer[TEST_BUFFER_SIZE];
|
||||
|
||||
static TCHAR dos_data[] = _T("line1: this is a bunch of readable text.\r\n")\
|
||||
_T("line2: some more printable text and punctuation !@#$%^&*()\r\n")\
|
||||
_T("line3: followed up with some numerals 1234567890\r\n")\
|
||||
_T("line4: done.\r\n");
|
||||
|
||||
static TCHAR nix_data[] = _T("line1: this is a bunch of readable text.\n")\
|
||||
_T("line2: some more printable text and punctuation !@#$%^&*()\n")\
|
||||
_T("line3: followed up with some numerals 1234567890\n")\
|
||||
_T("line4: done.\n");
|
||||
|
||||
#ifdef UNICODE
|
||||
#define TEST_B1_FILE_SIZE ((((sizeof(dos_data)/2)-1)+TEST_FILE_LINES)/2) // (166+4)/2=85
|
||||
#define TEST_B2_FILE_SIZE (((sizeof(dos_data)/2)-1)*2) // (166*2) =332
|
||||
#define TEST_B3_FILE_SIZE ((((sizeof(nix_data)/2)-1)+TEST_FILE_LINES)/2) // (162+4)/2=83
|
||||
#define TEST_B4_FILE_SIZE (((sizeof(nix_data)/2)-1)*2) // (162*2) =324
|
||||
#else /*UNICODE*/
|
||||
#define TEST_B1_FILE_SIZE (sizeof(dos_data)-1+TEST_FILE_LINES) // (166+4)=170
|
||||
#define TEST_B2_FILE_SIZE (sizeof(dos_data)-1-TEST_FILE_LINES) // (166-4)=162
|
||||
#define TEST_B3_FILE_SIZE (sizeof(nix_data)-1+TEST_FILE_LINES) // (162+4)=166
|
||||
#define TEST_B4_FILE_SIZE (sizeof(nix_data)-1) // (162) =162
|
||||
#endif /*UNICODE*/
|
||||
|
||||
|
||||
// result = create_test_file(file_name, _T("wb"), _T("rb"), file_data);
|
||||
|
||||
static BOOL test_file_truncate(TCHAR* file_name)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
int count = -1;
|
||||
int error_code;
|
||||
TCHAR ch;
|
||||
TCHAR* file_data = _T("this file should have been truncated to zero bytes...");
|
||||
FILE *file = _tfopen(file_name, _T("wb"));
|
||||
|
||||
if (verbose_flagged) {
|
||||
_tprintf(_T("test_file_truncate(\"%s\")\n"), file_name);
|
||||
}
|
||||
|
||||
if (file != NULL) {
|
||||
if (_fputts(file_data, file) != _TEOF) {
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to write data to file \"%s\"\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to open/create file \"%s\" for output\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
}
|
||||
|
||||
file = _tfopen(file_name, _T("wb"));
|
||||
if (file != NULL) {
|
||||
error_code = ferror(file);
|
||||
if (error_code) {
|
||||
_tprintf(_T("ERROR: (%s) ferror returned %d\n"), file_name, error_code);
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: (%s) failed to open file for truncating\n"), file_name);
|
||||
}
|
||||
|
||||
file = _tfopen(file_name, _T("rb"));
|
||||
if (file != NULL) {
|
||||
count = 0;
|
||||
while ((ch = _fgettc(file)) != _TEOF) {
|
||||
if (verbose_flagged) {
|
||||
_tprintf(_THEX_FORMAT, ch);
|
||||
}
|
||||
++count;
|
||||
}
|
||||
error_code = ferror(file);
|
||||
if (error_code) {
|
||||
_tprintf(_T("ERROR: (%s) ferror returned %d after reading\n"), file_name, error_code);
|
||||
perror("Read error");
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: (%s) failed to open file for reading\n"), file_name);
|
||||
}
|
||||
if (count) {
|
||||
result = TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOL create_output_file(TCHAR* file_name, TCHAR* file_mode, TCHAR* file_data)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
FILE *file = _tfopen(file_name, file_mode);
|
||||
if (file != NULL) {
|
||||
if (_fputts(file_data, file) != _TEOF) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to write data to file \"%s\"\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to open/create file \"%s\" for output\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOL verify_output_file(TCHAR* file_name, TCHAR* file_mode, TCHAR* file_data)
|
||||
{
|
||||
int error_code;
|
||||
int offset = 0;
|
||||
int line_num = 0;
|
||||
BOOL result = FALSE;
|
||||
BOOL error_flagged = FALSE;
|
||||
FILE* file = _tfopen(file_name, file_mode);
|
||||
if (file == NULL) {
|
||||
_tprintf(_T("ERROR: (%s) Can't open file for reading\n"), file_name);
|
||||
_tprintf(_T("ERROR: ferror returned %d\n"), ferror(file));
|
||||
return FALSE;
|
||||
} else if (status_flagged) {
|
||||
_tprintf(_T("STATUS: (%s) opened file for reading\n"), file_name);
|
||||
}
|
||||
while (_fgetts(test_buffer, TEST_BUFFER_SIZE, file)) {
|
||||
int length = _tcslen(test_buffer);
|
||||
int req_len = _tcschr(file_data+offset, _T('\n')) - (file_data+offset) + 1;
|
||||
|
||||
++line_num;
|
||||
if (length > req_len) {
|
||||
_tprintf(_T("ERROR: read excess bytes from line %d, length %d, but expected %d\n"), line_num, length, req_len);
|
||||
error_flagged = TRUE;
|
||||
break;
|
||||
}
|
||||
if (length < req_len) {
|
||||
_tprintf(_T("ERROR: read to few bytes from line %d, length %d, but expected %d\n"), line_num, length, req_len);
|
||||
error_flagged = TRUE;
|
||||
break;
|
||||
}
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("STATUS: Verifying %d bytes read from line %d\n"), length, line_num);
|
||||
}
|
||||
if (_tcsncmp(test_buffer, file_data+offset, length - 1) == 0) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
if (status_flagged) {
|
||||
int i;
|
||||
_tprintf(_T("WARNING: (%s) failed to verify file\n"), file_name);
|
||||
for (i = 0; i < length; i++) {
|
||||
if (file_data[offset+i] != test_buffer[i]) {
|
||||
_tprintf(_T("line %d, offset %d expected: 0x%04x found: 0x%04x\n"), line_num, i, (int)file_data[offset+i], (int)test_buffer[i]);
|
||||
}
|
||||
}
|
||||
_tprintf(_T("\n"));
|
||||
} else {
|
||||
error_flagged = TRUE;
|
||||
}
|
||||
}
|
||||
offset += length;
|
||||
}
|
||||
error_code = ferror(file);
|
||||
if (error_code) {
|
||||
_tprintf(_T("ERROR: (%s) ferror returned %d after reading\n"), file_name, error_code);
|
||||
perror("Read error");
|
||||
}
|
||||
if (!line_num) {
|
||||
_tprintf(_T("ERROR: (%s) failed to read from file\n"), file_name);
|
||||
}
|
||||
if (error_flagged == TRUE) {
|
||||
_tprintf(_T("ERROR: (%s) failed to verify file\n"), file_name);
|
||||
result = FALSE;
|
||||
}
|
||||
fclose(file);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int create_test_file(TCHAR* file_name, TCHAR* write_mode, TCHAR* read_mode, TCHAR* file_data)
|
||||
{
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("STATUS: Attempting to create output file %s\n"), file_name);
|
||||
}
|
||||
if (create_output_file(file_name, write_mode, file_data)) {
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("STATUS: Attempting to verify output file %s\n"), file_name);
|
||||
}
|
||||
if (verify_output_file(file_name, read_mode, file_data)) {
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("SUCCESS: %s verified ok\n"), file_name);
|
||||
}
|
||||
} else {
|
||||
//_tprintf(_T("ERROR: failed to verify file %s\n"), file_name);
|
||||
return 2;
|
||||
}
|
||||
} else {
|
||||
_tprintf(_T("ERROR: failed to create file %s\n"), file_name);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_file_size(TCHAR* file_name, TCHAR* file_mode, int expected)
|
||||
{
|
||||
int count = 0;
|
||||
FILE* file;
|
||||
TCHAR ch;
|
||||
int error_code;
|
||||
|
||||
if (status_flagged) {
|
||||
//_tprintf(_T("STATUS: (%s) checking for %d bytes in %s mode\n"), file_name, expected, _tcschr(file_mode, _T('b')) ? _T("binary") : _T("text"));
|
||||
_tprintf(_T("STATUS: (%s) checking for %d bytes with mode %s\n"), file_name, expected, file_mode);
|
||||
}
|
||||
file = _tfopen(file_name, file_mode);
|
||||
if (file == NULL) {
|
||||
_tprintf(_T("ERROR: (%s) failed to open file for reading\n"), file_name);
|
||||
return 1;
|
||||
}
|
||||
while ((ch = _fgettc(file)) != _TEOF) {
|
||||
if (verbose_flagged) {
|
||||
_tprintf(_THEX_FORMAT, ch);
|
||||
}
|
||||
++count;
|
||||
}
|
||||
error_code = ferror(file);
|
||||
if (error_code) {
|
||||
_tprintf(_T("ERROR: (%s) ferror returned %d after reading\n"), file_name, error_code);
|
||||
perror("Read error");
|
||||
}
|
||||
|
||||
if (verbose_flagged) {
|
||||
// _puttc(_T('\n'), stdout);
|
||||
}
|
||||
fclose(file);
|
||||
if (count == expected) {
|
||||
if (status_flagged) {
|
||||
_tprintf(_T("PASSED: (%s) read %d bytes\n"), file_name, count);
|
||||
}
|
||||
} else {
|
||||
_tprintf(_T("FAILED: (%s) read %d bytes but expected %d using mode \"%s\"\n"), file_name, count, expected, file_mode);
|
||||
}
|
||||
return (count == expected) ? 0 : -1;
|
||||
}
|
||||
|
||||
static int test_console_io(void)
|
||||
{
|
||||
TCHAR buffer[81];
|
||||
TCHAR ch;
|
||||
int i, j;
|
||||
|
||||
_tprintf(_T("Enter a line for echoing:\n"));
|
||||
|
||||
//for (i = 0; (i < 80) && ((ch = _gettchar()) != _TEOF) && (ch != _T('\n')); i++) {
|
||||
for (i = 0; (i < 80) && ((ch = _gettc(stdin)) != _TEOF) && (ch != _T('\n')); i++) {
|
||||
buffer[i] = (TCHAR)ch;
|
||||
}
|
||||
buffer[i] = _T('\0');
|
||||
for (j = 0; j < i; j++) {
|
||||
_puttc(buffer[j], stdout);
|
||||
}
|
||||
_puttc(_T('\n'), stdout);
|
||||
_tprintf(_T("%s\n"), buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_console_getchar(void)
|
||||
{
|
||||
int result = 0;
|
||||
TCHAR ch;
|
||||
|
||||
_tprintf(_T("Enter lines for dumping or <ctrl-z><nl> to finish:\n"));
|
||||
|
||||
//while ((ch = _gettchar()) != _TEOF) {
|
||||
while ((ch = _gettc(stdin)) != _TEOF) {
|
||||
_tprintf(_THEX_FORMAT, ch);
|
||||
//printf("0x%04x ", ch);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_console_putch(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
_putch('1');
|
||||
_putch('@');
|
||||
_putch('3');
|
||||
_putch(':');
|
||||
_putch('\n');
|
||||
_putch('a');
|
||||
_putch('B');
|
||||
_putch('c');
|
||||
_putch(':');
|
||||
_putch('\n');
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_unlink_files(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
//printf("sizeof dos_data: %d\n", sizeof(dos_data));
|
||||
//printf("sizeof nix_data: %d\n", sizeof(nix_data));
|
||||
|
||||
result |= _tunlink(_T("binary.dos"));
|
||||
result |= _tunlink(_T("binary.nix"));
|
||||
result |= _tunlink(_T("text.dos"));
|
||||
result |= _tunlink(_T("text.nix"));
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_text_fileio(TCHAR* file_name, TCHAR* file_data, int tsize, int bsize)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
result = create_test_file(file_name, _T("w"), _T("r"), file_data);
|
||||
result = check_file_size(file_name, _T("r"), tsize);
|
||||
result = check_file_size(file_name, _T("rb"), bsize);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_binary_fileio(TCHAR* file_name, TCHAR* file_data, int tsize, int bsize)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
result = create_test_file(file_name, _T("wb"), _T("rb"), file_data);
|
||||
result = check_file_size(file_name, _T("r"), tsize);
|
||||
result = check_file_size(file_name, _T("rb"), bsize);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int test_files(int test_num, char* type)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
printf("performing test: %d (%s)\n", test_num, type);
|
||||
|
||||
|
||||
if (test_file_truncate(_T("zerosize.foo"))) {
|
||||
printf("System unable to truncate files yet, unlinking:\n");
|
||||
test_unlink_files();
|
||||
}
|
||||
|
||||
switch (test_num) {
|
||||
case 1:
|
||||
result = test_text_fileio(_T("text.dos"), dos_data, 166, TEST_B1_FILE_SIZE);
|
||||
break;
|
||||
case 2:
|
||||
result = test_binary_fileio(_T("binary.dos"), dos_data, TEST_B2_FILE_SIZE, 166);
|
||||
break;
|
||||
case 3:
|
||||
result = test_text_fileio(_T("text.nix"), nix_data, 162, TEST_B3_FILE_SIZE);
|
||||
break;
|
||||
case 4:
|
||||
result = test_binary_fileio(_T("binary.nix"), nix_data, TEST_B4_FILE_SIZE, 162);
|
||||
break;
|
||||
case 5:
|
||||
result = test_console_io();
|
||||
break;
|
||||
case 6:
|
||||
result = test_console_getchar();
|
||||
break;
|
||||
case 7:
|
||||
result = test_console_putch();
|
||||
break;
|
||||
case -1:
|
||||
result = test_unlink_files();
|
||||
break;
|
||||
default:
|
||||
_tprintf(_T("no test number selected\n"));
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* _fileio.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#undef UNICODE
|
||||
#undef _UNICODE
|
||||
#include "_tfileio.c"
|
||||
|
||||
|
||||
int run_ansi_tests(int test_num)
|
||||
{
|
||||
return test_files(test_num, "ANSI");
|
||||
}
|
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* main.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
||||
#define VERSION 1
|
||||
|
||||
#ifdef UNICODE
|
||||
#define TARGET "UNICODE"
|
||||
#else
|
||||
#define TARGET "MBCS"
|
||||
#endif
|
||||
|
||||
BOOL verbose_flagged = 0;
|
||||
BOOL status_flagged = 0;
|
||||
|
||||
int usage(char* argv0)
|
||||
{
|
||||
printf("USAGE: %s test_id [unicode]|[ansi] [clean]|[status][verbose]\n", argv0);
|
||||
printf("\tWhere test_id is one of:\n");
|
||||
printf("\t0 - (default) regression mode, run tests 1-4 displaying failures only\n");
|
||||
printf("\t1 - Write DOS style eol data to file in text mode (text.dos)\n");
|
||||
printf("\t2 - Write NIX style eol data to file in binary mode (binary.dos)\n");
|
||||
printf("\t3 - Write DOS style eol data to file in text mode (text.nix)\n");
|
||||
printf("\t4 - Write NIX style eol data to file in binary mode (binary.nix)\n");
|
||||
printf("\t5 - Echo console line input\n");
|
||||
printf("\t6 - Dump console line input in hex format\n");
|
||||
printf("\t7 - The source code is your friend\n");
|
||||
printf("\t[unicode] - perform tests using UNICODE versions of library functions\n");
|
||||
printf("\t[ansi] - perform tests using ANSI versions of library functions\n");
|
||||
printf("\t If neither unicode or ansi is specified build default is used\n");
|
||||
printf("\t[clean] - delete all temporary test output files\n");
|
||||
printf("\t[status] - enable extra status display while running\n");
|
||||
printf("\t[verbose] - enable verbose output when running\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
{
|
||||
int test_num = 0;
|
||||
int version = 0;
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
|
||||
printf("%s test application - build %03d (default: %s)\n", argv[0], VERSION, TARGET);
|
||||
if (argc < 2) {
|
||||
return usage(argv[0]);
|
||||
}
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strstr(argv[i], "ansi") || strstr(argv[i], "ANSI")) {
|
||||
version = 1;
|
||||
} else if (strstr(argv[i], "unicode") || strstr(argv[i], "UNICODE")) {
|
||||
version = 2;
|
||||
} else if (strstr(argv[i], "clean") || strstr(argv[i], "CLEAN")) {
|
||||
test_num = -1;
|
||||
} else if (strstr(argv[i], "verbose") || strstr(argv[i], "VERBOSE")) {
|
||||
verbose_flagged = 1;
|
||||
} else if (strstr(argv[i], "status") || strstr(argv[i], "STATUS")) {
|
||||
status_flagged = 1;
|
||||
} else {
|
||||
test_num = atoi(argv[1]);
|
||||
//if (test_num < 0
|
||||
}
|
||||
}
|
||||
for (i = test_num; i <= test_num; i++) {
|
||||
if (!test_num) {
|
||||
test_num = 4;
|
||||
i = 1;
|
||||
}
|
||||
switch (version) {
|
||||
case 1:
|
||||
result = run_ansi_tests(i);
|
||||
break;
|
||||
case 2:
|
||||
result = run_unicode_tests(i);
|
||||
break;
|
||||
default:
|
||||
result = run_ansi_tests(i);
|
||||
result = run_unicode_tests(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("finished\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
||||
char* args[] = { "fileio.exe", "0", "unicode", "verbose"};
|
||||
|
||||
int __cdecl mainCRTStartup(void)
|
||||
{
|
||||
main(2, args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /*__GNUC__*/
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* main.h
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
int app_main(int argc, char* argv[]);
|
||||
DWORD GetInput(char* Buffer, int buflen);
|
||||
|
||||
int test_ansi_files(int test_num);
|
||||
int test_unicode_files(int test_num);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // __MAIN_H__
|
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# $Id: makefile,v 1.0
|
||||
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TEST_ROOT = $(PATH_TO_TOP)/apps/testsets/test
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = fileio
|
||||
|
||||
#TARGET_CFLAGS = -I$(TEST_ROOT) -DDBG -DUNICODE -D_UNICODE
|
||||
TARGET_CFLAGS = -I$(TEST_ROOT) -DDBG
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o wfileio.o main.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
*
|
||||
* wfileio.c
|
||||
*
|
||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#include "_tfileio.c"
|
||||
|
||||
|
||||
int run_unicode_tests(int test_num)
|
||||
{
|
||||
return test_files(test_num, "UNICODE");
|
||||
}
|
@@ -1,71 +0,0 @@
|
||||
#
|
||||
# ReactOS system utilities makefile
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
||||
# Console system utilities
|
||||
# cabman cat net objdir partinfo pice ps sc stats
|
||||
UTIL_APPS = cat objdir partinfo pnpdump sc shutdown stats tickcount consw ps
|
||||
|
||||
UTIL_NET_APPS = arp finger ftp ipconfig netstat ping route telnet whois
|
||||
|
||||
|
||||
all: $(UTIL_APPS) $(UTIL_NET_APPS)
|
||||
|
||||
depends:
|
||||
|
||||
implib: $(UTIL_APPS:%=%_implib) \
|
||||
$(UTIL_NET_APPS:%=%_implib)
|
||||
|
||||
clean: $(UTIL_APPS:%=%_clean) \
|
||||
$(UTIL_NET_APPS:%=%_clean)
|
||||
|
||||
install: $(UTIL_APPS:%=%_install) \
|
||||
$(UTIL_NET_APPS:%=%_install)
|
||||
|
||||
.PHONY: all depends implib clean install
|
||||
|
||||
|
||||
#
|
||||
# Utility Applications
|
||||
#
|
||||
$(UTIL_APPS): %:
|
||||
$(MAKE) -C $*
|
||||
|
||||
$(UTIL_APPS:%=%_implib): %_implib:
|
||||
$(MAKE) -C $* implib
|
||||
|
||||
$(UTIL_APPS:%=%_clean): %_clean:
|
||||
$(MAKE) -C $* clean
|
||||
|
||||
$(UTIL_APPS:%=%_install): %_install:
|
||||
$(MAKE) -C $* install
|
||||
|
||||
.PHONY: $(UTIL_APPS) $(UTIL_APPS:%=%_implib) $(UTIL_APPS:%=%_clean) $(UTIL_APPS:%=%_install)
|
||||
|
||||
#
|
||||
# GUI Utility Applications
|
||||
#
|
||||
$(UTIL_NET_APPS): %:
|
||||
$(MAKE) -C net/$*
|
||||
|
||||
$(UTIL_NET_APPS:%=%_implib): %_implib:
|
||||
$(MAKE) -C net/$* implib
|
||||
|
||||
$(UTIL_NET_APPS:%=%_clean): %_clean:
|
||||
$(MAKE) -C net/$* clean
|
||||
|
||||
$(UTIL_NET_APPS:%=%_install): %_install:
|
||||
$(MAKE) -C net/$* install
|
||||
|
||||
.PHONY: $(UTIL_NET_APPS) $(UTIL_NET_APPS:%=%_implib) $(UTIL_NET_APPS:%=%_clean) $(UTIL_NET_APPS:%=%_install)
|
||||
|
||||
|
||||
etags:
|
||||
find . -name "*.[ch]" -print | etags --language=c -
|
||||
|
||||
# EOF
|
@@ -1,26 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
FILE* in;
|
||||
char ch;
|
||||
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
in = fopen(argv[i],"r");
|
||||
if (in == NULL)
|
||||
{
|
||||
printf("Failed to open file %s\n", argv[i]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
while ((ch = fgetc(in)) != EOF)
|
||||
{
|
||||
putchar(ch);
|
||||
}
|
||||
fclose(in);
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = cat
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,30 +0,0 @@
|
||||
/* $Id$
|
||||
*
|
||||
* DESCRIPTION: Console mode switcher
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* REVISIONS
|
||||
* 2003-07-26 (arty)
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void STDCALL SetConsoleHardwareState( HANDLE conhandle,
|
||||
DWORD flags,
|
||||
DWORD state );
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if( argc > 1 ) {
|
||||
SetConsoleHardwareState( GetStdHandle( STD_INPUT_HANDLE ),
|
||||
0,
|
||||
!strcmp( argv[1], "hw" ) );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
@@ -1,23 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = consw
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,5 +0,0 @@
|
||||
@echo off
|
||||
rem Turn off cosole, run a program, turn console on
|
||||
\reactos\bin\consw sw
|
||||
"%1" "%2" "%3" "%4" "%5" "%6" "%7" "%8" "%9"
|
||||
\reactos\bin\consw hw
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Load a device driver
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <ntos/zw.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING ServiceName;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: load <ServiceName>\n");
|
||||
return 0;
|
||||
}
|
||||
ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
|
||||
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
||||
wsprintf(ServiceName.Buffer,
|
||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
|
||||
argv[1]);
|
||||
wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
||||
Status = NtLoadDriver(&ServiceName);
|
||||
free(ServiceName.Buffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("Failed: %X\n", Status);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = load
|
||||
|
||||
TARGET_CFLAGS = -DUNICODE -D_UNICODE
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,21 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = unload
|
||||
|
||||
TARGET_CFLAGS = -DUNICODE -D_UNICODE
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Unload a device driver
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <ntos/zw.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING ServiceName;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: unload <ServiceName>\n");
|
||||
return 0;
|
||||
}
|
||||
ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
|
||||
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
||||
wsprintf(ServiceName.Buffer,
|
||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
|
||||
argv[1]);
|
||||
wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
||||
Status = NtUnloadDriver(&ServiceName);
|
||||
free(ServiceName.Buffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("Failed: %X\n", Status);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* ReactOS INF Helper
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PROJECT: INF Helper
|
||||
* FILE: infinst.c
|
||||
* PURPOSE: Pass INF files to setupapi.dll for execution
|
||||
* PROGRAMMER: Michael Biggins
|
||||
* UPDATE HISTORY:
|
||||
* Created 19/09/2004
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef UNICODE
|
||||
VOID WINAPI InstallHinfSectionW(HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show);
|
||||
#define InstallHinfSection InstallHinfSectionW
|
||||
#else
|
||||
VOID WINAPI InstallHinfSectionA(HWND hwnd, HINSTANCE handle, LPCSTR cmdline, INT show);
|
||||
#define InstallHinfSection InstallHinfSectionA
|
||||
#endif
|
||||
|
||||
#define FILEOPEN_FILTER TEXT("Inf Files (*.inf)\0*.inf\0All Files (*.*)\0*.*\0\0")
|
||||
#define FILEOPEN_TITLE TEXT("INF file to process")
|
||||
#define FILEOPEN_DEFEXT TEXT(".inf")
|
||||
#define INF_COMMAND TEXT("DefaultInstall 128 %s")
|
||||
|
||||
int
|
||||
_tmain(int argc, TCHAR *argv[])
|
||||
{
|
||||
TCHAR infCommand[MAX_PATH + 32];
|
||||
|
||||
if (argc <= 1)
|
||||
{
|
||||
TCHAR FileName[MAX_PATH + 1];
|
||||
OPENFILENAME ofc;
|
||||
int rv;
|
||||
|
||||
ZeroMemory(&ofc, sizeof(ofc));
|
||||
ZeroMemory(FileName, MAX_PATH + 1);
|
||||
ofc.lStructSize = sizeof(ofc);
|
||||
ofc.lpstrFilter = FILEOPEN_FILTER;
|
||||
ofc.nFilterIndex = 1;
|
||||
ofc.lpstrTitle = FILEOPEN_TITLE;
|
||||
ofc.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_PATHMUSTEXIST;
|
||||
ofc.lpstrDefExt = FILEOPEN_DEFEXT;
|
||||
ofc.lpstrFile = FileName;
|
||||
ofc.nMaxFile = sizeof(FileName) / sizeof(TCHAR);
|
||||
|
||||
rv = GetOpenFileName(&ofc);
|
||||
|
||||
if (rv == 0)
|
||||
return 1;
|
||||
|
||||
_stprintf(infCommand, INF_COMMAND, FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_tcslen(argv[1]) > MAX_PATH)
|
||||
{
|
||||
MessageBox(NULL, TEXT("Command line too long to be a valid file name"), NULL, MB_OK | MB_ICONERROR);
|
||||
return 2; /* User error */
|
||||
}
|
||||
_stprintf(infCommand, INF_COMMAND, argv[1]);
|
||||
}
|
||||
|
||||
InstallHinfSection(NULL, NULL, infCommand, 0);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = infinst
|
||||
|
||||
TARGET_SDKLIBS = comdlg32.a setupapi.a
|
||||
|
||||
TARGET_OBJECTS = infinst.o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* arp - display ARP cache from the IP stack parameters.
|
||||
*
|
||||
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
|
||||
*
|
||||
* Robert Dickenson <robd@reactos.org>, August 15, 2002.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <iptypes.h>
|
||||
#include <ipexport.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <snmp.h>
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
VOID SNMP_FUNC_TYPE SnmpSvcInitUptime();
|
||||
DWORD SNMP_FUNC_TYPE SnmpSvcGetUptime();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char szUsage[] = { "\n" \
|
||||
"Displays and modifies the IP Protocol to physical address translation tables\n" \
|
||||
"used by address resolution protocol (ARP).\n" \
|
||||
"\n" \
|
||||
"ARP -s inet_addr eth_addr [if_addr]\n" \
|
||||
"ARP -d inet_addr [if_addr]\n" \
|
||||
"ARP -a [inet_addr] [-N if_addr]\n" \
|
||||
"\n" \
|
||||
" -a Displays the active ARP table by querying the current protocol\n" \
|
||||
" data. If inet_addr is specified, the IP and physical addresses\n" \
|
||||
" for the specified address are displayed. If more than one\n" \
|
||||
" network interface is using ARP, each interfaces ARP table is\n" \
|
||||
" displayed.\n" \
|
||||
" -g Indentical to -a.\n" \
|
||||
" inet_addr Specifies the IP address.\n" \
|
||||
" -N if_addr Displays the ARP table for the specified interface only\n" \
|
||||
" -d Deletes the host entry specified by inet_addr. inet_addr may be\n" \
|
||||
" wildcarded with * to delete all host entries in the ARP table.\n" \
|
||||
" -s Adds the host and associates the IP address inet_addr with the\n" \
|
||||
" physical address eth_addr. The physical address must be specified\n" \
|
||||
" as 6 hexadecimal characters delimited by hyphens. The new entry\n" \
|
||||
" will become permanent in the ARP table.\n" \
|
||||
" eth_addr Specifies the interface physical address.\n" \
|
||||
" if_addr If present, this specifies the IP address of the interface whose\n" \
|
||||
" address translation table should be modified. If not present, the\n" \
|
||||
" first applicable interface will be used.\n" \
|
||||
"Example:\n" \
|
||||
" > arp -s 192.168.0.12 55-AA-55-01-02-03 .... Static entry creation.\n" \
|
||||
" > arp -a .... ARP table display.\n" \
|
||||
" > arp -d * .... Delete all ARP table entries.\n"
|
||||
};
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
// fprintf(stderr,"USAGE:\n");
|
||||
fputs(szUsage, stderr);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
TCHAR szComputerName[50];
|
||||
DWORD dwSize = 50;
|
||||
|
||||
int nBytes = 500;
|
||||
BYTE* pCache;
|
||||
|
||||
if (argc > 1) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
SnmpSvcInitUptime();
|
||||
|
||||
GetComputerName(szComputerName, &dwSize);
|
||||
_tprintf(_T("ReactOS ARP cache on Computer Name: %s\n"), szComputerName);
|
||||
|
||||
pCache = (BYTE*)SnmpUtilMemAlloc(nBytes);
|
||||
|
||||
Sleep(2500);
|
||||
|
||||
if (pCache != NULL) {
|
||||
|
||||
DWORD dwUptime = SnmpSvcGetUptime();
|
||||
|
||||
_tprintf(_T("SNMP uptime: %d\n"), dwUptime);
|
||||
|
||||
SnmpUtilMemFree(pCache);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n"));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1,6 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 arp\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "arp\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "arp.exe\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,19 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = arp
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32API
|
||||
|
||||
TARGET_SDKLIBS = user32.a snmpapi.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,53 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
|
||||
void _DebugBreak(void)
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
|
||||
void Trace(TCHAR* lpszFormat, ...)
|
||||
{
|
||||
va_list args;
|
||||
int nBuf;
|
||||
TCHAR szBuffer[512];
|
||||
|
||||
va_start(args, lpszFormat);
|
||||
nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
|
||||
OutputDebugString(szBuffer);
|
||||
// was there an error? was the expanded string too long?
|
||||
//ASSERT(nBuf >= 0);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg)
|
||||
{
|
||||
if (msg == NULL) {
|
||||
printf("ASSERT -- %s occured on line %u of file %s.\n",
|
||||
assert, line, file);
|
||||
} else {
|
||||
printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
|
||||
assert, line, file, msg);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Trace(TCHAR* lpszFormat, ...) { };
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg) { };
|
||||
|
||||
#endif //_DEBUG
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#ifndef __TRACE_H__
|
||||
#define __TRACE_H__
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#ifdef _X86_
|
||||
#define BreakPoint() _asm { int 3h }
|
||||
#else
|
||||
#define BreakPoint() _DebugBreak()
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, NULL); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
} \
|
||||
|
||||
#define ASSERTMSG(exp, msg) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, msg); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// MACRO: TRACE()
|
||||
//=============================================================================
|
||||
|
||||
#define TRACE Trace
|
||||
|
||||
|
||||
#else // _DEBUG
|
||||
|
||||
//=============================================================================
|
||||
// Define away MACRO's ASSERT() and TRACE() in non debug builds
|
||||
//=============================================================================
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp)
|
||||
#define ASSERTMSG(exp, msg)
|
||||
#endif
|
||||
|
||||
#define TRACE 0 ? (void)0 : Trace
|
||||
|
||||
#endif // !_DEBUG
|
||||
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg);
|
||||
void Trace(TCHAR* lpszFormat, ...);
|
||||
|
||||
|
||||
#endif // __TRACE_H__
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@@ -1,23 +0,0 @@
|
||||
July 22, 1999
|
||||
|
||||
To All Licensees, Distributors of Any Version of BSD:
|
||||
|
||||
As you know, certain of the Berkeley Software Distribution ("BSD") source code files
|
||||
require that further distributions of products containing all or portions of the
|
||||
software, acknowledge within their advertising materials that such products contain
|
||||
software developed by UC Berkeley and its contributors.
|
||||
|
||||
Specifically, the provision reads:
|
||||
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
|
||||
Effective immediately, licensees and distributors are no longer required to include
|
||||
the acknowledgement within advertising materials. Accordingly, the foregoing paragraph
|
||||
of those BSD Unix files containing it is hereby deleted in its entirety.
|
||||
|
||||
William Hoskins
|
||||
Director, Office of Technology Licensing
|
||||
University of California, Berkeley "
|
@@ -1,180 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "err.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
extern char *__progname; /* Program name, from crt0. */
|
||||
|
||||
void
|
||||
#ifdef __STDC__
|
||||
err(int eval, const char *fmt, ...)
|
||||
#else
|
||||
err(eval, fmt, va_alist)
|
||||
int eval;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
verr(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
verr(int eval, const char *fmt, va_list ap)
|
||||
{
|
||||
int sverrno;
|
||||
|
||||
sverrno = errno;
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL) {
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, ": ");
|
||||
}
|
||||
(void)fprintf(stderr, "%s\n", strerror(sverrno));
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
errx(int eval, const char *fmt, ...)
|
||||
#else
|
||||
errx(eval, fmt, va_alist)
|
||||
int eval;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
verrx(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
verrx(int eval, const char *fmt, va_list ap)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL)
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, "\n");
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
warn(const char *fmt, ...)
|
||||
#else
|
||||
warn(fmt, va_alist)
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
vwarn(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
vwarn(fmt, ap)
|
||||
const char *fmt;
|
||||
va_list ap;
|
||||
{
|
||||
int sverrno;
|
||||
|
||||
sverrno = errno;
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL) {
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, ": ");
|
||||
}
|
||||
(void)fprintf(stderr, "%s\n", strerror(sverrno));
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef __STDC__
|
||||
warnx(const char *fmt, ...)
|
||||
#else
|
||||
warnx(fmt, va_alist)
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
vwarnx(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
vwarnx(fmt, ap)
|
||||
const char *fmt;
|
||||
va_list ap;
|
||||
{
|
||||
(void)fprintf(stderr, "%s: ", __progname);
|
||||
if (fmt != NULL)
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
(void)fprintf(stderr, "\n");
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)err.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _ERR_H_
|
||||
#define _ERR_H_
|
||||
|
||||
/*
|
||||
* Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two
|
||||
* places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
|
||||
* of them here we may collide with the utility's includes. It's unreasonable
|
||||
* for utilities to have to include one of them to include err.h, so we get
|
||||
* _BSD_VA_LIST_ from <machine/ansi.h> and use it.
|
||||
*/
|
||||
/*#include <machine/ansi.h>*/
|
||||
/*#include <sys/cdefs.h>*/
|
||||
#include "various.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
void err __P((int, const char *, ...));
|
||||
void verr __P((int, const char *, va_list));
|
||||
void errx __P((int, const char *, ...));
|
||||
void verrx __P((int, const char *, va_list));
|
||||
void warn __P((const char *, ...));
|
||||
void vwarn __P((const char *, va_list));
|
||||
void warnx __P((const char *, ...));
|
||||
void vwarnx __P((const char *, va_list));
|
||||
|
||||
#endif /* !_ERR_H_ */
|
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* 8/2/97 - Ted Felix <tfelix@fred.net>
|
||||
* Ported to Win32 from 4.4BSD-LITE2 at wcarchive.
|
||||
* NT Workstation already has finger, and it runs fine under
|
||||
* Win95. Thought I'd do this anyways since not everyone has
|
||||
* access to NT.
|
||||
* Had to remove local handling. Otherwise, same as whois.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1989, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Finger prints out information about users. It is not portable since
|
||||
* certain fields (e.g. the full user name, office, and phone numbers) are
|
||||
* extracted from the gecos field of the passwd file which other UNIXes
|
||||
* may not have or may use for other things.
|
||||
*
|
||||
* There are currently two output formats; the short format is one line
|
||||
* per user and displays login name, tty, login time, real name, idle time,
|
||||
* and office location/phone number. The long format gives the same
|
||||
* information (in a more legible format) as well as home directory, shell,
|
||||
* mail info, and .plan/.project files.
|
||||
*/
|
||||
|
||||
#include <winsock2.h>
|
||||
#include "err.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "unistd.h"
|
||||
|
||||
#include "various.h"
|
||||
#include "getopt.h"
|
||||
|
||||
char *__progname;
|
||||
|
||||
time_t now;
|
||||
int lflag, mflag, pplan, sflag;
|
||||
|
||||
static void userlist(int, char **);
|
||||
void usage();
|
||||
void netfinger(char *);
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "lmps")) != EOF)
|
||||
switch(ch) {
|
||||
case 'l':
|
||||
lflag = 1; /* long format */
|
||||
break;
|
||||
case 'm':
|
||||
mflag = 1; /* force exact match of names */
|
||||
break;
|
||||
case 'p':
|
||||
pplan = 1; /* don't show .plan/.project */
|
||||
break;
|
||||
case 's':
|
||||
sflag = 1; /* short format */
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
(void)fprintf(stderr,
|
||||
"usage: finger [-lmps] login [...]\n");
|
||||
exit(1);
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
(void)time(&now);
|
||||
if (!*argv) {
|
||||
usage();
|
||||
} else {
|
||||
userlist(argc, argv);
|
||||
/*
|
||||
* Assign explicit "large" format if names given and -s not
|
||||
* explicitly stated. Force the -l AFTER we get names so any
|
||||
* remote finger attempts specified won't be mishandled.
|
||||
*/
|
||||
if (!sflag)
|
||||
lflag = 1; /* if -s not explicit, force -l */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
userlist(int argc, char **argv)
|
||||
{
|
||||
int *used;
|
||||
char **ap, **nargv, **np, **p;
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int iErr;
|
||||
|
||||
|
||||
if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL ||
|
||||
(used = calloc(argc, sizeof(int))) == NULL)
|
||||
err(1, NULL);
|
||||
|
||||
/* Pull out all network requests into nargv. */
|
||||
for (ap = p = argv, np = nargv; *p; ++p)
|
||||
if (index(*p, '@'))
|
||||
*np++ = *p;
|
||||
else
|
||||
*ap++ = *p;
|
||||
|
||||
*np++ = NULL;
|
||||
*ap++ = NULL;
|
||||
|
||||
/* If there are local requests */
|
||||
if (*argv)
|
||||
{
|
||||
fprintf(stderr, "Warning: Can't do local finger\n");
|
||||
}
|
||||
|
||||
/* Start winsock */
|
||||
wVersionRequested = MAKEWORD( 1, 1 );
|
||||
iErr = WSAStartup( wVersionRequested, &wsaData );
|
||||
if ( iErr != 0 )
|
||||
{
|
||||
/* Tell the user that we couldn't find a usable */
|
||||
/* WinSock DLL. */
|
||||
fprintf(stderr, "WSAStartup failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle network requests. */
|
||||
for (p = nargv; *p;)
|
||||
netfinger(*p++);
|
||||
|
||||
/* Bring down winsock */
|
||||
WSACleanup();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: finger [-lmps] login [...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@@ -1,6 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 finger\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "finger\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "finger.exe\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1987 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Fri Jun 13 10:39:00 1997, tfelix@fred.net:
|
||||
* Ported to Win32, changed index/rindex to strchr/strrchr
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* get option letter from argument vector
|
||||
*/
|
||||
int opterr = 1, /* if error message should be printed */
|
||||
optind = 1, /* index into parent argv vector */
|
||||
optopt; /* character checked for validity */
|
||||
char *optarg; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define EMSG ""
|
||||
|
||||
int
|
||||
getopt(int nargc, char * const *nargv, const char *ostr)
|
||||
{
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
register char *oli; /* option letter list index */
|
||||
char *p;
|
||||
|
||||
if (!*place) { /* update scanning pointer */
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return(EOF);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return(EOF);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
!(oli = strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means EOF.
|
||||
*/
|
||||
if (optopt == (int)'-')
|
||||
return(EOF);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr) {
|
||||
if (!(p = strrchr(*nargv, '/')))
|
||||
p = *nargv;
|
||||
else
|
||||
++p;
|
||||
(void)fprintf(stderr, "%s: illegal option -- %c\n",
|
||||
p, optopt);
|
||||
}
|
||||
return(BADCH);
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place)
|
||||
++optind;
|
||||
}
|
||||
else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (!(p = strrchr(*nargv, '/')))
|
||||
p = *nargv;
|
||||
else
|
||||
++p;
|
||||
if (opterr)
|
||||
(void)fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
p, optopt);
|
||||
return(BADCH);
|
||||
}
|
||||
else /* white space */
|
||||
optarg = nargv[optind];
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return(optopt); /* dump back option letter */
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
/* getopt.h */
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
int
|
||||
getopt(int nargc, char * const *nargv, const char *ostr);
|
@@ -1,24 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = finger
|
||||
|
||||
TARGET_SDKLIBS = ws2_32.a
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32_SOCKETS
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o \
|
||||
err.o \
|
||||
getopt.o \
|
||||
net.o
|
||||
|
||||
TARGET_GCCLIBS = iberty
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <winsock2.h>
|
||||
#include "unistd.h"
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "various.h"
|
||||
|
||||
void
|
||||
netfinger(char *name)
|
||||
{
|
||||
extern int lflag;
|
||||
char c, lastc;
|
||||
struct in_addr defaddr;
|
||||
struct hostent *hp, def;
|
||||
struct servent *sp;
|
||||
struct sockaddr_in sin;
|
||||
int s;
|
||||
char *alist[1], *host;
|
||||
|
||||
/* If this is a local request */
|
||||
if (!(host = rindex(name, '@')))
|
||||
return;
|
||||
|
||||
*host++ = NULL;
|
||||
if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) {
|
||||
def.h_name = host;
|
||||
def.h_addr_list = alist;
|
||||
def.h_addr = (char *)&defaddr;
|
||||
def.h_length = sizeof(struct in_addr);
|
||||
def.h_addrtype = AF_INET;
|
||||
def.h_aliases = 0;
|
||||
hp = &def;
|
||||
} else if (!(hp = gethostbyname(host))) {
|
||||
(void)fprintf(stderr,
|
||||
"finger: unknown host: %s\n", host);
|
||||
return;
|
||||
}
|
||||
if (!(sp = getservbyname("finger", "tcp"))) {
|
||||
(void)fprintf(stderr, "finger: tcp/finger: unknown service\n");
|
||||
return;
|
||||
}
|
||||
sin.sin_family = hp->h_addrtype;
|
||||
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
|
||||
sin.sin_port = sp->s_port;
|
||||
if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {
|
||||
perror("finger: socket");
|
||||
return;
|
||||
}
|
||||
|
||||
/* have network connection; identify the host connected with */
|
||||
(void)printf("[%s]\n", hp->h_name);
|
||||
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
|
||||
fprintf(stderr, "finger: connect rc = %d", WSAGetLastError());
|
||||
(void)close(s);
|
||||
return;
|
||||
}
|
||||
|
||||
/* -l flag for remote fingerd */
|
||||
if (lflag)
|
||||
send(s, "/W ", 3, 0);
|
||||
/* send the name followed by <CR><LF> */
|
||||
send(s, name, strlen(name), 0);
|
||||
send(s, "\r\n", 2, 0);
|
||||
|
||||
/*
|
||||
* Read from the remote system; once we're connected, we assume some
|
||||
* data. If none arrives, we hang until the user interrupts.
|
||||
*
|
||||
* If we see a <CR> or a <CR> with the high bit set, treat it as
|
||||
* a newline; if followed by a newline character, only output one
|
||||
* newline.
|
||||
*
|
||||
* Otherwise, all high bits are stripped; if it isn't printable and
|
||||
* it isn't a space, we can simply set the 7th bit. Every ASCII
|
||||
* character with bit 7 set is printable.
|
||||
*/
|
||||
lastc = 0;
|
||||
while (recv(s, &c, 1, 0) == 1) {
|
||||
c &= 0x7f;
|
||||
if (c == 0x0d) {
|
||||
if (lastc == '\r') /* ^M^M - skip dupes */
|
||||
continue;
|
||||
c = '\n';
|
||||
lastc = '\r';
|
||||
} else {
|
||||
if (!isprint(c) && !isspace(c))
|
||||
c |= 0x40;
|
||||
if (lastc != '\r' || c != '\n')
|
||||
lastc = c;
|
||||
else {
|
||||
lastc = '\n';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
putchar(c);
|
||||
}
|
||||
if (lastc != '\n')
|
||||
putchar('\n');
|
||||
putchar('\n');
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
// Various things you need when porting BSD and GNU utilities to
|
||||
// Win32.
|
||||
|
||||
#ifndef VARIOUS_H
|
||||
#define VARIOUS_H
|
||||
|
||||
|
||||
typedef float f4byte_t;
|
||||
typedef double f8byte_t;
|
||||
typedef long uid_t; // SunOS 5.5
|
||||
|
||||
#define __P(x) x
|
||||
|
||||
/* utmp.h */
|
||||
#define UT_LINESIZE 8
|
||||
#define UT_HOSTSIZE 16
|
||||
|
||||
/* stat.h */
|
||||
#define S_ISREG(mode) (((mode)&0xF000) == 0x8000)
|
||||
#define S_ISDIR(mode) (((mode)&0xF000) == 0x4000)
|
||||
|
||||
#undef MIN //take care of windows default
|
||||
#undef MAX //take care of windows default
|
||||
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
#define bcopy(s1, s2, n) memmove(s2, s1, n)
|
||||
#define bcmp(s1, s2, n) (memcmp(s1, s2, n) != 0)
|
||||
#define bzero(s, n) memset(s, 0, n)
|
||||
|
||||
#define index(s, c) strchr(s, c)
|
||||
#define rindex(s, c) strrchr(s, c)
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@@ -1,185 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1985, 1989 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)cmdtab.c 5.9 (Berkeley) 3/21/89";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
/*
|
||||
* User FTP -- Command Tables.
|
||||
*/
|
||||
int setascii(), setbell(), setbinary(), setdebug(), setform();
|
||||
int setglob(), sethash(), setmode(), setpeer(), setpassive(), setport();
|
||||
int setprompt(), setstruct();
|
||||
int settenex(), settrace(), settype(), setverbose();
|
||||
int disconnect(), restart(), reget(), syst();
|
||||
int cd(), lcd(), delete(), mdelete(), user();
|
||||
int ls(), mls(), get(), mget(), help(), append(), put(), mput();
|
||||
int quit(), renamefile(), status();
|
||||
int quote(), rmthelp(), shell(), site();
|
||||
int pwd(), makedir(), removedir(), setcr();
|
||||
int account(), doproxy(), reset(), setcase(), setntrans(), setnmap();
|
||||
int setsunique(), setrunique(), cdup(), macdef(), domacro();
|
||||
int sizecmd(), modtime(), newer(), rmtstatus();
|
||||
int do_chmod(), do_umask(), idle();
|
||||
|
||||
char accounthelp[] = "send account command to remote server";
|
||||
char appendhelp[] = "append to a file";
|
||||
char asciihelp[] = "set ascii transfer type";
|
||||
char beephelp[] = "beep when command completed";
|
||||
char binaryhelp[] = "set binary transfer type";
|
||||
char casehelp[] = "toggle mget upper/lower case id mapping";
|
||||
char cdhelp[] = "change remote working directory";
|
||||
char cduphelp[] = "change remote working directory to parent directory";
|
||||
char chmodhelp[] = "change file permissions of remote file";
|
||||
char connecthelp[] = "connect to remote tftp";
|
||||
char crhelp[] = "toggle carriage return stripping on ascii gets";
|
||||
char deletehelp[] = "delete remote file";
|
||||
char debughelp[] = "toggle/set debugging mode";
|
||||
char dirhelp[] = "list contents of remote directory";
|
||||
char disconhelp[] = "terminate ftp session";
|
||||
char domachelp[] = "execute macro";
|
||||
char formhelp[] = "set file transfer format";
|
||||
char globhelp[] = "toggle metacharacter expansion of local file names";
|
||||
char hashhelp[] = "toggle printing `#' for each buffer transferred";
|
||||
char helphelp[] = "print local help information";
|
||||
char idlehelp[] = "get (set) idle timer on remote side";
|
||||
char lcdhelp[] = "change local working directory";
|
||||
char lshelp[] = "list contents of remote directory";
|
||||
char macdefhelp[] = "define a macro";
|
||||
char mdeletehelp[] = "delete multiple files";
|
||||
char mdirhelp[] = "list contents of multiple remote directories";
|
||||
char mgethelp[] = "get multiple files";
|
||||
char mkdirhelp[] = "make directory on the remote machine";
|
||||
char mlshelp[] = "list contents of multiple remote directories";
|
||||
char modtimehelp[] = "show last modification time of remote file";
|
||||
char modehelp[] = "set file transfer mode";
|
||||
char mputhelp[] = "send multiple files";
|
||||
char newerhelp[] = "get file if remote file is newer than local file ";
|
||||
char nlisthelp[] = "nlist contents of remote directory";
|
||||
char nmaphelp[] = "set templates for default file name mapping";
|
||||
char ntranshelp[] = "set translation table for default file name mapping";
|
||||
char porthelp[] = "toggle use of PORT cmd for each data connection";
|
||||
char prompthelp[] = "force interactive prompting on multiple commands";
|
||||
char proxyhelp[] = "issue command on alternate connection";
|
||||
char pwdhelp[] = "print working directory on remote machine";
|
||||
char quithelp[] = "terminate ftp session and exit";
|
||||
char quotehelp[] = "send arbitrary ftp command";
|
||||
char receivehelp[] = "receive file";
|
||||
char regethelp[] = "get file restarting at end of local file";
|
||||
char remotehelp[] = "get help from remote server";
|
||||
char renamehelp[] = "rename file";
|
||||
char restarthelp[]= "restart file transfer at bytecount";
|
||||
char rmdirhelp[] = "remove directory on the remote machine";
|
||||
char rmtstatushelp[]="show status of remote machine";
|
||||
char runiquehelp[] = "toggle store unique for local files";
|
||||
char resethelp[] = "clear queued command replies";
|
||||
char sendhelp[] = "send one file";
|
||||
char passivehelp[] = "enter passive transfer mode";
|
||||
char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
|
||||
char shellhelp[] = "escape to the shell";
|
||||
char sizecmdhelp[] = "show size of remote file";
|
||||
char statushelp[] = "show current status";
|
||||
char structhelp[] = "set file transfer structure";
|
||||
char suniquehelp[] = "toggle store unique on remote machine";
|
||||
char systemhelp[] = "show remote system type";
|
||||
char tenexhelp[] = "set tenex file transfer type";
|
||||
char tracehelp[] = "toggle packet tracing";
|
||||
char typehelp[] = "set file transfer type";
|
||||
char umaskhelp[] = "get (set) umask on remote side";
|
||||
char userhelp[] = "send new user information";
|
||||
char verbosehelp[] = "toggle verbose mode";
|
||||
|
||||
struct cmd cmdtab[] = {
|
||||
{ "!", shellhelp, 0, 0, 0, shell },
|
||||
{ "$", domachelp, 1, 0, 0, domacro },
|
||||
{ "account", accounthelp, 0, 1, 1, account},
|
||||
{ "append", appendhelp, 1, 1, 1, put },
|
||||
{ "ascii", asciihelp, 0, 1, 1, setascii },
|
||||
{ "bell", beephelp, 0, 0, 0, setbell },
|
||||
{ "binary", binaryhelp, 0, 1, 1, setbinary },
|
||||
{ "bye", quithelp, 0, 0, 0, quit },
|
||||
{ "case", casehelp, 0, 0, 1, setcase },
|
||||
{ "cd", cdhelp, 0, 1, 1, cd },
|
||||
{ "cdup", cduphelp, 0, 1, 1, cdup },
|
||||
{ "chmod", chmodhelp, 0, 1, 1, do_chmod },
|
||||
{ "close", disconhelp, 0, 1, 1, disconnect },
|
||||
{ "cr", crhelp, 0, 0, 0, setcr },
|
||||
{ "delete", deletehelp, 0, 1, 1, delete },
|
||||
{ "debug", debughelp, 0, 0, 0, setdebug },
|
||||
{ "dir", dirhelp, 1, 1, 1, ls },
|
||||
{ "disconnect", disconhelp, 0, 1, 1, disconnect },
|
||||
{ "form", formhelp, 0, 1, 1, setform },
|
||||
{ "get", receivehelp, 1, 1, 1, get },
|
||||
{ "glob", globhelp, 0, 0, 0, setglob },
|
||||
{ "hash", hashhelp, 0, 0, 0, sethash },
|
||||
{ "help", helphelp, 0, 0, 1, help },
|
||||
{ "idle", idlehelp, 0, 1, 1, idle },
|
||||
{ "image", binaryhelp, 0, 1, 1, setbinary },
|
||||
{ "lcd", lcdhelp, 0, 0, 0, lcd },
|
||||
{ "ls", lshelp, 1, 1, 1, ls },
|
||||
{ "macdef", macdefhelp, 0, 0, 0, macdef },
|
||||
{ "mdelete", mdeletehelp, 1, 1, 1, mdelete },
|
||||
{ "mdir", mdirhelp, 1, 1, 1, mls },
|
||||
{ "mget", mgethelp, 1, 1, 1, mget },
|
||||
{ "mkdir", mkdirhelp, 0, 1, 1, makedir },
|
||||
{ "mls", mlshelp, 1, 1, 1, mls },
|
||||
{ "mode", modehelp, 0, 1, 1, setmode },
|
||||
{ "modtime", modtimehelp, 0, 1, 1, modtime },
|
||||
{ "mput", mputhelp, 1, 1, 1, mput },
|
||||
{ "newer", newerhelp, 1, 1, 1, newer },
|
||||
{ "nmap", nmaphelp, 0, 0, 1, setnmap },
|
||||
{ "nlist", nlisthelp, 1, 1, 1, ls },
|
||||
{ "ntrans", ntranshelp, 0, 0, 1, setntrans },
|
||||
{ "open", connecthelp, 0, 0, 1, setpeer },
|
||||
{ "passive",passivehelp,0, 0, 0, setpassive },
|
||||
{ "prompt", prompthelp, 0, 0, 0, setprompt },
|
||||
{ "proxy", proxyhelp, 0, 0, 1, doproxy },
|
||||
{ "sendport", porthelp, 0, 0, 0, setport },
|
||||
{ "put", sendhelp, 1, 1, 1, put },
|
||||
{ "pwd", pwdhelp, 0, 1, 1, pwd },
|
||||
{ "quit", quithelp, 0, 0, 0, quit },
|
||||
{ "quote", quotehelp, 1, 1, 1, quote },
|
||||
{ "recv", receivehelp, 1, 1, 1, get },
|
||||
{ "reget", regethelp, 1, 1, 1, reget },
|
||||
{ "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus },
|
||||
{ "rhelp", remotehelp, 0, 1, 1, rmthelp },
|
||||
{ "rename", renamehelp, 0, 1, 1, renamefile },
|
||||
{ "reset", resethelp, 0, 1, 1, reset },
|
||||
{ "restart", restarthelp, 1, 1, 1, restart },
|
||||
{ "rmdir", rmdirhelp, 0, 1, 1, removedir },
|
||||
{ "runique", runiquehelp, 0, 0, 1, setrunique },
|
||||
{ "send", sendhelp, 1, 1, 1, put },
|
||||
{ "site", sitehelp, 0, 1, 1, site },
|
||||
{ "size", sizecmdhelp, 1, 1, 1, sizecmd },
|
||||
{ "status", statushelp, 0, 0, 1, status },
|
||||
{ "struct", structhelp, 0, 1, 1, setstruct },
|
||||
{ "system", systemhelp, 0, 1, 1, syst },
|
||||
{ "sunique", suniquehelp, 0, 0, 1, setsunique },
|
||||
{ "tenex", tenexhelp, 0, 1, 1, settenex },
|
||||
{ "trace", tracehelp, 0, 0, 0, settrace },
|
||||
{ "type", typehelp, 0, 1, 1, settype },
|
||||
{ "user", userhelp, 0, 1, 1, user },
|
||||
{ "umask", umaskhelp, 0, 1, 1, do_umask },
|
||||
{ "verbose", verbosehelp, 0, 0, 0, setverbose },
|
||||
{ "?", helphelp, 0, 0, 1, help },
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
|
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1985 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)domacro.c 1.6 (Berkeley) 2/28/89";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "ftp_var.h"
|
||||
#include "prototypes.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
//#include <errno.h>
|
||||
#include <ctype.h>
|
||||
//#include <sys/ttychars.h>
|
||||
|
||||
void domacro(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
register int i, j;
|
||||
register char *cp1, *cp2;
|
||||
int count = 2, loopflg = 0;
|
||||
char line2[200];
|
||||
extern char **glob(), *globerr;
|
||||
struct cmd *getcmd(), *c;
|
||||
extern struct cmd cmdtab[];
|
||||
|
||||
if (argc < 2) {
|
||||
(void) strcat(line, " ");
|
||||
printf("(macro name) ");
|
||||
(void) fflush(stdout);
|
||||
(void) gets(&line[strlen(line)]);
|
||||
makeargv();
|
||||
argc = margc;
|
||||
argv = margv;
|
||||
}
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s macro_name.\n", argv[0]);
|
||||
(void) fflush(stdout);
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < macnum; ++i) {
|
||||
if (!strncmp(argv[1], macros[i].mac_name, 9)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == macnum) {
|
||||
printf("'%s' macro not found.\n", argv[1]);
|
||||
(void) fflush(stdout);
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
(void) strcpy(line2, line);
|
||||
TOP:
|
||||
cp1 = macros[i].mac_start;
|
||||
while (cp1 != macros[i].mac_end) {
|
||||
while (isspace(*cp1)) {
|
||||
cp1++;
|
||||
}
|
||||
cp2 = line;
|
||||
while (*cp1 != '\0') {
|
||||
switch(*cp1) {
|
||||
case '\\':
|
||||
*cp2++ = *++cp1;
|
||||
break;
|
||||
case '$':
|
||||
if (isdigit(*(cp1+1))) {
|
||||
j = 0;
|
||||
while (isdigit(*++cp1)) {
|
||||
j = 10*j + *cp1 - '0';
|
||||
}
|
||||
cp1--;
|
||||
if (argc - 2 >= j) {
|
||||
(void) strcpy(cp2, argv[j+1]);
|
||||
cp2 += strlen(argv[j+1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (*(cp1+1) == 'i') {
|
||||
loopflg = 1;
|
||||
cp1++;
|
||||
if (count < argc) {
|
||||
(void) strcpy(cp2, argv[count]);
|
||||
cp2 += strlen(argv[count]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* intentional drop through */
|
||||
default:
|
||||
*cp2++ = *cp1;
|
||||
break;
|
||||
}
|
||||
if (*cp1 != '\0') {
|
||||
cp1++;
|
||||
}
|
||||
}
|
||||
*cp2 = '\0';
|
||||
makeargv();
|
||||
c = getcmd(margv[0]);
|
||||
if (c == (struct cmd *)-1) {
|
||||
printf("?Ambiguous command\n");
|
||||
code = -1;
|
||||
}
|
||||
else if (c == 0) {
|
||||
printf("?Invalid command\n");
|
||||
code = -1;
|
||||
}
|
||||
else if (c->c_conn && !connected) {
|
||||
printf("Not connected.\n");
|
||||
code = -1;
|
||||
}
|
||||
else {
|
||||
if (verbose) {
|
||||
printf("%s\n",line);
|
||||
}
|
||||
(*c->c_handler)(margc, margv);
|
||||
if (bell && c->c_bell) {
|
||||
(void) putchar('\007');
|
||||
}
|
||||
(void) strcpy(line, line2);
|
||||
makeargv();
|
||||
argc = margc;
|
||||
argv = margv;
|
||||
}
|
||||
if (cp1 != macros[i].mac_end) {
|
||||
cp1++;
|
||||
}
|
||||
(void) fflush(stdout);
|
||||
}
|
||||
if (loopflg && ++count < argc) {
|
||||
goto TOP;
|
||||
}
|
||||
}
|
@@ -1,344 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <winsock.h>
|
||||
#include "prototypes.h"
|
||||
|
||||
#define MAX_ASCII 100
|
||||
|
||||
int checkRecv(SOCKET s);
|
||||
|
||||
int checkRecv(SOCKET s)
|
||||
{
|
||||
int testVal;
|
||||
fd_set sSet;
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 60;
|
||||
|
||||
FD_ZERO(&sSet);
|
||||
|
||||
FD_SET(s, &sSet);
|
||||
|
||||
testVal = select(0, &sSet, NULL, NULL, &timeout);
|
||||
|
||||
if (testVal == SOCKET_ERROR)
|
||||
fprintf(stderr, "Socket Error");
|
||||
|
||||
return testVal;
|
||||
}
|
||||
|
||||
void blkfree(char **av0)
|
||||
{
|
||||
register char **av = av0;
|
||||
|
||||
while (*av)
|
||||
free(*av++);
|
||||
}
|
||||
|
||||
char *glob(register char *v)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int sleep(int time)
|
||||
{
|
||||
return time;
|
||||
}
|
||||
|
||||
int herror(char *string)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
|
||||
int gettimeofday(struct timeval *timenow,
|
||||
struct timezone *zone)
|
||||
{
|
||||
time_t t;
|
||||
|
||||
t = clock();
|
||||
|
||||
timenow->tv_usec = t;
|
||||
timenow->tv_sec = t / CLK_TCK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fgetcSocket(int s)
|
||||
{
|
||||
int c;
|
||||
char buffer[10];
|
||||
|
||||
// checkRecv(s);
|
||||
|
||||
c = recv(s, buffer, 1, 0);
|
||||
|
||||
#ifdef DEBUG_IN
|
||||
printf("%c", buffer[0]);
|
||||
#endif
|
||||
|
||||
if (c == INVALID_SOCKET)
|
||||
return c;
|
||||
|
||||
if (c == 0)
|
||||
return EOF;
|
||||
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int fgetcSocket(int s)
|
||||
{
|
||||
static int index = 0;
|
||||
static int total = 0;
|
||||
static unsigned char buffer[4096];
|
||||
|
||||
if (index == total)
|
||||
{
|
||||
index = 0;
|
||||
total = recv(s, buffer, sizeof(buffer), 0);
|
||||
|
||||
if (total == INVALID_SOCKET)
|
||||
{
|
||||
total = 0;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (total == 0)
|
||||
return EOF;
|
||||
}
|
||||
return buffer[index++];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
char *fprintfSocket(int s, char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char buffer[10009];
|
||||
|
||||
va_start(argptr, format);
|
||||
vsprintf(buffer, format, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
send(s, buffer, strlen(buffer), 0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *fputsSocket(char *format, int s)
|
||||
{
|
||||
send(s, format, strlen(format), 0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int fputcSocket(int s, char putChar)
|
||||
{
|
||||
char buffer[2];
|
||||
|
||||
buffer[0] = putChar;
|
||||
buffer[1] = '\0';
|
||||
|
||||
if(SOCKET_ERROR==send(s, buffer, 1, 0)) {
|
||||
int iret=WSAGetLastError ();
|
||||
fprintf(stdout,"fputcSocket: %d\n",iret);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return putChar;
|
||||
}
|
||||
}
|
||||
int fputSocket(int s, char *buffer, int len)
|
||||
{
|
||||
int iret;
|
||||
while(len) {
|
||||
if(SOCKET_ERROR==(iret=send(s, buffer, len, 0)))
|
||||
{
|
||||
iret=WSAGetLastError ();
|
||||
fprintf(stdout,"fputcSocket: %d\n",iret);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return len-=iret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *fgetsSocket(int s, char *string)
|
||||
{
|
||||
char buffer[2] = {0};
|
||||
int i, count;
|
||||
|
||||
for (i = 0, count = 1; count != 0 && buffer[0] != '\n'; i++)
|
||||
{
|
||||
checkRecv(s);
|
||||
|
||||
count = recv(s, buffer, 1, 0);
|
||||
|
||||
if (count == SOCKET_ERROR)
|
||||
{
|
||||
printf("Error in fgetssocket");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
string[i] = buffer[0];
|
||||
|
||||
if (i == MAX_ASCII - 3)
|
||||
{
|
||||
count = 0;
|
||||
string[++i] = '\n';
|
||||
string[++i] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == 0)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
string[i] = '\n';
|
||||
string[i + 1] = '\0'; // This is risky
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
string[i] = '\0';
|
||||
|
||||
#ifdef DEBUG_IN
|
||||
printf("%s", string);
|
||||
#endif
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
char *getpass(const char *prompt)
|
||||
{
|
||||
static char string[64];
|
||||
|
||||
printf("%s", prompt);
|
||||
|
||||
gets(string);
|
||||
|
||||
return string;
|
||||
}
|
||||
#endif
|
||||
char *getpass (const char * prompt)
|
||||
{
|
||||
static char input[256];
|
||||
HANDLE in;
|
||||
HANDLE err;
|
||||
int count;
|
||||
|
||||
in = GetStdHandle (STD_INPUT_HANDLE);
|
||||
err = GetStdHandle (STD_ERROR_HANDLE);
|
||||
|
||||
if (in == INVALID_HANDLE_VALUE || err == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
|
||||
if (WriteFile (err, prompt, strlen (prompt), &count, NULL))
|
||||
{
|
||||
int istty = (GetFileType (in) == FILE_TYPE_CHAR);
|
||||
DWORD old_flags;
|
||||
int rc;
|
||||
|
||||
if (istty)
|
||||
{
|
||||
if (GetConsoleMode (in, &old_flags))
|
||||
SetConsoleMode (in, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT);
|
||||
else
|
||||
istty = 0;
|
||||
}
|
||||
/* Need to read line one byte at time to avoid blocking, if not a
|
||||
tty, so always do it this way. */
|
||||
count = 0;
|
||||
while (1)
|
||||
{
|
||||
DWORD dummy;
|
||||
char one_char;
|
||||
|
||||
rc = ReadFile (in, &one_char, 1, &dummy, NULL);
|
||||
if (rc == 0)
|
||||
break;
|
||||
if (one_char == '\r')
|
||||
{
|
||||
/* CR is always followed by LF if reading from tty. */
|
||||
if (istty)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (one_char == '\n')
|
||||
break;
|
||||
/* Silently truncate password string if overly long. */
|
||||
if (count < sizeof (input) - 1)
|
||||
input[count++] = one_char;
|
||||
}
|
||||
input[count] = '\0';
|
||||
|
||||
WriteFile (err, "\r\n", 2, &count, NULL);
|
||||
if (istty)
|
||||
SetConsoleMode (in, old_flags);
|
||||
if (rc)
|
||||
return input;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Stubbed out here. Should be changed in Source code...
|
||||
int access(const char *filename, int accessmethod)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define EPOCHFILETIME (116444736000000000i64)
|
||||
#else
|
||||
#define EPOCHFILETIME (116444736000000000LL)
|
||||
#endif
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
LARGE_INTEGER li;
|
||||
__int64 t;
|
||||
static int tzflag;
|
||||
|
||||
if (tv)
|
||||
{
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
//li.LowPart = ft.dwLowDateTime;
|
||||
//li.HighPart = ft.dwHighDateTime;
|
||||
t = li.QuadPart; /* In 100-nanosecond intervals */
|
||||
t -= EPOCHFILETIME; /* Offset to the Epoch time */
|
||||
t /= 10; /* In microseconds */
|
||||
tv->tv_sec = (long)(t / 1000000);
|
||||
tv->tv_usec = (long)(t % 1000000);
|
||||
}
|
||||
|
||||
if (tz)
|
||||
{
|
||||
if (!tzflag)
|
||||
{
|
||||
_tzset();
|
||||
tzflag++;
|
||||
}
|
||||
tz->tz_minuteswest = _timezone / 60;
|
||||
tz->tz_dsttime = _daylight;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
#define bcopy(s,d,l) memcpy((d),(s),(l))
|
||||
#define bzero(cp,l) memset((cp),0,(l))
|
||||
|
||||
#define rindex strrchr
|
||||
#define index strchr
|
||||
|
||||
#define getwd getcwd
|
||||
|
||||
#define strcasecmp strcmp
|
||||
#define strncasecmp strnicmp
|
File diff suppressed because it is too large
Load Diff
@@ -1,372 +0,0 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on ftp.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=ftp - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to ftp - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "ftp - Win32 Release" && "$(CFG)" != "ftp - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ftp.mak" CFG="ftp - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ftp - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "ftp - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\cmds.obj"
|
||||
-@erase "$(INTDIR)\cmdtab.obj"
|
||||
-@erase "$(INTDIR)\domacro.obj"
|
||||
-@erase "$(INTDIR)\fake.obj"
|
||||
-@erase "$(INTDIR)\ftp.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\ruserpass.obj"
|
||||
-@erase "$(INTDIR)\vc*.idb"
|
||||
-@erase "$(OUTDIR)\ftp.exe"
|
||||
-@erase "$(OUTDIR)\ftp.pch"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" \
|
||||
/D "HAVE_TIMEVAL" /Fp"$(INTDIR)\ftp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD\
|
||||
/c
|
||||
CPP_OBJS=.\Release/
|
||||
CPP_SBRS=.
|
||||
|
||||
.c{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftp.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
|
||||
odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
|
||||
/pdb:"$(OUTDIR)\ftp.pdb" /machine:I386 /out:"$(OUTDIR)\ftp.exe"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\cmds.obj" \
|
||||
"$(INTDIR)\cmdtab.obj" \
|
||||
"$(INTDIR)\domacro.obj" \
|
||||
"$(INTDIR)\fake.obj" \
|
||||
"$(INTDIR)\ftp.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\ruserpass.obj"
|
||||
|
||||
"$(OUTDIR)\ftp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
TargetPath=.\Release\ftp.exe
|
||||
InputPath=.\Release\ftp.exe
|
||||
SOURCE=$(InputPath)
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\cmds.obj"
|
||||
-@erase "$(INTDIR)\cmdtab.obj"
|
||||
-@erase "$(INTDIR)\domacro.obj"
|
||||
-@erase "$(INTDIR)\fake.obj"
|
||||
-@erase "$(INTDIR)\ftp.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\ruserpass.obj"
|
||||
-@erase "$(INTDIR)\vc*.idb"
|
||||
-@erase "$(INTDIR)\vc*.pdb"
|
||||
-@erase "$(OUTDIR)\ftp.exe"
|
||||
-@erase "$(OUTDIR)\ftp.ilk"
|
||||
-@erase "$(OUTDIR)\ftp.pdb"
|
||||
-@erase "$(OUTDIR)\ftp.pch"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS"\
|
||||
/Fp"$(INTDIR)\ftp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
CPP_OBJS=.\Debug/
|
||||
CPP_SBRS=.
|
||||
|
||||
.c{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftp.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
|
||||
odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:yes\
|
||||
/pdb:"$(OUTDIR)\ftp.pdb" /debug /machine:I386 /out:"$(OUTDIR)\ftp.exe"\
|
||||
/pdbtype:sept
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\cmds.obj" \
|
||||
"$(INTDIR)\cmdtab.obj" \
|
||||
"$(INTDIR)\domacro.obj" \
|
||||
"$(INTDIR)\fake.obj" \
|
||||
"$(INTDIR)\ftp.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\ruserpass.obj"
|
||||
|
||||
"$(OUTDIR)\ftp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
TargetPath=.\Debug\ftp.exe
|
||||
InputPath=.\Debug\ftp.exe
|
||||
SOURCE=$(InputPath)
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release" || "$(CFG)" == "ftp - Win32 Debug"
|
||||
SOURCE=.\cmds.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_CMDS_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\pathnames.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmds.obj" : $(SOURCE) $(DEP_CPP_CMDS_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_CMDS_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\pathnames.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmds.obj" : $(SOURCE) $(DEP_CPP_CMDS_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\cmdtab.c
|
||||
DEP_CPP_CMDTA=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmdtab.obj" : $(SOURCE) $(DEP_CPP_CMDTA) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\domacro.c
|
||||
DEP_CPP_DOMAC=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\domacro.obj" : $(SOURCE) $(DEP_CPP_DOMAC) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\fake.c
|
||||
DEP_CPP_FAKE_=\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\fake.obj" : $(SOURCE) $(DEP_CPP_FAKE_) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\ftp.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_FTP_C=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ftp.obj" : $(SOURCE) $(DEP_CPP_FTP_C) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_FTP_C=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ftp.obj" : $(SOURCE) $(DEP_CPP_FTP_C) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\main.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_MAIN_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_MAIN_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\ruserpass.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_RUSER=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ruserpass.obj" : $(SOURCE) $(DEP_CPP_RUSER) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_RUSER=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ruserpass.obj" : $(SOURCE) $(DEP_CPP_RUSER) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!ENDIF
|
@@ -1,400 +0,0 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on ftp.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=ftp - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to ftp - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "ftp - Win32 Release" && "$(CFG)" != "ftp - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ftp.mak" CFG="ftp - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ftp - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "ftp - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe" "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe" "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\cmds.obj"
|
||||
-@erase "$(INTDIR)\cmdtab.obj"
|
||||
-@erase "$(INTDIR)\domacro.obj"
|
||||
-@erase "$(INTDIR)\fake.obj"
|
||||
-@erase "$(INTDIR)\ftp.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\ruserpass.obj"
|
||||
-@erase "$(INTDIR)\vc50.idb"
|
||||
-@erase "$(OUTDIR)\ftp.exe"
|
||||
-@erase "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "C:\emacs-19.34\nt\inc" /I\
|
||||
"C:\emacs-19.34\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D\
|
||||
"HAVE_TIMEVAL" /Fp"$(INTDIR)\ftp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD\
|
||||
/c
|
||||
CPP_OBJS=.\Release/
|
||||
CPP_SBRS=.
|
||||
|
||||
.c{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftp.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
|
||||
odbccp32.lib /nologo /subsystem:console /incremental:no\
|
||||
/pdb:"$(OUTDIR)\ftp.pdb" /machine:I386 /out:"$(OUTDIR)\ftp.exe"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\cmds.obj" \
|
||||
"$(INTDIR)\cmdtab.obj" \
|
||||
"$(INTDIR)\domacro.obj" \
|
||||
"$(INTDIR)\fake.obj" \
|
||||
"$(INTDIR)\ftp.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\ruserpass.obj" \
|
||||
"d:\Program Files\DevStudio\VC\lib\WSOCK32.LIB"
|
||||
|
||||
"$(OUTDIR)\ftp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
TargetPath=.\Release\ftp.exe
|
||||
InputPath=.\Release\ftp.exe
|
||||
SOURCE=$(InputPath)
|
||||
|
||||
"\emacs-19.34\bin\ftp.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
# copy $(TargetPath) \emacs-19.34\bin
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe" "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "$(OUTDIR)\ftp.exe" "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\cmds.obj"
|
||||
-@erase "$(INTDIR)\cmdtab.obj"
|
||||
-@erase "$(INTDIR)\domacro.obj"
|
||||
-@erase "$(INTDIR)\fake.obj"
|
||||
-@erase "$(INTDIR)\ftp.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\ruserpass.obj"
|
||||
-@erase "$(INTDIR)\vc50.idb"
|
||||
-@erase "$(INTDIR)\vc50.pdb"
|
||||
-@erase "$(OUTDIR)\ftp.exe"
|
||||
-@erase "$(OUTDIR)\ftp.ilk"
|
||||
-@erase "$(OUTDIR)\ftp.pdb"
|
||||
-@erase "\emacs-19.34\bin\ftp.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "C:\emacs-19.34\nt\inc" /I\
|
||||
"C:\emacs-19.34\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS"\
|
||||
/Fp"$(INTDIR)\ftp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
CPP_OBJS=.\Debug/
|
||||
CPP_SBRS=.
|
||||
|
||||
.c{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftp.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
|
||||
odbccp32.lib /nologo /subsystem:console /incremental:yes\
|
||||
/pdb:"$(OUTDIR)\ftp.pdb" /debug /machine:I386 /out:"$(OUTDIR)\ftp.exe"\
|
||||
/pdbtype:sept
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\cmds.obj" \
|
||||
"$(INTDIR)\cmdtab.obj" \
|
||||
"$(INTDIR)\domacro.obj" \
|
||||
"$(INTDIR)\fake.obj" \
|
||||
"$(INTDIR)\ftp.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\ruserpass.obj" \
|
||||
"d:\Program Files\DevStudio\VC\lib\WSOCK32.LIB"
|
||||
|
||||
"$(OUTDIR)\ftp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
TargetPath=.\Debug\ftp.exe
|
||||
InputPath=.\Debug\ftp.exe
|
||||
SOURCE=$(InputPath)
|
||||
|
||||
"\emacs-19.34\bin\ftp.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
# copy $(TargetPath) \emacs-19.34\bin
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release" || "$(CFG)" == "ftp - Win32 Debug"
|
||||
SOURCE=.\cmds.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_CMDS_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\pathnames.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmds.obj" : $(SOURCE) $(DEP_CPP_CMDS_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_CMDS_=\
|
||||
"..\..\..\emacs-19.34\nt\inc\netdb.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\netinet\in.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\socket.h"\
|
||||
"..\..\..\emacs-19.34\src\nt.h"\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\pathnames.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmds.obj" : $(SOURCE) $(DEP_CPP_CMDS_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\cmdtab.c
|
||||
DEP_CPP_CMDTA=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\cmdtab.obj" : $(SOURCE) $(DEP_CPP_CMDTA) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\domacro.c
|
||||
DEP_CPP_DOMAC=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\domacro.obj" : $(SOURCE) $(DEP_CPP_DOMAC) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\fake.c
|
||||
DEP_CPP_FAKE_=\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\fake.obj" : $(SOURCE) $(DEP_CPP_FAKE_) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\ftp.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_FTP_C=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ftp.obj" : $(SOURCE) $(DEP_CPP_FTP_C) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_FTP_C=\
|
||||
"..\..\..\emacs-19.34\nt\inc\netdb.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\netinet\in.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\pwd.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\file.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\ioctl.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\param.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\socket.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\time.h"\
|
||||
"..\..\..\emacs-19.34\src\nt.h"\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ftp.obj" : $(SOURCE) $(DEP_CPP_FTP_C) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\main.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_MAIN_=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_MAIN_=\
|
||||
"..\..\..\emacs-19.34\nt\inc\netdb.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\pwd.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\ioctl.h"\
|
||||
"..\..\..\emacs-19.34\nt\inc\sys\socket.h"\
|
||||
"..\..\..\emacs-19.34\src\nt.h"\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\ruserpass.c
|
||||
|
||||
!IF "$(CFG)" == "ftp - Win32 Release"
|
||||
|
||||
DEP_CPP_RUSER=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ruserpass.obj" : $(SOURCE) $(DEP_CPP_RUSER) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftp - Win32 Debug"
|
||||
|
||||
DEP_CPP_RUSER=\
|
||||
".\fake.h"\
|
||||
".\ftp_var.h"\
|
||||
".\prototypes.h"\
|
||||
{$(INCLUDE)}"sys\stat.h"\
|
||||
{$(INCLUDE)}"sys\types.h"\
|
||||
|
||||
|
||||
"$(INTDIR)\ruserpass.obj" : $(SOURCE) $(DEP_CPP_RUSER) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!ENDIF
|
@@ -1,6 +0,0 @@
|
||||
/* $Id: route.rc 11816 2004-11-26 06:51:47Z arty $ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 FTP Client\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "ftp\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "ftp.exe\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,181 +0,0 @@
|
||||
#include "fake.h"
|
||||
#include <winsock.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
//typedef void (*Sig_t)(int);
|
||||
|
||||
int fgetcSocket(int s);
|
||||
char *fputsSocket(char *format, int s);
|
||||
|
||||
char *fprintfSocket(int s, char *format, ...);
|
||||
|
||||
int fputcSocket(int s, char putChar);
|
||||
int fputSocket(int s, char *putChar, int len);
|
||||
char *fgetsSocket(int s, char *string);
|
||||
|
||||
/* The following defines are from ftp.h and telnet.h from bsd.h */
|
||||
/* All relevent copyrights below apply. */
|
||||
|
||||
#define IAC 255
|
||||
#define DONT 254
|
||||
#define DO 253
|
||||
#define WONT 252
|
||||
#define WILL 251
|
||||
#define SB 250
|
||||
#define GA 249
|
||||
#define EL 248
|
||||
#define EC 247
|
||||
#define AYT 246
|
||||
#define AO 245
|
||||
#define IP 244
|
||||
#define BREAK 243
|
||||
#define DM 242
|
||||
#define NOP 241
|
||||
#define SE 240
|
||||
#define EOR 239
|
||||
#define ABORT 238
|
||||
#define SUSP 237
|
||||
#define xEOF 236
|
||||
|
||||
|
||||
#define MAXPATHLEN 255
|
||||
#define TYPE_A 'A'
|
||||
#define TYPE_I 'I'
|
||||
#define TYPE_E 'E'
|
||||
#define TYPE_L 'L'
|
||||
|
||||
#define PRELIM 1
|
||||
#define COMPLETE 2
|
||||
#define CONTINUE 3
|
||||
#define TRANSIENT 4
|
||||
|
||||
#define MODE_S 1
|
||||
#define MODE_B 2
|
||||
#define MODE_C 3
|
||||
|
||||
#define STRU_F 1
|
||||
#define STRU_R 2
|
||||
#define STRU_P 3
|
||||
|
||||
#define SIGQUIT 1
|
||||
#define SIGPIPE 2
|
||||
#define SIGALRM 3
|
||||
|
||||
|
||||
#define FORM_N 1
|
||||
#define FORM_T 2
|
||||
#define FORM_C 3
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)ftp_var.h 5.5 (Berkeley) 6/29/88
|
||||
*/
|
||||
|
||||
/*
|
||||
* FTP global variables.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Options and other state info.
|
||||
*/
|
||||
extern int trace; /* trace packets exchanged */
|
||||
extern int hash; /* print # for each buffer transferred */
|
||||
extern int sendport; /* use PORT cmd for each data connection */
|
||||
extern int verbose; /* print messages coming back from server */
|
||||
extern int connected; /* connected to server */
|
||||
extern int fromatty; /* input is from a terminal */
|
||||
extern int interactive; /* interactively prompt on m* cmds */
|
||||
extern int debug; /* debugging level */
|
||||
extern int bell; /* ring bell on cmd completion */
|
||||
extern int doglob; /* glob local file names */
|
||||
extern int proxy; /* proxy server connection active */
|
||||
extern int proxflag; /* proxy connection exists */
|
||||
extern int sunique; /* store files on server with unique name */
|
||||
extern int runique; /* store local files with unique name */
|
||||
extern int mcase; /* map upper to lower case for mget names */
|
||||
extern int ntflag; /* use ntin ntout tables for name translation */
|
||||
extern int mapflag; /* use mapin mapout templates on file names */
|
||||
extern int code; /* return/reply code for ftp command */
|
||||
extern int crflag; /* if 1, strip car. rets. on ascii gets */
|
||||
extern char pasv[64]; /* passive port for proxy data connection */
|
||||
extern int passivemode; /* passive mode enabled */
|
||||
extern char *altarg; /* argv[1] with no shell-like preprocessing */
|
||||
extern char ntin[17]; /* input translation table */
|
||||
extern char ntout[17]; /* output translation table */
|
||||
|
||||
extern char mapin[MAXPATHLEN]; /* input map template */
|
||||
extern char mapout[MAXPATHLEN]; /* output map template */
|
||||
extern char typename[32]; /* name of file transfer type */
|
||||
extern int type; /* file transfer type */
|
||||
extern char structname[32]; /* name of file transfer structure */
|
||||
extern int stru; /* file transfer structure */
|
||||
extern char formname[32]; /* name of file transfer format */
|
||||
extern int form; /* file transfer format */
|
||||
extern char modename[32]; /* name of file transfer mode */
|
||||
extern int mode; /* file transfer mode */
|
||||
extern char bytename[32]; /* local byte size in ascii */
|
||||
extern int bytesize; /* local byte size in binary */
|
||||
|
||||
extern jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||
|
||||
extern char line[200]; /* input line buffer */
|
||||
extern char *stringbase; /* current scan point in line buffer */
|
||||
extern char argbuf[200]; /* argument storage buffer */
|
||||
extern char *argbase; /* current storage point in arg buffer */
|
||||
extern int margc; /* count of arguments on input line */
|
||||
extern char *margv[20]; /* args parsed from input line */
|
||||
extern int cpend; /* flag: if != 0, then pending server reply */
|
||||
extern int mflag; /* flag: if != 0, then active multi command */
|
||||
|
||||
extern int options; /* used during socket creation */
|
||||
|
||||
/*
|
||||
* Format of command table.
|
||||
*/
|
||||
struct cmd {
|
||||
char *c_name; /* name of command */
|
||||
char *c_help; /* help string */
|
||||
char c_bell; /* give bell when command completes */
|
||||
char c_conn; /* must be connected to use command */
|
||||
char c_proxy; /* proxy server may execute */
|
||||
int (*c_handler)(); /* function to call */
|
||||
};
|
||||
|
||||
struct macel {
|
||||
char mac_name[9]; /* macro name */
|
||||
char *mac_start; /* start of macro in macbuf */
|
||||
char *mac_end; /* end of macro in macbuf */
|
||||
};
|
||||
|
||||
int macnum; /* number of defined macros */
|
||||
struct macel macros[16];
|
||||
char macbuf[4096];
|
||||
|
||||
extern char *tail();
|
||||
extern char *remglob();
|
||||
extern int errno;
|
||||
extern char *mktemp();
|
||||
|
||||
#if defined(__ANSI__) || defined(sparc)
|
||||
typedef void sig_t;
|
||||
#else
|
||||
typedef int sig_t;
|
||||
#endif
|
||||
|
||||
typedef int uid_t;
|
||||
int herror(char *s);
|
@@ -1,602 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1985, 1989 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1985, 1989 Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)main.c based on 5.13 (Berkeley) 3/14/89";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* FTP User Program -- Command Interface.
|
||||
*/
|
||||
#if !defined(WIN32)
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <arpa/ftp.h>
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
#include "ftp_var.h"
|
||||
#include "prototypes.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
#if defined(sun) && !defined(FD_SET)
|
||||
typedef int uid_t;
|
||||
#endif
|
||||
|
||||
uid_t getuid();
|
||||
void intr();
|
||||
void lostpeer();
|
||||
char *getlogin();
|
||||
|
||||
short portnum;
|
||||
|
||||
char home[128];
|
||||
char *globerr;
|
||||
int autologin;
|
||||
|
||||
|
||||
|
||||
/* Lot's of options... */
|
||||
/*
|
||||
* Options and other state info.
|
||||
*/
|
||||
int trace; /* trace packets exchanged */
|
||||
int hash; /* print # for each buffer transferred */
|
||||
int sendport; /* use PORT cmd for each data connection */
|
||||
int verbose; /* print messages coming back from server */
|
||||
int connected; /* connected to server */
|
||||
int fromatty; /* input is from a terminal */
|
||||
int interactive; /* interactively prompt on m* cmds */
|
||||
int debug; /* debugging level */
|
||||
int bell; /* ring bell on cmd completion */
|
||||
int doglob; /* glob local file names */
|
||||
int proxy; /* proxy server connection active */
|
||||
int passivemode;
|
||||
int proxflag; /* proxy connection exists */
|
||||
int sunique; /* store files on server with unique name */
|
||||
int runique; /* store local files with unique name */
|
||||
int mcase; /* map upper to lower case for mget names */
|
||||
int ntflag; /* use ntin ntout tables for name translation */
|
||||
int mapflag; /* use mapin mapout templates on file names */
|
||||
int code; /* return/reply code for ftp command */
|
||||
int crflag; /* if 1, strip car. rets. on ascii gets */
|
||||
char pasv[64]; /* passive port for proxy data connection */
|
||||
char *altarg; /* argv[1] with no shell-like preprocessing */
|
||||
char ntin[17]; /* input translation table */
|
||||
char ntout[17]; /* output translation table */
|
||||
// #include <sys/param.h>
|
||||
char mapin[MAXPATHLEN]; /* input map template */
|
||||
char mapout[MAXPATHLEN]; /* output map template */
|
||||
char typename[32]; /* name of file transfer type */
|
||||
int type; /* file transfer type */
|
||||
char structname[32]; /* name of file transfer structure */
|
||||
int stru; /* file transfer structure */
|
||||
char formname[32]; /* name of file transfer format */
|
||||
int form; /* file transfer format */
|
||||
char modename[32]; /* name of file transfer mode */
|
||||
int mode; /* file transfer mode */
|
||||
char bytename[32]; /* local byte size in ascii */
|
||||
int bytesize; /* local byte size in binary */
|
||||
|
||||
jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||
|
||||
char line[200]; /* input line buffer */
|
||||
char *stringbase; /* current scan point in line buffer */
|
||||
char argbuf[200]; /* argument storage buffer */
|
||||
char *argbase; /* current storage point in arg buffer */
|
||||
int margc; /* count of arguments on input line */
|
||||
char *margv[20]; /* args parsed from input line */
|
||||
int cpend; /* flag: if != 0, then pending server reply */
|
||||
int mflag; /* flag: if != 0, then active multi command */
|
||||
|
||||
int options; /* used during socket creation */
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
register char *cp;
|
||||
int top;
|
||||
struct passwd *pw = NULL;
|
||||
#if 0
|
||||
char homedir[MAXPATHLEN];
|
||||
#endif
|
||||
|
||||
int err;
|
||||
WORD wVerReq;
|
||||
|
||||
WSADATA WSAData;
|
||||
struct servent *sp; /* service spec for tcp/ftp */
|
||||
|
||||
/* Disable output buffering, for the benefit of Emacs. */
|
||||
//setbuf(stdout, NULL);
|
||||
|
||||
_fmode = O_BINARY; // This causes an error somewhere.
|
||||
|
||||
wVerReq = MAKEWORD(1,1);
|
||||
|
||||
err = WSAStartup(wVerReq, &WSAData);
|
||||
if (err != 0)
|
||||
{
|
||||
fprintf(stderr, "Could not initialize Windows socket interface.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sp = getservbyname("ftp", "tcp");
|
||||
if (sp == 0) {
|
||||
fprintf(stderr, "ftp: ftp/tcp: unknown service\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
portnum = sp->s_port;
|
||||
|
||||
|
||||
doglob = 1;
|
||||
interactive = 1;
|
||||
autologin = 1;
|
||||
argc--, argv++;
|
||||
while (argc > 0 && **argv == '-') {
|
||||
for (cp = *argv + 1; *cp; cp++)
|
||||
switch (*cp) {
|
||||
|
||||
case 'd':
|
||||
options |= SO_DEBUG;
|
||||
debug++;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
trace++;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
interactive = 0;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
autologin = 0;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
doglob = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stdout,
|
||||
"ftp: %c: unknown option\n", *cp);
|
||||
exit(1);
|
||||
}
|
||||
argc--, argv++;
|
||||
}
|
||||
// fromatty = isatty(fileno(stdin));
|
||||
fromatty = 1; // Strengthen this test
|
||||
/*
|
||||
* Set up defaults for FTP.
|
||||
*/
|
||||
(void) strcpy(typename, "ascii"), type = TYPE_A;
|
||||
(void) strcpy(formname, "non-print"), form = FORM_N;
|
||||
(void) strcpy(modename, "stream"), mode = MODE_S;
|
||||
(void) strcpy(structname, "file"), stru = STRU_F;
|
||||
(void) strcpy(bytename, "8"), bytesize = 8;
|
||||
if (fromatty)
|
||||
verbose++;
|
||||
cpend = 0; /* no pending replies */
|
||||
proxy = 0; /* proxy not active */
|
||||
passivemode = 1; /* passive mode *is* active */
|
||||
crflag = 1; /* strip c.r. on ascii gets */
|
||||
/*
|
||||
* Set up the home directory in case we're globbing.
|
||||
*/
|
||||
#if 0
|
||||
cp = getlogin();
|
||||
if (cp != NULL) {
|
||||
pw = getpwnam(cp);
|
||||
}
|
||||
if (pw == NULL)
|
||||
pw = getpwuid(getuid());
|
||||
if (pw != NULL) {
|
||||
home = homedir;
|
||||
(void) strcpy(home, pw->pw_dir);
|
||||
}
|
||||
#endif
|
||||
strcpy(home, "C:/");
|
||||
if (argc > 0) {
|
||||
if (setjmp(toplevel))
|
||||
exit(0);
|
||||
// (void) signal(SIGINT, intr);
|
||||
// (void) signal(SIGPIPE, lostpeer);
|
||||
setpeer(argc + 1, argv - 1);
|
||||
}
|
||||
top = setjmp(toplevel) == 0;
|
||||
if (top) {
|
||||
// (void) signal(SIGINT, intr);
|
||||
// (void) signal(SIGPIPE, lostpeer);
|
||||
}
|
||||
for (;;) {
|
||||
cmdscanner(top);
|
||||
top = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
intr()
|
||||
{
|
||||
|
||||
longjmp(toplevel, 1);
|
||||
}
|
||||
|
||||
void lostpeer(void)
|
||||
{
|
||||
extern int cout;
|
||||
extern int data;
|
||||
|
||||
if (connected) {
|
||||
if (cout != (int) NULL) {
|
||||
closesocket(cout);
|
||||
cout = (int) NULL;
|
||||
}
|
||||
if (data >= 0) {
|
||||
(void) shutdown(data, 1+1);
|
||||
(void) close(data);
|
||||
data = -1;
|
||||
}
|
||||
connected = 0;
|
||||
}
|
||||
pswitch(1);
|
||||
if (connected) {
|
||||
if (cout != (int)NULL) {
|
||||
closesocket(cout);
|
||||
cout = (int) NULL;
|
||||
}
|
||||
connected = 0;
|
||||
}
|
||||
proxflag = 0;
|
||||
pswitch(0);
|
||||
}
|
||||
|
||||
/*char *
|
||||
tail(filename)
|
||||
char *filename;
|
||||
{
|
||||
register char *s;
|
||||
|
||||
while (*filename) {
|
||||
s = rindex(filename, '/');
|
||||
if (s == NULL)
|
||||
break;
|
||||
if (s[1])
|
||||
return (s + 1);
|
||||
*s = '\0';
|
||||
}
|
||||
return (filename);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
* Command parser.
|
||||
*/
|
||||
void cmdscanner(top)
|
||||
int top;
|
||||
{
|
||||
register struct cmd *c;
|
||||
struct cmd *getcmd();
|
||||
extern int help();
|
||||
|
||||
if (!top)
|
||||
(void) putchar('\n');
|
||||
for (;;) {
|
||||
(void) fflush(stdout);
|
||||
if (fromatty) {
|
||||
printf("ftp> ");
|
||||
(void) fflush(stdout);
|
||||
}
|
||||
if (gets(line) == 0) {
|
||||
if (feof(stdin) || ferror(stdin))
|
||||
quit();
|
||||
break;
|
||||
}
|
||||
if (line[0] == 0)
|
||||
break;
|
||||
makeargv();
|
||||
if (margc == 0) {
|
||||
continue;
|
||||
}
|
||||
c = getcmd(margv[0]);
|
||||
if (c == (struct cmd *)-1) {
|
||||
printf("?Ambiguous command\n");
|
||||
continue;
|
||||
}
|
||||
if (c == 0) {
|
||||
printf("?Invalid command\n");
|
||||
continue;
|
||||
}
|
||||
if (c->c_conn && !connected) {
|
||||
printf ("Not connected.\n");
|
||||
continue;
|
||||
}
|
||||
(*c->c_handler)(margc, margv);
|
||||
if (bell && c->c_bell)
|
||||
(void) putchar('\007');
|
||||
if (c->c_handler != help)
|
||||
break;
|
||||
}
|
||||
(void) fflush(stdout);
|
||||
// (void) signal(SIGINT, intr);
|
||||
// (void) signal(SIGPIPE, lostpeer);
|
||||
}
|
||||
|
||||
struct cmd *
|
||||
getcmd(name)
|
||||
register char *name;
|
||||
{
|
||||
extern struct cmd cmdtab[];
|
||||
register char *p, *q;
|
||||
register struct cmd *c, *found;
|
||||
register int nmatches, longest;
|
||||
|
||||
longest = 0;
|
||||
nmatches = 0;
|
||||
found = 0;
|
||||
for (c = cmdtab; p = c->c_name; c++) {
|
||||
for (q = name; *q == *p++; q++)
|
||||
if (*q == 0) /* exact match? */
|
||||
return (c);
|
||||
if (!*q) { /* the name was a prefix */
|
||||
if (q - name > longest) {
|
||||
longest = q - name;
|
||||
nmatches = 1;
|
||||
found = c;
|
||||
} else if (q - name == longest)
|
||||
nmatches++;
|
||||
}
|
||||
}
|
||||
if (nmatches > 1)
|
||||
return ((struct cmd *)-1);
|
||||
return (found);
|
||||
}
|
||||
|
||||
/*
|
||||
* Slice a string up into argc/argv.
|
||||
*/
|
||||
|
||||
int slrflag;
|
||||
|
||||
void makeargv()
|
||||
{
|
||||
char **argp;
|
||||
char *slurpstring();
|
||||
|
||||
margc = 0;
|
||||
argp = margv;
|
||||
stringbase = line; /* scan from first of buffer */
|
||||
argbase = argbuf; /* store from first of buffer */
|
||||
slrflag = 0;
|
||||
while (*argp++ = slurpstring())
|
||||
margc++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse string into argbuf;
|
||||
* implemented with FSM to
|
||||
* handle quoting and strings
|
||||
*/
|
||||
char *
|
||||
slurpstring()
|
||||
{
|
||||
int got_one = 0;
|
||||
register char *sb = stringbase;
|
||||
register char *ap = argbase;
|
||||
char *tmp = argbase; /* will return this if token found */
|
||||
|
||||
if (*sb == '!' || *sb == '$') { /* recognize ! as a token for shell */
|
||||
switch (slrflag) { /* and $ as token for macro invoke */
|
||||
case 0:
|
||||
slrflag++;
|
||||
stringbase++;
|
||||
return ((*sb == '!') ? "!" : "$");
|
||||
/* NOTREACHED */
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = stringbase;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
S0:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT1;
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
sb++; goto S0;
|
||||
|
||||
default:
|
||||
switch (slrflag) {
|
||||
case 0:
|
||||
slrflag++;
|
||||
break;
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = sb;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S1:
|
||||
switch (*sb) {
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\0':
|
||||
goto OUT1; /* end of token */
|
||||
|
||||
case '\\':
|
||||
sb++; goto S2; /* slurp next character */
|
||||
|
||||
case '"':
|
||||
sb++; goto S3; /* slurp quoted string */
|
||||
|
||||
default:
|
||||
*ap++ = *sb++; /* add character to token */
|
||||
got_one = 1;
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S2:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT1;
|
||||
|
||||
default:
|
||||
*ap++ = *sb++;
|
||||
got_one = 1;
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S3:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT1;
|
||||
|
||||
case '"':
|
||||
sb++; goto S1;
|
||||
|
||||
default:
|
||||
*ap++ = *sb++;
|
||||
got_one = 1;
|
||||
goto S3;
|
||||
}
|
||||
|
||||
OUT1:
|
||||
if (got_one)
|
||||
*ap++ = '\0';
|
||||
argbase = ap; /* update storage pointer */
|
||||
stringbase = sb; /* update scan pointer */
|
||||
if (got_one) {
|
||||
return(tmp);
|
||||
}
|
||||
switch (slrflag) {
|
||||
case 0:
|
||||
slrflag++;
|
||||
break;
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = (char *) 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return((char *)0);
|
||||
}
|
||||
|
||||
#define HELPINDENT (sizeof ("directory"))
|
||||
|
||||
/*
|
||||
* Help command.
|
||||
* Call each command handler with argc == 0 and argv[0] == name.
|
||||
*/
|
||||
int help(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
extern struct cmd cmdtab[];
|
||||
register struct cmd *c;
|
||||
|
||||
if (argc == 1) {
|
||||
register int i, j, w, k;
|
||||
int columns, width = 0, lines;
|
||||
extern int NCMDS;
|
||||
|
||||
printf("Commands may be abbreviated. Commands are:\n\n");
|
||||
for (c = cmdtab; c < &cmdtab[NCMDS]; c++) {
|
||||
int len = strlen(c->c_name);
|
||||
|
||||
if (len > width)
|
||||
width = len;
|
||||
}
|
||||
width = (width + 8) &~ 7;
|
||||
columns = 80 / width;
|
||||
if (columns == 0)
|
||||
columns = 1;
|
||||
lines = (NCMDS + columns - 1) / columns;
|
||||
for (i = 0; i < lines; i++) {
|
||||
for (j = 0; j < columns; j++) {
|
||||
c = cmdtab + j * lines + i;
|
||||
if (c->c_name && (!proxy || c->c_proxy)) {
|
||||
printf("%s", c->c_name);
|
||||
}
|
||||
else if (c->c_name) {
|
||||
for (k=0; k < (int) strlen(c->c_name); k++) {
|
||||
(void) putchar(' ');
|
||||
}
|
||||
}
|
||||
if (c + lines >= &cmdtab[NCMDS]) {
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
w = strlen(c->c_name);
|
||||
while (w < width) {
|
||||
w = (w + 8) &~ 7;
|
||||
(void) putchar('\t');
|
||||
}
|
||||
}
|
||||
}
|
||||
(void) fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
while (--argc > 0) {
|
||||
register char *arg;
|
||||
arg = *++argv;
|
||||
c = getcmd(arg);
|
||||
if (c == (struct cmd *)-1)
|
||||
printf("?Ambiguous help command %s\n", arg);
|
||||
else if (c == (struct cmd *)0)
|
||||
printf("?Invalid help command %s\n", arg);
|
||||
else
|
||||
printf("%-*s\t%s\n", HELPINDENT,
|
||||
c->c_name, c->c_help);
|
||||
}
|
||||
(void) fflush(stdout);
|
||||
return 0;
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = ftp
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_SDKLIBS = ws2_32.a iphlpapi.a
|
||||
# ntdll.a
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
cmds.o \
|
||||
cmdtab.o \
|
||||
domacro.o \
|
||||
fake.o \
|
||||
ftp.o \
|
||||
main.o \
|
||||
ruserpass.o
|
||||
|
||||
TARGET_GCCLIBS =
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* %W% (Berkeley) %G%
|
||||
*/
|
||||
|
||||
#define _PATH_TMP "/tmp/ftpXXXXXX"
|
||||
#define _PATH_BSHELL "/bin/sh"
|
@@ -1,32 +0,0 @@
|
||||
|
||||
int getreply(int expecteof);
|
||||
int ruserpass(char *host, char **aname, char **apass, char **aacct);
|
||||
char *getpass(const char *prompt);
|
||||
void makeargv(void);
|
||||
void domacro(int argc, char *argv[]);
|
||||
void proxtrans(char *cmd, char *local, char *remote);
|
||||
int null(void);
|
||||
int initconn(void);
|
||||
void disconnect(void);
|
||||
void ptransfer(char *direction, long bytes, struct timeval *t0, struct timeval *t1);
|
||||
void setascii(void);
|
||||
void setbinary(void);
|
||||
void setebcdic(void);
|
||||
void settenex(void);
|
||||
void tvsub(struct timeval *tdiff, struct timeval *t1, struct timeval *t0);
|
||||
void setpassive(int argc, char *argv[]);
|
||||
void setpeer(int argc, char *argv[]);
|
||||
void cmdscanner(int top);
|
||||
void pswitch(int flag);
|
||||
void quit(void);
|
||||
int login(char *host);
|
||||
int command(char *fmt, ...);
|
||||
int globulize(char **cpp);
|
||||
void sendrequest(char *cmd, char *local, char *remote, int printnames);
|
||||
void recvrequest(char *cmd, char *local, char *remote, char *mode,
|
||||
int printnames);
|
||||
int confirm(char *cmd, char *file);
|
||||
void blkfree(char **av0);
|
||||
int getit(int argc, char *argv[], int restartit, char *mode);
|
||||
static int token(void);
|
||||
int sleep(int time);
|
@@ -1,271 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1985 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)ruserpass.c 5.1 (Berkeley) 3/1/89";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
//#include <utmp.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include "ftp_var.h"
|
||||
#include "prototypes.h"
|
||||
#include <winsock.h>
|
||||
|
||||
char *renvlook(), *index(), *getenv(), *getpass(), *getlogin();
|
||||
void *malloc();
|
||||
char *strcpy();
|
||||
struct utmp *getutmp();
|
||||
static FILE *cfile;
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 64
|
||||
#endif
|
||||
|
||||
#define DEFAULT 1
|
||||
#define LOGIN 2
|
||||
#define PASSWD 3
|
||||
#define ACCOUNT 4
|
||||
#define MACDEF 5
|
||||
#define ID 10
|
||||
#define MACH 11
|
||||
|
||||
static char tokval[100];
|
||||
|
||||
static struct toktab {
|
||||
char *tokstr;
|
||||
int tval;
|
||||
} toktab[]= {
|
||||
"default", DEFAULT,
|
||||
"login", LOGIN,
|
||||
"password", PASSWD,
|
||||
"passwd", PASSWD,
|
||||
"account", ACCOUNT,
|
||||
"machine", MACH,
|
||||
"macdef", MACDEF,
|
||||
0, 0
|
||||
};
|
||||
|
||||
extern char *hostname;
|
||||
|
||||
int ruserpass(char *host, char **aname, char **apass, char **aacct)
|
||||
{
|
||||
char *hdir, buf[BUFSIZ], *tmp;
|
||||
char myname[MAXHOSTNAMELEN], *mydomain;
|
||||
int t, i, c, usedefault = 0;
|
||||
struct stat stb;
|
||||
extern int errno;
|
||||
|
||||
hdir = getenv("HOME");
|
||||
if (hdir == NULL)
|
||||
hdir = ".";
|
||||
(void) sprintf(buf, "%s/.netrc", hdir);
|
||||
cfile = fopen(buf, "r");
|
||||
if (cfile == NULL) {
|
||||
if (errno != ENOENT)
|
||||
perror(buf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
if (gethostname(myname, sizeof(myname)) < 0)
|
||||
myname[0] = '\0';
|
||||
if ((mydomain = index(myname, '.')) == NULL)
|
||||
mydomain = "";
|
||||
next:
|
||||
while ((t = token())) switch(t) {
|
||||
|
||||
case DEFAULT:
|
||||
usedefault = 1;
|
||||
/* FALL THROUGH */
|
||||
|
||||
case MACH:
|
||||
if (!usedefault) {
|
||||
if (token() != ID)
|
||||
continue;
|
||||
/*
|
||||
* Allow match either for user's input host name
|
||||
* or official hostname. Also allow match of
|
||||
* incompletely-specified host in local domain.
|
||||
*/
|
||||
if (strcasecmp(host, tokval) == 0)
|
||||
goto match;
|
||||
if (strcasecmp(hostname, tokval) == 0)
|
||||
goto match;
|
||||
if ((tmp = index(hostname, '.')) != NULL &&
|
||||
strcasecmp(tmp, mydomain) == 0 &&
|
||||
strncasecmp(hostname, tokval, tmp - hostname) == 0 &&
|
||||
tokval[tmp - hostname] == '\0')
|
||||
goto match;
|
||||
if ((tmp = index(host, '.')) != NULL &&
|
||||
strcasecmp(tmp, mydomain) == 0 &&
|
||||
strncasecmp(host, tokval, tmp - host) == 0 &&
|
||||
tokval[tmp - host] == '\0')
|
||||
goto match;
|
||||
continue;
|
||||
}
|
||||
match:
|
||||
while ((t = token()) && t != MACH && t != DEFAULT) switch(t) {
|
||||
|
||||
case LOGIN:
|
||||
if (token())
|
||||
if (*aname == 0) {
|
||||
*aname = malloc((unsigned) strlen(tokval) + 1);
|
||||
(void) strcpy(*aname, tokval);
|
||||
} else {
|
||||
if (strcmp(*aname, tokval))
|
||||
goto next;
|
||||
}
|
||||
break;
|
||||
case PASSWD:
|
||||
if (strcmp(*aname, "anonymous") &&
|
||||
fstat(fileno(cfile), &stb) >= 0 &&
|
||||
(stb.st_mode & 077) != 0) {
|
||||
fprintf(stderr, "Error - .netrc file not correct mode.\n");
|
||||
fprintf(stderr, "Remove password or correct mode.\n");
|
||||
goto bad;
|
||||
}
|
||||
if (token() && *apass == 0) {
|
||||
*apass = malloc((unsigned) strlen(tokval) + 1);
|
||||
(void) strcpy(*apass, tokval);
|
||||
}
|
||||
break;
|
||||
case ACCOUNT:
|
||||
if (fstat(fileno(cfile), &stb) >= 0
|
||||
&& (stb.st_mode & 077) != 0) {
|
||||
fprintf(stderr, "Error - .netrc file not correct mode.\n");
|
||||
fprintf(stderr, "Remove account or correct mode.\n");
|
||||
goto bad;
|
||||
}
|
||||
if (token() && *aacct == 0) {
|
||||
*aacct = malloc((unsigned) strlen(tokval) + 1);
|
||||
(void) strcpy(*aacct, tokval);
|
||||
}
|
||||
break;
|
||||
case MACDEF:
|
||||
if (proxy) {
|
||||
(void) fclose(cfile);
|
||||
return(0);
|
||||
}
|
||||
while ((c=getc(cfile)) != EOF && c == ' ' || c == '\t');
|
||||
if (c == EOF || c == '\n') {
|
||||
printf("Missing macdef name argument.\n");
|
||||
goto bad;
|
||||
}
|
||||
if (macnum == 16) {
|
||||
printf("Limit of 16 macros have already been defined\n");
|
||||
goto bad;
|
||||
}
|
||||
tmp = macros[macnum].mac_name;
|
||||
*tmp++ = c;
|
||||
for (i=0; i < 8 && (c=getc(cfile)) != EOF &&
|
||||
!isspace(c); ++i) {
|
||||
*tmp++ = c;
|
||||
}
|
||||
if (c == EOF) {
|
||||
printf("Macro definition missing null line terminator.\n");
|
||||
goto bad;
|
||||
}
|
||||
*tmp = '\0';
|
||||
if (c != '\n') {
|
||||
while ((c=getc(cfile)) != EOF && c != '\n');
|
||||
}
|
||||
if (c == EOF) {
|
||||
printf("Macro definition missing null line terminator.\n");
|
||||
goto bad;
|
||||
}
|
||||
if (macnum == 0) {
|
||||
macros[macnum].mac_start = macbuf;
|
||||
}
|
||||
else {
|
||||
macros[macnum].mac_start = macros[macnum-1].mac_end + 1;
|
||||
}
|
||||
tmp = macros[macnum].mac_start;
|
||||
while (tmp != macbuf + 4096) {
|
||||
if ((c=getc(cfile)) == EOF) {
|
||||
printf("Macro definition missing null line terminator.\n");
|
||||
goto bad;
|
||||
}
|
||||
*tmp = c;
|
||||
if (*tmp == '\n') {
|
||||
if (*(tmp-1) == '\0') {
|
||||
macros[macnum++].mac_end = tmp - 1;
|
||||
break;
|
||||
}
|
||||
*tmp = '\0';
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
if (tmp == macbuf + 4096) {
|
||||
printf("4K macro buffer exceeded\n");
|
||||
goto bad;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown .netrc keyword %s\n", tokval);
|
||||
break;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
done:
|
||||
(void) fclose(cfile);
|
||||
return(0);
|
||||
bad:
|
||||
(void) fclose(cfile);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static int token(void)
|
||||
{
|
||||
char *cp;
|
||||
int c;
|
||||
struct toktab *t;
|
||||
|
||||
if (feof(cfile))
|
||||
return (0);
|
||||
while ((c = getc(cfile)) != EOF &&
|
||||
(c == '\r' || c == '\n' || c == '\t' || c == ' ' || c == ','))
|
||||
continue;
|
||||
if (c == EOF)
|
||||
return (0);
|
||||
cp = tokval;
|
||||
if (c == '"') {
|
||||
while ((c = getc(cfile)) != EOF && c != '"') {
|
||||
if (c == '\\')
|
||||
c = getc(cfile);
|
||||
*cp++ = c;
|
||||
}
|
||||
} else {
|
||||
*cp++ = c;
|
||||
while ((c = getc(cfile)) != EOF
|
||||
&& c != '\n' && c != '\t' && c != ' ' && c != ',' && c != '\r') {
|
||||
if (c == '\\')
|
||||
c = getc(cfile);
|
||||
*cp++ = c;
|
||||
}
|
||||
}
|
||||
*cp = 0;
|
||||
if (tokval[0] == 0)
|
||||
return (0);
|
||||
for (t = toktab; t->tokstr; t++)
|
||||
if (!strcmp(t->tokstr, tokval))
|
||||
return (t->tval);
|
||||
return (ID);
|
||||
}
|
@@ -1,299 +0,0 @@
|
||||
/*
|
||||
* ipconfig - display IP stack parameters.
|
||||
*
|
||||
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
|
||||
*
|
||||
* Robert Dickenson <robd@reactos.org>, August 15, 2002.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <iptypes.h>
|
||||
#include <ipexport.h>
|
||||
#include <iphlpapi.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include "trace.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* imported from iphlpapi.dll
|
||||
|
||||
GetAdapterOrderMap
|
||||
GetInterfaceInfo
|
||||
GetIpStatsFromStack
|
||||
NhGetInterfaceNameFromGuid
|
||||
NhpAllocateAndGetInterfaceInfoFromStack
|
||||
|
||||
*/
|
||||
|
||||
static TCHAR* GetNodeTypeName(int nNodeType)
|
||||
{
|
||||
switch (nNodeType) {
|
||||
case 0: return _T("zero");
|
||||
case 1: return _T("one");
|
||||
case 2: return _T("two");
|
||||
case 3: return _T("three");
|
||||
case 4: return _T("mixed");
|
||||
default: return _T("unknown");
|
||||
}
|
||||
}
|
||||
|
||||
static void ShowNetworkFixedInfo()
|
||||
{
|
||||
FIXED_INFO* pFixedInfo = NULL;
|
||||
ULONG OutBufLen = 0;
|
||||
DWORD result;
|
||||
|
||||
result = GetNetworkParams(NULL, &OutBufLen);
|
||||
if (result == ERROR_BUFFER_OVERFLOW) {
|
||||
pFixedInfo = (FIXED_INFO*)malloc(OutBufLen);
|
||||
if (!pFixedInfo) {
|
||||
_tprintf(_T("ERROR: failed to allocate 0x%08X bytes of memory\n"), OutBufLen);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
_tprintf(_T("ERROR: GetNetworkParams() failed to report required buffer size.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
result = GetNetworkParams(pFixedInfo, &OutBufLen);
|
||||
if (result == ERROR_SUCCESS) {
|
||||
IP_ADDR_STRING* pIPAddr;
|
||||
|
||||
printf("\tHostName. . . . . . . . . . . : %s\n", pFixedInfo->HostName);
|
||||
printf("\tDomainName. . . . . . . . . . : %s\n", pFixedInfo->DomainName);
|
||||
//
|
||||
printf("\tDNS Servers . . . . . . . . . : %s\n", pFixedInfo->DnsServerList.IpAddress.String);
|
||||
pIPAddr = pFixedInfo->DnsServerList.Next;
|
||||
while (pIPAddr) {
|
||||
printf("\t\t\t\t : %s\n", pIPAddr->IpAddress.String);
|
||||
pIPAddr = pIPAddr->Next;
|
||||
}
|
||||
//
|
||||
_tprintf(_T("\tNodeType. . . . . . . . . . . : %d (%s)\n"), pFixedInfo->NodeType, GetNodeTypeName(pFixedInfo->NodeType));
|
||||
printf("\tScopeId . . . . . . . . . . . : %s\n", pFixedInfo->ScopeId);
|
||||
_tprintf(_T("\tEnableRouting . . . . . . . . : %s\n"), pFixedInfo->EnableRouting ? _T("yes") : _T("no"));
|
||||
_tprintf(_T("\tEnableProxy . . . . . . . . . : %s\n"), pFixedInfo->EnableProxy ? _T("yes") : _T("no"));
|
||||
_tprintf(_T("\tEnableDns . . . . . . . . . . : %s\n"), pFixedInfo->EnableDns ? _T("yes") : _T("no"));
|
||||
_tprintf(_T("\n"));
|
||||
//_tprintf(_T("\n"),);
|
||||
//_tprintf(_T("GetNetworkParams() returned with %d\n"), pIfTable->NumAdapters);
|
||||
|
||||
// _tprintf(_T("\tConnection specific DNS suffix: %s\n"), pFixedInfo->EnableDns ? _T("yes") : _T("no"));
|
||||
|
||||
} else {
|
||||
switch (result) {
|
||||
case ERROR_BUFFER_OVERFLOW:
|
||||
_tprintf(_T("The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size\n"));
|
||||
break;
|
||||
case ERROR_INVALID_PARAMETER:
|
||||
_tprintf(_T("The pOutBufLen parameter is NULL, or the calling process does not have read/write access to the memory pointed to by pOutBufLen, or the calling process does not have write access to the memory pointed to by the pAdapterInfo parameter\n"));
|
||||
break;
|
||||
case ERROR_NO_DATA:
|
||||
_tprintf(_T("No adapter information exists for the local computer\n"));
|
||||
break;
|
||||
case ERROR_NOT_SUPPORTED:
|
||||
_tprintf(_T("This function is not supported on the operating system in use on the local system\n"));
|
||||
break;
|
||||
default:
|
||||
_tprintf(_T("0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ShowNetworkInterfaces()
|
||||
{
|
||||
IP_INTERFACE_INFO* pIfTable = NULL;
|
||||
DWORD result;
|
||||
DWORD dwNumIf;
|
||||
DWORD dwOutBufLen = 0;
|
||||
|
||||
if ((result = GetNumberOfInterfaces(&dwNumIf)) != NO_ERROR) {
|
||||
_tprintf(_T("GetNumberOfInterfaces() failed with code 0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result);
|
||||
return;
|
||||
} else {
|
||||
_tprintf(_T("GetNumberOfInterfaces() returned %d\n"), dwNumIf);
|
||||
}
|
||||
|
||||
result = GetInterfaceInfo(pIfTable, &dwOutBufLen);
|
||||
// dwOutBufLen = sizeof(IP_INTERFACE_INFO) + dwNumIf * sizeof(IP_ADAPTER_INDEX_MAP);
|
||||
// _tprintf(_T("GetNumberOfInterfaces() returned %d, dwOutBufLen %d\n"), dwNumIf, dwOutBufLen);
|
||||
// _tprintf(_T("sizeof(IP_INTERFACE_INFO) %d, sizeof(IP_ADAPTER_INDEX_MAP) %d\n"), sizeof(IP_INTERFACE_INFO), sizeof(IP_ADAPTER_INDEX_MAP));
|
||||
|
||||
pIfTable = (IP_INTERFACE_INFO*)malloc(dwOutBufLen);
|
||||
if (!pIfTable) {
|
||||
_tprintf(_T("ERROR: failed to allocate 0x%08X bytes of memory\n"), dwOutBufLen);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
typedef struct _IP_ADAPTER_INDEX_MAP {
|
||||
ULONG Index; // adapter index
|
||||
WCHAR Name[MAX_ADAPTER_NAME]; // name of the adapter
|
||||
} IP_ADAPTER_INDEX_MAP, * PIP_ADAPTER_INDEX_MAP;
|
||||
|
||||
typedef struct _IP_INTERFACE_INFO {
|
||||
LONG NumAdapters; // number of adapters in array
|
||||
IP_ADAPTER_INDEX_MAP Adapter[1]; // adapter indices and names
|
||||
} IP_INTERFACE_INFO,*PIP_INTERFACE_INFO;
|
||||
*/
|
||||
result = GetInterfaceInfo(pIfTable, &dwOutBufLen);
|
||||
if (result == NO_ERROR) {
|
||||
int i;
|
||||
_tprintf(_T("GetInterfaceInfo() returned with %d adaptor entries\n"), pIfTable->NumAdapters);
|
||||
for (i = 0; i < pIfTable->NumAdapters; i++) {
|
||||
wprintf(L"[%d] %s\n", i + 1, pIfTable->Adapter[i].Name);
|
||||
//wprintf(L"[%d] %s\n", pIfTable->Adapter[i].Index, pIfTable->Adapter[i].Name);
|
||||
|
||||
// \DEVICE\TCPIP_{DB0E61C1-3498-4C5F-B599-59CDE8A1E357}
|
||||
// \DEVICE\TCPIP_{BD445697-0945-4591-AE7F-2AB0F383CA87}
|
||||
// \DEVICE\TCPIP_{6D87DC08-6BC5-4E78-AB5F-18CAB785CFFE}
|
||||
|
||||
//HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_{DB0E61C1-3498-4C5F-B599-59CDE8A1E357}
|
||||
}
|
||||
} else {
|
||||
switch (result) {
|
||||
case ERROR_INVALID_PARAMETER:
|
||||
_tprintf(_T("The dwOutBufLen parameter is NULL, or GetInterfaceInterface is unable to write to the memory pointed to by the dwOutBufLen parameter\n"));
|
||||
break;
|
||||
case ERROR_INSUFFICIENT_BUFFER:
|
||||
_tprintf(_T("The buffer pointed to by the pIfTable parameter is not large enough. The required size is returned in the DWORD variable pointed to by the dwOutBufLen parameter\n"));
|
||||
_tprintf(_T("\tdwOutBufLen: %d\n"), dwOutBufLen);
|
||||
break;
|
||||
case ERROR_NOT_SUPPORTED:
|
||||
_tprintf(_T("This function is not supported on the operating system in use on the local system\n"));
|
||||
break;
|
||||
default:
|
||||
_tprintf(_T("0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(pIfTable);
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _IP_ADAPTER_INFO {
|
||||
struct _IP_ADAPTER_INFO* Next;
|
||||
DWORD ComboIndex;
|
||||
char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
|
||||
1 char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
|
||||
UINT AddressLength;
|
||||
2 BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
|
||||
DWORD Index;
|
||||
UINT Type;
|
||||
3 UINT DhcpEnabled;
|
||||
5 PIP_ADDR_STRING CurrentIpAddress;
|
||||
IP_ADDR_STRING IpAddressList;
|
||||
7 IP_ADDR_STRING GatewayList;
|
||||
8 IP_ADDR_STRING DhcpServer;
|
||||
BOOL HaveWins;
|
||||
IP_ADDR_STRING PrimaryWinsServer;
|
||||
IP_ADDR_STRING SecondaryWinsServer;
|
||||
a time_t LeaseObtained;
|
||||
b time_t LeaseExpires;
|
||||
} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
|
||||
*/
|
||||
/*
|
||||
Ethernet adapter VMware Virtual Ethernet Adapter (Network Address Translation (NAT) for VMnet8):
|
||||
|
||||
Connection-specific DNS Suffix . :
|
||||
1 Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter (Network Address Translation (NAT) for VMnet8)
|
||||
2 Physical Address. . . . . . . . . : 00-50-56-C0-00-08
|
||||
3 DHCP Enabled. . . . . . . . . . . : Yes
|
||||
Autoconfiguration Enabled . . . . : Yes
|
||||
5 IP Address. . . . . . . . . . . . : 192.168.136.1
|
||||
Subnet Mask . . . . . . . . . . . : 255.255.255.0
|
||||
7 Default Gateway . . . . . . . . . :
|
||||
8 DHCP Server . . . . . . . . . . . : 192.168.136.254
|
||||
DNS Servers . . . . . . . . . . . :
|
||||
a Lease Obtained. . . . . . . . . . : Monday, 30 December 2002 5:56:53 PM
|
||||
b Lease Expires . . . . . . . . . . : Monday, 30 December 2002 6:26:53 PM
|
||||
*/
|
||||
static void ShowAdapterInfo()
|
||||
{
|
||||
IP_ADAPTER_INFO* pAdaptorInfo;
|
||||
ULONG ulOutBufLen;
|
||||
DWORD dwRetVal;
|
||||
|
||||
_tprintf(_T("\nAdaptor Information\t\n"));
|
||||
pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, sizeof(IP_ADAPTER_INFO));
|
||||
ulOutBufLen = sizeof(IP_ADAPTER_INFO);
|
||||
|
||||
if (ERROR_BUFFER_OVERFLOW == GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) {
|
||||
GlobalFree(pAdaptorInfo);
|
||||
pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, ulOutBufLen);
|
||||
}
|
||||
if (dwRetVal = GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) {
|
||||
_tprintf(_T("Call to GetAdaptersInfo failed. Return Value: %08x\n"), dwRetVal);
|
||||
} else {
|
||||
while (pAdaptorInfo) {
|
||||
printf(" AdapterName: %s\n", pAdaptorInfo->AdapterName);
|
||||
printf(" Description: %s\n", pAdaptorInfo->Description);
|
||||
pAdaptorInfo = pAdaptorInfo->Next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char szUsage[] = { "USAGE:\n" \
|
||||
" ipconfig [/? | /all | /release [adapter] | /renew [adapter]\n" \
|
||||
" | /flushdns | /registerdns\n" \
|
||||
" | /showclassid adapter\n" \
|
||||
" | /showclassid adapter\n" \
|
||||
" | /setclassid adapter [classidtoset] ]\n" \
|
||||
"\n" \
|
||||
"adapter Full name or pattern with '*' and '?' to 'match',\n" \
|
||||
" * matches any character, ? matches one character.\n" \
|
||||
" Options\n" \
|
||||
" /? Display this help message.\n" \
|
||||
" /all Display full configuration information.\n" \
|
||||
" /release Release the IP address for the specified adapter.\n" \
|
||||
" /renew Renew the IP address for the specified adapter.\n" \
|
||||
" /flushdns Purges the DNS Resolver cache.\n" \
|
||||
" /registerdns Refreshes all DHCP leases and re-registers DNS names\n" \
|
||||
" /displaydns Display the contents of the DNS Resolver Cache.\n" \
|
||||
" /showclassid Displays all the dhcp class IDs allowed for adapter.\n" \
|
||||
" /setclassid Modifies the dhcp class id.\n" \
|
||||
"\n" \
|
||||
"The default is to display only the IP address, subnet mask and\n" \
|
||||
"default gateway for each adapter bound to TCP/IP.\n"
|
||||
};
|
||||
/*
|
||||
"\n" \
|
||||
"For Release and Renew, if no adapter name is specified, then the IP address\n" \
|
||||
"leases for all adapters bound to TCP/IP will be released or renewed.\n" \
|
||||
"\n" \
|
||||
"For SetClassID, if no class id is specified, then the classid is removed.\n" \
|
||||
"\n" \
|
||||
"Examples:\n" \
|
||||
" > ipconfig ... Show information.\n" \
|
||||
" > ipconfig /all ... Show detailed information\n" \
|
||||
" > ipconfig /renew ... renew all adapaters\n" \
|
||||
" > ipconfig /renew EL* ... renew adapters named EL....\n" \
|
||||
" > ipconfig /release *ELINK?21* ... release all matching adapters,\n" \
|
||||
eg. ELINK-21, myELELINKi21adapter.\n"
|
||||
*/
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
fputs(szUsage, stderr);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// 10.0.0.100 // As of build 0.0.20 this is hardcoded in the ip stack
|
||||
|
||||
if (argc > 1) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
_tprintf(_T("ReactOS IP Configuration\n"));
|
||||
ShowNetworkFixedInfo();
|
||||
ShowNetworkInterfaces();
|
||||
ShowAdapterInfo();
|
||||
return 0;
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 ipconfig\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "ipconfig\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "ipconfig.exe\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,19 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = ipconfig
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32API
|
||||
|
||||
TARGET_SDKLIBS = user32.a iphlpapi.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,53 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
|
||||
void _DebugBreak(void)
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
|
||||
void Trace(TCHAR* lpszFormat, ...)
|
||||
{
|
||||
va_list args;
|
||||
int nBuf;
|
||||
TCHAR szBuffer[512];
|
||||
|
||||
va_start(args, lpszFormat);
|
||||
nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
|
||||
OutputDebugString(szBuffer);
|
||||
// was there an error? was the expanded string too long?
|
||||
//ASSERT(nBuf >= 0);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg)
|
||||
{
|
||||
if (msg == NULL) {
|
||||
printf("ASSERT -- %s occured on line %u of file %s.\n",
|
||||
assert, line, file);
|
||||
} else {
|
||||
printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
|
||||
assert, line, file, msg);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Trace(TCHAR* lpszFormat, ...) { };
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg) { };
|
||||
|
||||
#endif //_DEBUG
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#ifndef __TRACE_H__
|
||||
#define __TRACE_H__
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#ifdef _X86_
|
||||
#define BreakPoint() _asm { int 3h }
|
||||
#else
|
||||
#define BreakPoint() _DebugBreak()
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, NULL); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
} \
|
||||
|
||||
#define ASSERTMSG(exp, msg) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, msg); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// MACRO: TRACE()
|
||||
//=============================================================================
|
||||
|
||||
#define TRACE Trace
|
||||
|
||||
|
||||
#else // _DEBUG
|
||||
|
||||
//=============================================================================
|
||||
// Define away MACRO's ASSERT() and TRACE() in non debug builds
|
||||
//=============================================================================
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp)
|
||||
#define ASSERTMSG(exp, msg)
|
||||
#endif
|
||||
|
||||
#define TRACE 0 ? (void)0 : Trace
|
||||
|
||||
#endif // !_DEBUG
|
||||
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg);
|
||||
void Trace(TCHAR* lpszFormat, ...);
|
||||
|
||||
|
||||
#endif // __TRACE_H__
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@@ -1,22 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = netstat
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = \
|
||||
-D__USE_W32API \
|
||||
-D_WIN32_IE=0x600 \
|
||||
-D_WIN32_WINNT=0x501
|
||||
|
||||
TARGET_SDKLIBS = user32.a snmpapi.a iphlpapi.a ws2_32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,518 +0,0 @@
|
||||
/*
|
||||
* netstat - display IP stack statistics.
|
||||
*
|
||||
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
|
||||
*
|
||||
* Robert Dickenson <robd@reactos.org>, August 15, 2002.
|
||||
*/
|
||||
|
||||
// Extensive reference made and use of source to netstatp by:
|
||||
// Copyright (C) 1998-2002 Mark Russinovich
|
||||
// www.sysinternals.com
|
||||
|
||||
#define ANY_SIZE 1
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <iptypes.h>
|
||||
#include <ipexport.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <snmp.h>
|
||||
|
||||
#include "trace.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
#define MAX_RESLEN 4000
|
||||
|
||||
//
|
||||
// Possible TCP endpoint states
|
||||
//
|
||||
static char TcpState[][32] = {
|
||||
"???",
|
||||
"CLOSED",
|
||||
"LISTENING",
|
||||
"SYN_SENT",
|
||||
"SYN_RCVD",
|
||||
"ESTABLISHED",
|
||||
"FIN_WAIT1",
|
||||
"FIN_WAIT2",
|
||||
"CLOSE_WAIT",
|
||||
"CLOSING",
|
||||
"LAST_ACK",
|
||||
"TIME_WAIT",
|
||||
"DELETE_TCB"
|
||||
};
|
||||
|
||||
VOID PrintError(DWORD ErrorCode)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, ErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR)&lpMsgBuf, 0, NULL);
|
||||
printf("%s\n", lpMsgBuf);
|
||||
LocalFree(lpMsgBuf);
|
||||
}
|
||||
|
||||
static void ShowTcpStatistics()
|
||||
{
|
||||
MIB_TCPSTATS TcpStatsMIB;
|
||||
GetTcpStatistics(&TcpStatsMIB);
|
||||
|
||||
_tprintf(_T("TCP/IP Statistics\t\n"));
|
||||
_tprintf(_T(" time-out algorithm:\t\t%d\n"), TcpStatsMIB.dwRtoAlgorithm);
|
||||
_tprintf(_T(" minimum time-out:\t\t%d\n"), TcpStatsMIB.dwRtoMin);
|
||||
_tprintf(_T(" maximum time-out:\t\t%d\n"), TcpStatsMIB.dwRtoMax);
|
||||
_tprintf(_T(" maximum connections:\t\t%d\n"), TcpStatsMIB.dwMaxConn);
|
||||
_tprintf(_T(" active opens:\t\t\t%d\n"), TcpStatsMIB.dwActiveOpens);
|
||||
_tprintf(_T(" passive opens:\t\t\t%d\n"), TcpStatsMIB.dwPassiveOpens);
|
||||
_tprintf(_T(" failed attempts:\t\t%d\n"), TcpStatsMIB.dwAttemptFails);
|
||||
_tprintf(_T(" established connections reset:\t%d\n"), TcpStatsMIB.dwEstabResets);
|
||||
_tprintf(_T(" established connections:\t%d\n"), TcpStatsMIB.dwCurrEstab);
|
||||
_tprintf(_T(" segments received:\t\t%d\n"), TcpStatsMIB.dwInSegs);
|
||||
_tprintf(_T(" segment sent:\t\t\t%d\n"), TcpStatsMIB.dwOutSegs);
|
||||
_tprintf(_T(" segments retransmitted:\t\t%d\n"), TcpStatsMIB.dwRetransSegs);
|
||||
_tprintf(_T(" incoming errors:\t\t%d\n"), TcpStatsMIB.dwInErrs);
|
||||
_tprintf(_T(" outgoing resets:\t\t%d\n"), TcpStatsMIB.dwOutRsts);
|
||||
_tprintf(_T(" cumulative connections:\t\t%d\n"), TcpStatsMIB.dwNumConns);
|
||||
}
|
||||
|
||||
static void ShowUdpStatistics()
|
||||
{
|
||||
MIB_UDPSTATS UDPStatsMIB;
|
||||
GetUdpStatistics(&UDPStatsMIB);
|
||||
|
||||
_tprintf(_T("UDP Statistics\t\n"));
|
||||
_tprintf(_T(" received datagrams:\t\t\t%d\n"), UDPStatsMIB.dwInDatagrams);
|
||||
_tprintf(_T(" datagrams for which no port exists:\t%d\n"), UDPStatsMIB.dwNoPorts);
|
||||
_tprintf(_T(" errors on received datagrams:\t\t%d\n"), UDPStatsMIB.dwInErrors);
|
||||
_tprintf(_T(" sent datagrams:\t\t\t\t%d\n"), UDPStatsMIB.dwOutDatagrams);
|
||||
_tprintf(_T(" number of entries in listener table:\t%d\n"), UDPStatsMIB.dwNumAddrs);
|
||||
}
|
||||
|
||||
static void ShowIpStatistics()
|
||||
{
|
||||
MIB_IPSTATS IPStatsMIB;
|
||||
GetIpStatistics(&IPStatsMIB);
|
||||
|
||||
_tprintf(_T("IP Statistics\t\n"));
|
||||
_tprintf(_T(" IP forwarding enabled or disabled:\t%d\n"), IPStatsMIB.dwForwarding);
|
||||
_tprintf(_T(" default time-to-live:\t\t\t%d\n"), IPStatsMIB.dwDefaultTTL);
|
||||
_tprintf(_T(" datagrams received:\t\t\t%d\n"), IPStatsMIB.dwInReceives);
|
||||
_tprintf(_T(" received header errors:\t\t\t%d\n"), IPStatsMIB.dwInHdrErrors);
|
||||
_tprintf(_T(" received address errors:\t\t%d\n"), IPStatsMIB.dwInAddrErrors);
|
||||
_tprintf(_T(" datagrams forwarded:\t\t\t%d\n"), IPStatsMIB.dwForwDatagrams);
|
||||
_tprintf(_T(" datagrams with unknown protocol:\t%d\n"), IPStatsMIB.dwInUnknownProtos);
|
||||
_tprintf(_T(" received datagrams discarded:\t\t%d\n"), IPStatsMIB.dwInDiscards);
|
||||
_tprintf(_T(" received datagrams delivered:\t\t%d\n"), IPStatsMIB.dwInDelivers);
|
||||
_tprintf(_T(" sent datagrams discarded:\t\t%d\n"), IPStatsMIB.dwOutDiscards);
|
||||
_tprintf(_T(" datagrams for which no route exists:\t%d\n"), IPStatsMIB.dwOutNoRoutes);
|
||||
_tprintf(_T(" datagrams for which frags didn't arrive:%d\n"), IPStatsMIB.dwReasmTimeout);
|
||||
_tprintf(_T(" datagrams requiring reassembly:\t\t%d\n"), IPStatsMIB.dwReasmReqds);
|
||||
_tprintf(_T(" successful reassemblies:\t\t%d\n"), IPStatsMIB.dwReasmOks);
|
||||
_tprintf(_T(" failed reassemblies:\t\t\t%d\n"), IPStatsMIB.dwReasmFails);
|
||||
_tprintf(_T(" successful fragmentations:\t\t%d\n"), IPStatsMIB.dwFragOks);
|
||||
_tprintf(_T(" failed fragmentations:\t\t\t%d\n"), IPStatsMIB.dwFragFails);
|
||||
_tprintf(_T(" datagrams fragmented:\t\t\t%d\n"), IPStatsMIB.dwFragCreates);
|
||||
_tprintf(_T(" number of interfaces on computer:\t%d\n"), IPStatsMIB.dwNumIf);
|
||||
_tprintf(_T(" number of IP address on computer:\t%d\n"), IPStatsMIB.dwNumAddr);
|
||||
_tprintf(_T(" number of routes in routing table:\t%d\n"), IPStatsMIB.dwNumRoutes);
|
||||
}
|
||||
|
||||
static void ShowNetworkParams()
|
||||
{
|
||||
FIXED_INFO* FixedInfo;
|
||||
IP_ADDR_STRING* pIPAddr;
|
||||
ULONG ulOutBufLen;
|
||||
DWORD dwRetVal;
|
||||
|
||||
_tprintf(_T("Network Parameters\t\n"));
|
||||
|
||||
FixedInfo = (FIXED_INFO*)GlobalAlloc(GPTR, sizeof(FIXED_INFO));
|
||||
ulOutBufLen = sizeof(FIXED_INFO);
|
||||
if (ERROR_BUFFER_OVERFLOW == GetNetworkParams(FixedInfo, &ulOutBufLen)) {
|
||||
GlobalFree(FixedInfo);
|
||||
FixedInfo =(FIXED_INFO*)GlobalAlloc(GPTR, ulOutBufLen);
|
||||
}
|
||||
if (dwRetVal = GetNetworkParams(FixedInfo, &ulOutBufLen)) {
|
||||
_tprintf(_T("Call to GetNetworkParams failed. Return Value: %08x\n"), dwRetVal);
|
||||
} else {
|
||||
printf(" Host Name: %s", FixedInfo->HostName);
|
||||
printf("\n Domain Name: %s", FixedInfo->DomainName);
|
||||
printf("\n DNS Servers:\t%s\n", FixedInfo->DnsServerList.IpAddress.String);
|
||||
pIPAddr = FixedInfo->DnsServerList.Next;
|
||||
while (pIPAddr) {
|
||||
printf("\t\t\t%s\n", pIPAddr->IpAddress.String);
|
||||
pIPAddr = pIPAddr->Next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ShowAdapterInfo()
|
||||
{
|
||||
IP_ADAPTER_INFO* pAdaptorInfo;
|
||||
ULONG ulOutBufLen;
|
||||
DWORD dwRetVal;
|
||||
|
||||
_tprintf(_T("\nAdaptor Information\t\n"));
|
||||
pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, sizeof(IP_ADAPTER_INFO));
|
||||
ulOutBufLen = sizeof(IP_ADAPTER_INFO);
|
||||
|
||||
if (ERROR_BUFFER_OVERFLOW == GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) {
|
||||
GlobalFree(pAdaptorInfo);
|
||||
pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, ulOutBufLen);
|
||||
}
|
||||
if (dwRetVal = GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) {
|
||||
_tprintf(_T("Call to GetAdaptersInfo failed. Return Value: %08x\n"), dwRetVal);
|
||||
} else {
|
||||
while (pAdaptorInfo) {
|
||||
printf(" AdapterName: %s\n", pAdaptorInfo->AdapterName);
|
||||
printf(" Description: %s\n", pAdaptorInfo->Description);
|
||||
pAdaptorInfo = pAdaptorInfo->Next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
UINT idLength;
|
||||
UINT* ids;
|
||||
} AsnObjectIdentifier;
|
||||
|
||||
VOID SnmpUtilPrintAsnAny(AsnAny* pAny); // pointer to value to print
|
||||
VOID SnmpUtilPrintOid(AsnObjectIdentifier* Oid); // object identifier to print
|
||||
|
||||
*/
|
||||
void test_snmp(void)
|
||||
{
|
||||
int nBytes = 500;
|
||||
BYTE* pCache;
|
||||
|
||||
pCache = (BYTE*)SnmpUtilMemAlloc(nBytes);
|
||||
if (pCache != NULL) {
|
||||
AsnObjectIdentifier* pOidSrc = NULL;
|
||||
AsnObjectIdentifier AsnObId;
|
||||
if (SnmpUtilOidCpy(&AsnObId, pOidSrc)) {
|
||||
//
|
||||
//
|
||||
//
|
||||
SnmpUtilOidFree(&AsnObId);
|
||||
}
|
||||
SnmpUtilMemFree(pCache);
|
||||
} else {
|
||||
_tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n"));
|
||||
}
|
||||
}
|
||||
|
||||
// Maximum string lengths for ASCII ip address and port names
|
||||
//
|
||||
#define HOSTNAMELEN 256
|
||||
#define PORTNAMELEN 256
|
||||
#define ADDRESSLEN HOSTNAMELEN+PORTNAMELEN
|
||||
|
||||
//
|
||||
// Our option flags
|
||||
//
|
||||
#define FLAG_SHOW_ALL_ENDPOINTS 1
|
||||
#define FLAG_SHOW_ETH_STATS 2
|
||||
#define FLAG_SHOW_NUMBERS 3
|
||||
#define FLAG_SHOW_PROT_CONNECTIONS 4
|
||||
#define FLAG_SHOW_ROUTE_TABLE 5
|
||||
#define FLAG_SHOW_PROT_STATS 6
|
||||
#define FLAG_SHOW_INTERVAL 7
|
||||
|
||||
|
||||
// Undocumented extended information structures available only on XP and higher
|
||||
|
||||
typedef struct {
|
||||
DWORD dwState; // state of the connection
|
||||
DWORD dwLocalAddr; // address on local computer
|
||||
DWORD dwLocalPort; // port number on local computer
|
||||
DWORD dwRemoteAddr; // address on remote computer
|
||||
DWORD dwRemotePort; // port number on remote computer
|
||||
DWORD dwProcessId;
|
||||
} MIB_TCPEXROW, *PMIB_TCPEXROW;
|
||||
|
||||
typedef struct {
|
||||
DWORD dwNumEntries;
|
||||
MIB_TCPEXROW table[ANY_SIZE];
|
||||
} MIB_TCPEXTABLE, *PMIB_TCPEXTABLE;
|
||||
|
||||
typedef struct {
|
||||
DWORD dwLocalAddr; // address on local computer
|
||||
DWORD dwLocalPort; // port number on local computer
|
||||
DWORD dwProcessId;
|
||||
} MIB_UDPEXROW, *PMIB_UDPEXROW;
|
||||
|
||||
typedef struct {
|
||||
DWORD dwNumEntries;
|
||||
MIB_UDPEXROW table[ANY_SIZE];
|
||||
} MIB_UDPEXTABLE, *PMIB_UDPEXTABLE;
|
||||
|
||||
|
||||
//
|
||||
// GetPortName
|
||||
//
|
||||
// Translate port numbers into their text equivalent if there is one
|
||||
//
|
||||
PCHAR
|
||||
GetPortName(DWORD Flags, UINT port, PCHAR proto, PCHAR name, int namelen)
|
||||
{
|
||||
struct servent *psrvent;
|
||||
|
||||
if (Flags & FLAG_SHOW_NUMBERS) {
|
||||
sprintf(name, "%d", htons((WORD)port));
|
||||
return name;
|
||||
}
|
||||
// Try to translate to a name
|
||||
if (psrvent = getservbyport(port, proto)) {
|
||||
strcpy(name, psrvent->s_name );
|
||||
} else {
|
||||
sprintf(name, "%d", htons((WORD)port));
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GetIpHostName
|
||||
//
|
||||
// Translate IP addresses into their name-resolved form if possible.
|
||||
//
|
||||
PCHAR
|
||||
GetIpHostName(DWORD Flags, BOOL local, UINT ipaddr, PCHAR name, int namelen)
|
||||
{
|
||||
// struct hostent *phostent;
|
||||
UINT nipaddr;
|
||||
|
||||
// Does the user want raw numbers?
|
||||
nipaddr = htonl(ipaddr);
|
||||
if (Flags & FLAG_SHOW_NUMBERS ) {
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
(nipaddr >> 24) & 0xFF,
|
||||
(nipaddr >> 16) & 0xFF,
|
||||
(nipaddr >> 8) & 0xFF,
|
||||
(nipaddr) & 0xFF);
|
||||
return name;
|
||||
}
|
||||
|
||||
name[0] = _T('\0');
|
||||
|
||||
// Try to translate to a name
|
||||
if (!ipaddr) {
|
||||
if (!local) {
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
(nipaddr >> 24) & 0xFF,
|
||||
(nipaddr >> 16) & 0xFF,
|
||||
(nipaddr >> 8) & 0xFF,
|
||||
(nipaddr) & 0xFF);
|
||||
} else {
|
||||
//gethostname(name, namelen);
|
||||
}
|
||||
} else if (ipaddr == 0x0100007f) {
|
||||
if (local) {
|
||||
//gethostname(name, namelen);
|
||||
} else {
|
||||
strcpy(name, "localhost");
|
||||
}
|
||||
// } else if (phostent = gethostbyaddr((char*)&ipaddr, sizeof(nipaddr), PF_INET)) {
|
||||
// strcpy(name, phostent->h_name);
|
||||
} else {
|
||||
#if 0
|
||||
int i1, i2, i3, i4;
|
||||
|
||||
i1 = (nipaddr >> 24) & 0x000000FF;
|
||||
i2 = (nipaddr >> 16) & 0x000000FF;
|
||||
i3 = (nipaddr >> 8) & 0x000000FF;
|
||||
i4 = (nipaddr) & 0x000000FF;
|
||||
|
||||
i1 = 10;
|
||||
i2 = 20;
|
||||
i3 = 30;
|
||||
i4 = 40;
|
||||
|
||||
sprintf(name, "%d.%d.%d.%d", i1,i2,i3,i4);
|
||||
#else
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
((nipaddr >> 24) & 0x000000FF),
|
||||
((nipaddr >> 16) & 0x000000FF),
|
||||
((nipaddr >> 8) & 0x000000FF),
|
||||
((nipaddr) & 0x000000FF));
|
||||
#endif
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
BOOLEAN usage(void)
|
||||
{
|
||||
TCHAR buffer[MAX_RESLEN];
|
||||
|
||||
int length = LoadString(GetModuleHandle(NULL), IDS_APP_USAGE, buffer, sizeof(buffer)/sizeof(buffer[0]));
|
||||
_fputts(buffer, stderr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// GetOptions
|
||||
//
|
||||
// Parses the command line arguments.
|
||||
//
|
||||
BOOLEAN
|
||||
GetOptions(int argc, char *argv[], PDWORD pFlags)
|
||||
{
|
||||
int i, j;
|
||||
BOOLEAN skipArgument;
|
||||
|
||||
*pFlags = 0;
|
||||
for (i = 1; i < argc; i++) {
|
||||
skipArgument = FALSE;
|
||||
switch (argv[i][0]) {
|
||||
case '-':
|
||||
case '/':
|
||||
j = 1;
|
||||
while (argv[i][j]) {
|
||||
switch (toupper(argv[i][j])) {
|
||||
case 'A':
|
||||
*pFlags |= FLAG_SHOW_ALL_ENDPOINTS;
|
||||
break;
|
||||
case 'E':
|
||||
*pFlags |= FLAG_SHOW_ETH_STATS;
|
||||
break;
|
||||
case 'N':
|
||||
*pFlags |= FLAG_SHOW_NUMBERS;
|
||||
break;
|
||||
case 'P':
|
||||
*pFlags |= FLAG_SHOW_PROT_CONNECTIONS;
|
||||
break;
|
||||
case 'R':
|
||||
*pFlags |= FLAG_SHOW_ROUTE_TABLE;
|
||||
break;
|
||||
case 'S':
|
||||
*pFlags |= FLAG_SHOW_PROT_STATS;
|
||||
break;
|
||||
default:
|
||||
return usage();
|
||||
}
|
||||
if (skipArgument) break;
|
||||
j++;
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
*pFlags |= FLAG_SHOW_INTERVAL;
|
||||
break;
|
||||
default:
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
||||
CHAR localname[HOSTNAMELEN], remotename[HOSTNAMELEN];
|
||||
CHAR remoteport[PORTNAMELEN], localport[PORTNAMELEN];
|
||||
CHAR localaddr[ADDRESSLEN], remoteaddr[ADDRESSLEN];
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
PMIB_TCPTABLE tcpTable;
|
||||
PMIB_UDPTABLE udpTable;
|
||||
DWORD error, dwSize;
|
||||
DWORD i, flags;
|
||||
|
||||
// Get options
|
||||
if (!GetOptions(argc, argv, &flags)) {
|
||||
return -1;
|
||||
} else {
|
||||
// Get the table of TCP endpoints
|
||||
dwSize = 0;
|
||||
error = GetTcpTable(NULL, &dwSize, TRUE);
|
||||
if (error != ERROR_INSUFFICIENT_BUFFER) {
|
||||
printf("Failed to snapshot TCP endpoints.\n");
|
||||
PrintError(error);
|
||||
return -1;
|
||||
}
|
||||
tcpTable = (PMIB_TCPTABLE)malloc(dwSize);
|
||||
error = GetTcpTable(tcpTable, &dwSize, TRUE );
|
||||
if (error) {
|
||||
printf("Failed to snapshot TCP endpoints table.\n");
|
||||
PrintError(error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get the table of UDP endpoints
|
||||
dwSize = 0;
|
||||
error = GetUdpTable(NULL, &dwSize, TRUE);
|
||||
if (error != ERROR_INSUFFICIENT_BUFFER) {
|
||||
printf("Failed to snapshot UDP endpoints.\n");
|
||||
PrintError(error);
|
||||
return -1;
|
||||
}
|
||||
udpTable = (PMIB_UDPTABLE)malloc(dwSize);
|
||||
error = GetUdpTable(udpTable, &dwSize, TRUE);
|
||||
if (error) {
|
||||
printf("Failed to snapshot UDP endpoints table.\n");
|
||||
PrintError(error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Dump the TCP table
|
||||
for (i = 0; i < tcpTable->dwNumEntries; i++) {
|
||||
if (flags & FLAG_SHOW_ALL_ENDPOINTS ||
|
||||
tcpTable->table[i].dwState == MIB_TCP_STATE_ESTAB) {
|
||||
sprintf(localaddr, "%s:%s",
|
||||
GetIpHostName(flags, TRUE, tcpTable->table[i].dwLocalAddr, localname, HOSTNAMELEN),
|
||||
GetPortName(flags, tcpTable->table[i].dwLocalPort, "tcp", localport, PORTNAMELEN));
|
||||
sprintf(remoteaddr, "%s:%s",
|
||||
GetIpHostName(flags, FALSE, tcpTable->table[i].dwRemoteAddr, remotename, HOSTNAMELEN),
|
||||
tcpTable->table[i].dwRemoteAddr ?
|
||||
GetPortName(flags, tcpTable->table[i].dwRemotePort, "tcp", remoteport, PORTNAMELEN):
|
||||
"0");
|
||||
printf("%4s\tState: %s\n", "[TCP]", TcpState[tcpTable->table[i].dwState]);
|
||||
printf(" Local: %s\n Remote: %s\n", localaddr, remoteaddr);
|
||||
}
|
||||
}
|
||||
// Dump the UDP table
|
||||
if (flags & FLAG_SHOW_ALL_ENDPOINTS) {
|
||||
for (i = 0; i < udpTable->dwNumEntries; i++) {
|
||||
sprintf(localaddr, "%s:%s",
|
||||
GetIpHostName(flags, TRUE, udpTable->table[i].dwLocalAddr, localname, HOSTNAMELEN),
|
||||
GetPortName(flags, udpTable->table[i].dwLocalPort, "tcp", localport, PORTNAMELEN));
|
||||
printf("%4s", "[UDP]");
|
||||
printf(" Local: %s\n Remote: %s\n", localaddr, "*.*.*.*:*");
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc > 1) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
_tprintf(_T("\nActive Connections\n\n")\
|
||||
_T(" Proto Local Address Foreign Address State\n\n"));
|
||||
test_snmp();
|
||||
|
||||
ShowTcpStatistics();
|
||||
ShowUdpStatistics();
|
||||
ShowIpStatistics();
|
||||
ShowNetworkParams();
|
||||
ShowAdapterInfo();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,40 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 netstat\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "netstat\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "netstat.exe\0"
|
||||
#include <reactos/version.rc>
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
#ifdef __GNUC__
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_APP_TITLE "ReactOS netstat"
|
||||
IDS_APP_USAGE "\n"\
|
||||
"Displays current TCP/IP protocol statistics and network connections.\n\n"\
|
||||
"NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]\n\n"\
|
||||
" -a Displays all connections and listening ports.\n"\
|
||||
" -e Displays Ethernet statistics. May be combined with -s\n"\
|
||||
" -n Displays address and port numbers in numeric form.\n"\
|
||||
" -p proto Shows connections for protocol 'proto' TCP or UDP.\n"\
|
||||
" If used with the -s option to display\n"\
|
||||
" per-protocol statistics, 'proto' may be TCP, UDP, or IP.\n"\
|
||||
" -r Displays the current routing table.\n"\
|
||||
" -s Displays per-protocol statistics. Statistics are shown for\n"\
|
||||
" TCP, UDP and IP by default; use -p option to display\n"\
|
||||
" information about a subset of the protocols only.\n"\
|
||||
" interval Redisplays selected statistics every 'interval' seconds.\n"\
|
||||
" Press CTRL+C to stop redisplaying. By default netstat will\n"\
|
||||
" print the current information only once.\n"
|
||||
END
|
||||
#endif
|
||||
|
@@ -1,7 +0,0 @@
|
||||
|
||||
#define RES_FIRST_INDEX 1
|
||||
#define RES_LAST_INDEX 25
|
||||
|
||||
#define IDS_APP_TITLE 100
|
||||
#define IDS_APP_USAGE 101
|
||||
|
@@ -1,53 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
|
||||
void _DebugBreak(void)
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
|
||||
void Trace(TCHAR* lpszFormat, ...)
|
||||
{
|
||||
va_list args;
|
||||
int nBuf;
|
||||
TCHAR szBuffer[512];
|
||||
|
||||
va_start(args, lpszFormat);
|
||||
nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
|
||||
OutputDebugString(szBuffer);
|
||||
// was there an error? was the expanded string too long?
|
||||
//ASSERT(nBuf >= 0);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg)
|
||||
{
|
||||
if (msg == NULL) {
|
||||
printf("ASSERT -- %s occured on line %u of file %s.\n",
|
||||
assert, line, file);
|
||||
} else {
|
||||
printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
|
||||
assert, line, file, msg);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Trace(TCHAR* lpszFormat, ...) { };
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg) { };
|
||||
|
||||
#endif //_DEBUG
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#ifndef __TRACE_H__
|
||||
#define __TRACE_H__
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#ifdef _X86_
|
||||
#define BreakPoint() _asm { int 3h }
|
||||
#else
|
||||
#define BreakPoint() _DebugBreak()
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, NULL); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
} \
|
||||
|
||||
#define ASSERTMSG(exp, msg) \
|
||||
{ \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, msg); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// MACRO: TRACE()
|
||||
//=============================================================================
|
||||
|
||||
#define TRACE Trace
|
||||
|
||||
|
||||
#else // _DEBUG
|
||||
|
||||
//=============================================================================
|
||||
// Define away MACRO's ASSERT() and TRACE() in non debug builds
|
||||
//=============================================================================
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp)
|
||||
#define ASSERTMSG(exp, msg)
|
||||
#endif
|
||||
|
||||
#define TRACE 0 ? (void)0 : Trace
|
||||
|
||||
#endif // !_DEBUG
|
||||
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg);
|
||||
void Trace(TCHAR* lpszFormat, ...);
|
||||
|
||||
|
||||
#endif // __TRACE_H__
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@@ -1,19 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = ping
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32_SOCKETS
|
||||
|
||||
TARGET_SDKLIBS = ws2_32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,631 +0,0 @@
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS ping utility
|
||||
* FILE: apps/net/ping/ping.c
|
||||
* PURPOSE: Network test utility
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
*/
|
||||
//#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <tchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#ifndef _MSC_VER
|
||||
|
||||
//#define DBG
|
||||
|
||||
/* FIXME: Where should this be? */
|
||||
#ifdef CopyMemory
|
||||
#undef CopyMemory
|
||||
#endif
|
||||
#define CopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length);
|
||||
|
||||
/* Should be in the header files somewhere (exported by ntdll.dll) */
|
||||
long atol(const char *str);
|
||||
|
||||
#ifndef __int64
|
||||
typedef long long __int64;
|
||||
#endif
|
||||
|
||||
char * _i64toa(__int64 value, char *string, int radix);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* General ICMP constants */
|
||||
#define ICMP_MINSIZE 8 /* Minimum ICMP packet size */
|
||||
#define ICMP_MAXSIZE 65535 /* Maximum ICMP packet size */
|
||||
|
||||
/* ICMP message types */
|
||||
#define ICMPMSG_ECHOREQUEST 8 /* ICMP ECHO request message */
|
||||
#define ICMPMSG_ECHOREPLY 0 /* ICMP ECHO reply message */
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
/* IPv4 header structure */
|
||||
typedef struct _IPv4_HEADER {
|
||||
unsigned char IHL:4;
|
||||
unsigned char Version:4;
|
||||
unsigned char TOS;
|
||||
unsigned short Length;
|
||||
unsigned short Id;
|
||||
unsigned short FragFlags;
|
||||
unsigned char TTL;
|
||||
unsigned char Protocol;
|
||||
unsigned short Checksum;
|
||||
unsigned int SrcAddress;
|
||||
unsigned int DstAddress;
|
||||
} IPv4_HEADER, *PIPv4_HEADER;
|
||||
|
||||
/* ICMP echo request/reply header structure */
|
||||
typedef struct _ICMP_HEADER {
|
||||
unsigned char Type;
|
||||
unsigned char Code;
|
||||
unsigned short Checksum;
|
||||
unsigned short Id;
|
||||
unsigned short SeqNum;
|
||||
} ICMP_HEADER, *PICMP_HEADER;
|
||||
|
||||
typedef struct _ICMP_ECHO_PACKET {
|
||||
ICMP_HEADER Icmp;
|
||||
LARGE_INTEGER Timestamp;
|
||||
} ICMP_ECHO_PACKET, *PICMP_ECHO_PACKET;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
BOOL InvalidOption;
|
||||
BOOL NeverStop;
|
||||
BOOL ResolveAddresses;
|
||||
UINT PingCount;
|
||||
UINT DataSize; /* ICMP echo request data size */
|
||||
BOOL DontFragment;
|
||||
ULONG TTLValue;
|
||||
ULONG TOSValue;
|
||||
ULONG Timeout;
|
||||
CHAR TargetName[256];
|
||||
SOCKET IcmpSock;
|
||||
SOCKADDR_IN Target;
|
||||
LPSTR TargetIP;
|
||||
FD_SET Fds;
|
||||
TIMEVAL Timeval;
|
||||
UINT CurrentSeqNum;
|
||||
UINT SentCount;
|
||||
UINT LostCount;
|
||||
BOOL MinRTTSet;
|
||||
LARGE_INTEGER MinRTT; /* Minimum round trip time in microseconds */
|
||||
LARGE_INTEGER MaxRTT;
|
||||
LARGE_INTEGER SumRTT;
|
||||
LARGE_INTEGER AvgRTT;
|
||||
LARGE_INTEGER TicksPerMs; /* Ticks per millisecond */
|
||||
LARGE_INTEGER TicksPerUs; /* Ticks per microsecond */
|
||||
BOOL UsePerformanceCounter;
|
||||
|
||||
|
||||
/* Display the contents of a buffer */
|
||||
VOID DisplayBuffer(
|
||||
PVOID Buffer,
|
||||
DWORD Size)
|
||||
{
|
||||
UINT i;
|
||||
PCHAR p;
|
||||
|
||||
printf("Buffer (0x%X) Size (0x%X).\n", Buffer, Size);
|
||||
|
||||
p = (PCHAR)Buffer;
|
||||
for (i = 0; i < Size; i++) {
|
||||
if (i % 16 == 0) {
|
||||
printf("\n");
|
||||
}
|
||||
printf("%02X ", (p[i]) & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
/* Display usage information on screen */
|
||||
VOID Usage(VOID)
|
||||
{
|
||||
printf("\nUsage: ping [-t] [-n count] [-l size] [-w timeout] destination-host\n\n");
|
||||
printf("Options:\n");
|
||||
printf(" -t Ping the specified host until stopped.\n");
|
||||
printf(" To stop - type Control-C.\n");
|
||||
printf(" -n count Number of echo requests to send.\n");
|
||||
printf(" -l size Send buffer size.\n");
|
||||
printf(" -w timeout Timeout in milliseconds to wait for each reply.\n\n");
|
||||
}
|
||||
|
||||
/* Reset configuration to default values */
|
||||
VOID Reset(VOID)
|
||||
{
|
||||
LARGE_INTEGER PerformanceCounterFrequency;
|
||||
|
||||
NeverStop = FALSE;
|
||||
ResolveAddresses = FALSE;
|
||||
PingCount = 4;
|
||||
DataSize = 32;
|
||||
DontFragment = FALSE;
|
||||
TTLValue = 128;
|
||||
TOSValue = 0;
|
||||
Timeout = 1000;
|
||||
UsePerformanceCounter = QueryPerformanceFrequency(&PerformanceCounterFrequency);
|
||||
|
||||
if (UsePerformanceCounter) {
|
||||
/* Performance counters may return incorrect results on some multiprocessor
|
||||
platforms so we restrict execution on the first processor. This may fail
|
||||
on Windows NT so we fall back to GetCurrentTick() for timing */
|
||||
if (SetThreadAffinityMask (GetCurrentThread(), 1) == 0) {
|
||||
UsePerformanceCounter = FALSE;
|
||||
}
|
||||
|
||||
/* Convert frequency to ticks per millisecond */
|
||||
TicksPerMs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000;
|
||||
/* And to ticks per microsecond */
|
||||
TicksPerUs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000000;
|
||||
}
|
||||
if (!UsePerformanceCounter) {
|
||||
/* 1 tick per millisecond for GetCurrentTick() */
|
||||
TicksPerMs.QuadPart = 1;
|
||||
/* GetCurrentTick() cannot handle microseconds */
|
||||
TicksPerUs.QuadPart = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return ULONG in a string */
|
||||
ULONG GetULONG(LPSTR String)
|
||||
{
|
||||
UINT i, Length;
|
||||
ULONG Value;
|
||||
|
||||
i = 0;
|
||||
Length = strlen(String);
|
||||
while ((i < Length) && ((String[i] < '0') || (String[i] > '9'))) i++;
|
||||
if ((i >= Length) || ((String[i] < '0') || (String[i] > '9'))) {
|
||||
InvalidOption = TRUE;
|
||||
return 0;
|
||||
}
|
||||
Value = (ULONG)atol(&String[i]);
|
||||
|
||||
return Value;
|
||||
}
|
||||
|
||||
/* Return ULONG in a string. Try next paramter if not successful */
|
||||
ULONG GetULONG2(LPSTR String1, LPSTR String2, PINT i)
|
||||
{
|
||||
ULONG Value;
|
||||
|
||||
Value = GetULONG(String1);
|
||||
if (InvalidOption) {
|
||||
InvalidOption = FALSE;
|
||||
if (String2[0] != '-') {
|
||||
Value = GetULONG(String2);
|
||||
if (!InvalidOption)
|
||||
*i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return Value;
|
||||
}
|
||||
|
||||
/* Parse command line parameters */
|
||||
BOOL ParseCmdline(int argc, char* argv[])
|
||||
{
|
||||
INT i;
|
||||
BOOL ShowUsage;
|
||||
BOOL FoundTarget;
|
||||
//#if 1
|
||||
// lstrcpy(TargetName, "127.0.0.1");
|
||||
// PingCount = 1;
|
||||
// return TRUE;
|
||||
//#endif
|
||||
if (argc < 2) {
|
||||
ShowUsage = TRUE;
|
||||
} else {
|
||||
ShowUsage = FALSE;
|
||||
}
|
||||
FoundTarget = FALSE;
|
||||
InvalidOption = FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
switch (argv[i][1]) {
|
||||
case 't': NeverStop = TRUE; break;
|
||||
case 'a': ResolveAddresses = TRUE; break;
|
||||
case 'n': PingCount = GetULONG2(&argv[i][2], argv[i + 1], &i); break;
|
||||
case 'l':
|
||||
DataSize = GetULONG2(&argv[i][2], argv[i + 1], &i);
|
||||
if ((DataSize < 0) || (DataSize > ICMP_MAXSIZE - sizeof(ICMP_ECHO_PACKET))) {
|
||||
printf("Bad value for option -l, valid range is from 0 to %d.\n",
|
||||
ICMP_MAXSIZE - sizeof(ICMP_ECHO_PACKET));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case 'f': DontFragment = TRUE; break;
|
||||
case 'i': TTLValue = GetULONG2(&argv[i][2], argv[i + 1], &i); break;
|
||||
case 'v': TOSValue = GetULONG2(&argv[i][2], argv[i + 1], &i); break;
|
||||
case 'w': Timeout = GetULONG2(&argv[i][2], argv[i + 1], &i); break;
|
||||
default:
|
||||
printf("Bad option %s.\n", argv[i]);
|
||||
Usage();
|
||||
return FALSE;
|
||||
}
|
||||
if (InvalidOption) {
|
||||
printf("Bad option format %s.\n", argv[i]);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (FoundTarget) {
|
||||
printf("Bad parameter %s.\n", argv[i]);
|
||||
return FALSE;
|
||||
} else {
|
||||
lstrcpy(TargetName, argv[i]);
|
||||
FoundTarget = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((!ShowUsage) && (!FoundTarget)) {
|
||||
printf("Name or IP address of destination host must be specified.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ShowUsage) {
|
||||
Usage();
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Calculate checksum of data */
|
||||
WORD Checksum(PUSHORT data, UINT size)
|
||||
{
|
||||
ULONG sum = 0;
|
||||
|
||||
while (size > 1) {
|
||||
sum += *data++;
|
||||
size -= sizeof(USHORT);
|
||||
}
|
||||
|
||||
if (size)
|
||||
sum += *(UCHAR*)data;
|
||||
|
||||
sum = (sum >> 16) + (sum & 0xFFFF);
|
||||
sum += (sum >> 16);
|
||||
|
||||
return (USHORT)(~sum);
|
||||
}
|
||||
|
||||
/* Prepare to ping target */
|
||||
BOOL Setup(VOID)
|
||||
{
|
||||
WORD wVersionRequested;
|
||||
WSADATA WsaData;
|
||||
INT Status;
|
||||
ULONG Addr;
|
||||
PHOSTENT phe;
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 2);
|
||||
|
||||
Status = WSAStartup(wVersionRequested, &WsaData);
|
||||
if (Status != 0) {
|
||||
printf("Could not initialize winsock dll.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
IcmpSock = WSASocket(AF_INET, SOCK_RAW, IPPROTO_ICMP, NULL, 0, 0);
|
||||
if (IcmpSock == INVALID_SOCKET) {
|
||||
printf("Could not create socket (#%d).\n", WSAGetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ZeroMemory(&Target, sizeof(Target));
|
||||
phe = NULL;
|
||||
Addr = inet_addr(TargetName);
|
||||
if (Addr == INADDR_NONE) {
|
||||
phe = gethostbyname(TargetName);
|
||||
if (phe == NULL) {
|
||||
printf("Unknown host %s.\n", TargetName);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (phe != NULL) {
|
||||
CopyMemory(&Target.sin_addr, phe->h_addr, phe->h_length);
|
||||
} else {
|
||||
Target.sin_addr.s_addr = Addr;
|
||||
}
|
||||
|
||||
if (phe != NULL) {
|
||||
Target.sin_family = phe->h_addrtype;
|
||||
} else {
|
||||
Target.sin_family = AF_INET;
|
||||
}
|
||||
|
||||
TargetIP = inet_ntoa(Target.sin_addr);
|
||||
CurrentSeqNum = 0;
|
||||
SentCount = 0;
|
||||
LostCount = 0;
|
||||
MinRTT.QuadPart = 0;
|
||||
MaxRTT.QuadPart = 0;
|
||||
SumRTT.QuadPart = 0;
|
||||
MinRTTSet = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Close socket */
|
||||
VOID Cleanup(VOID)
|
||||
{
|
||||
if (IcmpSock != INVALID_SOCKET)
|
||||
closesocket(IcmpSock);
|
||||
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
VOID QueryTime(PLARGE_INTEGER Time)
|
||||
{
|
||||
if (UsePerformanceCounter) {
|
||||
if (QueryPerformanceCounter(Time) == 0) {
|
||||
/* This should not happen, but we fall
|
||||
back to GetCurrentTick() if it does */
|
||||
Time->u.LowPart = (ULONG)GetTickCount();
|
||||
Time->u.HighPart = 0;
|
||||
|
||||
/* 1 tick per millisecond for GetCurrentTick() */
|
||||
TicksPerMs.QuadPart = 1;
|
||||
/* GetCurrentTick() cannot handle microseconds */
|
||||
TicksPerUs.QuadPart = 1;
|
||||
|
||||
UsePerformanceCounter = FALSE;
|
||||
}
|
||||
} else {
|
||||
Time->u.LowPart = (ULONG)GetTickCount();
|
||||
Time->u.HighPart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
|
||||
{
|
||||
UINT i, Length;
|
||||
CHAR Convstr[40];
|
||||
LARGE_INTEGER LargeTime;
|
||||
|
||||
LargeTime.QuadPart = Time.QuadPart / TicksPerMs.QuadPart;
|
||||
|
||||
_i64toa(LargeTime.QuadPart, Convstr, 10);
|
||||
strcpy(String, Convstr);
|
||||
strcat(String, "ms");
|
||||
}
|
||||
|
||||
/* Locate the ICMP data and print it. Returns TRUE if the packet was good,
|
||||
FALSE if not */
|
||||
BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
|
||||
{
|
||||
PIPv4_HEADER IpHeader;
|
||||
PICMP_ECHO_PACKET Icmp;
|
||||
UINT IphLength;
|
||||
CHAR Time[100];
|
||||
LARGE_INTEGER RelativeTime;
|
||||
LARGE_INTEGER LargeTime;
|
||||
CHAR Sign[1];
|
||||
|
||||
IpHeader = (PIPv4_HEADER)buffer;
|
||||
|
||||
IphLength = IpHeader->IHL * 4;
|
||||
|
||||
if (size < IphLength + ICMP_MINSIZE) {
|
||||
#ifdef DBG
|
||||
printf("Bad size (0x%X < 0x%X)\n", size, IphLength + ICMP_MINSIZE);
|
||||
#endif /* DBG */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Icmp = (PICMP_ECHO_PACKET)(buffer + IphLength);
|
||||
|
||||
if (Icmp->Icmp.Type != ICMPMSG_ECHOREPLY) {
|
||||
#ifdef DBG
|
||||
printf("Bad ICMP type (0x%X should be 0x%X)\n", Icmp->Icmp.Type, ICMPMSG_ECHOREPLY);
|
||||
#endif /* DBG */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Icmp->Icmp.Id != (USHORT)GetCurrentProcessId()) {
|
||||
#ifdef DBG
|
||||
printf("Bad ICMP id (0x%X should be 0x%X)\n", Icmp->Icmp.Id, (USHORT)GetCurrentProcessId());
|
||||
#endif /* DBG */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
QueryTime(&LargeTime);
|
||||
|
||||
RelativeTime.QuadPart = (LargeTime.QuadPart - Icmp->Timestamp.QuadPart);
|
||||
|
||||
if ((RelativeTime.QuadPart / TicksPerMs.QuadPart) < 1) {
|
||||
strcpy(Sign, "<");
|
||||
strcpy(Time, "1ms");
|
||||
} else {
|
||||
strcpy(Sign, "=");
|
||||
TimeToMsString(Time, RelativeTime);
|
||||
}
|
||||
|
||||
|
||||
printf("Reply from %s: bytes=%d time%s%s TTL=%d\n", inet_ntoa(from->sin_addr),
|
||||
size - IphLength - sizeof(ICMP_ECHO_PACKET), Sign, Time, IpHeader->TTL);
|
||||
if (RelativeTime.QuadPart < MinRTT.QuadPart) {
|
||||
MinRTT.QuadPart = RelativeTime.QuadPart;
|
||||
MinRTTSet = TRUE;
|
||||
}
|
||||
if (RelativeTime.QuadPart > MaxRTT.QuadPart)
|
||||
MaxRTT.QuadPart = RelativeTime.QuadPart;
|
||||
SumRTT.QuadPart += RelativeTime.QuadPart;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Send and receive one ping */
|
||||
BOOL Ping(VOID)
|
||||
{
|
||||
INT Status;
|
||||
SOCKADDR From;
|
||||
UINT Length;
|
||||
PVOID Buffer;
|
||||
UINT Size;
|
||||
PICMP_ECHO_PACKET Packet;
|
||||
|
||||
/* Account for extra space for IP header when packet is received */
|
||||
Size = DataSize + 128;
|
||||
Buffer = GlobalAlloc(0, Size);
|
||||
if (!Buffer) {
|
||||
printf("Not enough free resources available.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ZeroMemory(Buffer, Size);
|
||||
Packet = (PICMP_ECHO_PACKET)Buffer;
|
||||
|
||||
/* Assemble ICMP echo request packet */
|
||||
Packet->Icmp.Type = ICMPMSG_ECHOREQUEST;
|
||||
Packet->Icmp.Code = 0;
|
||||
Packet->Icmp.Id = (USHORT)GetCurrentProcessId();
|
||||
Packet->Icmp.SeqNum = (USHORT)CurrentSeqNum;
|
||||
Packet->Icmp.Checksum = 0;
|
||||
|
||||
/* Timestamp is part of data area */
|
||||
QueryTime(&Packet->Timestamp);
|
||||
|
||||
CopyMemory(Buffer, &Packet->Icmp, sizeof(ICMP_ECHO_PACKET) + DataSize);
|
||||
/* Calculate checksum for ICMP header and data area */
|
||||
Packet->Icmp.Checksum = Checksum((PUSHORT)&Packet->Icmp, sizeof(ICMP_ECHO_PACKET) + DataSize);
|
||||
|
||||
CurrentSeqNum++;
|
||||
|
||||
/* Send ICMP echo request */
|
||||
|
||||
FD_ZERO(&Fds);
|
||||
FD_SET(IcmpSock, &Fds);
|
||||
Timeval.tv_sec = Timeout / 1000;
|
||||
Timeval.tv_usec = Timeout % 1000;
|
||||
Status = select(0, NULL, &Fds, NULL, &Timeval);
|
||||
if ((Status != SOCKET_ERROR) && (Status != 0)) {
|
||||
|
||||
#ifdef DBG
|
||||
printf("Sending packet\n");
|
||||
DisplayBuffer(Buffer, sizeof(ICMP_ECHO_PACKET) + DataSize);
|
||||
printf("\n");
|
||||
#endif /* DBG */
|
||||
|
||||
Status = sendto(IcmpSock, Buffer, sizeof(ICMP_ECHO_PACKET) + DataSize,
|
||||
0, (SOCKADDR*)&Target, sizeof(Target));
|
||||
SentCount++;
|
||||
}
|
||||
if (Status == SOCKET_ERROR) {
|
||||
if (WSAGetLastError() == WSAEHOSTUNREACH) {
|
||||
printf("Destination host unreachable.\n");
|
||||
} else {
|
||||
printf("Could not transmit data (%d).\n", WSAGetLastError());
|
||||
}
|
||||
GlobalFree(Buffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Expect to receive ICMP echo reply */
|
||||
FD_ZERO(&Fds);
|
||||
FD_SET(IcmpSock, &Fds);
|
||||
Timeval.tv_sec = Timeout / 1000;
|
||||
Timeval.tv_usec = Timeout % 1000;
|
||||
|
||||
Status = select(0, &Fds, NULL, NULL, &Timeval);
|
||||
if ((Status != SOCKET_ERROR) && (Status != 0)) {
|
||||
Length = sizeof(From);
|
||||
Status = recvfrom(IcmpSock, Buffer, Size, 0, &From, &Length);
|
||||
|
||||
#ifdef DBG
|
||||
printf("Received packet\n");
|
||||
DisplayBuffer(Buffer, Status);
|
||||
printf("\n");
|
||||
#endif /* DBG */
|
||||
}
|
||||
if (Status == SOCKET_ERROR) {
|
||||
if (WSAGetLastError() != WSAETIMEDOUT) {
|
||||
printf("Could not receive data (%d).\n", WSAGetLastError());
|
||||
GlobalFree(Buffer);
|
||||
return FALSE;
|
||||
}
|
||||
Status = 0;
|
||||
}
|
||||
|
||||
if (Status == 0) {
|
||||
printf("Request timed out.\n");
|
||||
LostCount++;
|
||||
GlobalFree(Buffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!DecodeResponse(Buffer, Status, (PSOCKADDR_IN)&From)) {
|
||||
/* FIXME: Wait again as it could be another ICMP message type */
|
||||
printf("Request timed out (incomplete datagram received).\n");
|
||||
LostCount++;
|
||||
}
|
||||
|
||||
GlobalFree(Buffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Program entry point */
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UINT Count;
|
||||
CHAR MinTime[20];
|
||||
CHAR MaxTime[20];
|
||||
CHAR AvgTime[20];
|
||||
|
||||
Reset();
|
||||
|
||||
if ((ParseCmdline(argc, argv)) && (Setup())) {
|
||||
|
||||
printf("\nPinging %s [%s] with %d bytes of data:\n\n",
|
||||
TargetName, TargetIP, DataSize);
|
||||
|
||||
Count = 0;
|
||||
while ((NeverStop) || (Count < PingCount)) {
|
||||
Ping();
|
||||
Sleep(Timeout);
|
||||
Count++;
|
||||
};
|
||||
|
||||
Cleanup();
|
||||
|
||||
/* Calculate avarage round trip time */
|
||||
if ((SentCount - LostCount) > 0) {
|
||||
AvgRTT.QuadPart = SumRTT.QuadPart / (SentCount - LostCount);
|
||||
} else {
|
||||
AvgRTT.QuadPart = 0;
|
||||
}
|
||||
|
||||
/* Calculate loss percent */
|
||||
if (LostCount > 0) {
|
||||
Count = (SentCount * 100) / LostCount;
|
||||
} else {
|
||||
Count = 0;
|
||||
}
|
||||
|
||||
if (!MinRTTSet)
|
||||
MinRTT = MaxRTT;
|
||||
|
||||
TimeToMsString(MinTime, MinRTT);
|
||||
TimeToMsString(MaxTime, MaxRTT);
|
||||
TimeToMsString(AvgTime, AvgRTT);
|
||||
|
||||
/* Print statistics */
|
||||
printf("\nPing statistics for %s:\n", TargetIP);
|
||||
printf(" Packets: Sent = %d, Received = %d, Lost = %d (%d%% loss),\n",
|
||||
SentCount, SentCount - LostCount, LostCount, Count);
|
||||
printf("Approximate round trip times in milli-seconds:\n");
|
||||
printf(" Minimum = %s, Maximum = %s, Average = %s\n",
|
||||
MinTime, MaxTime, AvgTime);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
@@ -1,7 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 Ping\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "ping\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "ping.exe\0"
|
||||
#define REACTOS_STR_ORIGINAL_COPYRIGHT "Casper S. Hornstrup (chorns@users.sourceforge.net)\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: list.cpp
|
||||
* PURPOSE: A doubly linked list implementation
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
* NOTES: The linked list does it's own heap management for
|
||||
* better performance
|
||||
* TODO: - InsertBefore(), InsertAfter(), Move()
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <list.h>
|
||||
|
||||
// **************************** CListNode ****************************
|
||||
|
||||
HANDLE CListNode::hHeap = NULL;
|
||||
INT CListNode::nRef = 0;
|
||||
|
||||
// Default constructor
|
||||
CListNode::CListNode()
|
||||
{
|
||||
Element = NULL;
|
||||
Next = NULL;
|
||||
Prev = NULL;
|
||||
}
|
||||
|
||||
// Constructor with element and next as starter values
|
||||
CListNode::CListNode(PVOID element, CListNode *next, CListNode *prev)
|
||||
{
|
||||
Element = element;
|
||||
Next = next;
|
||||
Prev = prev;
|
||||
}
|
||||
|
||||
void* CListNode::operator new(/*size_t*/ UINT size)
|
||||
{
|
||||
PVOID p;
|
||||
if (hHeap == NULL) {
|
||||
SYSTEM_INFO inf;
|
||||
GetSystemInfo(&inf);
|
||||
hHeap = HeapCreate(0, inf.dwAllocationGranularity, 0);
|
||||
}
|
||||
if ((p = HeapAlloc(hHeap, 0, size)) != NULL)
|
||||
nRef++;
|
||||
return p;
|
||||
}
|
||||
|
||||
VOID CListNode::operator delete(void* p)
|
||||
{
|
||||
if (HeapFree(hHeap, 0, p) != FALSE)
|
||||
nRef--;
|
||||
if (nRef == 0) {
|
||||
HeapDestroy(hHeap);
|
||||
hHeap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Set element
|
||||
VOID CListNode::SetElement(PVOID element)
|
||||
{
|
||||
Element = element;
|
||||
}
|
||||
|
||||
// Set pointer to next node in list
|
||||
VOID CListNode::SetNext(CListNode *next)
|
||||
{
|
||||
Next = next;
|
||||
}
|
||||
|
||||
// Set pointer to previous node in list
|
||||
VOID CListNode::SetPrev(CListNode *prev)
|
||||
{
|
||||
Prev = prev;
|
||||
}
|
||||
|
||||
// Get element of node
|
||||
PVOID CListNode::GetElement()
|
||||
{
|
||||
return Element;
|
||||
}
|
||||
|
||||
// Get pointer to next node in list
|
||||
CListNode *CListNode::GetNext()
|
||||
{
|
||||
return Next;
|
||||
}
|
||||
|
||||
// Get pointer to previous node in list
|
||||
CListNode *CListNode::GetPrev()
|
||||
{
|
||||
return Prev;
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS HTTP Win32 Server\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "roshttpd\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "roshttpd.exe\0"
|
||||
#include <reactos/version.rc>
|
@@ -1,344 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: socket.cpp
|
||||
* PURPOSE: Socket classes
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <error.h>
|
||||
#include <socket.h>
|
||||
#include <iterator.h>
|
||||
|
||||
// ***************************** CSocket *****************************
|
||||
|
||||
// Default constructor
|
||||
CSocket::CSocket()
|
||||
{
|
||||
Active = FALSE;
|
||||
Event = WSA_INVALID_EVENT;
|
||||
Events = 0;
|
||||
Socket = INVALID_SOCKET;
|
||||
|
||||
// INET address family
|
||||
SockAddrIn.sin_family = AF_INET;
|
||||
|
||||
// Any address will do
|
||||
SockAddrIn.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
// Convert to network ordering
|
||||
SockAddrIn.sin_port = htons(0);
|
||||
}
|
||||
|
||||
// Default destructor
|
||||
CSocket::~CSocket()
|
||||
{
|
||||
}
|
||||
|
||||
// Return winsock socket handle
|
||||
SOCKET CSocket::GetSocket()
|
||||
{
|
||||
return Socket;
|
||||
}
|
||||
|
||||
// Set winsock socket handle
|
||||
VOID CSocket::SetSocket(SOCKET socket)
|
||||
{
|
||||
Socket = socket;
|
||||
}
|
||||
|
||||
|
||||
// Return socket address
|
||||
SOCKADDR_IN CSocket::GetSockAddrIn()
|
||||
{
|
||||
return SockAddrIn;
|
||||
}
|
||||
|
||||
// Set socket address
|
||||
VOID CSocket::SetSockAddrIn(SOCKADDR_IN sockaddrin)
|
||||
{
|
||||
SockAddrIn = sockaddrin;
|
||||
}
|
||||
|
||||
// Associate winsock events with socket
|
||||
VOID CSocket::SetEvents(LONG lEvents)
|
||||
{
|
||||
if (Event == WSA_INVALID_EVENT) {
|
||||
// Create socket event
|
||||
Event = WSACreateEvent();
|
||||
if (Event == WSA_INVALID_EVENT)
|
||||
throw ESocketOpen(TS("Unable to create event."));
|
||||
}
|
||||
|
||||
if (lEvents != Events) {
|
||||
// Associate network events with socket
|
||||
if (WSAEventSelect(Socket, Event, lEvents) == SOCKET_ERROR)
|
||||
throw ESocketOpen(TS("Unable to select socket events."));
|
||||
Events = lEvents;
|
||||
}
|
||||
}
|
||||
|
||||
// Return associated winsock events
|
||||
LONG CSocket::GetEvents()
|
||||
{
|
||||
return Events;
|
||||
}
|
||||
|
||||
// Open socket
|
||||
VOID CSocket::Open()
|
||||
{
|
||||
}
|
||||
|
||||
// Close socket
|
||||
VOID CSocket::Close()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// *********************** CServerClientSocket ***********************
|
||||
|
||||
// Constructor with serversocket as parameter
|
||||
CServerClientSocket::CServerClientSocket(LPCServerSocket lpServerSocket)
|
||||
{
|
||||
ServerSocket = lpServerSocket;
|
||||
}
|
||||
|
||||
// Transmit data to socket
|
||||
INT CServerClientSocket::Transmit( LPSTR lpsBuffer, UINT nLength)
|
||||
{
|
||||
return send(Socket, lpsBuffer, nLength, 0);
|
||||
}
|
||||
|
||||
// Send a string to socket
|
||||
INT CServerClientSocket::SendText( LPSTR lpsText)
|
||||
{
|
||||
static CHAR crlf[3] = {0x0D, 0x0A, 0x00};
|
||||
INT nCount;
|
||||
|
||||
nCount = Transmit(lpsText, strlen(lpsText));
|
||||
nCount += Transmit(crlf, strlen(crlf));
|
||||
return nCount;
|
||||
}
|
||||
|
||||
// Receive data from socket
|
||||
INT CServerClientSocket::Receive(LPSTR lpsBuffer, UINT nLength)
|
||||
{
|
||||
return recv(Socket, lpsBuffer, nLength, 0);
|
||||
}
|
||||
|
||||
// Process winsock messages if any
|
||||
VOID CServerClientSocket::MessageLoop()
|
||||
{
|
||||
UINT nStatus;
|
||||
WSANETWORKEVENTS NetworkEvents;
|
||||
|
||||
nStatus = WSAWaitForMultipleEvents(1, &Event, FALSE, 0, FALSE);
|
||||
if ((nStatus == 0) && (WSAEnumNetworkEvents(Socket, Event, &NetworkEvents) != SOCKET_ERROR)) {
|
||||
if ((NetworkEvents.lNetworkEvents & FD_READ) != 0) {
|
||||
OnRead();
|
||||
}
|
||||
if ((NetworkEvents.lNetworkEvents & FD_CLOSE) != 0) {
|
||||
OnClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return server socket that own this socket
|
||||
LPCServerSocket CServerClientSocket::GetServerSocket()
|
||||
{
|
||||
return ServerSocket;
|
||||
}
|
||||
|
||||
|
||||
// *********************** CServerClientThread ***********************
|
||||
|
||||
CServerClientThread::CServerClientThread(LPCServerClientSocket lpSocket)
|
||||
{
|
||||
ClientSocket = lpSocket;
|
||||
}
|
||||
|
||||
CServerClientThread::~CServerClientThread()
|
||||
{
|
||||
ClientSocket->GetServerSocket()->RemoveClient((LPCServerClientThread) this);
|
||||
}
|
||||
|
||||
|
||||
// ************************** CServerSocket **************************
|
||||
|
||||
// Default constructor
|
||||
CServerSocket::CServerSocket()
|
||||
{
|
||||
}
|
||||
|
||||
// Default destructor
|
||||
CServerSocket::~CServerSocket()
|
||||
{
|
||||
if (Active)
|
||||
Close();
|
||||
}
|
||||
|
||||
// Open server socket so clients can connect
|
||||
VOID CServerSocket::Open()
|
||||
{
|
||||
assert(!Active);
|
||||
|
||||
// Convert to network ordering
|
||||
SockAddrIn.sin_port = htons(Port);
|
||||
|
||||
if (Socket == INVALID_SOCKET) {
|
||||
// Create socket
|
||||
Socket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (Socket == INVALID_SOCKET)
|
||||
throw ESocketOpen(TS("Unable to allocate a socket."));
|
||||
}
|
||||
|
||||
// Associate an address with server socket
|
||||
if (bind(Socket, (struct sockaddr FAR *) &SockAddrIn, sizeof(SockAddrIn)) == SOCKET_ERROR)
|
||||
throw ESocketOpen(TS("Unable to associate address with socket."));
|
||||
|
||||
// Listen for incoming connections
|
||||
if (listen(Socket, MAX_PENDING_CONNECTS) != 0)
|
||||
throw ESocketOpen(TS("Unable to listen on socket."));
|
||||
|
||||
// Associate network events with socket
|
||||
SetEvents(FD_ACCEPT | FD_CONNECT | FD_CLOSE);
|
||||
|
||||
Active = TRUE;
|
||||
}
|
||||
|
||||
// Close server socket and all current connections
|
||||
VOID CServerSocket::Close()
|
||||
{
|
||||
assert(Active);
|
||||
|
||||
if (Event != WSA_INVALID_EVENT) {
|
||||
// Tell winsock not to notify us about any events
|
||||
if (WSAEventSelect(Socket, Event, 0) == SOCKET_ERROR)
|
||||
throw ESocketClose(TS("Unable to select socket events."));
|
||||
|
||||
if (!WSACloseEvent(Event))
|
||||
throw ESocketClose(TS("Unable to close socket event."));
|
||||
Event = WSA_INVALID_EVENT;
|
||||
}
|
||||
|
||||
CIterator<LPCServerClientThread> *i = Connections.CreateIterator();
|
||||
|
||||
// Terminate and free all client threads
|
||||
for (i->First(); !i->IsDone(); i->Next()) {
|
||||
//i->CurrentItem()->Terminate();
|
||||
delete i->CurrentItem();
|
||||
}
|
||||
delete i;
|
||||
Connections.RemoveAll();
|
||||
|
||||
closesocket(Socket);
|
||||
Socket = INVALID_SOCKET;
|
||||
|
||||
Active = FALSE;
|
||||
}
|
||||
|
||||
// Set port number to listen on
|
||||
VOID CServerSocket::SetPort(UINT nPort)
|
||||
{
|
||||
assert(!Active);
|
||||
|
||||
Port = nPort;
|
||||
}
|
||||
|
||||
// Process messages from winsock if any
|
||||
VOID CServerSocket::MessageLoop()
|
||||
{
|
||||
UINT nStatus;
|
||||
INT nAddrLen;
|
||||
SOCKET ClientSocket;
|
||||
SOCKADDR_IN SockAddrIn;
|
||||
WSANETWORKEVENTS NetworkEvents;
|
||||
LPCServerClientSocket lpClient;
|
||||
LPCServerClientThread lpThread;
|
||||
|
||||
nStatus = WSAWaitForMultipleEvents(1, &Event, FALSE, 0, FALSE);
|
||||
if ((nStatus == 0) && (WSAEnumNetworkEvents(Socket, Event, &NetworkEvents) != SOCKET_ERROR)) {
|
||||
if ((NetworkEvents.lNetworkEvents & FD_ACCEPT) != 0) {
|
||||
lpClient = OnGetSocket(this);
|
||||
nAddrLen = sizeof(SockAddrIn);
|
||||
ClientSocket = accept(Socket, (SOCKADDR *) &SockAddrIn, &nAddrLen);
|
||||
if (ClientSocket != INVALID_SOCKET) {
|
||||
// Set socket handle
|
||||
lpClient->SetSocket(ClientSocket);
|
||||
// Set socket address
|
||||
lpClient->SetSockAddrIn(SockAddrIn);
|
||||
// Set winsock events
|
||||
lpClient->SetEvents(FD_READ | FD_CLOSE);
|
||||
// Create client connection thread
|
||||
lpThread = OnGetThread(lpClient);
|
||||
// Add client thread to connection list
|
||||
InsertClient(lpThread);
|
||||
// Call OnAccept event handler
|
||||
OnAccept(lpThread);
|
||||
} else {
|
||||
delete lpClient;
|
||||
lpClient = NULL;
|
||||
throw ESocketOpen(TS("No more sockets available."));
|
||||
}
|
||||
}
|
||||
/*if ((NetworkEvents.lNetworkEvents & FD_CONNECT) != 0) {
|
||||
}
|
||||
if ((NetworkEvents.lNetworkEvents & FD_CLOSE) != 0) {
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
// Insert client into connection list
|
||||
VOID CServerSocket::InsertClient(LPCServerClientThread lpClient)
|
||||
{
|
||||
Connections.Insert(lpClient);
|
||||
}
|
||||
|
||||
// Remove client from connection list
|
||||
VOID CServerSocket::RemoveClient(LPCServerClientThread lpClient)
|
||||
{
|
||||
Connections.Remove(lpClient);
|
||||
}
|
||||
|
||||
// OnGetSocket event handler
|
||||
LPCServerClientSocket CServerSocket::OnGetSocket(LPCServerSocket lpServerSocket)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// OnGetThread event handler
|
||||
LPCServerClientThread CServerSocket::OnGetThread(LPCServerClientSocket lpSocket)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Initialize WinSock DLL
|
||||
VOID InitWinsock()
|
||||
{
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 0);
|
||||
|
||||
if (WSAStartup(wVersionRequested, &wsaData) != 0)
|
||||
// Return FALSE as we couldn't find a usable WinSock DLL
|
||||
throw ESocketWinsock(TS("Unable to initialize winsock dll."));
|
||||
|
||||
/* Confirm that the WinSock DLL supports 2.0 */
|
||||
|
||||
if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) {
|
||||
// We couldn't find a usable winsock dll
|
||||
WSACleanup();
|
||||
throw ESocketDll(TS("Winsock dll version is not 2.0 or higher."));
|
||||
}
|
||||
}
|
||||
|
||||
// Deinitialize WinSock DLL
|
||||
VOID DeinitWinsock()
|
||||
{
|
||||
if (WSACleanup() != 0)
|
||||
throw ESocketWinsock(TS("Unable to deinitialize winsock dll."));
|
||||
}
|
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: thread.cpp
|
||||
* PURPOSE: Generic thread class
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
*/
|
||||
#include <debug.h>
|
||||
#include <assert.h>
|
||||
#include <windows.h>
|
||||
#include <thread.h>
|
||||
|
||||
// This is the thread entry code
|
||||
DWORD WINAPI ThreadEntry(LPVOID parameter)
|
||||
{
|
||||
ThreadData *p = (ThreadData*) parameter;
|
||||
|
||||
p->ClassPtr->Execute();
|
||||
|
||||
SetEvent(p->hFinished);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Default constructor
|
||||
CThread::CThread()
|
||||
{
|
||||
bTerminated = FALSE;
|
||||
// Points to the class that is executed within thread
|
||||
Data.ClassPtr = this;
|
||||
// Create synchronization event
|
||||
Data.hFinished = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
// FIXME: Do some error handling
|
||||
assert(Data.hFinished != NULL);
|
||||
|
||||
// Create thread
|
||||
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadEntry, &Data, 0, &dwThreadId);
|
||||
|
||||
// FIXME: Do some error handling
|
||||
assert(hThread != NULL);
|
||||
}
|
||||
|
||||
// Default destructor
|
||||
CThread::~CThread()
|
||||
{
|
||||
if ((hThread != NULL) && (Data.hFinished != NULL)) {
|
||||
if (!bTerminated)
|
||||
Terminate();
|
||||
WaitForSingleObject(Data.hFinished, INFINITE);
|
||||
CloseHandle(Data.hFinished);
|
||||
CloseHandle(hThread);
|
||||
hThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Execute thread code
|
||||
void CThread::Execute()
|
||||
{
|
||||
while (!bTerminated) Sleep(0);
|
||||
}
|
||||
|
||||
// Post a message to the thread's message queue
|
||||
BOOL CThread::PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return PostThreadMessage(dwThreadId, Msg, wParam, lParam);
|
||||
}
|
||||
|
||||
// Gracefully terminate thread
|
||||
void CThread::Terminate()
|
||||
{
|
||||
bTerminated = TRUE;
|
||||
}
|
||||
|
||||
// Returns TRUE if thread is terminated, FALSE if not
|
||||
BOOL CThread::Terminated()
|
||||
{
|
||||
return bTerminated;
|
||||
}
|
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: config.cpp
|
||||
* PURPOSE: Daemon configuration
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
*/
|
||||
#include <new>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <config.h>
|
||||
#include <tchar.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
LPCConfig pConfiguration;
|
||||
LPCHttpDaemonThread pDaemonThread;
|
||||
|
||||
// Default constructor
|
||||
CConfig::CConfig()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
// Default destructor
|
||||
CConfig::~CConfig()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
// Clear configuration
|
||||
void CConfig::Reset()
|
||||
{
|
||||
MainBase = NULL;
|
||||
HttpBase = NULL;
|
||||
DefaultResources.RemoveAll();
|
||||
}
|
||||
|
||||
// Create default configuration. Can throw bad_alloc
|
||||
void CConfig::Default()
|
||||
{
|
||||
Clear();
|
||||
MainBase = (LPWSTR)_wcsdup(dcfgMainBase);
|
||||
HttpBase = _strdup(dcfgHttpBase);
|
||||
|
||||
LPSTR lpsStr;
|
||||
try {
|
||||
lpsStr = _strdup(dcfgDefaultResource);
|
||||
DefaultResources.Insert(lpsStr);
|
||||
} catch (bad_alloc e) {
|
||||
free((void *)lpsStr);
|
||||
Clear();
|
||||
throw;
|
||||
}
|
||||
|
||||
Port = dcfgDefaultPort;
|
||||
}
|
||||
|
||||
// Clear configuration
|
||||
void CConfig::Clear()
|
||||
{
|
||||
if (MainBase != NULL)
|
||||
free((void *)MainBase);
|
||||
if (HttpBase != NULL)
|
||||
free((void *)HttpBase);
|
||||
|
||||
// Free memory for all strings
|
||||
CIterator<LPSTR> *i = DefaultResources.CreateIterator();
|
||||
for (i->First(); !i->IsDone(); i->Next())
|
||||
free((void *)i->CurrentItem());
|
||||
delete i;
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
// Load configuration
|
||||
BOOL CConfig::Load()
|
||||
{
|
||||
Default();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Save configuration
|
||||
BOOL CConfig::Save()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Return MainBase
|
||||
LPWSTR CConfig::GetMainBase()
|
||||
{
|
||||
return MainBase;
|
||||
}
|
||||
|
||||
// Set MainBase
|
||||
void CConfig::SetMainBase(LPWSTR lpwsMainBase)
|
||||
{
|
||||
MainBase = lpwsMainBase;
|
||||
}
|
||||
|
||||
// Return HttpBase
|
||||
LPSTR CConfig::GetHttpBase()
|
||||
{
|
||||
return HttpBase;
|
||||
}
|
||||
|
||||
// Set HttpBase
|
||||
void CConfig::SetHttpBase(LPSTR lpsHttpBase)
|
||||
{
|
||||
HttpBase = lpsHttpBase;
|
||||
}
|
||||
|
||||
// Return DefaultResources
|
||||
CList<LPSTR>* CConfig::GetDefaultResources()
|
||||
{
|
||||
return &DefaultResources;
|
||||
}
|
||||
|
||||
// Return bound port
|
||||
USHORT CConfig::GetPort()
|
||||
{
|
||||
return Port;
|
||||
}
|
||||
|
||||
// Set port
|
||||
VOID CConfig::SetPort(USHORT wPort)
|
||||
{
|
||||
Port = wPort;
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: error.cpp
|
||||
* PURPOSE: Error reporting
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
*/
|
||||
#include <error.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void ReportErrorStr(LPTSTR lpsText)
|
||||
{
|
||||
wprintf((wchar_t*)lpsText);
|
||||
}
|
@@ -1,380 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: http.cpp
|
||||
* PURPOSE: HTTP 1.1 parser engine
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
* TODO: - Implement message-body
|
||||
* - Implement more generel-header entries
|
||||
* - Implement more request-header entries
|
||||
* - Implement more entity-header entries
|
||||
*/
|
||||
#include <debug.h>
|
||||
#include <iostream.h>
|
||||
#include <string.h>
|
||||
#include <http.h>
|
||||
|
||||
CHAR MethodTable[NUMMETHODS][8] = {"OPTIONS", "GET", "HEAD", "POST", "PUT",
|
||||
"DELETE", "TRACE"};
|
||||
|
||||
CHAR GenerelTable[NUMGENERELS][18] = {"Cache-Control", "Connection", "Date", "Pragma",
|
||||
"Transfer-Encoding", "Upgrade", "Via"};
|
||||
|
||||
CHAR RequestTable[NUMREQUESTS][20] = {"Accept", "Accept-Charset", "Accept-Encoding",
|
||||
"Accept-Language", "Authorization", "From", "Host", "If-Modified-Since", "If-Match",
|
||||
"If-None-Match", "If-Range", "If-Unmodified-Since", "Max-Forwards",
|
||||
"Proxy-Authorization", "Range", "Referer", "User-Agent"};
|
||||
|
||||
CHAR EntityTable[NUMENTITIES][17] = {"Allow", "Content-Base", "Content-Encoding",
|
||||
"Content-Language", "Content-Length", "Content-Location", "Content-MD5",
|
||||
"Content-Range", "Content-Type", "ETag", "Expires", "Last-Modified"};
|
||||
|
||||
// *************************** CHttpParser ***************************
|
||||
|
||||
// Default constructor
|
||||
CHttpParser::CHttpParser()
|
||||
{
|
||||
nHead = 0;
|
||||
nTail = 0;
|
||||
}
|
||||
|
||||
// Default destructor
|
||||
CHttpParser::~CHttpParser()
|
||||
{
|
||||
}
|
||||
|
||||
// Returns TRUE if a complete HTTP message is in buffer
|
||||
BOOL CHttpParser::Complete()
|
||||
{
|
||||
UINT nTmp;
|
||||
|
||||
/*DPRINT("--1:-%d---\n", sBuffer[nHead-2]);
|
||||
DPRINT("--2:-%d---\n", sBuffer[nHead-1]);
|
||||
|
||||
sBuffer[nHead] = '!';
|
||||
sBuffer[nHead+1] = 0;
|
||||
DPRINT("Examining buffer: (Head: %d, Tail: %d)\n", nHead, nTail);
|
||||
DPRINT("%s\n", (LPSTR)&sBuffer[nTail]);*/
|
||||
|
||||
nTmp = nTail;
|
||||
if (!Parse()) {
|
||||
if (!bUnknownMethod)
|
||||
nTail = nTmp;
|
||||
return FALSE;
|
||||
} else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Read a character from buffer
|
||||
BOOL CHttpParser::ReadChar(LPSTR lpsStr)
|
||||
{
|
||||
if (nTail <= nHead) {
|
||||
if (nTail != nHead) {
|
||||
lpsStr[0] = sBuffer[nTail];
|
||||
nTail++;
|
||||
return TRUE;
|
||||
} else {
|
||||
lpsStr[0] = 0;
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (nTail == sizeof(sBuffer))
|
||||
nTail = 0;
|
||||
if (nTail != nHead) {
|
||||
lpsStr[0] = sBuffer[nTail];
|
||||
nTail++;
|
||||
return TRUE;
|
||||
} else {
|
||||
lpsStr[0] = 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Peek at a character in the buffer
|
||||
BOOL CHttpParser::PeekChar(LPSTR lpsStr)
|
||||
{
|
||||
UINT nFakeTail;
|
||||
|
||||
if (nTail == sizeof(sBuffer))
|
||||
nFakeTail = 0;
|
||||
else
|
||||
nFakeTail = nTail;
|
||||
if (nFakeTail != nHead) {
|
||||
lpsStr[0] = sBuffer[nFakeTail];
|
||||
return TRUE;
|
||||
} else {
|
||||
lpsStr[0] = 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Read a string from buffer. Only A-Z, a-z, 0-9 and '-' are valid characters
|
||||
BOOL CHttpParser::ReadString(LPSTR lpsStr, UINT nLength)
|
||||
{
|
||||
UINT i = 0;
|
||||
CHAR sTmp;
|
||||
|
||||
while (PeekChar(&sTmp)) {
|
||||
if (((sTmp >= 'A') && (sTmp <= 'Z')) || ((sTmp >= 'a') && (sTmp <= 'z')) ||
|
||||
((sTmp >= '0') && (sTmp <= '9')) || (sTmp == '-')) {
|
||||
if (i >= (nLength - 1)) {
|
||||
lpsStr[0] = 0;
|
||||
return FALSE;
|
||||
}
|
||||
ReadChar(&sTmp);
|
||||
lpsStr[i] = sTmp;
|
||||
i++;
|
||||
} else {
|
||||
lpsStr[i] = 0;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
lpsStr[0] = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Read a string from buffer. Stop if SP or CR is found or when there are no more
|
||||
// characters
|
||||
BOOL CHttpParser::ReadSpecial(LPSTR lpsStr, UINT nLength)
|
||||
{
|
||||
UINT i = 0;
|
||||
CHAR sTmp;
|
||||
|
||||
while (PeekChar(&sTmp) && (sTmp != ' ') && (sTmp != 13)) {
|
||||
if (i >= (nLength - 1)) {
|
||||
lpsStr[nLength - 1] = 0;
|
||||
return FALSE;
|
||||
}
|
||||
ReadChar(&sTmp);
|
||||
lpsStr[i] = sTmp;
|
||||
i++;
|
||||
}
|
||||
lpsStr[i] = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Skip until "sCh" is found
|
||||
VOID CHttpParser::Skip(CHAR sCh)
|
||||
{
|
||||
CHAR sTmp;
|
||||
|
||||
while (PeekChar(&sTmp) && (sTmp != sCh))
|
||||
ReadChar(&sTmp);
|
||||
}
|
||||
|
||||
// Return TRUE if sCh is the next character
|
||||
BOOL CHttpParser::Expect(CHAR sCh)
|
||||
{
|
||||
CHAR sTmp;
|
||||
|
||||
if (PeekChar(&sTmp)) {
|
||||
if (sTmp == sCh) {
|
||||
ReadChar(&sTmp);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Return TRUE if CRLF are the next characters
|
||||
BOOL CHttpParser::ExpectCRLF()
|
||||
{
|
||||
return (Expect(13) && Expect(10));
|
||||
}
|
||||
|
||||
// Request = RequestLine | *( GenerelHeader | RequestHeader | EntityHeader )
|
||||
// CRLF [ MessageBody ]
|
||||
BOOL CHttpParser::Parse()
|
||||
{
|
||||
BOOL bStatus;
|
||||
|
||||
|
||||
CHAR ch;
|
||||
|
||||
if (RequestLine()) {
|
||||
do {
|
||||
if (!ReadString(sHeader, sizeof(sHeader)))
|
||||
break;
|
||||
bStatus = (GenerelHeader());
|
||||
bStatus = (RequestHeader() || bStatus);
|
||||
bStatus = (EntityHeader() || bStatus);
|
||||
} while (bStatus);
|
||||
// CRLF
|
||||
if (!ExpectCRLF())
|
||||
return FALSE;
|
||||
MessageBody();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// RequestLine = Method SP RequestURI SP HTTP-Version CRLF
|
||||
BOOL CHttpParser::RequestLine()
|
||||
{
|
||||
CHAR sCh;
|
||||
UINT i;
|
||||
|
||||
bUnknownMethod = FALSE;
|
||||
|
||||
// RFC 2068 states that servers SHOULD ignore any empty nine(s) received where a
|
||||
// Request-Line is expected
|
||||
while (PeekChar(&sCh) && ((sCh == 13) || (sCh == 10)));
|
||||
|
||||
if (!ReadString(sMethod, sizeof(sMethod)))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < NUMMETHODS; i++) {
|
||||
if (strcmp(MethodTable[i], sMethod) == 0) {
|
||||
nMethodNo = i;
|
||||
if (!Expect(' '))
|
||||
return FALSE;
|
||||
// URI (ie. host/directory/resource)
|
||||
if (!ReadSpecial(sUri, sizeof(sUri)))
|
||||
return FALSE;
|
||||
if (!Expect(' '))
|
||||
return FALSE;
|
||||
// HTTP version (eg. HTTP/1.1)
|
||||
if (!ReadSpecial(sVersion, sizeof(sVersion)))
|
||||
return FALSE;
|
||||
// CRLF
|
||||
if (!ExpectCRLF())
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
bUnknownMethod = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// GenerelHeader = Cache-Control | Connection | Date | Pragma | Transfer-Encoding |
|
||||
// Upgrade | Via
|
||||
BOOL CHttpParser::GenerelHeader()
|
||||
{
|
||||
INT i;
|
||||
|
||||
for (i = 0; i < NUMGENERELS; i++) {
|
||||
if (strcmp(GenerelTable[i], sHeader) == 0) {
|
||||
switch (i) {
|
||||
case 1: {
|
||||
//Connection
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// RequestHeader = Accept | Accept-Charset | Accept-Encoding | Accept-Language |
|
||||
// Authorization | From | Host | If-Modified-Since | If-Match |
|
||||
// If-None-Match | If-Range | If-Unmodified-Since | Max-Forwards |
|
||||
// Proxy-Authorization | Range | Referer | User-Agent
|
||||
BOOL CHttpParser::RequestHeader()
|
||||
{
|
||||
INT i;
|
||||
|
||||
for (i = 0; i < NUMREQUESTS; i++) {
|
||||
if (strcmp(RequestTable[i], sHeader) == 0) {
|
||||
switch (i) {
|
||||
case 0: {
|
||||
//Accept
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
//Accept-Encoding
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
//Accept-Language
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
//Host
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
//User-Agent
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// EntityHeader = Allow | Content-Base | Content-Encoding | Content-Language |
|
||||
// Content-Length | Content-Location | Content-MD5 |
|
||||
// Content-Range | Content-Type | ETag | Expires |
|
||||
// Last-Modified | extension-header
|
||||
BOOL CHttpParser::EntityHeader()
|
||||
{
|
||||
INT i;
|
||||
|
||||
for (i = 0; i < NUMENTITIES; i++) {
|
||||
if (strcmp(EntityTable[i], sHeader) == 0) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
default: {
|
||||
//cout << "<Entity-Header>: #" << i << endl;
|
||||
Expect(':');
|
||||
Expect(' ');
|
||||
Skip(13);
|
||||
ExpectCRLF();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// MessageBody = *OCTET
|
||||
BOOL CHttpParser::MessageBody()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
@@ -1,492 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: httpd.cpp
|
||||
* PURPOSE: HTTP daemon
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
*/
|
||||
#include <debug.h>
|
||||
#include <new>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <config.h>
|
||||
#include <httpd.h>
|
||||
#include <error.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CHAR HttpMsg400[] = "<HEAD><TITLE>400 Bad Request</TITLE></HEAD>\n\r<BODY><H1>400 Bad Request</H1>\n\rThe request had bad syntax.<BR>\n\r</BODY>\n\r\n\r";
|
||||
CHAR HttpMsg404[] = "<HEAD><TITLE>404 Not Found</TITLE></HEAD>\n\r<BODY><H1>404 Not Found</H1>\n\rThe requested URL was not found on this server.<BR>\n\r</BODY>\n\r\n\r";
|
||||
CHAR HttpMsg405[] = "<HEAD><TITLE>405 Method Not Allowed</TITLE></HEAD>\n\r<BODY><H1>405 Method Not Allowed</H1>\n\rThe requested method is not supported on this server.<BR>\n\r</BODY>\n\r\n\r";
|
||||
CHAR HttpMsg500[] = "<HEAD><TITLE>500 Internal Server Error</TITLE></HEAD>\n\r<BODY><H1>500 Internal Server Error</H1>\n\rAn internal error occurred.<BR>\n\r</BODY>\n\r\n\r";
|
||||
CHAR HttpMsg501[] = "<HEAD><TITLE>501 Not Implemented</TITLE></HEAD>\n\r<BODY><H1>501 Not Implemented</H1>\n\rThe feature is not implemented.<BR>\n\r</BODY>\n\r\n\r";
|
||||
|
||||
|
||||
// *************************** CHttpClient ***************************
|
||||
|
||||
// Default constructor
|
||||
CHttpClient::CHttpClient()
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor with server socket as starter value
|
||||
CHttpClient::CHttpClient(CServerSocket *serversocket)
|
||||
{
|
||||
ServerSocket = serversocket;
|
||||
}
|
||||
|
||||
// Split URIs into its parts (ie. |http://|www.host.com|/resource|?parameters|)
|
||||
VOID CHttpClient::SplitUri(LPSTR lpsUri, LPSTR lpsHost, LPSTR lpsResource, LPSTR lpsParams)
|
||||
{
|
||||
LPSTR lpsPos;
|
||||
LPSTR lpsStr;
|
||||
UINT i;
|
||||
|
||||
strcpy(lpsHost, "");
|
||||
strcpy(lpsResource, "");
|
||||
strcpy(lpsParams, "");
|
||||
|
||||
lpsPos = strstr(lpsUri, "://");
|
||||
if (lpsPos != NULL)
|
||||
lpsStr = &lpsPos[3];
|
||||
else
|
||||
lpsStr = lpsUri;
|
||||
|
||||
lpsPos = strstr(lpsStr, "/");
|
||||
if (lpsPos != NULL) {
|
||||
strncat(lpsHost, lpsPos, lpsPos - lpsStr);
|
||||
lpsStr = &lpsPos[1];
|
||||
|
||||
lpsPos = strstr(lpsStr, "?");
|
||||
if (lpsPos != NULL) {
|
||||
strncat(lpsResource, lpsStr, lpsPos - lpsStr);
|
||||
strcpy(lpsParams, &lpsPos[1]);
|
||||
} else {
|
||||
strcpy(lpsResource, lpsStr);
|
||||
strcpy(lpsParams, "");
|
||||
}
|
||||
|
||||
// Replace "/" with "\"
|
||||
for (i = 0; i < strlen(lpsResource); i++) {
|
||||
if (lpsResource[i] == '/')
|
||||
lpsResource[i] = '\\';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Split resource into its parts (ie. |/path/|filename|.extension|)
|
||||
VOID CHttpClient::SplitResource(LPSTR lpsResource, LPSTR lpsPath, LPSTR lpsFilename, LPSTR lpsExtension)
|
||||
{
|
||||
INT i,len,fileptr,extptr;
|
||||
|
||||
strcpy(lpsPath, "");
|
||||
strcpy(lpsFilename, "");
|
||||
strcpy(lpsExtension, "");
|
||||
|
||||
len = strlen(lpsResource);
|
||||
if (len != 0) {
|
||||
if (lpsResource[len - 1] == '/') {
|
||||
// There is only a path
|
||||
strcpy(lpsPath, lpsResource);
|
||||
} else {
|
||||
// Find extension
|
||||
i = len - 1;
|
||||
while ((i >= 0) && (lpsResource[i] != '.')) i--;
|
||||
extptr = i;
|
||||
while ((i >= 0) && (lpsResource[i] != '/')) i--;
|
||||
if (i > 0) {
|
||||
// There is at least one directory in the path (besides root directory)
|
||||
fileptr = i + 1;
|
||||
strncat(lpsPath, lpsResource, fileptr);
|
||||
} else
|
||||
fileptr = 1;
|
||||
|
||||
// Get filename and possibly extension
|
||||
if (extptr != 0) {
|
||||
strncat(lpsFilename, &lpsResource[fileptr], extptr - fileptr);
|
||||
// Get extension
|
||||
strncat(lpsExtension, &lpsResource[extptr + 1], len - extptr - 1);
|
||||
} else
|
||||
strncat(lpsFilename, &lpsResource[fileptr], len - fileptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process HTTP request
|
||||
VOID CHttpClient::ProcessRequest()
|
||||
{
|
||||
CHAR sStr[255];
|
||||
CHAR sHost[255];
|
||||
CHAR sResource[255];
|
||||
CHAR sParams[255];
|
||||
|
||||
// Which method?
|
||||
switch (Parser.nMethodNo) {
|
||||
case hmGET: {
|
||||
SplitUri(Parser.sUri, sHost, sResource, sParams);
|
||||
|
||||
// Default resource?
|
||||
if (strlen(sResource) == 0) {
|
||||
CIterator<LPSTR> *i = pConfiguration->GetDefaultResources()->CreateIterator();
|
||||
|
||||
// FIXME: All default resources should be tried
|
||||
// Iterate through all strings
|
||||
//for (i->First(); !i->IsDone(); i->Next())
|
||||
i->First();
|
||||
if (!i->IsDone()) {
|
||||
strcat(sResource, i->CurrentItem());
|
||||
delete i;
|
||||
} else {
|
||||
// File not found
|
||||
Report("404 Not Found", HttpMsg404);
|
||||
break;
|
||||
}
|
||||
}
|
||||
strcpy(sStr, pConfiguration->GetHttpBase());
|
||||
strcat(sStr, sResource);
|
||||
SendFile(sStr);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// Method is not implemented
|
||||
Report("501 Not Implemented", HttpMsg501);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send a file to socket
|
||||
VOID CHttpClient::SendFile(LPSTR lpsFilename)
|
||||
{
|
||||
CHAR str[255];
|
||||
CHAR str2[32];
|
||||
union BigNum {
|
||||
// unsigned __int64 Big;
|
||||
unsigned long long Big;
|
||||
struct {
|
||||
DWORD Low;
|
||||
DWORD High;
|
||||
} u;
|
||||
} nTotalBytes;
|
||||
DWORD nBytesToRead;
|
||||
DWORD nBytesRead;
|
||||
BOOL bStatus;
|
||||
|
||||
// Try to open file
|
||||
hFile = CreateFileA(lpsFilename,
|
||||
GENERIC_READ, // Open for reading
|
||||
FILE_SHARE_READ, // Share for reading
|
||||
NULL, // No security
|
||||
OPEN_EXISTING, // Existing file only
|
||||
FILE_ATTRIBUTE_NORMAL, // Normal file
|
||||
NULL); // No attr. template
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
// File not found
|
||||
Report("404 Not Found", HttpMsg404);
|
||||
return;
|
||||
}
|
||||
// Get file size
|
||||
nTotalBytes.u.Low = GetFileSize(hFile, &nTotalBytes.u.High);
|
||||
if ((nTotalBytes.u.Low == 0xFFFFFFFF) && ((GetLastError()) != NO_ERROR)) {
|
||||
// Internal server error
|
||||
Report("500 Internal Server Error", HttpMsg500);
|
||||
// Close file
|
||||
CloseHandle(hFile);
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine buffer size
|
||||
if (nTotalBytes.Big < 65536)
|
||||
nBufferSize = 1024;
|
||||
else
|
||||
nBufferSize = 32768;
|
||||
// Allocate memory on heap
|
||||
lpsBuffer = (PCHAR) malloc(nBufferSize);
|
||||
|
||||
if (lpsBuffer == NULL) {
|
||||
// Internal server error
|
||||
Report("500 Internal Server Error", HttpMsg500);
|
||||
// Close file
|
||||
CloseHandle(hFile);
|
||||
return;
|
||||
}
|
||||
|
||||
SendText("HTTP/1.1 200 OK");
|
||||
SendText("Server: ROSHTTPD");
|
||||
SendText("MIME-version: 1.0");
|
||||
SendText("Content-Type: text/plain");
|
||||
SendText("Accept-Ranges: bytes");
|
||||
strcpy(str, "Content-Length: ");
|
||||
_itoa(nTotalBytes.u.Low, str2, 10);
|
||||
strcat(str, str2);
|
||||
SendText(str);
|
||||
SendText("");
|
||||
// Read and transmit file
|
||||
nTotalRead = 0;
|
||||
nFileSize = nTotalBytes.Big;
|
||||
bStop = FALSE;
|
||||
|
||||
fd_set wfds;
|
||||
FD_ZERO(&wfds);
|
||||
FD_SET(Socket, &wfds);
|
||||
do {
|
||||
MessageLoop();
|
||||
|
||||
if (nTotalRead + nBufferSize < nFileSize)
|
||||
nBytesToRead = nBufferSize;
|
||||
else nBytesToRead = nFileSize - nTotalRead;
|
||||
|
||||
bStatus = ReadFile(hFile, lpsBuffer, nBytesToRead, &nBytesRead, NULL);
|
||||
if (bStatus) {
|
||||
select(0, NULL, &wfds, NULL, NULL);
|
||||
bStatus = (Transmit(lpsBuffer, nBytesRead) == (INT)nBytesRead);
|
||||
nTotalRead += nBytesRead;
|
||||
}
|
||||
} while ((!bStop) && (bStatus) && (nTotalRead < nFileSize));
|
||||
|
||||
if (bStatus)
|
||||
SendText("");
|
||||
else
|
||||
// We can't send an error message here as we are in the process of sending a file.
|
||||
// We have to terminate the connection instead
|
||||
Close();
|
||||
|
||||
// Free allocated memory
|
||||
free(lpsBuffer);
|
||||
|
||||
// Close file
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
|
||||
// Report something to client
|
||||
VOID CHttpClient::Report(LPSTR lpsCode, LPSTR lpsStr)
|
||||
{
|
||||
CHAR sTmp[128];
|
||||
CHAR sTmp2[16];
|
||||
|
||||
strcpy(sTmp, "HTTP/1.1 ");
|
||||
strcat(sTmp, lpsCode);
|
||||
SendText(sTmp);
|
||||
SendText("Server: ROSHTTPD");
|
||||
SendText("MIME-version: 1.0");
|
||||
SendText("Content-Type: text/html");
|
||||
SendText("Accept-Ranges: bytes");
|
||||
strcpy(sTmp, "Content-Length: ");
|
||||
if (lpsStr != NULL) {
|
||||
_itoa(strlen(lpsStr), sTmp2, 10);
|
||||
strcat(sTmp, sTmp2);
|
||||
} else
|
||||
strcat(sTmp, "0");
|
||||
SendText(sTmp);
|
||||
SendText("");
|
||||
if (lpsStr != NULL)
|
||||
SendText(lpsStr);
|
||||
SendText("");
|
||||
}
|
||||
|
||||
// OnRead event handler
|
||||
VOID CHttpClient::OnRead()
|
||||
{
|
||||
LONG nCount;
|
||||
|
||||
nCount = Receive((LPSTR) &Parser.sBuffer[Parser.nHead],
|
||||
sizeof(Parser.sBuffer) - Parser.nHead);
|
||||
|
||||
Parser.nHead += nCount;
|
||||
if (Parser.nHead >= sizeof(Parser.sBuffer))
|
||||
Parser.nHead = 0;
|
||||
|
||||
if (Parser.Complete()) {
|
||||
ProcessRequest();
|
||||
}
|
||||
|
||||
if (Parser.bUnknownMethod) {
|
||||
// Method Not Allowed
|
||||
Report("405 Method Not Allowed", HttpMsg405);
|
||||
// Terminate connection
|
||||
Close();
|
||||
}
|
||||
}
|
||||
/*
|
||||
// OnWrite event handler
|
||||
VOID CHttpClient::OnWrite()
|
||||
{
|
||||
DWORD nBytesToRead;
|
||||
DWORD nBytesRead;
|
||||
|
||||
OutputDebugString(TS("Can write\n"));
|
||||
|
||||
if (bSendingFile) {
|
||||
if (nTotalRead + nBufferSize < nFileSize)
|
||||
nBytesToRead = nBufferSize;
|
||||
else nBytesToRead = nFileSize - nTotalRead;
|
||||
|
||||
bError = ReadFile(hFile, Buffer, nBytesToRead, &nBytesRead, NULL);
|
||||
if (!bError) {
|
||||
Transmit(Buffer, nBytesRead);
|
||||
nTotalRead += nBytesRead;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// OnClose event handler
|
||||
VOID CHttpClient::OnClose()
|
||||
{
|
||||
// Stop sending file if we are doing that now
|
||||
bStop = TRUE;
|
||||
}
|
||||
|
||||
|
||||
// ************************ CHttpClientThread ************************
|
||||
|
||||
// Constructor with client socket as starter value
|
||||
CHttpClientThread::CHttpClientThread(LPCServerClientSocket lpSocket)
|
||||
{
|
||||
ClientSocket = lpSocket;
|
||||
}
|
||||
|
||||
// Execute client thread code
|
||||
VOID CHttpClientThread::Execute()
|
||||
{
|
||||
MSG Msg;
|
||||
|
||||
while (!Terminated()) {
|
||||
(( CHttpClient *) ClientSocket)->MessageLoop();
|
||||
if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE) != 0) {
|
||||
switch (Msg.message) {
|
||||
case HTTPD_START: {
|
||||
// TODO: Start thread
|
||||
break;
|
||||
}
|
||||
case HTTPD_STOP: {
|
||||
// TODO: Stop thread
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DispatchMessage(&Msg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (ClientSocket != NULL) {
|
||||
delete ClientSocket;
|
||||
ClientSocket = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// *************************** CHttpDaemon ***************************
|
||||
|
||||
// Default constructor
|
||||
CHttpDaemon::CHttpDaemon()
|
||||
{
|
||||
State = hsStopped;
|
||||
Start();
|
||||
}
|
||||
|
||||
// Default destructor
|
||||
CHttpDaemon::~CHttpDaemon()
|
||||
{
|
||||
if (State==hsRunning)
|
||||
Stop();
|
||||
}
|
||||
|
||||
// Return daemon state
|
||||
HTTPdState CHttpDaemon::GetState() const
|
||||
{
|
||||
return State;
|
||||
}
|
||||
|
||||
// Start HTTP daemon
|
||||
BOOL CHttpDaemon::Start()
|
||||
{
|
||||
assert(State==hsStopped);
|
||||
|
||||
SetPort(pConfiguration->GetPort());
|
||||
|
||||
Open();
|
||||
|
||||
State = hsRunning;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Stop HTTP daemon
|
||||
BOOL CHttpDaemon::Stop()
|
||||
{
|
||||
assert(State==hsRunning);
|
||||
|
||||
Close();
|
||||
|
||||
State = hsStopped;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// OnGetSocket event handler
|
||||
LPCServerClientSocket CHttpDaemon::OnGetSocket(LPCServerSocket lpServerSocket)
|
||||
{
|
||||
return new CHttpClient(lpServerSocket);
|
||||
}
|
||||
|
||||
// OnGetThread event handler
|
||||
LPCServerClientThread CHttpDaemon::OnGetThread(LPCServerClientSocket lpSocket)
|
||||
{
|
||||
return new CHttpClientThread(lpSocket);
|
||||
}
|
||||
|
||||
// OnAccept event handler
|
||||
VOID CHttpDaemon::OnAccept(LPCServerClientThread lpThread)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ************************ CHttpDaemonThread ************************
|
||||
|
||||
// Execute daemon thread code
|
||||
VOID CHttpDaemonThread::Execute()
|
||||
{
|
||||
MSG Msg;
|
||||
|
||||
try {
|
||||
Daemon = NULL;
|
||||
Daemon = new CHttpDaemon;
|
||||
|
||||
while (!Terminated()) {
|
||||
Daemon->MessageLoop();
|
||||
if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE) != 0) {
|
||||
switch (Msg.message) {
|
||||
case HTTPD_START: {
|
||||
if (Daemon->GetState() == hsStopped)
|
||||
Daemon->Start();
|
||||
break;
|
||||
}
|
||||
case HTTPD_STOP: {
|
||||
if (Daemon->GetState() == hsRunning)
|
||||
Daemon->Stop();
|
||||
break;
|
||||
}
|
||||
case HTTPD_SUSPEND: {
|
||||
if (Daemon->GetState() == hsRunning){}
|
||||
// FIXME: Suspend service
|
||||
break;
|
||||
}
|
||||
case HTTPD_RESUME: {
|
||||
if (Daemon->GetState() != hsSuspended){}
|
||||
// FIXME: Resume service
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DispatchMessage(&Msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
delete Daemon;
|
||||
} catch (ESocket e) {
|
||||
ReportErrorStr(e.what());
|
||||
} catch (bad_alloc e) {
|
||||
ReportErrorStr(TS("Insufficient resources."));
|
||||
}
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/config.h
|
||||
*/
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
#include <list.h>
|
||||
#include <httpd.h>
|
||||
|
||||
// General constants
|
||||
#define APP_DESCRIPTION _T("ReactOS HTTP Daemon")
|
||||
|
||||
// Default configuration
|
||||
#define dcfgDescription _T("Default configuration")
|
||||
#define dcfgMainBase _T("C:\\roshttpd\\")
|
||||
#define dcfgHttpBase "C:\\roshttpd\\HttpBase\\"
|
||||
#define dcfgDefaultResource "index.html"
|
||||
#define dcfgDefaultPort 80
|
||||
|
||||
class CConfig {
|
||||
public:
|
||||
CConfig();
|
||||
~CConfig();
|
||||
VOID Default();
|
||||
VOID Clear();
|
||||
BOOL Load();
|
||||
BOOL Save();
|
||||
LPWSTR GetMainBase();
|
||||
VOID SetMainBase(LPWSTR lpwsMainBase);
|
||||
LPSTR GetHttpBase();
|
||||
VOID SetHttpBase(LPSTR lpsHttpBase);
|
||||
CList<LPSTR>* GetDefaultResources();
|
||||
USHORT GetPort();
|
||||
VOID SetPort(USHORT wPort);
|
||||
private:
|
||||
VOID Reset();
|
||||
LPWSTR MainBase;
|
||||
LPSTR HttpBase;
|
||||
CList<LPSTR> DefaultResources;
|
||||
USHORT Port;
|
||||
};
|
||||
typedef CConfig* LPCConfig;
|
||||
|
||||
extern LPCConfig pConfiguration;
|
||||
extern LPCHttpDaemonThread pDaemonThread;
|
||||
|
||||
#endif /* __CONFIG_H */
|
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/debug.h
|
||||
*/
|
||||
#ifndef __DEBUG_H
|
||||
#define __DEBUG_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef DBG
|
||||
#define DPRINT(x...) printf(x)
|
||||
#else
|
||||
#define DPRINT(x...)
|
||||
#endif
|
||||
|
||||
#endif /* __DEBUG_H */
|
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/error.h
|
||||
*/
|
||||
#ifndef __ERROR_H
|
||||
#define __ERROR_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define TS(x) (LPTSTR)TEXT(x)
|
||||
|
||||
void ReportErrorStr(LPTSTR lpsText);
|
||||
|
||||
#endif /* __ERROR_H */
|
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/http.h
|
||||
*/
|
||||
#ifndef __HTTP_H
|
||||
#define __HTTP_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// Generel HTTP related constants
|
||||
#define NUMMETHODS 7
|
||||
#define NUMGENERELS 7
|
||||
#define NUMREQUESTS 17
|
||||
#define NUMENTITIES 12
|
||||
|
||||
// HTTP method constants
|
||||
#define hmOPTIONS 0
|
||||
#define hmGET 1
|
||||
#define hmHEAD 2
|
||||
#define hmPOST 3
|
||||
#define hmPUT 4
|
||||
#define hmDELETE 5
|
||||
#define hmTRACE 6
|
||||
|
||||
class CHttpParser {
|
||||
public:
|
||||
CHAR sBuffer[2048];
|
||||
UINT nHead;
|
||||
UINT nTail;
|
||||
CHAR sUri[255];
|
||||
CHAR sVersion[15];
|
||||
CHAR sHeader[63];
|
||||
CHAR sMethod[63];
|
||||
UINT nMethodNo;
|
||||
BOOL bUnknownMethod;
|
||||
BOOL bBadRequest;
|
||||
CHttpParser();
|
||||
~CHttpParser();
|
||||
BOOL Complete();
|
||||
BOOL Parse();
|
||||
private:
|
||||
BOOL ReadChar(LPSTR lpsStr);
|
||||
BOOL PeekChar(LPSTR lpsStr);
|
||||
BOOL ReadString(LPSTR lpsStr, UINT nLength);
|
||||
BOOL ReadSpecial(LPSTR lpStr, UINT nLength);
|
||||
VOID Skip(CHAR sStr);
|
||||
BOOL Expect(CHAR sStr);
|
||||
BOOL ExpectCRLF();
|
||||
BOOL RequestLine();
|
||||
BOOL GenerelHeader();
|
||||
BOOL RequestHeader();
|
||||
BOOL EntityHeader();
|
||||
BOOL MessageBody();
|
||||
};
|
||||
|
||||
#endif /* __HTTP_H */
|
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/httpd.h
|
||||
*/
|
||||
#ifndef __HTTPD_H
|
||||
#define __HTTPD_H
|
||||
|
||||
#include <thread.h>
|
||||
#include <socket.h>
|
||||
#include <http.h>
|
||||
|
||||
#define HTTPD_START WM_USER + 1
|
||||
#define HTTPD_STOP WM_USER + 2
|
||||
#define HTTPD_SUSPEND WM_USER + 3
|
||||
#define HTTPD_RESUME WM_USER + 4
|
||||
|
||||
enum HTTPdState {
|
||||
hsStopped = 0,
|
||||
hsRunning,
|
||||
hsSuspended
|
||||
};
|
||||
|
||||
class CHttpDaemon;
|
||||
|
||||
class CHttpClient : public CServerClientSocket {
|
||||
public:
|
||||
CHttpClient();
|
||||
CHttpClient(LPCServerSocket lpServerSocket);
|
||||
virtual void OnRead();
|
||||
//virtual void OnWrite();
|
||||
virtual void OnClose();
|
||||
HANDLE ThreadHandle;
|
||||
DWORD ThreadId;
|
||||
CHttpParser Parser;
|
||||
void SplitUri(const LPSTR lpsUri, LPSTR lpsHost, LPSTR lpsResource, LPSTR lpsParams);
|
||||
void SplitResource(const LPSTR lpsResource, LPSTR lpsPath, LPSTR lpsFilename, LPSTR lpsExtension);
|
||||
void ProcessRequest();
|
||||
void SendFile(const LPSTR lpsFilename);
|
||||
void Report(const LPSTR lpsCode, const LPSTR lpsStr);
|
||||
private:
|
||||
BOOL bStop;
|
||||
LPSTR lpsBuffer;
|
||||
LONG nBufferSize;
|
||||
// unsigned __int64 nTotalRead;
|
||||
unsigned long long nTotalRead;
|
||||
// unsigned __int64 nFileSize;
|
||||
unsigned long long nFileSize;
|
||||
HANDLE hFile;
|
||||
};
|
||||
typedef CHttpClient* LPCHttpClient;
|
||||
|
||||
class CHttpClientThread : public CServerClientThread {
|
||||
public:
|
||||
CHttpClientThread() {};
|
||||
CHttpClientThread(LPCServerClientSocket Socket);
|
||||
virtual void Execute();
|
||||
};
|
||||
typedef CHttpClientThread* LPCHttpClientThread;
|
||||
|
||||
class CHttpDaemon : public CServerSocket {
|
||||
public:
|
||||
CHttpDaemon();
|
||||
virtual ~CHttpDaemon();
|
||||
HTTPdState GetState() const;
|
||||
virtual BOOL Start();
|
||||
virtual BOOL Stop();
|
||||
virtual LPCServerClientSocket OnGetSocket(LPCServerSocket lpServerSocket);
|
||||
virtual LPCServerClientThread OnGetThread(LPCServerClientSocket Socket);
|
||||
virtual void OnAccept(const LPCServerClientThread lpThread);
|
||||
private:
|
||||
HTTPdState State;
|
||||
};
|
||||
typedef CHttpDaemon* LPCHttpDaemon;
|
||||
|
||||
class CHttpDaemonThread : public CThread {
|
||||
public:
|
||||
CHttpDaemonThread() {};
|
||||
virtual void Execute();
|
||||
private:
|
||||
CHttpDaemon *Daemon;
|
||||
};
|
||||
typedef CHttpDaemonThread* LPCHttpDaemonThread;
|
||||
|
||||
#endif /* __HTTPD_H */
|
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/iterator.h
|
||||
*/
|
||||
#ifndef __ITERATOR_H
|
||||
#define __ITERATOR_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
template <class Item>
|
||||
class CIterator {
|
||||
public:
|
||||
virtual VOID First() = 0;
|
||||
virtual VOID Next() = 0;
|
||||
virtual BOOL IsDone() const = 0;
|
||||
virtual Item CurrentItem() const = 0;
|
||||
};
|
||||
|
||||
#endif /* __ITERATOR_H */
|
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/list.h
|
||||
*/
|
||||
#ifndef __LIST_H
|
||||
#define __LIST_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <iterator.h>
|
||||
|
||||
class CListNode {
|
||||
public:
|
||||
CListNode();
|
||||
CListNode(VOID *element, CListNode *next, CListNode *prev);
|
||||
~CListNode() {};
|
||||
void* operator new(/*size_t s*/ UINT s);
|
||||
VOID operator delete(void* p);
|
||||
|
||||
VOID SetElement(PVOID element);
|
||||
VOID SetNext(CListNode *next);
|
||||
VOID SetPrev(CListNode *prev);
|
||||
PVOID GetElement();
|
||||
CListNode *GetNext();
|
||||
CListNode *GetPrev();
|
||||
private:
|
||||
PVOID Element;
|
||||
CListNode *Next;
|
||||
CListNode *Prev;
|
||||
static HANDLE hHeap;
|
||||
static INT nRef;
|
||||
};
|
||||
|
||||
template <class Item> class CList {
|
||||
public:
|
||||
//CList(CList&);
|
||||
CList();
|
||||
~CList();
|
||||
CList& operator=(CList&);
|
||||
|
||||
CIterator<Item> *CreateIterator() const;
|
||||
LONG Count() const;
|
||||
Item& Get(const LONG index) const;
|
||||
// Can throw bad_alloc
|
||||
VOID Insert(Item& element);
|
||||
VOID Remove(Item& element);
|
||||
VOID RemoveAll();
|
||||
CListNode *GetHeader() const;
|
||||
CListNode *GetTrailer() const;
|
||||
private:
|
||||
CListNode *Search(Item& element) const;
|
||||
LONG NodeCount;
|
||||
CListNode *Header;
|
||||
CListNode *Trailer;
|
||||
};
|
||||
|
||||
template <class Item> class CListIterator : public CIterator<Item> {
|
||||
public:
|
||||
CListIterator(const CList<Item> *list);
|
||||
virtual VOID First();
|
||||
virtual VOID Next();
|
||||
virtual BOOL IsDone() const;
|
||||
virtual Item CurrentItem() const;
|
||||
private:
|
||||
const CList<Item> *List;
|
||||
CListNode *Current;
|
||||
};
|
||||
|
||||
// ****************************** CList ******************************
|
||||
|
||||
// Default constructor
|
||||
template <class Item>
|
||||
CList<Item>::CList()
|
||||
{
|
||||
// Create dummy nodes
|
||||
Trailer = new CListNode;
|
||||
Header = new CListNode;
|
||||
Header->SetNext(Trailer);
|
||||
Trailer->SetPrev(Header);
|
||||
}
|
||||
|
||||
// Default destructor
|
||||
template <class Item>
|
||||
CList<Item>::~CList()
|
||||
{
|
||||
RemoveAll();
|
||||
delete Trailer;
|
||||
delete Header;
|
||||
}
|
||||
|
||||
// Create an iterator for the list
|
||||
template <class Item>
|
||||
CIterator<Item> *CList<Item>::CreateIterator() const
|
||||
{
|
||||
return new CListIterator<Item>((CList<Item> *) this);
|
||||
}
|
||||
|
||||
// Return number of elements in list
|
||||
template <class Item>
|
||||
LONG CList<Item>::Count() const
|
||||
{
|
||||
return NodeCount;
|
||||
}
|
||||
|
||||
// Return element at index
|
||||
template <class Item>
|
||||
Item& CList<Item>::Get(const LONG index) const
|
||||
{
|
||||
CListNode *node;
|
||||
|
||||
if ((index < 0) || (index >= NodeCount))
|
||||
return NULL;
|
||||
|
||||
node = Header;
|
||||
for (int i = 0; i <= index; i++)
|
||||
node = node->GetNext();
|
||||
|
||||
return (Item *) node->GetElement();
|
||||
}
|
||||
|
||||
// Insert an element into the list
|
||||
template <class Item>
|
||||
VOID CList<Item>::Insert(Item& element)
|
||||
{
|
||||
CListNode *node;
|
||||
|
||||
node = new CListNode((PVOID)element, Trailer, Trailer->GetPrev());
|
||||
Trailer->GetPrev()->SetNext(node);
|
||||
Trailer->SetPrev(node);
|
||||
NodeCount++;
|
||||
}
|
||||
|
||||
// Remove an element from the list
|
||||
template <class Item>
|
||||
VOID CList<Item>::Remove(Item& element)
|
||||
{
|
||||
CListNode *node;
|
||||
|
||||
node = Search(element);
|
||||
if (node != NULL) {
|
||||
node->GetPrev()->SetNext(node->GetNext());
|
||||
node->GetNext()->SetPrev(node->GetPrev());
|
||||
NodeCount--;
|
||||
delete node;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all elements in list
|
||||
template <class Item>
|
||||
VOID CList<Item>::RemoveAll()
|
||||
{
|
||||
CListNode *node;
|
||||
CListNode *tmp;
|
||||
|
||||
node = Header->GetNext();
|
||||
while (node != Trailer) {
|
||||
tmp = node->GetNext();
|
||||
delete node;
|
||||
node = tmp;
|
||||
}
|
||||
Header->SetNext(Trailer);
|
||||
Trailer->SetPrev(Header);
|
||||
NodeCount = 0;
|
||||
}
|
||||
|
||||
// Return header node
|
||||
template <class Item>
|
||||
CListNode *CList<Item>::GetHeader() const
|
||||
{
|
||||
return Header;
|
||||
}
|
||||
|
||||
// Return trailer node
|
||||
template <class Item>
|
||||
CListNode *CList<Item>::GetTrailer() const
|
||||
{
|
||||
return Trailer;
|
||||
}
|
||||
|
||||
// Searches for a node that contains the element. Returns NULL if element is not found
|
||||
template <class Item>
|
||||
CListNode *CList<Item>::Search(Item& element) const
|
||||
{
|
||||
CListNode *node;
|
||||
|
||||
node = Header;
|
||||
while (((node = node->GetNext()) != Trailer) && (node->GetElement() != element));
|
||||
if (node != Trailer)
|
||||
return node;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// ************************** CListIterator **************************
|
||||
|
||||
// Default constructor
|
||||
template <class Item>
|
||||
CListIterator<Item>::CListIterator(const CList<Item> *list) : List(list)
|
||||
{
|
||||
First();
|
||||
}
|
||||
|
||||
// Go to first element in list
|
||||
template <class Item>
|
||||
VOID CListIterator<Item>::First()
|
||||
{
|
||||
Current = List->GetHeader()->GetNext();
|
||||
}
|
||||
|
||||
// Go to next element in list
|
||||
template <class Item>
|
||||
VOID CListIterator<Item>::Next()
|
||||
{
|
||||
if (!IsDone())
|
||||
Current = Current->GetNext();
|
||||
}
|
||||
|
||||
// Return FALSE when there are more elements in list and TRUE when there are no more
|
||||
template <class Item>
|
||||
BOOL CListIterator<Item>::IsDone() const
|
||||
{
|
||||
return (Current == List->GetTrailer());
|
||||
}
|
||||
|
||||
// Return current element
|
||||
template <class Item>
|
||||
Item CListIterator<Item>::CurrentItem() const
|
||||
{
|
||||
return IsDone()? NULL : (Item) Current->GetElement();
|
||||
}
|
||||
|
||||
#endif /* __LIST_H */
|
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/socket.h
|
||||
*/
|
||||
#ifndef __SOCKET_H
|
||||
#define __SOCKET_H
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <thread.h>
|
||||
#include <list.h>
|
||||
#include <exception>
|
||||
#include <assert.h>
|
||||
|
||||
#define MAX_PENDING_CONNECTS 4 // The backlog allowed for listen()
|
||||
|
||||
VOID InitWinsock();
|
||||
VOID DeinitWinsock();
|
||||
|
||||
class CSocket;
|
||||
class CClientSocket;
|
||||
class CServerClientSocket;
|
||||
class CServerClientThread;
|
||||
class CServerSocket;
|
||||
|
||||
typedef CSocket* LPCSocket;
|
||||
typedef CClientSocket* LPCClientSocket;
|
||||
typedef CServerClientSocket* LPCServerClientSocket;
|
||||
typedef CServerClientThread* LPCServerClientThread;
|
||||
typedef CServerSocket* LPCServerSocket;
|
||||
|
||||
class ESocket {
|
||||
public:
|
||||
ESocket() { Description = NULL; }
|
||||
ESocket(LPTSTR description) { Description = description; }
|
||||
LPTSTR what() { return Description; }
|
||||
protected:
|
||||
LPTSTR Description;
|
||||
};
|
||||
|
||||
class ESocketWinsock : public ESocket {
|
||||
public:
|
||||
ESocketWinsock(LPTSTR description) { Description = description; }
|
||||
};
|
||||
|
||||
class ESocketDll : public ESocket {
|
||||
public:
|
||||
ESocketDll(LPTSTR description) { Description = description; }
|
||||
};
|
||||
|
||||
class ESocketOpen : public ESocket {
|
||||
public:
|
||||
ESocketOpen(LPTSTR description) { Description = description; }
|
||||
};
|
||||
|
||||
class ESocketClose : public ESocket {
|
||||
public:
|
||||
ESocketClose(LPTSTR description) { Description = description; }
|
||||
};
|
||||
|
||||
class ESocketSend : public ESocket {
|
||||
public:
|
||||
ESocketSend(LPTSTR description) { Description = description; }
|
||||
};
|
||||
|
||||
class ESocketReceive : public ESocket {
|
||||
public:
|
||||
ESocketReceive(LPTSTR description) { Description = description; }
|
||||
};
|
||||
|
||||
|
||||
class CSocket {
|
||||
public:
|
||||
CSocket();
|
||||
virtual ~CSocket();
|
||||
virtual SOCKET GetSocket();
|
||||
virtual VOID SetSocket(SOCKET socket);
|
||||
virtual SOCKADDR_IN GetSockAddrIn();
|
||||
virtual VOID SetSockAddrIn(SOCKADDR_IN sockaddrin);
|
||||
virtual VOID SetEvents(LONG lEvents);
|
||||
virtual LONG GetEvents();
|
||||
virtual VOID SetPort( UINT nPort) {};
|
||||
virtual VOID Open();
|
||||
virtual VOID Close();
|
||||
virtual INT Transmit( LPSTR lpsBuffer, UINT nLength) { return 0; };
|
||||
virtual INT Receive(LPSTR lpsBuffer, UINT nLength) { return 0; };
|
||||
virtual INT SendText( LPSTR lpsStr) { return 0; };
|
||||
protected:
|
||||
SOCKET Socket;
|
||||
SOCKADDR_IN SockAddrIn;
|
||||
WSAEVENT Event;
|
||||
UINT Port;
|
||||
BOOL Active;
|
||||
private:
|
||||
LONG Events;
|
||||
};
|
||||
|
||||
class CServerClientSocket : public CSocket {
|
||||
public:
|
||||
CServerClientSocket() {};
|
||||
CServerClientSocket(LPCServerSocket lpServerSocket);
|
||||
CServerSocket *GetServerSocket();
|
||||
virtual INT Transmit( LPSTR lpsBuffer, UINT nLength);
|
||||
virtual INT Receive(LPSTR lpsBuffer, UINT nLength);
|
||||
virtual INT SendText( LPSTR lpsText);
|
||||
virtual VOID MessageLoop();
|
||||
virtual VOID OnRead() {};
|
||||
//virtual VOID OnWrite() {};
|
||||
virtual VOID OnClose() {};
|
||||
protected:
|
||||
LPCServerSocket ServerSocket;
|
||||
};
|
||||
|
||||
class CServerClientThread : public CThread {
|
||||
public:
|
||||
CServerClientThread() {};
|
||||
CServerClientThread(CServerClientSocket *socket);
|
||||
virtual ~CServerClientThread();
|
||||
protected:
|
||||
CServerClientSocket *ClientSocket;
|
||||
};
|
||||
|
||||
class CServerSocket : public CSocket {
|
||||
public:
|
||||
CServerSocket();
|
||||
virtual ~CServerSocket();
|
||||
virtual VOID SetPort( UINT nPort);
|
||||
virtual VOID Open();
|
||||
virtual VOID Close();
|
||||
virtual LPCServerClientSocket OnGetSocket(LPCServerSocket lpServerSocket);
|
||||
virtual LPCServerClientThread OnGetThread(LPCServerClientSocket lpSocket);
|
||||
virtual VOID OnAccept( LPCServerClientThread lpThread) {};
|
||||
virtual VOID MessageLoop();
|
||||
VOID InsertClient(LPCServerClientThread lpClient);
|
||||
VOID RemoveClient(LPCServerClientThread lpClient);
|
||||
protected:
|
||||
CList<LPCServerClientThread> Connections;
|
||||
};
|
||||
|
||||
#endif /* __SOCKET_H */
|
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: include/thread.h
|
||||
*/
|
||||
#ifndef __THREAD_H
|
||||
#define __THREAD_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
class CThread;
|
||||
|
||||
struct ThreadData {
|
||||
CThread *ClassPtr;
|
||||
HANDLE hFinished;
|
||||
};
|
||||
|
||||
class CThread {
|
||||
public:
|
||||
CThread();
|
||||
virtual ~CThread();
|
||||
BOOL PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
virtual void Execute();
|
||||
virtual void Terminate();
|
||||
BOOL Terminated();
|
||||
protected:
|
||||
BOOL bTerminated;
|
||||
DWORD dwThreadId;
|
||||
HANDLE hThread;
|
||||
ThreadData Data;
|
||||
};
|
||||
typedef CThread *LPCThread;
|
||||
|
||||
#endif /* __THREAD_H */
|
@@ -1,31 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_PATH = common
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = roshttpd
|
||||
|
||||
TARGET_CPPFLAGS = -I./include -DUNICODE -D_UNICODE -DDBG -D__USE_W32API -Wno-deprecated
|
||||
|
||||
TARGET_GCCLIBS = stdc++
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a ws2_32.a user32.a
|
||||
|
||||
MAIN_OBJECTS = roshttpd.o config.o error.o http.o httpd.o
|
||||
|
||||
COMMON_OBJECTS = common/list.o common/socket.o common/thread.o
|
||||
|
||||
TARGET_OBJECTS = $(MAIN_OBJECTS) $(COMMON_OBJECTS)
|
||||
|
||||
TARGET_CLEAN = common/*.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS HTTP Daemon
|
||||
* FILE: roshttpd.cpp
|
||||
* PURPOSE: Main program
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
* CSH 01/09/2000 Created
|
||||
*/
|
||||
#include <debug.h>
|
||||
#include <new>
|
||||
#include <winsock2.h>
|
||||
#include <stdio.h>
|
||||
#include <config.h>
|
||||
#include <error.h>
|
||||
#include <httpd.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
VOID Run()
|
||||
{
|
||||
InitWinsock();
|
||||
|
||||
pDaemonThread = NULL;
|
||||
pConfiguration = NULL;
|
||||
|
||||
try {
|
||||
// Create configuration object
|
||||
pConfiguration = new CConfig;
|
||||
pConfiguration->Default();
|
||||
|
||||
// Create daemon object
|
||||
pDaemonThread = new CHttpDaemonThread;
|
||||
|
||||
MSG Msg;
|
||||
BOOL bQuit = FALSE;
|
||||
while ((!bQuit) && (!pDaemonThread->Terminated())) {
|
||||
bQuit = PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE);
|
||||
if (!bQuit)
|
||||
DispatchMessage(&Msg);
|
||||
}
|
||||
|
||||
delete pDaemonThread;
|
||||
|
||||
if (pConfiguration != NULL)
|
||||
delete pConfiguration;
|
||||
} catch (bad_alloc e) {
|
||||
if (pConfiguration != NULL)
|
||||
delete pConfiguration;
|
||||
ReportErrorStr(TS("Insufficient resources."));
|
||||
}
|
||||
|
||||
DeinitWinsock();
|
||||
}
|
||||
|
||||
/* Program entry point */
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("ReactOS HTTP Daemon\n");
|
||||
printf("Type Control-C to stop.\n");
|
||||
|
||||
Run();
|
||||
|
||||
printf("Daemon stopped.\n");
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = route
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_SDKLIBS = ws2_32.a iphlpapi.a ntdll.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_GCCLIBS =
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
@@ -1,157 +0,0 @@
|
||||
/* Poor man's route
|
||||
*
|
||||
* Supported commands:
|
||||
*
|
||||
* "print"
|
||||
* "add" target ["mask" mask] gw ["metric" metric]
|
||||
* "delete" target gw
|
||||
*
|
||||
* Goals:
|
||||
*
|
||||
* Flexible, simple
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
#define IPBUF 17
|
||||
#define IN_ADDR_OF(x) *((struct in_addr *)&(x))
|
||||
|
||||
int usage() {
|
||||
fprintf( stderr,
|
||||
"route usage:\n"
|
||||
"route print\n"
|
||||
" prints the route table\n"
|
||||
"route add <target> [mask <mask>] <gw> [metric <m>]\n"
|
||||
" adds a route\n"
|
||||
"route delete <target> <gw>\n"
|
||||
" deletes a route\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
int print_routes() {
|
||||
PMIB_IPFORWARDTABLE IpForwardTable;
|
||||
DWORD Error;
|
||||
ULONG Size = 0;
|
||||
char Destination[IPBUF], Gateway[IPBUF], Netmask[IPBUF],
|
||||
Index[IPBUF], Metric[IPBUF];
|
||||
int i;
|
||||
|
||||
if( (Error = GetIpForwardTable( NULL, &Size, TRUE )) ==
|
||||
ERROR_INSUFFICIENT_BUFFER ) {
|
||||
IpForwardTable = malloc( Size );
|
||||
Error = GetIpForwardTable( IpForwardTable, &Size, TRUE );
|
||||
}
|
||||
|
||||
if( Error == ERROR_SUCCESS ) {
|
||||
printf( "%-16s%-16s%-16s%-10s%-10s\n",
|
||||
"Destination",
|
||||
"Netmask",
|
||||
"Gateway",
|
||||
"Index",
|
||||
"Metric" );
|
||||
for( i = 0; i < IpForwardTable->dwNumEntries; i++ ) {
|
||||
strcpy( Destination,
|
||||
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].
|
||||
dwForwardDest) ) );
|
||||
strcpy( Netmask,
|
||||
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].
|
||||
dwForwardMask) ) );
|
||||
strcpy( Gateway,
|
||||
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].
|
||||
dwForwardNextHop) ) );
|
||||
|
||||
printf( "%-16s%-16s%-16s%-10d%-10d\n",
|
||||
Destination,
|
||||
Netmask,
|
||||
Gateway,
|
||||
IpForwardTable->table[i].dwForwardIfIndex,
|
||||
IpForwardTable->table[i].dwForwardMetric1 );
|
||||
}
|
||||
|
||||
free( IpForwardTable );
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
fprintf( stderr, "Route enumerate failed\n" );
|
||||
return Error;
|
||||
}
|
||||
}
|
||||
|
||||
int convert_add_cmd_line( PMIB_IPFORWARDROW RowToAdd,
|
||||
int argc, char **argv ) {
|
||||
int i;
|
||||
|
||||
if( argc > 1 ) RowToAdd->dwForwardDest = inet_addr( argv[0] );
|
||||
else return FALSE;
|
||||
for( i = 1; i < argc; i++ ) {
|
||||
if( !strcasecmp( argv[i], "mask" ) ) {
|
||||
i++; if( i >= argc ) return FALSE;
|
||||
RowToAdd->dwForwardMask = inet_addr( argv[i] );
|
||||
} else if( !strcasecmp( argv[i], "metric" ) ) {
|
||||
i++; if( i >= argc ) return FALSE;
|
||||
RowToAdd->dwForwardMetric1 = atoi( argv[i] );
|
||||
} else {
|
||||
RowToAdd->dwForwardNextHop = inet_addr( argv[i] );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int add_route( int argc, char **argv ) {
|
||||
MIB_IPFORWARDROW RowToAdd = { 0 };
|
||||
DWORD Error;
|
||||
|
||||
if( argc < 2 || !convert_add_cmd_line( &RowToAdd, argc, argv ) ) {
|
||||
fprintf( stderr,
|
||||
"route add usage:\n"
|
||||
"route add <target> [mask <mask>] <gw> [metric <m>]\n"
|
||||
" Adds a route to the IP route table.\n"
|
||||
" <target> is the network or host to add a route to.\n"
|
||||
" <mask> is the netmask to use (autodetected if unspecified)\n"
|
||||
" <gw> is the gateway to use to access the network\n"
|
||||
" <m> is the metric to use (lower is preferred)\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( (Error = CreateIpForwardEntry( &RowToAdd )) == ERROR_SUCCESS )
|
||||
return 0;
|
||||
|
||||
fprintf( stderr, "Route addition failed\n" );
|
||||
return Error;
|
||||
}
|
||||
|
||||
int del_route( int argc, char **argv ) {
|
||||
MIB_IPFORWARDROW RowToDel = { 0 };
|
||||
DWORD Error;
|
||||
|
||||
if( argc < 2 || !convert_add_cmd_line( &RowToDel, argc, argv ) ) {
|
||||
fprintf( stderr,
|
||||
"route delete usage:\n"
|
||||
"route delete <target> <gw>\n"
|
||||
" Removes a route from the IP route table.\n"
|
||||
" <target> is the network or host to add a route to.\n"
|
||||
" <gw> is the gateway to remove the route from.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( (Error = DeleteIpForwardEntry( &RowToDel )) == ERROR_SUCCESS )
|
||||
return 0;
|
||||
|
||||
fprintf( stderr, "Route addition failed\n" );
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
if( argc < 2 ) return usage();
|
||||
else if( !strcasecmp( argv[1], "print" ) )
|
||||
return print_routes();
|
||||
else if( !strcasecmp( argv[1], "add" ) )
|
||||
return add_route( argc-2, argv+2 );
|
||||
else if( !strcasecmp( argv[1], "delete" ) )
|
||||
return del_route( argc-2, argv+2 );
|
||||
else return usage();
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user