Compare commits

..

7 Commits

Author SHA1 Message Date
The ReactOS Team
0b545b592e This commit was manufactured by cvs2svn to create tag 'krnl0010'.
svn path=/tags/krnl0010/; revision=32
1998-09-05 17:34:23 +00:00
Rex Jolliff
935b7c2953 upgrade to krnl0010
svn path=/branches/ros/; revision=30
1998-09-05 17:34:23 +00:00
The ReactOS Team
1b7327da76 This commit was manufactured by cvs2svn to create branch 'ros'.
svn path=/branches/ros/; revision=29
1998-09-05 17:34:23 +00:00
Rex Jolliff
f77c44657c Import of KRNL0009
svn path=/branches/ros/; revision=21
1998-08-28 23:24:42 +00:00
The ReactOS Team
df0328b7cc This commit was manufactured by cvs2svn to create branch 'ros'.
svn path=/branches/ros/; revision=20
1998-08-28 23:24:42 +00:00
Rex Jolliff
94c8483b04 A much Needed Update
svn path=/branches/ros/; revision=10
1998-08-25 04:27:41 +00:00
The ReactOS Team
fc7e59ce74 This commit was manufactured by cvs2svn to create branch 'ros'.
svn path=/branches/ros/; revision=9
1998-08-25 04:27:41 +00:00
8630 changed files with 65123 additions and 2937221 deletions

0
.gitignore vendored
View File

View File

@@ -1,79 +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 <betam4x@gmail.com>
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>
Magnus Olsen (magnus@greatlord.com)
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.

View File

@@ -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

View File

@@ -1,78 +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
2.1 Building the binaries
To build ReactOS run 'make' (wihout the quotes) if you are building on Linux
or 'mingw32-make' if you are building on Windows (or ReactOS) from the top
directory.
2.2 Building a bootable CD image
To build a bootable CD image run 'make bootcd' (wihout the quotes) if you are
building on Linux or 'mingw32-make bootcd' if you are building on Windows (or
ReactOS) from the top directory. This will create a CD image with a filename,
ReactOS.iso, in the top directory.
3. Installation
ReactOS can only be installed on a machine that has a FAT16 or FAT32 partition
as the active (bootable) partition. The partition on which ReactOS is to be
installed (which may or may not be the bootable partition) must also be
formatted as FAT16 or FAT32. ReactOS Setup can format the partitions if
needed.
ReactOS can be installed from the source distribution or from the bootable CD
distribution. The two ways to install ReactOS are explained below.
3.1 Installation from sources
If you don't have an existing ReactOS installation you want to upgrade, then
build a bootable CD as described above. Burn the CD image, boot from it, and
follow the instructions to install ReactOS.
If you have an existing ReactOS installation you want to upgrade, then to
install ReactOS after building it, type 'make install' or
'mingw32-make install'. This will create the directory 'reactos' in the top
directory. Copy the contents of this directory over the existing installation.
If you don't want to copy the files manually every time you run a
'make install' or 'mingw32-make install', then you can specify the directory
where the files are to be copied to during installation.
Set the ROS_INSTALL environment variable. If you are on Windows this could be
done by:
set ROS_INSTALL=c:\reactos
If you are on Linux this could be done by:
export ROS_INSTALL=/mnt/windows/reactos
Now run 'make install' or 'mingw32-make install' to install the files to the
new location.
3.2 Installation from bootable CD distribution
To install ReactOS from the bootable CD distribution, extract the archive
contents. Then burn the CD image, boot from it, and follow instructions.
5. Help
If you run into problems or have suggestions for making ReactOS better, please
visit the address below and subscribe to one or more of the mailing lists.
http://www.reactos.com/en/content/view/full/66
ReactOS Development Team

View File

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

View File

@@ -1,354 +0,0 @@
# Well-known targets:
#
# all (default target)
# This target builds all of ReactOS.
#
# module
# These targets builds a single module. Replace module with the name of
# the module you want to build.
#
# bootcd
# This target builds an ISO (ReactOS.iso) from which ReactOS can be booted
# and installed.
#
# livecd
# This target builds an ISO (ReactOS-Live.iso) from which ReactOS can be
# booted, but not installed.
#
# install
# This target installs all of ReactOS to a location specified by the
# ROS_INSTALL environment variable.
#
# module_install
# These targets installs a single module to a location specified by the
# ROS_INSTALL environment variable. Replace module with the name of the
# module you want to install.
#
# clean
# This target cleans (deletes) all files that are generated when building
# ReactOS.
#
# module_clean
# These targets cleans (deletes) files that are generated when building a
# single module. Replace module with the name of the module you want to
# clean.
#
# depends
# This target does a complete dependency check of the ReactOS codebase.
# This can require several minutes to complete. If you only need to check
# dependencies for a single or few modules then you can use the
# module_depends targets instead. This target can also repair a damaged or
# missing makefile.auto if needed.
#
# module_depends
# These targets do a dependency check of individual modules. Replace module
# with the name of the module for which you want to check dependencies.
# This is faster than the depends target which does a complete dependency
# check of the ReactOS codebase.
#
#
# Accepted environment variables:
#
# ROS_PREFIX
# This variable specifies the prefix of the MinGW installation. On Windows
# a prefix is usually not needed, but on linux it is usually "mingw32". If
# not present and no executable named "gcc" can be found, then the prefix is
# assumed to be "mingw32". If your gcc is named i386-mingw32-gcc then set
# ROS_PREFIX to i386-mingw32. Don't include the dash (-) before gcc.
#
# ROS_INTERMEDIATE
# This variable controls where to put intermediate files. Intermediate
# files are generated files that are needed to generate the final
# output files. Examples of intermediate files include *.o, *.a, and
# *.coff. N.B. Don't put a path separator at the end. The variable
# defaults to .\obj-i386.
#
# ROS_OUTPUT
# This variable controls where to put output files. Output files are
# generated files that makes up the result of the build process.
# Examples of output files include *.exe, *.dll, and *.sys. N.B. Don't
# put a path separator at the end. The variable defaults to .\output-i386.
#
# ROS_TEMPORARY
# This variable controls where to put temporary files. Temporary files
# are (usually small) generated files that are needed to generate the
# intermediate or final output files. Examples of temporary files include
# *.rci (preprocessed .rc files for wrc), *.tmp, and *.exp. N.B. Don't put
# a path separator at the end. The variable defaults to the current
# directory.
#
# ROS_INSTALL
# This variable controls where to install output files to when using
# 'make install'. N.B. Don't put a path separator at the end. The variable
# defaults to .\reactos.
#
# ROS_BUILDMAP
# This variable controls if map files are to be generated for executable
# output files. Map files have the extension .map. The value can be either
# full (to build map files with assembly code), yes (to build map files
# without source code) or no (to not build any map files). The variable
# defaults to no.
#
# ROS_BUILDNOSTRIP
# This variable controls if non-symbol-stripped versions are to be built
# of executable output files. Non-symbol-stripped executable output files
# have .nostrip added to the filename just before the extension. The value
# can be either yes (to build non-symbol-stripped versions of executable
# output files) or no (to not build non-symbol-stripped versions of
# executable output files). The variable defaults to no.
#
# ROS_RBUILDFLAGS
# Pass parameters to rbuild.
# -v Be verbose.
# -c Clean as you go. Delete generated files as soon as they are not needed anymore.
# -dd Disable automatic dependencies.
# -dm{module} Check only automatic dependencies for this module.
# -mi Let make handle creation of install directories. Rbuild will not generate the directories.
# -ps Generate proxy makefiles in source tree instead of the output tree.
.PHONY: all
.PHONY: clean
all: makefile.auto
.SUFFIXES:
ifeq ($(HOST),)
ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
HOST=mingw32-windows
else
HOST=mingw32-linux
endif
endif
# Default to half-verbose mode
ifeq ($(VERBOSE),no)
Q = @
HALFVERBOSEECHO = no
BUILDNO_QUIET = -q
else
ifeq ($(VERBOSE),full)
Q =
HALFVERBOSEECHO = no
BUILDNO_QUIET =
else
Q = @
HALFVERBOSEECHO = yes
BUILDNO_QUIET = -q
endif
endif
ifeq ($(HOST),mingw32-linux)
QUOTE = "
else
QUOTE =
endif
ifeq ($(HALFVERBOSEECHO),yes)
ECHO_CP =@echo $(QUOTE)[COPY] $@$(QUOTE)
ECHO_MKDIR =@echo $(QUOTE)[MKDIR] $@$(QUOTE)
ECHO_BUILDNO =@echo $(QUOTE)[BUILDNO] $@$(QUOTE)
ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE)
ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE)
ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE)
ECHO_GAS =@echo $(QUOTE)[GAS] $<$(QUOTE)
ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE)
ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE)
ECHO_WINEBLD =@echo $(QUOTE)[WINEBLD] $@$(QUOTE)
ECHO_WRC =@echo $(QUOTE)[WRC] $@$(QUOTE)
ECHO_WIDL =@echo $(QUOTE)[WIDL] $@$(QUOTE)
ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE)
ECHO_DLLTOOL =@echo $(QUOTE)[DLLTOOL] $@$(QUOTE)
ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE)
ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE)
ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)
ECHO_CDMAKE =@echo $(QUOTE)[CDMAKE] $@$(QUOTE)
ECHO_MKHIVE =@echo $(QUOTE)[MKHIVE] $@$(QUOTE)
ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
else
ECHO_CP =
ECHO_MKDIR =
ECHO_BUILDNO =
ECHO_INVOKE =
ECHO_PCH =
ECHO_CC =
ECHO_GAS =
ECHO_NASM =
ECHO_AR =
ECHO_WINEBLD =
ECHO_WRC =
ECHO_WIDL =
ECHO_BIN2RES =
ECHO_DLLTOOL =
ECHO_LD =
ECHO_NM =
ECHO_OBJDUMP =
ECHO_RBUILD =
ECHO_RSYM =
ECHO_WMC =
ECHO_NCI =
ECHO_CABMAN =
ECHO_CDMAKE =
ECHO_MKHIVE =
ECHO_REGTESTS=
ECHO_TEST =
ECHO_GENDIB =
endif
host_gcc = $(Q)gcc
host_gpp = $(Q)g++
host_ld = $(Q)ld
host_ar = $(Q)ar
host_objcopy = $(Q)objcopy
ifeq ($(HOST),mingw32-linux)
EXEPREFIX = ./
EXEPOSTFIX =
SEP = /
mkdir = -$(Q)mkdir -p
gcc = $(Q)$(PREFIX)-gcc
gpp = $(Q)$(PREFIX)-g++
ld = $(Q)$(PREFIX)-ld
nm = $(Q)$(PREFIX)-nm
objdump = $(Q)$(PREFIX)-objdump
ar = $(Q)$(PREFIX)-ar
objcopy = $(Q)$(PREFIX)-objcopy
dlltool = $(Q)$(PREFIX)-dlltool
windres = $(Q)$(PREFIX)-windres
rm = $(Q)rm -f
cp = $(Q)cp
NUL = /dev/null
else # mingw32-windows
EXEPREFIX =
EXEPOSTFIX = .exe
ROS_EMPTY =
SEP = \$(ROS_EMPTY)
mkdir = -$(Q)mkdir
gcc = $(Q)gcc
gpp = $(Q)g++
ld = $(Q)ld
nm = $(Q)nm
objdump = $(Q)objdump
ar = $(Q)ar
objcopy = $(Q)objcopy
dlltool = $(Q)dlltool
windres = $(Q)windres
rm = $(Q)del /f /q
cp = $(Q)copy /y
NUL = NUL
endif
ifneq ($(ROS_INTERMEDIATE),)
INTERMEDIATE := $(ROS_INTERMEDIATE)
else
INTERMEDIATE := obj-i386
endif
INTERMEDIATE_ := $(INTERMEDIATE)$(SEP)
ifneq ($(ROS_OUTPUT),)
OUTPUT := $(ROS_OUTPUT)
else
OUTPUT := output-i386
endif
OUTPUT_ := $(OUTPUT)$(SEP)
ifneq ($(ROS_TEMPORARY),)
TEMPORARY := $(ROS_TEMPORARY)
else
TEMPORARY :=
endif
TEMPORARY_ := $(TEMPORARY)$(SEP)
ifneq ($(ROS_INSTALL),)
INSTALL := $(ROS_INSTALL)
else
INSTALL := reactos
endif
INSTALL_ := $(INSTALL)$(SEP)
$(INTERMEDIATE):
${mkdir} $@
ifneq ($(INTERMEDIATE),$(OUTPUT))
$(OUTPUT):
${mkdir} $@
endif
NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
KERNEL32_MC = lib$(SEP)kernel32$(SEP)kernel32.mc
BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h
BUGCODES_H = include$(SEP)reactos$(SEP)bugcodes.h
BUGCODES_RC = ntoskrnl$(SEP)bugcodes.rc
ERRCODES_H = include$(SEP)reactos$(SEP)errcodes.h
ERRCODES_RC = lib$(SEP)kernel32$(SEP)errcodes.rc
include lib/lib.mak
include tools/tools.mak
include boot/freeldr/bootsect/bootsect.mak
-include makefile.auto
PREAUTO := \
$(BIN2C_TARGET) \
$(BIN2RES_TARGET) \
$(BUILDNO_H) \
$(BUGCODES_H) \
$(BUGCODES_RC) \
$(ERRCODES_H) \
$(ERRCODES_RC) \
$(NCI_SERVICE_FILES) \
$(GENDIB_DIB_FILES)
makefile.auto: $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
$(ECHO_RBUILD)
$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) mingw
.PHONY: msvc
msvc: $(RBUILD_TARGET)
$(ECHO_RBUILD)
$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) msvc
$(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
$(ECHO_WMC)
$(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
$(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
$(ECHO_WMC)
$(Q)$(WMC_TARGET) -i -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
.PHONY: msvc6
msvc6: $(RBUILD_TARGET)
$(ECHO_RBUILD)
$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs6.00 msvc
.PHONY: msvc7
msvc7: $(RBUILD_TARGET)
$(ECHO_RBUILD)
$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 msvc
.PHONY: msvc71
msvc71: $(RBUILD_TARGET)
$(ECHO_RBUILD)
$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 msvc
.PHONY: msvc8
msvc8: $(RBUILD_TARGET)
$(ECHO_RBUILD)
$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 msvc
.PHONY: makefile_auto_clean
makefile_auto_clean:
-@$(rm) makefile.auto $(PREAUTO) 2>$(NUL)
.PHONY: clean
clean: makefile_auto_clean
.PHONY: depends
depends:
@-$(rm) makefile.auto
@$(MAKE) $(filter-out depends, $(MAKECMDGOALS))

View File

@@ -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

View File

@@ -1,80 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<project name="ReactOS" makefile="makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config.xml">
<xi:fallback>
<xi:include href="config.template.xml" />
</xi:fallback>
</xi:include>
<xi:include href="baseaddress.xml" />
<define name="_M_IX86" />
<if property="MP" value="1">
<define name="CONFIG_SMP" value="1" />
</if>
<if property="DBG" value="1">
<define name="DBG" value="1" />
<property name="DBG_OR_KDBG" value="true" />
</if>
<if property="DBG" value="0">
<compilerflag>-Os</compilerflag>
<compilerflag>-Wno-strict-aliasing</compilerflag>
<compilerflag>-ftracer</compilerflag>
<compilerflag>-momit-leaf-frame-pointer</compilerflag>
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
</if>
<if property="KDBG" value="1">
<define name="KDBG" value="1" />
<property name="DBG_OR_KDBG" value="true" />
</if>
<compilerflag>-Wpointer-arith</compilerflag>
<include>include</include>
<include>include/reactos</include>
<include>include/libs</include>
<include>include/drivers</include>
<include>include/subsys</include>
<include>w32api/include</include>
<include>w32api/include/ddk</include>
<directory name="apps">
<xi:include href="apps/directory.xml" />
</directory>
<directory name="boot">
<xi:include href="boot/boot.xml" />
</directory>
<directory name="bootdata">
<xi:include href="bootdata/bootdata.xml" />
</directory>
<directory name="drivers">
<xi:include href="drivers/directory.xml" />
</directory>
<directory name="hal">
<xi:include href="hal/directory.xml" />
</directory>
<directory name="include">
<xi:include href="include/directory.xml" />
</directory>
<directory name="lib">
<xi:include href="lib/directory.xml" />
</directory>
<directory name="media">
<xi:include href="media/directory.xml" />
</directory>
<directory name="modules">
<xi:include href="modules/directory.xml" />
</directory>
<directory name="ntoskrnl">
<xi:include href="ntoskrnl/ntoskrnl.xml" />
</directory>
<directory name="regtests">
<xi:include href="regtests/directory.xml" />
</directory>
<directory name="services">
<xi:include href="services/directory.xml" />
</directory>
<directory name="subsys">
<xi:include href="subsys/directory.xml" />
</directory>
</project>

View 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

View File

@@ -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

View File

@@ -1,3 +0,0 @@
<directory name="utils">
<xi:include href="utils/directory.xml" />
</directory>

View File

@@ -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__*/

View File

@@ -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__

View File

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

View File

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

View File

@@ -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__*/

View File

@@ -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__

View File

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

View File

@@ -1,615 +0,0 @@
#include <conio.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
/** DEFINES *******************************************************************/
#define PATCH_BUFFER_SIZE 4096 /* Maximum size of a patch */
#define PATCH_BUFFER_MAGIC "\xde\xad\xbe\xef MaGiC MaRk "
#define SIZEOF_PATCH_BUFFER_MAGIC (sizeof (PATCH_BUFFER_MAGIC) - 1)
/** TYPES *********************************************************************/
typedef struct _PatchedByte
{
int offset; /*!< File offset of the patched byte. */
unsigned char expected; /*!< Expected (original) value of the byte. */
unsigned char patched; /*!< Patched (new) value for the byte. */
} PatchedByte;
typedef struct _PatchedFile
{
const char *name; /*!< Name of the file to be patched. */
int fileSize; /*!< Size of the file in bytes. */
int patchCount; /*!< Number of patches for the file. */
PatchedByte *patches; /*!< Patches for the file. */
} PatchedFile;
typedef struct _Patch
{
const char *name; /*!< Name of the patch. */
int fileCount; /*!< Number of files in the patch. */
PatchedFile *files; /*!< Files for the patch. */
} Patch;
/** FUNCTION PROTOTYPES *******************************************************/
static void printUsage();
/** GLOBALS *******************************************************************/
static Patch m_patch = { NULL, 0, NULL };
static int m_argc = 0;
static char **m_argv = NULL;
/* patch buffer where we put the patch info into */
static unsigned char m_patchBuffer[SIZEOF_PATCH_BUFFER_MAGIC + PATCH_BUFFER_SIZE] =
PATCH_BUFFER_MAGIC;
/** HELPER FUNCTIONS **********************************************************/
static void *
loadFile(const char *fileName, int *fileSize_)
{
FILE *f;
struct stat sb;
int fileSize;
void *p;
/* Open the file */
f = fopen(fileName, "rb");
if (f == NULL)
{
printf("Couldn't open file %s for reading!\n", fileName);
return NULL;
}
/* Get file size */
if (fstat(fileno(f), &sb) < 0)
{
fclose(f);
printf("Couldn't get size of file %s!\n", fileName);
return NULL;
}
fileSize = sb.st_size;
/* Load file */
p = malloc(fileSize);
if (p == NULL)
{
fclose(f);
printf("Couldn't allocate %d bytes for file %s!\n", fileSize, fileName);
return NULL;
}
if (fread(p, fileSize, 1, f) != 1)
{
fclose(f);
free(p);
printf("Couldn't read file %s into memory!\n", fileName);
return NULL;
}
/* Close file */
fclose(f);
*fileSize_ = fileSize;
return p;
}
static int
saveFile(const char *fileName, void *file, int fileSize)
{
FILE *f;
/* Open the file */
f = fopen(fileName, "wb");
if (f == NULL)
{
printf("Couldn't open file %s for writing!\n", fileName);
return -1;
}
/* Write file */
if (fwrite(file, fileSize, 1, f) != 1)
{
fclose(f);
printf("Couldn't write file %s!\n", fileName);
return -1;
}
/* Close file */
fclose(f);
return 0;
}
static int
compareFiles(
PatchedFile *patchedFile,
const char *originalFileName)
{
const char *patchedFileName = patchedFile->name;
unsigned char *origChunk, *patchedChunk;
int origSize, patchedSize, i, patchCount;
PatchedByte *patches = NULL;
int patchesArrayCount = 0;
/* Load both files */
origChunk = loadFile(originalFileName, &origSize);
if (origChunk == NULL)
return -1;
patchedChunk = loadFile(patchedFileName, &patchedSize);
if (patchedChunk == NULL)
{
free(origChunk);
return -1;
}
if (origSize != patchedSize)
{
free(origChunk);
free(patchedChunk);
printf("File size of %s and %s differs (%d != %d)\n",
originalFileName, patchedFileName,
origSize, patchedSize);
return -1;
}
/* Compare the files and record any differences */
printf("Comparing %s to %s", originalFileName, patchedFileName);
for (i = 0, patchCount = 0; i < origSize; i++)
{
if (origChunk[i] != patchedChunk[i])
{
patchCount++;
/* Resize patches array if needed */
if (patchesArrayCount < patchCount)
{
PatchedByte *newPatches;
newPatches = realloc(patches, patchCount * sizeof (PatchedByte));
if (newPatches == NULL)
{
if (patches != NULL)
free(patches);
free(origChunk);
free(patchedChunk);
printf("\nOut of memory (tried to allocated %d bytes)\n",
patchCount * sizeof (PatchedByte));
return -1;
}
patches = newPatches;
}
/* Fill in patch info */
patches[patchCount - 1].offset = i;
patches[patchCount - 1].expected = origChunk[i];
patches[patchCount - 1].patched = patchedChunk[i];
}
if ((i % (origSize / 40)) == 0)
printf(".");
}
printf(" %d changed bytes found.\n", patchCount);
/* Unload the files */
free(origChunk);
free(patchedChunk);
/* Save patch info */
patchedFile->fileSize = patchedSize;
patchedFile->patchCount = patchCount;
patchedFile->patches = patches;
return 0;
}
static int
outputPatch(const char *outputFileName)
{
unsigned char *patchExe, *patchBuffer;
int i, size, patchExeSize, patchSize, stringSize, stringOffset, patchOffset;
Patch *patch;
PatchedFile *files;
printf("Putting patch into %s...\n", outputFileName);
/* Calculate size of the patch */
patchSize = sizeof (Patch) + sizeof (PatchedFile) * m_patch.fileCount;
stringSize = strlen(m_patch.name) + 1;
for (i = 0; i < m_patch.fileCount; i++)
{
stringSize += strlen(m_patch.files[i].name) + 1;
patchSize += sizeof (PatchedByte) * m_patch.files[i].patchCount;
}
if ((stringSize + patchSize) > PATCH_BUFFER_SIZE)
{
printf("Patch is too big - %d bytes maximum, %d bytes needed\n",
PATCH_BUFFER_SIZE, stringSize + patchSize);
return -1;
}
/* Load patch.exe file into memory... */
patchExe = loadFile(m_argv[0], &patchExeSize);
if (patchExe == NULL)
{
return -1;
}
/* Try to find the magic mark for the patch buffer */
for (i = 0; i < (patchExeSize - SIZEOF_PATCH_BUFFER_MAGIC); i++)
{
if (memcmp(patchExe + i, m_patchBuffer, SIZEOF_PATCH_BUFFER_MAGIC) == 0)
{
patchBuffer = patchExe + i + SIZEOF_PATCH_BUFFER_MAGIC;
break;
}
}
if (!(i < (patchExeSize - SIZEOF_PATCH_BUFFER_MAGIC)))
{
free(patchExe);
printf("Couldn't find patch buffer magic in file %s - this shouldn't happen!!!\n", m_argv[0]);
return -1;
}
/* Pack patch together and replace string pointers by offsets */
patch = (Patch *)patchBuffer;
files = (PatchedFile *)(patchBuffer + sizeof (Patch));
patchOffset = sizeof (Patch) + sizeof (PatchedFile) * m_patch.fileCount;
stringOffset = patchSize;
patch->fileCount = m_patch.fileCount;
patch->files = (PatchedFile *)sizeof (Patch);
patch->name = (const char *)stringOffset;
strcpy(patchBuffer + stringOffset, m_patch.name);
stringOffset += strlen(m_patch.name) + 1;
for (i = 0; i < m_patch.fileCount; i++)
{
files[i].fileSize = m_patch.files[i].fileSize;
files[i].patchCount = m_patch.files[i].patchCount;
files[i].name = (const char *)stringOffset;
strcpy(patchBuffer + stringOffset, m_patch.files[i].name);
stringOffset += strlen(m_patch.files[i].name) + 1;
size = files[i].patchCount * sizeof (PatchedByte);
files[i].patches = (PatchedByte *)patchOffset;
memcpy(patchBuffer + patchOffset, m_patch.files[i].patches, size);
patchOffset += size;
}
size = patchSize + stringSize;
memset(patchBuffer + size, 0, PATCH_BUFFER_SIZE - size);
/* Save file */
if (saveFile(outputFileName, patchExe, patchExeSize) < 0)
{
free(patchExe);
return -1;
}
free(patchExe);
printf("Patch saved!\n");
return 0;
}
static int
loadPatch()
{
char *p;
Patch *patch;
int i;
p = m_patchBuffer + SIZEOF_PATCH_BUFFER_MAGIC;
patch = (Patch *)p;
if (patch->name == NULL)
{
return -1;
}
m_patch.name = p + (int)patch->name;
m_patch.fileCount = patch->fileCount;
m_patch.files = (PatchedFile *)(p + (int)patch->files);
for (i = 0; i < m_patch.fileCount; i++)
{
m_patch.files[i].name = p + (int)m_patch.files[i].name;
m_patch.files[i].patches = (PatchedByte *)(p + (int)m_patch.files[i].patches);
}
printf("Patch %s loaded...\n", m_patch.name);
return 0;
}
/** MAIN FUNCTIONS ************************************************************/
static int
createPatch()
{
int i, status;
const char *outputFileName;
/* Check argument count */
if (m_argc < 6 || (m_argc % 2) != 0)
{
printUsage();
return -1;
}
outputFileName = m_argv[3];
m_patch.name = m_argv[2];
/* Allocate PatchedFiles array */
m_patch.fileCount = (m_argc - 4) / 2;
m_patch.files = malloc(m_patch.fileCount * sizeof (PatchedFile));
if (m_patch.files == NULL)
{
printf("Out of memory!\n");
return -1;
}
memset(m_patch.files, 0, m_patch.fileCount * sizeof (PatchedFile));
/* Compare original to patched files and fill m_patch.files array */
for (i = 0; i < m_patch.fileCount; i++)
{
m_patch.files[i].name = m_argv[4 + (i * 2) + 1];
status = compareFiles(m_patch.files + i, m_argv[4 + (i * 2) + 0]);
if (status < 0)
{
for (i = 0; i < m_patch.fileCount; i++)
{
if (m_patch.files[i].patches != NULL)
free(m_patch.files[i].patches);
}
free(m_patch.files);
m_patch.files = NULL;
m_patch.fileCount = 0;
return status;
}
}
/* Output patch */
return outputPatch(outputFileName);
}
static int
applyPatch()
{
int c, i, j, fileSize, makeBackup;
unsigned char *file;
char *p;
const char *fileName;
char buffer[MAX_PATH];
if (m_argc > 1 && strcmp(m_argv[1], "-d") != 0)
{
printUsage();
return -1;
}
/* Load patch */
if (loadPatch() < 0)
{
printf("This executable doesn't contain a patch, use -c to create one.\n");
return -1;
}
if (m_argc > 1)
{
/* Dump patch */
printf("Patch name: %s\n", m_patch.name);
printf("File count: %d\n", m_patch.fileCount);
for (i = 0; i < m_patch.fileCount; i++)
{
printf("----------------------\n"
"File name: %s\n"
"File size: %d bytes\n",
m_patch.files[i].name, m_patch.files[i].fileSize);
printf("Patch count: %d\n", m_patch.files[i].patchCount);
for (j = 0; j < m_patch.files[i].patchCount; j++)
{
printf(" Offset 0x%x 0x%02x -> 0x%02x\n",
m_patch.files[i].patches[j].offset,
m_patch.files[i].patches[j].expected,
m_patch.files[i].patches[j].patched);
}
}
}
else
{
/* Apply patch */
printf("Applying patch...\n");
for (i = 0; i < m_patch.fileCount; i++)
{
/* Load original file */
fileName = m_patch.files[i].name;
applyPatch_retry_file:
file = loadFile(fileName, &fileSize);
if (file == NULL)
{
printf("File %s not found! ", fileName);
applyPatch_file_open_error:
printf("(S)kip, (R)etry, (A)bort, (M)anually enter filename");
do
{
c = getch();
}
while (c != 's' && c != 'r' && c != 'a' && c != 'm');
printf("\n");
if (c == 's')
{
continue;
}
else if (c == 'r')
{
goto applyPatch_retry_file;
}
else if (c == 'a')
{
return 0;
}
else if (c == 'm')
{
if (fgets(buffer, sizeof (buffer), stdin) == NULL)
{
printf("fgets() failed!\n");
return -1;
}
p = strchr(buffer, '\r');
if (p != NULL)
*p = '\0';
p = strchr(buffer, '\n');
if (p != NULL)
*p = '\0';
fileName = buffer;
goto applyPatch_retry_file;
}
}
/* Check file size */
if (fileSize != m_patch.files[i].fileSize)
{
free(file);
printf("File %s has unexpected filesize of %d bytes (%d bytes expected)\n",
fileName, fileSize, m_patch.files[i].fileSize);
if (fileName != m_patch.files[i].name) /* manually entered filename */
{
goto applyPatch_file_open_error;
}
return -1;
}
/* Ask for backup */
printf("Do you want to make a backup of %s? (Y)es, (N)o, (A)bort", fileName);
do
{
c = getch();
}
while (c != 'y' && c != 'n' && c != 'a');
printf("\n");
if (c == 'y')
{
char buffer[MAX_PATH];
snprintf(buffer, MAX_PATH, "%s.bak", fileName);
buffer[MAX_PATH-1] = '\0';
makeBackup = 1;
if (access(buffer, 0) >= 0) /* file exists */
{
printf("File %s already exists, overwrite? (Y)es, (N)o, (A)bort", buffer);
do
{
c = getch();
}
while (c != 'y' && c != 'n' && c != 'a');
printf("\n");
if (c == 'n')
makeBackup = 0;
else if (c == 'a')
{
free(file);
return 0;
}
}
if (makeBackup && saveFile(buffer, file, fileSize) < 0)
{
free(file);
return -1;
}
}
else if (c == 'a')
{
free(file);
return 0;
}
/* Patch file */
for (j = 0; j < m_patch.files[i].patchCount; j++)
{
int offset = m_patch.files[i].patches[j].offset;
if (file[offset] != m_patch.files[i].patches[j].expected)
{
printf("Unexpected value in file %s at offset 0x%x: expected = 0x%02x, found = 0x%02x\n",
fileName, offset, m_patch.files[i].patches[j].expected, file[offset]);
free(file);
return -1;
}
file[offset] = m_patch.files[i].patches[j].patched;
}
/* Save file */
if (saveFile(fileName, file, fileSize) < 0)
{
free(file);
return -1;
}
free(file);
}
printf("Patch applied sucessfully!\n");
}
return 0;
}
static void
printUsage()
{
printf("Usage:\n"
"%s -c - Create patch\n"
"%s -d - Dump patch\n"
"%s - Apply patch\n"
"\n"
"A patch can be created like this:\n"
"%s -c \"patch name\" output.exe file1.orig file1.patched[ file2.orig file2.patched[ ...]]\n",
m_argv[0], m_argv[0], m_argv[0], m_argv[0]);
}
int
main(
int argc,
char *argv[])
{
m_argc = argc;
m_argv = argv;
if (argc >= 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0))
{
printUsage();
return 0;
}
else if (argc >= 2 && argv[1][0] == '-')
{
if (strcmp(argv[1], "-c") == 0)
{
return createPatch();
}
else if (strcmp(argv[1], "-d") == 0)
{
return applyPatch();
}
else
{
printf("Unknown option: %s\n"
"Use -h for help.\n",
argv[1]);
return -1;
}
}
return applyPatch();
}

View File

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

View File

@@ -1,11 +0,0 @@
<group>
<directory name="net">
<xi:include href="net/directory.xml" />
</directory>
<directory name="rosperf">
<xi:include href="rosperf/rosperf.xml" />
</directory>
<directory name="ps">
<xi:include href="ps/ps.xml" />
</directory>
</group>

View File

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

View File

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

View File

@@ -1,733 +0,0 @@
/*
*
* dumprecbin - dumps a recycle bin database
*
* Copyright (c) 2005 by Thomas Weidenmueller <w3seek@reactos.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* TODO: - Support for Vista recycle bins (read the DeleteInfo NTFS streams, also NT 5.x)
* - Support for INFO databases (win95)
*/
#include <windows.h>
#include <winternl.h>
#include <sddl.h>
#include <ntsecapi.h>
#include <stdio.h>
#include <ctype.h>
#include <tchar.h>
#ifndef NT_SUCCESS
#define NT_SUCCESS(status) ((LONG)(status) >= 0)
#endif
typedef struct _RECYCLE_BIN
{
struct _RECYCLE_BIN *Next;
PSID Sid;
WCHAR User[255];
WCHAR Path[MAX_PATH + 1];
} RECYCLE_BIN, *PRECYCLE_BIN;
typedef enum
{
ivUnknown = 0,
ivINFO2
} INFO_VERSION, *PINFO_VERSION;
typedef struct _INFO2_HEADER
{
DWORD Version;
DWORD Zero1;
DWORD Zero2;
DWORD RecordSize;
} INFO2_HEADER, *PINFO2_HEADER;
typedef struct _INFO2_RECORD
{
DWORD Unknown;
CHAR AnsiFileName[MAX_PATH];
DWORD RecordNumber;
DWORD DriveLetter;
FILETIME DeletionTime;
DWORD DeletedPhysicalSize;
WCHAR FileName[MAX_PATH - 2];
} INFO2_RECORD, *PINFO2_RECORD;
static HANDLE
OpenAndMapInfoDatabase(IN LPTSTR szFileName,
OUT PVOID *MappingBasePtr,
OUT PLARGE_INTEGER FileSize)
{
HANDLE hFile, hMapping = INVALID_HANDLE_VALUE;
hFile = CreateFile(szFileName,
FILE_READ_DATA,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM,
NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
if (GetFileSizeEx(hFile,
FileSize) &&
FileSize->QuadPart >= 0xF)
{
hMapping = CreateFileMapping(hFile,
NULL,
PAGE_READONLY,
0,
0,
NULL);
if (hMapping == NULL ||
!(*MappingBasePtr = MapViewOfFile(hMapping,
FILE_MAP_READ,
0,
0,
0)))
{
if (hMapping != NULL)
{
CloseHandle(hMapping);
}
hMapping = INVALID_HANDLE_VALUE;
}
}
CloseHandle(hFile);
}
return hMapping;
}
static VOID
UnmapAndCloseDatabase(IN HANDLE hMapping,
IN PVOID MappingBasePtr)
{
UnmapViewOfFile(MappingBasePtr);
CloseHandle(hMapping);
}
static INFO_VERSION
DetectDatabaseVersion(PVOID Header)
{
PINFO2_HEADER Info2 = (PINFO2_HEADER)Header;
INFO_VERSION Version = ivUnknown;
if (Info2->Version == 5 &&
Info2->Zero1 == 0 &&
Info2->Zero2 == 0 &&
Info2->RecordSize == 0x320)
{
Version = ivINFO2;
}
return Version;
}
static BOOL
IsValidRecycleBin(IN LPTSTR szPath)
{
TCHAR szFile[MAX_PATH + 1];
TCHAR szClsId[48];
INFO_VERSION DbVersion = ivUnknown;
_stprintf(szFile,
_T("%s\\desktop.ini"),
szPath);
/* check if directory contains a valid desktop.ini for the recycle bin */
if (GetPrivateProfileString(TEXT(".ShellClassInfo"),
TEXT("CLSID"),
NULL,
szClsId,
sizeof(szClsId) / sizeof(szClsId[0]),
szFile) &&
!_tcsicmp(_T("{645FF040-5081-101B-9F08-00AA002F954E}"),
szClsId))
{
HANDLE hDb;
LARGE_INTEGER FileSize;
PVOID pDbBase = NULL;
/* open the database and check the signature */
_stprintf(szFile,
_T("%s\\INFO2"),
szPath);
hDb = OpenAndMapInfoDatabase(szFile,
&pDbBase,
&FileSize);
if (hDb != INVALID_HANDLE_VALUE)
{
DbVersion = DetectDatabaseVersion(pDbBase);
UnmapAndCloseDatabase(hDb,
pDbBase);
}
}
return DbVersion != ivUnknown;
}
static BOOL
OpenLocalLSAPolicyHandle(IN ACCESS_MASK DesiredAccess,
OUT PLSA_HANDLE PolicyHandle)
{
LSA_OBJECT_ATTRIBUTES LsaObjectAttributes = {0};
NTSTATUS Status;
Status = LsaOpenPolicy(NULL,
&LsaObjectAttributes,
DesiredAccess,
PolicyHandle);
if (!NT_SUCCESS(Status))
{
SetLastError(LsaNtStatusToWinError(Status));
return FALSE;
}
return TRUE;
}
static BOOL
ConvertSIDToAccountName(IN PSID Sid,
OUT LPWSTR User)
{
DWORD AccountNameLen = 0;
DWORD DomainNameLen = 0;
SID_NAME_USE NameUse;
DWORD Error = ERROR_SUCCESS;
LPWSTR AccountName, DomainName;
BOOL Ret = FALSE;
if (!LookupAccountSidW(NULL,
Sid,
NULL,
&AccountNameLen,
NULL,
&DomainNameLen,
&NameUse))
{
Error = GetLastError();
if (Error == ERROR_NONE_MAPPED ||
Error != ERROR_INSUFFICIENT_BUFFER)
{
/* some unexpected error occured! */
goto ConvertSID;
}
}
AccountName = (LPWSTR)HeapAlloc(GetProcessHeap(),
0,
(AccountNameLen + DomainNameLen) * sizeof(WCHAR));
if (AccountName != NULL)
{
LSA_HANDLE PolicyHandle;
DomainName = AccountName + AccountNameLen;
if (!LookupAccountSidW(NULL,
Sid,
AccountName,
&AccountNameLen,
DomainName,
&DomainNameLen,
&NameUse))
{
goto BailFreeAccountName;
}
wcscpy(User,
AccountName);
Ret = TRUE;
if (OpenLocalLSAPolicyHandle(POLICY_LOOKUP_NAMES | POLICY_VIEW_LOCAL_INFORMATION,
&PolicyHandle))
{
PLSA_REFERENCED_DOMAIN_LIST ReferencedDomain;
PLSA_TRANSLATED_NAME Names;
PLSA_TRUST_INFORMATION Domain;
PLSA_UNICODE_STRING DomainName;
PPOLICY_ACCOUNT_DOMAIN_INFO PolicyAccountDomainInfo = NULL;
NTSTATUS Status;
Status = LsaLookupSids(PolicyHandle,
1,
&Sid,
&ReferencedDomain,
&Names);
if (NT_SUCCESS(Status))
{
if (ReferencedDomain != NULL &&
Names->DomainIndex >= 0)
{
Domain = &ReferencedDomain->Domains[Names->DomainIndex];
DomainName = &Domain->Name;
}
else
{
Domain = NULL;
DomainName = NULL;
}
switch (Names->Use)
{
case SidTypeAlias:
if (Domain != NULL)
{
/* query the domain name for BUILTIN accounts */
Status = LsaQueryInformationPolicy(PolicyHandle,
PolicyAccountDomainInformation,
(PVOID*)&PolicyAccountDomainInfo);
if (NT_SUCCESS(Status))
{
DomainName = &PolicyAccountDomainInfo->DomainName;
}
}
/* fall through */
case SidTypeUser:
{
if (Domain != NULL)
{
WCHAR *s;
/* NOTE: LSA_UNICODE_STRINGs are not always NULL-terminated! */
wcscpy(User,
AccountName);
wcscat(User,
L" (");
s = User + wcslen(User);
CopyMemory(s,
DomainName->Buffer,
DomainName->Length);
s += DomainName->Length / sizeof(WCHAR);
*(s++) = L'\\';
CopyMemory(s,
Names->Name.Buffer,
Names->Name.Length);
s += Names->Name.Length / sizeof(WCHAR);
*(s++) = L')';
*s = L'\0';
}
break;
}
case SidTypeWellKnownGroup:
{
break;
}
default:
{
_ftprintf(stderr,
_T("Unhandled SID type: 0x%x\n"),
Names->Use);
break;
}
}
if (PolicyAccountDomainInfo != NULL)
{
LsaFreeMemory(PolicyAccountDomainInfo);
}
LsaFreeMemory(ReferencedDomain);
LsaFreeMemory(Names);
}
LsaClose(PolicyHandle);
if (!NT_SUCCESS(Status))
{
Ret = FALSE;
goto BailFreeAccountName;
}
}
else
{
BailFreeAccountName:
HeapFree(GetProcessHeap(),
0,
AccountName);
goto ConvertSID;
}
}
ConvertSID:
if (!Ret)
{
LPWSTR StrSid;
Ret = ConvertSidToStringSidW(Sid,
&StrSid);
if (Ret)
{
wcscpy(User,
StrSid);
LocalFree((HLOCAL)StrSid);
}
}
return Ret;
}
static VOID
FreeRecycleBinsList(IN OUT PRECYCLE_BIN *RecycleBinsListHead)
{
PRECYCLE_BIN CurrentBin, NextBin;
CurrentBin = *RecycleBinsListHead;
while (CurrentBin != NULL)
{
NextBin = CurrentBin->Next;
LocalFree((HLOCAL)CurrentBin->Sid);
HeapFree(GetProcessHeap(),
0,
CurrentBin);
CurrentBin = NextBin;
}
*RecycleBinsListHead = NULL;
}
static BOOL
LocateRecycleBins(IN LPWSTR szDrive,
OUT PRECYCLE_BIN *RecycleBinsListHead)
{
TCHAR szRecBinPath[MAX_PATH + 1];
HANDLE FindResult;
WIN32_FIND_DATA FindData;
PRECYCLE_BIN NewBin;
BOOL Ret = FALSE;
FreeRecycleBinsList(RecycleBinsListHead);
/*
* search for recycle bins on volumes that support file security (NTFS)
*/
_stprintf(szRecBinPath,
_T("%lS\\RECYCLER\\*"),
szDrive);
FindResult = FindFirstFile(szRecBinPath,
&FindData);
if (FindResult != INVALID_HANDLE_VALUE)
{
do
{
if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
_tcscmp(FindData.cFileName,
_T("..")) &&
_tcscmp(FindData.cFileName,
_T(".")))
{
PSID Sid;
if (ConvertStringSidToSid(FindData.cFileName,
&Sid))
{
_stprintf(szRecBinPath,
_T("%s\\RECYCLER\\%s"),
szDrive,
FindData.cFileName);
if (IsValidRecycleBin(szRecBinPath))
{
NewBin = (PRECYCLE_BIN)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
sizeof(RECYCLE_BIN));
if (NewBin != NULL)
{
_tcscpy(NewBin->Path,
szRecBinPath);
/* convert the SID to an account name */
ConvertSIDToAccountName(Sid,
NewBin->User);
/* append the recycle bin */
*RecycleBinsListHead = NewBin;
RecycleBinsListHead = &NewBin->Next;
Ret = TRUE;
}
else
goto ContinueFreeSid;
}
else
{
ContinueFreeSid:
LocalFree((HLOCAL)Sid);
}
}
}
} while (FindNextFile(FindResult,
&FindData));
FindClose(FindResult);
}
/*
* search for recycle bins on volumes that don't support file security (FAT)
*/
_stprintf(szRecBinPath,
_T("%s\\Recycled"),
szDrive);
FindResult = FindFirstFile(szRecBinPath,
&FindData);
if (FindResult != INVALID_HANDLE_VALUE)
{
if (IsValidRecycleBin(szRecBinPath))
{
SID_IDENTIFIER_AUTHORITY WorldSia = {SECURITY_WORLD_SID_AUTHORITY};
PSID EveryoneSid;
/* create an Everyone SID */
if (AllocateAndInitializeSid(&WorldSia,
1,
SECURITY_WORLD_RID,
0,
0,
0,
0,
0,
0,
0,
&EveryoneSid))
{
NewBin = (PRECYCLE_BIN)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
sizeof(RECYCLE_BIN));
if (NewBin != NULL)
{
_tcscpy(NewBin->Path,
szRecBinPath);
/* convert the SID to an account name */
ConvertSIDToAccountName(EveryoneSid,
NewBin->User);
/* append the recycle bin */
*RecycleBinsListHead = NewBin;
RecycleBinsListHead = &NewBin->Next;
Ret = TRUE;
}
else
FreeSid(EveryoneSid);
}
}
FindClose(FindResult);
}
return Ret;
}
static VOID
DiskFileNameFromRecord(OUT LPTSTR szShortFileName,
IN DWORD RecordNumber,
IN WCHAR cDriveLetter,
IN LPWSTR szFileName)
{
LPWSTR FileExt;
FileExt = wcsrchr(szFileName,
L'.');
if (FileExt != NULL)
{
_stprintf(szShortFileName,
_T("D%lC%d%lS"),
cDriveLetter,
RecordNumber,
FileExt);
}
else
{
_stprintf(szShortFileName,
_T("D%lC%d"),
cDriveLetter,
RecordNumber);
}
}
static BOOL
DumpRecycleBin(IN PRECYCLE_BIN RecycleBin)
{
WCHAR szFile[MAX_PATH + 1];
HANDLE hDb;
LARGE_INTEGER FileSize;
PVOID pDbBase = NULL;
INFO_VERSION Version = ivUnknown;
_tprintf(_T("Dumping recycle bin of \"%lS\":\n"),
RecycleBin->User);
_tprintf(_T("Directory: %lS\n\n"),
RecycleBin->Path);
_stprintf(szFile,
_T("%s\\INFO2"),
RecycleBin->Path);
hDb = OpenAndMapInfoDatabase(szFile,
&pDbBase,
&FileSize);
if (hDb != INVALID_HANDLE_VALUE)
{
Version = DetectDatabaseVersion(pDbBase);
/* dump the INFO2 database */
switch (Version)
{
case ivINFO2:
{
DWORD nRecords;
PINFO2_HEADER Info2Header = (PINFO2_HEADER)pDbBase;
PINFO2_RECORD Info2 = (PINFO2_RECORD)(Info2Header + 1);
int i = 0;
nRecords = (FileSize.QuadPart - sizeof(INFO2_HEADER)) / Info2Header->RecordSize;
while (nRecords != 0)
{
/* if the first character of the AnsiFileName is zero, the record
is considered deleted */
if (Info2->AnsiFileName[0] != '\0')
{
_tprintf(_T(" [%d] Record: #%d \"%lS\"\n"),
++i,
Info2->RecordNumber,
Info2->FileName);
DiskFileNameFromRecord(szFile,
Info2->RecordNumber,
(WCHAR)Info2->DriveLetter + L'a',
Info2->FileName);
_tprintf(_T(" Name on disk: \"%s\"\n"),
szFile);
_tprintf(_T(" Deleted size on disk: %d KB\n"),
Info2->DeletedPhysicalSize / 1024);
}
nRecords--;
Info2++;
}
break;
}
default:
break;
}
UnmapAndCloseDatabase(hDb,
pDbBase);
}
return FALSE;
}
static BOOL
SelectRecycleBin(IN LPWSTR szDrive)
{
BOOL Ret;
PRECYCLE_BIN RecycleBinsList = NULL;
Ret = LocateRecycleBins(szDrive,
&RecycleBinsList);
if (Ret)
{
if (RecycleBinsList->Next != NULL)
{
PRECYCLE_BIN CurrentBin = RecycleBinsList;
int n = 0, i = 0;
/* if there are multiple recycle bins ask the user which one to dump */
_tprintf(_T("There are several recycle bins on this drive. Select one:\n"));
while (CurrentBin != NULL)
{
_tprintf(_T(" [%d] %lS\n"),
++i,
CurrentBin->User);
CurrentBin = CurrentBin->Next;
n++;
}
_tprintf(_T("Enter the number: "));
DisplayPrompt:
_tscanf(_T("%d"),
&i);
if (i > n || i < 1)
{
_tprintf(_T("Please enter a number between 1 and %d: "),
n);
goto DisplayPrompt;
}
/* walk to the selected recycle bin */
CurrentBin = RecycleBinsList;
while (CurrentBin != NULL && i != 1)
{
CurrentBin = CurrentBin->Next;
i--;
}
/* dump it */
Ret = DumpRecycleBin(CurrentBin);
}
else
{
/* dump the first (and only) recycle bin */
Ret = DumpRecycleBin(RecycleBinsList);
}
}
else
{
_ftprintf(stderr,
_T("No recycle bins on this volume!\n"));
}
FreeRecycleBinsList(&RecycleBinsList);
return Ret;
}
static VOID
PrintHelp(VOID)
{
_ftprintf(stderr,
_T("Usage: dumprecbin C:\n"));
}
int
main(int argc,
char *argv[])
{
if (argc != 2 ||
strlen(argv[1]) != 2 || argv[1][1] != ':' ||
toupper(argv[1][0]) < 'A' || toupper(argv[1][0]) > 'Z')
{
PrintHelp();
return 1;
}
else
{
WCHAR szDrive[3];
_stprintf(szDrive,
_T("%lC:"),
argv[1][0]);
if (!SelectRecycleBin(szDrive))
return 1;
else
return 0;
}
}

View File

@@ -1,13 +0,0 @@
<module name="dumprecbin" type="win32cui" installbase="bin" installname="dumprecbin.exe">
<include base="dumprecbin">.</include>
<define name="__USE_W32API" />
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="_WIN32_IE">0x0500</define>
<define name="_WIN32_WINNT">0x0600</define>
<define name="WINVER">0x0600</define>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>dumprecbin.c</file>
</module>

View File

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

View File

@@ -1,602 +0,0 @@
/*
* ReactOS Win32 Applications
* Copyright (C) 2005 ReactOS Team
*
* 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.
*/
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS arp utility
* FILE: apps/utils/net/arp/arp.c
* PURPOSE: view and manipulate the ARP cache
* PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
* REVISIONS:
* GM 27/06/05 Created
*
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include <winsock2.h>
#include <iphlpapi.h>
#define WIN32_LEAN_AND_MEAN
#define UNICODE
#define _UNICODE
/*
* Globals
*/
const char SEPERATOR = '-';
int _CRT_glob = 0; // stop * from listing dir files in arp -d *
/*
* function declerations
*/
DWORD DoFormatMessage(DWORD ErrorCode);
INT PrintEntries(PMIB_IPNETROW pIpAddRow);
INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr);
INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr);
INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr);
VOID Usage(VOID);
/*
* convert error code into meaningful message
*/
DWORD DoFormatMessage(DWORD ErrorCode)
{
LPVOID lpMsgBuf;
DWORD RetVal;
/* double brackets to silence the assignment warning message */
if ((RetVal = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
(LPTSTR) &lpMsgBuf,
0,
NULL ))) {
_tprintf(_T("%s"), (LPTSTR)lpMsgBuf);
LocalFree(lpMsgBuf);
/* return number of TCHAR's stored in output buffer
* excluding '\0' - as FormatMessage does*/
return RetVal;
}
else
return 0;
}
/*
*
* Takes an ARP entry and prints the IP address,
* the MAC address and the entry type to screen
*
*/
INT PrintEntries(PMIB_IPNETROW pIpAddRow)
{
IN_ADDR inaddr;
TCHAR cMacAddr[20];
/* print IP addresses */
inaddr.S_un.S_addr = pIpAddRow->dwAddr;
_tprintf(_T(" %-22s"), inet_ntoa(inaddr));
/* print MAC address */
_stprintf(cMacAddr, _T("%02x-%02x-%02x-%02x-%02x-%02x"),
pIpAddRow->bPhysAddr[0],
pIpAddRow->bPhysAddr[1],
pIpAddRow->bPhysAddr[2],
pIpAddRow->bPhysAddr[3],
pIpAddRow->bPhysAddr[4],
pIpAddRow->bPhysAddr[5]);
_tprintf(_T("%-22s"), cMacAddr);
/* print cache type */
switch (pIpAddRow->dwType)
{
case MIB_IPNET_TYPE_DYNAMIC : _tprintf(_T("dynamic\n"));
break;
case MIB_IPNET_TYPE_STATIC : _tprintf(_T("static\n"));
break;
case MIB_IPNET_TYPE_INVALID : _tprintf(_T("invalid\n"));
break;
case MIB_IPNET_TYPE_OTHER : _tprintf(_T("other\n"));
break;
}
return EXIT_SUCCESS;
}
/*
*
* Takes optional parameters of an internet address and interface address.
* Retrieve all entries in the ARP cache. If an internet address is
* specified, display the ARP entry relating to that address. If an
* interface address is specified, display all entries relating to
* that interface.
*
*/
/* FIXME: allow user to specify an interface address, via pszIfAddr */
INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
{
INT iRet;
UINT i, k;
PMIB_IPNETTABLE pIpNetTable;
PMIB_IPADDRTABLE pIpAddrTable;
ULONG ulSize = 0;
struct in_addr inaddr, inaddr2;
DWORD dwSize = 0;
PTCHAR pszIpAddr;
TCHAR szIntIpAddr[20];
/* Return required buffer size */
GetIpNetTable(NULL, &ulSize, 0);
/* allocate memory for ARP address table */
pIpNetTable = (PMIB_IPNETTABLE) malloc(ulSize * sizeof(BYTE));
ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
/* get Arp address table */
if (pIpNetTable != NULL)
GetIpNetTable(pIpNetTable, &ulSize, TRUE);
else
{
_tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
free(pIpNetTable);
exit(EXIT_FAILURE);
}
/* check there are entries in the table */
if (pIpNetTable->dwNumEntries == 0)
{
_tprintf(_T("No ARP entires found\n"));
free(pIpNetTable);
exit(EXIT_FAILURE);
}
/* try doing this in the way it's done above, it's clearer */
/* Retrieve the interface-to-ip address mapping
* table to get the IP address for adapter */
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
GetIpAddrTable(pIpAddrTable, &dwSize, 0); // NULL ?
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
//ZeroMemory(pIpAddrTable, sizeof(*pIpAddrTable));
if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR)
{
_tprintf(_T("GetIpAddrTable failed: %d\n"), iRet);
_tprintf(_T("error: %d\n"), WSAGetLastError());
}
for (k=0; k < pIpAddrTable->dwNumEntries; k++)
{
if (pIpNetTable->table[0].dwIndex == pIpAddrTable->table[k].dwIndex)
{
//printf("debug print: pIpAddrTable->table[?].dwIndex = %lx\n", pIpNetTable->table[k].dwIndex);
inaddr2.s_addr = pIpAddrTable->table[k].dwAddr;
pszIpAddr = inet_ntoa(inaddr2);
strcpy(szIntIpAddr, pszIpAddr);
}
}
/* print header, including interface IP address and index number */
_tprintf(_T("\nInterface: %s --- 0x%lx \n"), szIntIpAddr, pIpNetTable->table[0].dwIndex);
_tprintf(_T(" Internet Address Physical Address Type\n"));
/* go through all ARP entries */
for (i=0; i < pIpNetTable->dwNumEntries; i++)
{
/* if the user has supplied their own internet addesss *
* only print the arp entry which matches that */
if (pszInetAddr)
{
inaddr.S_un.S_addr = pIpNetTable->table[i].dwAddr;
pszIpAddr = inet_ntoa(inaddr);
/* check if it matches, print it */
if (strcmp(pszIpAddr, pszInetAddr) == 0)
PrintEntries(&pIpNetTable->table[i]);
}
else
/* if an address is not supplied, print all entries */
PrintEntries(&pIpNetTable->table[i]);
}
free(pIpNetTable);
free(pIpAddrTable);
return EXIT_SUCCESS;
}
/*
*
* Takes an internet address, a MAC address and an optional interface
* address as arguments and checks their validity.
* Fill out an MIB_IPNETROW structure and insert the data into the
* ARP cache as a static entry.
*
*/
INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
{
PMIB_IPNETROW pAddHost;
PMIB_IPADDRTABLE pIpAddrTable;
PMIB_IPNETTABLE pIpNetTable;
DWORD dwIpAddr = 0;
DWORD dwSize = 0;
ULONG ulSize = 0;
INT iRet, i, val;
TCHAR c;
/* error checking */
/* check IP address */
if (pszInetAddr != NULL)
{
if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE)
{
_tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr);
exit(EXIT_FAILURE);
}
}
else
{
Usage();
exit(EXIT_FAILURE);
}
/* check MAC address */
if (strlen(pszEthAddr) != 17)
{
_tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr);
exit(EXIT_FAILURE);
}
for (i=0; i<17; i++)
{
if (pszEthAddr[i] == SEPERATOR)
continue;
if (!isxdigit(pszEthAddr[i]))
{
_tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr);
exit(EXIT_FAILURE);
}
}
/* We need the IpNetTable to get the adapter index */
/* Return required buffer size */
GetIpNetTable(NULL, &ulSize, 0);
/* allocate memory for ARP address table */
pIpNetTable = (PMIB_IPNETTABLE) malloc(ulSize * sizeof(BYTE));
ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
/* get Arp address table */
if (pIpNetTable != NULL)
GetIpNetTable(pIpNetTable, &ulSize, TRUE);
else
{
_tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
free(pIpNetTable);
return -1;
}
/* reserve memory on heap and zero */
pAddHost = (MIB_IPNETROW *) malloc(sizeof(MIB_IPNETROW));
ZeroMemory(pAddHost, sizeof(MIB_IPNETROW));
/* set dwIndex field to the index of a local IP address to
* indicate the network on which the ARP entry applies */
if (pszIfAddr)
sscanf(pszIfAddr, "%lx", &pAddHost->dwIndex);
else
{
/* map the IP to the index */
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
GetIpAddrTable(pIpAddrTable, &dwSize, 0);
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR)
{
_tprintf(_T("GetIpAddrTable failed: %d\n"), iRet);
_tprintf(_T("error: %d\n"), WSAGetLastError());
}
//printf("debug print: pIpNetTable->table[0].dwIndex = %lx\n", pIpNetTable->table[0].dwIndex);
/* needs testing. I get the correct index on my machine, but need others
* to test their card index. Any problems and we can use GetAdaptersInfo instead */
pAddHost->dwIndex = pIpNetTable->table[0].dwIndex;
free(pIpAddrTable);
}
/* Set MAC address to 6 bytes (typical) */
pAddHost->dwPhysAddrLen = 6;
/* Encode bPhysAddr into correct byte array */
for (i=0; i<6; i++)
{
val =0;
c = toupper(pszEthAddr[i*3]);
c = c - (isdigit(c) ? '0' : ('A' - 10));
val += c;
val = (val << 4);
c = toupper(pszEthAddr[i*3 + 1]);
c = c - (isdigit(c) ? '0' : ('A' - 10));
val += c;
pAddHost->bPhysAddr[i] = val;
}
/* copy converted IP address */
pAddHost->dwAddr = dwIpAddr;
/* set type to static */
pAddHost->dwType = MIB_IPNET_TYPE_STATIC;
/* Add the ARP entry */
if ((iRet = SetIpNetEntry(pAddHost)) != NO_ERROR)
{
DoFormatMessage(iRet);
free(pAddHost);
exit(EXIT_FAILURE);
}
free(pAddHost);
return EXIT_SUCCESS;
}
/*
*
* Takes an internet address and an optional interface address as
* arguments and checks their validity.
* Add the interface number and IP to an MIB_IPNETROW structure
* and remove the entry from the ARP cache.
*
*/
INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
{
PMIB_IPNETROW pDelHost;
PMIB_IPADDRTABLE pIpAddrTable;
PMIB_IPNETTABLE pIpNetTable;
ULONG ulSize = 0;
DWORD dwIpAddr = 0;
DWORD dwSize = 0;
INT iRet;
BOOL bFlushTable = FALSE;
/* error checking */
/* check IP address */
if (pszInetAddr != NULL)
{
/* if wildcard is given, set flag to delete all hosts */
if (strncmp(pszInetAddr, "*", 1) == 0)
bFlushTable = TRUE;
else if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE)
{
_tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr);
exit(EXIT_FAILURE);
}
}
else
{
Usage();
exit(EXIT_FAILURE);
}
/* We need the IpNetTable to get the adapter index */
/* Return required buffer size */
GetIpNetTable(NULL, &ulSize, 0);
/* allocate memory for ARP address table */
pIpNetTable = (PMIB_IPNETTABLE) malloc(ulSize * sizeof(BYTE));
ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
/* get Arp address table */
if (pIpNetTable != NULL)
GetIpNetTable(pIpNetTable, &ulSize, TRUE);
else
{
_tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
free(pIpNetTable);
return -1;
}
pIpAddrTable = (MIB_IPADDRTABLE*) malloc(sizeof(MIB_IPADDRTABLE));
pDelHost = (MIB_IPNETROW *) malloc(sizeof(MIB_IPNETROW));
ZeroMemory(pIpAddrTable, sizeof(MIB_IPADDRTABLE));
ZeroMemory(pDelHost, sizeof(MIB_IPNETROW));
/* set dwIndex field to the index of a local IP address to
* indicate the network on which the ARP entry applies */
if (pszIfAddr)
sscanf(pszIfAddr, "%lx", &pDelHost->dwIndex);
else
{
/* map the IP to the index */
if (GetIpAddrTable(pIpAddrTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER)
pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR)
{
_tprintf(_T("GetIpAddrTable failed: %d\n"), iRet);
_tprintf(_T("error: %d\n"), WSAGetLastError());
}
/* needs testing. I get the correct index on my machine, but need others
* to test their card index. Any problems and we can use GetAdaptersInfo instead */
pDelHost->dwIndex = pIpNetTable->table[0].dwIndex;
}
if (bFlushTable == TRUE)
{
/* delete arp cache */
if ((iRet = FlushIpNetTable(pDelHost->dwIndex)) != NO_ERROR)
{
DoFormatMessage(iRet);
free(pIpAddrTable);
free(pDelHost);
return EXIT_FAILURE;
}
else
{
free(pIpAddrTable);
free(pDelHost);
return EXIT_SUCCESS;
}
}
else
/* copy converted IP address */
pDelHost->dwAddr = dwIpAddr;
/* Add the ARP entry */
if ((iRet = DeleteIpNetEntry(pDelHost)) != NO_ERROR)
{
DoFormatMessage(iRet);
free(pIpAddrTable);
free(pDelHost);
exit(EXIT_FAILURE);
}
free(pIpAddrTable);
free(pDelHost);
return EXIT_SUCCESS;
}
/*
*
* print program usage to screen
*
*/
VOID Usage(VOID)
{
_tprintf(_T("\nDisplays and modifies the IP-to-Physical address translation tables used by\n"
"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 current ARP entries by interrogating the current\n"
" protocol data. If inet_addr is specified, the IP and Physical\n"
" addresses for only the specified computer are displayed. If\n"
" more than one network interface uses ARP, entries for each ARP\n"
" table are displayed.\n"
" -g Same as -a.\n"
" inet_addr Specifies an internet address.\n"
" -N if_addr Displays the ARP entries for the network interface specified\n"
" by if_addr.\n"
" -d Deletes the host specified by inet_addr. inet_addr may be\n"
" wildcarded with * to delete all hosts.\n"
" -s Adds the host and associates the Internet address inet_addr\n"
" with the Physical address eth_addr. The Physical address is\n"
" given as 6 hexadecimal bytes separated by hyphens. The entry\n"
" is permanent.\n"
" eth_addr Specifies a physical address.\n"
" if_addr If present, this specifies the Internet address of the\n"
" interface whose address translation table should be modified.\n"
" If not present, the first applicable interface will be used.\n"
"Example:\n"
" > arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.\n"
" > arp -a .... Displays the arp table.\n\n"));
}
/*
*
* Program entry.
* Parse command line and call the required function
*
*/
INT main(int argc, char* argv[])
{
if ((argc < 2) || (argc > 5))
{
Usage();
return EXIT_FAILURE;
}
if (argv[1][0] == '-')
{
switch (argv[1][1])
{
case 'a': /* fall through */
case 'g':
if (argc == 2)
DisplayArpEntries(NULL, NULL);
else if (argc == 3)
DisplayArpEntries(argv[2], NULL);
else if ((argc == 4) && ((strcmp(argv[2], "-N")) == 0))
DisplayArpEntries(NULL, argv[3]);
else if ((argc == 5) && ((strcmp(argv[3], "-N")) == 0))
DisplayArpEntries(argv[2], argv[4]);
else
Usage();
return EXIT_FAILURE;
break;
case 'd': if (argc == 3)
Deletehost(argv[2], NULL);
else if (argc == 4)
Deletehost(argv[2], argv[3]);
else
Usage();
return EXIT_FAILURE;
break;
case 's': if (argc == 4)
Addhost(argv[2], argv[3], NULL);
else if (argc == 5)
Addhost(argv[2], argv[3], argv[4]);
else
Usage();
return EXIT_FAILURE;
break;
default:
Usage();
return EXIT_FAILURE;
}
}
else
Usage();
return EXIT_SUCCESS;
} /*
warning: suggest parentheses around assignment used as truth value
warning: char format, void arg (arg 2)*/

View File

@@ -1,5 +0,0 @@
#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"
#define REACTOS_STR_ORIGINAL_COPYRIGHT "Ged Murphy (gedmurphy@gmail.com)\0"
#include <reactos/version.rc>

View File

@@ -1,11 +0,0 @@
<module name="arp" type="win32cui" installbase="system32" installname="arp.exe">
<include base="arp">.</include>
<define name="__USE_W32API" />
<library>kernel32</library>
<library>iphlpapi</library>
<library>ws2_32</library>
<library>shlwapi</library>
<file>arp.c</file>
<file>arp.rc</file>
</module>

View File

@@ -1,30 +0,0 @@
<directory name="arp">
<xi:include href="arp/arp.xml" />
</directory>
<directory name="finger">
<xi:include href="finger/finger.xml" />
</directory>
<directory name="ftp">
<xi:include href="ftp/ftp.xml" />
</directory>
<directory name="ipconfig">
<xi:include href="ipconfig/ipconfig.xml" />
</directory>
<directory name="netstat">
<xi:include href="netstat/netstat.xml" />
</directory>
<directory name="ping">
<xi:include href="ping/ping.xml" />
</directory>
<directory name="route">
<xi:include href="route/route.xml" />
</directory>
<directory name="telnet">
<xi:include href="telnet/telnet.xml" />
</directory>
<directory name="tracert">
<xi:include href="tracert/tracert.xml" />
</directory>
<directory name="whois">
<xi:include href="whois/whois.xml" />
</directory>

View File

@@ -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 "

View File

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

View File

@@ -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_ */

View File

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

View File

@@ -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>

View File

@@ -1,12 +0,0 @@
<module name="finger" type="win32cui" installbase="system32" installname="finger.exe">
<include base="finger">.</include>
<define name="__USE_W32API" />
<define name="__USE_W32_SOCKETS" />
<library>kernel32</library>
<library>ws2_32</library>
<file>finger.c</file>
<file>err.c</file>
<file>getopt.c</file>
<file>net.c</file>
<file>finger.rc</file>
</module>

View File

@@ -1,122 +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>
#include "getopt.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 */
}

View File

@@ -1,7 +0,0 @@
/* getopt.h */
extern char *optarg;
extern int optind;
int
getopt(int nargc, char * const *nargv, const char *ostr);

View File

@@ -1,137 +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.
*/
#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;
SOCKET s;
char *alist[1], *host;
/* If this is a local request */
if (!(host = rindex(name, '@')))
return;
*host++ = '\0';
if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != (unsigned long)-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)) == INVALID_SOCKET) {
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');
}

View File

@@ -1,36 +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)
void netfinger(char *);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,171 +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.
*/
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, fsetmode },
{ "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;

View File

@@ -1,147 +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];
struct cmd *getcmd(), *c;
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;
}
}

View File

@@ -1,341 +0,0 @@
#include <stdio.h>
#include <time.h>
#include <winsock.h>
#include "fake.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 char buffer[4096];
if (index == total)
{
index = 0;
total = recv(s, buffer, sizeof(buffer), 0);
if (total == SOCKET_ERROR)
{
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;
DWORD 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;
}
#if 0
// Stubbed out here. Should be changed in Source code...
int access(const char *filename, int accessmethod)
{
return 0;
}
#endif
#ifndef __GNUC__
#define EPOCHFILETIME (116444736000000000i64)
#else
#define EPOCHFILETIME (116444736000000000LL)
#endif
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;
}

View File

@@ -1,17 +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
struct timezone {
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
int gettimeofday(struct timeval *tv, struct timezone *tz);

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -1,16 +0,0 @@
<module name="ftp" type="win32cui" installbase="system32" installname="ftp.exe" allowwarnings="true">
<include base="ftp">.</include>
<define name="__USE_W32API" />
<define name="lint" />
<library>kernel32</library>
<library>ws2_32</library>
<library>iphlpapi</library>
<file>cmds.c</file>
<file>cmdtab.c</file>
<file>domacro.c</file>
<file>fake.c</file>
<file>ftp.c</file>
<file>main.c</file>
<file>ruserpass.c</file>
<file>ftp.rc</file>
</module>

View File

@@ -1,168 +0,0 @@
#include <winsock.h>
#include "fake.h"
#include "prototypes.h"
#include <setjmp.h>
//typedef void (*Sig_t)(int);
/* 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 */
void (*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];
#if defined(__ANSI__) || defined(sparc)
typedef void sig_t;
#else
typedef int sig_t;
#endif
typedef int uid_t;

View File

@@ -1,598 +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 */
static char *slurpstring();
int main(int argc, char *argv[])
{
register char *cp;
int top;
#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;
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;
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
*/
static 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.
*/
void 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;
}
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);
}

View File

@@ -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"

View File

@@ -1,66 +0,0 @@
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);
char *hookup();
char **glob();
int herror(char *s);
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);
int sleep(int time);
char *tail();
int errno;
char *mktemp();
void setbell(), setdebug();
void setglob(), sethash(), setport();
void setprompt();
void settrace(), setverbose();
void settype(), setform(), setstruct();
void restart(), syst();
void cd(), lcd(), delete(), mdelete();
void ls(), mls(), get(), mget(), help(), append(), put(), mput(), reget();
void status();
void renamefile();
void quote(), rmthelp(), site();
void pwd(), makedir(), removedir(), setcr();
void account(), doproxy(), reset(), setcase(), setntrans(), setnmap();
void setsunique(), setrunique(), cdup(), macdef();
void sizecmd(), modtime(), newer(), rmtstatus();
void do_chmod(), do_umask(), idle();
void shell(), user(), fsetmode();
struct cmd *getcmd();

View File

@@ -1,273 +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;
static int token(void);
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);
}

View File

@@ -1,483 +0,0 @@
/* $Id: ipconfig.c
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Ipconfig utility
* FILE: apps/utils/net/ipconfig/ipconfig.c
* PURPOSE: Show and set network interface IP parameters
*/
/*
* History:
*
* 15/8/2002 (Robert Dickenson <robd@reactos.org>)
* Original version (PUBLIC DOMAIN and NO WARRANTY)
*
* 26/6/2005 (Tim Jobling <tjob800@yahoo.co.uk>)
* Relicense to GPL.
* Display NodeType with meaningfull Human readable names.
* Exclusively use TCHAR strings.
* Display Physical Address, DHCP enabled state, IP Addresses/Netmasks,
* Default Gateway, DHCP server and DHCP Lease times.
* Parse command line options.
* Default to only showing the IP/SM/DG is no options specified
* Handel option: /All and /?
* Display message about all unimplemented options.
* Changed C++ style commenting to C style
*
*/
#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(UINT nNodeType)
{
switch (nNodeType) {
case 1: return _T("Broadcast");
case 2: return _T("Peer To Peer");
case 4: return _T("Mixed");
case 8: return _T("Hybrid");
default: return _T("unknown");
}
}
static TCHAR* GetInterfaceTypeName(UINT nInterfaceType)
{
switch (nInterfaceType) {
case MIB_IF_TYPE_OTHER: return _T("Other");
case MIB_IF_TYPE_ETHERNET: return _T("Ethernet");
case MIB_IF_TYPE_TOKENRING: return _T("Token Ring");
case MIB_IF_TYPE_FDDI: return _T("FDDI");
case MIB_IF_TYPE_PPP: return _T("PPP");
case MIB_IF_TYPE_LOOPBACK: return _T("Loopback");
case MIB_IF_TYPE_SLIP: return _T("SLIP");
default: return _T("unknown");
}
}
static void PrintPhysicalAddr(PBYTE Addr, UINT len)
{
UINT i=0;
for (i=0; i<len; i++)
{
_tprintf(_T("%02X"), Addr[i]);
if ((i+1)<len)
_tprintf(_T("-"));
}
_tprintf(_T("\n"));
}
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%08lX 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;
_tprintf(_T("\tHostName. . . . . . . . . . . : %s\n"), pFixedInfo->HostName);
_tprintf(_T("\tDomainName. . . . . . . . . . : %s\n"), pFixedInfo->DomainName);
_tprintf(_T("\tDNS Servers . . . . . . . . . : %s\n"), pFixedInfo->DnsServerList.IpAddress.String);
pIPAddr = pFixedInfo->DnsServerList.Next;
while (pIPAddr) {
_tprintf(_T("\t\t\t\t : %s\n"), pIPAddr->IpAddress.String);
pIPAddr = pIPAddr->Next;
}
_tprintf(_T("\tNodeType. . . . . . . . . . . : %d (%s)\n"), pFixedInfo->NodeType, GetNodeTypeName(pFixedInfo->NodeType));
_tprintf(_T("\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%08lX - 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%08lX - Use FormatMessage to obtain the message string for the returned error\n"), result);
return;
} else {
_tprintf(_T("GetNumberOfInterfaces() returned %lu\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%08lX 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 %ld 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);*/
/*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: %lu\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%08lX - 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(BOOL ShowAll)
{
IP_ADAPTER_INFO* pAdaptorInfo;
ULONG ulOutBufLen;
DWORD dwRetVal;
PIP_ADDR_STRING pIpAddrString;
struct tm *LeaseTime;
if (ShowAll)
{
_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: 0x%08lx\n"), dwRetVal);
} else {
while (pAdaptorInfo) {
/* print the type of interface before the Name of it */
_tprintf(_T("\n%s Adapter %s:\n\n"), GetInterfaceTypeName(pAdaptorInfo->Type), pAdaptorInfo->AdapterName);
if (ShowAll)
{
_tprintf(_T("\tDescription. . . . . . : %s\n"), pAdaptorInfo->Description);
/* print the Physical address to the screen*/
_tprintf(_T("\tPhysical Address . . . : "));
PrintPhysicalAddr(pAdaptorInfo->Address, pAdaptorInfo->AddressLength);
/* Now the DHCP state */
_tprintf(_T("\tDHCP Enabled . . . . . : %s\n"), pAdaptorInfo->DhcpEnabled ? _T("Yes") : _T("No"));
}
/* IP Addresses/Netmasks, there may be more than one */
pIpAddrString = &pAdaptorInfo->IpAddressList;
do{
_tprintf(_T("\tIP Address . . . . . . : %s\n"), pIpAddrString->IpAddress.String);
_tprintf(_T("\tSubnet Mask. . . . . . : %s\n"), pIpAddrString->IpMask.String);
pIpAddrString = pIpAddrString->Next;
}while (pIpAddrString!=NULL);
/* Default Gateway */
pIpAddrString = &pAdaptorInfo->GatewayList;
_tprintf(_T("\tDefault Gateway. . . . : %s\n"), pIpAddrString->IpAddress.String);
/* Print some stuff that is only relevant it dhcp is enabled */
if((pAdaptorInfo->DhcpEnabled)&&(ShowAll))
{
/* Display the DHCP server address */
pIpAddrString = &pAdaptorInfo->DhcpServer;
_tprintf(_T("\tDHCP Server. . . . . . : %s\n"), pIpAddrString->IpAddress.String);
/* Display the Lease times*/
LeaseTime = localtime(&pAdaptorInfo->LeaseObtained);
_tprintf(_T("\tLease Obtained . . . . : %s"), asctime(LeaseTime));
LeaseTime = localtime(&pAdaptorInfo->LeaseExpires);
_tprintf(_T("\tLease Expieres . . . . : %s"), asctime(LeaseTime));
}
pAdaptorInfo = pAdaptorInfo->Next;
}
}
}
const TCHAR szUsage[] = { _T("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)
{
_fputts(szUsage, stderr);
}
int _tmain(int argc, TCHAR *argv[])
{
BOOL DoUsage=FALSE;
BOOL DoAll=FALSE;
BOOL DoRelease=FALSE;
BOOL DoRenew=FALSE;
BOOL DoFlushdns=FALSE;
BOOL DoRegisterdns=FALSE;
BOOL DoDisplaydns=FALSE;
BOOL DoShowclassid=FALSE;
BOOL DoSetclassid=FALSE;
_tprintf(_T("\nReactOS IP Configuration\n\n"));
/*
Parse command line for options we have been given.
*/
if ( ((argc > 1))&&((argv[1][0]=='/')||(argv[1][0]=='-')) )
{
if( !_tcsicmp( &argv[1][1], _T("?") ))
{
DoUsage = TRUE;
}
else if( !_tcsnicmp( &argv[1][1], _T("ALL"), _tcslen(&argv[1][1]) ))
{
DoAll = TRUE;
}
else if( !_tcsnicmp( &argv[1][1], _T("RELEASE"), _tcslen(&argv[1][1]) ))
{
DoRelease = TRUE;
}
else if( ! _tcsnicmp( &argv[1][1], _T("RENEW"), _tcslen(&argv[1][1]) ))
{
DoRenew = TRUE;
}
else if( ! _tcsnicmp( &argv[1][1], _T("FLUSHDNS"), _tcslen(&argv[1][1]) ))
{
DoFlushdns = TRUE;
}
else if( ! _tcsnicmp( &argv[1][1], _T("REGISTERDNS"), _tcslen(&argv[1][1]) ))
{
DoRegisterdns = TRUE;
}
else if( ! _tcsnicmp( &argv[1][1], _T("DISPLAYDNS"), _tcslen(&argv[1][1]) ))
{
DoDisplaydns = TRUE;
}
else if( ! _tcsnicmp( &argv[1][1], _T("SHOWCLASSID"), _tcslen(&argv[1][1]) ))
{
DoShowclassid = TRUE;
}
else if( ! _tcsnicmp( &argv[1][1], _T("SETCLASSID"), _tcslen(&argv[1][1]) ))
{
DoSetclassid = TRUE;
}
}
switch (argc)
{
case 1: /* Default behaviour if options are given specified*/
ShowAdapterInfo(FALSE);
break;
case 2: /* Process all the options that take no paramiters */
if ( DoUsage)
usage();
else if ( DoAll)
{
ShowNetworkFixedInfo();
ShowNetworkInterfaces();
ShowAdapterInfo(TRUE);
}
else if ( DoRelease)
printf("\nSorry /Release is not implemented yet\n");
else if ( DoRenew)
printf("\nSorry /Renew is not implemented yet\n");
else if ( DoFlushdns)
printf("\nSorry /Flushdns is not implemented yet\n");
else if ( DoRegisterdns)
printf("\nSorry /Registerdns is not implemented yet\n");
else if ( DoDisplaydns)
printf("\nSorry /Displaydns is not implemented yet\n");
else
usage();
break;
case 3: /* Process all the options that can have 1 paramiters */
if ( DoRelease)
printf("\nSorry /Release is not implemented yet\n");
else if ( DoRenew)
printf("\nSorry /Renew is not implemented yet\n");
else if ( DoShowclassid)
printf("\nSorry /Showclassid is not implemented yet\n");
else
usage();
break;
case 4: /* Process all the options that can have 2 paramiters */
if ( DoSetclassid)
printf("\nSorry /Setclassid is not implemented yet\n");
else
usage();
break;
default:
usage();
}
return 0;
}

View File

@@ -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>

View File

@@ -1,10 +0,0 @@
<module name="ipconfig" type="win32cui" installbase="system32" installname="ipconfig.exe" allowwarnings="true">
<include base="ipconfig">.</include>
<define name="__USE_W32API" />
<library>kernel32</library>
<library>user32</library>
<library>iphlpapi</library>
<file>ipconfig.c</file>
<file>trace.c</file>
<file>ipconfig.rc</file>
</module>

View File

@@ -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
/////////////////////////////////////////////////////////////////////////////

View File

@@ -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__
/////////////////////////////////////////////////////////////////////////////

View File

@@ -1,645 +0,0 @@
/*
* ReactOS Win32 Applications
* Copyright (C) 2005 ReactOS Team
*
* 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.
*/
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS netstat utility
* FILE: apps/utils/net/netstat/netstat.c
* PURPOSE: display IP stack statistics
* PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
* REVISIONS:
* Ged Murphy 19/09/05 Created
* Some ideas/code taken from Rob Dickinson's original app
*
*/
/*
* TODO:
* sort function return values.
* implement -b, -o and -v
* clean up GetIpHostName
* command line parser needs more work
*/
#include <windows.h>
#include <winsock.h>
#include <tchar.h>
#include <stdio.h>
#include <iphlpapi.h>
#include "netstat.h"
enum ProtoType {IP, TCP, UDP, ICMP} Protocol;
DWORD Interval; /* time to pause between printing output */
/* TCP endpoint states */
TCHAR TcpState[][32] = {
_T("???"),
_T("CLOSED"),
_T("LISTENING"),
_T("SYN_SENT"),
_T("SYN_RCVD"),
_T("ESTABLISHED"),
_T("FIN_WAIT1"),
_T("FIN_WAIT2"),
_T("CLOSE_WAIT"),
_T("CLOSING"),
_T("LAST_ACK"),
_T("TIME_WAIT"),
_T("DELETE_TCB")
};
/*
* format message string and display output
*/
DWORD DoFormatMessage(DWORD ErrorCode)
{
LPVOID lpMsgBuf;
DWORD RetVal;
if ((RetVal = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
(LPTSTR) &lpMsgBuf,
0,
NULL )))
{
_tprintf(_T("%s"), (LPTSTR)lpMsgBuf);
LocalFree(lpMsgBuf);
/* return number of TCHAR's stored in output buffer
* excluding '\0' - as FormatMessage does*/
return RetVal;
}
else
return 0;
}
/*
*
* Parse command line parameters and set any options
*
*/
BOOL ParseCmdline(int argc, char* argv[])
{
INT i;
TCHAR Proto[5];
if ((argc == 1) || (isdigit(*argv[1])))
bNoOptions = TRUE;
/* Parse command line for options we have been given. */
for (i = 1; i < argc; i++)
{
if ( (argc > 1)&&(argv[i][0] == '-') )
{
TCHAR c;
while ((c = *++argv[i]) != '\0')
{
switch (tolower(c))
{
case 'a' :
//_tprintf(_T("got a\n"));
bDoShowAllCons = TRUE;
break;
case 'e' :
//_tprintf(_T("got e\n"));
bDoShowEthStats = TRUE;
break;
case 'n' :
//_tprintf(_T("got n\n"));
bDoShowNumbers = TRUE;
break;
case 's' :
//_tprintf(_T("got s\n"));
bDoShowProtoStats = TRUE;
break;
case 'p' :
//_tprintf(_T("got p\n"));
bDoShowProtoCons = TRUE;
strncpy(Proto, (++argv)[i], sizeof(Proto));
if (!_tcsicmp( "IP", Proto ))
Protocol = IP;
else if (!_tcsicmp( "ICMP", Proto ))
Protocol = ICMP;
else if (!_tcsicmp( "TCP", Proto ))
Protocol = TCP;
else if (!_tcsicmp( "UDP", Proto ))
Protocol = UDP;
else
{
Usage();
return EXIT_FAILURE;
}
(--argv)[i]; /* move pointer back down to previous argv */
break;
case 'r' :
bDoShowRouteTable = TRUE;
break;
case 'v' :
_tprintf(_T("got v\n"));
bDoDispSeqComp = TRUE;
break;
default :
Usage();
return EXIT_FAILURE;
}
}
}
else if (isdigit(*argv[i]))
{
_stscanf(argv[i], "%lu", &Interval);
bLoopOutput = TRUE;
}
// else
// {
// Usage();
// EXIT_FAILURE;
// }
}
return EXIT_SUCCESS;
}
/*
* Simulate Microsofts netstat utility output
*/
BOOL DisplayOutput()
{
if (bNoOptions)
{
_tprintf(_T("\n Proto Local Address Foreign Address State\n"));
ShowTcpTable();
return EXIT_SUCCESS;
}
if (bDoShowRouteTable)
{
if (system("route print") == -1)
{
//mingw doesn't have lib for _tsystem
_tprintf(_T("cannot find 'route.exe'\n"));
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
if (bDoShowEthStats)
{
ShowEthernetStatistics();
return EXIT_SUCCESS;
}
if (bDoShowProtoCons)
{
switch (Protocol)
{
case IP :
if (bDoShowProtoStats)
{
ShowIpStatistics();
return EXIT_SUCCESS;
}
break;
case ICMP :
if (bDoShowProtoStats)
{
ShowIcmpStatistics();
return EXIT_SUCCESS;
}
break;
case TCP :
if (bDoShowProtoStats)
ShowTcpStatistics();
_tprintf(_T("\nActive Connections\n"));
_tprintf(_T("\n Proto Local Address Foreign Address State\n"));
ShowTcpTable();
break;
case UDP :
if (bDoShowProtoStats)
ShowUdpStatistics();
_tprintf(_T("\nActive Connections\n"));
_tprintf(_T("\n Proto Local Address Foreign Address State\n"));
ShowUdpTable();
break;
default :
break;
}
}
else if (bDoShowProtoStats)
{
ShowIpStatistics();
ShowIcmpStatistics();
ShowTcpStatistics();
ShowUdpStatistics();
return EXIT_SUCCESS;
}
else //if (bDoShowAllCons)
{
_tprintf(_T("\nActive Connections\n"));
_tprintf(_T("\n Proto Local Address Foreign Address State\n"));
ShowTcpTable();
ShowUdpTable();
}
return EXIT_SUCCESS;
}
VOID ShowIpStatistics()
{
PMIB_IPSTATS pIpStats;
DWORD dwRetVal;
pIpStats = (MIB_IPSTATS*) malloc(sizeof(MIB_IPSTATS));
if ((dwRetVal = GetIpStatistics(pIpStats)) == NO_ERROR)
{
_tprintf(_T("\nIPv4 Statistics\n\n"));
_tprintf(_T(" %-34s = %lu\n"), _T("Packets Recieved"), pIpStats->dwInReceives);
_tprintf(_T(" %-34s = %lu\n"), _T("Received Header Errors"), pIpStats->dwInHdrErrors);
_tprintf(_T(" %-34s = %lu\n"), _T("Received Address Errors"), pIpStats->dwInAddrErrors);
_tprintf(_T(" %-34s = %lu\n"), _T("Datagrams Forwarded"), pIpStats->dwForwDatagrams);
_tprintf(_T(" %-34s = %lu\n"), _T("Unknown Protocols Recieved"), pIpStats->dwInUnknownProtos);
_tprintf(_T(" %-34s = %lu\n"), _T("Received Packets Discarded"), pIpStats->dwInDiscards);
_tprintf(_T(" %-34s = %lu\n"), _T("Recieved Packets Delivered"), pIpStats->dwInDelivers);
_tprintf(_T(" %-34s = %lu\n"), _T("Output Requests"), pIpStats->dwOutRequests);
_tprintf(_T(" %-34s = %lu\n"), _T("Routing Discards"), pIpStats->dwRoutingDiscards);
_tprintf(_T(" %-34s = %lu\n"), _T("Discarded Output Packets"), pIpStats->dwOutDiscards);
_tprintf(_T(" %-34s = %lu\n"), _T("Output Packets No Route"), pIpStats->dwOutNoRoutes);
_tprintf(_T(" %-34s = %lu\n"), _T("Reassembly Required"), pIpStats->dwReasmReqds);
_tprintf(_T(" %-34s = %lu\n"), _T("Reassembly Succesful"), pIpStats->dwReasmOks);
_tprintf(_T(" %-34s = %lu\n"), _T("Reassembly Failures"), pIpStats->dwReasmFails);
// _tprintf(_T(" %-34s = %lu\n"), _T("Datagrams succesfully fragmented"), NULL); /* FIXME: what is this one? */
_tprintf(_T(" %-34s = %lu\n"), _T("Datagrams Failing Fragmentation"), pIpStats->dwFragFails);
_tprintf(_T(" %-34s = %lu\n"), _T("Fragments Created"), pIpStats->dwFragCreates);
}
else
DoFormatMessage(dwRetVal);
}
VOID ShowIcmpStatistics()
{
PMIB_ICMP pIcmpStats;
DWORD dwRetVal;
pIcmpStats = (MIB_ICMP*) malloc(sizeof(MIB_ICMP));
if ((dwRetVal = GetIcmpStatistics(pIcmpStats)) == NO_ERROR)
{
_tprintf(_T("\nICMPv4 Statistics\n\n"));
_tprintf(_T(" Received Sent\n"));
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Messages"),
pIcmpStats->stats.icmpInStats.dwMsgs, pIcmpStats->stats.icmpOutStats.dwMsgs);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Errors"),
pIcmpStats->stats.icmpInStats.dwErrors, pIcmpStats->stats.icmpOutStats.dwErrors);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Destination Unreachable"),
pIcmpStats->stats.icmpInStats.dwDestUnreachs, pIcmpStats->stats.icmpOutStats.dwDestUnreachs);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Time Exceeded"),
pIcmpStats->stats.icmpInStats.dwTimeExcds, pIcmpStats->stats.icmpOutStats.dwTimeExcds);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Parameter Problems"),
pIcmpStats->stats.icmpInStats.dwParmProbs, pIcmpStats->stats.icmpOutStats.dwParmProbs);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Source Quenches"),
pIcmpStats->stats.icmpInStats.dwSrcQuenchs, pIcmpStats->stats.icmpOutStats.dwSrcQuenchs);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Redirects"),
pIcmpStats->stats.icmpInStats.dwRedirects, pIcmpStats->stats.icmpOutStats.dwRedirects);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Echos"),
pIcmpStats->stats.icmpInStats.dwEchos, pIcmpStats->stats.icmpOutStats.dwEchos);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Echo Replies"),
pIcmpStats->stats.icmpInStats.dwEchoReps, pIcmpStats->stats.icmpOutStats.dwEchoReps);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Timestamps"),
pIcmpStats->stats.icmpInStats.dwTimestamps, pIcmpStats->stats.icmpOutStats.dwTimestamps);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Timestamp Replies"),
pIcmpStats->stats.icmpInStats.dwTimestampReps, pIcmpStats->stats.icmpOutStats.dwTimestampReps);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Address Masks"),
pIcmpStats->stats.icmpInStats.dwAddrMasks, pIcmpStats->stats.icmpOutStats.dwAddrMasks);
_tprintf(_T(" %-25s %-11lu %lu\n"), _T("Address Mask Replies"),
pIcmpStats->stats.icmpInStats.dwAddrMaskReps, pIcmpStats->stats.icmpOutStats.dwAddrMaskReps);
}
else
DoFormatMessage(dwRetVal);
}
VOID ShowTcpStatistics()
{
PMIB_TCPSTATS pTcpStats;
DWORD dwRetVal;
pTcpStats = (MIB_TCPSTATS*) malloc(sizeof(MIB_TCPSTATS));
if ((dwRetVal = GetTcpStatistics(pTcpStats)) == NO_ERROR)
{
_tprintf(_T("\nTCP Statistics for IPv4\n\n"));
_tprintf(_T(" %-35s = %lu\n"), _T("Active Opens"), pTcpStats->dwActiveOpens);
_tprintf(_T(" %-35s = %lu\n"), _T("Passive Opens"), pTcpStats->dwPassiveOpens);
_tprintf(_T(" %-35s = %lu\n"), _T("Failed Connection Attempts"), pTcpStats->dwAttemptFails);
_tprintf(_T(" %-35s = %lu\n"), _T("Reset Connections"), pTcpStats->dwEstabResets);
_tprintf(_T(" %-35s = %lu\n"), _T("Current Connections"), pTcpStats->dwCurrEstab);
_tprintf(_T(" %-35s = %lu\n"), _T("Segments Recieved"), pTcpStats->dwInSegs);
_tprintf(_T(" %-35s = %lu\n"), _T("Segments Sent"), pTcpStats->dwOutSegs);
_tprintf(_T(" %-35s = %lu\n"), _T("Segments Retransmitted"), pTcpStats->dwRetransSegs);
}
else
DoFormatMessage(dwRetVal);
}
VOID ShowUdpStatistics()
{
PMIB_UDPSTATS pUdpStats;
DWORD dwRetVal;
pUdpStats = (MIB_UDPSTATS*) malloc(sizeof(MIB_UDPSTATS));
if ((dwRetVal = GetUdpStatistics(pUdpStats)) == NO_ERROR)
{
_tprintf(_T("\nUDP Statistics for IPv4\n\n"));
_tprintf(_T(" %-21s = %lu\n"), _T("Datagrams Recieved"), pUdpStats->dwInDatagrams);
_tprintf(_T(" %-21s = %lu\n"), _T("No Ports"), pUdpStats->dwNoPorts);
_tprintf(_T(" %-21s = %lu\n"), _T("Recieve Errors"), pUdpStats->dwInErrors);
_tprintf(_T(" %-21s = %lu\n"), _T("Datagrams Sent"), pUdpStats->dwOutDatagrams);
}
else
DoFormatMessage(dwRetVal);
}
VOID ShowEthernetStatistics()
{
PMIB_IFTABLE pIfTable;
DWORD dwSize = 0;
DWORD dwRetVal = 0;
pIfTable = (MIB_IFTABLE*) malloc(sizeof(MIB_IFTABLE));
if (GetIfTable(pIfTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER)
{
GlobalFree(pIfTable);
pIfTable = (MIB_IFTABLE*) malloc(dwSize);
if ((dwRetVal = GetIfTable(pIfTable, &dwSize, 0)) == NO_ERROR)
{
_tprintf(_T("Interface Statistics\n\n"));
_tprintf(_T(" Received Sent\n\n"));
_tprintf(_T("%-20s %14lu %15lu\n"), _T("Bytes"),
pIfTable->table[0].dwInOctets, pIfTable->table[0].dwOutOctets);
_tprintf(_T("%-20s %14lu %15lu\n"), _T("Unicast packets"),
pIfTable->table[0].dwInUcastPkts, pIfTable->table[0].dwOutUcastPkts);
_tprintf(_T("%-20s %14lu %15lu\n"), _T("Non-unicast packets"),
pIfTable->table[0].dwInNUcastPkts, pIfTable->table[0].dwOutNUcastPkts);
_tprintf(_T("%-20s %14lu %15lu\n"), _T("Discards"),
pIfTable->table[0].dwInDiscards, pIfTable->table[0].dwOutDiscards);
_tprintf(_T("%-20s %14lu %15lu\n"), _T("Errors"),
pIfTable->table[0].dwInErrors, pIfTable->table[0].dwOutErrors);
_tprintf(_T("%-20s %14lu\n"), _T("Unknown Protocols"),
pIfTable->table[0].dwInUnknownProtos);
}
else
DoFormatMessage(dwRetVal);
}
}
VOID ShowTcpTable()
{
PMIB_TCPTABLE tcpTable;
DWORD error, dwSize;
DWORD i;
CHAR HostIp[HOSTNAMELEN], HostPort[PORTNAMELEN];
CHAR RemoteIp[HOSTNAMELEN], RemotePort[PORTNAMELEN];
CHAR Host[ADDRESSLEN];
CHAR Remote[ADDRESSLEN];
/* 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");
DoFormatMessage(error);
exit(EXIT_FAILURE);
}
tcpTable = (PMIB_TCPTABLE)malloc(dwSize);
error = GetTcpTable(tcpTable, &dwSize, TRUE );
if (error)
{
printf("Failed to snapshot TCP endpoints table.\n");
DoFormatMessage(error);
exit(EXIT_FAILURE);
}
/* Dump the TCP table */
for (i = 0; i < tcpTable->dwNumEntries; i++)
{
/* If we aren't showing all connections, only display established, close wait
* and time wait. This is the default output for netstat */
if (bDoShowAllCons || (tcpTable->table[i].dwState == MIB_TCP_STATE_ESTAB)
|| (tcpTable->table[i].dwState == MIB_TCP_STATE_CLOSE_WAIT)
|| (tcpTable->table[i].dwState == MIB_TCP_STATE_TIME_WAIT))
{
/* I've split this up so it's easier to follow */
GetIpHostName(TRUE, tcpTable->table[i].dwLocalAddr, HostIp, HOSTNAMELEN);
GetPortName(tcpTable->table[i].dwLocalPort, "tcp", HostPort, PORTNAMELEN);
GetIpHostName(FALSE, tcpTable->table[i].dwRemoteAddr, RemoteIp, HOSTNAMELEN);
GetPortName(tcpTable->table[i].dwRemotePort, "tcp", RemotePort, PORTNAMELEN);
sprintf(Host, "%s:%s", HostIp, HostPort);
sprintf(Remote, "%s:%s", RemoteIp, RemotePort);
_tprintf(_T(" %-6s %-22s %-22s %s\n"), _T("TCP"),
Host, Remote, TcpState[tcpTable->table[i].dwState]);
}
}
}
VOID ShowUdpTable()
{
PMIB_UDPTABLE udpTable;
DWORD error, dwSize;
DWORD i;
CHAR HostIp[HOSTNAMELEN], HostPort[PORTNAMELEN];
CHAR Host[ADDRESSLEN];
/* 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");
DoFormatMessage(error);
exit(EXIT_FAILURE);
}
udpTable = (PMIB_UDPTABLE)malloc(dwSize);
error = GetUdpTable(udpTable, &dwSize, TRUE);
if (error)
{
printf("Failed to snapshot UDP endpoints table.\n");
DoFormatMessage(error);
exit(EXIT_FAILURE);
}
/* Dump the UDP table */
for (i = 0; i < udpTable->dwNumEntries; i++)
{
/* I've split this up so it's easier to follow */
GetIpHostName(TRUE, udpTable->table[i].dwLocalAddr, HostIp, HOSTNAMELEN);
GetPortName(udpTable->table[i].dwLocalPort, "tcp", HostPort, PORTNAMELEN);
sprintf(Host, "%s:%s", HostIp, HostPort);
_tprintf(_T(" %-6s %-22s %-22s\n"), _T("UDP"), Host, _T(":*:"));
}
}
/*
* Translate port numbers into their text equivalent if there is one
*/
PCHAR
GetPortName(UINT Port, PCHAR Proto, CHAR Name[], INT NameLen)
{
struct servent *pSrvent;
if (bDoShowNumbers)
{
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(BOOL Local, UINT IpAddr, CHAR Name[], int NameLen)
{
// struct hostent *phostent;
UINT nIpAddr;
// Does the user want raw numbers?
nIpAddr = htonl(IpAddr);
if (bDoShowNumbers) {
sprintf(Name, "%d.%d.%d.%d",
(nIpAddr >> 24) & 0xFF,
(nIpAddr >> 16) & 0xFF,
(nIpAddr >> 8) & 0xFF,
(nIpAddr) & 0xFF);
return Name;
}
Name[0] = L'\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 {
sprintf(Name, "%d.%d.%d.%d",
((nIpAddr >> 24) & 0x000000FF),
((nIpAddr >> 16) & 0x000000FF),
((nIpAddr >> 8) & 0x000000FF),
((nIpAddr) & 0x000000FF));
}
return Name;
}
VOID Usage()
{
_tprintf(_T("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"
" option\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. By default, Statistics are\n"
" shown for IP, ICMP, TCP and UDP;\n"
" the -p option may be used to specify a subset of the default.\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"));
}
/*
*
* Parse command line parameters and set any options
* Run display output, looping over set intervals if a number is given
*
*/
int main(int argc, char *argv[])
{
if (ParseCmdline(argc, argv))
return -1;
if (bLoopOutput)
{
while (1)
{
if (DisplayOutput())
return -1;
Sleep(Interval*1000);
}
}
if (DisplayOutput())
return -1;
else
return 0;
}

View File

@@ -1,60 +0,0 @@
/* Maximum string lengths for ASCII ip address and port names */
#define HOSTNAMELEN 256
#define PORTNAMELEN 256
#define ADDRESSLEN HOSTNAMELEN+PORTNAMELEN
/* command line options */
BOOL bNoOptions = FALSE; // print default
BOOL bDoShowAllCons = FALSE; // -a
BOOL bDoShowEthStats = FALSE; // -e
BOOL bDoShowNumbers = FALSE; // -n
BOOL bDoShowProtoCons = FALSE; // -p
BOOL bDoShowRouteTable = FALSE; // -r
BOOL bDoShowProtoStats = FALSE; // -s
BOOL bDoDispSeqComp = FALSE; // -v
BOOL bLoopOutput = FALSE; // interval
/* 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;
} 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;
} MIB_UDPEXTABLE, *PMIB_UDPEXTABLE;
/* function declerations */
BOOL ParseCmdline(int argc, char* argv[]);
BOOL DisplayOutput(VOID);
DWORD DoFormatMessage(DWORD ErrorCode);
VOID ShowIpStatistics(VOID);
VOID ShowIcmpStatistics(VOID);
VOID ShowTcpStatistics(VOID);
VOID ShowUdpStatistics(VOID);
VOID ShowEthernetStatistics(VOID);
VOID ShowTcpTable(VOID);
VOID ShowUdpTable(VOID);
PCHAR GetPortName(UINT Port, PCHAR Proto, CHAR Name[PORTNAMELEN], INT NameLen);
PCHAR GetIpHostName(BOOL local, UINT ipaddr, CHAR name[HOSTNAMELEN], int namelen);
VOID Usage(VOID);

View File

@@ -1,7 +0,0 @@
#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"
#define REACTOS_STR_ORIGINAL_COPYRIGHT "Ged Murphy (gedmurphy@gmail.com)\0"
#include <reactos/version.rc>

View File

@@ -1,13 +0,0 @@
<module name="netstat" type="win32cui" installbase="system32" installname="netstat.exe" allowwarnings="true">
<include base="netstat">.</include>
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<library>kernel32</library>
<library>user32</library>
<library>ws2_32</library>
<library>snmpapi</library>
<library>iphlpapi</library>
<file>netstat.c</file>
<file>netstat.rc</file>
</module>

View File

@@ -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;
#ifdef DBG
/* Display the contents of a buffer */
static VOID DisplayBuffer(
PVOID Buffer,
DWORD Size)
{
UINT i;
PCHAR p;
printf("Buffer (0x%p) Size (0x%lX).\n", Buffer, Size);
p = (PCHAR)Buffer;
for (i = 0; i < Size; i++) {
if (i % 16 == 0) {
printf("\n");
}
printf("%02X ", (p[i]) & 0xFF);
}
}
#endif /* DBG */
/* Display usage information on screen */
static 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 */
static 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 */
static 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 */
static 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 */
static 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 */
static 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 */
static 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 */
static VOID Cleanup(VOID)
{
if (IcmpSock != INVALID_SOCKET)
closesocket(IcmpSock);
WSACleanup();
}
static 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;
}
}
static VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
{
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 */
static 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 */
static BOOL Ping(VOID)
{
INT Status;
SOCKADDR From;
INT 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 */

View File

@@ -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>

View File

@@ -1,11 +0,0 @@
<module name="ping" type="win32cui" installbase="system32" installname="ping.exe">
<include base="ping">.</include>
<define name="__USE_W32API" />
<define name="__USE_W32_SOCKETS" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<library>kernel32</library>
<library>ws2_32</library>
<file>ping.c</file>
<file>ping.rc</file>
</module>

View File

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

View File

@@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,308 +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>
#include <tchar.h>
#define IPBUF 17
#define IN_ADDR_OF(x) *((struct in_addr *)&(x))
static int Usage()
{
_ftprintf( stderr,
_T("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;
}
static int PrintRoutes()
{
PMIB_IPFORWARDTABLE IpForwardTable = NULL;
PIP_ADAPTER_INFO pAdapterInfo;
ULONG Size = 0;
DWORD Error = 0;
ULONG adaptOutBufLen = sizeof(IP_ADAPTER_INFO);
TCHAR DefGate[16];
TCHAR Destination[IPBUF], Gateway[IPBUF], Netmask[IPBUF];
unsigned int i;
/* set required buffer size */
pAdapterInfo = (IP_ADAPTER_INFO *) malloc( adaptOutBufLen );
if (pAdapterInfo == NULL)
{
Error = ERROR_NOT_ENOUGH_MEMORY;
goto Error;
}
if (GetAdaptersInfo( pAdapterInfo, &adaptOutBufLen) == ERROR_BUFFER_OVERFLOW)
{
free (pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc (adaptOutBufLen);
if (pAdapterInfo == NULL)
{
Error = ERROR_NOT_ENOUGH_MEMORY;
goto Error;
}
}
if( (GetIpForwardTable( NULL, &Size, TRUE )) == ERROR_INSUFFICIENT_BUFFER )
{
if (!(IpForwardTable = malloc( Size )))
{
free(pAdapterInfo);
Error = ERROR_NOT_ENOUGH_MEMORY;
goto Error;
}
}
if (((Error = GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen)) == NO_ERROR) &&
((Error = GetIpForwardTable(IpForwardTable, &Size, TRUE)) == NO_ERROR))
{
_stprintf(DefGate,
#if UNICODE
_T("%hs"),
#else
_T("%s"),
#endif
pAdapterInfo->GatewayList.IpAddress.String);
_tprintf(_T("===========================================================================\n"));
_tprintf(_T("Interface List\n"));
/* FIXME - sort by the index! */
while (pAdapterInfo)
{
_tprintf(_T("0x%lu ........................... "
#if UNICODE
"%hs\n"),
#else
"%s\n"),
#endif
pAdapterInfo->Index, pAdapterInfo->Description);
pAdapterInfo = pAdapterInfo->Next;
}
_tprintf(_T("===========================================================================\n"));
_tprintf(_T("===========================================================================\n"));
_tprintf(_T("Active Routes:\n"));
_tprintf( _T("%-27s%-17s%-14s%-11s%-10s\n"),
_T("Network Destination"),
_T("Netmask"),
_T("Gateway"),
_T("Interface"),
_T("Metric") );
for( i = 0; i < IpForwardTable->dwNumEntries; i++ )
{
_stprintf( Destination,
#if UNICODE
_T("%hs"),
#else
_T("%s"),
#endif
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].dwForwardDest) ) );
_stprintf( Netmask,
#if UNICODE
_T("%hs"),
#else
_T("%s"),
#endif
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].dwForwardMask) ) );
_stprintf( Gateway,
#if UNICODE
_T("%hs"),
#else
_T("%s"),
#endif
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].dwForwardNextHop) ) );
_tprintf( _T("%17s%17s%17s%16ld%9ld\n"),
Destination,
Netmask,
Gateway,
IpForwardTable->table[i].dwForwardIfIndex,
IpForwardTable->table[i].dwForwardMetric1 );
}
_tprintf(_T("Default Gateway:%18s\n"), DefGate);
_tprintf(_T("===========================================================================\n"));
_tprintf(_T("Persistent Routes:\n"));
free(IpForwardTable);
free(pAdapterInfo);
return ERROR_SUCCESS;
}
else
{
Error:
_ftprintf( stderr, _T("Route enumerate failed\n") );
return Error;
}
}
static int convert_add_cmd_line( PMIB_IPFORWARDROW RowToAdd,
int argc, TCHAR **argv ) {
int i;
#if UNICODE
char addr[16];
#endif
if( argc > 1 )
{
#if UNICODE
sprintf( addr, "%ls", argv[0] );
RowToAdd->dwForwardDest = inet_addr( addr );
#else
RowToAdd->dwForwardDest = inet_addr( argv[0] );
#endif
}
else
return FALSE;
for( i = 1; i < argc; i++ )
{
if( !_tcscmp( argv[i], _T("mask") ) )
{
i++; if( i >= argc ) return FALSE;
#if UNICODE
sprintf( addr, "%ls", argv[i] );
RowToAdd->dwForwardDest = inet_addr( addr );
#else
RowToAdd->dwForwardMask = inet_addr( argv[i] );
#endif
}
else if( !_tcscmp( argv[i], _T("metric") ) )
{
i++;
if( i >= argc )
return FALSE;
RowToAdd->dwForwardMetric1 = _ttoi( argv[i] );
}
else
{
#if UNICODE
sprintf( addr, "%ls", argv[i] );
RowToAdd->dwForwardNextHop = inet_addr( addr );
#else
RowToAdd->dwForwardNextHop = inet_addr( argv[i] );
#endif
}
}
return TRUE;
}
static int add_route( int argc, TCHAR **argv ) {
MIB_IPFORWARDROW RowToAdd = { 0 };
DWORD Error;
if( argc < 2 || !convert_add_cmd_line( &RowToAdd, argc, argv ) )
{
_ftprintf( stderr,
_T("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;
_ftprintf( stderr, _T("Route addition failed\n") );
return Error;
}
static int del_route( int argc, TCHAR **argv )
{
MIB_IPFORWARDROW RowToDel = { 0 };
DWORD Error;
if( argc < 2 || !convert_add_cmd_line( &RowToDel, argc, argv ) )
{
_ftprintf( stderr,
_T("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;
_ftprintf( stderr, _T("Route addition failed\n") );
return Error;
}
#if defined(_UNICODE) && defined(__GNUC__)
static
#endif
int _tmain( int argc, TCHAR **argv )
{
if( argc < 2 )
return Usage();
else if ( !_tcscmp( argv[1], _T("print") ) )
return PrintRoutes();
else if( !_tcscmp( argv[1], _T("add") ) )
return add_route( argc-2, argv+2 );
else if( !_tcscmp( argv[1], _T("delete") ) )
return del_route( argc-2, argv+2 );
else
return Usage();
}
#if defined(_UNICODE) && defined(__GNUC__)
/* HACK - MINGW HAS NO OFFICIAL SUPPORT FOR wmain()!!! */
int main( int argc, char **argv )
{
WCHAR **argvW;
int i, j, Ret = 1;
if ((argvW = malloc(argc * sizeof(WCHAR*))))
{
/* convert the arguments */
for (i = 0, j = 0; i < argc; i++)
{
if (!(argvW[i] = malloc((strlen(argv[i]) + 1) * sizeof(WCHAR))))
{
j++;
}
swprintf(argvW[i], L"%hs", argv[i]);
}
if (j == 0)
{
/* no error converting the parameters, call wmain() */
Ret = wmain(argc, argvW);
}
/* free the arguments */
for (i = 0; i < argc; i++)
{
if (argvW[i])
free(argvW[i]);
}
free(argvW);
}
return Ret;
}
#endif

View File

@@ -1,7 +0,0 @@
/* $Id$ */
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 Route\0"
#define REACTOS_STR_INTERNAL_NAME "route\0"
#define REACTOS_STR_ORIGINAL_FILENAME "route.exe\0"
#define REACTOS_STR_ORIGINAL_COPYRIGHT "Art Yerkes (arty@users.sourceforge.net)\0"
#include <reactos/version.rc>

View File

@@ -1,11 +0,0 @@
<module name="route" type="win32cui" installbase="system32" installname="route.exe">
<include base="route">.</include>
<define name="__USE_W32API" />
<define name="UNICODE" />
<define name="_UNICODE" />
<library>kernel32</library>
<library>ws2_32</library>
<library>iphlpapi</library>
<file>route.c</file>
<file>route.rc</file>
</module>

View File

@@ -1,142 +0,0 @@
#
# Makefile for Console Telnet
# Last modified 4/15/2000 by Paul Brannan
#
SRCDIR=./src
OBJDIR=src
RESDIR=resource
SRC=$(wildcard $(SRCDIR)/*.cpp)
RESOURCES=$(wildcard $(RESDIR)/*.rc)
OBJ1=$(SRC:.c=.o)
OBJ=$(OBJ1:.cpp=.o) $(RESOURCES:.rc=.o)
INCLUDES=-I$(RESDIR)
OUT=telnet.exe
# Modify these for your system if necessary
# Note: DJGPP+RDXNTDJ configuration is untested.
# --CYGWIN--
#CC=gcc
#CCC=g++
#LDFLAGS=-lwsock32 -lmsvcrt
#CFLAGS=-O2 -Wall -mwindows -mno-cygwin -D__CYGWIN__
#CCFLAGS=$(CFLAGS)
#RES=
#RC=windres
#RCFLAGS=-O coff
# --MINGW32(+EGCS)--
CC=gcc
CCC=g++
LDFLAGS=-lkernel32 -luser32 -lgdi32 -lshell32 -lwsock32
CFLAGS=-O2 -Wall
CCFLAGS=$(CFLAGS)
RES=
RC=windres
RCFLAGS=
# --DJGPP+RSXNTDJ--
#CC=gcc -Zwin32 -Zmt -Zcrtdll
#CCC=$(CC)
#LDFLAGS=
#CFLAGS= -g
#CCFLAGS=$(CFLAGS)
#RES=rsrc
#RC=grc
#RCFLAGS=-r
# You should not have to modify anything below this line
all: dep $(OUT)
.SUFFIXES: .c .cpp .rc
.c.o:
$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
.cpp.o:
$(CCC) $(INCLUDES) $(CCFLAGS) -c $< -o $@
.rc.o:
$(RC) -i $< $(RCFLAGS) -o $@
$(OUT): $(OBJ)
$(CCC) $(OBJ) $(LDFLAGS) $(LIBS) -o $(OUT)
strip $(OUT)
depend: dep
dep:
start /min makedepend -- $(CFLAGS) -- $(INCLUDES) $(SRC)
clean:
del $(OBJDIR)\*.o
del $(OUT)
# DO NOT DELETE
./src/ansiprsr.o: ./src/ansiprsr.h ./src/tnconfig.h ./src/tnerror.h
./src/ansiprsr.o: ./src/tnmsg.h ./src/tparser.h ./src/tconsole.h
./src/ansiprsr.o: ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h
./src/ansiprsr.o: ./src/stl_bids.h ./src/tscroll.h ./src/tmouse.h
./src/ansiprsr.o: ./src/tnclip.h ./src/tnetwork.h ./src/tcharmap.h
./src/keytrans.o: ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h
./src/keytrans.o: ./src/stl_bids.h ./src/tnerror.h ./src/tnmsg.h
./src/tcharmap.o: ./src/tcharmap.h ./src/tnconfig.h ./src/tnerror.h
./src/tcharmap.o: ./src/tnmsg.h
./src/tconsole.o: ./src/tconsole.h ./src/tnconfig.h ./src/tnerror.h
./src/tconsole.o: ./src/tnmsg.h
./src/tkeydef.o: ./src/tkeydef.h
./src/tkeymap.o: ./src/tkeymap.h ./src/stl_bids.h ./src/tkeydef.h
./src/tmapldr.o: ./src/tmapldr.h ./src/keytrans.h ./src/tkeydef.h
./src/tmapldr.o: ./src/tkeymap.h ./src/stl_bids.h ./src/tcharmap.h
./src/tmapldr.o: ./src/tnerror.h ./src/tnmsg.h ./src/tnconfig.h
./src/tmouse.o: ./src/tmouse.h ./src/tnclip.h ./src/tnetwork.h
./src/tmouse.o: ./src/tconsole.h ./src/tnconfig.h ./src/tnerror.h
./src/tmouse.o: ./src/tnmsg.h
./src/tnclass.o: ./src/tnclass.h ./src/tnconfig.h ./src/tnerror.h
./src/tnclass.o: ./src/tnmsg.h ./src/ttelhndl.h ./src/tparser.h
./src/tnclass.o: ./src/tconsole.h ./src/keytrans.h ./src/tkeydef.h
./src/tnclass.o: ./src/tkeymap.h ./src/stl_bids.h ./src/tscroll.h
./src/tnclass.o: ./src/tmouse.h ./src/tnclip.h ./src/tnetwork.h
./src/tnclass.o: ./src/tcharmap.h ./src/tncon.h ./src/tparams.h
./src/tnclass.o: ./src/ansiprsr.h ./src/tmapldr.h ./src/tnmisc.h
./src/tnclip.o: ./src/tnclip.h ./src/tnetwork.h
./src/tncon.o: ./src/tncon.h ./src/tparams.h ./src/ttelhndl.h ./src/tparser.h
./src/tncon.o: ./src/tconsole.h ./src/tnconfig.h ./src/tnerror.h
./src/tncon.o: ./src/tnmsg.h ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h
./src/tncon.o: ./src/stl_bids.h ./src/tscroll.h ./src/tmouse.h ./src/tnclip.h
./src/tncon.o: ./src/tnetwork.h ./src/tcharmap.h
./src/tnconfig.o: ./src/tnconfig.h ./src/tnerror.h ./src/tnmsg.h
./src/tnerror.o: ./src/tnerror.h ./src/tnmsg.h ./src/ttelhndl.h
./src/tnerror.o: ./src/tparser.h ./src/tconsole.h ./src/tnconfig.h
./src/tnerror.o: ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h
./src/tnerror.o: ./src/stl_bids.h ./src/tscroll.h ./src/tmouse.h
./src/tnerror.o: ./src/tnclip.h ./src/tnetwork.h ./src/tcharmap.h
./src/tnetwork.o: ./src/tnetwork.h
./src/tnmain.o: ./src/tnmain.h ./src/tncon.h ./src/tparams.h ./src/ttelhndl.h
./src/tnmain.o: ./src/tparser.h ./src/tconsole.h ./src/tnconfig.h
./src/tnmain.o: ./src/tnerror.h ./src/tnmsg.h ./src/keytrans.h
./src/tnmain.o: ./src/tkeydef.h ./src/tkeymap.h ./src/stl_bids.h
./src/tnmain.o: ./src/tscroll.h ./src/tmouse.h ./src/tnclip.h
./src/tnmain.o: ./src/tnetwork.h ./src/tcharmap.h ./src/tnclass.h
./src/tnmain.o: ./src/ansiprsr.h ./src/tmapldr.h ./src/tnmisc.h
./src/tnmisc.o: ./src/tnmisc.h
./src/tscript.o: ./src/tscript.h ./src/tnetwork.h
./src/tscroll.o: ./src/tscroll.h ./src/tconsole.h ./src/tnconfig.h
./src/tscroll.o: ./src/tnerror.h ./src/tnmsg.h ./src/tmouse.h ./src/tnclip.h
./src/tscroll.o: ./src/tnetwork.h ./src/tncon.h ./src/tparams.h
./src/tscroll.o: ./src/ttelhndl.h ./src/tparser.h ./src/keytrans.h
./src/tscroll.o: ./src/tkeydef.h ./src/tkeymap.h ./src/stl_bids.h
./src/tscroll.o: ./src/tcharmap.h
./src/ttelhndl.o: ./src/ttelhndl.h ./src/tparser.h ./src/tconsole.h
./src/ttelhndl.o: ./src/tnconfig.h ./src/tnerror.h ./src/tnmsg.h
./src/ttelhndl.o: ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h
./src/ttelhndl.o: ./src/stl_bids.h ./src/tscroll.h ./src/tmouse.h
./src/ttelhndl.o: ./src/tnclip.h ./src/tnetwork.h ./src/tcharmap.h
./src/ttelhndl.o: ./src/telnet.h ./src/tparams.h

View File

@@ -1,261 +0,0 @@
Hi!
Now I come back to telnet source, and make some changes, wich you suggest
to me:
1. telnet.rc renamed to telnet.cfg
2. I change syntax of 'keys' command (but I did'nt found a tool for edit
msg*.bin files - so it's remain unchanged). Syntax are
keys load keymapname [file]
keys display
keys switch number
I fix some 'political' ;) problem with charmap, now we (citizens of xUSSR)
have koi8, koi8r and koi8u(RFC on draft) on UNIX, wich are diff's on 6 or
8 letters; cp866 and many (3 or 4) very near to cp866 on DOS.
So, I rewrite code to able a charmap addition like a keymap done.
And I make more smart command line processing, look at telCommandLine().
And last: my english is not so good :( to rewrite documentation, but there are
things, wich would be described - look on next page. I think that you will
translate my english to more understable, ok?
and now is a list of files, wich I touch
old new
ANSIPRSR.CPP 32763 05.10.97 11:09 33237 24.12.97 17:42
ANSIPRSR.H 3311 04.09.97 0:25 3410 23.12.97 13:18
KEYTRANS.CPP 9504 28.05.97 22:43 26547 03.02.98 21:33
KEYTRANS.H 8020 25.01.97 16:06 8090 03.02.98 19:53
TNCLASS.CPP 13663 17.08.97 23:55 13891 03.02.98 20:09
TNCLASS.H 1112 01.06.97 14:19 1233 03.02.98 20:09
TNMAIN.CPP 12668 02.10.97 20:38 16610 03.02.98 21:22
TNNET.CPP 3445 01.06.97 14:21 3474 23.12.97 13:16
TNPARSER.CPP 17653 05.10.97 11:09 17715 23.12.97 18:03
TNPARSER.H 2129 01.06.97 14:22 2188 23.12.97 13:25
KEYS.CFG erased
TELNET.CFG new
TELNET.IDE 65810 26.10.97 16:53 66118 03.02.98 21:34
I was start my work with file telc2b4s.zip with size 132619 bytes, and now send
to you just files, wich I touch.
with best regards
Andrei V. Smilianets
smile@head.aval.kiev.ua
22:25 03 Feb 1998
There are all of my changes (from 2.04b), wich have to be described:
1. command line (telnet>) processing
a 'keys' command
was
keys keymapname [file]
new
keys load keymapname [file] // mean unchanged
keys display // display a list of loaded keymaps
keys switch number // switch to keymap
more smart command processing
command might be writed shortly
cl[ose]
op[en]
ke[ys]
qu[it]
subcommands of 'keys'
l[oad]
d[isplay]
s[witch]
synonym of '?' -> h[elp]
2. file 'keys.cfg' renamed to 'telnet.cfg'
3. Added codepage conversion, look [charmap]
4. completely changed conception of telnet.cfg
Now you can define multiple keymaps, character maps, combine it in your
ways.
file is splitted into following sections:
[COMMENT]
...
[END COMMENT]
it is for comment a big part of text. can be nested.
in text also work:
; - first printable character in line, which is completelly
ignored.
// - like C++ comment
[GLOBAL]
...
[END GLOBAL]
mean of [global] unchanged
[KEYMAP name]
...
[END KEYMAP]
'name' - is a keymap name for reference. in 'name' you can use
any char exept spaces, '+', ':' and ']'. '+' and ':' reserved for
CONFIG section.
body is a sequence of key definition:
<vk_name> [keymodifier[+keymodifier[+...]]] <keytranslation>
example:
VK_F1 RIGHT_ALT+RIGHT_CTRL this_would_print
vk_name is an ASCII string equivalent to an entry in [GLOBAL].
valid keymodifiers are:
RIGHT_ALT
LEFT_ALT
RIGHT_CTRL
LEFT_CTRL
SHIFT
ENHANCED
Undefined enhanced keys will use the non-enhanced definition.
keytranslation is the string you want printed for the key.
The notation ^[ can be used to denote an escape character.
Any ASCII value can be represented by
\nnn where nnn is a 3 digit decimal ASCII value or
\xhh where hh is a 2 digit hexadecimal ASCII value.
Leading zeros may not be omitted.
A value of \000(\x00) will not be transmitted.
note: In order to have both left and right alt have the same
action, you must create a separate def for left and right.
[CHARMAP name]
...
[END CHARMAP]
'name' - is a charmap name for reference. requirements is the same
as for keymap name.
body is a sequence of char conversion definition:
<host_char> <console_char>
where host_char is a char received from host, and console_char
is a char, which would be displayed on console.
The main purpose of it is a conversion between differents code
pages, for example, on former USSR part of world most unix's hosts
uses 'koi8' code page, and on W95 machines - 866 code page and
(as say I.Ioannou) Greece has the same problem with 737 and 928
code-pages.
Any ASCII value can be represented by
\nnn where nnn is a 3 digit decimal ASCII value or
\xhh where hh is a 2 digit hexadecimal ASCII value.
Leading zeros may be omitted.
A value of \000(\x00) will not be accepted.
look for example at [charmap koi8-cp866].
[CONFIG name]
...
[END CONFIG]
'name' - is a configuration name for reference. requirements is
the same as for keymap name.
you must define one with name 'default', which will be used as
default.
in body of this part you can combine keymaps and set charmap,
format is:
KEYMAP name_list [: <vk_name> [keymodifier[+keymodifier[+...]]] ]
where
name_list:
keymap_name
keymap_name '+' name_list
keymap_name is a name of [KEYMAP]
You can specify multiple keymaps, for first (mean default)
you can not define ': <vk_name> ...' part, but for rests
(secondary) you must!
The ': <vk_name> ...' part define a key for switch to this
keymap.
Assigning a switching key to first (default) keymap will be
ignored, but you can switch to by pressing second time switch
key of current keymap.
If a key not found in switched keymap, a program will be look
for it in default keymap. So, you can redefine only needed keys
in secondary keymaps.
CHARMAP name_list
where
name_list:
charmap_name
charmap_name '+' name_list
charmap_name is a name of [CHARMAP]
define wich charmap(s) is to use.
examples:
[config default]
keymap default
[end config]
[config linux]
keymap default + linux
[end config]
[config default_koi8]
keymap default
keymap koi8u + koi8r : VK_/ RIGHT_ALT // russian keyboard
keymap koi8u : VK_. RIGHT_ALT // ukranian
charmap koi8-cp866
[end config]
[config linux_koi8]
keymap default + linux
keymap koi8u + koi8r : VK_/ RIGHT_ALT // russian keyboard
keymap koi8u : VK_. RIGHT_ALT // ukranian
charmap koi8-cp866 + koi8u-cp866
[end config]
so, for switch to russian keyboard just press RIGHT_ALT and '/'.
and, for switch back to default press it again.

View File

@@ -1,24 +0,0 @@
**********************************************
*** Console Telnet 2.1 beta 2. Known Bugs ***
**********************************************
Wrap_Line = 0 Doesn't work very well. It works with elvis or talk on linux,
but messes up bash at last line.
Enable_Mouse=1 Causes the display to slow in fullscreen mode, since the
mouse has to be erased and then drawn again for every
screen write.
Term_Width or Term_Height != -1 or Wide_Enable=1
Specifying any of these can cause display problems if
the font size is not set to auto.
Resizing the current window while running telnet can cause problems, especially
if doing so makes the buffer smaller. This should be more of a problem on
NT/W2K than on 95/98. Part of the problem is that the telnet NAWS option
negotiation isn't done properly. On a related note, turning on scrollbars can
decrease performance.
There are many other bugs, most of which are documented in the code. Just
grep the source for "FIX ME".

View File

@@ -1,239 +0,0 @@
**********************************************
*** Console Telnet version 2.1 Change log ***
**********************************************
Version 2.1b2 -- October 16, 2000
Redirection fix (Mark Miesfield)
Allow "o" to open a connecton on the command line
Fixed problem with special keys (ALt-[, Alt-], Alt-\, etc.)
Added MTE Support (Ziglio Frediano)
Speed improvements in ttelhndl.cpp -- may be buggy?
Wrap_line option is now modifiable via telnet command line
Lock_linewrap option added
Cleaned up console code
Fixed some color issues with nonstandard consoles
Tab setting/resetting
Fixed "telnet.exe" installer problem
Fixed miscellaneous parsing bugs
Fixed vt100-compliance
Added NAWS support, but it doesn't work (RFC 1073)
Added X Display Location support (RFC 1096)
Version 2.1b1 -- April 5, 2000
-Bugfixes
Console code writes to bottom of buffer (W2K scrollback buffer now works)
Updated Winsock error messages (Craig Nellist)
Sleeping while thread paused, to give up CPU time (Craig Nellist)
Ctrl_Break_as_C now works properly
Restore original screen colors; use initial screen colors as default
-New features
Cursor size sequences (Jose Cesar Otero Ridriguez)
Network piping
Line mode support added
Support for telnet:// URLs
Command-line history (Craig Nellist)
Connection Aliases
-Translator updates
New code structure
Unified character map class
More configurable "special" keys:
tn_escape, tn_scrollback, tn_dial, tn_paste, tn_null, tn_cr, tn_crlf
Transmission of NUL character possible
Czech keyboard definition (Jakub Sterba)
-New INI options
Window_Width, Window_Height
Scriptname (not functional), Script_Enable (not functional)
Netpipe (functional), Iopipe (not functional)
Version 2.0 -- July 5, 1999
-Bugfixes
Save/restore console title, character mapping fix (Pedro Gutierrez)
Telnet prompt fix, suspend telnet, string-based port (Craig Davidson)
Mutt/Lynx colors/underline fix, repeat character fix
Color display problem fixed (I.Ioannou)
Newline properly handled, added APP4_KEY, better key translation
Problem with icons not displaying properly fixed
Small bug with telnet crashing at exit (Sam Robertson, Daniel Straub)
Bug getting name of executable (Thomas Briggs)
-Updates
Better key translation
Spanish keyboard definition (Cesar Otero)
-New ini options
Set_Title (Adi Seiker)
Scroll_Enable/Scroll_Size
CtrlBreak_as_CtrlC (Bryan Montgomery)
Clear_on_Tabset removed
Version 2.0b7.1 -- Dec. 5, 1998
-Minor changes
Fixed problems with Scrollback and Clipboard
Minor updates to terminal emulation
Keyboard init improvements (Vassili Bourdo)
Repeat sequence support, German key config (Titus von Boxberg)
Version 2.0b7 -- Oct. 21, 1988
-To do still:
ZModem support
Update key translator/character maps
Finish scrollback
-Changes
Options added: Term_Width, Term_Height, Wide_Enable, Buffer_Size, Dial_key,
Keyboard_Paste, Status_bg, Status_fg, Input_Redir, Output_Redir
Application keypad mode support
Numlock/scroll lock support in KEYS.CFG
Del/. key now works properly
Ctrl-break bugfixes (Thomas Briggs)
Added suspend and fast quit to the command line (Thomas Briggs)
Error message for unable to load ini file (Thomas Briggs)
Fixed TELNET_INI environment variable (BK Oxley)
Support for changing screen size
Support for switching to 132-column mode via ANSI sequences
Fixed minor memory leaks
Mouse speedups/bugfixes, scrolling speedups/bugfixes
Miscellaneous ANSI parser fixes
Added support for changing the icon in the corner of the window
Fixed bug with mIRC
Fixed "try again" error message
Input and output redirection now separate (TELNET_REDIR still supported)
Modified "set" command to operate on groups
Character mapping now works again
Version 2.0b6 28 Jul 1998
-To Do still:
ZModem support
Finish mouse support
Fix character maps
-Changes:
ANSI Parser should be almost complete
Reorganized source
Display speedups
Preliminary mouse support
Enhanced scrollback support
Miscellaneous bug fixes
Version 2.0b5 05 Jun 1998
-Version 2b5 released from I.Ioannou <roryt@hol.gr>
-To Do Still:
Too many to mention :-)
-To Do, Maybe:
Mouse cut/paste support.
Support secure telnet options.
Real blinking attributes.
Zmodem & Kermit DL Protocols.
Any ideas acceptable :-)
May 1998
-Changes
Paul Brannan <pbranna@clemson.edu> add telnet.ini code
improve telnet's speed, add some VT emulation, port telnet to
MSVC, rewrote the command line options processing with GNU getopt,
fix many bugs, and more. Good work Paul :-)
I.Ioannou <roryt@hol.gr> . A few bugs fixes, and a icon.
Also I convert tnmsg files to use a resource compiler.
December 1997
-Changes
Andrey V. Smilianets (smile@head.aval.kiev.ua)
rewrote the keys translator to support many different
keymaps, charmaps and configurations.
Also add editing support to telnet> prompt.
Version 2.0b4 10/6/97
-Updated by Brad Johnson who can be contacted at
<jbj@nounname.com> http://nounname.com
-Changes
Added command line history at the telnet> prompt.
Added ability to "unmap" a key by setting it equal to \000 in the key.cfg.
Added log-file option '-dFILENAME'.
Added print screen/line commands by I.Ioannou <roryt@hol.gr>.
Added Support for running in an emacs buffer <mauch@unidui.uni-duisburg.de>.
Added better support for international character sets
<mauch@unidui.uni-duisburg.de>.
-To Do Still:
Support for local echo.
Scrollback buffer.
Fix Scrolling bug.
-To Do, Maybe:
Change the telnet options to initiate the negotiation.
Mouse cut/paste support.
Support secure telnet options.
Real blinking attributes.
Zmodem & Kermit DL Protocols.
Version 2.0b3 12/25/96:
-Updated by Brad Johnson who can be contacted at
<jbj@nounname.com> http://nounname.com
-Changes
Screen colors and buffer settings are now preserved on exit.
Fixed WindowSize height/width 255 exception :-).
Found out that the paste problem is a bug in Win 95 (not my problem)!
Fixed screen buffer problems under NT when the window
was smaller than the buffer.
Added custom key maps by I.Ioannou <roryt@hol.gr>.
-To Do Still:
Fix advance to next line error when writing past column
Extend NAWS window negotiation to include buffer size changes.
Change the telnet options to initiate the negotiation.
Add print screen/line commands.
-To Do, Maybe:
Support for running in an emacs buffer.
Mouse cut/paste support.
Support secure telnet options.
Real blinking attributes.
Zmodem & Kermit DL Protocols.
Version 2.0b2 09/29/96:
-Updated by Brad Johnson who can be contacted at
<jbj@nounname.com> http://nounname.com
-Changes
Added code to move cursor to end of screen and reset attributes on close
Fixed potential IAC parsing problem
Fixed ClearScreen Last line problem
Fixed parse problem that prevented line clears on unix history
Changed scroll code to scroll the entire buffer
Removed destructive backspace. May cause problems with terminals that want
destructive backspaces.
Added binary telnet option to use 8bit.
-To Do Next
Paste still doesn't work!
Version 2.0b1 09/22/96:
-Updated by Brad Johnson who can be contacted at
<jbj@nounname.com> http://nounname.com
-Changes
Added Color ANSI support. It works!
Added option for user specified port addresses on the command line.
Added ANSI keyboard mapping support for cursor keys.
Added destructive Backspace.
Added escape key 'ALT-]'.
Added TermType and WindowSize telnet options.
Added/Fixed various other ANSI codes.
Now (I hope) all ANSI codes handled correctly!
Fixed cursor left/right/save/restore commands.
Fixed clear line and clear screen command.
Expanded and altered network buffer to prevent some lockups :-).
Added Unix style telnet prompt "telnet>" with options.
-To Do Next
Should parse for IAC separate from ANSI.
Version 1.0a:
- This release fixes a bug which caused it to hang when connecting to
UNIX boxes. The program simply ignored Telnet DO instead of replying
with WON'T as required by RFC 854.
Version 1.0:
- First release

View File

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

View File

@@ -1,187 +0,0 @@
This file describes all the environment variables and options that are
available in TELNET.INI. If you are having problems with a terminal setting,
this is the file you want to read first. If this file does not help you,
please send a bug report to Paul Brannan <pbranna@clemson.edu>.
Environment variables
---------------------
Before there was a telnet.ini file, all the options were controlled
through environment variables. These have been left in for compatibility
with previous versions, and for specifying locations of files. They
override any values in telnet.ini.
TELNET_CFG Specifies the location of the keys.cfg file
TELNET_REDIR Specifies whether file redirection needs to be supported
INPUT_REDIR Specicies only to redirect input
OUTPUT_REDIR Specifies only to redirect output
TELNET_INI Specifies the location of the telnet.ini file
Configuration options
---------------------
These are the options that you can specify in telnet.ini. This file is in
the same format as any normal Windows ini file. You can also change some
of these options using the SET command at the telnet> prompt.
[Terminal] section
Dumpfile
Specifies the filename of a file to dump output to. (Default = "")
Term
The name of the terminal type to send to the server. You
can use this if Telnet is sending "ANSI" but you have a
vt100 terminal. If you use this options, please read about
some of the other options below. (Default = ansi)
EightBit_Ansi
Some machines use the ASCII characters 128 to 155 for ANSI
sequences. These are usually the newer VAX systems. Turning
this option on may cause problems with certain foreign
(non-American) character sets. (Default = FALSE)
VT100_Mode
This option turns on VT100 mode. There are a few minor
differences between ANSI terminals and DEC VT100 terminals.
I recommend trying TERM=vt220 or TERM=vt102 before trying
this option, but if you must have true VT100 emulation,
this is the only way to get it. (Default = FALSE)
Destructive_Backspace
This will probably cause problems with most programs, but if you need the
backspace to erase the previous character (as with some BBSes), use this
option. (Default = FALSE)
Speaker_Beep
If you set this to true you will hear beeps through the PC speaker; setting
it to false will play the default system beep sound through your sound
card. (Default = TRUE)
Beep
Setting this to false turns off all beeps; setting this to true turns on
all beeps. (Default = TRUE)
Preserve_Colors
This turns on color preservation for systems that require it (like SCO).
(Default = FALSE)
Wrap_line
This turns on/off line wrap. (Default = TRUE)
Lock_linewrap
Turning on this option disables the ability of the remote end to control
line wrap, and "locks" it into whatever it is set to in the ini file.
(Default = FALSE)
Fast_write
This turns on/off fast screen write. Turning it off allows you to see
control characters if your application requires it. (Default = TRUE)
Term_width
Term_height
These options specify the size of the terminal. You can specify non-standard
sizes if you are running telnet in a window. You may want to specify
a font size if you use these (using "Auto" can cause display problems).
Specifying -1 means use the settings for the parent console.
(Default = -1, -1)
Wide_enable
This is to allow the ANSI parser to change the screen size when sent certain
escape sequences. This is for vt100 compatibility. (Default = FALSE)
Buffer_size
This is the size of the ANSI buffer used for parsing sequences. Increasing
this value speeds up the parser, and decreasing it allows the mouse to
respond faster. (Default = 2048)
Input_redir
Output_redir
These are for redirecting input and output. (Default = 0, 0)
Any value greater than 0 turns redir on. Turn Output_redir on to bypass
the Console Telnet screen writing and positioning functions and simply
pass the data stream as received from the host straight through.
Strip_redir
If enabled, this option will attempt to strip the stream before passing it on
through redirected output. This will have no effect on non-redirected output.
(Default=FALSE)
[Colors] section
Setting the following to -1 disables them:
Blink_bg Background color to use for blink (default = -1)
Blink_fg Foreground color to use for blink (default = -1)
Underline_bg Background color to use for underline (default = -1)
Underline_fg Foreground color to use for underline (default = -1)
UlBlink_bg Background color to use for blink+uline (default = -1)
UlBlink_fg Foreground color to use for blink+uline (default = -1)
Setting the following to -1 uses colors detected at startup:
Normal_bg Normal text background color (default = -1)
Normal_fg Normal text foreground color (default = -1)
Please do not set these values to -1:
Scroll_bg Background color for scrollback mode (default = 0)
Scroll_fg Foreground color for scrollback mode (default = 7)
Status_bg Bg color of status line in scrollback (default = 1)
Status_fg Fg color of status line in scrollback (default = 15)
Here's a list of colors:
0 - black, 1 - blue, 2 - green, 3 - cyan, 4 - red, 5 - magenta, 6 - brown
7 - lt. grey (dk. white), 8 - dk. grey, 9 - bright blue, 10 - bright green,
11 - bright cyan, 12 - bright red, 13 - bright magenta, 14 - yellow
15 - bright white
[Mouse] section
Enable_Mouse
Turns on mouse support. (Default = TRUE)
[Printer] section
Printer_Name
The DOS name for the printer. (Default = LPT1)
[Keyboard] section
Many of these options are also available from telnet.cfg.
Escape_key
The key to break out of a telnet session. (Default = ])
Scrollback_key
The key for switching to scrollback mode. (Default = [)
Dial_key
You can start a new telnet session with this key. (Default = \)
Alt_erase
If you set this to true, it will swap backspace and delete.
(Default = FALSE)
Keyboard_paste
This option allows pasting to the screen via shift-insert. (Default = FALSE)
Keyfile
Selects an alternate telnet.cfg file. (Default = TELNET.CFG)
Default_Config
Selects a different keyboard definition. All of these are defined in
telnet.cfg.
[Scrollback] section
Scroll_Mode
Selects the default mode for scrollback. Valid selections are:
HEX Hex dump
DUMP Dump, control characters are shown as "."
DUMPB Binary dump
TEXT Text mode
Note: you can press TAB in scrollback mode to cycle through these.
(Default = DUMP)
Command-line Options
--------------------
-d<filename> Specifies the name of the dumpfile.
-h Gives a help screen.

View File

@@ -1,280 +0,0 @@
**************************************************
** Console Telnet v2.1b2 README.TXT 16 Oct 2000 **
**************************************************
RELEASE NOTES:
--------------
This release of TELNET is a beta one. This means that it is working as far
as it is tested, and has a few bugs. Hopefully this will be a stable
version. Please send comments and bug reports to me at
pbranna@clemson.edu, or to the mailing list (see below). See file
CHANGES.TXT for a detailed log of changes. See file BUGS.TXT for known
bugs.
DESCRIPTION:
------------
This is a telnet client with full color ANSI support for Windows NT/95
console. You can use this program from the Win95 command line (MsDos) and
run it in full screen text mode. You may also redirect the telnet session
to STDIN and STDOUT for use with other programs. Telnet will communicate
the number of lines and rows to the host, and can operate in any console
mode. Most of it's options are customizable.
COPYRIGHT/LICENSE/WARRANTY
--------------------------
Telnet Win32, Copyright (C) 1996-1997, Brad Johnson <jbj@nounname.com>
Copyright (C) 1998 I.Ioannou, Copyright (C) 1999-2000 Paul Brannan. Telnet
is a free project released under the GNU public license. This program comes
with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome
to redistribute it under the licence contitions. See LICENSE.TXT for
details.
REQUIREMENTS:
-------------
This program requires a Microsoft Win32 enviroment (Windows 95/98/NT) with
Winsock TCP/IP. 16 bit Win3.x or Win32s are not supported.
FEATURES:
---------
Full ANSI colors and (almost) complete ANSI emulation.
User configurable options via telnet.ini.
User configurable key bindings with alternative keyboards.
Icoming character translations.
Redirection of telnet session.
Telnet output can be dumped to a file.
Local printer support.
Basic scrollback support.
Basic VT emulation.
Mouse support.
Clipboard (cut-and-paste) support.
Support for multiple screen sizes.
WHERE TO GET IT:
----------------
Since version 2.0, Console Telnet's new home page is
http://www.musc.edu/~brannanp/telnet/. You can get the latest version from
ftp://argeas.cs-net.gr/Telnet-Win32 or from the web page. Telnet is
available as full project (sources included) or as binaries only. If you
would like to help to the development check the /devel directory on the ftp
site for a recent alpha version.
MAILING LIST:
-------------
Telnet has it's own mailing list for announcements, bug reports, support,
suggestions etc. To subscribe send e-mail to majordomo@argeas.cs-net.gr
with empty Subject, and the word subscribe in the body. List's address is
telnet-win32@argeas.cs-net.gr You can find the old archives at
http://www.cs-net.gr/lists
If you are only interested in announcements, follow the above procedures to
subscribe to telnet-win32-announce. The development list is
telnet-win32-devel.
HOW TO HELP:
------------
Telnet is a free project made from volunteers. If you know C/C++ and would
like to help in the development you are welcome :-) Just contact
pbranna@clemson.edu, and/or subscribe to the mailing list. Check
ftp://argeas.cs-net.gr/Telnet-Win32/devel for a recent alpha version.
INSTALLATION
------------
Just copy telnet.exe, telnet.ico, telnet.ini and keys.cfg to a directory.
I prefer a directory included in the PATH (such as C:\WINDOWS, but this will
overwrite the telnet that comes with Windows -- which is not necessarily a
bad thing). If you are upgrading from a previous version please look below
(Key file definitions) : the keys.cfg file has changed a bit. Also look at
the Configuration section below, TELNET now has a ini file.
USAGE:
-------
TELNET
Begins telnet and enters telnet> command line.
TELNET [params][host [port]]
Connects to port on host. Port defaults to 23 for TELNET.
params -d FILENAME.EXT Dumps all incoming data to FILENAME.EXT
Note lowercase 'd'.
--variable=value Overrides ini variable to be set to value.
host Host name or IP to connect to
port Service port to open connection on
(default is telnet port 23).
TELNET -?
Gives usage information.
Pressing the escape key (default ALT-]) will break out of a telnet session and
return you to the telnet> prompt. Pressing return will resume your session.
All the options are available from the telnet> prompt. Type ? to get help.
Pressing the scrollback key (default ALT-[) will give you a basic scrollback
view. Pressing ESC will resume your session.
BUGS:
-----
There are :-). Hopefully this version is more stable than the previous. See
BUGS.TXT, and grep for FIX ME's in the sources. Any help ?
NOTES:
------
If the environment variable LANG has a valid value (e.g. LANG=de for German
characters) and the file LOCALE.DLL is installed somewhere along the PATH
TELNET will not ignore local characters.
If you have problems with paste under Win 95 try unchecking the fast paste
option in the MsDos properties. The paste function works correctly under NT.
This is a Microsoft bug :-)
CONFIGURATION
-------------
The configuration is made through telnet.ini and keys.cfg. These files (at
least telnet.ini) must be in the same directory which telnet.exe is. The
basic options are loaded from the file telnet.ini. If you are having problems
with a terminal setting, check the file OPTIONS.TXT for configuration
information.
Key file definitions (telnet.cfg)
-------------------------------
Use the key file (telnet.cfg) to define the characters that telnet is sending
to the host. From version 2b5 you can configure the output keys (KEYMAP
sections), the input character translations (CHARMAP sections) and you can
combine all to as many configurations as you like (CONFIG sections). You
can also have alternative keymaps in a configuration, and keys to switch
between them. See the comments in keys.cfg for details.
NOTE: if you are upgrading from a previous version you must put your old keys
in the KEYMAP sections.
Please send any national specific keymaps / charmaps / configurations to be
included to the next version.
HOW TO COMPILE IT
-------------------
Telnet compiles with a variety of compilers. You will need at least
Borland 4.x or newer compiler, or MSVC 2.0 or newer, or download a version
of gcc for Win32 (see http://www.musc.edu/~brannanp/telnet/gccwin32.html).
Copy the files from the directories BORLAND or MSVC to the main directory,
change them to fit to your system, and recompile. The project comes with
IDE files and makefiles.
Follow the instructions for your compiler to compile telnet. A Makefile
for use with mingw32 or other gcc variants has been included, so if you have
gcc, you can just type "make" at the command line.
SPECIAL THANKS:
---------------
Many people have worked for this project. Please forgive me (and let me
know!) if I have forgotten anyone. We all thank them :-)
Igor Milavec <igor.milavec@uni-lj.si>
Original Author of version 1.1
Igor wrote the basic telnet program and released it to public.
Brad Johnson <jbj@nounname.com> http://nounname.com
Author of versions 2.0b to 2b4. Brad has wrote plenty of code for
telnet like ansi colors, emulation, scrollback option, and many
others.
Titus_Boxberg@public.uni-hamburg.de
Ansi emulation improvements
German keyboard configuration
I.Ioannou roryt@hol.gr
KeyTranslator class (version 2b3)
Maintainer (since version 2b5)
Andrei V. Smilianets <smile@head.aval.kiev.ua> (version 2b5)
KeyTranslator class (version 2b5)
Prompt improvments
Paul Brannan <pbranna@clemson.edu>
Telnet.ini author, MSVC port, speed improvements, VT support,
and many others.
Maintainer (since version 2b6)
Leo Leibovici <leo.leibovici@nouveau.co.uk>
Fixed some crashes in the ANSI parser
Wrote UK keymap
Dmitry Lapenkov <dl@bis.msk.su>
Wrote AT386 keymaps
Improved telnet icon
Thomas Briggs <tbriggs@qmetric.com>
Fixed problem with Ctrl-Break
Added suspend and fast quit options to the command line
Error messages for unable to load ini file
Fixed bug w/ getting name of executable
BK Oxley
Fixed TELNET_INI environment variable
Sam Robertson
Fixed compilation problems with MSVC6
Bugfix with telnet crashing at exit
Vassili Bourdo <vassili_bourdo@softhome.net>
Keyboard initialization improvements
Craig Davidson <crn@ozemail.com.au>
Bugfixes for telnet prompt
Added suspend telnet option
Set port number using name rather than number
Pedro Gutierrez <paag@coppi.tid.es>
Save/restore console title
Bugfix w/ character mapping
Daniel Straub <Daniel.Straub@nbgm.siemens.de>
Bugfix with telnet crashing at exit
Jose Cesar Otero Rodriguez <jcotero@las.es>
Spanish Keyboard definition
Cursor size sequences
Bryan Montgomery <monty@english.net>
Added CtrlBreak_as_CtrlC option
Added Scroll_Enable option
Adi Seiker
Added Set_Title ini file option
Craig Nellist
Updated Winsock error messages
Sleeping while thread paused, to give up CPU time
Command-line history
Jakub Sterba
Czech keyboard definition
Ziglio Frediano
MTE (Meridian Terminal) Support
Mark Miesfield
Fixed redirection
Wrote documentation for redirection
---
Paul Brannan <pbranna@clemson.edu>

View File

@@ -1,22 +0,0 @@
It should be possible to add ssh support to console telnet, as console telnet has a very modular design when it comes to the networking code. There is already support for pipes, and if there exists an ssh client for Win32 that will output to stdout, then you're in business. I'm yet to find such a client, but if one existed, an SSH session could be started like so:
C:\> telnet
Copyright message, license.txt, stuff, etc.
telnet> set io_netpipe "C:\BIN\SSH.EXE -l username host"
telnet> open blah
login:
password:
Unfortunately, all the ssh clients I've found don't work this way. You can output CMD.EXE to telnet this way, though, and get a very pretty ansi interpreter. If you want to try to get OpenSSH working, here's step-by-step instructions to get you started (please read them all the way though):
1) Get Perl from http://www.activestate.com/ActivePerl/download.htm
2) Get Openssl from http://www.openssl.org/source/
- Follow directions in INSTALL.W32
- Copy the .LIB files from OUT32DLL to your LIB directory (C:\DevStudio\VC\LIB)
- Copy the .DLL files from OUT32DLLto your system directory (C:\Winnt\System32 or C:\Windows\System)
- Copy the .H files from INC32\OPENSSL to your include\ssl (C:\DevStudio\VC\include\ssl)
- Copy these same files to include\openssl (C:\DevStudio\VC\include\openssl)
3) Get Openssh from http://www.openssh.com
4) Modify Openssh so it will compile, and get rid of all the termios stuff
Obviously this is a lot of work. If you need a good ssh client, try PuTTY from http://www.chiark.greenend.org.uk/~sgtatham/putty/. It may be possible to integrate PuTTY and Telnet, and that would certainly be easier than the above option. PuTTY is licensed under the MIT license, which seems to be compatible with the GPL. The primary advantage of integrating the two projects is that PuTTY would gain the key mappings that telnet has, and telnet would gain encryption.

View File

@@ -1,108 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Tnmsg.rc
//
#define MSG_COPYRIGHT 0x01
#define MSG_COPYRIGHT_1 0x02
#define MSG_USAGE 0x03
#define MSG_USAGE_1 0x04
#define MSG_HELP 0x05
#define MSG_HELP_1 0x06
#define MSG_INVCMD 0x07
#define MSG_ERROR 0x08
#define MSG_INFO 0x09
#define MSG_WARNING 0x0a
#define MSG_TRYING 0x0b
#define MSG_CONNECTED 0x0c
#define MSG_TERMBYREM 0x0d
#define MSG_KEYMAP 0x0e
#define MSG_ERRKEYMAP 0x0f
#define MSG_DUMPFILE 0x10
#define MSG_CONFIG 0x11
#define MSG_NOINI 0x12
#define MSG_BADVAL 0x13
#define MSG_NOSPAWN 0x14
#define MSG_RESOLVING 0x15
#define MSG_NOSERVICE 0x16
#define MSG_SIZEALIAS 0x17
#define MSG_ERRPIPE 0x18
#define MSG_BADUSAGE 0x19
#define MSG_ALREADYCONNECTED 0x1a
#define MSG_KEYNOVAL 1001
#define MSG_KEYBADVAL 1002
#define MSG_KEYBADSTRUCT 1003
#define MSG_KEYBADCHARS 1004
#define MSG_KEYUNEXPLINE 1005
#define MSG_KEYUNEXPEOF 1006
#define MSG_KEYUNEXPTOK 1007
#define MSG_KEYUNEXPTOKIN 1008
#define MSG_KEYUNEXP 1009
#define MSG_KEYNOGLOBAL 1010
#define MSG_KEYNOCONFIG 1011
#define MSG_KEYUSECONFIG 1012
#define MSG_KEYNOSWKEY 1013
#define MSG_KEYCANNOTDEF 1014
#define MSG_KEYDUPSWKEY 1015
#define MSG_KEYUNKNOWNMAP 1016
#define MSG_KEYNOCHARMAPS 1017
#define MSG_KEYNOKEYMAPS 1018
#define MSG_KEYNUMMAPS 1019
#define MSG_KEYBADMAP 1020
#define MSG_KEYMAPSWITCHED 1021
#define MSG_WSAEINTR 0x2714
#define MSG_WSAEBADF 0x2719
#define MSG_WSAEACCESS 0x271D
#define MSG_WSAEDEFAULT 0x271E
#define MSG_WSAEINVAL 0x2726
#define MSG_WSAEMFILE 0x2728
#define MSG_WSAEWOULDBLOCK 0x2733
#define MSG_WSAEINPROGRESS 0x2734
#define MSG_WSAEALREADY 0x2735
#define MSG_WSAENOTSOCK 0x2736
#define MSG_WSAEDESTADDRREQ 0x2737
#define MSG_WSAEMSGSIZE 0x2738
#define MSG_WSAEPROTOTYPE 0x2739
#define MSG_WSAENOPROTOOPT 0x273A
#define MSG_WSAEPROTONOTSUPPORT 0x273B
#define MSG_WSAESOCKNOTSUPPORT 0x273C
#define MSG_WSAEOPNOTSUPP 0x273D
#define MSG_WSAEPFNOTSUPPORT 0x273E
#define MSG_WSAEAFNOTSUPPORT 0x273F
#define MSG_WSAEADDRINUSE 0x2740
#define MSG_WSAEADDRNOTAVAIL 0x2741
#define MSG_WSAENETDOWN 0x2742
#define MSG_WSAENETUNREACH 0x2743
#define MSG_WSAENETRESET 0x2744
#define MSG_WSAECONNABORTED 0x2745
#define MSG_WSAECONNRESET 0x2746
#define MSG_WSAENOBUFS 0x2747
#define MSG_WSAEISCONN 0x2748
#define MSG_WSAENOTCONN 0x2749
#define MSG_WSAESHUTDOWN 0x274A
#define MSG_WSAETOOMANYREFS 0x274B
#define MSG_WSAETIMEDOUT 0x274C
#define MSG_WSAECONNREFUSED 0x274D
#define MSG_WSAELOOP 0x274E
#define MSG_WSAENAMETOOLONG 0x274F
#define MSG_WSAEHOSTDOWN 0x2750
#define MSG_WSAEHOSTUNREACH 0x2751
#define MSG_WSAESYSNOTREADY 0x276B
#define MSG_WSAVERNOTSUPPORTED 0x276C
#define MSG_WSANOTINITIALISED 0x276D
#define MSG_WSAHOST_NOT_FOUND 0x2AF9
#define MSG_WSATRY_AGAIN 0x2AFA
#define MSG_WSANO_RECOVERY 0x2AFB
#define MSG_WSANO_DATA 0x2AFC
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -1,107 +0,0 @@
#include "tnmsg.h"
LANGUAGE 0,0
// String Table
STRINGTABLE DISCARDABLE
BEGIN
MSG_COPYRIGHT "Telnet Win32 v2.1b2, Copyright (C) 2000 Paul Brannan <pbranna@clemson.edu>\nand the team. This program comes with ABSOLUTELY NO WARRANTY; for details\nread LICENSE.TXT. "
MSG_COPYRIGHT_1 "This is free software, and you are welcome to redistribute\nit under certain conditions.\n\n"
MSG_USAGE "Usage: TELNET [params][host [port]]\n\n params\n -d:FILENAME.EXT Dumps all incoming data to FILENAME.EXT.\n host Host name or IP address of the remote host to connect to.\n"
MSG_USAGE_1 " port Service port to open (default is telnet port 23).\n\n"
MSG_HELP "Commands may be abbreviated. Commands are:\n \ncl[ose] close current connection\nop[en] connect to a site\nq[uit] exit telnet\n"
MSG_HELP_1 "ke[ys] changes/displays keymaps (write keys to see the options)\nse[t] displays/alters configuration options\nz suspend\n? h[elp] print help information\n"
MSG_INVCMD "Invalid command. Type ? for help.\n"
MSG_ERROR "%1 failed.\n"
MSG_INFO "%1\n"
MSG_WARNING "%1\n"
MSG_TRYING "Trying %1.%2.%3.%4:%5...\n"
MSG_CONNECTED "Connected to %1. Escape key is ALT-%2.\n"
MSG_TERMBYREM "Connection terminated.\n"
MSG_KEYMAP "Loading %1 from %2.\n"
MSG_ERRKEYMAP "Error loading keymap.\n"
MSG_DUMPFILE "Writing output to file %1.\n"
MSG_CONFIG "Loading configuration options from %1.\n"
MSG_NOINI "Error loading configuration file %1.\nLoading default options.\n"
MSG_BADVAL "Warning: invalid variable %1.\n"
MSG_NOSPAWN "Unable to spawn process.\n"
MSG_RESOLVING "Looking up host: %1..."
MSG_NOSERVICE "Could not find TCP service %1.\n"
MSG_SIZEALIAS "Warning: size of alias %1 is too big, ignoring.\n"
MSG_ERRPIPE "Error: unable to spawn process for pipe.\n"
MSG_BADUSAGE "Error: invalid usage of command.\n"
MSG_ALREADYCONNECTED "Already connected to %1.\n"
MSG_WSAEINTR "Interrupted function call.\n"
MSG_WSAEBADF "WSAEBADF\n"
MSG_WSAEACCESS "Permission denied.\n"
MSG_WSAEDEFAULT "WSAEDEFAULT\n"
MSG_WSAEINVAL "Invalid argument.\n"
MSG_WSAEMFILE "Too many open files.\n"
MSG_WSAEWOULDBLOCK "Resource temporalily unavailable.\n"
MSG_WSAEINPROGRESS "Operation now in progress.\n"
MSG_WSAEALREADY "Operation already in progress.\n"
MSG_WSAENOTSOCK "Socket operation on non-socket.\n"
MSG_WSAEDESTADDRREQ "Destination address required.\n"
MSG_WSAEMSGSIZE "Message too long.\n"
MSG_WSAEPROTOTYPE "Protocol wrong type for socket.\n"
MSG_WSAENOPROTOOPT "Bad protocol option.\n"
MSG_WSAEPROTONOTSUPPORT "Protocol not supported.\n"
MSG_WSAESOCKNOTSUPPORT "Socket type not supported.\n"
MSG_WSAEOPNOTSUPP "Operation not supported.\n"
MSG_WSAEPFNOTSUPPORT "Protocol family not supported.\n"
MSG_WSAEAFNOTSUPPORT "Address family not supported by protocol family.\n"
MSG_WSAEADDRINUSE "Address already in use.\n"
MSG_WSAEADDRNOTAVAIL "Cannot assign requested address.\n"
MSG_WSAENETDOWN "Network is down.\n"
MSG_WSAENETUNREACH "Network is unreachable.\n"
MSG_WSAENETRESET "Network dropped connection on reset.\n"
MSG_WSAECONNABORTED "Software caused connection abort.\n"
MSG_WSAECONNRESET "Connection reset by peer.\n"
MSG_WSAENOBUFS "No buffer space available.\n"
MSG_WSAEISCONN "Socket is already connected.\n"
MSG_WSAENOTCONN "Socket is not connected.\n"
MSG_WSAESHUTDOWN "Cannot send after socket shutdown.\n"
MSG_WSAETOOMANYREFS "WSAETOOMANYREFS\n"
MSG_WSAETIMEDOUT "Connection timed out.\n"
MSG_WSAECONNREFUSED "Connection refused.\n"
MSG_WSAELOOP "WSAELOOP\n"
MSG_WSAENAMETOOLONG "Name too long.\n"
MSG_WSAEHOSTDOWN "Host is down.\n"
MSG_WSAEHOSTUNREACH "No route to host.\n"
MSG_WSAESYSNOTREADY "Network subsystem is unavailable.\n"
MSG_WSAVERNOTSUPPORTED "WINSOCK.DLL version out of range.\n"
MSG_WSANOTINITIALISED "Successful WSAStartup not yet performed.\n"
MSG_WSAHOST_NOT_FOUND "Host not found.\n"
MSG_WSATRY_AGAIN "Non-authoritative host not found.\n"
MSG_WSANO_RECOVERY "This is a non-recoverable error.\n"
MSG_WSANO_DATA "Valid name, no data record of requested type.\n"
MSG_KEYNOVAL "[GLOBAL]: No value for %1.\n"
MSG_KEYBADVAL "[GLOBAL]: Bad value for %1.\n"
MSG_KEYBADSTRUCT "%1: Bad structure.\n"
MSG_KEYBADCHARS "%1: Bad chars? %1 -> %3.\n"
MSG_KEYUNEXPLINE "Unexpected line ""%1"".\n"
MSG_KEYUNEXPEOF "Unexpended end of file.\n"
MSG_KEYUNEXPTOK "Unexpected token %1.\n"
MSG_KEYUNEXPTOKIN "Unexpected token in %1.\n"
MSG_KEYUNEXP "Unexpected end of file or token.\n"
MSG_KEYNOGLOBAL "No [GLOBAL] definition!\n"
MSG_KEYNOCONFIG "No [CONFIG %1].\n"
MSG_KEYUSECONFIG "Use configuration: %1.\n"
MSG_KEYNOSWKEY "No switch key for ""%1"".\n"
MSG_KEYCANNOTDEF "You cannot define switch key for default keymap - ignored.\n"
MSG_KEYDUPSWKEY "Duplicate switching key.\n"
MSG_KEYUNKNOWNMAP "Unknown keymap %1.\n"
MSG_KEYNOCHARMAPS "No charmaps loaded.\n"
MSG_KEYNOKEYMAPS "No keymaps loaded.\n"
MSG_KEYNUMMAPS "There are %1 maps.\n"
MSG_KEYBADMAP "Bad keymap number - try 'keys display'\n"
MSG_KEYMAPSWITCHED "keymap switched.\n"
END
#if defined(__MINGW32__) || defined(__CYGWIN__)
TelnetIcon ICON "telnet.ico"
#else
TelnetIcon ICON "../telnet.ico"
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,85 +0,0 @@
#ifndef __ANSIPRSR_H
#define __ANSIPRSR_H
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "tnconfig.h"
#include "tparser.h"
// added this color table to make things go faster (Paul Branann 5/8/98)
enum Colors {BLACK=0, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE};
extern const int ANSIColors[];
// This should be greater than the largest conceivable window size
// 200 should suffice
#define MAX_TAB_POSITIONS 200
// Added by Frediano Ziglio 6/2/2000
// Include Meridian Emulator support
// undefine it to remove support
#define MTE_SUPPORT 1
// TANSIParser is now properly no longer a base class for TTelnetParser.
// Screen output is handled in TConsole.cpp.
// (Paul Brannan 6/15/98)
class TANSIParser : public TParser {
private:
char* ParseEscapeANSI(char* pszBuffer, char* pszBufferEnd);
char* ParseANSIBuffer(char* pszBuffer, char* pszBufferEnd);
char* ParseEscape(char* pszBuffer, char* pszBufferEnd);
// Added by I.Ioannou 06/04/97
char* PrintBuffer(char* pszBuffer, char* pszBufferEnd);
char* PrintGoodChars(char * pszHead, char * pszTail);
#ifdef MTE_SUPPORT
// Added by Frediano Ziglio, 5/31/2000
char* ParseEscapeMTE(char* pszBuffer, char* pszBufferEnd);
short int mteRegionXF,mteRegionYF;
#endif
void ConSetAttribute(unsigned char wAttr);
char *GetTerminalID();
void ConSetCursorPos(int x, int y);
void ResetTerminal();
void Init();
void SaveCurX(int iX);
void SaveCurY(int iY);
void resetTabStops();
int iSavedCurX;
int iSavedCurY;
unsigned char iSavedAttributes;
FILE * dumpfile;
// Added by I.Ioannou 06 April 1997
FILE * printfile;
char InPrintMode;
int inGraphMode;
char last_char; // TITUS++: 2. November 98
char map_G0, map_G1;
int current_map;
bool vt52_mode;
bool print_ctrl;
bool ignore_margins;
bool fast_write;
bool newline_mode;
int tab_stops[MAX_TAB_POSITIONS];
public:
// Changed by Paul Brannan 5/13/98
TANSIParser(TConsole &Console, KeyTranslator &RefKeyTrans,
TScroller &RefScroller, TNetwork &NetHandler, TCharmap &RefCharmap);
~TANSIParser();
char* ParseBuffer(char* pszBuffer, char* pszBufferEnd);
static int StripBuffer(char* pszBuffer, char* pszBufferEnd, int width);
};
#endif

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