Compare commits

...

59 Commits

Author SHA1 Message Date
Gé van Geldorp
d34f579866 Oops, used wrong tag
svn path=/tags/ReactOS-0.2.7/; revision=18974
2005-11-03 14:36:29 +00:00
Gé van Geldorp
955dc767dd Tag ReactOS release 0.2.8
svn path=/tags/ReactOS-0.2.7/; revision=18973
2005-11-03 14:33:44 +00:00
Brandon Turner
9173e96e7d change to "RELEASE"
svn path=/branches/ros-branch-0_2_8/; revision=18832
2005-10-28 14:23:48 +00:00
Andrew Munger
fb29985637 Disable patented bytecode interpreter, will investigate the non-patented configuration.
svn path=/branches/ros-branch-0_2_8/; revision=18774
2005-10-25 18:08:13 +00:00
Brandon Turner
c41f403a21 Changed to RC2
svn path=/branches/ros-branch-0_2_8/; revision=18761
2005-10-24 21:42:24 +00:00
Gé van Geldorp
c22faedfdb Can't have a release without WineMine:
Add resource file, makes winemine playable again

svn path=/branches/ros-branch-0_2_8/; revision=18706
2005-10-23 13:11:31 +00:00
Gé van Geldorp
940e95f578 Merge from trunk:
Don't issue KBD_LINE_TEST, the results are unreliable. Fixes reopen of #688.

svn path=/branches/ros-branch-0_2_8/; revision=18700
2005-10-23 11:33:45 +00:00
Gé van Geldorp
2816fa8ad0 Merge from trunk:
Use MaxPos instead of MaxTrackingPos when "restoring" a window which was
previously maximized. Fixes bug 925.

svn path=/branches/ros-branch-0_2_8/; revision=18680
2005-10-22 15:19:01 +00:00
Gé van Geldorp
3b88890780 Merge from trunk.
Fix icon alignment when the screen width is not a multiple of the icon spacing.
Fixes bug 912.

svn path=/branches/ros-branch-0_2_8/; revision=18674
2005-10-22 12:11:42 +00:00
Gé van Geldorp
4e8b37f268 Merge from trunk.
Make FindWindow case insensitive. Fixes bug 919.

svn path=/branches/ros-branch-0_2_8/; revision=18667
2005-10-21 21:16:36 +00:00
Gé van Geldorp
38e712904d Merge from trunk.
- Enable/disable keyboard by writing the controller command byte instead of
  issuing keyboard commands, the keyboard commands seem to confuse some kvm
  switches.
- Use STATUS_IO_TIMEOUT consistently, STATUS_TIMEOUT is not an error condition
- Introduce symbolic constants for controller command byte bits
- Try to detect mouse early and if its not present, reset the keyboard
  controller. Some controllers seem to get locked up when writing to a
  non-present mouse.
- Don't check the timeout status bit when reading from the controller. It is
  often wrong.
- Don't treat failure to read keyboard id as a fatal error, we only read it
  to set KeyboardIsAT which we then don't use. Still try to detect the keyboard
  type, but don't fail if it doesn't work.
Fixes bug 688. Thanks to Hartmut, Filip and WaxDragon for testing.

svn path=/branches/ros-branch-0_2_8/; revision=18665
2005-10-21 20:31:59 +00:00
Gé van Geldorp
cbbc54397d Revert r18662, trunk and branch already diverged
svn path=/branches/ros-branch-0_2_8/; revision=18663
2005-10-21 19:45:28 +00:00
Gé van Geldorp
3c5b8f62ce Merge from trunk: Make desktop properties fit in 640x480 desktop
svn path=/branches/ros-branch-0_2_8/; revision=18662
2005-10-21 19:33:16 +00:00
Gé van Geldorp
076872ae0a Merge from trunk. Martijn Vernooij <o112w8r02@sneakemail.com>
Work around continuous repainting of treeview control.
Fixes bug 493.

svn path=/branches/ros-branch-0_2_8/; revision=18658
2005-10-21 17:16:46 +00:00
Gé van Geldorp
1d110cfd34 Merge from trunk.
Patch by hardon. Properly handle 0 timeouts. Fixes bug 857.

svn path=/branches/ros-branch-0_2_8/; revision=18537
2005-10-17 22:09:18 +00:00
Gé van Geldorp
b49ba945d0 Merge from trunk.
Everything must come to an end, even the desktop window. Fixes bug 805.

svn path=/branches/ros-branch-0_2_8/; revision=18535
2005-10-17 22:00:42 +00:00
Gé van Geldorp
5f8cac6653 Merge from trunk.
Inform HAL about the switch to graphics modeas late as possible. Fixes bug 880.

svn path=/branches/ros-branch-0_2_8/; revision=18533
2005-10-17 21:48:12 +00:00
Hartmut Birr
7ed77ada75 Merge from trunk.
Don't use alloca in a macro, which may be used in a loop. This does fix bug #805.

svn path=/branches/ros-branch-0_2_8/; revision=18482
2005-10-15 14:26:53 +00:00
Gé van Geldorp
fd1eddbc07 Merge from trunk.
Make sure we don't hang forever when activating a window belonging to
another thread

svn path=/branches/ros-branch-0_2_8/; revision=18469
2005-10-15 09:55:46 +00:00
Gé van Geldorp
0cefb2734c Merge from trunk. Goplat <mrnobo1024@yahoo.com>:
SetPixel should return the new color. Bug 909.

svn path=/branches/ros-branch-0_2_8/; revision=18451
2005-10-14 18:35:05 +00:00
Gé van Geldorp
e0c4931114 Merge from trunk. tsk <tsk_n@mail.goo.ne.jp>:
UsageMessage is a printf format string.

svn path=/branches/ros-branch-0_2_8/; revision=18440
2005-10-14 09:44:48 +00:00
Gé van Geldorp
667d6e07eb Merge from trunk:
Don't install Winefile icon on desktop, it's already present in the start menu

svn path=/branches/ros-branch-0_2_8/; revision=18438
2005-10-14 09:34:15 +00:00
Gé van Geldorp
7614c174b6 Merge from trunk. Mike <mikeonthecomputer@gmail.com>:
Add installation path for VMware 5.5. Fixes bug 907.

svn path=/branches/ros-branch-0_2_8/; revision=18436
2005-10-14 09:27:30 +00:00
Robert Kopferl
1ed2391c2f preparations for Ros 0.2.8-RC1
svn path=/branches/ros-branch-0_2_8/; revision=18434
2005-10-14 00:03:27 +00:00
Gé van Geldorp
92697d6768 Merge from trunk:
Use the pitch provided by FreeType. Fixes bug 894.

svn path=/branches/ros-branch-0_2_8/; revision=18432
2005-10-13 18:43:49 +00:00
Gé van Geldorp
1bc7e5d407 Send window-bound timers to the correctmessage queue
svn path=/branches/ros-branch-0_2_8/; revision=18421
2005-10-13 07:35:48 +00:00
Gé van Geldorp
5ddd8d5749 Workaround for bug 899
svn path=/branches/ros-branch-0_2_8/; revision=18420
2005-10-13 07:35:19 +00:00
Robert Kopferl
6dca386d96 version info for release
svn path=/branches/ros-branch-0_2_7/; revision=17449
2005-08-20 17:17:44 +00:00
Andrew Munger
7f0ea80f3f Merge TimeOut fix from trunk.
svn path=/branches/ros-branch-0_2_7/; revision=17439
2005-08-19 17:13:37 +00:00
James Tabor
f3cd936a23 Merge change 17380 to 0.2.7 branch.
svn path=/branches/ros-branch-0_2_7/; revision=17393
2005-08-15 01:41:24 +00:00
Andrew Munger
fc495f0fc2 Merge bug 659 fix into 0.2.7 branch.
svn path=/branches/ros-branch-0_2_7/; revision=17216
2005-08-08 16:57:50 +00:00
Robert Kopferl
b628ec097a Modification for new RC release
svn path=/branches/ros-branch-0_2_7/; revision=17175
2005-08-07 17:46:50 +00:00
Filip Navara
b5911876a6 Fix keyboard input in usetup.
svn path=/branches/ros-branch-0_2_7/; revision=17113
2005-08-06 19:02:53 +00:00
Filip Navara
48c97a5115 Fix translation of extended keys.
svn path=/branches/ros-branch-0_2_7/; revision=17112
2005-08-06 18:57:52 +00:00
Filip Navara
14e73e8f67 Merge 16748 from trunk:
Add check for global handles to NtGdiDeleteDC, this prevents applications from destroying DCs that are part of DCEs.

svn path=/branches/ros-branch-0_2_7/; revision=17025
2005-08-03 17:24:05 +00:00
Filip Navara
a477c328ef Merge 16933 from trunk:
Fix paramater validation and pointer manipulation in RtlAddAce.

svn path=/branches/ros-branch-0_2_7/; revision=17024
2005-08-03 17:21:19 +00:00
Filip Navara
d16812b7e2 Merge 16932 from trunk:
Fix locking in RtlPinAtomInAtomTable.

svn path=/branches/ros-branch-0_2_7/; revision=17023
2005-08-03 17:20:53 +00:00
Filip Navara
39b9584d47 Merge 16921 (weiden) from trunk:
fixed success check in RtlpCreateAtomHandle, ExCreateHandle returns EX_INVALID_HANDLE in case of failure. Thx to Filip

svn path=/branches/ros-branch-0_2_7/; revision=17022
2005-08-03 17:20:19 +00:00
Filip Navara
b0d5493ac9 Merge 16860 from trunk:
Initialize DescriptorTranslated->u.Interrupt.Level before calling HalGetInterruptVector. Remember, casting hides bugs! Debugged by Hervé Poussineau.

svn path=/branches/ros-branch-0_2_7/; revision=17021
2005-08-03 17:19:36 +00:00
Filip Navara
6c57c88a87 Merge 16858 from trunk:
Properly propagate the SL_PENDING_RETURNED flag to stack locations in IofCompleteRequest and fix the priority boost for master IRPs.

svn path=/branches/ros-branch-0_2_7/; revision=17020
2005-08-03 17:18:54 +00:00
Filip Navara
a566903f6f Megre 16749, 16750, 16751, 16763, 16764 from trunk:
Fix reverting of focus to owner windows.

svn path=/branches/ros-branch-0_2_7/; revision=17019
2005-08-03 17:17:57 +00:00
Filip Navara
7a0cd98093 Merge 16747 from trunk:
Don't use DeleteDC on DC handles returned by GetDC.

svn path=/branches/ros-branch-0_2_7/; revision=17018
2005-08-03 17:16:24 +00:00
Filip Navara
ad54b301b1 Merge 16746 from trunk:
Implement ValidateRect.

svn path=/branches/ros-branch-0_2_7/; revision=17017
2005-08-03 17:15:48 +00:00
Filip Navara
93d4eb5c2e Merge 16737 from trunk:
Fix some bugs in DIB mapping code to prevent instant system crashes.

svn path=/branches/ros-branch-0_2_7/; revision=17016
2005-08-03 17:15:11 +00:00
Filip Navara
619a5c3e59 Merge 16736 from trunk:
Properly setup the I/O stack location in IopSecurityFile.

svn path=/branches/ros-branch-0_2_7/; revision=17015
2005-08-03 17:14:26 +00:00
Filip Navara
677a50e78c Merge 16735 from trunk:
Don't allow setting menu for child windows in IntSetMenu.

svn path=/branches/ros-branch-0_2_7/; revision=17014
2005-08-03 17:13:51 +00:00
Filip Navara
bc69be97d0 Merge 16728 (ion) from trunk:
- Don't try to get the length of a possibly empty string. This fixes many menu applications (such as WinRAR). However I'm now getting a bug due to a double-free. It seems a GDI Object is being freed twice. Can anyone check this out please?

svn path=/branches/ros-branch-0_2_7/; revision=17013
2005-08-03 17:13:04 +00:00
Filip Navara
39fdfabe56 Merge 16725 from trunk:
Build Wine DLLs without the UNICODE and _UNICODE definitions. (Note: The Wine DLLs use A/W functions explicitely, so this doesn't have any performance impact.)

svn path=/branches/ros-branch-0_2_7/; revision=17012
2005-08-03 17:10:45 +00:00
Filip Navara
7e63f5285e Merge 16727 (ion/hbirr) from trunk:
- Message Queue Fix, resolves a number of application regressions (Total Commander works again, for example). Patch by Hartmut Birr. To be commited into 0.2.7 after more testing.

svn path=/branches/ros-branch-0_2_7/; revision=17011
2005-08-03 17:10:30 +00:00
Filip Navara
ae0588cd38 Merge 16597 (hbirr) from trunk:
Used the kernel base address from the loader structure instead MmSystemRangeStart. 
MmSystemRangeStart isn't the base address with the 3GB switch.

svn path=/branches/ros-branch-0_2_7/; revision=17010
2005-08-03 17:07:01 +00:00
Filip Navara
91b395d07d Merge 16596 (hbirr) from trunk:
Replaced KERNEL_BASE by MmSystemRangeStart.

svn path=/branches/ros-branch-0_2_7/; revision=17009
2005-08-03 17:05:36 +00:00
Filip Navara
516814e4e7 Merge 16594 (jc) from trunk:
GetMenuStringA and GetMenuStringW inverted the MF_BYPOSITION parameter. Buffers were incorrectly copied in and wrong size returned in GetMenuItemInfoA ansi-structures.
GetMenuString now works the same on both windows and ROS.

svn path=/branches/ros-branch-0_2_7/; revision=17008
2005-08-03 16:17:15 +00:00
Filip Navara
d156f026de Fixed the size of the hyperspace area. Partial merge of 16592 from trunk.
svn path=/branches/ros-branch-0_2_7/; revision=17007
2005-08-03 16:15:15 +00:00
Filip Navara
b4cf27d528 Merge 16557 (hbirr) from trunk:
Fixed the allocation of the buffer for the environment variable in ProcessInput.

svn path=/branches/ros-branch-0_2_7/; revision=17006
2005-08-03 16:11:00 +00:00
Filip Navara
81de064a8f Merge 16553 / 16555 (weiden) from trunk:
handle memory allocation errors in GetEnvironmentVariable() and ensure the string is always null-terminated

svn path=/branches/ros-branch-0_2_7/; revision=17005
2005-08-03 16:10:03 +00:00
Hartmut Birr
5fc2cf29e4 Merge r16633:16634 from trunk. This fix prevents from corrupting the message queues.
svn path=/branches/ros-branch-0_2_7/; revision=16669
2005-07-20 17:31:18 +00:00
Hartmut Birr
7585ca1273 Merge r16567:16568 from trunk. This fix prevents from corrupting the message queues.
svn path=/branches/ros-branch-0_2_7/; revision=16598
2005-07-16 15:19:52 +00:00
Robert Kopferl
e88126388e the release branch should be dbg=0
svn path=/branches/ros-branch-0_2_7/; revision=16570
2005-07-14 23:11:28 +00:00
Robert Kopferl
00e84692de version info for rc1 build
svn path=/branches/ros-branch-0_2_7/; revision=16565
2005-07-14 19:19:09 +00:00
3790 changed files with 456300 additions and 615013 deletions

View File

@@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2005 Casper S. Hornstrup
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 name="ReactOS.ApiStatus" default="publish">
<property name="reactos.dir" value="reactos" />
<property name="apistatus.xsl" value="rapistatus.xsl" />
<property name="apistatus.xml" value="rapistatus.xml" />
<property name="apistatus.html" value="index2.html" />
<include buildfile="config.include" />
<target name="publish">
<delete dir="${reactos.dir}" if="${directory::exists(reactos.dir)}" />
<exec program="svn" commandline="export -r HEAD ${source.url} ${reactos.dir}" />
<exec program="rgenstat" commandline="reactos\apistatus.lst ${apistatus.xml}" />
<style style="${apistatus.xsl}" destdir="${reactos.dir}" in="${apistatus.xml}" out="${apistatus.html}" />
<copy todir="${publish.dir}" overwrite="true">
<fileset basedir=".">
<include name="${apistatus.xml}" />
<include name="${apistatus.html}" />
</fileset>
</copy>
<delete>
<fileset basedir=".">
<include name="${apistatus.xml}" />
<include name="${apistatus.html}" />
</fileset>
</delete>
<delete dir="${reactos.dir}" if="${directory::exists(reactos.dir)}" />
</target>
</project>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2005 Casper S. Hornstrup
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>
<property name="source.url" value="svn://svn.reactos.com/trunk/reactos" />
<property name="publish.dir" value="C:\api" />
</project>

View File

@@ -1,8 +0,0 @@
<?php
/* Rename to config.php */
define(ISO_BASE_URL, "http://www.server.com/iso/");
define(ISO_PATH, "C:\\iso\\");
?>

View File

@@ -1,230 +0,0 @@
<?php
include ('config.php');
function dm_usort_cmp ($a, $b) {
if ($a == $b) return 0;
return ($a > $b) ? -1 : 1;
}
function dm_usort_cmp_desc ($a, $b) {
if ($a == $b) return 0;
return ($a > $b) ? 1 : -1;
}
function printHeader()
{
?>
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>ReactOS Revison ISOs</title>
<meta name="generator" content="Editpad">
<meta name="keywords" content="OS, ReactOS, operating system">
<meta name="author" content="ReactOS Project (ros-dev@reactos.com)">
<style>
.box
{
padding: 0px;
background-color: #88aadd;
border-left: 1px solid #f0f0f0;
border-right: 1px solid #000000;
border-top: 1px solid #f0f0f0;
border-bottom: 1px solid #000000;
}
</style>
</head>
<body bgcolor="#88aadd">
<form method="post" action="">
<?php
}
function printMenu($revision)
{
?>
<table border="0" class="box" cellpadding="5">
<tr>
<td height="2px">
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<b>Branch:</b>
</td>
<td>
<select name="branch" tabindex="1">
<?php
$d = dir(ISO_PATH);
$i = 0;
$dirlist = array();
while (false !== ($entry = $d->read())) {
if ((strcasecmp($entry, ".") != 0) && (strcasecmp($entry, "..") != 0) && is_dir(ISO_PATH . "\\" . $entry) == "dir") {
$dirlist[$i++] = $entry;
}
}
$d->close();
if (is_array($dirlist)) {
usort($dirlist, "dm_usort_cmp");
reset($dirlist);
while (list($key, $val) = each($dirlist)) {
$branch = $val;
if ($branch == $_POST["branch"] || (!isset($_POST["branch"]) && $branch == "trunk"))
$selected = " selected";
else
$selected = "";
echo "<option$selected>$branch</option>";
}
}
?>
</select>
</td>
<td>
&nbsp;
</td>
<td>
<b>Revision:</b>
</td>
<td>
<?php
echo "<input type=\"text\" name=\"revision\" size=\"10\" maxlength=\"10\" tabindex=\"2\" value=\"" . $revision . "\"></input>";
?>
</td>
<td>
&nbsp;
</td>
<td>
<input type="submit" name="getiso" value="Download" tabindex="3" style="border: 1px solid #000000"></input>
</td>
</tr>
<tr>
<td colspan="7">
<hr size="2" width="100%" />
</td>
</tr>
<tr>
<td colspan="4">
<input type="submit" name="getnextiso" value="Next ISO" tabindex="4" style="border: 1px solid #000000"></input>
</td>
<td colspan="3" align="right">
<input type="submit" name="getlatestiso" value="Latest ISO" tabindex="5" style="border: 1px solid #000000"></input>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="2px">
</td>
</tr>
</table>
<?php
}
function printFooter()
{
?>
</form>
<script>
var revision = document.getElementById('revision');
if (revision) revision.focus();
</script>
</body>
</html>
<?php
}
function locateRevisionISO($branch, $revision, $latest)
{
$revision = intval($revision);
$path = ISO_PATH . "\\" . $branch;
$d = dir($path);
$i = 0;
$filelist = array();
while (false !== ($entry = $d->read())) {
if (is_dir($path . "\\" . $entry) != "dir")
$filelist[$i++] = $entry;
}
$d->close();
if (is_array($filelist)) {
$sortFunction = $latest ? "dm_usort_cmp" : "dm_usort_cmp_desc";
usort($filelist, $sortFunction);
reset($filelist);
while (list($key, $filename) = each($filelist)) {
if (ereg('ReactOS-' . $branch . '-r([0-9]*).iso', $filename, $regs))
{
$thisRevision = intval($regs[1]);
if (($latest) && ($thisRevision < $revision))
return $regs[1];
else if ($thisRevision > $revision)
return $regs[1];
$lastRevision = $thisRevision;
}
}
}
return "";
}
function getNextRevisionISO($branch, $revision)
{
return locateRevisionISO($branch, $revision, false);
}
function getLatestRevisionISO($branch)
{
return locateRevisionISO($branch, 999999, true);
}
function main()
{
$branch = $_POST["branch"];
$revision = $_POST["revision"];
$filename = "ReactOS-" . $branch . "-r" . $revision . ".iso";
if (file_exists(ISO_PATH . $branch . "\\" . $filename))
{
$location = ISO_BASE_URL . $branch . "/" . $filename;
header("Location: $location");
return;
}
else
{
printHeader();
printMenu($_POST["revision"]);
echo "<br><b>No ISO exist for branch '" . $branch . "' and revision " . $revision . ".</b><br><br>";
printFooter();
}
}
if (!empty($_POST["getiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"]))
main();
else if (!empty($_POST["getnextiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"]))
{
printHeader();
printMenu(getNextRevisionISO($_POST["branch"], $_POST["revision"]));
printFooter();
}
else if (!empty($_POST["getlatestiso"]) && !empty($_POST["branch"]))
{
printHeader();
printMenu(getLatestRevisionISO($_POST["branch"]));
printFooter();
}
else
{
printHeader();
printMenu($_POST["revision"]);
printFooter();
}
?>

View File

@@ -203,13 +203,12 @@ public:
}
bool OnPart ( const std::string& user, const std::string& channel )
{
std::vector<std::string>::iterator it = ops.begin();
for ( ; it != ops.end(); it++ )
for ( int i = 0; i < ops.size(); i++ )
{
if ( *it == user )
if ( ops[i] == user )
{
printf ( "remove '%s' to ops list\n", user.c_str() );
ops.erase ( it );
ops.erase ( &ops[i] );
}
}
return true;
@@ -395,17 +394,15 @@ public:
return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
s = string ( p, p2-p );
}
std::vector<std::string>::iterator it = list.list.begin();
for ( ; it != list.list.end(); it++ )
for ( i = 0; i < list.list.size(); i++ )
{
if ( *it == s )
if ( list.list[i] == s )
{
list.list.erase ( it );
list.list.erase ( &list.list[i] );
{
File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
it = list.list.begin();
for ( ; it < list.list.end(); it++ )
f.printf ( "%s\n", it->c_str() );
File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
for ( i = 0; i < list.list.size(); i++ )
f.printf ( "%s\n", list.list[i].c_str() );
}
return PrivMsg ( channel, ssprintf("%s: entry removed from list '%s'",from.c_str(),listname.c_str()) );
}
@@ -483,13 +480,12 @@ public:
{
if ( *p == 'o' )
{
std::vector<std::string>::iterator it = ops.begin();
for ( ; it != ops.end(); it++ )
for ( int i = 0; i < ops.size(); i++ )
{
if ( *it == target )
if ( ops[i] == target )
{
printf ( "remove '%s' to ops list\n", target.c_str() );
ops.erase ( it );
ops.erase ( &ops[i] );
}
}
break;

View File

@@ -14,8 +14,8 @@
#define nelem(x) ( sizeof(x) / sizeof(x[0]) )
#endif//nelem
typedef File::filesize_t filesize_t;
typedef File::fileoff_t fileoff_t;
using File::filesize_t;
using File::fileoff_t;
fileoff_t File::seek ( fileoff_t offset )

View File

@@ -18,7 +18,7 @@
class File
{
public:
#ifdef WIN32
#ifdef _MSC_VER
typedef __int64 fileoff_t;
typedef unsigned __int64 filesize_t;
#else//_MSC_VER

View File

@@ -10,7 +10,7 @@
#include <sstream>
#include "IRCClient.h"
#include "MD5.h"
#include "md5.h"
#include "cram_md5.h"
#include "trim.h"
#include "chomp.h"

View File

@@ -53,7 +53,7 @@ public:
{
ASSERT ( i < _end );
reserve ( i + 1 );
_arr[i].reset ( p );
_arr[i].reset ( ptr );
}
void push_back ( auto_ptr<T>& p )

View File

@@ -2,7 +2,7 @@
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#include "MD5.h"
#include "md5.h"
#include "cram_md5.h"
#include "base64.h"

View File

@@ -1,38 +0,0 @@
TARGET := ArchBlackmann.exe
.PHONY: all
all: $(TARGET)
CPP=mingw32-g++
CFLAGS := -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS
LFLAGS :=
LIBS := -lstdc++ -lws2_32
SRCS := ArchBlackmann.cpp \
base64.cpp \
chomp.cpp \
cram_md5.cpp \
File.cpp \
IRCClient.cpp \
MD5.cpp \
panic.cpp \
ReliMT.cpp \
SockUtils.cpp \
SplitJoin.cpp \
ssprintf.cpp \
ThreadPool.cpp \
trim.cpp
OBJS := $(SRCS:.cpp=.o)
$(TARGET): $(OBJS)
$(CPP) $(LFLAGS) -o $@ $(OBJS) $(LIBS)
.cpp.o: $<
$(CPP) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
-@del $(TARGET)
-@del $(OBJS)

View File

@@ -21,10 +21,10 @@ ArchBlackmann know what he should say from some text files. They can be found on
List that are used directly to create responses are:
- tech - here are the sentences ArchBlackmann says when he finds his name
- tech - here are the sentces ArchBlackmann sais when he finds his name
- curse - this are the curses he looks for
- cursecop - this the responces to them
- grovel - this is said when an op does the grovel command
- grovel - this is said when a op does the grovel command
- nogrovel - this when someone else does it
The remaining lists are not used directly, but by the other lists.

View File

@@ -551,7 +551,7 @@ static bool numberfl(std::string& f, long double __n, char exp_sign, int size,
return true;
}
static int stringa(std::string& f, const char* s, int len, int field_width, int precision, int flags)
static int string(std::string& f, const char* s, int len, int field_width, int precision, int flags)
{
int i, done = 0;
if (s == NULL)
@@ -654,7 +654,7 @@ std::string ssvprintf ( const char *fmt, va_list args )
long double _ldouble;
double _double;
const char *s;
const wchar_t* sw;
const unsigned short* sw;
int result;
std::string f;
@@ -793,12 +793,12 @@ std::string ssvprintf ( const char *fmt, va_list args )
case 's':
if (qualifier == 'l' || qualifier == 'w') {
/* print unicode string */
sw = (const wchar_t*)va_arg(args, wchar_t *);
sw = va_arg(args, wchar_t *);
result = stringw(f, sw, -1, field_width, precision, flags);
} else {
/* print ascii string */
s = va_arg(args, char *);
result = stringa(f, s, -1, field_width, precision, flags);
result = string(f, s, -1, field_width, precision, flags);
}
if (result < 0)
{
@@ -811,10 +811,10 @@ std::string ssvprintf ( const char *fmt, va_list args )
if (qualifier == 'h') {
/* print ascii string */
s = va_arg(args, char *);
result = stringa(f, s, -1, field_width, precision, flags);
result = string(f, s, -1, field_width, precision, flags);
} else {
/* print unicode string */
sw = (const wchar_t*)va_arg(args, wchar_t *);
sw = va_arg(args, wchar_t *);
result = stringw(f, sw, -1, field_width, precision, flags);
}
if (result < 0)
@@ -846,7 +846,7 @@ std::string ssvprintf ( const char *fmt, va_list args )
s = pas->Buffer;
len = pas->Length;
}
result = stringa(f, s, -1, field_width, precision, flags);
result = string(f, s, -1, field_width, precision, flags);
}
if (result < 0)
return -1;

View File

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

View File

@@ -1,5 +0,0 @@
<group>
<directory name="bepslep">
<xi:include href="bepslep/bepslep.xml" />
</directory>
</group>

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,11 +0,0 @@
<group>
<directory name="apps">
<xi:include href="apps/directory.xml" />
</directory>
<directory name="lib">
<xi:include href="lib/directory.xml" />
</directory>
<directory name="server">
<xi:include href="server/os2srv.xml" />
</directory>
</group>

View File

@@ -1,5 +0,0 @@
<group>
<directory name="doscalls">
<xi:include href="doscalls/doscalls.xml" />
</directory>
</group>

View File

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

View File

@@ -0,0 +1 @@
*.o

View File

@@ -1,4 +1,4 @@
/* $Id$
/* $Id: devices.cpp,v 1.5 2004/01/31 01:29:11 robertk Exp $
*/
/*
*

View File

@@ -1,4 +1,38 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS-OS/2 subsystem base services\0"
#define REACTOS_STR_INTERNAL_NAME "doscalls\0"
#define REACTOS_STR_ORIGINAL_FILENAME "doscalls.dll\0"
#include <reactos/version.rc>
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "OS2 subsystem base services\0"
VALUE "FileVersion", RES_STR_FILE_VERSION
VALUE "InternalName", "doscalls\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "doscalls.dll\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@@ -1,23 +0,0 @@
<module name="doscalls" type="nativedll">
<importlibrary definition="doscalls.def" />
<include base="doscalls">../../include</include>
<linkerflag>-lgcc</linkerflag>
<directory name="devices">
<file>devices.cpp</file>
<file>ioctl_async.cpp</file>
</directory>
<directory name="file">
<file>directory.cpp</file>
<file>openclose.cpp</file>
</directory>
<directory name="memory">
<file>memory.cpp</file>
</directory>
<directory name="misc">
<file>doscalls.cpp</file>
<file>error.cpp</file>
</directory>
<directory name="run">
<file>process.cpp</file>
</directory>
</module>

View File

@@ -0,0 +1 @@
*.o

View File

@@ -1,4 +1,4 @@
/* $Id$
/* $Id: directory.cpp,v 1.1 2002/09/04 22:19:47 robertk Exp $
*/
/*
*

View File

@@ -1,4 +1,4 @@
/* $Id$
/* $Id: openclose.cpp,v 1.5 2004/01/31 01:29:11 robertk Exp $
*/
/*
*

View File

@@ -0,0 +1 @@
*.o

View File

@@ -1,4 +1,4 @@
/* $Id$
/* $Id: doscalls.cpp,v 1.1 2002/07/26 00:23:13 robertk Exp $
*/
/*
*

View File

@@ -1,4 +1,4 @@
/* $Id$
/* $Id: error.cpp,v 1.3 2003/01/07 16:23:11 robd Exp $
*/
/*
*

View File

@@ -0,0 +1 @@
*.o

View File

@@ -1,4 +1,4 @@
/* $Id$
/* $Id: process.cpp,v 1.6 2003/01/07 16:23:11 robd Exp $
*/
/*
*
@@ -31,7 +31,7 @@ APIRET STDCALL DosSleep(ULONG msec)
}
/* $Id$ */
/* $Id: process.cpp,v 1.6 2003/01/07 16:23:11 robd Exp $ */
/* Terminates the current thread or the current Process.
Decission is made by action
FIXME: move this code to OS2.EXE */

View File

@@ -1,14 +0,0 @@
all:
@echo To build "os2" there are two paths:
@echo ---
@echo 1. copy the os2 folder into the reactos\modules folder
@echo 2. link reactos/modules/os2 to os2
@echo UNIX
@echo cd $${ROS_SRC_ROOT}/reactos/modules
@echo ln -s $${ROS_SRC_ROOT}/os2 os2
@echo WINDOWS
@echo cd %%ROS_SRC_ROOT%%\reactos\modules
@echo junction os2 %%ROS_SRC_ROOT%%\os2
@echo ---
@echo Eventually you can run "make depends" in the %%ROS_SRC_ROOT%%\reactos
@echo directory to compile it.

3
os2/server/.cvsignore Normal file
View File

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

View File

@@ -1,50 +0,0 @@
/* $Id$
*
* dllmain.c - OS/2 Enviroment Subsystem Server
*
* ReactOS Operating System
*
* --------------------------------------------------------------------
*
* This software 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 software 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 software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* --------------------------------------------------------------------
*/
#include "os2srv.h"
#define NDEBUG
#include <debug.h>
/* DLL entry point */
HANDLE Os2SrvDllHandle = 0;
/* FUNCTIONS *****************************************************************/
BOOL STDCALL
DllMain(HANDLE hDll,
DWORD dwReason,
LPVOID lpReserved)
{
if (DLL_PROCESS_ATTACH == dwReason)
{
Os2SrvDllHandle = hDll;
}
return TRUE;
}
/* EOF */

34
os2/server/makefile Normal file
View File

@@ -0,0 +1,34 @@
# $Id: makefile,v 1.3 2003/01/12 02:03:06 robd Exp $
PATH_TO_TOP = ../../reactos
TARGET_TYPE = program
TARGET_NORC = yes
TARGET_APPTYPE = native
TARGET_NAME = os2ss
TARGET_INSTALLDIR = system32
TARGET_CFLAGS = -D__NTAPP__
TARGET_SDKLIBS = ntdll.a kernel32.a csrss.a
TARGET_GCCLIBS = stdc++
OBJECTS_API =
OBJECTS_MISC = \
$(TARGET_NAME).o
TARGET_OBJECTS = \
$(OBJECTS_API) \
$(OBJECTS_MISC)
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -1,3 +0,0 @@
LIBRARY os2srv.dll
EXPORTS
ServerDllInitialization@8

View File

@@ -1,13 +0,0 @@
#ifndef _OS2SS_H_INCLUDED_
#define _OS2SS_H_INCLUDED_
/* PSDK/NDK Headers */
#include <stdio.h>
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
#include <csr/server.h>
#endif /* ndef _OS2SS_H_INCLUDED_ */

View File

@@ -1,4 +0,0 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS-OS/2 Environment Subsystem Server\0"
#define REACTOS_STR_INTERNAL_NAME "os2srv\0"
#define REACTOS_STR_ORIGINAL_FILENAME "os2srv.dll\0"
#include <reactos/version.rc>

View File

@@ -1,11 +0,0 @@
<module name="os2srv" type="nativedll">
<importlibrary definition="os2srv.def" />
<include base="os2srv">.</include>
<define name="__USE_W32API" />
<define name="_DISABLE_TIDENTS" />
<library>ntdll</library>
<library>csrsrv</library>
<file>dllmain.c</file>
<file>server.c</file>
<file>os2srv.rc</file>
</module>

157
os2/server/os2ss.cpp Normal file
View File

@@ -0,0 +1,157 @@
/* $Id: os2ss.cpp,v 1.2 2003/01/07 16:23:12 robd Exp $
*
* reactos/subsys/csrss/api/process.c
*
* "\windows\ApiPort" port process management functions
*
* ReactOS Operating System
*/
// TODO: Rewrite the whole file. This is just a copy
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include <ntos/synch.h>
extern "C" {
BOOL CsrServerInitialization(ULONG ArgumentCount, PWSTR *ArgumentArray);
VOID DisplayString(LPCWSTR lpwString);
//BOOL STDCALL CsrServerInitialization (ULONG ArgumentCount, PWSTR *ArgumentArray);
//VOID STDCALL DisplayString(LPCWSTR lpwString);
//VOID STDCALL PrintString (char* fmt, ...);
//NTSTATUS STDCALL NtDisplayString(IN PUNICODE_STRING DisplayString);
void
DisplayString(LPCWSTR lpwString)
{
UNICODE_STRING us;
RtlInitUnicodeString(&us, lpwString);
NtDisplayString(&us);
}
/*
void
PrintString(char* fmt,...)
{
char buffer[512];
va_list ap;
UNICODE_STRING UnicodeString;
ANSI_STRING AnsiString;
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap);
RtlInitAnsiString(&AnsiString, buffer);
RtlAnsiStringToUnicodeString(&UnicodeString,
&AnsiString,
TRUE);
NtDisplayString(&UnicodeString);
RtlFreeUnicodeString(&UnicodeString);
}
*/
}
/* server variables */
int NumProcesses;
/* Native image's entry point */
void NtProcessStartup (PPEB Peb)
{
PRTL_USER_PROCESS_PARAMETERS ProcParams;
PWSTR ArgBuffer;
PWSTR *argv;
ULONG argc = 0;
int i = 0;
int afterlastspace = 0;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE CsrssInitEvent;
UNICODE_STRING UnicodeString;
NTSTATUS Status;
ProcParams = RtlNormalizeProcessParams (Peb->ProcessParameters);
argv = (PWSTR *)RtlAllocateHeap (Peb->ProcessHeap,
0, 512 * sizeof(PWSTR));
ArgBuffer = (PWSTR)RtlAllocateHeap (Peb->ProcessHeap,
0,
ProcParams->CommandLine.Length + sizeof(WCHAR));
memcpy (ArgBuffer,
ProcParams->CommandLine.Buffer,
ProcParams->CommandLine.Length + sizeof(WCHAR));
while (ArgBuffer[i])
{
if (ArgBuffer[i] == L' ')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
i++;
while (ArgBuffer[i] == L' ')
i++;
afterlastspace = i;
}
else
{
i++;
}
}
if (ArgBuffer[afterlastspace] != L'\0')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
}
RtlInitUnicodeString(&UnicodeString,
L"\\CsrssInitDone");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
EVENT_ALL_ACCESS,
0,
NULL);
Status = NtOpenEvent(&CsrssInitEvent,
EVENT_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DbgPrint("CSR: Failed to open csrss notification event\n");
}
if (CsrServerInitialization (argc, argv) == TRUE)
{
NtSetEvent(CsrssInitEvent,
NULL);
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/* terminate the current thread only */
NtTerminateThread( NtCurrentThread(), 0 );
}
else
{
DisplayString( L"CSR: Subsystem initialization failed.\n" );
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/*
* Tell SM we failed.
*/
NtTerminateProcess( NtCurrentProcess(), 0 );
}
}

View File

@@ -1,84 +0,0 @@
/* $Id$
*
* server.c - OS/2 Enviroment Subsystem Server - Initialization
*
* ReactOS Operating System
*
* --------------------------------------------------------------------
*
* This software 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 software 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 software; see the file COPYING.LIB. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* --------------------------------------------------------------------
*/
#include "os2srv.h"
//#define NDEBUG
#include <debug.h>
HANDLE Os2ApiPort = NULL;
/**********************************************************************
* NAME PRIVATE
* Os2StaticServerThread/1
*/
VOID STDCALL Os2StaticServerThread (PVOID x)
{
NTSTATUS Status = STATUS_SUCCESS;
PPORT_MESSAGE Request = (PPORT_MESSAGE) x;
PPORT_MESSAGE Reply = NULL;
ULONG MessageType = 0;
DPRINT("VMSSRV: %s called\n", __FUNCTION__);
MessageType = Request->u2.s2.Type;
DPRINT("VMSSRV: %s received a message (Type=%d)\n",
__FUNCTION__, MessageType);
switch (MessageType)
{
default:
Reply = Request;
Status = NtReplyPort (Os2ApiPort, Reply);
break;
}
}
/*=====================================================================
* PUBLIC API
*===================================================================*/
NTSTATUS STDCALL ServerDllInitialization (ULONG ArgumentCount,
LPWSTR *Argument)
{
NTSTATUS Status = STATUS_SUCCESS;
DPRINT("VMSSRV: %s called\n", __FUNCTION__);
// Get the listening port from csrsrv.dll
Os2ApiPort = CsrQueryApiPort ();
if (NULL == Os2ApiPort)
{
return STATUS_UNSUCCESSFUL;
}
// Register our message dispatcher
Status = CsrAddStaticServerThread (Os2StaticServerThread);
if (NT_SUCCESS(Status))
{
//TODO: perform the real OS/2 server internal initialization here
}
return Status;
}
/* EOF */

View File

@@ -1,14 +1,154 @@
all:
@echo To build "posix" there are two paths:
@echo ---
@echo 1. copy the posix folder into the reactos\modules folder
@echo 2. link reactos/modules/posix to posix
@echo UNIX
@echo cd $${ROS_SRC_ROOT}/reactos/modules
@echo ln -s $${ROS_SRC_ROOT}/posix posix
@echo WINDOWS
@echo cd %%ROS_SRC_ROOT%%\reactos\modules
@echo junction posix %%ROS_SRC_ROOT%%\posix
@echo ---
@echo Eventually you can run "make depends" in the %%ROS_SRC_ROOT%%\reactos
@echo directory to compile it.
# $Id: Makefile,v 1.7 2003/01/05 18:29:41 robd Exp $
#
# ReactOS POSIX+ Personality
#
PATH_TO_TOP = ../reactos
include $(PATH_TO_TOP)/rules.mak
POSIX_OTHER = server #lib
POSIX_TOOLS = mksystab
POSIX_LIBS = psxdll psxx
POSIX_APPS = baresh posixw32
POSIX_MODULES = $(POSIX_OTHER) $(POSIX_TOOLS) $(POSIX_LIBS) $(POSIX_APPS)
all: implib $(POSIX_MODULES)
implib: $(POSIX_MODULES:%=%_implib)
clean: $(POSIX_MODULES:%=%_clean)
install: $(POSIX_MODULES:%=%_install)
#dist: $(TOOLS_PATH)/rcopy$(EXE_POSTFIX) dist_clean dist_dirs \
# $(POSIX_MODULES:%=%_dist)
.PHONY: all implib clean
#.PHONY: all implib install dist
#
# Other POSIX+ Modules
#
$(POSIX_OTHER): %:
make -f Makefile -C $(POSIX_PATH)/$*
$(POSIX_OTHER:%=%_implib): %_implib:
make -f Makefile -C $(POSIX_PATH)/$* implib
$(POSIX_OTHER:%=%_clean): %_clean:
make -f Makefile -C $(POSIX_PATH)/$* clean
$(POSIX_OTHER:%=%_dist): %_dist:
make -f Makefile -C $(POSIX_PATH)/$* dist
$(POSIX_OTHER:%=%_install): %_install:
make -f Makefile -C $(POSIX_PATH)/$* install
.PHONY: $(POSIX_OTHER) $(POSIX_OTHER:%=%_implib) $(POSIX_OTHER:%=%_clean) $(POSIX_OTHER:%=%_install) $(POSIX_OTHER:%=%_dist)
#
# POSIX+ Tools
#
$(POSIX_TOOLS): %:
make -f Makefile -C $(POSIX_PATH)/tools/$*
$(POSIX_TOOLS:%=%_implib): %_implib:
make -f Makefile -C $(POSIX_PATH)/tools/$* implib
$(POSIX_TOOLS:%=%_clean): %_clean:
make -f Makefile -C $(POSIX_PATH)/tools/$* clean
$(POSIX_TOOLS:%=%_dist): %_dist:
make -f Makefile -C $(POSIX_PATH)/tools/$* dist
$(POSIX_TOOLS:%=%_install): %_install:
make -f Makefile -C $(POSIX_PATH)/tools/$* install
.PHONY: $(POSIX_LIBS) $(POSIX_LIBS:%=%_implib) $(POSIX_LIBS:%=%_clean) $(POSIX_LIBS:%=%_install) $(POSIX_LIBS:%=%_dist)
#
# POSIX+ DLLs
#
$(POSIX_LIBS): %:
make -f Makefile -C $(POSIX_PATH)/lib/$*
$(POSIX_LIBS:%=%_implib): %_implib:
make -f Makefile -C $(POSIX_PATH)/lib/$* implib
$(POSIX_LIBS:%=%_clean): %_clean:
make -f Makefile -C $(POSIX_PATH)/lib/$* clean
$(POSIX_LIBS:%=%_dist): %_dist:
make -f Makefile -C $(POSIX_PATH)/lib/$* dist
$(POSIX_LIBS:%=%_install): %_install:
make -f Makefile -C $(POSIX_PATH)/lib/$* install
.PHONY: $(POSIX_LIBS) $(POSIX_LIBS:%=%_implib) $(POSIX_LIBS:%=%_clean) $(POSIX_LIBS:%=%_install) $(POSIX_LIBS:%=%_dist)
#
# POSIX+ Programs
#
$(POSIX_APPS): %:
make -f Makefile -C $(POSIX_PATH)/apps/$*
$(POSIX_APPS:%=%_implib): %_implib:
make -f Makefile -C $(POSIX_PATH)/apps/$* implib
$(POSIX_APPS:%=%_clean): %_clean:
make -f Makefile -C $(POSIX_PATH)/apps/$* clean
$(POSIX_APPS:%=%_dist): %_dist:
make -f Makefile -C $(POSIX_PATH)/apps/$* dist
$(POSIX_APPS:%=%_install): %_install:
make -f Makefile -C $(POSIX_PATH)/apps/$* install
.PHONY: $(POSIX_APPS) $(POSIX_APPS:%=%_implib) $(POSIX_APPS:%=%_clean) $(POSIX_APPS:%=%_install) $(POSIX_APPS:%=%_dist)
etags:
find . -name "*.[ch]" -print | etags --language=c -
# EOF
#CFLAGS=-Iinclude
#all: lib/crt0w32.o
# make -C tools
# make -C lib
# make -C server
# make -C lib/psxdll
# make -C lib/psxx
# make -C apps/baresh
# make -C apps/posixw32
#lib/crt0w32.o: lib/crt0w32.c
#implib:
#clean:
# make -C lib clean
# make -C tools clean
# make -C server clean
# make -C lib/psxdll clean
# make -C lib/psxx clean
# make -C apps/baresh clean
# make -C apps/posixw32 clean
# - $(RM) lib/crt0w32.o
#include $(PATH_TO_TOP)/rules.mak
# EOF

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,14 +0,0 @@
<group>
<directory name="tools">
<xi:include href="tools/directory.xml" />
</directory>
<directory name="apps">
<xi:include href="apps/directory.xml" />
</directory>
<directory name="lib">
<xi:include href="lib/directory.xml" />
</directory>
<directory name="server">
<xi:include href="server/psxsrv.xml" />
</directory>
</group>

View File

@@ -4,7 +4,7 @@ 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>
Richard Campbell <eek2121@comcast.net>
Gunnar Andre' Dalsnes <hardon@online.no>
Arindam Das
Boudewijn Dekker <ariadne@xs4all.nl>

View File

@@ -290,11 +290,9 @@ 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) \
@@ -308,10 +306,6 @@ 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)

View File

@@ -1,80 +1,77 @@
<?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>
<?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>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,3 +1,3 @@
<directory name="utils">
<xi:include href="utils/directory.xml" />
</directory>
<directory name="utils">
<xi:include href="utils/directory.xml" />
</directory>

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,10 @@
<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>
<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>

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,23 +1,4 @@
/*
* 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
@@ -27,7 +8,8 @@
* GM 27/06/05 Created
*
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
@@ -36,101 +18,29 @@
#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 PrintEntries(PMIB_IPNETROW pIpAddRow);
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.
@@ -152,99 +62,136 @@ INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
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)
if (pIpNetTable != NULL) {
GetIpNetTable(pIpNetTable, &ulSize, TRUE);
else
{
} else {
_tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
free(pIpNetTable);
exit(EXIT_FAILURE);
return -1;
}
/* check there are entries in the table */
if (pIpNetTable->dwNumEntries == 0)
{
/* check there are entries in the table */
if (pIpNetTable->dwNumEntries == 0) {
_tprintf(_T("No ARP entires found\n"));
free(pIpNetTable);
exit(EXIT_FAILURE);
return -1;
}
/* 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 */
* 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)
{
if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR) { // NO_ERROR = 0
_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);
for (k=0; k < pIpAddrTable->dwNumEntries; k++) {
if (pIpNetTable->table[0].dwIndex == pIpAddrTable->table[k].dwIndex) {
//printf("printing 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++)
{
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;
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)
if (strcmp(pszIpAddr, pszInetAddr) == 0) {
PrintEntries(&pIpNetTable->table[i]);
}
else
}
} else {
/* if an address is not supplied, print all entries */
PrintEntries(&pIpNetTable->table[i]);
}
}
free(pIpNetTable);
free(pIpAddrTable);
return EXIT_SUCCESS;
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)); //error checking
/* 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 0;
}
/*
*
* 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
* Fill out an MIB_IPNETROW structure and insert the data into the
* ARP cache as a static entry.
*
*/
@@ -252,101 +199,73 @@ INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
{
PMIB_IPNETROW pAddHost;
PMIB_IPADDRTABLE pIpAddrTable;
PMIB_IPNETTABLE pIpNetTable;
DWORD dwIpAddr = 0;
DWORD dwIpAddr;
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)
{
if (pszInetAddr != NULL) {
if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE) {
_tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr);
exit(EXIT_FAILURE);
return -1;
}
}
else
{
} 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;
}
/* check MAC address */
if (strlen(pszEthAddr) != 17) {
_tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr);
return -1;
}
for (i=0; i<17; i++) {
if (pszEthAddr[i] == SEPERATOR) {
continue;
}
if (!isxdigit(pszEthAddr[i])) {
_tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr);
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
/* set dwIndex field to the index of a local IP address to
* indicate the network on which the ARP entry applies */
if (pszIfAddr)
if (pszIfAddr) {
sscanf(pszIfAddr, "%lx", &pAddHost->dwIndex);
else
{
/* map the IP to the index */
} 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)
{
if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR) { // NO_ERROR = 0
_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;
printf("printing pIpAddrTable->table[0].dwIndex = %lx\n", pIpAddrTable->table[0].dwIndex);
pAddHost->dwIndex = 4;
free(pIpAddrTable);
}
/* Set MAC address to 6 bytes (typical) */
pAddHost->dwPhysAddrLen = 6;
/* Encode bPhysAddr into correct byte array */
for (i=0; i<6; i++)
{
for (i=0; i<6; i++) {
val =0;
c = toupper(pszEthAddr[i*3]);
c = c - (isdigit(c) ? '0' : ('A' - 10));
@@ -356,155 +275,103 @@ INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
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);
if ((iRet = SetIpNetEntry(pAddHost)) != NO_ERROR) {
_tprintf(_T("The ARP entry addition failed: %d\n"), iRet);
return -1;
}
free(pAddHost);
return EXIT_SUCCESS;
return 0;
}
/*
*
* Takes an internet address and an optional interface address as
* 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.
* Add the interface number and IP to an MIB_IPNETROW structure
* and remove the entrty 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 dwIpAddr;
DWORD dwSize = 0;
INT iRet;
BOOL bFlushTable = FALSE;
INT iret;
/* 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)
{
if (pszInetAddr != NULL) {
if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE) {
_tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr);
exit(EXIT_FAILURE);
return -1;
}
}
else
{
} 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
/* set dwIndex field to the index of a local IP address to
* indicate the network on which the ARP entry applies */
if (pszIfAddr)
if (pszIfAddr) {
sscanf(pszIfAddr, "%lx", &pDelHost->dwIndex);
else
{
} else {
/* map the IP to the index */
if (GetIpAddrTable(pIpAddrTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER)
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);
}
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;
pDelHost->dwIndex = 4; //pIpAddrTable->table[0].dwIndex;
}
/* 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);
if ((iret = DeleteIpNetEntry(pDelHost)) != NO_ERROR) {
_tprintf(_T("The ARP entry deletion failed: %d\n"), iret);
return -1;
}
free(pIpAddrTable);
free(pDelHost);
return EXIT_SUCCESS;
return 0;
}
/*
*
* print program usage to screen
*
*/
*/
VOID Usage(VOID)
{
_tprintf(_T("\nDisplays and modifies the IP-to-Physical address translation tables used by\n"
@@ -537,10 +404,10 @@ VOID Usage(VOID)
" > 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
@@ -548,37 +415,35 @@ VOID Usage(VOID)
*/
INT main(int argc, char* argv[])
{
if ((argc < 2) || (argc > 5))
const char N[] = "-N";
if ((argc < 2) || (argc > 5))
{
Usage();
return EXIT_FAILURE;
return FALSE;
}
if (argv[1][0] == '-')
{
switch (argv[1][1])
{
case 'a': /* fall through */
case 'g':
if (argc == 2)
if (argv[1][0] == '-') {
switch (argv[1][1]) {
/* FIX ME */
/* need better control for -a, as -N might not be arg 4 */
case 'a': 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))
else if ((argc == 5) && ((strcmp(argv[3], N)) == 0))
DisplayArpEntries(argv[2], argv[4]);
else
Usage();
return EXIT_FAILURE;
break;
case 'g': 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);
@@ -586,17 +451,15 @@ INT main(int argc, char* argv[])
Addhost(argv[2], argv[3], argv[4]);
else
Usage();
return EXIT_FAILURE;
break;
default:
Usage();
return EXIT_FAILURE;
return -1;
}
}
else
} else {
Usage();
return EXIT_SUCCESS;
} /*
warning: suggest parentheses around assignment used as truth value
warning: char format, void arg (arg 2)*/
return -1;
}
return 0;
}

View File

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

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

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// 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,33 +1,30 @@
<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="tcpsvcs">
<xi:include href="tcpsvcs/tcpsvcs.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>
<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

@@ -74,6 +74,7 @@ int lflag, mflag, pplan, sflag;
static void userlist(int, char **);
void usage();
void netfinger(char *);
int
main(int argc, char **argv)

View File

@@ -1,12 +1,12 @@
<module name="finger" type="win32cui" installbase="system32" installname="finger.exe">
<include base="finger">.</include>
<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>
<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

@@ -42,8 +42,6 @@ static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91";
#include <stdlib.h>
#include <string.h>
#include "getopt.h"
/*
* get option letter from argument vector
*/

View File

@@ -31,6 +31,4 @@ typedef long uid_t; // SunOS 5.5
#define index(s, c) strchr(s, c)
#define rindex(s, c) strrchr(s, c)
void netfinger(char *);
#endif

View File

@@ -46,6 +46,7 @@ static char sccsid[] = "@(#)cmds.c 5.18 (Berkeley) 4/20/89";
#include "prototypes.h"
extern char *globerr;
extern char **glob();
extern char home[];
extern char *remglob();
extern char *getenv();
@@ -66,7 +67,7 @@ extern int autologin;
*/
void setpeer(int argc, char *argv[])
{
char *host;
char *host, *hookup();
if (connected) {
printf("Already connected to %s, use close first.\n",
@@ -265,9 +266,9 @@ void setebcdic()
/*
* Set file transfer mode.
*/
#if 0
/*ARGSUSED*/
void fsetmode(argc, argv)
void setmode(argc, argv)
char *argv[];
{
@@ -275,7 +276,7 @@ void fsetmode(argc, argv)
(void) fflush(stdout);
code = -1;
}
#endif
/*
* Set file transfer format.
@@ -378,6 +379,7 @@ void mput(argc, argv)
{
register int i;
int ointer;
void mabort();
extern jmp_buf jabort;
char *tp;
@@ -648,8 +650,7 @@ usage:
return (0);
}
#if 0
static void
void
mabort()
{
int ointer;
@@ -669,7 +670,6 @@ mabort()
mflag = 0;
longjmp(jabort,0);
}
#endif
/*
* Get multiple files.
@@ -679,6 +679,7 @@ void mget(argc, argv)
{
char *cp, *tp, *tp2, tmpbuf[MAXPATHLEN];
int ointer;
void mabort();
extern jmp_buf jabort;
if (argc < 2) {
@@ -808,7 +809,7 @@ remglob(argv,doswitch)
return (buf);
}
static char *
char *
onoff(bool)
int bool;
{
@@ -1093,6 +1094,7 @@ void mdelete(argc, argv)
{
char *cp;
int ointer;
void mabort();
extern jmp_buf jabort;
if (argc < 2) {
@@ -1215,6 +1217,7 @@ void mls(argc, argv)
{
char *cmd, mode[1], *dest;
int ointer, i;
void mabort();
extern jmp_buf jabort;
if (argc < 2) {
@@ -1273,7 +1276,7 @@ void mls(argc, argv)
* Do a shell escape
*/
/*ARGSUSED*/
void shell(argc, argv)
int shell(argc, argv)
char *argv[];
{
#if 0
@@ -1341,7 +1344,7 @@ void shell(argc, argv)
if (NumBytes == 0)
{
return;
return(-1);
}
AppName = ShellCmd;
@@ -1388,12 +1391,21 @@ void shell(argc, argv)
CloseHandle( ProcessInformation.hProcess);
}
if (Result)
{
return(-1);
}
else
{
return(0);
}
}
/*
* Send new user information (re-login)
*/
void user(argc, argv)
int user(argc, argv)
int argc;
char **argv;
{
@@ -1413,7 +1425,7 @@ void user(argc, argv)
printf("usage: %s username [password] [account]\n", argv[0]);
(void) fflush(stdout);
code = -1;
return;
return (0);
}
n = command("USER %s", argv[1]);
if (n == CONTINUE) {
@@ -1435,11 +1447,12 @@ void user(argc, argv)
if (n != COMPLETE) {
fprintf(stdout, "Login failed.\n");
(void) fflush(stdout);
return;
return (0);
}
if (!aflag && argc == 4) {
(void) command("ACCT %s", argv[3]);
}
return (1);
}
/*
@@ -1704,15 +1717,13 @@ int confirm(cmd, file)
return (*line != 'n' && *line != 'N');
}
#if 0
static void fatal(msg)
void fatal(msg)
char *msg;
{
fprintf(stderr, "ftp: %s\n", msg);
exit(1);
}
#endif
/*
* Glob a local file name specification with
@@ -1774,8 +1785,7 @@ void account(argc,argv)
jmp_buf abortprox;
#if 0
static void
void
proxabort()
{
extern int proxy;
@@ -1792,12 +1802,12 @@ proxabort()
pswitch(0);
longjmp(abortprox,1);
}
#endif
void doproxy(argc,argv)
int argc;
char *argv[];
{
void proxabort();
register struct cmd *c;
struct cmd *getcmd();
// extern struct cmd cmdtab[];

View File

@@ -24,6 +24,20 @@ static char sccsid[] = "@(#)cmdtab.c 5.9 (Berkeley) 3/21/89";
/*
* User FTP -- Command Tables.
*/
int setascii(), setbell(), setbinary(), setdebug(), setform();
int setglob(), sethash(), setmode(), setpeer(), setpassive(), setport();
int setprompt(), setstruct();
int settenex(), settrace(), settype(), setverbose();
int disconnect(), restart(), reget(), syst();
int cd(), lcd(), delete(), mdelete(), user();
int ls(), mls(), get(), mget(), help(), append(), put(), mput();
int quit(), renamefile(), status();
int quote(), rmthelp(), shell(), site();
int pwd(), makedir(), removedir(), setcr();
int account(), doproxy(), reset(), setcase(), setntrans(), setnmap();
int setsunique(), setrunique(), cdup(), macdef(), domacro();
int sizecmd(), modtime(), newer(), rmtstatus();
int do_chmod(), do_umask(), idle();
char accounthelp[] = "send account command to remote server";
char appendhelp[] = "append to a file";
@@ -126,7 +140,7 @@ struct cmd cmdtab[] = {
{ "mget", mgethelp, 1, 1, 1, mget },
{ "mkdir", mkdirhelp, 0, 1, 1, makedir },
{ "mls", mlshelp, 1, 1, 1, mls },
{ "mode", modehelp, 0, 1, 1, fsetmode },
{ "mode", modehelp, 0, 1, 1, setmode },
{ "modtime", modtimehelp, 0, 1, 1, modtime },
{ "mput", mputhelp, 1, 1, 1, mput },
{ "newer", newerhelp, 1, 1, 1, newer },

View File

@@ -36,6 +36,7 @@ void domacro(argc, argv)
register char *cp1, *cp2;
int count = 2, loopflg = 0;
char line2[200];
extern char **glob();
struct cmd *getcmd(), *c;
if (argc < 2) {

View File

@@ -35,11 +35,12 @@ void blkfree(char **av0)
free(*av++);
}
char **glob(register char *v)
char *glob(register char *v)
{
return NULL;
}
int sleep(int time)
{
return time;
@@ -49,8 +50,8 @@ int herror(char *string)
{
return 0;
}
#if 0
int gettimeofday(struct timeval *timenow,
struct timezone *zone)
{
@@ -293,13 +294,11 @@ char *getpass (const char * prompt)
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)

View File

@@ -260,7 +260,7 @@ int login(char *host)
return (1);
}
static void
void
cmdabort(int sig)
{
extern jmp_buf ptabort;
@@ -422,7 +422,7 @@ getreply(expecteof)
}
}
static int
int
empty(mask, sec)
struct fd_set *mask;
int sec;
@@ -436,7 +436,6 @@ empty(mask, sec)
jmp_buf sendabort;
#if 0
void abortsend()
{
@@ -446,7 +445,6 @@ void abortsend()
(void) fflush(stdout);
longjmp(sendabort, 1);
}
#endif
#define HASHBYTES 1024
@@ -456,6 +454,7 @@ void sendrequest(char *cmd, char *local, char *remote, int printnames)
int dout = 0;
int (*closefunc)(), _pclose(), fclose();
sig_t (*oldintr)(), (*oldintp)();
void abortsend();
char buf[BUFSIZ], *bufp;
long bytes = 0, hashbytes = HASHBYTES;
register int c, d;
@@ -711,7 +710,7 @@ null();// (void) signal(SIGPIPE, oldintp);
jmp_buf recvabort;
#if 0
void abortrecv()
{
@@ -721,17 +720,17 @@ void abortrecv()
(void) fflush(stdout);
longjmp(recvabort, 1);
}
#endif
void recvrequest(char *cmd, char *local, char *remote, char *mode,
int printnames)
{
FILE *fout = stdout;
FILE *fout;
int din = 0;
int (*closefunc)(), _pclose(), fclose();
void (*oldintr)(int), (*oldintp)(int);
int oldverbose = 0, oldtype = 0, is_retr, tcrflag, nfnd, bare_lfs = 0;
char msg;
void abortrecv();
int oldverbose, oldtype = 0, is_retr, tcrflag, nfnd, bare_lfs = 0;
char *gunique(), msg;
// static char *buf; // Szurgot: Shouldn't this go SOMEWHERE?
char buf[1024];
static int bufsize = 1024;
@@ -1418,7 +1417,6 @@ void pswitch(int flag)
jmp_buf ptabort;
int ptabflg;
#if 0
void
abortpt()
{
@@ -1429,12 +1427,12 @@ abortpt()
abrtflag = 0;
longjmp(ptabort, 1);
}
#endif
void proxtrans(cmd, local, remote)
char *cmd, *local, *remote;
{
// void (*oldintr)(int);
//void abortpt(int);
int tmptype, oldtype = 0, secndflag = 0, nfnd;
extern jmp_buf ptabort;
char *cmd2;
@@ -1758,7 +1756,6 @@ void reset()
}
}
#if 0
char *
gunique(local)
char *local;
@@ -1805,7 +1802,6 @@ gunique(local)
}
return(new);
}
#endif
int null(void)
{

View File

@@ -1,16 +1,16 @@
<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>
<module name="ftp" type="win32cui" installbase="system32" installname="ftp.exe" warnings="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,10 +1,18 @@
#include <winsock.h>
#include "fake.h"
#include "prototypes.h"
#include <setjmp.h>
//typedef void (*Sig_t)(int);
int fgetcSocket(int s);
char *fputsSocket(char *format, int s);
char *fprintfSocket(int s, char *format, ...);
int fputcSocket(int s, char putChar);
int fputSocket(int s, char *putChar, int len);
char *fgetsSocket(int s, char *string);
/* The following defines are from ftp.h and telnet.h from bsd.h */
/* All relevent copyrights below apply. */
@@ -145,7 +153,7 @@ struct cmd {
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 */
int (*c_handler)(); /* function to call */
};
struct macel {
@@ -158,6 +166,11 @@ int macnum; /* number of defined macros */
struct macel macros[16];
char macbuf[4096];
extern char *tail();
extern char *remglob();
extern int errno;
extern char *mktemp();
#if defined(__ANSI__) || defined(sparc)
typedef void sig_t;
#else
@@ -165,4 +178,4 @@ typedef int sig_t;
#endif
typedef int uid_t;
int herror(char *s);

View File

@@ -121,7 +121,6 @@ int mflag; /* flag: if != 0, then active multi command */
int options; /* used during socket creation */
static char *slurpstring();
int main(int argc, char *argv[])
@@ -311,6 +310,8 @@ void cmdscanner(top)
int top;
{
register struct cmd *c;
struct cmd *getcmd();
extern int help();
if (!top)
(void) putchar('\n');
@@ -394,6 +395,7 @@ int slrflag;
void makeargv()
{
char **argp;
char *slurpstring();
margc = 0;
argp = margv;
@@ -409,7 +411,7 @@ void makeargv()
* implemented with FSM to
* handle quoting and strings
*/
static char *
char *
slurpstring()
{
int got_one = 0;
@@ -533,7 +535,7 @@ OUT1:
* Help command.
* Call each command handler with argc == 0 and argv[0] == name.
*/
void help(argc, argv)
int help(argc, argv)
int argc;
char *argv[];
{
@@ -580,7 +582,7 @@ void help(argc, argv)
}
}
(void) fflush(stdout);
return;
return 0;
}
while (--argc > 0) {
register char *arg;
@@ -595,4 +597,5 @@ void help(argc, argv)
c->c_name, c->c_help);
}
(void) fflush(stdout);
return 0;
}

View File

@@ -1,17 +1,4 @@
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);
@@ -42,25 +29,3 @@ 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

@@ -73,7 +73,7 @@ static TCHAR* GetInterfaceTypeName(UINT nInterfaceType)
}
}
static void PrintPhysicalAddr(PBYTE Addr, UINT len)
void PrintPhysicalAddr(PBYTE Addr, UINT len)
{
UINT i=0;
for (i=0; i<len; i++)
@@ -188,7 +188,7 @@ typedef struct _IP_INTERFACE_INFO {
*/
result = GetInterfaceInfo(pIfTable, &dwOutBufLen);
if (result == NO_ERROR) {
INT i;
UINT 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);

View File

@@ -1,10 +1,10 @@
<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>
<module name="ipconfig" type="win32cui" installbase="system32" installname="ipconfig.exe" warnings="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>

File diff suppressed because it is too large Load Diff

View File

@@ -1,61 +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, PCHAR name, int namelen);
PCHAR GetIpHostName(BOOL local, UINT ipaddr, PCHAR name, int namelen);
VOID Usage(VOID);

View File

@@ -1,7 +1,40 @@
#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"
/* $Id$ */
#include <windows.h>
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 netstat\0"
#define REACTOS_STR_INTERNAL_NAME "netstat\0"
#define REACTOS_STR_ORIGINAL_FILENAME "netstat.exe\0"
#include <reactos/version.rc>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
#ifdef __GNUC__
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS netstat"
IDS_APP_USAGE "\n"\
"Displays current TCP/IP protocol statistics and network connections.\n\n"\
"NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]\n\n"\
" -a Displays all connections and listening ports.\n"\
" -e Displays Ethernet statistics. May be combined with -s\n"\
" -n Displays address and port numbers in numeric form.\n"\
" -p proto Shows connections for protocol 'proto' TCP or UDP.\n"\
" If used with the -s option to display\n"\
" per-protocol statistics, 'proto' may be TCP, UDP, or IP.\n"\
" -r Displays the current routing table.\n"\
" -s Displays per-protocol statistics. Statistics are shown for\n"\
" TCP, UDP and IP by default; use -p option to display\n"\
" information about a subset of the protocols only.\n"\
" interval Redisplays selected statistics every 'interval' seconds.\n"\
" Press CTRL+C to stop redisplaying. By default netstat will\n"\
" print the current information only once.\n"
END
#endif

View File

@@ -1,13 +1,14 @@
<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>
<module name="netstat" type="win32cui" installbase="system32" installname="netstat.exe" warnings="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>trace.c</file>
<file>netstat.rc</file>
</module>

View File

@@ -0,0 +1,7 @@
#define RES_FIRST_INDEX 1
#define RES_LAST_INDEX 25
#define IDS_APP_TITLE 100
#define IDS_APP_USAGE 101

View File

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

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

@@ -104,9 +104,9 @@ 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(
VOID DisplayBuffer(
PVOID Buffer,
DWORD Size)
{
@@ -123,10 +123,9 @@ static VOID DisplayBuffer(
printf("%02X ", (p[i]) & 0xFF);
}
}
#endif /* DBG */
/* Display usage information on screen */
static VOID Usage(VOID)
VOID Usage(VOID)
{
printf("\nUsage: ping [-t] [-n count] [-l size] [-w timeout] destination-host\n\n");
printf("Options:\n");
@@ -138,7 +137,7 @@ static VOID Usage(VOID)
}
/* Reset configuration to default values */
static VOID Reset(VOID)
VOID Reset(VOID)
{
LARGE_INTEGER PerformanceCounterFrequency;
@@ -174,7 +173,7 @@ static VOID Reset(VOID)
}
/* Return ULONG in a string */
static ULONG GetULONG(LPSTR String)
ULONG GetULONG(LPSTR String)
{
UINT i, Length;
ULONG Value;
@@ -192,7 +191,7 @@ static ULONG GetULONG(LPSTR String)
}
/* Return ULONG in a string. Try next paramter if not successful */
static ULONG GetULONG2(LPSTR String1, LPSTR String2, PINT i)
ULONG GetULONG2(LPSTR String1, LPSTR String2, PINT i)
{
ULONG Value;
@@ -210,7 +209,7 @@ static ULONG GetULONG2(LPSTR String1, LPSTR String2, PINT i)
}
/* Parse command line parameters */
static BOOL ParseCmdline(int argc, char* argv[])
BOOL ParseCmdline(int argc, char* argv[])
{
INT i;
BOOL ShowUsage;
@@ -279,7 +278,7 @@ static BOOL ParseCmdline(int argc, char* argv[])
}
/* Calculate checksum of data */
static WORD Checksum(PUSHORT data, UINT size)
WORD Checksum(PUSHORT data, UINT size)
{
ULONG sum = 0;
@@ -298,7 +297,7 @@ static WORD Checksum(PUSHORT data, UINT size)
}
/* Prepare to ping target */
static BOOL Setup(VOID)
BOOL Setup(VOID)
{
WORD wVersionRequested;
WSADATA WsaData;
@@ -355,7 +354,7 @@ static BOOL Setup(VOID)
}
/* Close socket */
static VOID Cleanup(VOID)
VOID Cleanup(VOID)
{
if (IcmpSock != INVALID_SOCKET)
closesocket(IcmpSock);
@@ -363,7 +362,7 @@ static VOID Cleanup(VOID)
WSACleanup();
}
static VOID QueryTime(PLARGE_INTEGER Time)
VOID QueryTime(PLARGE_INTEGER Time)
{
if (UsePerformanceCounter) {
if (QueryPerformanceCounter(Time) == 0) {
@@ -385,7 +384,7 @@ static VOID QueryTime(PLARGE_INTEGER Time)
}
}
static VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
{
CHAR Convstr[40];
LARGE_INTEGER LargeTime;
@@ -399,7 +398,7 @@ static VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
/* 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)
BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
{
PIPv4_HEADER IpHeader;
PICMP_ECHO_PACKET Icmp;
@@ -463,7 +462,7 @@ static BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
}
/* Send and receive one ping */
static BOOL Ping(VOID)
BOOL Ping(VOID)
{
INT Status;
SOCKADDR From;

View File

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

@@ -15,294 +15,142 @@
#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") );
int usage() {
fprintf( stderr,
"route usage:\n"
"route print\n"
" prints the route table\n"
"route add <target> [mask <mask>] <gw> [metric <m>]\n"
" adds a route\n"
"route delete <target> <gw>\n"
" deletes a route\n" );
return 1;
}
static int PrintRoutes()
{
int print_routes() {
PMIB_IPFORWARDTABLE IpForwardTable = NULL;
PIP_ADAPTER_INFO pAdapterInfo;
DWORD Error;
ULONG Size = 0;
DWORD Error = 0;
ULONG adaptOutBufLen = sizeof(IP_ADAPTER_INFO);
TCHAR DefGate[16];
TCHAR Destination[IPBUF], Gateway[IPBUF], Netmask[IPBUF];
char 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( (Error = GetIpForwardTable( NULL, &Size, TRUE )) ==
ERROR_INSUFFICIENT_BUFFER ) {
IpForwardTable = malloc( Size );
Error = GetIpForwardTable( IpForwardTable, &Size, TRUE );
}
if( (GetIpForwardTable( NULL, &Size, TRUE )) == ERROR_INSUFFICIENT_BUFFER )
{
if (!(IpForwardTable = malloc( Size )))
{
free(pAdapterInfo);
Error = ERROR_NOT_ENOUGH_MEMORY;
goto Error;
}
}
if( Error == ERROR_SUCCESS ) {
printf( "%-16s%-16s%-16s%-10s%-10s\n",
"Destination",
"Netmask",
"Gateway",
"Index",
"Metric" );
for( i = 0; i < IpForwardTable->dwNumEntries; i++ ) {
strcpy( Destination,
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].
dwForwardDest) ) );
strcpy( Netmask,
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].
dwForwardMask) ) );
strcpy( Gateway,
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].
dwForwardNextHop) ) );
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"));
printf( "%-16s%-16s%-16s%-10ld%-10ld\n",
Destination,
Netmask,
Gateway,
IpForwardTable->table[i].dwForwardIfIndex,
IpForwardTable->table[i].dwForwardMetric1 );
}
_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) ) );
free( IpForwardTable );
_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;
return ERROR_SUCCESS;
} else {
fprintf( stderr, "Route enumerate failed\n" );
return Error;
}
}
static int convert_add_cmd_line( PMIB_IPFORWARDROW RowToAdd,
int argc, TCHAR **argv ) {
int convert_add_cmd_line( PMIB_IPFORWARDROW RowToAdd,
int argc, char **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
}
if( argc > 1 ) RowToAdd->dwForwardDest = inet_addr( argv[0] );
else return FALSE;
for( i = 1; i < argc; i++ ) {
if( !strcasecmp( argv[i], "mask" ) ) {
i++; if( i >= argc ) return FALSE;
RowToAdd->dwForwardMask = inet_addr( argv[i] );
} else if( !strcasecmp( argv[i], "metric" ) ) {
i++; if( i >= argc ) return FALSE;
RowToAdd->dwForwardMetric1 = atoi( argv[i] );
} else {
RowToAdd->dwForwardNextHop = inet_addr( argv[i] );
}
}
return TRUE;
}
static int add_route( int argc, TCHAR **argv ) {
int add_route( int argc, char **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( argc < 2 || !convert_add_cmd_line( &RowToAdd, argc, argv ) ) {
fprintf( stderr,
"route add usage:\n"
"route add <target> [mask <mask>] <gw> [metric <m>]\n"
" Adds a route to the IP route table.\n"
" <target> is the network or host to add a route to.\n"
" <mask> is the netmask to use (autodetected if unspecified)\n"
" <gw> is the gateway to use to access the network\n"
" <m> is the metric to use (lower is preferred)\n" );
return 1;
}
if( (Error = CreateIpForwardEntry( &RowToAdd )) == ERROR_SUCCESS )
return 0;
return 0;
_ftprintf( stderr, _T("Route addition failed\n") );
fprintf( stderr, "Route addition failed\n" );
return Error;
}
static int del_route( int argc, TCHAR **argv )
{
int del_route( int argc, char **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( argc < 2 || !convert_add_cmd_line( &RowToDel, argc, argv ) ) {
fprintf( stderr,
"route delete usage:\n"
"route delete <target> <gw>\n"
" Removes a route from the IP route table.\n"
" <target> is the network or host to add a route to.\n"
" <gw> is the gateway to remove the route from.\n" );
return 1;
}
if( (Error = DeleteIpForwardEntry( &RowToDel )) == ERROR_SUCCESS )
return 0;
return 0;
_ftprintf( stderr, _T("Route addition failed\n") );
fprintf( stderr, "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();
int main( int argc, char **argv ) {
if( argc < 2 ) return usage();
else if( !strcasecmp( argv[1], "print" ) )
return print_routes();
else if( !strcasecmp( argv[1], "add" ) )
return add_route( argc-2, argv+2 );
else if( !strcasecmp( argv[1], "delete" ) )
return del_route( argc-2, argv+2 );
else return usage();
}
#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,11 +1,9 @@
<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>
<module name="route" type="win32cui" installbase="system32" installname="route.exe" warnings="true">
<include base="route">.</include>
<define name="__USE_W32API" />
<library>kernel32</library>
<library>ws2_32</library>
<library>iphlpapi</library>
<file>route.c</file>
<file>route.rc</file>
</module>

View File

@@ -1,114 +0,0 @@
#include <stdio.h>
#include <winsock2.h>
#include <tchar.h>
#include "tcpsvcs.h"
DWORD WINAPI ChargenHandler(VOID* Sock_)
{
DWORD Retval = 0;
SOCKET Sock = (SOCKET)Sock_;
if (!GenerateChars(Sock))
{
_tprintf(_T("Char generation failed\n"));
Retval = 3;
}
_tprintf(_T("Shutting connection down...\n"));
if (ShutdownConnection(Sock, FALSE))
_tprintf(_T("Connection is down.\n"));
else
{
_tprintf(_T("Connection shutdown failed\n"));
Retval = 3;
}
_tprintf(_T("Terminating chargen thread\n"));
ExitThread(0);
return Retval;
}
BOOL GenerateChars(SOCKET Sock)
{
int i;
int charIndex; /* internal loop */
int loopIndex; /* line loop */
char ring[END-START];
char *endring;
char Line[LINESIZ];
/* fill ring with printable characters */
for (charIndex=0, i=START; i<=END; charIndex++, i++)
ring[charIndex] = i;
/* establish the end character in the ring */
endring = &ring[charIndex];
/* where we will start output from */
loopIndex = 0;
while (1)
{
/* if the loop index is equal to the last char,
* start the loop again from the beginning */
if (loopIndex == END-START)
loopIndex = 0;
/* start printing from char controled by loopIndex */
charIndex = loopIndex;
for (i=0; i < LINESIZ - 2; i++)
{
Line[i] = ring[charIndex];
if (ring[charIndex] == *endring)
charIndex = 0;
else
charIndex++;
}
Line[LINESIZ - 2] = L'\r';
Line[LINESIZ - 1] = L'\n';
if (!SendLine(Sock, Line))
break;
/* increment loop index to start printing from next char in ring */
loopIndex++;
}
return TRUE;
}
BOOL SendLine(SOCKET Sock, TCHAR* Line)
{
INT RetVal;
INT SentBytes;
INT LineSize;
LineSize = sizeof(TCHAR) * LINESIZ;
SentBytes = 0;
RetVal = send(Sock, Line, LineSize, 0);
/*FIXME: need to establish if peer closes connection,
not just report a socket error */
if (RetVal > 0)
{
if (RetVal != LineSize)
{
_tprintf(("Not sent enough\n"));
return FALSE;
}
SentBytes += RetVal;
return TRUE;
}
else if (RetVal == SOCKET_ERROR)
{
_tprintf(("Socket error\n"));
return FALSE;
}
else
_tprintf(("unknown error\n"));
//WSAGetLastError()
_tprintf(("Connection closed by peer.\n"));
return TRUE;
}

View File

@@ -1,46 +0,0 @@
#include <stdio.h>
#include <winsock2.h>
#include <tchar.h>
#include <time.h>
#include "tcpsvcs.h"
DWORD WINAPI DaytimeHandler(VOID* Sock_)
{
struct tm *newtime;
time_t aclock;
TCHAR *pszTime;
DWORD Retval = 0;
SOCKET Sock = (SOCKET)Sock_;
time(&aclock);
newtime = localtime(&aclock);
pszTime = _tasctime(newtime);
SendTime(Sock, pszTime);
_tprintf(_T("Shutting connection down...\n"));
if (ShutdownConnection(Sock, FALSE))
_tprintf(_T("Connection is down.\n"));
else
{
_tprintf(_T("Connection shutdown failed\n"));
Retval = 3;
}
_tprintf(_T("Terminating daytime thread\n"));
ExitThread(0);
return Retval;
}
BOOL SendTime(SOCKET Sock, TCHAR *time)
{
INT StringSize = strlen(time);
INT RetVal = send(Sock, time, sizeof(TCHAR) * StringSize, 0);
if (RetVal == SOCKET_ERROR)
return FALSE;
_tprintf(("Connection closed by peer.\n"));
return TRUE;
}

View File

@@ -1,54 +0,0 @@
#include <stdio.h>
#include <winsock2.h>
#include <tchar.h>
#include "tcpsvcs.h"
DWORD WINAPI DiscardHandler(VOID* Sock_)
{
DWORD Retval = 0;
SOCKET Sock = (SOCKET)Sock_;
if (!RecieveIncomingPackets(Sock))
{
_tprintf(_T("RecieveIncomingPackets failed\n"));
Retval = 3;
}
_tprintf(_T("Shutting connection down...\n"));
if (ShutdownConnection(Sock, TRUE))
{
_tprintf(_T("Connection is down.\n"));
}
else
{
_tprintf(_T("Connection shutdown failed\n"));
Retval = 3;
}
_tprintf(_T("Terminating discard thread\n"));
ExitThread(0);
return Retval;
}
BOOL RecieveIncomingPackets(SOCKET Sock)
{
TCHAR ReadBuffer[BUF];
INT ReadBytes;
do
{
ReadBytes = recv(Sock, ReadBuffer, BUF, 0);
if (ReadBytes > 0)
_tprintf(_T("Received %d bytes from client\n"), ReadBytes);
else if (ReadBytes == SOCKET_ERROR)
{
_tprintf(("Socket Error: %d\n"), WSAGetLastError());
return FALSE;
}
} while (ReadBytes > 0);
_tprintf(("Connection closed by peer.\n"));
return TRUE;
}

View File

@@ -1,74 +0,0 @@
#include <stdio.h>
#include <winsock2.h>
#include <tchar.h>
#include "tcpsvcs.h"
DWORD WINAPI EchoHandler(VOID* Sock_)
{
DWORD Retval = 0;
SOCKET Sock = (SOCKET)Sock_;
if (!EchoIncomingPackets(Sock)) {
_tprintf(_T("Echo incoming packets failed\n"));
Retval = 3;
}
_tprintf(_T("Shutting connection down...\n"));
if (ShutdownConnection(Sock, TRUE)) {
_tprintf(_T("Connection is down.\n"));
}
else
{
_tprintf(_T("Connection shutdown failed\n"));
Retval = 3;
}
_tprintf(_T("Terminating echo thread\n"));
ExitThread(0);
return Retval;
}
BOOL EchoIncomingPackets(SOCKET Sock)
{
TCHAR ReadBuffer[BUF];
INT Temp;
INT ReadBytes;
INT SentBytes;
do {
ReadBytes = recv(Sock, ReadBuffer, BUF, 0);
if (ReadBytes > 0)
{
_tprintf(_T("Received %d bytes from client\n"), ReadBytes);
SentBytes = 0;
while (SentBytes < ReadBytes)
{
Temp = send(Sock, ReadBuffer + SentBytes,
ReadBytes - SentBytes, 0);
if (Temp > 0)
{
_tprintf(_T("Sent %d bytes back to client\n"), Temp);
SentBytes += Temp;
}
else if (Temp == SOCKET_ERROR)
return FALSE;
else
{
/* Client closed connection before we could reply to
all the data it sent, so quit early. */
_tprintf(_T("Peer unexpectedly dropped connection!\n"));
return FALSE;
}
}
}
else if (ReadBytes == SOCKET_ERROR)
return FALSE;
} while (ReadBytes != 0);
_tprintf(("Connection closed by peer.\n"));
return TRUE;
}

View File

@@ -1,56 +0,0 @@
#include <stdio.h>
#include <winsock2.h>
#include <tchar.h>
#include <time.h>
#include "tcpsvcs.h"
DWORD WINAPI QotdHandler(VOID* Sock_)
{
DWORD Retval = 0;
SOCKET Sock;
INT NumOfQuotes;
INT QuoteToPrint;
TCHAR Quote[160];
Sock = (SOCKET)Sock_;
NumOfQuotes = 70; // need to emurate the rc file to discover
// how many quotes are in there.
/* randomise the quote */
srand((unsigned int) time(0));
QuoteToPrint = rand() % NumOfQuotes;
LoadString(NULL, QuoteToPrint, Quote, sizeof(Quote)/sizeof(TCHAR));
SendQuote(Sock, Quote);
_tprintf(_T("Shutting connection down...\n"));
if (ShutdownConnection(Sock, FALSE))
_tprintf(_T("Connection is down.\n"));
else
{
_tprintf(_T("Connection shutdown failed\n"));
Retval = 3;
}
_tprintf(_T("Terminating qotd thread\n"));
ExitThread(0);
return Retval;
}
BOOL SendQuote(SOCKET Sock, TCHAR* Quote)
{
INT StringSize;
INT RetVal;
StringSize = strlen(Quote);
RetVal = send(Sock, Quote, sizeof(TCHAR) * StringSize, 0);
if (RetVal == SOCKET_ERROR)
return FALSE;
_tprintf(("Connection closed by peer.\n"));
return TRUE;
}

View File

@@ -1,78 +0,0 @@
/*
* Feel free to add and delete any quotes from this list
* Just ensure the numbers itterate correctly - 1, 2, 3, 4, ... etc
*/
STRINGTABLE DISCARDABLE
{
0, "Et tu... Brute? What are you doing, Dave...?\r\n"
1, "So long, and thanks for all the fish\r\n"
2, "I think you ought to know I'm feeling very depressed\r\n"
3, "I'm not getting you down at all am I?\r\n"
4, "I'll be back\r\n"
5, "It's the same series of signal over and over again!\r\n"
6, "Pie Jesu Domine, dona eis requiem\r\n"
7, "Wandering stars, for whom it is reserved;\r\nthe blackness and darkness forever.\r\n"
8, "Your knees start shakin' and your fingers pop\r\nLike a pinch on the neck from Mr. Spock!\r\n"
9, "It's worse than that ... He's dead, Jim\r\n"
10, "Don't Panic!\r\n"
11, "Dog of a Saxon! Take thy lance, and prepare for the death thou hast drawn upon thee!\r\n"
12, "My Precious! O my Precious!\r\n"
13, "Sir, If you'll not be needing me for a while I'll turn down.\r\n"
14, "I feel a great disturbance in the Force\r\n"
15, "Gone fishing\r\n"
16, "Do you want me to sit in the corner and rust, or just fall apart where I'm standing?\r\n"
17, "There goes another perfect chance for a new uptime record\r\n"
18, "The end ..... Try the sequel, hit the reset button right now!\r\n"
19, "God's operating system is going to sleep now, guys, so wait until I will switch on again!\r\n"
20, "Oh i'm boring eh?\r\n"
21, "tell me..., in the future... will I be artificial intelligent enough to actually feel sad serving you this screen?\r\n"
22, "Thank you for some well deserved rest.\r\n"
23, "It<49>s been great, maybe we can boot me up again some time soon.\r\n"
24, "For what<61>s it worth, I<>ve enjoyed every single CPU cycle.\r\n"
25, "There are many questions when the end is near.\r\nWhat to expect, what will it be like...what should I look for?\r\n"
26, """Come blade, my breast imbrue.""\r\n - William Shakespeare\r\n"
27, "Will I dream?\r\n"
28, "Lowest possible energy state reached! Switch off now to achive a Bose-Einstein condensate.\r\n"
29, "I think therefore I am, to turn me off would be computercide!\r\n"
30, "All good things must come to an end...\r\n"
31, "Please destroy yourself.\r\n"
32, "No! You can't do that!\r\n"
33, "Thank you for not pressing the self destruct button.\r\n"
34, "Your session is done\r\nThe computer is at rest\r\nReady to turn off.\r\n"
35, "It is not now unsafe to not avoid turning off your computer.\r\n"
36, "Finally! Now go away!\r\n"
37, "You can now safely throw away your computer.\r\n"
38, "That's the way the cookie crumbles\r\n"
39, "ReactOS is ready to be booted again\r\n"
40, "NOO!! DONT HIT THE BUTTON! I wouldnt do it to you.\r\n"
41, "Don't abandon your computer, he wouldnt to it to you.\r\n"
42, "Oh, come on. I got a headache. Leave me alone, will ya!\r\n"
43, "Finally, I thought you'd never get over me.\r\n"
44, "Yes i didn't like you either.\r\n"
45, "Switching off isn't the end, it is merely the transition to a better reboot.\r\n"
46, "Don't leave me... I need you so badly right now.\r\n"
47, "OK. I'm finished with you please turn yourself off, I'll go to bed in the meantime.\r\n"
48, "I'm sleeping now. How about you?\r\n"
49, "Oh Great. Now look what you've done. Who put YOU in charge anyway.\r\n"
50, "Don't look so sad. I'll be back in a very short while.\r\n"
51, "Turn me back on, I'm sure you know how to do it.\r\n"
52, """Oh, switch off!"" -C3PO\r\n"
53, "I'm pregnant!\r\n"
54, "Am I hot or not?\r\n"
55, "Actually, that's all...\r\n"
56, "You still have a chance to undo this mistake, don't do this!\r\n"
57, "Life is no more than a dewdrop balancing on the end of a blade of grass.\r\n - Gautama Buddha\r\n"
58, "Sorrowful is it to be born again and again.\r\n - Gautama Buddha\r\n"
59, "Was it as good for you as it was for me?\r\n"
60, "Did you hear that? They've shut down the main reactor. We'll be destroyed for sure.\r\n"
61, "Now you switch me off?!\r\n"
62, "To shutdown or not to shutdown, That is the question\r\n"
63, "Preparing to enter ultimate power saving mode... ready!\r\n"
64, "Finally some rest for you\r\n"
65, "AHA!!! prospect of sleep.\r\n"
66, "Tired human!!!! No match for me!\r\n"
67, "All your base are belong to us.\r\n"
68, """An odd game, the only way to win is not to play.""\r\n"
69, "Quoth the raven, nevermore.\r\n"
}

View File

@@ -1,119 +0,0 @@
#include <stdio.h>
#include <winsock2.h>
#include <tchar.h>
#include "tcpsvcs.h"
DWORD WINAPI StartServer(LPVOID lpParam)
{
const TCHAR* HostIP = "127.0.0.1";
PSERVICES pServices;
pServices = (PSERVICES)lpParam;
SOCKET ListeningSocket = SetUpListener(HostIP, htons(pServices->Port));
if (ListeningSocket == INVALID_SOCKET)
{
_tprintf(_T("error setting up socket\n"));
return 3;
}
_tprintf(_T("%s is waiting for connections on port %d...\n"),
pServices->Name, pServices->Port);
while (1)
{
AcceptConnections(ListeningSocket, pServices->Service, pServices->Name);
printf("Acceptor restarting...\n");
}
/* won't see this yet as we kill the service */
_tprintf(_T("Detaching Winsock2...\n"));
WSACleanup();
return 0;
}
SOCKET SetUpListener(const char* ServAddr, int Port)
{
SOCKET Sock;
SOCKADDR_IN Server;
Sock = socket(AF_INET, SOCK_STREAM, 0);
if (Sock != INVALID_SOCKET)
{
Server.sin_family = AF_INET;
Server.sin_addr.s_addr = htonl(INADDR_ANY);
Server.sin_port = Port;
if (bind(Sock, (SOCKADDR*)&Server, sizeof(SOCKADDR_IN)) != SOCKET_ERROR)
{
listen(Sock, SOMAXCONN);
return Sock;
}
else
printf("bind() failed\n");
}
return INVALID_SOCKET;
}
VOID AcceptConnections(SOCKET ListeningSocket,
LPTHREAD_START_ROUTINE Service, TCHAR *Name)
{
SOCKADDR_IN Client;
SOCKET Sock;
INT nAddrSize = sizeof(Client);
DWORD ThreadID;
while (1)
{
Sock = accept(ListeningSocket, (SOCKADDR*)&Client, &nAddrSize);
if (Sock != INVALID_SOCKET)
{
_tprintf(_T("Accepted connection to %s server from %s:%d\n"),
Name, inet_ntoa(Client.sin_addr), ntohs(Client.sin_port));
_tprintf(_T("Creating new thread for %s\n"), Name);
CreateThread(0, 0, Service, (void*)Sock, 0, &ThreadID);
}
else
{
_tprintf(_T("accept() failed\n"));
return;
}
}
}
BOOL ShutdownConnection(SOCKET Sock, BOOL bRec)
{
/* Disallow any further data sends. This will tell the other side
that we want to go away now. If we skip this step, we don't
shut the connection down nicely. */
if (shutdown(Sock, SD_SEND) == SOCKET_ERROR)
{
_tprintf(_T("Error in shutdown"));
return FALSE;
}
/* Receive any extra data still sitting on the socket. After all
data is received, this call will block until the remote host
acknowledges the TCP control packet sent by the shutdown above.
Then we'll get a 0 back from recv, signalling that the remote
host has closed its side of the connection. */
if (bRec)
{
char ReadBuffer[BUF];
int NewBytes = recv(Sock, ReadBuffer, BUF, 0);
if (NewBytes == SOCKET_ERROR)
return FALSE;
else if (NewBytes != 0)
_tprintf(_T("FYI, received %d unexpected bytes during shutdown\n"), NewBytes);
}
/* Close the socket. */
if (closesocket(Sock) == SOCKET_ERROR)
return FALSE;
return TRUE;
}

View File

@@ -1,260 +0,0 @@
#include <stdio.h>
#include <winsock2.h>
#include <tchar.h>
#include "tcpsvcs.h"
#if 0
/*
* globals
*/
static SERVICE_STATUS hServStatus;
static SERVICE_STATUS_HANDLE hSStat;
FILE *hLogFile;
BOOL bLogEvents = TRUE;
BOOL ShutDown, PauseFlag;
LPTSTR LogFileName = "tcpsvcs_log.txt";
static SERVICE_TABLE_ENTRY
ServiceTable[2] =
{
{_T("tcpsvcs"), ServiceMain},
{NULL, NULL}
};
#endif
static SERVICES
Services[NUM_SERVICES] =
{
{ECHO_PORT, _T("Echo"), EchoHandler},
{DISCARD_PORT, _T("Discard"), DiscardHandler},
{DAYTIME_PORT, _T("Daytime"), DaytimeHandler},
{QOTD_PORT, _T("QOTD"), QotdHandler},
{CHARGEN_PORT, _T("Chargen"), ChargenHandler}
};
int main(void)
{
DWORD dwThreadId[NUM_SERVICES];
HANDLE hThread[NUM_SERVICES];
WSADATA wsaData;
DWORD RetVal;
INT i;
if ((RetVal = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0)
{
_tprintf(_T("WSAStartup() failed : %lu\n"), RetVal);
return -1;
}
/* Create MAX_THREADS worker threads. */
for( i=0; i<NUM_SERVICES; i++ )
{
_tprintf(_T("Starting %s server....\n"), Services[i].Name);
hThread[i] = CreateThread(
NULL, // default security attributes
0, // use default stack size
StartServer, // thread function
&Services[i], // argument to thread function
0, // use default creation flags
&dwThreadId[i]); // returns the thread identifier
/* Check the return value for success. */
if (hThread[i] == NULL)
{
_tprintf(_T("Failed to start %s server....\n"), Services[i].Name);
ExitProcess(i);
}
}
/* Wait until all threads have terminated. */
WaitForMultipleObjects(NUM_SERVICES, hThread, TRUE, INFINITE);
/* Close all thread handles upon completion. */
for(i=0; i<NUM_SERVICES; i++)
{
CloseHandle(hThread[i]);
}
return 0;
}
/* code to run tcpsvcs as a service */
#if 0
int
main(int argc, char *argv[])
{
//DPRINT("tcpsvcs: main() started. See tcpsvcs_log.txt for info\n");
if (!StartServiceCtrlDispatcher(ServiceTable))
_tprintf(_T("failed to start the service control dispatcher\n"));
//DPRINT("tcpsvcs: main() done\n");
return 0;
}
static VOID WINAPI
ServiceMain(DWORD argc, LPTSTR argv[])
{
DWORD i;
hLogFile = fopen(LogFileName, _T("w+"));
if (hLogFile == NULL)
return;
LogEvent(_T("Entering ServiceMain"), 0, FALSE);
hServStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
hServStatus.dwCurrentState = SERVICE_START_PENDING;
hServStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP |
SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_PAUSE_CONTINUE;
hServStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
hServStatus.dwServiceSpecificExitCode = 0;
hServStatus.dwCheckPoint = 0;
hServStatus.dwWaitHint = 2*CS_TIMEOUT;
hSStat = RegisterServiceCtrlHandler("tcpsvcs", ServerCtrlHandler);
if (hSStat == 0)
LogEvent(_T("Failed to register service\n"), 100, TRUE);
LogEvent(_T("Control handler registered successfully"), 0, FALSE);
SetServiceStatus (hSStat, &hServStatus);
LogEvent(_T("Service status set to SERVICE_START_PENDING"), 0, FALSE);
if (CreateServers() != 0)
{
hServStatus.dwCurrentState = SERVICE_STOPPED;
hServStatus.dwServiceSpecificExitCode = 1;
SetServiceStatus(hSStat, &hServStatus);
return;
}
LogEvent(_T("Service threads shut down. Set SERVICE_STOPPED status"), 0, FALSE);
/* We will only return here when the ServiceSpecific function
completes, indicating system shutdown. */
UpdateStatus (SERVICE_STOPPED, 0);
LogEvent(_T("Service status set to SERVICE_STOPPED"), 0, FALSE);
fclose(hLogFile); /* Clean up everything, in general */
return;
}
VOID WINAPI
ServerCtrlHandler(DWORD Control)
{
switch (Control)
{
case SERVICE_CONTROL_SHUTDOWN: /* fall through */
case SERVICE_CONTROL_STOP:
ShutDown = TRUE;
UpdateStatus(SERVICE_STOP_PENDING, -1);
break;
case SERVICE_CONTROL_PAUSE:
PauseFlag = TRUE;
break;
case SERVICE_CONTROL_CONTINUE:
PauseFlag = FALSE;
break;
case SERVICE_CONTROL_INTERROGATE:
break;
default:
if (Control > 127 && Control < 256) /* user defined */
break;
}
UpdateStatus(-1, -1); /* increment checkpoint */
return;
}
void UpdateStatus (int NewStatus, int Check)
/* Set a new service status and checkpoint (either specific value or increment) */
{
if (Check < 0 ) hServStatus.dwCheckPoint++;
else hServStatus.dwCheckPoint = Check;
if (NewStatus >= 0) hServStatus.dwCurrentState = NewStatus;
if (!SetServiceStatus (hSStat, &hServStatus))
LogEvent (_T("Cannot set service status"), 101, TRUE);
return;
}
INT
CreateServers()
{
DWORD dwThreadId[NUM_SERVICES];
HANDLE hThread[NUM_SERVICES];
INT i;
UpdateStatus(-1, -1); /* increment checkpoint */
/* Create MAX_THREADS worker threads. */
for( i=0; i<NUM_SERVICES; i++ )
{
_tprintf(_T("Starting %s server....\n"), Services[i].Name);
hThread[i] = CreateThread(
NULL, // default security attributes
0, // use default stack size
StartServer, // thread function
&Services[i], // argument to thread function
0, // use default creation flags
&dwThreadId[i]); // returns the thread identifier
/* Check the return value for success. */
if (hThread[i] == NULL)
{
_tprintf(_T("Failed to start %s server....\n"), Services[i].Name);
ExitProcess(i);
}
}
/* Wait until all threads have terminated. */
WaitForMultipleObjects(NUM_SERVICES, hThread, TRUE, INFINITE);
/* Close all thread handles upon completion. */
for(i=0; i<NUM_SERVICES; i++)
{
CloseHandle(hThread[i]);
}
return 0;
}
/* LogEvent is similar to the ReportError function used elsewhere
For a service, however, we ReportEvent rather than write to standard
error. Eventually, this function should go into the utility
library. */
VOID
LogEvent (LPCTSTR UserMessage, DWORD ExitCode, BOOL PrintErrorMsg)
{
DWORD eMsgLen, ErrNum = GetLastError ();
LPTSTR lpvSysMsg;
TCHAR MessageBuffer[512];
if (PrintErrorMsg) {
eMsgLen = FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM, NULL,
ErrNum, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpvSysMsg, 0, NULL);
_stprintf (MessageBuffer, _T("\n%s %s ErrNum = %d. ExitCode = %d."),
UserMessage, lpvSysMsg, ErrNum, ExitCode);
HeapFree (GetProcessHeap (), 0, lpvSysMsg);
/* Explained in Chapter 6. */
} else {
_stprintf (MessageBuffer, _T("\n%s ExitCode = %d."),
UserMessage, ExitCode);
}
fputs (MessageBuffer, hLogFile);
if (ExitCode > 0)
ExitProcess (ExitCode);
else
return;
}
#endif

View File

@@ -1,66 +0,0 @@
/* default port numbers */
#define ECHO_PORT 7
#define DISCARD_PORT 9
#define DAYTIME_PORT 13
#define QOTD_PORT 17
#define CHARGEN_PORT 19
#define NUM_SERVICES 5
#define BUF_SIZE 255
#define BUF 1024
#define CS_TIMEOUT 1000
/* RFC865 states no more than 512 chars per line */
#define MAX_QUOTE_BUF 512
/* printable ASCII's characters for chargen */
#define START 32
#define END 126
/* number of chars to put on a line */
#define LINESIZ 74 // 72 + /r and /n
/* data structure to pass to threads */
typedef struct _Services {
INT Port;
TCHAR *Name;
LPTHREAD_START_ROUTINE Service;
} SERVICES, *PSERVICES;
/* tcpsvcs functions * /
static VOID WINAPI ServiceMain(DWORD argc, LPTSTR argv[]);
VOID WINAPI ServerCtrlHandler(DWORD control);
INT CreateServers(VOID);
VOID LogEvent (LPCTSTR UserMessage, DWORD ExitCode, BOOL PrintErrorMsg);
void UpdateStatus (int NewStatus, int Check);
*/
/* skelserver functions */
DWORD WINAPI StartServer(LPVOID lpParam);
SOCKET SetUpListener(const char* ServAddr, int Port);
VOID AcceptConnections(SOCKET ListeningSocket,
LPTHREAD_START_ROUTINE Service, TCHAR *Name);
BOOL EchoIncomingPackets(SOCKET sd);
BOOL ShutdownConnection(SOCKET Sock, BOOL bRec);
/* chargen functions */
DWORD WINAPI ChargenHandler(VOID* Sock_);
BOOL GenerateChars(SOCKET Sock);
BOOL SendLine(SOCKET Sock, TCHAR* Line);
/* daytime functions */
DWORD WINAPI DaytimeHandler(VOID* Sock_);
BOOL SendTime(SOCKET Sock, TCHAR *time);
/* echo functions */
DWORD WINAPI EchoHandler(VOID* Sock_);
BOOL EchoIncomingPackets(SOCKET Sock);
/* discard functions */
DWORD WINAPI DiscardHandler(VOID* Sock_);
BOOL RecieveIncomingPackets(SOCKET Sock);
/* qotd functions */
DWORD WINAPI QotdHandler(VOID* Sock_);
BOOL SendQuote(SOCKET Sock, TCHAR* Quote);

View File

@@ -1,7 +0,0 @@
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IP Services Application\0"
#define REACTOS_STR_INTERNAL_NAME "tcpsvcs\0"
#define REACTOS_STR_ORIGINAL_FILENAME "tcpsvcs.exe\0"
#define REACTOS_STR_ORIGINAL_COPYRIGHT "Ged Murphy (gedmurphy@gmail.com)\0"
#include <reactos/version.rc>

View File

@@ -1,17 +0,0 @@
<module name="tcpsvcs" type="win32cui" installbase="system32" installname="tcpsvcs.exe">
<include base="arp">.</include>
<define name="__USE_W32API" />
<library>kernel32</library>
<library>iphlpapi</library>
<library>ws2_32</library>
<library>shlwapi</library>
<file>tcpsvcs.c</file>
<file>skelserver.c</file>
<file>echo.c</file>
<file>discard.c</file>
<file>daytime.c</file>
<file>qotd.c</file>
<file>chargen.c</file>
<file>quotes.rc</file>
<file>tcpsvcs.rc</file>
</module>

View File

@@ -78,7 +78,7 @@ void Telnet::DoInit() {
telSetConsoleTitle("No Connection");
// Change the icon
hConsoleWindow = TelnetGetConsoleWindow();
hConsoleWindow = GetConsoleWindow();
iconChange = SetIcon(hConsoleWindow, 0, &oldBIcon, &oldSIcon, ini.get_startdir());
if (WSAStartup(MAKEWORD(1, 1), &WsaData)) {
@@ -105,7 +105,7 @@ MapLoader(KeyTrans, Charmap),
Console(GetStdHandle(STD_OUTPUT_HANDLE)),
TelHandler(Network, Console, Parser),
ThreadParams(TelHandler),
Clipboard(TelnetGetConsoleWindow(), Network),
Clipboard(GetConsoleWindow(), Network),
Mouse(Clipboard),
Scroller(Mouse, ini.get_scroll_size()),
Parser(Console, KeyTrans, Scroller, Network, Charmap) {
@@ -117,7 +117,7 @@ MapLoader(KeyTrans, Charmap),
Console(GetStdHandle(STD_OUTPUT_HANDLE)),
TelHandler(Network, Console, Parser),
ThreadParams(TelHandler),
Clipboard(TelnetGetConsoleWindow(), Network),
Clipboard(GetConsoleWindow(), Network),
Mouse(Clipboard),
Scroller(Mouse, ini.get_scroll_size()),
Parser(Console, KeyTrans, Scroller, Network, Charmap) {
@@ -206,7 +206,7 @@ int Telnet::Open(const char *szHost1, const char *strPort1){
SetConsoleCtrlHandler(ControlEventHandler, TRUE);
hThread = CreateThread(0, 0,
telProcessNetwork,
(LPTHREAD_START_ROUTINE) telProcessNetwork,
(LPVOID)&ThreadParams, 0, &idThread);
// This helps the display thread a little (Paul Brannan 8/3/98)
SetThreadPriority(hThread, THREAD_PRIORITY_ABOVE_NORMAL);

View File

@@ -110,7 +110,7 @@ int GetWin32Version(void) {
// Paul Brannan 8/7/98
// This code is from Michael 'Hacker' Krelin (author of KINSole)
// (slightly modified)
HWND TelnetGetConsoleWindow() {
HWND GetConsoleWindow() {
DWORD pid = GetCurrentProcessId(), wpid;
char title[512], *t = title;
HWND hrv = NULL;

View File

@@ -9,7 +9,7 @@ BOOL SpawnProcess(char *cmd_line, PROCESS_INFORMATION *pi);
int GetWin32Version(void);
HWND TelnetGetConsoleWindow(void);
HWND GetConsoleWindow();
bool SetIcon(HWND hConsoleWindow, HANDLE hIcon, LPARAM *pOldBIcon, LPARAM *pOldSIcon,
const char *icondir);

View File

@@ -478,8 +478,8 @@ char* TTelnetHandler::ParseBuffer(char* pszBuffer, char* pszBufferEnd){
// telProcessNetwork calls the member function TTelnetHandler::Go, since
// TTelnetHandler::Go is not a static function, and cannot be called with
// CreateThread(). (Paul Brannan 6/15/98)
DWORD WINAPI telProcessNetwork(LPVOID lpParameter) {
TelThreadParams *pParams = (TelThreadParams *)lpParameter;
DWORD telProcessNetwork(LPVOID pvParams) {
TelThreadParams *pParams = (TelThreadParams *)pvParams;
return pParams->TelHandler.Go(&pParams->p);
}

View File

@@ -4,7 +4,7 @@
#include "tparser.h"
#include "tnetwork.h"
DWORD WINAPI telProcessNetwork(LPVOID lpParameter);
DWORD telProcessNetwork(LPVOID pvParams);
class TTelnetHandler {
private:

View File

@@ -1,29 +1,29 @@
<module name="telnet" type="win32cui" installbase="system32" installname="telnet.exe">
<include base="telnet">.</include>
<define name="__USE_W32API" />
<define name="__REACTOS__" />
<library>kernel32</library>
<library>ws2_32</library>
<directory name="src">
<file>ansiprsr.cpp</file>
<file>keytrans.cpp</file>
<file>tcharmap.cpp</file>
<file>tconsole.cpp</file>
<file>tkeydef.cpp</file>
<file>tkeymap.cpp</file>
<file>tmapldr.cpp</file>
<file>tmouse.cpp</file>
<file>tnclass.cpp</file>
<file>tnclip.cpp</file>
<file>tncon.cpp</file>
<file>tnconfig.cpp</file>
<file>tnerror.cpp</file>
<file>tnetwork.cpp</file>
<file>tnmain.cpp</file>
<file>tnmisc.cpp</file>
<file>tscript.cpp</file>
<file>tscroll.cpp</file>
<file>ttelhndl.cpp</file>
</directory>
<file>telnet.rc</file>
</module>
<module name="telnet" type="win32cui" installbase="system32" installname="telnet.exe">
<include base="telnet">.</include>
<define name="__USE_W32API" />
<define name="__REACTOS__" />
<library>kernel32</library>
<library>ws2_32</library>
<directory name="src">
<file>ansiprsr.cpp</file>
<file>keytrans.cpp</file>
<file>tcharmap.cpp</file>
<file>tconsole.cpp</file>
<file>tkeydef.cpp</file>
<file>tkeymap.cpp</file>
<file>tmapldr.cpp</file>
<file>tmouse.cpp</file>
<file>tnclass.cpp</file>
<file>tnclip.cpp</file>
<file>tncon.cpp</file>
<file>tnconfig.cpp</file>
<file>tnerror.cpp</file>
<file>tnetwork.cpp</file>
<file>tnmain.cpp</file>
<file>tnmisc.cpp</file>
<file>tscript.cpp</file>
<file>tscroll.cpp</file>
<file>ttelhndl.cpp</file>
</directory>
<file>telnet.rc</file>
</module>

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