Compare commits

..

43 Commits

Author SHA1 Message Date
Brandon Turner
9995407642 version -> release
svn path=/branches/ros-branch-0_2_9/; revision=20302
2005-12-22 18:32:14 +00:00
Brandon Turner
0970bef959 merge 20263 from GL's request.
svn path=/branches/ros-branch-0_2_9/; revision=20266
2005-12-19 01:50:51 +00:00
Hervé Poussineau
501f3eae92 Merge 20261 and part of 20256 from trunk:
- Fix little bug which prevented IRP_MJ_PNP to be forwarded to lower driver
- Fix serial mouse type detection
- Shut up some debug message

svn path=/branches/ros-branch-0_2_9/; revision=20262
2005-12-18 23:02:36 +00:00
Brandon Turner
1bab34f39f change version to RC2
svn path=/branches/ros-branch-0_2_9/; revision=20260
2005-12-18 22:51:10 +00:00
Gé van Geldorp
9902d58ce2 Merge from trunk:
Fix C++ exception handling

svn path=/branches/ros-branch-0_2_9/; revision=20258
2005-12-18 21:01:56 +00:00
Hervé Poussineau
4b5d91277e Merge from trunk:
Fix typo, which lead to be unable to create services with a description text

svn path=/branches/ros-branch-0_2_9/; revision=20254
2005-12-18 18:14:48 +00:00
Hervé Poussineau
f95ef07957 Merge from trunk:
Use the right default value for the serial port baud rate

svn path=/branches/ros-branch-0_2_9/; revision=20252
2005-12-18 18:12:51 +00:00
Gé van Geldorp
1471bad4d2 Add static entries for PCnet and NE2000 network cards (VMware/QEmu resp.) so
networking is available on the LiveCD. Fixes bug 1116 (again :-))

svn path=/branches/ros-branch-0_2_9/; revision=20214
2005-12-16 23:17:18 +00:00
Andrew Munger
33be95a93e Merge 20204 from trunk.
svn path=/branches/ros-branch-0_2_9/; revision=20205
2005-12-16 03:04:02 +00:00
Gé van Geldorp
0ef3fa89ca Fix by Royce3:
Don't wait 10 sec after starting an app via a .lnk file

svn path=/branches/ros-branch-0_2_9/; revision=20199
2005-12-15 20:58:51 +00:00
Ged Murphy
5093f4e90e merge 20197
svn path=/branches/ros-branch-0_2_9/; revision=20198
2005-12-15 20:50:04 +00:00
Andrew Munger
7566da4dbc *Tweetmerge -r 20194:20193 . *Yellow Card* Revert 20194. *g*
svn path=/branches/ros-branch-0_2_9/; revision=20195
2005-12-15 19:12:37 +00:00
Brandon Turner
c805e6657c set default res to 800x600x16
svn path=/branches/ros-branch-0_2_9/; revision=20194
2005-12-15 18:53:33 +00:00
Hervé Poussineau
35a1e044f5 Merge from trunk:
Add message box to tell the user to reboot after the installation of a network card

svn path=/branches/ros-branch-0_2_9/; revision=20193
2005-12-15 18:22:34 +00:00
Andrew Munger
ac5b031aea Merge 20151 from trunk.
svn path=/branches/ros-branch-0_2_9/; revision=20186
2005-12-15 01:47:36 +00:00
Gé van Geldorp
88c6bdc581 Martin Fuchs <martin-fuchs@gmx.net>
Directly return the correct "My Computer" attributes in
ISF_Desktop_fnGetAttributesOf().
Fixes bug 1097

svn path=/branches/ros-branch-0_2_9/; revision=20178
2005-12-14 22:41:16 +00:00
Gé van Geldorp
f4ef493c15 Merge from trunk:
Make property sheet fit in 640x480. Fixes bug 1099

svn path=/branches/ros-branch-0_2_9/; revision=20177
2005-12-14 21:39:24 +00:00
Gé van Geldorp
ef206239f6 Don't pop-up device installer screen.
Fixes bug 1026

svn path=/branches/ros-branch-0_2_9/; revision=20175
2005-12-14 20:32:57 +00:00
Ged Murphy
7ba0b3e0ad merge Art's tcpip changes to the branch
svn path=/branches/ros-branch-0_2_9/; revision=20162
2005-12-14 10:28:30 +00:00
Ged Murphy
5d1b580120 merge 20108 to branch
svn path=/branches/ros-branch-0_2_9/; revision=20109
2005-12-12 20:01:44 +00:00
Andrew Munger
ac56de8f10 Merge 20041 from trunk
svn path=/branches/ros-branch-0_2_9/; revision=20099
2005-12-12 04:50:06 +00:00
Sebastian Gasiorek
0a08dc64a5 merge 20084
svn path=/branches/ros-branch-0_2_9/; revision=20087
2005-12-11 21:29:07 +00:00
Gé van Geldorp
d5ba90fc03 Merge from trunk:
Put back extra info if it was present

svn path=/branches/ros-branch-0_2_9/; revision=20086
2005-12-11 21:24:51 +00:00
Gé van Geldorp
22ea8a7f36 Merge from trunk:
Resolve chained CNAME records

svn path=/branches/ros-branch-0_2_9/; revision=20083
2005-12-11 21:18:32 +00:00
Sebastian Gasiorek
824ed815aa merge 20065
svn path=/branches/ros-branch-0_2_9/; revision=20080
2005-12-11 20:22:21 +00:00
Brandon Turner
1c0fdf270d merge 20048
svn path=/branches/ros-branch-0_2_9/; revision=20076
2005-12-11 19:30:07 +00:00
Brandon Turner
21728b5d71 merge 20051 / 20052
svn path=/branches/ros-branch-0_2_9/; revision=20075
2005-12-11 19:28:17 +00:00
Brandon Turner
f4d4dc00c0 merge 20053
svn path=/branches/ros-branch-0_2_9/; revision=20074
2005-12-11 19:27:51 +00:00
Brandon Turner
81fa1382bb merge 20049
svn path=/branches/ros-branch-0_2_9/; revision=20073
2005-12-11 19:27:22 +00:00
Gé van Geldorp
44689c61ed Merge from trunk:
Use links.reactos.org redirection script

svn path=/branches/ros-branch-0_2_9/; revision=20064
2005-12-11 14:35:33 +00:00
Gé van Geldorp
b7f02b4160 Merge from trunk:
Shut off some debug messages

svn path=/branches/ros-branch-0_2_9/; revision=20046
2005-12-10 22:28:26 +00:00
Gé van Geldorp
2966911af9 Merge from trunk:
Multiple interrupt status bits can be active at the same time, process them
all instead of just one and ignoring the rest.
On an active network card, this would eventually cause all transmit buffers
to be marked "in use", blocking all transmits. Sinds no TCP acks would go out,
it would block TCP receives too.

svn path=/branches/ros-branch-0_2_9/; revision=20044
2005-12-10 22:21:55 +00:00
Gé van Geldorp
a714b65aa6 Merge from trunk:
Remove Wine-ism

svn path=/branches/ros-branch-0_2_9/; revision=20023
2005-12-09 21:50:59 +00:00
Gé van Geldorp
9a9811c882 Merge from trunk:
Tell shdocvw where to get the Mozilla control

svn path=/branches/ros-branch-0_2_9/; revision=20021
2005-12-09 21:48:35 +00:00
Gé van Geldorp
8ec6560a0f Merge from trunk:
Never allocate 0 bytes. Fixes bug 1082.

svn path=/branches/ros-branch-0_2_9/; revision=20011
2005-12-09 17:57:58 +00:00
Gé van Geldorp
19c2f33c29 Merge from trunk:
Synthesize FILE_ATTRIBUTE_NORMAL on NetworkOpenInformation query too.
This fixes the final problem with the Firefox installer.

svn path=/branches/ros-branch-0_2_9/; revision=20006
2005-12-09 13:24:00 +00:00
Gé van Geldorp
c3511de52b Merge from trunk:
Strings with different lengths are not equal

svn path=/branches/ros-branch-0_2_9/; revision=19977
2005-12-08 21:33:49 +00:00
Gé van Geldorp
24c4a95a96 Merge from trunk:
Don't do WM_INITDIALOG processing during window destruction...
Fixes bug 1087.

svn path=/branches/ros-branch-0_2_9/; revision=19974
2005-12-08 19:08:04 +00:00
Gé van Geldorp
84ffb3645f Merge from trunk:
Self-registration of devenum.dll depends on quartz.dll, which we don't have yet.

svn path=/branches/ros-branch-0_2_9/; revision=19972
2005-12-08 18:33:57 +00:00
Gé van Geldorp
cce3271e71 Merge from trunk:
It's possible to select an (indexed) palette into a bitfield (e.g. 16 bit
deep) DC. This palette will be used when calling CreateDIBSection with
DIB_PAL_COLORS usage. Fixes bug 1077.

svn path=/branches/ros-branch-0_2_9/; revision=19969
2005-12-08 17:42:31 +00:00
Gé van Geldorp
ad9c234c2e Merge from trunk:
It's possible to select an (indexed) palette into a bitfield (e.g. 16 bit
deep) DC. This palette will be used when calling CreateDIBSection with
DIB_PAL_COLORS usage. Fixes bug 1077.

svn path=/branches/ros-branch-0_2_9/; revision=19968
2005-12-08 17:41:57 +00:00
Andrew Munger
dafd96040c Merge 19941, 19955, and 19956 to 0.2.9
svn path=/branches/ros-branch-0_2_9/; revision=19965
2005-12-08 17:09:25 +00:00
Brandon Turner
1fd2b6f20a Change version and DBG=0
svn path=/branches/ros-branch-0_2_9/; revision=19952
2005-12-07 18:14:41 +00:00
14008 changed files with 1322643 additions and 1978935 deletions

View File

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

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

@@ -47,8 +47,8 @@
<TD> Implemented </TD> <TD> Implemented </TD>
<TD> <IMG src="sc.gif"/> </TD> <TD> <IMG src="sc.gif"/> </TD>
<TD> Complete </TD> <TD> Complete </TD>
</TR>
<TR> <TR>
</TR>
<TD> <IMG src="f.gif"/> </TD> <TD> <IMG src="f.gif"/> </TD>
<TD> Function </TD> <TD> Function </TD>
<TD> <IMG src="u.gif"/> </TD> <TD> <IMG src="u.gif"/> </TD>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="publishPath" value="c:\iso" /> <!-- c:\iso or ftp://ftp.server.com/iso -->
<add key="smtpServer" value="localhost" />
<add key="errorEmail" value="mailbox@somewhere-on-the-net" />
<add key="makeParameters" value="" />
<add key="fastDisk" value="" />
</appSettings>
</configuration>

View File

@@ -0,0 +1,14 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("ReactOS Sin Custom Revision Action")]
[assembly: AssemblyDescription("ReactOS Sin Custom Revision Action")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ReactOS Project")]
[assembly: AssemblyProduct("React Operating System")]
[assembly: AssemblyCopyright("Copyright 2005 ReactOS Project")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]

View File

@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<project name="ReactOS.CustomRevisionAction" default="build">
<property name="output.dir" value="bin" />
<target name="build" description="Build component">
<mkdir dir="${output.dir}" />
<csc target="exe"
output="${output.dir}\ReactOS.CustomRevisionAction.exe"
optimize="true"
debug="true"
doc="${output.dir}\ReactOS.CustomRevisionAction.xml"
warninglevel="0">
<sources>
<include name="*.cs" />
</sources>
</csc>
</target>
</project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,340 @@
using System;
using System.IO;
using System.Diagnostics;
using System.Configuration;
using System.Web.Mail;
namespace ReactOS.CustomRevisionAction
{
public class MainClass
{
/// <summary>
/// Path to store published binaries at.
/// </summary>
private static string publishPath;
/// <summary>
/// Whether or not to publish ISOs to a remote destination via FTP.
/// </summary>
private static bool PublishToRemoteFtpLocation
{
get
{
return publishPath.StartsWith("ftp://");
}
}
/// <summary>
/// Run the application.
/// </summary>
/// <param name="script">Script to run.</param>
/// <param name="args">Arguments to pass to script.</param>
/// <param name="workingDirectory">Working directory.</param>
/// <param name="standardOutput">Receives standard output.</param>
/// <param name="standardError">Receives standard error.</param>
/// <returns>
/// Exit code.
/// </returns>
private static int RunScript(string script,
string args,
string workingDirectory,
out string standardOutput,
out string standardError)
{
ProcessStartInfo scriptProcessStartInfo = new ProcessStartInfo(script,
args);
scriptProcessStartInfo.CreateNoWindow = true;
/*
* All standard streams must be redirected.
* Otherwise DuplicateHandle() will fail.
*/
scriptProcessStartInfo.RedirectStandardInput = true;
scriptProcessStartInfo.RedirectStandardError = true;
scriptProcessStartInfo.RedirectStandardOutput = true;
scriptProcessStartInfo.UseShellExecute = false;
scriptProcessStartInfo.WorkingDirectory = workingDirectory;
RedirectableProcess redirectableProcess = new RedirectableProcess(scriptProcessStartInfo);
standardOutput = redirectableProcess.ProcessOutput;
standardError = redirectableProcess.ProcessError;
return redirectableProcess.ExitCode;
}
/// <summary>
/// Retrieve value of configuration from configuration file.
/// </summary>
/// <param name="name">Name of configuration option.</param>
/// <param name="defaultValue">
/// Default value to be returned if the option does not exist.
/// </param>
/// <returns>
/// Value of configuration option or null if the option does not
/// exist and no default value is provided.
/// </returns>
private static string GetConfigurationOption(string name,
string defaultValue)
{
if (ConfigurationSettings.AppSettings[name] != null)
return ConfigurationSettings.AppSettings[name];
else
return defaultValue;
}
/// <summary>
/// Send an email.
/// </summary>
/// <param name="subject">Subject of the email.</param>
/// <param name="body">Content of the email.</param>
private static void SendErrorMail(string subject, string body)
{
try
{
string smtpServer = GetConfigurationOption("smtpServer", "localhost");
string toEmail = GetConfigurationOption("errorEmail", null);
if (toEmail == null)
return;
string fromEmail = GetConfigurationOption("fromEmail", null);
if (fromEmail == null)
fromEmail = toEmail;
MailMessage mm = new MailMessage();
mm.Priority = MailPriority.Normal;
mm.From = toEmail;
mm.To = toEmail;
mm.Subject = subject;
mm.Body += body;
mm.Body += "<br>";
mm.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = smtpServer;
SmtpMail.Send(mm);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
}
}
/// <summary>
/// Fail with an error message.
/// </summary>
/// <param name="revision">Repository revision.</param>
/// <param name="text">Error message.</param>
private static void Fail(int revision,
string text)
{
Console.WriteLine(text);
Console.Error.WriteLine(text);
SendErrorMail(String.Format("[{0}] ReactOS Publish Error", revision), text);
}
/// <summary>
/// Fail with an error message.
/// </summary>
/// <param name="text">Error message.</param>
private static void Fail(string text)
{
Console.WriteLine(text);
Console.Error.WriteLine(text);
SendErrorMail("ReactOS Publish Error", text);
}
/// <summary>
/// Generate filename of distribution.
/// </summary>
/// <param name="branch">Branch.</param>
/// <param name="revision">Revision.</param>
private static string GetDistributionFilename(string branch,
int revision)
{
return String.Format("ReactOS-{0}-r{1}.iso",
branch,
revision);
}
private static void SplitRemotePublishPath(string publishPath,
out string server,
out string directory)
{
string searchString = "://";
int index = publishPath.IndexOf(searchString);
if (index == -1)
throw new InvalidOperationException();
int endOfProtocolIndex = index + searchString.Length;
string withoutProtocol = publishPath.Remove(0, endOfProtocolIndex);
index = withoutProtocol.IndexOf("/");
if (index == -1)
{
server = withoutProtocol;
directory = "";
}
else
{
server = withoutProtocol.Substring(0, index);
directory = withoutProtocol.Remove(0, index + 1);
}
}
/// <summary>
/// Copy ISO to the (remote) destination.
/// </summary>
/// <param name="sourceFilename">Name of source ISO file to copy.</param>
/// <param name="branch">Branch.</param>
/// <param name="revision">Revision.</param>
/// <remarks>
/// Structure is ftp://ftp.server.com/whereever/<branch>/ReactOS-<branch>-r<revision>.iso.
/// </remarks>
private static void CopyISOToRemoteFtpDestination(string sourceFilename,
string branch,
int revision)
{
string distributionFilename = GetDistributionFilename(branch,
revision);
string destinationFilename = Path.Combine(Path.GetDirectoryName(sourceFilename),
distributionFilename);
File.Move(sourceFilename, destinationFilename);
string server;
string directory;
SplitRemotePublishPath(publishPath, out server, out directory);
FtpClient ftpClient = new FtpClient(server, "anonymous", "sin@svn.reactos.com");
ftpClient.Login();
if (directory != "")
ftpClient.ChangeDir(directory);
/* Create destination directory if it does not already exist */
if (!ftpClient.DirectoryExists(branch))
ftpClient.MakeDir(branch);
ftpClient.ChangeDir(branch);
ftpClient.Upload(destinationFilename);
ftpClient.Close();
}
/// <summary>
/// Copy ISO to the (local) destination.
/// </summary>
/// <param name="sourceFilename">Name of source ISO file to copy.</param>
/// <param name="branch">Branch.</param>
/// <param name="revision">Revision.</param>
/// <remarks>
/// Structure is <branch>\ReactOS-<branch>-r<revision>.iso.
/// </remarks>
private static void CopyISOToLocalDestination(string sourceFilename,
string branch,
int revision)
{
string distributionFilename = GetDistributionFilename(branch,
revision);
string destinationDirectory = Path.Combine(publishPath,
branch);
string destinationFilename = Path.Combine(destinationDirectory,
distributionFilename);
if (!Directory.Exists(destinationDirectory))
Directory.CreateDirectory(destinationDirectory);
File.Copy(sourceFilename,
destinationFilename);
}
/// <summary>
/// Copy ISO to the destination.
/// </summary>
/// <param name="sourceFilename">Name of source ISO file to copy.</param>
/// <param name="branch">Branch.</param>
/// <param name="revision">Revision.</param>
/// <remarks>
/// Structure is <branch>\ReactOS-<branch>-r<revision>.iso.
/// </remarks>
private static void CopyISOToDestination(string sourceFilename,
string branch,
int revision)
{
if (PublishToRemoteFtpLocation)
CopyISOToRemoteFtpDestination(sourceFilename, branch, revision);
else
CopyISOToLocalDestination(sourceFilename, branch, revision);
}
/// <summary>
/// Publish a revision of ReactOS.
/// </summary>
/// <param name="text">Error message.</param>
private static int Publish(string branch,
int revision,
string workingDirectory)
{
string make = "mingw32-make";
string makeParameters = GetConfigurationOption("makeParameters", "");
string reactosDirectory = Path.Combine(workingDirectory,
"reactos");
Console.WriteLine(String.Format("ReactOS directory is {0}",
reactosDirectory));
string standardOutput;
string standardError;
int exitCode = RunScript(make,
makeParameters + " bootcd",
reactosDirectory,
out standardOutput,
out standardError);
if (exitCode != 0)
{
Fail(revision,
String.Format("make bootcd failed: (error: {0}) {1}",
standardError,
standardOutput));
return exitCode;
}
string sourceFilename = Path.Combine(reactosDirectory,
"ReactOS.iso");
if (File.Exists(sourceFilename))
CopyISOToDestination(sourceFilename,
branch,
revision);
else
{
Fail(revision,
"make bootcd produced no ReactOS.iso");
return exitCode;
}
return exitCode;
}
/// <summary>
/// Program entry point.
/// </summary>
/// <param name="args">Arguments from command line.</param>
/// <remarks>
/// If exit code is 0, then the commit was processed successfully.
/// If exit code is 1, then the commit was not processed successfully.
/// </remarks>
public static void Main(string[] args)
{
try
{
System.Environment.ExitCode = 1;
publishPath = ConfigurationSettings.AppSettings["publishPath"];
if (publishPath == null)
{
Fail("PublishPath option not set.");
return;
}
if (args.Length < 3)
{
Fail("Usage: ReactOS.CustomRevisionAction action branch revision");
return;
}
string action = args[0]; /* bootcd */
string branch = args[1];
int revision = Int32.Parse(args[2]);
System.Environment.ExitCode = Publish(branch,
revision,
System.Environment.CurrentDirectory);
}
catch (Exception ex)
{
Fail(String.Format("Exception: {0}", ex));
System.Environment.ExitCode = 1;
}
}
}
}

View File

@@ -0,0 +1,145 @@
/*
* When using the ProcessStartInfo.RedirectStandardXxx properties there is a chance of
* the parent and child process blocking due to a race condition. This class handles the
* problem.
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdiagnosticsprocessstartinfoclassredirectstandardoutputtopic.asp
*/
using System;
using System.IO;
using System.Threading;
using System.Diagnostics;
namespace ReactOS.CustomRevisionAction
{
/// <summary>
/// Process that redirects standard output and standard error streams.
/// </summary>
public class RedirectableProcess
{
/// <summary>
/// Process.
/// </summary>
private Process process;
/// <summary>
/// Redirected standard error stream.
/// </summary>
private string processError;
/// <summary>
/// Redirected standard output stream.
/// </summary>
private string processOutput;
/// <summary>
/// Exit code.
/// </summary>
private int exitCode;
/// <summary>
/// Redirected standard error stream.
/// </summary>
public string ProcessError
{
get
{
return processError;
}
}
/// <summary>
/// Redirected standard output stream.
/// </summary>
public string ProcessOutput
{
get
{
return processOutput;
}
}
/// <summary>
/// Exit code.
/// </summary>
public int ExitCode
{
get
{
return exitCode;
}
}
/// <summary>
/// Run an excutable and redirect standard error and/or standard output safely.
/// </summary>
public RedirectableProcess(ProcessStartInfo processStartInfo)
{
Run(processStartInfo, null);
}
/// <summary>
/// Run an excutable and redirect standard error and/or standard output safely.
/// </summary>
public RedirectableProcess(ProcessStartInfo processStartInfo, string input)
{
Run(processStartInfo, input);
}
private void Run(ProcessStartInfo processStartInfo, string input)
{
process = new Process();
process.StartInfo = processStartInfo;
process.Start();
if (processStartInfo.RedirectStandardInput && input != null)
{
process.StandardInput.AutoFlush = true;
process.StandardInput.WriteLine(input);
}
Thread readStandardError = null;
if (processStartInfo.RedirectStandardError)
{
readStandardError = new Thread(new ThreadStart(ReadStandardError));
readStandardError.Start();
}
Thread readStandardOutput = null;
if (processStartInfo.RedirectStandardOutput)
{
readStandardOutput = new Thread(new ThreadStart(ReadStandardOutput));
readStandardOutput.Start();
}
if (processStartInfo.RedirectStandardError)
{
readStandardError.Join();
}
if (processStartInfo.RedirectStandardOutput)
{
readStandardOutput.Join();
}
process.WaitForExit();
exitCode = process.ExitCode;
process = null;
}
/// <summary>
/// Read standard error thread entry-point.
/// </summary>
private void ReadStandardError()
{
if (process != null)
{
processError = process.StandardError.ReadToEnd();
}
}
/// <summary>
/// Read standard output thread entry-point.
/// </summary>
private void ReadStandardOutput()
{
if (process != null)
{
processOutput = process.StandardOutput.ReadToEnd();
}
}
}
}

View File

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

View File

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

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="smtpServer" value="localhost" />
<add key="errorEmail" value="mailbox@somewhere-on-the-net" />
<add key="makeParameters" value="" />
<add key="fastDisk" value="" />
</appSettings>
</configuration>

View File

@@ -0,0 +1,14 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("ReactOS Sin Verifier")]
[assembly: AssemblyDescription("ReactOS Sin Verifier")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ReactOS Project")]
[assembly: AssemblyProduct("React Operating System")]
[assembly: AssemblyCopyright("Copyright 2005 ReactOS Project")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]

View File

@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<project name="ReactOS.Verify" default="build">
<property name="output.dir" value="bin" />
<target name="build" description="Build component">
<mkdir dir="${output.dir}" />
<csc target="exe"
output="${output.dir}\ReactOS.Verify.exe"
optimize="true"
debug="true"
doc="${output.dir}\ReactOS.Verify.xml"
warninglevel="0">
<sources>
<include name="*.cs" />
</sources>
</csc>
</target>
</project>

279
cis/ReactOS.Verify/Main.cs Normal file
View File

@@ -0,0 +1,279 @@
using System;
using System.IO;
using System.Diagnostics;
using System.Configuration;
using System.Web.Mail;
using System.Collections;
using System.Collections.Specialized;
namespace ReactOS.Verify
{
public class MainClass
{
/// <summary>
/// Run the application.
/// </summary>
/// <param name="script">Script to run.</param>
/// <param name="args">Arguments to pass to script.</param>
/// <param name="workingDirectory">Working directory.</param>
/// <param name="standardOutput">Receives standard output.</param>
/// <param name="standardError">Receives standard error.</param>
/// <returns>
/// Exit code.
/// </returns>
private static int RunScript(string script,
string args,
string workingDirectory,
StringDictionary environmentVarables,
out string standardOutput,
out string standardError)
{
ProcessStartInfo scriptProcessStartInfo = new ProcessStartInfo(script,
args);
scriptProcessStartInfo.CreateNoWindow = true;
/*
* All standard streams must be redirected.
* Otherwise DuplicateHandle() will fail.
*/
scriptProcessStartInfo.RedirectStandardInput = true;
scriptProcessStartInfo.RedirectStandardError = true;
scriptProcessStartInfo.RedirectStandardOutput = true;
scriptProcessStartInfo.UseShellExecute = false;
scriptProcessStartInfo.WorkingDirectory = workingDirectory;
if (environmentVarables != null)
{
foreach (DictionaryEntry de in environmentVarables)
scriptProcessStartInfo.EnvironmentVariables.Add(de.Key as string, de.Value as string);
}
RedirectableProcess redirectableProcess = new RedirectableProcess(scriptProcessStartInfo);
standardOutput = redirectableProcess.ProcessOutput;
standardError = redirectableProcess.ProcessError;
return redirectableProcess.ExitCode;
}
/// <summary>
/// Retrieve value of configuration from configuration file.
/// </summary>
/// <param name="name">Name of configuration option.</param>
/// <param name="defaultValue">
/// Default value to be returned if the option does not exist.
/// </param>
/// <returns>
/// Value of configuration option or null if the option does not
/// exist and no default value is provided.
/// </returns>
private static string GetConfigurationOption(string name,
string defaultValue)
{
if (ConfigurationSettings.AppSettings[name] != null)
{
string s = ConfigurationSettings.AppSettings[name].Trim();
return s.Equals(String.Empty) ? defaultValue : s;
}
else
return defaultValue;
}
/// <summary>
/// Send an email.
/// </summary>
/// <param name="subject">Subject of the email.</param>
/// <param name="body">Content of the email.</param>
private static void SendErrorMail(string subject, string body)
{
try
{
string smtpServer = GetConfigurationOption("smtpServer", "localhost");
string email = GetConfigurationOption("errorEmail", null);
if (email == null)
return;
MailMessage mm = new MailMessage();
mm.Priority = MailPriority.Normal;
mm.From = email;
mm.To = email;
mm.Subject = subject;
mm.Body += body;
mm.Body += "<br>";
mm.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = smtpServer;
SmtpMail.Send(mm);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
}
}
/// <summary>
/// Fail with an error message.
/// </summary>
/// <param name="text">Error message.</param>
private static void Fail(string text)
{
Console.WriteLine(text);
}
/// <summary>
/// Paths to fast disk for temporary files.
/// </summary>
private static string TemporaryFastDisk
{
get
{
string temporaryFastDisk = GetConfigurationOption("temporaryFastDisk", null);
if (temporaryFastDisk == null || temporaryFastDisk.Trim().Equals(String.Empty))
return null;
return temporaryFastDisk.Trim();
}
}
/// <summary>
/// Paths to fast disk for intermediate files.
/// </summary>
private static string IntermediateFastDisk
{
get
{
string intermediateFastDisk = GetConfigurationOption("intermediateFastDisk", null);
if (intermediateFastDisk == null || intermediateFastDisk.Trim().Equals(String.Empty))
return null;
return intermediateFastDisk.Trim();
}
}
/// <summary>
/// Paths to fast disk for output files.
/// </summary>
private static string OutputFastDisk
{
get
{
string outputFastDisk = GetConfigurationOption("outputFastDisk", null);
if (outputFastDisk == null || outputFastDisk.Trim().Equals(String.Empty))
return null;
return outputFastDisk.Trim();
}
}
/// <summary>
/// Return collection of environment variables.
/// </summary>
/// <returns>Collection of environment variables or null if there is none.</returns>
private static StringDictionary GetEnvironmentVarables()
{
StringDictionary environmentVarables = new StringDictionary();
if (TemporaryFastDisk != null)
environmentVarables.Add("ROS_TEMPORARY", TemporaryFastDisk);
if (IntermediateFastDisk != null)
environmentVarables.Add("ROS_INTERMEDIATE", IntermediateFastDisk);
if (OutputFastDisk != null)
environmentVarables.Add("ROS_OUTPUT", OutputFastDisk);
return environmentVarables;
}
/// <summary>
/// Run make.
/// </summary>
/// <param name="arguments">Arguments.</param>
/// <param name="standardOutput">Receives standard output.</param>
/// <param name="standardError">Receives standard error.</param>
/// <returns>Make exit code.</returns>
private static int RunMake(string arguments,
out string standardOutput,
out string standardError)
{
string make = "mingw32-make";
string makeParameters = GetConfigurationOption("makeParameters", "");
string reactosDirectory = Path.Combine(System.Environment.CurrentDirectory,
"reactos");
return RunScript(make,
makeParameters + " " + arguments,
reactosDirectory,
GetEnvironmentVarables(),
out standardOutput,
out standardError);
}
/// <summary>
/// Verify a revision of ReactOS by building it all.
/// </summary>
private static int VerifyFull()
{
string standardOutput;
string standardError;
int exitCode = RunMake("bootcd",
out standardOutput,
out standardError);
if (exitCode != 0)
{
Fail(String.Format("make bootcd failed: (error: {0}) {1}",
standardError,
standardOutput));
return exitCode;
}
string reactosDirectory = Path.Combine(System.Environment.CurrentDirectory,
"reactos");
string isoFilename = Path.Combine(reactosDirectory,
"ReactOS.iso");
if (!File.Exists(isoFilename))
Fail("make bootcd produced no ReactOS.iso");
return exitCode;
}
/// <summary>
/// Verify a revision of ReactOS by building parts.
/// </summary>
/// <param name="components">Comma separated list of components to build.</param>
private static int VerifyPartial(string components)
{
string standardOutput;
string standardError;
string componentParameters = "\"" + components.Replace(",", "\" \"") + "\"";
int exitCode = RunMake(componentParameters,
out standardOutput,
out standardError);
if (exitCode != 0)
Fail(String.Format("make failed for targets {0}: (error: {1}) {2}",
componentParameters,
standardError,
standardOutput));
return exitCode;
}
/// <summary>
/// Verify a revision of ReactOS.
/// </summary>
/// <param name="args">Arguments from command line.</param>
private static int Verify(string[] args)
{
if (args.Length > 0)
return VerifyPartial(args[0]);
else
return VerifyFull();
}
/// <summary>
/// Program entry point.
/// </summary>
/// <param name="args">Arguments from command line.</param>
/// <remarks>
/// If exit code is 0, then the commit was processed successfully.
/// If exit code is 1, then the commit was not processed successfully.
/// </remarks>
public static void Main(string[] args)
{
try
{
System.Environment.ExitCode = Verify(args);
}
catch (Exception ex)
{
string text = String.Format("Exception: {0}", ex);
SendErrorMail("ReactOS Verify Error", text);
System.Environment.ExitCode = 1;
}
}
}
}

View File

@@ -0,0 +1,145 @@
/*
* When using the ProcessStartInfo.RedirectStandardXxx properties there is a chance of
* the parent and child process blocking due to a race condition. This class handles the
* problem.
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdiagnosticsprocessstartinfoclassredirectstandardoutputtopic.asp
*/
using System;
using System.IO;
using System.Threading;
using System.Diagnostics;
namespace ReactOS.Verify
{
/// <summary>
/// Process that redirects standard output and standard error streams.
/// </summary>
public class RedirectableProcess
{
/// <summary>
/// Process.
/// </summary>
private Process process;
/// <summary>
/// Redirected standard error stream.
/// </summary>
private string processError;
/// <summary>
/// Redirected standard output stream.
/// </summary>
private string processOutput;
/// <summary>
/// Exit code.
/// </summary>
private int exitCode;
/// <summary>
/// Redirected standard error stream.
/// </summary>
public string ProcessError
{
get
{
return processError;
}
}
/// <summary>
/// Redirected standard output stream.
/// </summary>
public string ProcessOutput
{
get
{
return processOutput;
}
}
/// <summary>
/// Exit code.
/// </summary>
public int ExitCode
{
get
{
return exitCode;
}
}
/// <summary>
/// Run an excutable and redirect standard error and/or standard output safely.
/// </summary>
public RedirectableProcess(ProcessStartInfo processStartInfo)
{
Run(processStartInfo, null);
}
/// <summary>
/// Run an excutable and redirect standard error and/or standard output safely.
/// </summary>
public RedirectableProcess(ProcessStartInfo processStartInfo, string input)
{
Run(processStartInfo, input);
}
private void Run(ProcessStartInfo processStartInfo, string input)
{
process = new Process();
process.StartInfo = processStartInfo;
process.Start();
if (processStartInfo.RedirectStandardInput && input != null)
{
process.StandardInput.AutoFlush = true;
process.StandardInput.WriteLine(input);
}
Thread readStandardError = null;
if (processStartInfo.RedirectStandardError)
{
readStandardError = new Thread(new ThreadStart(ReadStandardError));
readStandardError.Start();
}
Thread readStandardOutput = null;
if (processStartInfo.RedirectStandardOutput)
{
readStandardOutput = new Thread(new ThreadStart(ReadStandardOutput));
readStandardOutput.Start();
}
if (processStartInfo.RedirectStandardError)
{
readStandardError.Join();
}
if (processStartInfo.RedirectStandardOutput)
{
readStandardOutput.Join();
}
process.WaitForExit();
exitCode = process.ExitCode;
process = null;
}
/// <summary>
/// Read standard error thread entry-point.
/// </summary>
private void ReadStandardError()
{
if (process != null)
{
processError = process.StandardError.ReadToEnd();
}
}
/// <summary>
/// Read standard output thread entry-point.
/// </summary>
private void ReadStandardOutput()
{
if (process != null)
{
processOutput = process.StandardOutput.ReadToEnd();
}
}
}
}

View File

@@ -1 +1,27 @@
semprini shit
fuck
pussy
ass
ass-
-ass
dumbass
jackass
fatass
asshole
smartass
cunt
fucker
bitch
dick
penile
stfu
omfg
lmao
ass.
-ass.
semprini
goat.cx
ekush
akshor
poop
guten morgen

View File

@@ -1,7 +1,5 @@
<?xml version="1.0" ?> <?xml version="1.0" ?>
<HresultList> <HresultList>
<Hresult text="S_OK" value="00000000" />
<Hresult text="S_FALSE" value="00000001" />
<Hresult text="STG_S_CONVERTED" value="00030200" /> <Hresult text="STG_S_CONVERTED" value="00030200" />
<Hresult text="STG_S_BLOCK" value="00030201" /> <Hresult text="STG_S_BLOCK" value="00030201" />
<Hresult text="STG_S_RETRYNOW" value="00030202" /> <Hresult text="STG_S_RETRYNOW" value="00030202" />

View File

@@ -2,69 +2,8 @@
<NtstatusList> <NtstatusList>
<Ntstatus text="STATUS_SUCCESS" value="00000000"></Ntstatus> <Ntstatus text="STATUS_SUCCESS" value="00000000"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0" value="00000000"></Ntstatus> <Ntstatus text="STATUS_WAIT_0" value="00000000"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 1" value="00000001"></Ntstatus> <Ntstatus text="STATUS_WAIT_1" value="00000001"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 2" value="00000002"></Ntstatus> <Ntstatus text="STATUS_WAIT_63" value="0000003F"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 3" value="00000003"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 4" value="00000004"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 5" value="00000005"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 6" value="00000006"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 7" value="00000007"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 8" value="00000008"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 9" value="00000009"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 10" value="0000000A"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 11" value="0000000B"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 12" value="0000000C"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 13" value="0000000D"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 14" value="0000000E"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 15" value="0000000F"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 16" value="00000010"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 17" value="00000011"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 18" value="00000012"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 19" value="00000013"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 20" value="00000014"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 21" value="00000015"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 22" value="00000016"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 23" value="00000017"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 24" value="00000018"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 25" value="00000019"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 26" value="0000001A"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 27" value="0000001B"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 28" value="0000001C"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 29" value="0000001D"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 30" value="0000001E"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 31" value="0000001F"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 32" value="00000020"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 33" value="00000021"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 34" value="00000022"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 35" value="00000023"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 36" value="00000024"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 37" value="00000025"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 38" value="00000026"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 39" value="00000027"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 40" value="00000028"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 41" value="00000029"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 42" value="0000002A"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 43" value="0000002B"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 44" value="0000002C"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 45" value="0000002D"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 46" value="0000002E"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 47" value="0000002F"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 48" value="00000030"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 49" value="00000031"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 50" value="00000032"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 51" value="00000033"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 52" value="00000034"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 53" value="00000035"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 54" value="00000036"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 55" value="00000037"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 56" value="00000038"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 57" value="00000039"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 58" value="0000003A"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 59" value="0000003B"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 60" value="0000003C"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 61" value="0000003D"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 62" value="0000003E"></Ntstatus>
<Ntstatus text="STATUS_WAIT_0 + 63" value="0000003F"></Ntstatus>
<Ntstatus text="STATUS_ABANDONED" value="00000080"></Ntstatus> <Ntstatus text="STATUS_ABANDONED" value="00000080"></Ntstatus>
<Ntstatus text="STATUS_ABANDONED_WAIT_0" value="00000080"></Ntstatus> <Ntstatus text="STATUS_ABANDONED_WAIT_0" value="00000080"></Ntstatus>
<Ntstatus text="STATUS_ABANDONED_WAIT_63" value="000000BF"></Ntstatus> <Ntstatus text="STATUS_ABANDONED_WAIT_63" value="000000BF"></Ntstatus>

View File

@@ -1,321 +0,0 @@
<?xml version="1.0" ?>
<WindowMessageList>
<WindowMessage text="WM_APP" value="32768" />
<WindowMessage text="WM_ACTIVATE" value="6" />
<WindowMessage text="WM_ACTIVATEAPP" value="28" />
<WindowMessage text="WM_AFXFIRST" value="864" />
<WindowMessage text="WM_AFXLAST" value="895" />
<WindowMessage text="WM_ASKCBFORMATNAME" value="780" />
<WindowMessage text="WM_CANCELJOURNAL" value="75" />
<WindowMessage text="WM_CANCELMODE" value="31" />
<WindowMessage text="WM_CAPTURECHANGED" value="533" />
<WindowMessage text="WM_CHANGECBCHAIN" value="781" />
<WindowMessage text="WM_CHANGEUISTATE" value="295" />
<WindowMessage text="WM_UPDATEUISTATE" value="296" />
<WindowMessage text="WM_QUERYUISTATE" value="297" />
<WindowMessage text="WM_CHAR" value="258" />
<WindowMessage text="WM_CHARTOITEM" value="47" />
<WindowMessage text="WM_CHILDACTIVATE" value="34" />
<WindowMessage text="WM_CLEAR" value="771" />
<WindowMessage text="WM_CLOSE" value="16" />
<WindowMessage text="WM_COMMAND" value="273" />
<WindowMessage text="WM_COMMNOTIFY" value="68" />
<WindowMessage text="WM_COMPACTING" value="65" />
<WindowMessage text="WM_COMPAREITEM" value="57" />
<WindowMessage text="WM_CONTEXTMENU" value="123" />
<WindowMessage text="WM_COPY" value="769" />
<WindowMessage text="WM_COPYDATA" value="74" />
<WindowMessage text="WM_CREATE" value="1" />
<WindowMessage text="WM_CTLCOLORBTN" value="309" />
<WindowMessage text="WM_CTLCOLORDLG" value="310" />
<WindowMessage text="WM_CTLCOLOREDIT" value="307" />
<WindowMessage text="WM_CTLCOLORLISTBOX" value="308" />
<WindowMessage text="WM_CTLCOLORMSGBOX" value="306" />
<WindowMessage text="WM_CTLCOLORSCROLLBAR" value="311" />
<WindowMessage text="WM_CTLCOLORSTATIC" value="312" />
<WindowMessage text="WM_CUT" value="768" />
<WindowMessage text="WM_DEADCHAR" value="259" />
<WindowMessage text="WM_DELETEITEM" value="45" />
<WindowMessage text="WM_DESTROY" value="2" />
<WindowMessage text="WM_DESTROYCLIPBOARD" value="775" />
<WindowMessage text="WM_DEVICECHANGE" value="537" />
<WindowMessage text="WM_DEVMODECHANGE" value="27" />
<WindowMessage text="WM_DISPLAYCHANGE" value="126" />
<WindowMessage text="WM_DRAWCLIPBOARD" value="776" />
<WindowMessage text="WM_DRAWITEM" value="43" />
<WindowMessage text="WM_DROPFILES" value="563" />
<WindowMessage text="WM_ENABLE" value="10" />
<WindowMessage text="WM_ENDSESSION" value="22" />
<WindowMessage text="WM_ENTERIDLE" value="289" />
<WindowMessage text="WM_ENTERMENULOOP" value="529" />
<WindowMessage text="WM_ENTERSIZEMOVE" value="561" />
<WindowMessage text="WM_ERASEBKGND" value="20" />
<WindowMessage text="WM_EXITMENULOOP" value="530" />
<WindowMessage text="WM_EXITSIZEMOVE" value="562" />
<WindowMessage text="WM_FONTCHANGE" value="29" />
<WindowMessage text="WM_GETDLGCODE" value="135" />
<WindowMessage text="WM_GETFONT" value="49" />
<WindowMessage text="WM_GETHOTKEY" value="51" />
<WindowMessage text="WM_GETICON" value="127" />
<WindowMessage text="WM_GETMINMAXINFO" value="36" />
<WindowMessage text="WM_GETTEXT" value="13" />
<WindowMessage text="WM_GETTEXTLENGTH" value="14" />
<WindowMessage text="WM_HANDHELDFIRST" value="856" />
<WindowMessage text="WM_HANDHELDLAST" value="863" />
<WindowMessage text="WM_HELP" value="83" />
<WindowMessage text="WM_HOTKEY" value="786" />
<WindowMessage text="WM_HSCROLL" value="276" />
<WindowMessage text="WM_HSCROLLCLIPBOARD" value="782" />
<WindowMessage text="WM_ICONERASEBKGND" value="39" />
<WindowMessage text="WM_INITDIALOG" value="272" />
<WindowMessage text="WM_INITMENU" value="278" />
<WindowMessage text="WM_INITMENUPOPUP" value="279" />
<WindowMessage text="WM_INPUTLANGCHANGE" value="81" />
<WindowMessage text="WM_INPUTLANGCHANGEREQUEST" value="80" />
<WindowMessage text="WM_KEYDOWN" value="256" />
<WindowMessage text="WM_KEYUP" value="257" />
<WindowMessage text="WM_KILLFOCUS" value="8" />
<WindowMessage text="WM_MDIACTIVATE" value="546" />
<WindowMessage text="WM_MDICASCADE" value="551" />
<WindowMessage text="WM_MDICREATE" value="544" />
<WindowMessage text="WM_MDIDESTROY" value="545" />
<WindowMessage text="WM_MDIGETACTIVE" value="553" />
<WindowMessage text="WM_MDIICONARRANGE" value="552" />
<WindowMessage text="WM_MDIMAXIMIZE" value="549" />
<WindowMessage text="WM_MDINEXT" value="548" />
<WindowMessage text="WM_MDIREFRESHMENU" value="564" />
<WindowMessage text="WM_MDIRESTORE" value="547" />
<WindowMessage text="WM_MDISETMENU" value="560" />
<WindowMessage text="WM_MDITILE" value="550" />
<WindowMessage text="WM_MEASUREITEM" value="44" />
<WindowMessage text="WM_MENURBUTTONUP" value="290" />
<WindowMessage text="WM_MENUCHAR" value="288" />
<WindowMessage text="WM_MENUSELECT" value="287" />
<WindowMessage text="WM_NEXTMENU" value="531" />
<WindowMessage text="WM_MOVE" value="3" />
<WindowMessage text="WM_MOVING" value="534" />
<WindowMessage text="WM_NCACTIVATE" value="134" />
<WindowMessage text="WM_NCCALCSIZE" value="131" />
<WindowMessage text="WM_NCCREATE" value="129" />
<WindowMessage text="WM_NCDESTROY" value="130" />
<WindowMessage text="WM_NCHITTEST" value="132" />
<WindowMessage text="WM_NCLBUTTONDBLCLK" value="163" />
<WindowMessage text="WM_NCLBUTTONDOWN" value="161" />
<WindowMessage text="WM_NCLBUTTONUP" value="162" />
<WindowMessage text="WM_NCMBUTTONDBLCLK" value="169" />
<WindowMessage text="WM_NCMBUTTONDOWN" value="167" />
<WindowMessage text="WM_NCMBUTTONUP" value="168" />
<WindowMessage text="WM_NCXBUTTONDOWN" value="171" />
<WindowMessage text="WM_NCXBUTTONUP" value="172" />
<WindowMessage text="WM_NCXBUTTONDBLCLK" value="173" />
<WindowMessage text="WM_NCMOUSEMOVE" value="160" />
<WindowMessage text="WM_NCMOUSEHOVER" value="0x02A0" />
<WindowMessage text="WM_NCMOUSELEAVE" value="0x02A2" />
<WindowMessage text="WM_NCPAINT" value="133" />
<WindowMessage text="WM_NCRBUTTONDBLCLK" value="166" />
<WindowMessage text="WM_NCRBUTTONDOWN" value="164" />
<WindowMessage text="WM_NCRBUTTONUP" value="165" />
<WindowMessage text="WM_NEXTDLGCTL" value="40" />
<WindowMessage text="WM_NEXTMENU" value="531" />
<WindowMessage text="WM_NOTIFY" value="78" />
<WindowMessage text="WM_NOTIFYFORMAT" value="85" />
<WindowMessage text="WM_NULL" value="0" />
<WindowMessage text="WM_PAINT" value="15" />
<WindowMessage text="WM_PAINTCLIPBOARD" value="777" />
<WindowMessage text="WM_PAINTICON" value="38" />
<WindowMessage text="WM_PALETTECHANGED" value="785" />
<WindowMessage text="WM_PALETTEISCHANGING" value="784" />
<WindowMessage text="WM_PARENTNOTIFY" value="528" />
<WindowMessage text="WM_PASTE" value="770" />
<WindowMessage text="WM_PENWINFIRST" value="896" />
<WindowMessage text="WM_PENWINLAST" value="911" />
<WindowMessage text="WM_POWER" value="72" />
<WindowMessage text="WM_POWERBROADCAST" value="536" />
<WindowMessage text="WM_PRINT" value="791" />
<WindowMessage text="WM_PRINTCLIENT" value="792" />
<WindowMessage text="WM_QUERYDRAGICON" value="55" />
<WindowMessage text="WM_QUERYENDSESSION" value="17" />
<WindowMessage text="WM_QUERYNEWPALETTE" value="783" />
<WindowMessage text="WM_QUERYOPEN" value="19" />
<WindowMessage text="WM_QUEUESYNC" value="35" />
<WindowMessage text="WM_QUIT" value="18" />
<WindowMessage text="WM_RENDERALLFORMATS" value="774" />
<WindowMessage text="WM_RENDERFORMAT" value="773" />
<WindowMessage text="WM_SETCURSOR" value="32" />
<WindowMessage text="WM_SETFOCUS" value="7" />
<WindowMessage text="WM_SETFONT" value="48" />
<WindowMessage text="WM_SETHOTKEY" value="50" />
<WindowMessage text="WM_SETICON" value="128" />
<WindowMessage text="WM_SETREDRAW" value="11" />
<WindowMessage text="WM_SETTEXT" value="12" />
<WindowMessage text="WM_SETTINGCHANGE" value="26" />
<WindowMessage text="WM_SHOWWINDOW" value="24" />
<WindowMessage text="WM_SIZE" value="5" />
<WindowMessage text="WM_SIZECLIPBOARD" value="779" />
<WindowMessage text="WM_SIZING" value="532" />
<WindowMessage text="WM_SPOOLERSTATUS" value="42" />
<WindowMessage text="WM_STYLECHANGED" value="125" />
<WindowMessage text="WM_STYLECHANGING" value="124" />
<WindowMessage text="WM_SYSCHAR" value="262" />
<WindowMessage text="WM_SYSCOLORCHANGE" value="21" />
<WindowMessage text="WM_SYSCOMMAND" value="274" />
<WindowMessage text="WM_SYSDEADCHAR" value="263" />
<WindowMessage text="WM_SYSKEYDOWN" value="260" />
<WindowMessage text="WM_SYSKEYUP" value="261" />
<WindowMessage text="WM_TCARD" value="82" />
<WindowMessage text="WM_TIMECHANGE" value="30" />
<WindowMessage text="WM_TIMER" value="275" />
<WindowMessage text="WM_SYSTIMER" value="280" />
<WindowMessage text="WM_UNDO" value="772" />
<WindowMessage text="WM_USER" value="1024" />
<WindowMessage text="WM_USERCHANGED" value="84" />
<WindowMessage text="WM_VKEYTOITEM" value="46" />
<WindowMessage text="WM_VSCROLL" value="277" />
<WindowMessage text="WM_VSCROLLCLIPBOARD" value="778" />
<WindowMessage text="WM_WINDOWPOSCHANGED" value="71" />
<WindowMessage text="WM_WINDOWPOSCHANGING" value="70" />
<WindowMessage text="WM_WININICHANGE" value="26" />
<WindowMessage text="WM_KEYFIRST" value="256" />
<WindowMessage text="WM_KEYLAST" value="264" />
<WindowMessage text="WM_SYNCPAINT" value="136" />
<WindowMessage text="WM_MOUSEACTIVATE" value="33" />
<WindowMessage text="WM_MOUSEMOVE" value="512" />
<WindowMessage text="WM_LBUTTONDOWN" value="513" />
<WindowMessage text="WM_LBUTTONUP" value="514" />
<WindowMessage text="WM_LBUTTONDBLCLK" value="515" />
<WindowMessage text="WM_RBUTTONDOWN" value="516" />
<WindowMessage text="WM_RBUTTONUP" value="517" />
<WindowMessage text="WM_RBUTTONDBLCLK" value="518" />
<WindowMessage text="WM_MBUTTONDOWN" value="519" />
<WindowMessage text="WM_MBUTTONUP" value="520" />
<WindowMessage text="WM_MBUTTONDBLCLK" value="521" />
<WindowMessage text="WM_MOUSEWHEEL" value="522" />
<WindowMessage text="WM_MOUSEFIRST" value="512" />
<WindowMessage text="WM_XBUTTONDOWN" value="523" />
<WindowMessage text="WM_XBUTTONUP" value="524" />
<WindowMessage text="WM_XBUTTONDBLCLK" value="525" />
<WindowMessage text="WM_MOUSELAST" value="525" />
<WindowMessage text="WM_MOUSEHOVER" value="0x2A1" />
<WindowMessage text="WM_MOUSELEAVE" value="0x2A3" />
<WindowMessage text="WM_THEMECHANGED" value="794" />
<WindowMessage text="BM_CLICK" value="245" />
<WindowMessage text="BM_GETCHECK" value="240" />
<WindowMessage text="BM_GETIMAGE" value="246" />
<WindowMessage text="BM_GETSTATE" value="242" />
<WindowMessage text="BM_SETCHECK" value="241" />
<WindowMessage text="BM_SETIMAGE" value="247" />
<WindowMessage text="BM_SETSTATE" value="243" />
<WindowMessage text="BM_SETSTYLE" value="244" />
<WindowMessage text="CB_ADDSTRING" value="323" />
<WindowMessage text="CB_DELETESTRING" value="324" />
<WindowMessage text="CB_DIR" value="325" />
<WindowMessage text="CB_FINDSTRING" value="332" />
<WindowMessage text="CB_FINDSTRINGEXACT" value="344" />
<WindowMessage text="CB_GETCOMBOBOXINFO" value="356" />
<WindowMessage text="CB_GETCOUNT" value="326" />
<WindowMessage text="CB_GETCURSEL" value="327" />
<WindowMessage text="CB_GETDROPPEDCONTROLRECT" value="338" />
<WindowMessage text="CB_GETDROPPEDSTATE" value="343" />
<WindowMessage text="CB_GETDROPPEDWIDTH" value="351" />
<WindowMessage text="CB_GETEDITSEL" value="320" />
<WindowMessage text="CB_GETEXTENDEDUI" value="342" />
<WindowMessage text="CB_GETHORIZONTALEXTENT" value="349" />
<WindowMessage text="CB_GETITEMDATA" value="336" />
<WindowMessage text="CB_GETITEMHEIGHT" value="340" />
<WindowMessage text="CB_GETLBTEXT" value="328" />
<WindowMessage text="CB_GETLBTEXTLEN" value="329" />
<WindowMessage text="CB_GETLOCALE" value="346" />
<WindowMessage text="CB_GETTOPINDEX" value="347" />
<WindowMessage text="CB_INITSTORAGE" value="353" />
<WindowMessage text="CB_INSERTSTRING" value="330" />
<WindowMessage text="CB_LIMITTEXT" value="321" />
<WindowMessage text="CB_RESETCONTENT" value="331" />
<WindowMessage text="CB_SELECTSTRING" value="333" />
<WindowMessage text="CB_SETCURSEL" value="334" />
<WindowMessage text="CB_SETDROPPEDWIDTH" value="352" />
<WindowMessage text="CB_SETEDITSEL" value="322" />
<WindowMessage text="CB_SETEXTENDEDUI" value="341" />
<WindowMessage text="CB_SETHORIZONTALEXTENT" value="350" />
<WindowMessage text="CB_SETITEMDATA" value="337" />
<WindowMessage text="CB_SETITEMHEIGHT" value="339" />
<WindowMessage text="CB_SETLOCALE" value="345" />
<WindowMessage text="CB_SETTOPINDEX" value="348" />
<WindowMessage text="CB_SHOWDROPDOWN" value="335" />
<WindowMessage text="EM_CANUNDO" value="198" />
<WindowMessage text="EM_CHARFROMPOS" value="215" />
<WindowMessage text="EM_EMPTYUNDOBUFFER" value="205" />
<WindowMessage text="EM_FMTLINES" value="200" />
<WindowMessage text="EM_GETFIRSTVISIBLELINE" value="206" />
<WindowMessage text="EM_GETHANDLE" value="189" />
<WindowMessage text="EM_GETLIMITTEXT" value="213" />
<WindowMessage text="EM_GETLINE" value="196" />
<WindowMessage text="EM_GETLINECOUNT" value="186" />
<WindowMessage text="EM_GETMARGINS" value="212" />
<WindowMessage text="EM_GETMODIFY" value="184" />
<WindowMessage text="EM_GETPASSWORDCHAR" value="210" />
<WindowMessage text="EM_GETRECT" value="178" />
<WindowMessage text="EM_GETSEL" value="176" />
<WindowMessage text="EM_GETTHUMB" value="190" />
<WindowMessage text="EM_GETWORDBREAKPROC" value="209" />
<WindowMessage text="EM_LIMITTEXT" value="197" />
<WindowMessage text="EM_LINEFROMCHAR" value="201" />
<WindowMessage text="EM_LINEINDEX" value="187" />
<WindowMessage text="EM_LINELENGTH" value="193" />
<WindowMessage text="EM_LINESCROLL" value="182" />
<WindowMessage text="EM_POSFROMCHAR" value="214" />
<WindowMessage text="EM_REPLACESEL" value="194" />
<WindowMessage text="EM_SCROLL" value="181" />
<WindowMessage text="EM_SCROLLCARET" value="183" />
<WindowMessage text="EM_SETHANDLE" value="188" />
<WindowMessage text="EM_SETLIMITTEXT" value="197" />
<WindowMessage text="EM_SETMARGINS" value="211" />
<WindowMessage text="EM_SETMODIFY" value="185" />
<WindowMessage text="EM_SETPASSWORDCHAR" value="204" />
<WindowMessage text="EM_SETREADONLY" value="207" />
<WindowMessage text="EM_SETRECT" value="179" />
<WindowMessage text="EM_SETRECTNP" value="180" />
<WindowMessage text="EM_SETSEL" value="177" />
<WindowMessage text="EM_SETTABSTOPS" value="203" />
<WindowMessage text="EM_SETWORDBREAKPROC" value="208" />
<WindowMessage text="EM_UNDO" value="199" />
<WindowMessage text="LB_ADDFILE" value="406" />
<WindowMessage text="LB_ADDSTRING" value="384" />
<WindowMessage text="LB_DELETESTRING" value="386" />
<WindowMessage text="LB_DIR" value="397" />
<WindowMessage text="LB_FINDSTRING" value="399" />
<WindowMessage text="LB_FINDSTRINGEXACT" value="418" />
<WindowMessage text="LB_GETANCHORINDEX" value="413" />
<WindowMessage text="LB_GETCARETINDEX" value="415" />
<WindowMessage text="LB_GETCOUNT" value="395" />
<WindowMessage text="LB_GETCURSEL" value="392" />
<WindowMessage text="LB_GETHORIZONTALEXTENT" value="403" />
<WindowMessage text="LB_GETITEMDATA" value="409" />
<WindowMessage text="LB_GETITEMHEIGHT" value="417" />
<WindowMessage text="LB_GETITEMRECT" value="408" />
<WindowMessage text="LB_GETLOCALE" value="422" />
<WindowMessage text="LB_GETSEL" value="391" />
<WindowMessage text="LB_GETSELCOUNT" value="400" />
<WindowMessage text="LB_GETSELITEMS" value="401" />
<WindowMessage text="LB_GETTEXT" value="393" />
<WindowMessage text="LB_GETTEXTLEN" value="394" />
<WindowMessage text="LB_GETTOPINDEX" value="398" />
<WindowMessage text="LB_INITSTORAGE" value="424" />
<WindowMessage text="LB_INSERTSTRING" value="385" />
<WindowMessage text="LB_ITEMFROMPOINT" value="425" />
<WindowMessage text="LB_RESETCONTENT" value="388" />
<WindowMessage text="LB_SELECTSTRING" value="396" />
<WindowMessage text="LB_SELITEMRANGE" value="411" />
<WindowMessage text="LB_SELITEMRANGEEX" value="387" />
<WindowMessage text="LB_SETANCHORINDEX" value="412" />
<WindowMessage text="LB_SETCARETINDEX" value="414" />
<WindowMessage text="LB_SETCOLUMNWIDTH" value="405" />
<WindowMessage text="LB_SETCOUNT" value="423" />
<WindowMessage text="LB_SETCURSEL" value="390" />
<WindowMessage text="LB_SETHORIZONTALEXTENT" value="404" />
<WindowMessage text="LB_SETITEMDATA" value="410" />
<WindowMessage text="LB_SETITEMHEIGHT" value="416" />
<WindowMessage text="LB_SETLOCALE" value="421" />
<WindowMessage text="LB_SETSEL" value="389" />
<WindowMessage text="LB_SETTABSTOPS" value="402" />
<WindowMessage text="LB_SETTOPINDEX" value="407" />
</WindowMessageList>

View File

@@ -5,16 +5,11 @@
<add key="IRCServerHostPort" value="6667" /> <add key="IRCServerHostPort" value="6667" />
<add key="IRCChannelNames" value="channel1;channel2" /> <add key="IRCChannelNames" value="channel1;channel2" />
<add key="IRCBotName" value="MyBot" /> <add key="IRCBotName" value="MyBot" />
<add key="IRCBotPassword" value="MyPassword" />
<add key="ChmPath" value="C:\IRC\TechBot\CHM" /> <add key="ChmPath" value="C:\IRC\TechBot\CHM" />
<add key="MainChm" value="kmarch.chm" /> <add key="MainChm" value="kmarch.chm" />
<add key="NtstatusXml" value="ntstatus.xml" /> <add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" />
<add key="WinerrorXml" value="winerror.xml" /> <add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />
<add key="HresultXml" value="hresult.xml" /> <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />
<add key="WmXml" value="wm.xml" /> <add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" />
<add key="SvnCommand" value="svn co svn://svn.reactos.org/trunk/reactos" />
<add key="BugUrl" value="http://www.reactos.org/bugzilla/show_bug.cgi?id={0}" />
<add key="WineBugUrl" value="http://bugs.winehq.org/show_bug.cgi?id={0}" />
<add key="SambaBugUrl" value="https://bugzilla.samba.org/show_bug.cgi?id={0}" />
</appSettings> </appSettings>
</configuration> </configuration>

View File

@@ -74,18 +74,6 @@ namespace TechBot.Console
} }
} }
private static string IRCBotPassword
{
get
{
string optionName = "IRCBotPassword";
string s = ConfigurationSettings.AppSettings[optionName];
VerifyRequiredOption(optionName,
s);
return s;
}
}
private static string ChmPath private static string ChmPath
{ {
get get
@@ -146,18 +134,6 @@ namespace TechBot.Console
} }
} }
private static string WmXml
{
get
{
string optionName = "WmXml";
string s = ConfigurationSettings.AppSettings[optionName];
VerifyRequiredOption(optionName,
s);
return s;
}
}
private static string SvnCommand private static string SvnCommand
{ {
get get
@@ -170,61 +146,18 @@ namespace TechBot.Console
} }
} }
private static string BugUrl
{
get
{
string optionName = "BugUrl";
string s = ConfigurationSettings.AppSettings[optionName];
VerifyRequiredOption(optionName,
s);
return s;
}
}
private static string WineBugUrl
{
get
{
string optionName = "WineBugUrl";
string s = ConfigurationSettings.AppSettings[optionName];
VerifyRequiredOption(optionName,
s);
return s;
}
}
private static string SambaBugUrl
{
get
{
string optionName = "SambaBugUrl";
string s = ConfigurationSettings.AppSettings[optionName];
VerifyRequiredOption(optionName,
s);
return s;
}
}
private static void RunIrcService() private static void RunIrcService()
{ {
IrcService ircService = new IrcService(IRCServerHostName, IrcService ircService = new IrcService(IRCServerHostName,
IRCServerHostPort, IRCServerHostPort,
IRCChannelNames, IRCChannelNames,
IRCBotName, IRCBotName,
IRCBotPassword,
ChmPath, ChmPath,
MainChm, MainChm,
NtstatusXml, NtstatusXml,
WinerrorXml, WinerrorXml,
HresultXml, HresultXml,
WmXml, SvnCommand);
SvnCommand,
BugUrl,
WineBugUrl,
SambaBugUrl);
ircService.Run(); ircService.Run();
} }
@@ -243,11 +176,7 @@ namespace TechBot.Console
NtstatusXml, NtstatusXml,
WinerrorXml, WinerrorXml,
HresultXml, HresultXml,
WmXml, SvnCommand);
SvnCommand,
BugUrl,
WineBugUrl,
SambaBugUrl);
service.Run(); service.Run();
while (true) while (true)
{ {

View File

@@ -16,7 +16,6 @@ namespace TechBot.IRCLibrary
public const string PONG = "PONG"; public const string PONG = "PONG";
public const string PRIVMSG = "PRIVMSG"; public const string PRIVMSG = "PRIVMSG";
public const string USER = "USER"; public const string USER = "USER";
public const string PASS = "PASS";
public const string RPL_NAMREPLY = "353"; public const string RPL_NAMREPLY = "353";
public const string RPL_ENDOFNAMES = "366"; public const string RPL_ENDOFNAMES = "366";

View File

@@ -556,40 +556,26 @@ namespace TechBot.IRCLibrary
public void ChangeNick(string nickname) public void ChangeNick(string nickname)
{ {
if (nickname == null) if (nickname == null)
{
throw new ArgumentNullException("nickname", "Nickname cannot be null."); throw new ArgumentNullException("nickname", "Nickname cannot be null.");
}
/* NICK <nickname> [ <hopcount> ] */ /* NICK <nickname> [ <hopcount> ] */
SendMessage(new IrcMessage(IRC.NICK, nickname)); SendMessage(new IrcMessage(IRC.NICK, nickname));
} }
/// <summary>
/// Submit password to identify user.
/// </summary>
/// <param name="password">Password of registered nick.</param>
private void SubmitPassword(string password)
{
if (password == null)
throw new ArgumentNullException("password", "Password cannot be null.");
/* PASS <password> */
SendMessage(new IrcMessage(IRC.PASS, password));
}
/// <summary> /// <summary>
/// Register. /// Register.
/// </summary> /// </summary>
/// <param name="nickname">New nickname.</param> /// <param name="nickname">New nickname.</param>
/// <param name="password">Password. Can be null.</param>
/// <param name="realname">Real name. Can be null.</param> /// <param name="realname">Real name. Can be null.</param>
public void Register(string nickname, public void Register(string nickname, string realname)
string password,
string realname)
{ {
if (nickname == null) if (nickname == null)
{
throw new ArgumentNullException("nickname", "Nickname cannot be null."); throw new ArgumentNullException("nickname", "Nickname cannot be null.");
}
firstPingReceived = false; firstPingReceived = false;
if (password != null)
SubmitPassword(password);
ChangeNick(nickname); ChangeNick(nickname);
/* OLD: USER <username> <hostname> <servername> <realname> */ /* OLD: USER <username> <hostname> <servername> <realname> */
/* NEW: USER <user> <mode> <unused> <realname> */ /* NEW: USER <user> <mode> <unused> <realname> */

View File

@@ -1,71 +0,0 @@
using System;
namespace TechBot.Library
{
public class BugCommand : BaseCommand, ICommand
{
private IServiceOutput serviceOutput;
private string RosBugUrl;
private string WineBugUrl;
private string SambaBugUrl;
public BugCommand(IServiceOutput serviceOutput,
string RosBugUrl,
string WineBugUrl,
string SambaBugUrl)
{
this.serviceOutput = serviceOutput;
this.RosBugUrl = RosBugUrl;
this.WineBugUrl = WineBugUrl;
this.SambaBugUrl = SambaBugUrl;
}
public bool CanHandle(string commandName)
{
return CanHandle(commandName,
new string[] { "bug" });
}
public void Handle(MessageContext context,
string commandName,
string parameters)
{
string bugText = parameters;
if (bugText.Equals(String.Empty))
{
serviceOutput.WriteLine(context,
"Please provide a valid bug number.");
return;
}
NumberParser np = new NumberParser();
long bug = np.Parse(bugText);
if (np.Error)
{
serviceOutput.WriteLine(context,
String.Format("{0} is not a valid bug number.",
bugText));
return;
}
string bugUrl = this.RosBugUrl;
if (context is ChannelMessageContext)
{
ChannelMessageContext channelContext = context as ChannelMessageContext;
if (channelContext.Channel.Name == "winehackers")
bugUrl = this.WineBugUrl;
else if (channelContext.Channel.Name == "samba-technical")
bugUrl = this.SambaBugUrl;
}
serviceOutput.WriteLine(context,
String.Format(bugUrl, bug));
}
public string Help()
{
return "!bug <number>";
}
}
}

View File

@@ -1,204 +0,0 @@
using System;
using System.Xml;
using System.Collections;
namespace TechBot.Library
{
public class ErrorCommand : BaseCommand, ICommand
{
private IServiceOutput serviceOutput;
private NtStatusCommand ntStatus;
private WinerrorCommand winerror;
private HresultCommand hresult;
public ErrorCommand(IServiceOutput serviceOutput, string ntstatusXml,
string winerrorXml, string hresultXml)
{
this.serviceOutput = serviceOutput;
this.ntStatus = new NtStatusCommand(serviceOutput,
ntstatusXml);
this.winerror = new WinerrorCommand(serviceOutput,
winerrorXml);
this.hresult = new HresultCommand(serviceOutput,
hresultXml);
}
public bool CanHandle(string commandName)
{
return CanHandle(commandName,
new string[] { "error" });
}
private static int GetSeverity(long error)
{
return (int)((error >> 30) & 0x3);
}
private static bool IsCustomer(long error)
{
return (error & 0x20000000) != 0;
}
private static bool IsReserved(long error)
{
return (error & 0x10000000) != 0;
}
private static int GetFacility(long error)
{
return (int)((error >> 16) & 0xFFF);
}
private static short GetCode(long error)
{
return (short)((error >> 0) & 0xFFFF);
}
private static string FormatSeverity(long error)
{
int severity = GetSeverity(error);
switch (severity)
{
case 0: return "SUCCESS";
case 1: return "INFORMATIONAL";
case 2: return "WARNING";
case 3: return "ERROR";
}
return null;
}
private static string FormatFacility(long error)
{
int facility = GetFacility(error);
return facility.ToString();
}
private static string FormatCode(long error)
{
int code = GetCode(error);
return code.ToString();
}
public void Handle(MessageContext context,
string commandName,
string parameters)
{
string originalErrorText = parameters.Trim();
if (originalErrorText.Equals(String.Empty))
{
serviceOutput.WriteLine(context,
"Please provide an Error Code.");
return;
}
string errorText = originalErrorText;
retry:
NumberParser np = new NumberParser();
long error = np.Parse(errorText);
if (np.Error)
{
serviceOutput.WriteLine(context,
String.Format("{0} is not a valid Error Code.",
originalErrorText));
return;
}
ArrayList descriptions = new ArrayList();
// Error is out of bounds
if ((ulong)error > uint.MaxValue)
{
// Do nothing
}
// Error is outside of the range [0, 65535]: it cannot be a plain Win32 error code
else if ((ulong)error > ushort.MaxValue)
{
// Customer bit is set: custom error code
if (IsCustomer(error))
{
string description = String.Format("[custom, severity {0}, facility {1}, code {2}]",
FormatSeverity(error),
FormatFacility(error),
FormatCode(error));
descriptions.Add(description);
}
// Reserved bit is set: HRESULT_FROM_NT(ntstatus)
else if (IsReserved(error))
{
int status = (int)(error & 0xCFFFFFFF);
string description = ntStatus.GetNtstatusDescription(status);
if (description == null)
description = status.ToString("X");
description = String.Format("HRESULT_FROM_NT({0})", description);
descriptions.Add(description);
}
// Win32 facility: HRESULT_FROM_WIN32(winerror)
else if (GetFacility(error) == 7)
{
// Must be an error code
if (GetSeverity(error) == 2)
{
short err = GetCode(error);
string description = winerror.GetWinerrorDescription(err);
if (description == null)
description = err.ToString("D");
description = String.Format("HRESULT_FROM_WIN32({0})", description);
descriptions.Add(description);
}
}
}
string winerrorDescription = winerror.GetWinerrorDescription(error);
string ntstatusDescription = ntStatus.GetNtstatusDescription(error);
string hresultDescription = hresult.GetHresultDescription(error);
if (winerrorDescription != null)
descriptions.Add(winerrorDescription);
if (ntstatusDescription != null)
descriptions.Add(ntstatusDescription);
if (hresultDescription != null)
descriptions.Add(hresultDescription);
if (descriptions.Count == 0)
{
// Last chance heuristics: attempt to parse a 8-digit decimal as hexadecimal
if (errorText.Length == 8)
{
errorText = "0x" + errorText;
goto retry;
}
serviceOutput.WriteLine(context,
String.Format("I don't know about Error Code {0}.",
originalErrorText));
}
else if (descriptions.Count == 1)
{
string description = (string)descriptions[0];
serviceOutput.WriteLine(context,
String.Format("{0} is {1}.",
originalErrorText,
description));
}
else
{
serviceOutput.WriteLine(context,
String.Format("{0} could be:",
originalErrorText));
foreach(string description in descriptions)
serviceOutput.WriteLine(context, String.Format("\t{0}", description));
}
}
public string Help()
{
return "!error <value>";
}
}
}

View File

@@ -6,12 +6,14 @@ namespace TechBot.Library
public class HresultCommand : BaseCommand, ICommand public class HresultCommand : BaseCommand, ICommand
{ {
private IServiceOutput serviceOutput; private IServiceOutput serviceOutput;
private string hresultXml;
private XmlDocument hresultXmlDocument; private XmlDocument hresultXmlDocument;
public HresultCommand(IServiceOutput serviceOutput, public HresultCommand(IServiceOutput serviceOutput,
string hresultXml) string hresultXml)
{ {
this.serviceOutput = serviceOutput; this.serviceOutput = serviceOutput;
this.hresultXml = hresultXml;
hresultXmlDocument = new XmlDocument(); hresultXmlDocument = new XmlDocument();
hresultXmlDocument.Load(hresultXml); hresultXmlDocument.Load(hresultXml);
} }
@@ -65,7 +67,7 @@ namespace TechBot.Library
return "!hresult <value>"; return "!hresult <value>";
} }
public string GetHresultDescription(long hresult) private string GetHresultDescription(long hresult)
{ {
XmlElement root = hresultXmlDocument.DocumentElement; XmlElement root = hresultXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("Hresult[@value='{0}']", XmlNode node = root.SelectSingleNode(String.Format("Hresult[@value='{0}']",

View File

@@ -11,15 +11,12 @@ namespace TechBot.Library
private int port; private int port;
private string channelnames; private string channelnames;
private string botname; private string botname;
private string password;
private string chmPath; private string chmPath;
private string mainChm; private string mainChm;
private string ntstatusXml; private string ntstatusXml;
private string winerrorXml; private string winerrorXml;
private string hresultXml; private string hresultXml;
private string wmXml;
private string svnCommand; private string svnCommand;
private string bugUrl, WineBugUrl, SambaBugUrl;
private IrcClient client; private IrcClient client;
private ArrayList channels = new ArrayList(); /* IrcChannel */ private ArrayList channels = new ArrayList(); /* IrcChannel */
private TechBotService service; private TechBotService service;
@@ -29,36 +26,23 @@ namespace TechBot.Library
int port, int port,
string channelnames, string channelnames,
string botname, string botname,
string password,
string chmPath, string chmPath,
string mainChm, string mainChm,
string ntstatusXml, string ntstatusXml,
string winerrorXml, string winerrorXml,
string hresultXml, string hresultXml,
string wmXml, string svnCommand)
string svnCommand,
string BugUrl,
string WineBugUrl,
string SambaBugUrl)
{ {
this.hostname = hostname; this.hostname = hostname;
this.port = port; this.port = port;
this.channelnames = channelnames; this.channelnames = channelnames;
this.botname = botname; this.botname = botname;
if (password == null || password.Trim() == "") this.chmPath = chmPath;
this.password = null; this.mainChm = mainChm;
else this.ntstatusXml = ntstatusXml;
this.password = password; this.winerrorXml = winerrorXml;
this.chmPath = chmPath; this.hresultXml = hresultXml;
this.mainChm = mainChm; this.svnCommand = svnCommand;
this.ntstatusXml = ntstatusXml;
this.winerrorXml = winerrorXml;
this.hresultXml = hresultXml;
this.wmXml = wmXml;
this.svnCommand = svnCommand;
this.bugUrl = BugUrl;
this.WineBugUrl = WineBugUrl;
this.SambaBugUrl = SambaBugUrl;
} }
public void Run() public void Run()
@@ -69,11 +53,7 @@ namespace TechBot.Library
ntstatusXml, ntstatusXml,
winerrorXml, winerrorXml,
hresultXml, hresultXml,
wmXml, svnCommand);
svnCommand,
bugUrl,
WineBugUrl,
SambaBugUrl);
service.Run(); service.Run();
client = new IrcClient(); client = new IrcClient();
@@ -84,7 +64,7 @@ namespace TechBot.Library
hostname, port)); hostname, port));
client.Connect(hostname, port); client.Connect(hostname, port);
System.Console.WriteLine("Connected..."); System.Console.WriteLine("Connected...");
client.Register(botname, password, null); client.Register(botname, null);
System.Console.WriteLine(String.Format("Registered as {0}...", botname)); System.Console.WriteLine(String.Format("Registered as {0}...", botname));
JoinChannels(); JoinChannels();

View File

@@ -67,7 +67,7 @@ namespace TechBot.Library
return "!ntstatus <value>"; return "!ntstatus <value>";
} }
public string GetNtstatusDescription(long ntstatus) private string GetNtstatusDescription(long ntstatus)
{ {
XmlElement root = ntstatusXmlDocument.DocumentElement; XmlElement root = ntstatusXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("Ntstatus[@value='{0}']", XmlNode node = root.SelectSingleNode(String.Format("Ntstatus[@value='{0}']",

View File

@@ -9,7 +9,7 @@ namespace TechBot.Library
private const string SpecialHexCharacters = "ABCDEF"; private const string SpecialHexCharacters = "ABCDEF";
private static bool IsSpecialHexCharacter(char ch) private bool IsSpecialHexCharacter(char ch)
{ {
foreach (char specialChar in SpecialHexCharacters) foreach (char specialChar in SpecialHexCharacters)
{ {
@@ -19,7 +19,7 @@ namespace TechBot.Library
return false; return false;
} }
private static bool HasSpecialHexCharacters(string s) private bool HasSpecialHexCharacters(string s)
{ {
foreach (char ch in s) foreach (char ch in s)
{ {
@@ -35,7 +35,7 @@ namespace TechBot.Library
{ {
Error = false; Error = false;
bool useHex = false; bool useHex = false;
if (s.StartsWith("0x", StringComparison.InvariantCultureIgnoreCase)) if (s.StartsWith("0x"))
{ {
s = s.Substring(2); s = s.Substring(2);
useHex = true; useHex = true;

View File

@@ -12,11 +12,7 @@
<File name=".\NumberParser.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\NumberParser.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\HresultCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\HresultCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\WinerrorCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\WinerrorCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\ErrorCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\SvnCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\SvnCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\BugCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\WmCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\MessageContext.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
</Contents> </Contents>
<References> <References>
<Reference type="Project" refto="CHMLibrary" localcopy="True" /> <Reference type="Project" refto="CHMLibrary" localcopy="True" />
@@ -40,4 +36,4 @@
<Output directory="..\bin\Release" assembly="TechBot.Library" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> <Output directory="..\bin\Release" assembly="TechBot.Library" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
</Configuration> </Configuration>
</Configurations> </Configurations>
</Project> </Project>

View File

@@ -15,22 +15,16 @@ namespace TechBot.Library
private string ntstatusXml; private string ntstatusXml;
private string winerrorXml; private string winerrorXml;
private string hresultXml; private string hresultXml;
private string wmXml;
private string svnCommand; private string svnCommand;
private string bugUrl, WineBugUrl, SambaBugUrl;
private ArrayList commands = new ArrayList(); private ArrayList commands = new ArrayList();
public TechBotService(IServiceOutput serviceOutput, public TechBotService(IServiceOutput serviceOutput,
string chmPath, string chmPath,
string mainChm, string mainChm,
string ntstatusXml, string ntstatusXml,
string winerrorXml, string winerrorXml,
string hresultXml, string hresultXml,
string wmXml, string svnCommand)
string svnCommand,
string bugUrl,
string WineBugUrl,
string SambaBugUrl)
{ {
this.serviceOutput = serviceOutput; this.serviceOutput = serviceOutput;
this.chmPath = chmPath; this.chmPath = chmPath;
@@ -38,38 +32,24 @@ namespace TechBot.Library
this.ntstatusXml = ntstatusXml; this.ntstatusXml = ntstatusXml;
this.winerrorXml = winerrorXml; this.winerrorXml = winerrorXml;
this.hresultXml = hresultXml; this.hresultXml = hresultXml;
this.wmXml = wmXml;
this.svnCommand = svnCommand; this.svnCommand = svnCommand;
this.bugUrl = bugUrl;
this.WineBugUrl = WineBugUrl;
this.SambaBugUrl = SambaBugUrl;
} }
public void Run() public void Run()
{ {
commands.Add(new HelpCommand(serviceOutput, commands.Add(new HelpCommand(serviceOutput,
commands)); commands));
/*commands.Add(new ApiCommand(serviceOutput, commands.Add(new ApiCommand(serviceOutput,
chmPath, chmPath,
mainChm));*/ mainChm));
commands.Add(new NtStatusCommand(serviceOutput, commands.Add(new NtStatusCommand(serviceOutput,
ntstatusXml)); ntstatusXml));
commands.Add(new WinerrorCommand(serviceOutput, commands.Add(new WinerrorCommand(serviceOutput,
winerrorXml)); winerrorXml));
commands.Add(new HresultCommand(serviceOutput, commands.Add(new HresultCommand(serviceOutput,
hresultXml)); hresultXml));
commands.Add(new ErrorCommand(serviceOutput,
ntstatusXml,
winerrorXml,
hresultXml));
commands.Add(new WmCommand(serviceOutput,
wmXml));
commands.Add(new SvnCommand(serviceOutput, commands.Add(new SvnCommand(serviceOutput,
svnCommand)); svnCommand));
commands.Add(new BugCommand(serviceOutput,
bugUrl,
WineBugUrl,
SambaBugUrl));
} }
public void InjectMessage(MessageContext context, public void InjectMessage(MessageContext context,

View File

@@ -67,7 +67,7 @@ namespace TechBot.Library
return "!winerror <value>"; return "!winerror <value>";
} }
public string GetWinerrorDescription(long winerror) private string GetWinerrorDescription(long winerror)
{ {
XmlElement root = winerrorXmlDocument.DocumentElement; XmlElement root = winerrorXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("Winerror[@value='{0}']", XmlNode node = root.SelectSingleNode(String.Format("Winerror[@value='{0}']",

View File

@@ -1,104 +0,0 @@
using System;
using System.Xml;
namespace TechBot.Library
{
public class WmCommand : BaseCommand, ICommand
{
private IServiceOutput serviceOutput;
private string wmXml;
private XmlDocument wmXmlDocument;
public WmCommand(IServiceOutput serviceOutput,
string wmXml)
{
this.serviceOutput = serviceOutput;
this.wmXml = wmXml;
wmXmlDocument = new XmlDocument();
wmXmlDocument.Load(wmXml);
}
public bool CanHandle(string commandName)
{
return CanHandle(commandName,
new string[] { "wm" });
}
public void Handle(MessageContext context,
string commandName,
string parameters)
{
string wmText = parameters;
if (wmText.Equals(String.Empty))
{
serviceOutput.WriteLine(context,
"Please provide a valid window message value or name.");
return;
}
NumberParser np = new NumberParser();
long wm = np.Parse(wmText);
string output;
if (np.Error)
{
// Assume "!wm <name>" form.
output = GetWmNumber(wmText);
}
else
{
output = GetWmDescription(wm);
}
if (output != null)
{
serviceOutput.WriteLine(context,
String.Format("{0} is {1}.",
wmText,
output));
}
else
{
serviceOutput.WriteLine(context,
String.Format("I don't know about window message {0}.",
wmText));
}
}
public string Help()
{
return "!wm <value> or !wm <name>";
}
private string GetWmDescription(long wm)
{
XmlElement root = wmXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@value='{0}']",
wm));
if (node != null)
{
XmlAttribute text = node.Attributes["text"];
if (text == null)
throw new Exception("Node has no text attribute.");
return text.Value;
}
else
return null;
}
private string GetWmNumber(string wmName)
{
XmlElement root = wmXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@text='{0}']",
wmName));
if (node != null)
{
XmlAttribute value = node.Attributes["value"];
if (value == null)
throw new Exception("Node has no value attribute.");
return value.Value;
}
else
return null;
}
}
}

View File

@@ -5,16 +5,11 @@
<add key="IRCServerHostPort" value="6667" /> <add key="IRCServerHostPort" value="6667" />
<add key="IRCChannelNames" value="channel1;channel2" /> <add key="IRCChannelNames" value="channel1;channel2" />
<add key="IRCBotName" value="MyBot" /> <add key="IRCBotName" value="MyBot" />
<add key="IRCBotPassword" value="MyPassword" />
<add key="ChmPath" value="C:\IRC\TechBot\CHM" /> <add key="ChmPath" value="C:\IRC\TechBot\CHM" />
<add key="MainChm" value="kmarch.chm" /> <add key="MainChm" value="kmarch.chm" />
<add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" /> <add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" />
<add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" /> <add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />
<add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" /> <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />
<add key="WmXml" value="C:\IRC\TechBot\wm.xml" /> <add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" />
<add key="SvnCommand" value="svn co svn://svn.reactos.org/trunk/reactos" />
<add key="BugUrl" value="http://www.reactos.org/bugzilla/show_bug.cgi?id={0}" />
<add key="WineBugUrl" value="http://bugs.winehq.org/show_bug.cgi?id={0}" />
<add key="SambaBugUrl" value="https://bugzilla.samba.org/show_bug.cgi?id={0}" />
</appSettings> </appSettings>
</configuration> </configuration>

View File

@@ -11,15 +11,12 @@ namespace TechBot
private int IRCServerHostPort; private int IRCServerHostPort;
private string IRCChannelNames; private string IRCChannelNames;
private string IRCBotName; private string IRCBotName;
private string IRCBotPassword;
private string ChmPath; private string ChmPath;
private string MainChm; private string MainChm;
private string NtstatusXml; private string NtstatusXml;
private string HresultXml; private string HresultXml;
private string WmXml;
private string WinerrorXml; private string WinerrorXml;
private string SvnCommand; private string SvnCommand;
private string BugUrl, WineBugUrl, SambaBugUrl;
private EventLog eventLog; private EventLog eventLog;
public ServiceThread(EventLog eventLog) public ServiceThread(EventLog eventLog)
@@ -33,17 +30,12 @@ namespace TechBot
IRCServerHostPort = Int32.Parse(ConfigurationSettings.AppSettings["IRCServerHostPort"]); IRCServerHostPort = Int32.Parse(ConfigurationSettings.AppSettings["IRCServerHostPort"]);
IRCChannelNames = ConfigurationSettings.AppSettings["IRCChannelNames"]; IRCChannelNames = ConfigurationSettings.AppSettings["IRCChannelNames"];
IRCBotName = ConfigurationSettings.AppSettings["IRCBotName"]; IRCBotName = ConfigurationSettings.AppSettings["IRCBotName"];
IRCBotPassword = ConfigurationSettings.AppSettings["IRCBotPassword"];
ChmPath = ConfigurationSettings.AppSettings["ChmPath"]; ChmPath = ConfigurationSettings.AppSettings["ChmPath"];
MainChm = ConfigurationSettings.AppSettings["MainChm"]; MainChm = ConfigurationSettings.AppSettings["MainChm"];
NtstatusXml = ConfigurationSettings.AppSettings["NtstatusXml"]; NtstatusXml = ConfigurationSettings.AppSettings["NtstatusXml"];
HresultXml = ConfigurationSettings.AppSettings["HresultXml"]; HresultXml = ConfigurationSettings.AppSettings["HresultXml"];
WmXml = ConfigurationSettings.AppSettings["WmXml"];
WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"]; WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"];
SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"]; SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"];
BugUrl = ConfigurationSettings.AppSettings["BugUrl"];
WineBugUrl = ConfigurationSettings.AppSettings["WineBugUrl"];
SambaBugUrl = ConfigurationSettings.AppSettings["SambaBugUrl"];
} }
public void Run() public void Run()
@@ -55,17 +47,12 @@ namespace TechBot
IRCServerHostPort, IRCServerHostPort,
IRCChannelNames, IRCChannelNames,
IRCBotName, IRCBotName,
IRCBotPassword,
ChmPath, ChmPath,
MainChm, MainChm,
NtstatusXml, NtstatusXml,
WinerrorXml, WinerrorXml,
HresultXml, HresultXml,
WmXml, SvnCommand);
SvnCommand,
BugUrl,
WineBugUrl,
SambaBugUrl);
ircService.Run(); ircService.Run();
} }

2
msvc6/.cvsignore Normal file
View File

@@ -0,0 +1,2 @@
*.ncb
*.opt

102
msvc6/README.txt Normal file
View File

@@ -0,0 +1,102 @@
ReactOS Microsoft Visual C/C++ 6.0 IDE files
This is the Microsoft Visual C/C++ 6.0 project workspace and project
files for a few of the ReactOS binaries. They are ONLY included as a
convenience, and is NOT to be considered supported, or even correct.
If you build a binary that misbehaves using these files, you _might_
be able to get in touch with someone to fix the problem
BUT DO NOT COUNT ON IT!
The only supported build system for ReactOS is the one documented at
www.reactos.com.
------------------------------------------------------------------
Please, before you start playing with this, read the whole of
this document.
Before you can use these project files, you _need_ to make a successful
build using the normal ReactOS build system. There are some vital files
that needs to be created, and currently only the normal build creates these.
Once that is done, you need to generate the kernel-mode service "table"
file by running nmake (from this point on you can use the "native"
MSVC tools) from the directory MSVC6\iface\native.
This will generate MSVC6\ntoskrnl\nt_zw_msvc.c, an MSVC compatible inline-
assembler version of the file otherwise known as reactos\ntoskrnl\nt\zw.c.
Next, go to def_converter and run nmake. This builds the tool to convert
the .def files for HAL and the kernel from the MinGW format to something
more suitable for the MSVC linker, and also generates these .def files
to their target location [1].
Now you should be set to fire up the IDE and load the project workspace.
When building HAL or the kernel for the first time using these
project files, just doing it the "normal" way _will not work_.
The linker will complain about missing library, and it will fail.
The reason for this is a circular dependency between these two binaries.
Currently you need to follow these procedures [2]:
- Select hal as your active project.
- Select Project/Settings.
- Select the Link tab.
- Select "General" from the Category drop-list.
- Temporary remove the explicit linker library
(e.g. "..\ntoskrnl\Debug\ntoskrnl.lib")
- Select "Customize" from the Category drop-list.
- Check the "Force file output" checkbox.
- Build hal.
- Uncheck "Force file output".
- Put back the removed import library.
- Now build the ntoskrnl. Do NOT try to build hal again until
you have sucessfully built the kernel, and the linker has
generated its import library!
- Now you can "Clean" hal, and build it as usual.
If everything worked as expected, you should now have both ntoskrnl.exe
and hal.dll freshly built.
LIMITATIONS/DEVIATIONS (from the MinGW build):
- Since there can only be one resource file/project, the kernel had
to choose between either its version resource, or its message table.
The messages won.
- Do NOT open the .rc files in the IDE's resource editor. Chances are
it will assume ownership over them and fill them up with at least
conditional compilation macros.
NOTES:
[1] This is needed due to differences in handling of decorated names
in .def files. While both MinGW GCC and MSVC generates decorated names
in the same way for at least plain cdecl and stdcall C functions, the
MSVC linker expects names in the .def file to be either
- an exact match of the decorated name, in case it exports the
decorated name from the linked binary, or
- just the name without any decoration, in case it exports just the
name of the symbol from the linked binary (to allow for e.g.
GetProcAddress using the undecorated name) - but keeps the decorated
names in the import library to handle and "redirect" linker requests
for those decorated symbols, and point them to the undercorated names
in the binary exporting them - so that a binary A, at link time,
importing symbols from binary B of the form "_name@0" will resolve
that symbol from the import library, but the linked binary A will
reference it as just "name".
The ROS .def files contains a mix, "half-decorated", where the leading
undescores are missing, but the trailing "@n" (for stdcall functions)
are present.
[2] Theoretically it could be possible to use a hal.lib generated by the
following procedure, removing the need for the manual steps above.
cd MSVC6\hal\Debug
lib \def:..\..\..\reactos\hal\hal\hal.def
but I have not tested it, and take no responsibility for its effectiveness.

41
msvc6/ReactOS.dsw Normal file
View File

@@ -0,0 +1,41 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "hal"=.\hal\hal.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "ntoskrnl"=.\ntoskrnl\ntoskrnl.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,64 @@
// Uses hard-coded filenames to require a minimum of input.
// You think this file should be licensed? OK then,
// Copyright (C) 2004, Mike Nordell. Use as you whish.
#include <fstream>
#include <string>
#include <algorithm>
const char szSrc1[] = "..\\..\\reactos\\ntoskrnl\\ntoskrnl.def";
const char szDst1[] = "..\\ntoskrnl\\ntoskrnl.def";
const char szSrc2[] = "..\\..\\reactos\\hal\\hal\\hal.def";
const char szDst2[] = "..\\hal\\hal.def";
enum File
{
Kernel,
HAL
};
std::string do_kernel_replacements(std::string& s)
{
std::string s2 = s.c_str(); // to fixup size after replacements
if (s2 == "ExAllocateFromPagedLookasideList") {
s2 += "=ExiAllocateFromPagedLookasideList";
} else
if (s2 == "ExFreeToPagedLookasideList") {
s2 += "=ExiFreeToPagedLookasideList";
} else
if (s2 == "MmLockPagableImageSection") {
s2 += "=MmLockPagableDataSection";
}
return s2;
}
void convert_def(const char* szSrc, const char* szDst, File file)
{
using namespace std;
ifstream in(szSrc);
ofstream out(szDst);
string s;
while (getline(in, s).good()) {
if (!s.size()) {
continue;
}
if (s[0] != ';') { // only replace non-comment lines
if (s[0] == '@') {
s.erase(0, 1);
}
replace(s.begin(), s.end(), '@', '\0');
if (file == Kernel) {
s = do_kernel_replacements(s);
}
}
out << s << endl;
}
}
int main()
{
convert_def(szSrc1, szDst1, Kernel);
convert_def(szSrc2, szDst2, HAL);
return 0;
}

View File

@@ -0,0 +1,19 @@
# $Id: makefile,v 1.1 2004/02/06 08:21:54 fireball Exp $
#
# ReactOS Operating System - .def converter for HAL and the kernel
#
DEF_HAL = ..\hal\hal.def
DEF_KRNL = ..\ntoskrnl\ntoskrnl.def
CPPFLAGS = /GX
all: def_converter.exe $(DEF_HAL) $(DEF_KRNL)
$(DEF_HAL) : ..\..\reactos\hal\hal\hal.def
def_converter.exe
$(DEF_KRNL) : ..\..\reactos\ntoskrnl\ntoskrnl.def
def_converter.exe
def_converter.exe : def_converter.cpp

3
msvc6/hal/.cvsignore Normal file
View File

@@ -0,0 +1,3 @@
Debug
Release
hal.def

243
msvc6/hal/hal.dsp Normal file
View File

@@ -0,0 +1,243 @@
# Microsoft Developer Studio Project File - Name="hal" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=hal - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "hal.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "hal.mak" CFG="hal - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "hal - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "hal - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "hal - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HAL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /Ot /Og /Os /Ob1 /I "..\..\reactos\include" /I "..\..\reactos\hal\halx86\include" /I "..\..\reactos\ntoskrnl\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "i386" /D "__NTHAL__" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x41d /d "NDEBUG"
# ADD RSC /l 0x417 /i "..\..\reactos\include" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386
# ADD LINK32 ..\ntoskrnl\Release\ntoskrnl.lib /nologo /dll /machine:I386 /fixed:no
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "hal - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HAL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Z7 /Od /I "..\..\reactos\include" /I "..\..\reactos\hal\halx86\include" /I "..\..\reactos\ntoskrnl\include" /D "_WINDOWS" /D "__NTHAL__" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "i386" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x41d /d "_DEBUG"
# ADD RSC /l 0x417 /i "..\..\reactos\include" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ..\ntoskrnl\Debug\ntoskrnl.lib /nologo /dll /incremental:no /debug /machine:I386 /pdbtype:sept /fixed:no
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "hal - Win32 Release"
# Name "hal - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\adapter.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\beep.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\bus.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\display.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\dma.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\drive.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\enum.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\fmutex.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\fmutex_tmn.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\halinit.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\halx86mp.rc
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\halx86up.rc
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\irql.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\isa.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\kdbg.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\mca.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\misc.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\mp.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\mpsirql.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\pci.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\portio.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\pwroff.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\reboot.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\spinlock.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\spinlock_tmn.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\sysbus.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\sysinfo.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\time.c
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\timer.c
# End Source File
# End Group
# Begin Group "include"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\include\bus.h
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\include\hal.h
# End Source File
# Begin Source File
SOURCE=..\..\reactos\hal\halx86\include\mps.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=.\hal.def
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,392 @@
/* $Id: genntdll.c,v 1.1 2004/02/06 08:21:56 fireball Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS version of ntdll
* FILE: iface/native/genntdll.c
* PURPOSE: Generates the system call stubs in ntdll
* CHANGE HISTORY: Added a '@xx' to deal with stdcall [ Ariadne ]
* 19990616 (ea)
* Four arguments now required; 4th is the file
* for ntoskrnl ZwXXX functions (which are merely calls
* to twin NtXXX calls, via int 0x2e (x86).
* 19990617 (ea)
* Fixed a bug in function numbers in kernel ZwXXX stubs.
*
*/
/* INCLUDE ******************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PARAMETERIZED_LIBS
/* #define VERBOSE */
#define INPUT_BUFFER_SIZE 255
/* FUNCTIONS ****************************************************************/
void write_syscall_stub(FILE* out, FILE* out3, char* name, char* name2,
char* nr_args, unsigned int sys_call_idx)
{
int i;
int nArgBytes = atoi(nr_args);
#ifdef PARAMETERIZED_LIBS
fprintf(out,"__asm__(\"\\n\\t.global _%s@%s\\n\\t\"\n",name,nr_args);
fprintf(out,"\".global _%s@%s\\n\\t\"\n",name2,nr_args);
fprintf(out,"\"_%s@%s:\\n\\t\"\n",name,nr_args);
fprintf(out,"\"_%s@%s:\\n\\t\"\n",name2,nr_args);
#else
fprintf(out,"__asm__(\"\\n\\t.global _%s\\n\\t\"\n",name);
fprintf(out,"\".global _%s\\n\\t\"\n",name2);
fprintf(out,"\"_%s:\\n\\t\"\n",name);
fprintf(out,"\"_%s:\\n\\t\"\n",name2);
#endif
fprintf(out,"\t\"pushl\t%%ebp\\n\\t\"\n");
fprintf(out,"\t\"movl\t%%esp, %%ebp\\n\\t\"\n");
fprintf(out,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx);
fprintf(out,"\t\"lea\t8(%%ebp),%%edx\\n\\t\"\n");
fprintf(out,"\t\"int\t$0x2E\\n\\t\"\n");
fprintf(out,"\t\"popl\t%%ebp\\n\\t\"\n");
fprintf(out,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
/*
* Now write the NTOSKRNL stub for the
* current system call. ZwXXX does NOT
* alias the corresponding NtXXX call.
*/
#if 0
fprintf(out3,"__asm__(\n");
fprintf(out3,"\".global _%s@%s\\n\\t\"\n",name2,nr_args);
fprintf(out3,"\"_%s@%s:\\n\\t\"\n",name2,nr_args);
fprintf(out3,"\t\"pushl\t%%ebp\\n\\t\"\n");
fprintf(out3,"\t\"movl\t%%esp, %%ebp\\n\\t\"\n");
fprintf(out3,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx);
fprintf(out3,"\t\"lea\t8(%%ebp),%%edx\\n\\t\"\n");
fprintf(out3,"\t\"int\t$0x2E\\n\\t\"\n");
fprintf(out3,"\t\"popl\t%%ebp\\n\\t\"\n");
fprintf(out3,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
#else
fprintf(out3,"__declspec(naked) __stdcall\n");
fprintf(out3,"%s(", name2); // make it emit callconv, reval and full signature too
for (i=0; i*4 < nArgBytes; ++i) {
fprintf(out3,"int dummy%d", i);
if (((i+1)*4) < nArgBytes) fprintf(out3,",");
}
fprintf(out3,")\n{\n");
fprintf(out3,"\t__asm {\n");
fprintf(out3,"\t\tpush\tebp\n");
fprintf(out3,"\t\tmov\tebp, esp\n");
fprintf(out3,"\t\tmov\teax,%d\n",sys_call_idx);
fprintf(out3,"\t\tlea\tedx, 8[ebp]\n");
fprintf(out3,"\t\tint\t0x2E\n");
fprintf(out3,"\t\tpop\tebp\n");
fprintf(out3,"\t\tret\t%s\n",nr_args);
fprintf(out3,"\t}\n");
fprintf(out3,"}\n\n");
#endif
}
int makeSystemServiceTable(FILE *in, FILE *out)
{
char line [INPUT_BUFFER_SIZE];
char *s;
char *name;
char *name2;
int sys_call_idx;
char *nr_args;
char *stmp;
/*
* Main SSDT Header
*/
fprintf(out,"// Machine generated, don't edit\n");
fprintf(out,"\n\n");
/*
* First we build the Main SSDT
*/
fprintf(out,"\n\n\n");
fprintf(out,"SSDT MainSSDT[] = {\n");
for ( /* First system call has index zero */
sys_call_idx = 0;
/* Go on until EOF or read zero bytes */
( (!feof(in))
&& (fgets(line, sizeof line, in) != NULL)
);
/* Next system call index */
sys_call_idx++
)
{
if ((s = (char *) strchr(line,'\r')) != NULL)
{
*s = '\0';
}
/*
* Skip comments (#) and empty lines.
*/
s = & line[0];
if ((*s) != '#' && (*s) != '\0')
{
/* Extract the NtXXX name */
name = (char *)strtok(s," \t");
/* Extract the ZwXXX name */
name2 = (char *)strtok(NULL," \t");
//value = strtok(NULL," \t");
/* Extract the stack size */
nr_args = (char *)strtok(NULL," \t");
/*
* Remove, if present, the trailing LF.
*/
if ((stmp = strchr(nr_args, '\n')) != NULL)
{
*stmp = '\0';
}
#ifdef VERBOSE
printf("%3d \"%s\"\n",sys_call_idx,name);
#endif
if (sys_call_idx > 0)
{
fprintf(out,",\n");
}
/*
* Now write the current system call's name
* in the service table.
*/
fprintf(out,"\t\t{ (ULONG)%s }",name);
}
}
/* Close the service table (C syntax) */
fprintf(out,"\n};\n");
/*
* Now we build the Main SSPT
*/
rewind(in);
fprintf(out,"\n\n\n");
fprintf(out,"SSPT MainSSPT[] = {\n");
for ( /* First system call has index zero */
sys_call_idx = 0;
/* Go on until EOF or read zero bytes */
( (!feof(in))
&& (fgets(line, sizeof line, in) != NULL)
);
/* Next system call index */
sys_call_idx++
)
{
if ((s = (char *) strchr(line,'\r')) != NULL)
{
*s = '\0';
}
/*
* Skip comments (#) and empty lines.
*/
s = & line[0];
if ((*s) != '#' && (*s) != '\0')
{
/* Extract the NtXXX name */
name = (char *)strtok(s," \t");
/* Extract the ZwXXX name */
name2 = (char *)strtok(NULL," \t");
//value = strtok(NULL," \t");
/* Extract the stack size */
nr_args = (char *)strtok(NULL," \t");
/*
* Remove, if present, the trailing LF.
*/
if ((stmp = strchr(nr_args, '\n')) != NULL)
{
*stmp = '\0';
}
#ifdef VERBOSE
printf("%3d \"%s\"\n",sys_call_idx,name);
#endif
if (sys_call_idx > 0)
{
fprintf(out,",\n");
}
/*
* Now write the current system call's ID
* in the service table along with its Parameters Size.
*/
fprintf(out,"\t\t{ %s }",nr_args);
}
}
/*
* Close the service table (C syntax)
*/
fprintf(out,"\n};\n");
/*
* We write some useful defines
*/
fprintf(out, "\n\n#define MIN_SYSCALL_NUMBER 0\n");
fprintf(out, "#define MAX_SYSCALL_NUMBER %d\n", sys_call_idx-1);
fprintf(out, "#define NUMBER_OF_SYSCALLS %d\n", sys_call_idx);
return(0);
}
int
process(
FILE * in,
FILE * out,
FILE * out2,
FILE * out3
)
{
char line [INPUT_BUFFER_SIZE];
char * s;
char * name; /* NtXXX name */
char * name2; /* ZwXXX name */
int sys_call_idx; /* NtXXX index number in the service table */
char * nr_args; /* stack_size / machine_word_size */
char * stmp;
/*
* NTDLL stubs file header
*/
fprintf(out,"// Machine generated, don't edit\n");
fprintf(out,"\n\n");
/*
* NTOSKRNL Zw functions stubs header
*/
fprintf(out3,"// Machine generated by genntdll, don't edit\n");
fprintf(out3,"\n\n");
/*
* Scan the database. DB is a text file; each line
* is a record, which contains data for one system
* function. Each record has three columns:
*
* NT_NAME (e.g. NtCreateProcess)
* ZW_NAME (e.g. ZwCreateProcess)
* STACK_SIZE (in machine words: for x[3456]86
* processors a machine word is 4 bytes)
*/
for ( /* First system call has index zero */
sys_call_idx = 0;
/* Go on until EOF or read zero bytes */
( (!feof(in))
&& (fgets(line, sizeof line, in) != NULL)
);
/* Next system call index */
sys_call_idx++
)
{
/*
* Remove, if present, the trailing CR.
* (os specific?)
*/
if ((s = (char *) strchr(line,'\r')) != NULL)
{
*s = '\0';
}
/*
* Skip comments (#) and empty lines.
*/
s = & line[0];
if ((*s) != '#' && (*s) != '\0')
{
/* Extract the NtXXX name */
name = (char *)strtok(s," \t");
/* Extract the ZwXXX name */
name2 = (char *)strtok(NULL," \t");
//value = strtok(NULL," \t");
/* Extract the stack size */
nr_args = (char *)strtok(NULL," \t");
/*
* Remove, if present, the trailing LF.
*/
if ((stmp = strchr(nr_args, '\n')) != NULL)
{
*stmp = '\0';
}
#ifdef VERBOSE
printf("%3d \"%s\"\n",sys_call_idx,name);
#endif
/*
* Write the NTDLL stub for the current
* system call: NtXXX and ZwXXX symbols
* are aliases.
*/
write_syscall_stub(out, out3, name, name2,
nr_args, sys_call_idx);
}
}
return(0);
}
void usage(char * argv0)
{
printf("Usage: %s sysfuncs.lst napi.c napi.h zw.c\n"
" sysfuncs.lst system functions database\n"
" napi.c NTDLL stubs\n"
" napi.h NTOSKRNL service table\n"
" zw.c NTOSKRNL Zw stubs\n",
argv0
);
}
int main(int argc, char* argv[])
{
FILE * in; /* System calls database */
FILE * out1; /* NTDLL stubs */
FILE * out2; /* SERVICE_TABLE */
FILE * out3; /* NTOSKRNL Zw stubs */
int ret;
if (argc != 5)
{
usage(argv[0]);
return(1);
}
in = fopen(argv[1],"rb");
if (in == NULL)
{
perror("Failed to open input file (system calls database)");
return(1);
}
out1 = fopen(argv[2],"wb");
if (out1 == NULL)
{
perror("Failed to open output file (NTDLL stubs)");
return(1);
}
out2 = fopen(argv[3],"wb");
if (out2 == NULL)
{
perror("Failed to open output file (NTOSKRNL service table)");
return(1);
}
out3 = fopen(argv[4],"wb");
if (out3 == NULL)
{
perror("Failed to open output file (NTOSKRNL Zw stubs)");
return(1);
}
ret = process(in,out1,out2,out3);
rewind(in);
ret = makeSystemServiceTable(in, out2);
fclose(in);
fclose(out1);
fclose(out2);
fclose(out3);
return(ret);
}

View File

@@ -0,0 +1,22 @@
# $Id: makefile,v 1.1 2004/02/06 08:21:56 fireball Exp $
#
# ReactOS Operating System - MSVC6 Zw functions stubs to call generator
#
SYSTEM_CALLS_DB = ..\..\..\reactos\iface\native\sysfuncs.lst
KERNEL_ZW_CALLS =..\..\ntoskrnl\nt_zw_msvc.c
all: genntdll.exe $(KERNEL_ZW_CALLS)
$(KERNEL_ZW_CALLS) : $(SYSTEM_CALLS_DB)
genntdll.exe $(SYSTEM_CALLS_DB) foo1 foo2 $(KERNEL_ZW_CALLS)
-@del foo1
-@del foo2
genntdll.exe : genntdll.c
clean:
-@del *.exe
-@del *.obj
-@del $(KERNEL_ZW_CALLS)

View File

@@ -0,0 +1,4 @@
Debug
Release
nt_zw_msvc.c
ntoskrnl.def

View File

@@ -0,0 +1,167 @@
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-25
*
* 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.
*/
/* $Id: ke_i386_bthread.c,v 1.1 2004/02/06 08:21:56 fireball Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/i386/bthread.S
* PURPOSE: Trap handlers
* PROGRAMMER: David Welch (david.welch@seh.ox.ac.uk)
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
/* Values for contextflags */
#define CONTEXT_i386 0x10000
#ifndef CONTEXT_CONTROL
#define CONTEXT_CONTROL (CONTEXT_i386 | 1)
#endif
#ifndef CONTEXT_INTEGER
#define CONTEXT_INTEGER (CONTEXT_i386 | 2)
#endif
#ifndef CONTEXT_SEGMENTS
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 4)
#endif
#ifndef CONTEXT_FLOATING_POINT
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8)
#endif
#ifndef CONTEXT_DEBUG_REGISTERS
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x10)
#endif
#ifndef CONTEXT_FULL
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#endif
/* FUNCTIONS *****************************************************************/
void KeReturnFromSystemCallWithHook();
VOID PiBeforeBeginThread(CONTEXT c);
/*
*
*/
__declspec(naked)
VOID PsBeginThread(PKSTART_ROUTINE StartRoutine, PVOID StartContext)
{
/*
* This isn't really a function, we are called as the return address
* of the context switch function
*/
/*
* Do the necessary prolog after a context switch
*/
__asm
{
call PiBeforeBeginThread
/*
* Call the actual start of the thread
*/
// We must NOT use the arguments by name. VC then uses EBP-relative
// addressing, and with an EBP of 0 you can imagine what happens.
mov ebx, 4[esp] // StartRoutine
mov eax, 8[esp] // StartContext
push eax
call ebx /* Call the start routine */
add esp, 4
/*
* Terminate the thread
*/
push eax
call PsTerminateSystemThread
add esp, 4
}
/* If that fails then bug check */
KeBugCheck(0);
/* And if that fails then loop */
for (;;)
; // forever
}
__declspec(naked)
VOID PsBeginThreadWithContextInternal(VOID)
{
/*
* This isn't really a function, we are called as the return
* address of a context switch
*/
/*
* Do the necessary prolog before the context switch
*/
__asm
{
call PiBeforeBeginThread
/*
* Load the context flags.
*/
pop ebx
/*
* Load the debugging registers
*/
test ebx, (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386)
jz L1
pop eax __asm mov dr0, eax
pop eax __asm mov dr1, eax
pop eax __asm mov dr2, eax
pop eax __asm mov dr3, eax
pop eax __asm mov dr6, eax
pop eax __asm mov dr7, eax
jmp L3
L1:
add esp, 24
L3:
/*
* Load the floating point registers
*/
mov eax, HardwareMathSupport
test eax,eax
jz L2
test ebx, (CONTEXT_FLOATING_POINT & ~CONTEXT_i386)
jz L2
frstor [esp]
L2:
add esp, 112
/* Load the rest of the thread's user mode context. */
mov eax, 0
jmp KeReturnFromSystemCallWithHook
}
}

View File

@@ -0,0 +1,114 @@
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
*
* 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.
*/
/*
* FILE: ntoskrnl/ke/i386/vm86_sup.S
* PURPOSE: V86 mode support
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 09/10/00
*/
/* INCLUDES ******************************************************************/
#pragma hdrstop
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
#include <internal/v86m.h>
#include <ntos/tss.h>
#include <internal/trap.h>
#include <internal/ps.h>
#include <roscfg.h>
#include <internal/ntoskrnl.h>
#include <internal/i386/segment.h>
// no arg-list, but asm doesn't care anyway
void KiInterruptDispatch();
#define DEFINE_INT_HANDLER(N) \
__declspec(naked) \
void irq_handler_##N() \
{ \
__asm pushad \
__asm push ds \
__asm push es \
__asm push fs \
__asm mov eax, 0xceafbeef \
__asm push eax \
__asm mov ax, KERNEL_DS \
__asm mov ds, ax \
__asm mov es, ax \
__asm mov ax, PCR_SELECTOR \
__asm mov fs, ax \
__asm push esp \
__asm push N \
__asm call KiInterruptDispatch \
__asm pop eax \
__asm pop eax \
__asm pop eax \
__asm pop fs \
__asm pop es \
__asm pop ds \
__asm popad \
__asm iretd
// NOTE: The inline assembler can't deal with having the final brace,
// ending the function, on the same line as an __asm, why there is
// none here and it MUST be added when using the macro!
DEFINE_INT_HANDLER(0)
}
DEFINE_INT_HANDLER(1)
}
DEFINE_INT_HANDLER(2)
}
DEFINE_INT_HANDLER(3)
}
DEFINE_INT_HANDLER(4)
}
DEFINE_INT_HANDLER(5)
}
DEFINE_INT_HANDLER(6)
}
DEFINE_INT_HANDLER(7)
}
DEFINE_INT_HANDLER(8)
}
DEFINE_INT_HANDLER(9)
}
DEFINE_INT_HANDLER(10)
}
DEFINE_INT_HANDLER(11)
}
DEFINE_INT_HANDLER(12)
}
DEFINE_INT_HANDLER(13)
}
DEFINE_INT_HANDLER(14)
}
DEFINE_INT_HANDLER(15)
}

View File

@@ -0,0 +1,655 @@
/*
* ReactOS kernel
* Copyright (C) 2003 Mike Nordell
* Based on multiboot.S (no copyright note present), but so heavily
* modified that it bears close to no resemblance to the original work.
*
* MSVC compatible combination of plain C and inline assembler to:
* 1 Relocated all the sections in the kernel - something I feel the
* bootloader should have done, but multiboot being just a "raw image"
* loader, it unfortunately had to be done here - in-place.
* 2 Set up page directories and stuff.
* 3 Load IDT, GDT and turn on paging, making us execute at the intended
* target address (as if the image was PE-loaded and parsed into that addr.)
* 4 Call _main, and let the rest of the startup run...
*
* 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: Fix the MP parts
//
/* INCLUDES ******************************************************************/
#pragma hdrstop
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
#include <pe.h>
#include <roscfg.h>
#include <internal/ntoskrnl.h>
#include <internal/i386/segment.h>
#include <internal/ps.h>
#include <internal/ldr.h>
// some notes:
// The MSVC linker (by defult) emits no special .bss section, but uses the data
// section with a rawsize smaller than virtualsize. The "slack" is BSS.
//////////////////////////////////////////////////////////////////
// Some macros we need
// some stuff straight from freeloaders multiboot.h
#define MULTIBOOT_HEADER_MAGIC (0x1BADB002)
#define MULTIBOOT_HEADER_FLAGS (0x00010003)
#define TARGET_LOAD_ADDR 0x00200000
#define BASE_TO_PHYS_DIST (KERNEL_BASE - TARGET_LOAD_ADDR)
#define V2P(x) (x - BASE_TO_PHYS_DIST)
#ifdef MP
#define AP_MAGIC (0x12481020)
#endif /* MP */
void initialize_page_directory(void);
void* relocate_pointer_log_to_phys(const void* p)
{
// DON'T CALL this function until relocation of .data and/or .rdata,
// is completed - but still be sure that we have not yet enabled paging!
return (void*)((DWORD)p - BASE_TO_PHYS_DIST);
}
#ifdef _DEBUG
// Macro to emit one character to Bochs debug-port (0x9e).
// We need to do it this way, since at this point of the startup, obviously
// we have neither HAL nor DbgPrint support.
#define BOCHS_OUT_CHAR(c1) __asm push eax __asm push edx __asm mov dx, 0xe9 __asm mov al, c1 __asm out dx, al __asm pop edx __asm pop eax
void boch_out_hex_digit(unsigned char ch1)
{
if (ch1 <= 9) { ch1 += '0'; } else { ch1 += 'a' - 10; }
BOCHS_OUT_CHAR(ch1)
}
void bochs_dump_hex(DWORD p)
{
unsigned char ch3 = (unsigned char)((p >> 28) & 0x0f);
unsigned char cl3 = (unsigned char)((p >> 24) & 0x0f);
unsigned char ch2 = (unsigned char)((p >> 20) & 0x0f);
unsigned char cl2 = (unsigned char)((p >> 16) & 0x0f);
unsigned char ch1 = (unsigned char)((p >> 12) & 0x0f);
unsigned char cl1 = (unsigned char)((p >> 8) & 0x0f);
unsigned char ch0 = (unsigned char)((p >> 4) & 0x0f);
unsigned char cl0 = (unsigned char)((p >> 0) & 0x0f);
BOCHS_OUT_CHAR('0') BOCHS_OUT_CHAR('x')
boch_out_hex_digit(ch3);
boch_out_hex_digit(cl3);
boch_out_hex_digit(ch2);
boch_out_hex_digit(cl2);
boch_out_hex_digit(ch1);
boch_out_hex_digit(cl1);
boch_out_hex_digit(ch0);
boch_out_hex_digit(cl0);
BOCHS_OUT_CHAR('\n')
}
static void bochs_out_string(const char* s /* logical address! */)
{
s = relocate_pointer_log_to_phys(s);
__asm
{
pushad
mov dx, 0xe9
mov ebx, s
L1:
cmp byte ptr[ebx], 0
je end
mov al, [ebx]
out dx, al
inc ebx
jmp L1
end:
popad
}
}
#else
#define BOCHS_OUT_CHAR(c1)
#define bochs_dump_hex(VAL)
#define bochs_out_string(STR)
#endif // _DEBUG
//////////////////////////////////////////////////////////////////
typedef char kernel_page_t[4096];
// Use 4096 (pagesize) more bytes that actually needed for each *_holder,
// to be able to make sure that the other stuff is page aligned.
// No other way to do this portably... :-(
//
// TODO: Consider allocating just one large block of BSS memory here, align
// just the first pointer, and then get the other ones just as offsets from
// this (now-aligned) pointer. That way we could get away with wasting just
// one page of memory, instead of 4 (like 16KB would matter... but still)
static kernel_page_t* startup_pagedirectory_holder[1024 * 2];
static kernel_page_t* lowmem_pagetable_holder[1024 * 2];
static kernel_page_t* kernel_pagetable_holder[32*1024 + 1];
static __int32 kpcr_pagetable_holder[4096/4 * 2];
#ifdef MP
char apic_pagetable[4096];
#endif /* MP */
__int32 unmap_me[4096/4];
__int32 unmap_me2[4096/4];
__int32 unmap_me3[4096/4];
__int32 init_stack[3*4096/4];
int init_stack_top;
__int32 trap_stack[3*4096/4];
int trap_stack_top;
void _main();
// lie a bit about types - since C is basically typeless anyway, it
// doesn't really matter what type we say it is here...
extern int KiGdtDescriptor;
extern int KiIdtDescriptor;
/*
* This is called by the realmode loader, with protected mode
* enabled, paging disabled and the segment registers pointing
* a 4Gb, 32-bit segment starting at zero.
*
* EAX = Multiboot magic or application processor magic
*
* EBX = Points to a structure in lowmem with data from the
* loader
*/
#pragma intrinsic(memset)
// We need to implement this ourself, to be able to get to it by short call's
void our_memmove(void* pDest, const void* pSrc, DWORD size)
{
char* pD = (char*)pDest;
const char* pS = (char*)pSrc;
if (pDest < pSrc)
{
while (size--)
{
*pD++ = *pS++;
}
}
else if (pSrc < pDest)
{
while (size--)
{
pD[size] = pS[size];
}
}
}
void dummy_placeholder(void)
{
// NOTE: This function MUST be placed JUST AFTER MultibootStub in memory.
// Yes, it's BEFORE it in this file, but linkorder.txt fixes this for us.
}
// This one is needed, since the boot loader hasn't relocated us
__declspec(naked)
void MultibootStub()
{
__asm
{
jmp _multiboot_entry
// This sucks, I know...
#define EMIT_DWORD(x) __asm __emit ((x) >> 0) & 0xff __asm _emit ((x) >> 8) & 0xff __asm _emit ((x) >> 16) & 0xff __asm _emit ((x) >> 24) & 0xff
ALIGN 4
EMIT_DWORD(MULTIBOOT_HEADER_MAGIC)
EMIT_DWORD(MULTIBOOT_HEADER_FLAGS)
EMIT_DWORD(-(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS))
EMIT_DWORD(TARGET_LOAD_ADDR + 0x0400 + 0x04)
// Now just make something up, since there is no way we can know, beforehand,
// where any BSS data is...
EMIT_DWORD((TARGET_LOAD_ADDR))
EMIT_DWORD((TARGET_LOAD_ADDR + 1*1024*1024)) /* assume ntoskrnel.exe is < 1MB! */
EMIT_DWORD((TARGET_LOAD_ADDR + 2*1024*1024)) /* just to have something, let's say BSS is 1MB too */
/* This is *REALLY* ugly! If MultibootStub is *EVER* at */
/* any other offset, this will crash like crazy! */
/* 0x0400 is the file alignment of the binary (ntoskrnl.exe) */
EMIT_DWORD((TARGET_LOAD_ADDR + 0x0400)) // entry_addr
_multiboot_entry:
cld // just for good measure
}
{
/* Save the multiboot or application processor magic */
DWORD saved_eax;
DWORD saved_ebx;
__asm mov saved_eax, eax
__asm mov saved_ebx, ebx
// bochs_out_string("MultibootStub()\n");
// OK, time to relocate the brute-loaded image in-place...
// If we don't watch it, we will overwrite ourselves here - imagine
// the fireworks! :-) That's why the function dummy_placeholder()
// MUST be placed JUST JUST AFTER this function.
{
PIMAGE_NT_HEADERS NtHeader = RtlImageNtHeader((PVOID)TARGET_LOAD_ADDR);
PIMAGE_SECTION_HEADER Section = IMAGE_FIRST_SECTION(NtHeader);
const int count = NtHeader->FileHeader.NumberOfSections;
int i;
Section += count - 1; // make it point to the last section
// NOTE: We MUST walk the sections "backwards".
for (i = count-1; i >= 0; --i, --Section)
{
DWORD dwSrc = TARGET_LOAD_ADDR + Section->PointerToRawData;
DWORD dwDst = TARGET_LOAD_ADDR + Section->VirtualAddress;
DWORD dwSiz = Section->SizeOfRawData;
const char* pEndThisFunc;
if (dwSrc == dwDst)
{
continue;
}
//bochs_out_string("MultibootStub: relocating section\n");
if (Section->Characteristics & IMAGE_SCN_MEM_EXECUTE)
{
// can't get a pointer to a label from plain C :-(
__asm mov pEndThisFunc, offset dummy_placeholder
pEndThisFunc -= BASE_TO_PHYS_DIST;
if (dwDst < (DWORD)pEndThisFunc)
{
// We must not move the code from under our feet!
// This can only happen in the code segment - the first segment
DWORD diff = (DWORD)pEndThisFunc - dwDst;
dwDst += diff;
dwSrc += diff;
dwSiz -= diff;
}
}
// obviously we must use memmove, since memory can overlap
our_memmove((void*)dwDst, (void*)dwSrc, dwSiz);
// While at it, we might as well zero any uninitialized data in the section...
if (Section->SizeOfRawData < Section->Misc.VirtualSize)
{
memset((char*)(Section->VirtualAddress + Section->SizeOfRawData + TARGET_LOAD_ADDR),
0,
Section->Misc.VirtualSize - Section->SizeOfRawData);
}
}
// Now all sections are relocated to their intended in-memory layout,
// but we are still running int the low TARGET_LOAD_ADDR memory.
{
// Time to jump to the real startup, the entry-point function.
// We must do this using assembler, since both eax and ebx are assumed
// to hold some magic values.
typedef VOID (STDCALL* pfn_t)(PPEB);
pfn_t pfn = (pfn_t)(NtHeader->OptionalHeader.AddressOfEntryPoint + TARGET_LOAD_ADDR);
#if 1
__asm mov eax, saved_eax
__asm mov ebx, saved_ebx
__asm mov ecx, pfn
__asm jmp ecx
#else
__asm mov ebx, saved_ebx
(*pfn)((PPEB)saved_eax);
#endif
}
}
}
}
// TMN: TODO: Convert this to the extent possible to plain C code
// Due to the "magic" above, we enter this function with all kernel sections
// properly relocated wrt. offsets from start-of-mem. But, we are still running
// without paging, meaning that the address that is to be KERNEL_BASE+xyz is
// currently still TARGET_LOAD_ADDR+xyz.
// We get aways with a few of the functions call here since they are near calls
// (PC-relative), but don't even _think_ about calling any other functions
// until we have turned on paging!
VOID STDCALL
NtProcessStartup(
IN PPEB Peb
)
{
DWORD saved_ebx;
DWORD saved_eax;
__asm mov saved_ebx, ebx
__asm mov saved_eax, eax
bochs_out_string("NtProcessStartup: Just entered\n");
#ifdef MP
if (saved_eax != AP_MAGIC)
{
#endif /* MP */
bochs_out_string("NtProcessStartup: Calling initialize_page_directory()\n");
initialize_page_directory(); // Initialize the page directory
bochs_out_string("NtProcessStartup: Page directory initialized\n");
#ifdef MP
__asm
{
/*
* Initialize the page table that maps the APIC register address space
*/
/*
* FIXME: APIC register address space can be non-standard so do the
* mapping later
*/
mov esi, V2P(apic_pagetable)
mov edi, 0
mov eax, 0xFEC0001B
mov [esi+edi], eax
mov edi, 0x800
mov eax, 0xFEE0001B
mov [esi+edi], eax
}
}
#endif /* MP */
{
bochs_out_string("NtProcessStartup: Enabling paging...\n");
/*
* Enable paging and set write protect
* bit 31: PG, bit 16: WP
*/
__asm mov eax, cr0
__asm or eax, 0x80010000
__asm mov cr0, eax
bochs_out_string("NtProcessStartup: Paging enabled!\n");
bochs_out_string("NtProcessStartup: But we're still at the \"low\" address\n");
/*
* Do an absolute jump because we now want to execute above KERNEL_BASE
*/
__asm mov eax, offset l2_
__asm jmp eax
}
l2_:
bochs_out_string("We have now left \"low\" memory, and is flying at an altitude of...\n");
bochs_out_string("OK, we're not flying, we're just executing above KERNEL_BASE\n");
/*
* Load the GDTR and IDTR with new tables located above
* KERNEL_BASE
*/
#ifdef _DEBUG
{
DWORD val = (DWORD)&KiGdtDescriptor;
bochs_out_string("&KiGdtDescriptor: ");
bochs_dump_hex(val);
val = (DWORD)&KiIdtDescriptor;
bochs_out_string("&KiIdtDescriptor: ");
bochs_dump_hex(val);
}
#endif
bochs_out_string("Loading GDT and IDT...\n");
/* FIXME: Application processors should have their own GDT/IDT */
__asm lgdt KiGdtDescriptor
__asm lidt KiIdtDescriptor
bochs_out_string("GDT and IDT loaded\n");
__asm
{
/*
* Reload the data segment registers
*/
mov eax, KERNEL_DS
mov ds, ax
mov es, ax
mov gs, ax
mov ss, ax
mov eax, 0
mov fs, ax
}
bochs_out_string("NtProcessStartup: segment registers loaded\n");
#ifdef MP
if (saved_eax == AP_MAGIC)
{
__asm
{
/*
* This is an application processor executing
*/
/*
* Initialize EFLAGS
*/
push 0
popfd
/*
* Call the application processor initialization code
*/
push 0
push offset l7_
push KERNEL_CS
push KiSystemStartup
retf
/*
* Catch illegal returns from KiSystemStartup
*/
l7_:
pop eax
}
KeBugCheck(0);
for (;;)
; /*forever */
}
#endif /* MP */
bochs_out_string("Loading fs with PCR_SELECTOR\n");
/* Load the PCR selector */
__asm mov eax, PCR_SELECTOR
__asm mov fs, ax
bochs_out_string("Loading esp with init_stack_top : "); bochs_dump_hex((DWORD)&init_stack_top);
bochs_out_string("Just for interest, init_stack is at: "); bochs_dump_hex((DWORD)init_stack);
bochs_out_string("Meaing the init_stack in bytes is : "); bochs_dump_hex((DWORD)&init_stack_top - (DWORD)init_stack);
/* Load the initial kernel stack */
__asm mov esp, offset init_stack_top
bochs_out_string("Loaded esp with init_stack_top\n");
/*
* Initialize EFLAGS
*/
__asm push 0
__asm popfd
bochs_out_string("Loaded eflags\n");
/*
* Call the main kernel initialization
*/
bochs_out_string("TMN: Calling _main...\n");
__asm
{
xor ebp,ebp
push ebx
push edx
push offset l5_
push KERNEL_CS
push offset _main
retf
/*
* Catch illegal returns from main, try bug checking the system,
* if that fails then loop forever.
*/
l5_:
pop eax
pop eax
} // end of __asm block
bochs_out_string("TMN: Back from _main ?! Let's crash!\n");
KeBugCheck(0);
for (;;)
; /*forever */
}
void initialize_page_directory(void)
{
/*
* Initialize the page directory
*/
// First convert the pointers from the virtual address the compiler generated
// code thinks we are at, to the currently active physical address we actually
// got loaded into by the loader. At this point we have been relocated, so
// that there is a 1:1 mapping between KERNEL_BASE+n and TARGET_LOAD_ADDR+n.
kernel_page_t** startup_pagedirectory = startup_pagedirectory_holder;
kernel_page_t** lowmem_pagetable = lowmem_pagetable_holder;
kernel_page_t** kernel_pagetable = kernel_pagetable_holder;
__int32* kpcr_pagetable = kpcr_pagetable_holder;
bochs_out_string("startup_pagedirectory before reloc: ");
bochs_dump_hex((DWORD)startup_pagedirectory);
startup_pagedirectory = (kernel_page_t**)relocate_pointer_log_to_phys(startup_pagedirectory);
lowmem_pagetable = (kernel_page_t**)relocate_pointer_log_to_phys(lowmem_pagetable);
kernel_pagetable = (kernel_page_t**)relocate_pointer_log_to_phys(kernel_pagetable);
kpcr_pagetable = (__int32*) relocate_pointer_log_to_phys(kpcr_pagetable);
bochs_out_string("startup_pagedirectory after reloc : ");
bochs_dump_hex((DWORD)startup_pagedirectory);
// Now align the pointers to PAGE_SIZE...
startup_pagedirectory = (kernel_page_t**)(((ULONG_PTR)startup_pagedirectory + 4095) & ~4095);
lowmem_pagetable = (kernel_page_t**)(((ULONG_PTR)lowmem_pagetable + 4095) & ~4095);
kernel_pagetable = (kernel_page_t**)(((ULONG_PTR)kernel_pagetable + 4095) & ~4095);
kpcr_pagetable = (__int32* ) (((ULONG_PTR)kpcr_pagetable + 4095) & ~4095);
#ifdef _DEBUG
bochs_out_string("startup_pagedirectory aligned : ");
bochs_dump_hex((DWORD)startup_pagedirectory);
#endif
// Ugly macros, I know...
#define DEST(PAGE) startup_pagedirectory[(PAGE) + 0xc00 / 4]
#define SRC(PAGE) (kernel_page_t*)((char*)kernel_pagetable + (PAGE)*4096 + 0x7)
startup_pagedirectory[0] = (kernel_page_t*)((char*)lowmem_pagetable + 0x7);
{
unsigned int i;
for (i=0; i<32; ++i)
{
DEST(i) = SRC(i);
}
}
DEST( 64) = (kernel_page_t*)((char*)lowmem_pagetable + 0x7);
DEST(192) = (kernel_page_t*)((char*)startup_pagedirectory + 0x7);
#ifdef MP
DEST(251) = (kernel_page_t*)((char*)apic_pagetable + 0x7);
#endif /* MP */
DEST(252) = (kernel_page_t*)((char*)kpcr_pagetable + 0x7);
{
unsigned int i;
/* Initialize the page table that maps low memory */
for (i=0; i<1024; ++i) {
lowmem_pagetable[i] = (kernel_page_t*)(i*4096 + 7);
}
/* Initialize the page table that maps kernel memory */
for (i=0; i<6144/4 /* 1536 pages = 6MB */; ++i) {
kernel_pagetable[i] = (kernel_page_t*)(i*4096 + TARGET_LOAD_ADDR + 0x7);
}
/* Initialize the page table that maps the initial KPCR (at FF000000) */
kpcr_pagetable[0] = 0x1007;
}
/*
* Set up the PDBR
*/
__asm mov eax, startup_pagedirectory
__asm mov cr3, eax
}

View File

@@ -0,0 +1,110 @@
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
*
* 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.
*/
/*
* FILE: ntoskrnl/ke/i386/vm86_sup.S
* PURPOSE: V86 mode support
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 09/10/00
*/
/* INCLUDES ******************************************************************/
#pragma hdrstop
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
#include <internal/v86m.h>
#include <ntos/tss.h>
//#include <ntos/service.h>
#include <internal/trap.h>
#include <internal/ps.h>
#include <roscfg.h>
#include <internal/ntoskrnl.h>
#include <internal/i386/segment.h>
void KeReturnFromSystemCall();
/*
* FUNCTION: KeStackSwitchAndRet
* PURPOSE: Switch to a new stack and return from the first frame on
* the new stack which was assumed to a stdcall function with
* 8 bytes of arguments and which saved edi, esi and ebx.
*/
__declspec(naked)
VOID STDCALL
KeStackSwitchAndRet(PVOID NewStack)
{
__asm
{
push ebp
mov ebp, esp
cli
mov esp, NewStack
sti
pop edi
pop esi
pop ebx
pop ebp
ret 8
}
}
__declspec(naked)
VOID STDCALL
KePushAndStackSwitchAndSysRet(ULONG Push, PVOID NewStack)
{
__asm
{
push ebp
mov ebp, esp
push ebx
push esi
push edi
cli
push 8[ebp]
mov ebx, fs:KPCR_CURRENT_THREAD
mov KTHREAD_CALLBACK_STACK[ebx], esp
mov esp, 12[ebp]
sti
push 0
call KeLowerIrql
jmp KeReturnFromSystemCall
}
}

View File

@@ -0,0 +1,325 @@
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* Converted to MSVC-compatible inline assembler by Mike Nordell, 2003.
*
* 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.
*/
/*
* FILE: MSVC6/ntoskrnl/ke_i386_syscall.c
* based on ntoskrnl/ke/i386/syscall.s
* PURPOSE: syscall dispatching and support
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 09/10/00
*/
/* INCLUDES ******************************************************************/
#pragma hdrstop
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
#include <internal/v86m.h>
#include <ntos/tss.h>
//#include <ntos/service.h>
#include <internal/trap.h>
#include <internal/ps.h>
#include <roscfg.h>
#include <internal/ntoskrnl.h>
#include <internal/i386/segment.h>
#define KernelMode (0)
#define UserMode (1)
// TMN: Replicated here to reduce mess-time
#ifdef STATUS_INVALID_SYSTEM_SERVICE
#undef STATUS_INVALID_SYSTEM_SERVICE
#endif
#define STATUS_INVALID_SYSTEM_SERVICE 0xc000001c
/*
*
*/
void KiServiceCheck (ULONG Nr);
ULONG KiAfterSystemCallHook(ULONG NtStatus, PKTRAP_FRAME TrapFrame);
VOID KiSystemCallHook(ULONG Nr, ...);
void KeReturnFromSystemCallWithHook();
void KeReturnFromSystemCall();
__declspec(naked)
void interrupt_handler2e(void)
{
__asm
{
/* Construct a trap frame on the stack */
/* Error code */
push 0
push ebp
push ebx
push esi
push edi
push fs
/* Load PCR selector into fs */
mov ebx, PCR_SELECTOR
mov fs, bx
/* Save the old exception list */
mov ebx, fs:KPCR_EXCEPTION_LIST
push ebx
/* Set the exception handler chain terminator */
mov dword ptr fs:KPCR_EXCEPTION_LIST, 0xffffffff
/* Get a pointer to the current thread */
mov esi, fs:KPCR_CURRENT_THREAD
/* Save the old previous mode */
xor ebx,ebx
mov bl, ss:KTHREAD_PREVIOUS_MODE[esi]
push ebx
/* Set the new previous mode based on the saved CS selector */
mov ebx, 0x24[esp]
and ebx, 0x0000FFFF
cmp ebx, KERNEL_CS
#if 0
// TODO: Verify implementation change and use this code path
// to remove two conditional jumps.
setnz bl
mov ss:KTHREAD_PREVIOUS_MODE[esi], bl
#else
jne L1
mov ss:KTHREAD_PREVIOUS_MODE[esi], KernelMode
jmp L3
L1:
mov ss:KTHREAD_PREVIOUS_MODE[esi], UserMode
L3:
#endif
/* Save other registers */
push eax
push ecx
push edx
push ds
push es
push gs
push 0 /* DR7 */
push 0 /* DR6 */
push 0 /* DR3 */
push 0 /* DR2 */
push 0 /* DR1 */
push 0 /* DR0 */
push 0 /* XXX: TempESP */
push 0 /* XXX: TempCS */
push 0 /* XXX: DebugPointer */
push 0 /* XXX: DebugArgMark */
mov ebx, 0x60[esp]
push ebx /* DebugEIP */
push ebp /* DebugEBP */
/* Load the segment registers */
mov bx, KERNEL_DS
mov ds, bx
mov es, bx
mov gs, bx
/*
* Save the old trap frame pointer over where we would save the EDX
* register.
*/
mov ebx, KTHREAD_TRAP_FRAME[esi]
mov 0x3C[esp], ebx
/* Save a pointer to the trap frame in the TCB */
mov KTHREAD_TRAP_FRAME[esi], esp
/* Set ES to kernel segment */
mov bx, KERNEL_DS
mov es, bx
/* Allocate new Kernel stack frame */
mov ebp, esp
/* Users's current stack frame pointer is source */
mov esi, edx
/* Determine system service table to use */
cmp eax, 0x0fff
ja new_useShadowTable
/* Check to see if EAX is valid/inrange */
cmp eax, es:KeServiceDescriptorTable + 8
jbe new_serviceInRange
mov eax, STATUS_INVALID_SYSTEM_SERVICE
jmp KeReturnFromSystemCall
new_serviceInRange:
/* Allocate room for argument list from kernel stack */
mov ecx, es:KeServiceDescriptorTable + 12
mov ecx, es:[ecx + eax * 4]
sub esp, ecx
/* Copy the arguments from the user stack to the kernel stack */
mov edi, esp
cld
repe movsb
/* DS is now also kernel segment */
mov ds, bx
/* Call system call hook */
push eax
call KiSystemCallHook
pop eax
/* Make the system service call */
mov ecx, es:KeServiceDescriptorTable
mov eax, es:[ecx + eax * 4]
call eax
#if CHECKED
/* Bump Service Counter */
#endif
/* Deallocate the kernel stack frame */
mov esp, ebp
/* Call the post system call hook and deliver any pending APCs */
push ebp
push eax
call KiAfterSystemCallHook
add esp, 8
jmp KeReturnFromSystemCall
new_useShadowTable:
sub eax, 0x1000
/* Check to see if EAX is valid/inrange */
cmp eax, es:KeServiceDescriptorTableShadow + 24
jbe new_shadowServiceInRange
mov eax, STATUS_INVALID_SYSTEM_SERVICE
jmp KeReturnFromSystemCall
new_shadowServiceInRange:
/* Allocate room for argument list from kernel stack */
mov ecx, es:KeServiceDescriptorTableShadow + 28
mov ecx, es:[ecx + eax * 4]
sub esp, ecx
/* Copy the arguments from the user stack to the kernel stack */
mov edi, esp
cld
repe movsb
/* DS is now also kernel segment */
mov ds, bx
/* Call system call hook */
// pushl %eax
// call _KiSystemCallHook
// popl %eax
/* Call service check routine */
push eax
call KiServiceCheck
pop eax
/* Make the system service call */
mov ecx, es:KeServiceDescriptorTableShadow + 16
mov eax, es:[ecx + eax * 4]
call eax
#if CHECKED
/* Bump Service Counter */
#endif
/* Deallocate the kernel stack frame */
mov esp, ebp
// TMN: Added, to be able to separate this into different functions
jmp KeReturnFromSystemCallWithHook
}
}
__declspec(naked)
void KeReturnFromSystemCallWithHook()
{
__asm
{
/* Call the post system call hook and deliver any pending APCs */
push esp
push eax
call KiAfterSystemCallHook
add esp, 8
// TMN: Added, to be able to separate this into different functions
jmp KeReturnFromSystemCall
}
}
__declspec(naked)
void KeReturnFromSystemCall()
{
__asm
{
/* Restore the user context */
/* Get a pointer to the current thread */
mov esi, fs:0x124
/* Restore the old trap frame pointer */
mov ebx, 0x3c[esp]
mov KTHREAD_TRAP_FRAME[esi], ebx
/* Skip debug information and unsaved registers */
add esp, 0x30
pop gs
pop es
pop ds
pop edx
pop ecx
add esp, 4 /* Don't restore eax */
/* Restore the old previous mode */
pop ebx
mov ss:KTHREAD_PREVIOUS_MODE[esi], bl
/* Restore the old exception handler list */
pop ebx
mov fs:KPCR_EXCEPTION_LIST, ebx
pop fs
pop edi
pop esi
pop ebx
pop ebp
add esp, 4 /* Ignore error code */
iretd
}
}

View File

@@ -0,0 +1,468 @@
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
*
* 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.
*/
/*
* FILE: ntoskrnl/ke/i386/vm86_sup.S
* PURPOSE: V86 mode support
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 09/10/00
*/
/* INCLUDES ******************************************************************/
#pragma hdrstop
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
#include <internal/v86m.h>
#include <ntos/tss.h>
#include <internal/trap.h>
#include <internal/ps.h>
#include <roscfg.h>
#include <internal/ntoskrnl.h>
#include <internal/i386/segment.h>
void KiV86Complete(void);
void KiTrapHandler(void);
void KiDoubleFaultHandler(void);
extern int KiPcrInitDone;
/*
* Epilog for exception handlers
*/
__declspec(naked)
void KiTrapEpilog()
{
__asm
{
cmp eax, 1 /* Check for v86 recovery */
jne _KiTrapRet
jmp KiV86Complete
_KiTrapRet:
/* Skip debug information and unsaved registers */
add esp, 0x30
pop gs
pop es
pop ds
pop edx
pop ecx
pop eax
/* Restore the old previous mode */
pop ebx
mov ss:KTHREAD_PREVIOUS_MODE[esi], bl
/* Restore the old exception handler list */
pop ebx
mov fs:KPCR_EXCEPTION_LIST, ebx
pop fs
pop edi
pop esi
pop ebx
pop ebp
add esp, 4 /* Ignore error code */
iretd
}
}
__declspec(naked)
void KiTrapProlog()
{
__asm
{
push edi
push fs
/*
* Check that the PCR exists, very early in the boot process it may
* not
*/
cmp ss:KiPcrInitDone, 0
je L5_
/* Load the PCR selector into fs */
mov ebx, PCR_SELECTOR
mov fs, bx
/* Save the old exception list */
mov ebx, fs:KPCR_EXCEPTION_LIST
push ebx
/* Put the exception handler chain terminator */
mov dword ptr fs:KPCR_EXCEPTION_LIST, 0xffffffff
/* Get a pointer to the current thread */
mov edi, fs:KPCR_CURRENT_THREAD
/* The current thread may be NULL early in the boot process */
cmp edi, 0
je L4_
/* Save the old previous mode */
xor ebx, ebx
mov bl, ss:KTHREAD_PREVIOUS_MODE[edi]
push ebx
/* Set the new previous mode based on the saved CS selector */
mov ebx, 0x24[esp]
and ebx, 0x0000FFFF
cmp ebx, KERNEL_CS
jne L1_
mov ss:KTHREAD_PREVIOUS_MODE[edi], KernelMode
jmp L3_
L1_:
mov ss:KTHREAD_PREVIOUS_MODE[edi], UserMode
L3_:
/* Save other registers */
push eax
push ecx
push edx
push ds
push es
push gs
push 0 /* DR7 */
push 0 /* DR6 */
push 0 /* DR3 */
push 0 /* DR2 */
push 0 /* DR1 */
push 0 /* DR0 */
push 0 /* XXX: TempESP */
push 0 /* XXX: TempCS */
push 0 /* XXX: DebugPointer */
push 0 /* XXX: DebugArgMark */
mov ebx, 0x60[esp]
push ebx /* XXX: DebugEIP */
push ebp /* XXX: DebugEBP */
/* Load the segment registers */
mov ebx, KERNEL_DS
mov ds, bx
mov es, bx
mov gs, bx
/* Set ES to kernel segment */
mov bx, KERNEL_DS
mov es, bx
mov ebx, esp
mov ebp, esp
/* Save the old trap frame. */
cmp edi, 0
je L7_
mov edx, ss:KTHREAD_TRAP_FRAME[edi]
push edx
jmp L8_
L7_:
push 0
L8_:
/* Save a pointer to the trap frame in the current KTHREAD */
cmp edi, 0
je L6_
mov ss:KTHREAD_TRAP_FRAME[edi], ebx
L6_:
/* Call the C exception handler */
push esi
push ebx
call KiTrapHandler
add esp, 8
/* Get a pointer to the current thread */
mov esi, fs:KPCR_CURRENT_THREAD
/* Restore the old trap frame pointer */
pop ebx
mov KTHREAD_TRAP_FRAME[esi], ebx
/* Return to the caller */
jmp KiTrapEpilog
/* Handle the no-pcr case out of line */
L5_:
push 0
/* Handle the no-thread case out of line */
L4_:
push 0
jmp L3_
} // end of __asm block
}
__declspec(naked)
void KiTrap0()
{
__asm
{
/* No error code */
push 0
push ebp
push ebx
push esi
mov esi, 0
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap1()
{
__asm
{
/* No error code */
push 0
push ebp
push ebx
push esi
mov esi, 1
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap2()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 2
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap3()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 3
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap4()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 4
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap5()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 5
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap6()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 6
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap7()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 7
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap8()
{
__asm
{
call KiDoubleFaultHandler
iretd
}
}
__declspec(naked)
void KiTrap9()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 9
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap10()
{
__asm
{
push ebp
push ebx
push esi
mov esi, 10
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap11()
{
__asm
{
push ebp
push ebx
push esi
mov esi, 11
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap12()
{
__asm
{
push ebp
push ebx
push esi
mov esi, 12
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap13()
{
__asm
{
push ebp
push ebx
push esi
mov esi, 13
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap14()
{
__asm
{
push ebp
push ebx
push esi
mov esi, 14
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap15()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 15
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrap16()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 16
jmp KiTrapProlog
}
}
__declspec(naked)
void KiTrapUnknown()
{
__asm
{
push 0
push ebp
push ebx
push esi
mov esi, 255
jmp KiTrapProlog
}
}
/* EOF */

View File

@@ -0,0 +1,217 @@
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
*
* 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.
*/
/*
* FILE: ntoskrnl/ke/i386/vm86_sup.S
* PURPOSE: V86 mode support
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 09/10/00
*/
/* INCLUDES ******************************************************************/
#pragma hdrstop
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
#include <internal/v86m.h>
#include <ntos/tss.h>
//#include <ntos/service.h>
#include <internal/trap.h>
#include <internal/ps.h>
#include <roscfg.h>
#include <internal/ntoskrnl.h>
#include <internal/i386/segment.h>
extern KSPIN_LOCK PiThreadListLock;
extern ULONG PiNrThreadsAwaitingReaping;
extern ULONG MmGlobalKernelPageDirectory[1024];
VOID STDCALL PiWakeupReaperThread(VOID);
VOID KeSetBaseGdtSelector(ULONG Entry, PVOID Base);
/*
* FUNCTIONS: Switches to another thread's context
* ARGUMENTS:
* Thread = Thread to switch to
* OldThread = Thread to switch from
*/
__declspec(naked)
VOID
Ki386ContextSwitch(struct _KTHREAD* NewThread, struct _KTHREAD* OldThread)
{
__asm
{
push ebp
mov ebp, esp
/* Save callee save registers. */
push ebx
push esi
push edi
cli /* This is a critical section for this processor. */
/* Get the pointer to the new thread. */
mov ebx, NewThread
/*
* Set the base of the TEB selector to the base of the TEB for
* this thread.
*/
push ebx
push KTHREAD_TEB[ebx]
push TEB_SELECTOR
call KeSetBaseGdtSelector
add esp, 8
pop ebx
/*
* Load the PCR selector.
*/
mov eax, PCR_SELECTOR
mov fs, ax
/*
* Set the current thread information in the PCR.
*/
mov fs:KPCR_CURRENT_THREAD, ebx
/*
* Set the current LDT
*/
xor eax, eax
mov edi, ETHREAD_THREADS_PROCESS[ebx]
test word ptr KPROCESS_LDT_DESCRIPTOR0[edi], 0xFFFF
jz L4
push KPROCESS_LDT_DESCRIPTOR1[edi]
push KPROCESS_LDT_DESCRIPTOR0[edi]
push LDT_SELECTOR
call KeSetGdtSelector
add esp, 12
mov eax, LDT_SELECTOR
L4:
lldt ax
/*
* Load up the iomap offset for this thread in
* preparation for setting it below.
*/
mov eax, KPROCESS_IOPM_OFFSET[edi]
/*
* FIXME: Save debugging state.
*/
/*
* FIXME: Save floating point state.
*/
/*
* Switch stacks
*/
mov ebx, 12[ebp]
mov KTHREAD_KERNEL_STACK[ebx], esp
mov ebx, 8[ebp]
mov esp, KTHREAD_KERNEL_STACK[ebx]
mov edi, KTHREAD_STACK_LIMIT[ebx]
/*
* Set the stack pointer in this processors TSS
*/
mov esi, fs:KPCR_TSS
/*
* Set current IOPM offset in the TSS
*/
mov KTSS_IOMAPBASE[esi], ax
mov eax, KTHREAD_INITIAL_STACK[ebx]
mov KTSS_ESP0[esi], eax
/*
* Change the address space
*/
mov ebx, ETHREAD_THREADS_PROCESS[ebx]
mov eax, KPROCESS_DIRECTORY_TABLE_BASE[ebx]
mov cr3, eax
/*
* Set up the PDE for the top of the new stack.
*/
mov ebx, 0
L2:
mov esi, edi
shr esi, 22
mov eax, 0xF03C0000[esi*4]
cmp eax, 0
jne L1
mov eax, MmGlobalKernelPageDirectory[esi*4]
mov 0xF03C0000[esi*4], eax
L1:
add edi, 4096
inc ebx
cmp ebx, (MM_STACK_SIZE / 4096)
jl L2
/*
* FIXME: Restore floating point state
*/
/*
* FIXME: Restore debugging state
*/
/*
* Exit the critical section
*/
sti
}
KeReleaseSpinLockFromDpcLevel(&PiThreadListLock);
if (PiNrThreadsAwaitingReaping) {
PiWakeupReaperThread();
}
__asm
{
/*
* Restore the saved register and exit
*/
pop edi
pop esi
pop ebx
pop ebp
ret
}
}

View File

@@ -0,0 +1,256 @@
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-25
*
* 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.
*/
/*
* FILE: ntoskrnl/ke/i386/vm86_sup.S
* PURPOSE: V86 mode support
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 09/10/00
*/
/* INCLUDES ******************************************************************/
#pragma hdrstop
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
#include <internal/v86m.h>
#include <ntos/tss.h>
#include <internal/trap.h>
#include <internal/ps.h>
#include <roscfg.h>
#include <internal/ntoskrnl.h>
#include <internal/i386/segment.h>
#include <internal/ps.h>
// Taken from ntoskrnl/include/internal/v86m.h, since that one must be fixed
// a bit before it could be used from here.
#define KV86M_REGISTERS_EBP (0x0)
#define KV86M_REGISTERS_EDI (0x4)
#define KV86M_REGISTERS_ESI (0x8)
#define KV86M_REGISTERS_EDX (0xC)
#define KV86M_REGISTERS_ECX (0x10)
#define KV86M_REGISTERS_EBX (0x14)
#define KV86M_REGISTERS_EAX (0x18)
#define KV86M_REGISTERS_DS (0x1C)
#define KV86M_REGISTERS_ES (0x20)
#define KV86M_REGISTERS_FS (0x24)
#define KV86M_REGISTERS_GS (0x28)
#define KV86M_REGISTERS_EIP (0x2C)
#define KV86M_REGISTERS_CS (0x30)
#define KV86M_REGISTERS_EFLAGS (0x34)
#define KV86M_REGISTERS_ESP (0x38)
#define KV86M_REGISTERS_SS (0x3C)
void KiV86Complete();
/*
* Starts in v86 mode with the registers set to the
* specified values.
*/
__declspec(naked)
VOID Ki386RetToV86Mode(KV86M_REGISTERS* InRegs,
KV86M_REGISTERS* OutRegs)
{
__asm
{
/*
* Setup a stack frame
*/
push ebp
mov ebp, esp
pushad /* Save registers */
mov ebx, InRegs
/*
* Save ebp
*/
push ebp
/*
* Save a pointer to IN_REGS which the v86m exception handler will
* use to handle exceptions
*/
push ebx
/*
* Since we are going to fiddle with the stack pointer this must be
* a critical section for this processor
*/
/*
* Save the old initial stack
*/
mov esi, fs:KPCR_CURRENT_THREAD
mov edi, KTHREAD_INITIAL_STACK[esi]
push edi
/*
* We also need to set the stack in the kthread structure
*/
mov KTHREAD_INITIAL_STACK[esi], esp
/*
* The stack used for handling exceptions from v86 mode in this thread
* will be the current stack adjusted so we don't overwrite the
* existing stack frames
*/
mov esi, fs:KPCR_TSS
mov KTSS_ESP0[esi], esp
/*
* Create the stack frame for an iret to v86 mode
*/
push KV86M_REGISTERS_GS[ebx]
push KV86M_REGISTERS_FS[ebx]
push KV86M_REGISTERS_DS[ebx]
push KV86M_REGISTERS_ES[ebx]
push KV86M_REGISTERS_SS[ebx]
push KV86M_REGISTERS_ESP[ebx]
push KV86M_REGISTERS_EFLAGS[ebx]
push KV86M_REGISTERS_CS[ebx]
push KV86M_REGISTERS_EIP[ebx]
/*
* Setup the CPU registers
*/
mov eax, KV86M_REGISTERS_EAX[ebx]
mov ecx, KV86M_REGISTERS_ECX[ebx]
mov edx, KV86M_REGISTERS_EDX[ebx]
mov esi, KV86M_REGISTERS_ESI[ebx]
mov edi, KV86M_REGISTERS_EDI[ebx]
mov ebp, KV86M_REGISTERS_EBP[ebx]
mov ebx, KV86M_REGISTERS_EBX[ebx]
/*
* Go to v86 mode
*/
iretd
/*
* Handle the completion of a vm86 routine. We are called from
* an exception handler with the registers at the point of the
* exception on the stack.
*/
jmp KiV86Complete // TMN: Function-splitting
}
}
__declspec(naked)
void KiV86Complete()
{
__asm
{
/* Restore the original ebp */
mov ebp, TF_ORIG_EBP[esp]
/* Get a pointer to the OUT_REGS structure */
mov ebx, 12[ebp] // OutRegs
/* Skip debug information and unsaved registers */
add esp, 0x30
/* Ignore 32-bit segment registers */
add esp, 12
/* Save the vm86 registers into the OUT_REGS structure */
pop dword ptr KV86M_REGISTERS_EDX[ebx]
pop dword ptr KV86M_REGISTERS_ECX[ebx]
pop dword ptr KV86M_REGISTERS_EAX[ebx]
/* Restore the old previous mode */
pop eax
mov ss:KTHREAD_PREVIOUS_MODE[esi], al
/* Restore the old exception handler list */
pop eax
mov fs:KPCR_EXCEPTION_LIST, eax
/* Ignore the 32-bit fs register */
add esp, 4
pop dword ptr KV86M_REGISTERS_EDI[ebx]
pop dword ptr KV86M_REGISTERS_ESI[ebx]
pop dword ptr KV86M_REGISTERS_EBX[ebx]
pop dword ptr KV86M_REGISTERS_EBP[ebx]
/* Ignore error code */
add esp, 4
pop dword ptr KV86M_REGISTERS_EIP[ebx]
pop dword ptr KV86M_REGISTERS_CS[ebx]
pop dword ptr KV86M_REGISTERS_EFLAGS[ebx]
pop dword ptr KV86M_REGISTERS_ESP[ebx]
pop dword ptr KV86M_REGISTERS_SS[ebx]
pop dword ptr KV86M_REGISTERS_ES[ebx]
pop dword ptr KV86M_REGISTERS_DS[ebx]
pop dword ptr KV86M_REGISTERS_FS[ebx]
pop dword ptr KV86M_REGISTERS_GS[ebx]
/*
* We are going to fiddle with the stack so this must be a critical
* section for this process
*/
cli
/*
* Restore the initial stack
*/
pop eax
mov esi, fs:KPCR_TSS
mov KTSS_ESP0[esi], eax
/*
* We also need to set the stack in the kthread structure
*/
mov esi, fs:KPCR_CURRENT_THREAD
mov edi, KTHREAD_INITIAL_STACK[esi]
mov KTHREAD_INITIAL_STACK[esi], eax
/* Exit the critical section */
sti
/* Ignore IN_REGS pointer */
add esp, 4
/* Ignore ebp restored above */
add esp, 4
/* Return to caller */
popad
mov esp, ebp
pop ebp
ret
} // end of __asm block
}

View File

@@ -0,0 +1,15 @@
; This file is vital. It tells the linker how to order some functions
; and some data, that unfortunately is assumed to be at low location
; and in known order to eachother respectively?
MultibootStub
our_memmove
dummy_placeholder
NtProcessStartup@4
initialize_page_directory
relocate_pointer_log_to_phys
; Order some data that there is some assumptions about...
init_stack
init_stack_top
trap_stack
trap_stack_top

View File

@@ -0,0 +1,126 @@
#include <ddk/ntddk.h>
void MmSafeCopyToUserRestart();
void MmSafeCopyToUserUnsafeStart();
void MmSafeCopyFromUserUnsafeStart();
void MmSafeCopyFromUserRestart();
/*
* NTSTATUS MmSafeCopyFromUser(PVOID Dest, PVOID Src,
* ULONG NumberOfBytes)
*/
__declspec(naked)
NTSTATUS MmSafeCopyFromUser(PVOID Dest, const VOID *Src, ULONG Count)
{
__asm
{
push ebp
mov ebp,esp
push esi
push edi
push ecx
mov edi, 8[ebp]
mov esi, 12[ebp]
mov ecx, 16[ebp]
/*
* Default return code
*/
xor eax,eax
jmp MmSafeCopyFromUserUnsafeStart
}
}
__declspec(naked)
void MmSafeCopyFromUserUnsafeStart()
{
__asm
{
/*
* This is really a synthetic instruction since if we incur a
* pagefault then eax will be set to an appropiate STATUS code
*/
cld
rep movsb
jmp MmSafeCopyFromUserRestart
}
}
__declspec(naked)
void MmSafeCopyFromUserRestart()
{
__asm
{
pop ecx
pop edi
pop esi
pop ebp
ret
}
}
/*****************************************************************************/
/*
* NTSTATUS MmSafeCopyToUser(PVOID Dest, PVOID Src,
* ULONG NumberOfBytes)
*/
NTSTATUS MmSafeCopyToUser(PVOID Dest, const VOID *Src, ULONG Count)
{
__asm
{
push ebp
mov esp,ebp
push esi
push edi
push ecx
mov edi, 8[ebp]
mov esi, 12[ebp]
mov ecx, 16[ebp]
/*
* Default return code
*/
xor eax,eax
jmp MmSafeCopyToUserUnsafeStart
}
}
__declspec(naked)
void MmSafeCopyToUserUnsafeStart()
{
__asm
{
/*
* This is really a synthetic instruction since if we incur a
* pagefault then eax will be set to an appropiate STATUS code
*/
cld
rep movsb
jmp MmSafeCopyToUserRestart
}
}
__declspec(naked)
void MmSafeCopyToUserRestart()
{
__asm
{
pop ecx
pop edi
pop esi
pop ebp
ret
}
}

View File

@@ -0,0 +1,574 @@
/* $Id: mm_mminit_msvc.c,v 1.1 2004/02/06 08:22:01 fireball Exp $
*
* COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/mminit.c
* PURPOSE: kernel memory managment initialization functions
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 9/4/98
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <roscfg.h>
#include <internal/i386/segment.h>
#include <internal/mm.h>
#include <internal/ntoskrnl.h>
#include <internal/io.h>
#include <internal/ps.h>
#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS *****************************************************************/
/*
* Size of extended memory (kb) (fixed for now)
*/
#define EXTENDED_MEMORY_SIZE (3*1024*1024)
/*
* Compiler defined symbols
*/
#if defined(_MSC_VER)
#pragma intrinsic(strcmp)
static PIMAGE_SECTION_HEADER FindSection(const char* szSeg)
{
PIMAGE_NT_HEADERS NtHeader = RtlImageNtHeader((PVOID)KERNEL_BASE);
PIMAGE_SECTION_HEADER Section = IMAGE_FIRST_SECTION(NtHeader);
const int count = NtHeader->FileHeader.NumberOfSections;
int i;
for (i = 0; i < count; ++i, ++Section)
{
if (!strcmp(szSeg, Section->Name))
{
return Section;
}
}
return NULL;
}
static void* FindSegmentStart(const char* szSeg)
{
PIMAGE_SECTION_HEADER Section = FindSection(szSeg);
if (Section)
{
return (void*)(KERNEL_BASE + Section->VirtualAddress);
}
return NULL;
}
static void* FindSegmentEnd(const char* szSeg)
{
PIMAGE_SECTION_HEADER Section = FindSection(szSeg);
if (Section)
{
return (void*)(KERNEL_BASE + Section->VirtualAddress + Section->Misc.VirtualSize);
}
return NULL;
}
#endif // defined(_MSC_VER)
static BOOLEAN IsThisAnNtAsSystem = FALSE;
static MM_SYSTEM_SIZE MmSystemSize = MmSmallSystem;
static MEMORY_AREA* kernel_text_desc = NULL;
static MEMORY_AREA* kernel_init_desc = NULL;
static MEMORY_AREA* kernel_map_desc = NULL;
static MEMORY_AREA* kernel_kpcr_desc = NULL;
static MEMORY_AREA* kernel_data_desc = NULL;
static MEMORY_AREA* kernel_param_desc = NULL;
static MEMORY_AREA* kernel_pool_desc = NULL;
static MEMORY_AREA* kernel_shared_data_desc = NULL;
static MEMORY_AREA* kernel_mapped_low_mem_desc = NULL;
static MEMORY_AREA* MiKernelMapDescriptor = NULL;
static MEMORY_AREA* MiPagedPoolDescriptor = NULL;
PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
PVOID MiNonPagedPoolStart;
ULONG MiNonPagedPoolLength;
PVOID MiKernelMapStart;
ULONG MiKernelMapLength;
/* FUNCTIONS ****************************************************************/
/*
* @implemented
*/
BOOLEAN STDCALL MmIsThisAnNtAsSystem(VOID)
{
return(IsThisAnNtAsSystem);
}
/*
* @implemented
*/
MM_SYSTEM_SIZE STDCALL MmQuerySystemSize(VOID)
{
return(MmSystemSize);
}
VOID MiShutdownMemoryManager(VOID)
{
}
VOID INIT_FUNCTION
MmInitVirtualMemory(ULONG LastKernelAddress,
ULONG KernelLength)
/*
* FUNCTION: Intialize the memory areas list
* ARGUMENTS:
* bp = Pointer to the boot parameters
* kernel_len = Length of the kernel
*/
{
PVOID BaseAddress;
ULONG Length;
ULONG ParamLength = KernelLength;
NTSTATUS Status;
PHYSICAL_ADDRESS BoundaryAddressMultiple;
//ULONG i;
DPRINT("MmInitVirtualMemory(%x, %x)\n",LastKernelAddress, KernelLength);
BoundaryAddressMultiple.QuadPart = 0;
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
MmInitMemoryAreas();
/* Don't change the start of kernel map. Pte's must always exist for this region. */
MiKernelMapStart = (char*)LastKernelAddress + PAGE_SIZE;
MiKernelMapLength = MM_KERNEL_MAP_SIZE;
MiNonPagedPoolStart = (char*)MiKernelMapStart + MiKernelMapLength + PAGE_SIZE;
MiNonPagedPoolLength = MM_NONPAGED_POOL_SIZE;
MmPagedPoolBase = (char*)MiNonPagedPoolStart + MiNonPagedPoolLength + PAGE_SIZE;
MmPagedPoolSize = MM_PAGED_POOL_SIZE;
MiInitKernelMap();
MiInitializeNonPagedPool();
/*
* Setup the system area descriptor list
*/
BaseAddress = (PVOID)0xf0000000;
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
0x400000,
0,
&kernel_map_desc,
FALSE,
FALSE,
BoundaryAddressMultiple);
BaseAddress = (PVOID)KPCR_BASE;
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
PAGE_SIZE * MAXIMUM_PROCESSORS,
0,
&kernel_kpcr_desc,
FALSE,
FALSE,
BoundaryAddressMultiple);
BaseAddress = (PVOID)0xd0000000;
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
0x100000,
0,
&kernel_mapped_low_mem_desc,
FALSE,
FALSE,
BoundaryAddressMultiple);
BaseAddress = (PVOID)KERNEL_BASE;
Length = PAGE_ROUND_UP(((ULONG)FindSegmentEnd(".text"))) - KERNEL_BASE;
ParamLength = ParamLength - Length;
/*
* No need to lock the address space at this point since no
* other threads are running.
*/
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
Length,
0,
&kernel_text_desc,
FALSE,
FALSE,
BoundaryAddressMultiple);
// TODO: Here we REALLY should iterate the PE's sections and set protection
// accordingly for each and every one of them.
// NOTE This code ONLY works because of the assumption that the .text
// segment is the first in the PE, and the .reloc segment is the last.
// Link in a way to make this assumtion false, and the kernel won't work.
BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)FindSegmentEnd(".text")));
Length = PAGE_ROUND_UP(((ULONG)FindSegmentStart(".reloc"))) - (ULONG_PTR)BaseAddress;
ParamLength = ParamLength - Length;
DPRINT1("Data Length %x\n",Length);
DPRINT1("Data BaseAddress %x\n",BaseAddress);
/*
* No need to lock the address space at this point since we are
* the only thread running.
*/
// For GCC-compiled, kernel_data_desc contains:
// .data, .edata, .idata, .bss and .rsrc. E.i. all but .text and .reloc
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
Length,
0,
&kernel_data_desc,
FALSE,
FALSE,
BoundaryAddressMultiple);
// BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)FindSegmentEnd(".edata")));
BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)FindSegmentStart(".reloc")));
Length = LastKernelAddress - (ULONG)BaseAddress;
// For GCC-compiled, kernel_param_desc contains .reloc
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
Length,
0,
&kernel_param_desc,
FALSE,
FALSE,
BoundaryAddressMultiple);
BaseAddress = MiNonPagedPoolStart;
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
MiNonPagedPoolLength,
0,
&kernel_pool_desc,
FALSE,
FALSE,
BoundaryAddressMultiple);
BaseAddress = MiKernelMapStart;
Status = MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
MiKernelMapLength,
0,
&MiKernelMapDescriptor,
FALSE,
FALSE,
BoundaryAddressMultiple);
BaseAddress = MmPagedPoolBase;
Status = MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_PAGED_POOL,
&BaseAddress,
MmPagedPoolSize,
0,
&MiPagedPoolDescriptor,
FALSE,
FALSE,
BoundaryAddressMultiple);
MmInitializePagedPool();
/*
* Create the kernel mapping of the user/kernel shared memory.
*/
BaseAddress = (PVOID)KI_USER_SHARED_DATA;
Length = PAGE_SIZE;
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
Length,
0,
&kernel_shared_data_desc,
FALSE,
FALSE,
BoundaryAddressMultiple);
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE,
&MmSharedDataPagePhysicalAddress);
Status = MmCreateVirtualMapping(NULL,
(PVOID)KI_USER_SHARED_DATA,
PAGE_READWRITE,
MmSharedDataPagePhysicalAddress,
TRUE);
if (!NT_SUCCESS(Status))
{
DbgPrint("Unable to create virtual mapping\n");
KEBUGCHECK(0);
}
RtlZeroMemory(BaseAddress, Length);
/*
*
*/
MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
}
VOID INIT_FUNCTION
MmInit1(ULONG FirstKrnlPhysAddr,
ULONG LastKrnlPhysAddr,
ULONG LastKernelAddress,
PADDRESS_RANGE BIOSMemoryMap,
ULONG AddressRangeCount,
ULONG MaxMem)
/*
* FUNCTION: Initalize memory managment
*/
{
ULONG i;
ULONG kernel_len;
#ifndef MP
extern unsigned int unmap_me, unmap_me2, unmap_me3;
#endif
DPRINT("MmInit1(FirstKrnlPhysAddr, %x, LastKrnlPhysAddr %x, LastKernelAddress %x)\n",
FirstKrnlPhysAddr,
LastKrnlPhysAddr,
LastKernelAddress);
if ((BIOSMemoryMap != NULL) && (AddressRangeCount > 0))
{
// If we have a bios memory map, recalulate the memory size
ULONG last = 0;
for (i = 0; i < AddressRangeCount; i++)
{
if (BIOSMemoryMap[i].Type == 1
&& (BIOSMemoryMap[i].BaseAddrLow + BIOSMemoryMap[i].LengthLow + PAGE_SIZE -1) / PAGE_SIZE > last)
{
last = (BIOSMemoryMap[i].BaseAddrLow + BIOSMemoryMap[i].LengthLow + PAGE_SIZE -1) / PAGE_SIZE;
}
}
if ((last - 256) * 4 > KeLoaderBlock.MemHigher)
{
KeLoaderBlock.MemHigher = (last - 256) * 4;
}
}
if (KeLoaderBlock.MemHigher >= (MaxMem - 1) * 1024)
{
KeLoaderBlock.MemHigher = (MaxMem - 1) * 1024;
}
/*
* FIXME: Set this based on the system command line
*/
MmSystemRangeStart = (PVOID)KERNEL_BASE; // 0xC0000000
MmUserProbeAddress = (PVOID)0x7fff0000;
MmHighestUserAddress = (PVOID)0x7ffeffff;
MmInitGlobalKernelPageDirectory();
/*
* Initialize memory managment statistics
*/
MmStats.NrTotalPages = 0;
MmStats.NrSystemPages = 0;
MmStats.NrUserPages = 0;
MmStats.NrReservedPages = 0;
MmStats.NrUserPages = 0;
MmStats.NrFreePages = 0;
MmStats.NrLockedPages = 0;
MmStats.PagingRequestsInLastMinute = 0;
MmStats.PagingRequestsInLastFiveMinutes = 0;
MmStats.PagingRequestsInLastFifteenMinutes = 0;
/*
* Initialize the kernel address space
*/
MmInitializeKernelAddressSpace();
/*
* Unmap low memory
*/
#ifndef MP
/* In SMP mode we unmap the low memory in MmInit3.
The APIC needs the mapping of the first pages
while the processors are starting up. */
MmDeletePageTable(NULL, 0);
#endif
/*
* Free all pages not used for kernel memory
* (we assume the kernel occupies a continuous range of physical
* memory)
*/
DPRINT("first krnl %x\nlast krnl %x\n",FirstKrnlPhysAddr,
LastKrnlPhysAddr);
/*
* Free physical memory not used by the kernel
*/
MmStats.NrTotalPages = KeLoaderBlock.MemHigher/4;
if (!MmStats.NrTotalPages)
{
DbgPrint("Memory not detected, default to 8 MB\n");
MmStats.NrTotalPages = 2048;
}
else
{
/* add 1MB for standard memory (not extended) */
MmStats.NrTotalPages += 256;
}
#ifdef BIOS_MEM_FIX
MmStats.NrTotalPages += 16;
#endif
DbgPrint("Used memory %dKb\n", (MmStats.NrTotalPages * PAGE_SIZE) / 1024);
LastKernelAddress = (ULONG)MmInitializePageList((PVOID)FirstKrnlPhysAddr,
(PVOID)LastKrnlPhysAddr,
MmStats.NrTotalPages,
PAGE_ROUND_UP(LastKernelAddress),
BIOSMemoryMap,
AddressRangeCount);
kernel_len = LastKrnlPhysAddr - FirstKrnlPhysAddr;
/*
* Create a trap for null pointer references and protect text
* segment
*/
CHECKPOINT;
#if defined(_MSC_VER)
DPRINT(".text start: %x, .data start: %x\n",
(int)FindSegmentStart(".text"),
(int)FindSegmentStart(".data"));
{
const char* pCode = FindSegmentStart(".text");
const char* pData = FindSegmentEnd(".text");
while (pCode < pData)
{
MmSetPageProtect(NULL, (PVOID)pCode, PAGE_EXECUTE_READ);
pCode += PAGE_SIZE;
}
}
#else
DPRINT("_text_start__ %x _init_end__ %x\n",(int)&_text_start__,(int)&_init_end__);
for (i=PAGE_ROUND_DOWN(((int)&_text_start__));
i<PAGE_ROUND_UP(((int)&_init_end__));i=i+PAGE_SIZE)
{
MmSetPageProtect(NULL,
(PVOID)i,
PAGE_EXECUTE_READ);
}
#endif
DPRINT("Invalidating between %x and %x\n",
LastKernelAddress, 0xc0600000);
for (i=(LastKernelAddress); i<0xc0600000; i+=PAGE_SIZE)
{
MmRawDeleteVirtualMapping((PVOID)(i));
}
DPRINT("Invalidating between %x and %x\n",
0xd0100000, 0xd0400000);
for (i=0xd0100000; i<0xd0400000; i+=PAGE_SIZE)
{
MmRawDeleteVirtualMapping((PVOID)(i));
}
DPRINT("Almost done MmInit()\n");
#ifndef MP
/* FIXME: This is broken in SMP mode */
#if !defined(_MSC_VER) // FIXME: I don't trust using this from MSVC yet!
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me, TRUE, NULL, NULL);
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me2, TRUE, NULL, NULL);
MmDeleteVirtualMapping(NULL, (PVOID)&unmap_me3, TRUE, NULL, NULL);
#endif // _MSC_VER
#endif
/*
* Intialize memory areas
*/
MmInitVirtualMemory(LastKernelAddress, kernel_len);
MmInitializeMdlImplementation();
}
VOID INIT_FUNCTION
MmInit2(VOID)
{
MmInitializeRmapList();
MmInitializePageOp();
MmInitSectionImplementation();
MmInitPagingFile();
}
VOID INIT_FUNCTION
MmInit3(VOID)
{
/*
* Unmap low memory
*/
#ifdef MP
/* In SMP mode we can unmap the low memory
if all processors are started. */
MmDeletePageTable(NULL, 0);
#endif
MmInitZeroPageThread();
MmCreatePhysicalMemorySection();
MiInitBalancerThread();
/*
* Initialise the modified page writer.
*/
MmInitMpwThread();
/* FIXME: Read parameters from memory */
}
VOID STATIC
MiFreeInitMemoryPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry,
BOOLEAN Dirty)
{
assert(SwapEntry == 0);
if (PhysAddr.QuadPart != 0)
{
MmReleasePageMemoryConsumer(MC_NPPOOL, PhysAddr);
}
}
VOID
MiFreeInitMemory(VOID)
{
#if defined(_MSC_VER)
DPRINT1("Can not yet free .init memory for MSVC compiled kernel\n");
#else
MmLockAddressSpace(MmGetKernelAddressSpace());
MmFreeMemoryArea(MmGetKernelAddressSpace(),
(PVOID)&_init_start__,
PAGE_ROUND_UP((ULONG)&_init_end__) - (ULONG)_init_start__,
MiFreeInitMemoryPage,
NULL);
MmUnlockAddressSpace(MmGetKernelAddressSpace());
#endif
}

3271
msvc6/ntoskrnl/ntoskrnl.dsp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,299 @@
/*
* ReactOS kernel
* Copyright (C) 2000 David Welch <welch@cwcom.net>
*
* Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
*
* 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.
*/
/*
* FILE: ntoskrnl/ke/i386/vm86_sup.S
* PURPOSE: V86 mode support
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 09/10/00
*/
/* INCLUDES ******************************************************************/
#pragma hdrstop
#include <ddk/ntddk.h>
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/i386/fpu.h>
#include <internal/ps.h>
#include <ddk/defines.h>
#include <internal/v86m.h>
#include <ntos/tss.h>
//#include <ntos/service.h>
#include <internal/trap.h>
#include <internal/ps.h>
#include <roscfg.h>
#include <internal/ntoskrnl.h>
#include <internal/i386/segment.h>
#define EXCEPTION_UNWINDING 0x02
#define EREC_FLAGS 0x04
#define ExceptionContinueExecution 0
#define ExceptionContinueSearch 1
#define ExceptionNestedException 2
#define ExceptionCollidedUnwind 3
//.globl _RtlpExecuteHandlerForException
//.globl _RtlpExecuteHandlerForUnwind
#define CONTEXT_FLAGS 0x00
#define CONTEXT_SEGGS 0x8C
#define CONTEXT_SEGFS 0x90
#define CONTEXT_SEGES 0x94
#define CONTEXT_SEGDS 0x98
#define CONTEXT_EDI 0x9C
#define CONTEXT_ESI 0xA0
#define CONTEXT_EBX 0xA4
#define CONTEXT_EDX 0xA8
#define CONTEXT_ECX 0xAC
#define CONTEXT_EAX 0xB0
#define CONTEXT_EBP 0xB4
#define CONTEXT_EIP 0xB8
#define CONTEXT_SEGCS 0xBC
#define CONTEXT_EFLAGS 0xC0
#define CONTEXT_ESP 0xC4
#define CONTEXT_SEGSS 0xC8
#define RCC_CONTEXT 0x08
VOID STDCALL
AsmDebug(ULONG Value);
// EAX = value to print
__declspec(naked)
void do_debug()
{
__asm
{
pusha
push eax
call AsmDebug
popa
ret
}
}
#define REH_ERECORD 0x08
#define REH_RFRAME 0x0C
#define REH_CONTEXT 0x10
#define REH_DCONTEXT 0x14
#define REH_EROUTINE 0x18
// Parameters:
// None
// Registers:
// [EBP+08h] - PEXCEPTION_RECORD ExceptionRecord
// [EBP+0Ch] - PEXCEPTION_REGISTRATION RegistrationFrame
// [EBP+10h] - PVOID Context
// [EBP+14h] - PVOID DispatcherContext
// [EBP+18h] - PEXCEPTION_HANDLER ExceptionRoutine
// EDX - Address of protecting exception handler
// Returns:
// EXCEPTION_DISPOSITION
// Notes:
// Setup the protecting exception handler and call the exception
// handler in the right context.
__declspec(naked)
void RtlpExecuteHandler()
{
__asm
{
push ebp
mov ebp, esp
push REH_RFRAME[ebp]
push edx
push fs:0x0
mov fs:0x0, esp
// Prepare to call the exception handler
push REH_DCONTEXT[ebp]
push REH_CONTEXT[ebp]
push REH_RFRAME[ebp]
push REH_ERECORD[ebp]
// Now call the exception handler
mov eax, REH_EROUTINE[ebp]
call eax
cmp fs:0x0, -1
jne reh_stack_looks_ok
// This should not happen
push 0
push 0
push 0
push 0
call RtlAssert
reh_loop:
jmp reh_loop
reh_stack_looks_ok:
mov esp, fs:0x0
// Return to the 'front-end' for this function
pop dword ptr fs:0x0
mov esp, ebp
pop ebp
ret
}
}
#if 0
#endif // 0
#define REP_ERECORD 0x04
#define REP_RFRAME 0x08
#define REP_CONTEXT 0x0C
#define REP_DCONTEXT 0x10
// Parameters:
// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord
// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
// [ESP+0Ch] - PCONTEXT Context
// [ESP+10h] - PVOID DispatcherContext
// Registers:
// None
// Returns:
// EXCEPTION_DISPOSITION
// Notes:
// This exception handler protects the exception handling
// mechanism by detecting nested exceptions.
__declspec(naked)
void RtlpExceptionProtector()
{
__asm
{
mov eax, ExceptionContinueSearch
mov ecx, REP_ERECORD[esp]
test EREC_FLAGS[ecx], EXCEPTION_UNWINDING
jnz rep_end
// Unwinding is not taking place, so return ExceptionNestedException
// Set DispatcherContext field to the exception registration for the
// exception handler that executed when a nested exception occurred
mov ecx, REP_DCONTEXT[esp]
mov eax, REP_RFRAME[esp]
mov [ecx], eax
mov eax, ExceptionNestedException
rep_end:
ret
}
}
// Parameters:
// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord
// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
// [ESP+0Ch] - PCONTEXT Context
// [ESP+10h] - PVOID DispatcherContext
// [ESP+14h] - PEXCEPTION_HANDLER ExceptionHandler
// Registers:
// None
// Returns:
// EXCEPTION_DISPOSITION
// Notes:
// Front-end
__declspec(naked)
void RtlpExecuteHandlerForException()
{
__asm
{
mov edx, RtlpExceptionProtector
jmp RtlpExecuteHandler
}
}
#define RUP_ERECORD 0x04
#define RUP_RFRAME 0x08
#define RUP_CONTEXT 0x0C
#define RUP_DCONTEXT 0x10
// Parameters:
// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord
// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
// [ESP+0Ch] - PCONTEXT Context
// [ESP+10h] - PVOID DispatcherContext
// Registers:
// None
// Returns:
// EXCEPTION_DISPOSITION
// Notes:
// This exception handler protects the exception handling
// mechanism by detecting collided unwinds.
__declspec(naked)
void RtlpUnwindProtector()
{
__asm
{
mov eax, ExceptionContinueSearch
mov RUP_ERECORD[esp], ecx
test EREC_FLAGS[ecx], EXCEPTION_UNWINDING
jz rup_end
// Unwinding is taking place, so return ExceptionCollidedUnwind
mov ecx, RUP_RFRAME[esp]
mov edx, RUP_DCONTEXT[esp]
// Set DispatcherContext field to the exception registration for the
// exception handler that executed when a collision occurred
mov eax, RUP_RFRAME[ecx]
mov [edx], eax
mov eax, ExceptionCollidedUnwind
rup_end:
ret
}
}
// Parameters:
// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord
// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame
// [ESP+0Ch] - PCONTEXT Context
// [ESP+10h] - PVOID DispatcherContext
// [ESP+14h] - PEXCEPTION_HANDLER ExceptionHandler
// Registers:
// None
// Returns:
// EXCEPTION_DISPOSITION
__declspec(naked)
void RtlpExecuteHandlerForUnwind()
{
__asm mov edx, RtlpUnwindProtector
__asm jmp RtlpExecuteHandler
}

37
os2/apps/bepslep/Makefile Normal file
View File

@@ -0,0 +1,37 @@
# $Id: Makefile,v 1.2 2003/01/07 16:23:10 robd Exp $
#
#
PATH_TO_TOP = ../../../reactos
PATH_TO_OS2_TOP = ../..
TARGET_TYPE = program
TARGET_NORC = yes
#TARGET_APPTYPE = console
TARGET_APPTYPE = windows
TARGET_NAME = bepslep
TARGET_CFLAGS = -D__SUBSYSTEM_WINDOWS__
TARGET_LFLAGS = -nostartfiles
TARGET_SDKLIBS = doscalls.a
TARGET_GCCLIBS = stdc++
#TARGET_LIBS = $(PATH_TO_OS2_TOP)/lib/crt0w32.o \
# $(PATH_TO_TOP)/dk/psx/lib/psxdll.a
# $(PATH_TO_OS2_TOP)/dll/doscalls.dll
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,20 @@
#define INCL_DOSPROCESS
#include "../../include/os2.h"
//#include "../../include/ros2.h"
void Eingang()
{
DosBeep(3000,300);
DosSleep(1000);
DosBeep(4000,200);
DosExit(0,0);
}
void WinMainCRTStartup()
{
int a, b;
a= b+3;
b=a+3;
Eingang();
}

5
os2/apps/directory.xml Normal file
View File

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

11
os2/directory.xml Normal file
View File

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

50
os2/dirstruct.txt Normal file
View File

@@ -0,0 +1,50 @@
Win32 and os2ss sight to the system partition
+C < contains under os2ss a autogenerated config.sys
|
+-ROS
+-NATIVE < NTDLL, ntoskrnl, hal.dll, csrss.exe os2.exe psx.exe ...
| +-DRIVERS < *.SYS
| +-CONFIG < registry
+-WIN32
| +-SYSTEM < user32.dll kernel32.dll ...
| +-FONTS
| +...
+-OS2
| +-DLL < doscalls.dll ....
| +-SYSTEM
| +-...
+-PSX
+-etc < mountpoint for posix apps
+-bin
+-dev
+-lib < posix.dll
+-tmp
+-var
+-mnt < empty
posix sight to the system partition
/
+-etc < mountpoint for posix apps
+-bin
+-dev < link to OB-mans Devices
+-lib < posix.dll
+-tmp < alias to systemtemp
+-var
+-mnt
+-C < win32-driveletters
| |
| +-ROS
| +-NATIVE < NTDLL, ntoskrnl, hal.dll, csrss.exe os2.exe psx.exe ...
| | +-DRIVERS < *.SYS
| | +-CONFIG < registry
| +-WIN32
| | +-SYSTEM < user32.dll kernel32.dll ...
| | +-FONTS
| | +...
| +-OS2 <some apps
| | +-DLL < doscalls.dll ....
| | +-SYSTEM
| | +-...
| +-PSX < empty
+-D
+-E...

16
os2/doc/how to start.txt Normal file
View File

@@ -0,0 +1,16 @@
Beginning ROS/2-Developement
============================
ROS/2-Developement means building the OS/2 subsystem for ReactOS. In order to start the developement you should have CVS-access. For the CVS-access see the reactos-Homepage.
Setting up a build environment
------------------------------
For the native components (OS2SS.EXE and OS2.EXE) you'll need the same compiler and tools as you need for the rest of ReactOS. If you haven't already set it up, go to the reactos home and see the description there. For now this is the only compiler you need. At some point you'll need a compiler that can generate LX-EXEs. But now also the core dlls and even programs are compiled as PE-win32.
Getting documentation
---------------------
I'm not the inventor of OS/2. IBM still did the work, and they did also good work in terms of documentation. If you plan to do core-dll work, you'll also need NT-Native-API documentation. There exists a book called "The Native API", but there should be a preliminary PDF-file floating around. OS/2-API documentation is available on the CDs belonging to your OS/2-compiler. If you develope under OS/2 you have an INF-viewer on board. If your developementsystem is NT, I recomend you OVIEW (http://hobbes.nmsu.edu/pub/windows/win_inf.zip). This two 'books' should be, what you need.
Contacting me
-------------
Bevore you start, have a talk with me. We don't want to do useless work or do work twice. So write to ros2@dantepark.de

67
os2/doc/index.html Normal file
View File

@@ -0,0 +1,67 @@
<html>
<head>
<title>OS/2 subsystem for ReactOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<h1><b>OS/2 subsystem for ReactOS (ROS/2)</b></h1>
<h2><font color="#009966">Introduction</font></h2>
<p>The OS/2 subsystem is being developed to enable NT-like systems (like WinNT
and ReactOS) to run 32-Bit OS/2 applications natively. With this it shall provide
binary compatiblility on x86-Based systems. It is intended to port the ROS/2
also to other platforms supported by ReactOS / NT. It is planned to provide
source code compatibility on these platforms. Yeeahh, OS/2 for PowerPC is in
sight.</p>
<h2><font color="#009966">Components</font></h2>
<p>ROS/2 consists of the following components:</p>
<ul>
<li>OS2SS.EXE - A native application that implements the personality of the
OS/2 kernel.</li>
<li>OS2.EXE - A win32 application that does the interaction of the OS/2 apps
with the desktop.</li>
<li>Core DLLs - These DLLs that make OS/2 programs interface with the kernel/sub
system (i.E. DOSCALLS.DLL). </li>
<li>Additional DLLs - DLLs that provide additional APIs for OS/2 apps. This
includes Presentation Manager.</li>
</ul>
<h2><font color="#009966">Current state</font></h2>
<p>Up to now just a fragment of DOSCALLS.DLL exists. The biggest problem are the
os2 API headers which are (C) by IBM. So help is still welcome.</p>
<h2><font color="#009966">16-Bit issues</font></h2>
<p>It is not intended to support 16-bit OS/2 applications. This would make the
system inconsistent and produce much more work that use. But there is still
one issue: Current textmode applications are either 16-bit or use thunking to
call the 16-bit APIs. These 32-Bit thunking applications have to be supported.
We are still thinking how to accomplish that. </p>
<h2><font color="#009966">32-Bit issues</font></h2>
<p>It is planned to replace the current MOU- KBD- MSG- and VIO- subsystems with
the <a href="http://homepages.tesco.net/%7EJ.deBoynePollard/Softwares/conapi.html">Unicode
Console API</a>. This is also the foundation for other platforms we want to
provide source code compatibility with. So nearly every 32-Bit processor can
be supported. It sould even be possible to implement a 64-bit OS/2 API.</p>
<h2><font color="#009966">Architecture</font></h2>
<p>To understand the architecture of ReactOS or WinNT read a book from the &quot;Inside
Windows NT&quot;-series. The architecture of ROS/2 is like every normal subsystem.
When OS2SS.EXE starts, it creates an object directory named os2 and therein
it creates a port object with the name Os2API. A port is something like a socket.
Two programs can comunicate with each other via a port. The port Os2API provides
the LPC API of the OS2SS.EXE - the actual subsystem. <br>
Every OS/2 program that is loaded, is linked with DOSCALLS.DLL and NTDLL.DLL
- the interface to the NT-kernel. Since DOSCALLS is implemented using NTDLL.DLL,
every OS/2 app has it in its adress space. Many functions in DOSCALLS.DLL are
implemented by just wrapping NTDLL.DLL functions. Some functions however need
assistance by the subsystem. For this reason the app makes an LPC to OS2SS.EXE.
LPC means local procedure call and it is a very fast version of RPC. Together
with the first application also OS2.EXE starts up. OS2.EXE runs in the win32
subsystem with the security of the current user. OS2.EXE is used to gather keyboard
and mouse input and to show console windows and PM-windows of all OS/2 programms
of the current user. In order to accomplish this OS2.EXE creates a port object
in the os2 object directory named Os2Interact. OS/2 applications have a connection
to OS2.EXE, too. OS2SS.EXE and OS2.EXE also talk to each other. An OS/2 application
then makes LPCs either to OS2.EXE directly or if required via OS2SS.EXE.</p>
<p>Details</p>
<p>&nbsp;</p>
<p>LPC Documentation</p>
</body>
</html>

12603
os2/include/os2.h Normal file

File diff suppressed because it is too large Load Diff

91
os2/include/ros2.h Normal file
View File

@@ -0,0 +1,91 @@
/* $ $
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* FILE: dll/doscalls.c
* PURPOSE: supportheader for Kernelservices.
* Use this file if your dll or application
* is going to use both, the os2 base services
* as well as the native API of NTDLL.DLL
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 1-08-2002 Created
*/
/* How to use:
History got us another time. If you want to write a module
that uses either native-api or os2-services...no problem.
But if you want to use both of them you run into type conflicts.
BOOL is not very surprising. But there are many other types
whose names are equal. This results from the fact that NT
should originally become OS/2 3.0.
So your solution lies in including this file instead of os2.h
and ntddk.h. What this file here does is, it puts the os2-types+
functions into the namespace OS2 while the nt-types+functions are
put into the namespace NT. The still conflicting #defines are handled
like this: If ntddk.h defintes a symbol FOO and os2.h does the same,
this file here undefines the ntddk.h-one and renames it to NT_FOO.
This is only done for conflicting symbols. Of course, this list is a
source for errors. But is there a better solution than renaming
all of the symbols?
*/
#ifndef __ROS2_H__
#define __ROS2_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
namespace NT
{
#include <ddk/ntddk.h>
#include <napi/types.h>
}
/* rename all the symbols */
#define NT_FILE_CREATE FILE_CREATE
#undef FILE_CREATE
#define NT_CREATE_SUSPENDED CREATE_SUSPENDED
#undef CREATE_SUSPENDED
namespace OS2
{
#include "os2.h"
}
using namespace OS2;
APIRET STDCALL Dos32Open(PSZ pszFileName, PHFILE pHf,
PULONG pulAction, ULONG cbFile,
ULONG ulAttribute, ULONG fsOpenFlags,
ULONG fsOpenMode, PVOID reserved ); //ULONGPEAOP2 peaop2)
APIRET STDCALL Dos32Close(HFILE hFile);
APIRET STDCALL Dos32Read(HFILE hFile, PVOID pBuffer,
ULONG cbRead, PULONG pcbActual);
APIRET STDCALL Dos32Write(HFILE hFile, PVOID pBuffer,
ULONG cbWrite, PULONG pcbActual);
ULONG STDCALL DosSleep (ULONG ulInterval);
ULONG STDCALL DosBeep (ULONG ulFrequency, ULONG ulDuration);
VOID STDCALL DosExit (ULONG ulAction, ULONG ulResult);
//ULONG STDCALL DosDevIOCtl (HFILE hDevice, ULONG ulCategory, ULONG ulFunction,
// PVOID pParams, ULONG ulParamsLengthMax, PULONG pulParamsLength,
// PVOID pData, ULONG ulDataLengthMax, PULONG pulDataLength);
typedef ULONG foo_TID;
typedef foo_TID* foo_PTID;
typedef void (*foo_PFNTHREAD)(ULONG ulThreadArg);
ULONG STDCALL DosCreateThread (foo_PTID ptidThreadID, foo_PFNTHREAD pfnThreadAddr,
ULONG ulThreadArg, ULONG ulFlags, ULONG ulStackSize);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __ROS2_H__ */

20
os2/install.bat Normal file
View File

@@ -0,0 +1,20 @@
@echo off
if "%1" == "" goto NoParameter
set ROS_INSTALL=%1
goto Install
:NoParameter
set ROS_INSTALL=c:\reactos
:Install
echo Installing to %ROS_INSTALL%
@echo off
md %ROS_INSTALL%
md %ROS_INSTALL%\bin
md %ROS_INSTALL%\symbols
md %ROS_INSTALL%\system32
copy ..\os2\apps\bepslep\bepslep.exe %ROS_INSTALL%\bin
copy ..\os2\lib\doscalls\doscalls.dll %ROS_INSTALL%\system32
copy ..\os2\lib\doscalls\doscalls.sym %ROS_INSTALL%\symbols
copy ..\os2\server\os2ss.exe %ROS_INSTALL%\system32
copy ..\os2\server\os2ss.sym %ROS_INSTALL%\symbols

5
os2/lib/directory.xml Normal file
View File

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

View File

@@ -0,0 +1,65 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: devices.cpp
* CONTAINS: device io ctl main function.
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
* 25-07-2002 Work to make it compile
* 10-11-2002 Done som little things
*/
#define INCL_DOSDEVICES
#define INCL_DOSERRORS
#include "ros2.h"
/*******************************************/
/* DosDevIOCtl performs control functions */
/* on a device specified by an opened */
/* device handle. */
/*******************************************/
/*HFILE hDevice; Device handle returned by DosOpen, or a standard (open) device handle. */
/*ULONG category; Device category. */
/*ULONG function; Device-specific function code. */
/*PVOID pParams; Address of the command-specific argument list. */
/*ULONG cbParmLenMax; Length, in bytes, of pParams. */
/*PULONG pcbParmLen; Pointer to the length of parameters. */
/*PVOID pData; Address of the data area. */
/*ULONG cbDataLenMax; Length, in bytes, of pData. */
/*PULONG pcbDataLen; Pointer to the length of data. */
/*APIRET ulrc; Return Code.
ulrc (APIRET) - returns
Return Code.
DosDevIOCtl returns one of the following values:
0 NO_ERROR
1 ERROR_INVALID_FUNCTION
6 ERROR_INVALID_HANDLE
15 ERROR_INVALID_DRIVE
31 ERROR_GEN_FAILURE
87 ERROR_INVALID_PARAMETER
111 ERROR_BUFFER_OVERFLOW
115 ERROR_PROTECTION_VIOLATION
117 ERROR_INVALID_CATEGORY
119 ERROR_BAD_DRIVER_LEVEL
163 ERROR_UNCERTAIN_MEDIA
165 ERROR_MONITORS_NOT_SUPPORTED
*/
APIRET STDCALL DosDevIOCtl(HFILE hDevice, ULONG category, ULONG function,
PVOID pParams,ULONG cbParmLenMax,PULONG pcbParmLen,
PVOID pData,ULONG cbDataLenMax,PULONG pcbDataLen)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

View File

@@ -0,0 +1,97 @@
/* $Id: ioctl_async.cpp,v 1.2 2004/01/31 01:29:11 robertk Exp $
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: ipctl_async.cpp
* PURPOSE: This file is to be directly included into devices.cpp
* CONTAINS: implementation of the category 1 (async I/O)
* ioctl functioncodes.
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 10-11-2002 Created
*/
/* This function implements the async ioctls. It
is called from the real DosIOCtl function. This
function implies that it is only called, if the
cathegory was 0x01.
All other parameters are the same as DosIoCtl.
FIXME: implement me
*/
APIRET EvaluateAsyncIoCtl( HFILE hDevice, ULONG function,
PVOID pParams, ULONG cbParmLenMax, PULONG pcbParmLen,
PVOID pData, ULONG cbDataLenMax, PULONG pcbDataLen)
{
switch( function )
{
case 0x41: //ASYNC_SETBAUDRATE
//+------------------------------------+
//|Field Length C Datatype |
//|------------------------------------|
//|Bit Rate WORD USHORT |
//+------------------------------------+
break;
case 0x42: // Set Line Characteristics (stop, parity, data bits)
return ERROR_INVALID_PARAMETER; // example
break;
case 0x43: // Extended Set Bit Rate .
break;
case 0x44: // Transmit Byte Immediate .
break;
case 0x45: // Set Break OFF .
break;
case 0x46: // Set Modem Control Signals .
break;
case 0x47: // Behave as if XOFF Received (stop transmit) .
break;
case 0x48: // Behave as if XON Received (start transmit) .
break;
case 0x49: // Reserved .
break;
case 0x53: // Set Device Control Block (DCB) Parameters .
break;
case 0x54: // Set Enhanced Mode Parameters .
break;
case 0x61: // Query Current Bit Rate .
break;
case 0x62: // Query Line Characteristics .
break;
case 0x63: // Extended Query Bit Rate .
break;
case 0x64: // Query COM Status .
break;
case 0x65: // Query Transmit Data Status .
break;
case 0x66: // Query Modem Control Output Signals .
break;
case 0x67: // Query Current Modem Input Signals .
break;
case 0x68: // Query Number of Characters in Receive Queue .
break;
case 0x69: // Query Number of Characters in Transmit Queue .
break;
case 0x72: // Query COM Event Information .
break;
case 0x73: // Query Device Control Block (DCB) Parameters .
break;
case 0x74: // Query Enhanced Mode Parameters .
break;
default:
return ERROR_INVALID_FUNCTION;
break;
}
return ERROR_INVALID_FUNCTION;
}
/* EOF */

View File

@@ -0,0 +1,35 @@
; $Id: doscalls.def,v 1.6 2004/01/31 01:29:11 robertk Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
<<<<<<< doscalls.def
DosSleep
DosClose
DosOpen
DosRead
DosWrite
DosDevIOCtl
DosBeep
DosExit
DosCreateThread
=======
DosSleep
Dos32Close
Dos32Open
Dos32Read
Dos32Write
;DosDevIOCtl
DosBeep
DosExit
DosCreateThread
>>>>>>> 1.5
; EOF

View File

@@ -0,0 +1,23 @@
; $Id: doscalls.def.bak,v 1.1 2002/09/04 22:19:47 robertk Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
Dos32Sleep@4 @229
Dos32Close@4 @257
Dos32Open@32 @273
Dos32Read@16 @281
Dos32Write@16 @282
Dos32DevIOCtl@36 @284
Dos32Beep@8 @286
Dos32Exit@8 @234
Dos32CreateThread@20 @311
; EOF

View File

@@ -0,0 +1,35 @@
; $Id: doscalls.edf,v 1.4 2004/01/31 01:29:11 robertk Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
<<<<<<< doscalls.edf
DosSleep=DosSleep
DosClose=DosClose
DosOpen=DosOpen
DosRead=DosRead
DosWrite=DosWrite
DosDevIOCtl=DosDevIOCtl
DosBeep=DosBeep
DosExit=DosExit
DosCreateThread=DosCreateThread
=======
DosSleep=DosSleep@4 @229
Dos32Close=Dos32Close@4 @257
Dos32Open=Dos32Open@32 @273
Dos32Read=Dos32Read@16 @281
Dos32Write=Dos32Write@16 @282
;DosDevIOCtl=DosDevIOCtl@36 @284
DosBeep=DosBeep@8 @286
DosExit=DosExit@8 @234
DosCreateThread=DosCreateThread@20 @311
>>>>>>> 1.3
; EOF

View File

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

View File

@@ -0,0 +1,23 @@
<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,179 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: directory.cpp
* PURPOSE: Kernelservices for OS/2 apps
* CONTAINS: Directory related CP-functions.
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 10-11-2002 Created
*/
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#include "ros2.h"
/******************************************
DosDelete removes a file name from a
directory. The deleted file may be
recoverable.
pszFile (PSZ) - input
Address of the name of the file to be deleted.
ulrc (APIRET) - returns
Return Code.
DosDelete returns one of the following values:
0 NO_ERROR
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
26 ERROR_NOT_DOS_DISK
32 ERROR_SHARING_VIOLATION
36 ERROR_SHARING_BUFFER_EXCEEDED
87 ERROR_INVALID_PARAMETER
206 ERROR_FILENAME_EXCED_RANGE
*******************************************/
APIRET DosDelete(PSZ pszFile)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/******************************************
DosDeleteDir removes a subdirectory
from the specified disk.
pszDir (PSZ) - input
Address of the fully qualified path name of the subdirectory to be removed.
ulrc (APIRET) - returns
Return Code.
DosDeleteDir returns one of the following values:
0 NO_ERROR
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
16 ERROR_CURRENT_DIRECTORY
26 ERROR_NOT_DOS_DISK
87 ERROR_INVALID_PARAMETER
108 ERROR_DRIVE_LOCKED
206 ERROR_FILENAME_EXCED_RANGE
******************************************/
APIRET DosDeleteDir(PSZ pszDir)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/*******************************************
DosCopy copies the source file or
subdirectory to the destination file or
subdirectory.
pszOld (PSZ) - input
Address of the ASCIIZ path name of the source file,
subdirectory, or character device.
Global file-name characters are not allowed.
pszNew (PSZ) - input
Address of the ASCIIZ path name of the target file,
subdirectory, or character device.
Global file-name characters are not allowed.
option (ULONG) - input
ULONG bit flags that define how the DosCopy
function is done.
Bit Description
31-3 Reserved. These bits must be set to
zero.
2 DCPY_FAILEAS (0x00000004)
Discard the EAs if the source file
contains EAs and the destination file
system does not support EAs.
0 Discard the EAs (extended attributes) if
the destination file system does not
support EAs.
1 Fail the copy if the destination file
system does not support EAs.
1 DCPY_APPEND (x00000002)
Append the source file to the target
file's end of data.
0 Replace the target file with the source
file.
1 Append the source file to the target file's
end of data.
This is ignored when copying a
directory, or if the target file does not
exist.
0 DCPY_EXISTING (0x00000001)
Existing Target File Disposition.
0 Do not copy the source file to the target
if the file name already exists within the
target directory. If a single file is being
copied and the target already exists, an
error is returned.
1 Copy the source file to the target even if
the file name already exists within the
target directory.
Bit flag DCPY_FAILEAS can be used in
combination with bit flag DCPY_APPEND or
DCPY_EXISTING.
ulrc (APIRET) - returns
Return Code.
DosCopy returns one of the following values:
0 NO_ERROR
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
26 ERROR_NOT_DOS_DISK
32 ERROR_SHARING_VIOLATION
36 ERROR_SHARING_BUFFER_EXCEEDED
87 ERROR_INVALID_PARAMETER
108 ERROR_DRIVE_LOCKED
112 ERROR_DISK_FULL
206 ERROR_FILENAME_EXCED_RANGE
267 ERROR_DIRECTORY
282 ERROR_EAS_NOT_SUPPORTED
283 ERROR_NEED_EAS_FOUND
*******************************************/
APIRET DosCopy(PSZ pszOld,PSZ pszNew, ULONG option)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

View File

@@ -0,0 +1,199 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: openclose.cpp
* PURPOSE: Kernelservices for OS/2 apps
* CONTAINS: Open close write and handle related stuff.
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
* 25-07-2002 Work to make it compile
*/
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#include "ros2.h"
<<<<<<< openclose.cpp
APIRET STDCALL DosOpen(PSZ pszFileName, PHFILE pHf,
=======
APIRET STDCALL Dos32Open(PSZ pszFileName, PHFILE pHf,
>>>>>>> 1.4
PULONG pulAction, ULONG cbFile,
ULONG ulAttribute, ULONG fsOpenFlags,
ULONG fsOpenMode, PVOID reserved ) //ULONGPEAOP2 peaop2)
{
/* NTAPI
ZwCreateFile(
OUT PHANDLE FileHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PLARGE_INTEGER AllocationSize OPTIONAL,
IN ULONG FileAttributes,
IN ULONG ShareAccess,
IN ULONG CreateDisposition,
IN ULONG CreateOptions,
IN PVOID EaBuffer OPTIONAL,
IN ULONG EaLength
);*/
/*
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING NtPathU;
HANDLE FileHandle;
NTSTATUS Status;
ULONG Flags = 0;
switch (dwCreationDisposition)
{
case CREATE_NEW:
dwCreationDisposition = FILE_CREATE;
break;
case CREATE_ALWAYS:
dwCreationDisposition = FILE_OVERWRITE_IF;
break;
case OPEN_EXISTING:
dwCreationDisposition = FILE_OPEN;
break;
case OPEN_ALWAYS:
dwCreationDisposition = OPEN_ALWAYS;
break;
case TRUNCATE_EXISTING:
dwCreationDisposition = FILE_OVERWRITE;
}
DPRINT("CreateFileW(lpFileName %S)\n",lpFileName);
if (dwDesiredAccess & GENERIC_READ)
dwDesiredAccess |= FILE_GENERIC_READ;
if (dwDesiredAccess & GENERIC_WRITE)
dwDesiredAccess |= FILE_GENERIC_WRITE;
if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
{
Flags |= FILE_SYNCHRONOUS_IO_ALERT;
}
if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFileName,
&NtPathU,
NULL,
NULL))
return INVALID_HANDLE_VALUE;
DPRINT("NtPathU \'%S\'\n", NtPathU.Buffer);
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory = NULL;
ObjectAttributes.ObjectName = &NtPathU;
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE;
ObjectAttributes.SecurityDescriptor = NULL;
ObjectAttributes.SecurityQualityOfService = NULL;
Status = NtCreateFile (&FileHandle,
dwDesiredAccess,
&ObjectAttributes,
&IoStatusBlock,
NULL,
dwFlagsAndAttributes,
dwShareMode,
dwCreationDisposition,
Flags,
NULL,
0);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus (Status);
return INVALID_HANDLE_VALUE;
}
return FileHandle;*/
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* close a Handle. seems finished */
APIRET STDCALL DosClose(HFILE hFile)
{
NT::NTSTATUS nErrCode;
nErrCode = NT::ZwClose( (NT::HANDLE)hFile );
switch( nErrCode )
{
/*
case STATUS_SUCCESS:
return NO_ERROR;
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
case STATUS_HANDLE_NOT_CLOSABLE:
return ERROR_FILE_NOT_FOUND;
*/
}
return nErrCode;
}
APIRET STDCALL DosRead(HFILE hFile, PVOID pBuffer,
ULONG cbRead, PULONG pcbActual)
{
NT::NTSTATUS nErrCode;
NT::IO_STATUS_BLOCK isbStatus;
// read data from file
nErrCode = NT::ZwReadFile( (NT::HANDLE)hFile, NULL, NULL, NULL,
&isbStatus, pBuffer, cbRead,
NULL, NULL );
// contains the # bytes actually read.
*pcbActual = isbStatus.Information;
switch(nErrCode)
{
/*
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
// FIXME: complete this
*/
}
return NO_ERROR;
}
/* Generic write to a stream given by hFile */
APIRET STDCALL DosWrite(HFILE hFile, PVOID pBuffer,
ULONG cbWrite, PULONG pcbActual)
{
NT::NTSTATUS nErrCode;
NT::IO_STATUS_BLOCK StatusBlk;
nErrCode = NtWriteFile( (NT::HANDLE)hFile, NULL, NULL, NULL,
&StatusBlk, pBuffer, cbWrite, 0, NULL );
// FIXME *pcbActual = StatusBlk.Information;
// do an errorcode translation FIXME: correct
return ERROR_CALL_NOT_IMPLEMENTED;
switch(nErrCode)
{
/*
case STATUS_SUCCESS:
case STATUS_PENDING:
case STATUS_ACCESS_DENIED:
case STATUS_INVALID_HANDLE:
case STATUS_FILE_LOCK_CONFLICT:
return 0;
*/
}
return 0;
}

File diff suppressed because it is too large Load Diff

61
os2/lib/doscalls/makefile Normal file
View File

@@ -0,0 +1,61 @@
# $Id: makefile,v 1.7 2004/01/31 01:29:11 robertk Exp $
PATH_TO_TOP = ../../../reactos
PATH_TO_OS2_TOP = ../..
TARGET_TYPE = dynlink
#TARGET_DEFONLY = yes
TARGET_NAME = doscalls
TARGET_BASE = 0x68E00000
TARGET_CPPFLAGS =\
-Wall \
-I$(PATH_TO_OS2_TOP)/include \
-D__DOSCALLSDLL__
# removed CFLAGX
# -fno-builtin \
# -nostdinc \
# -nostdlib \
TARGET_ENTRY = _DllMain@12
TARGET_LFLAGS = -nostartfiles
TARGET_LIBS = doscalls.a
TARGET_SDKLIBS = ntdll.a
TARGET_GCCLIBS = stdc++
TARGET_OBJECTS = $(TARGET_NAME).o
MISC_OBJECTS = misc/doscalls.o misc/error.o
FILE_OBJECTS = file/openclose.o
RUN_OBJECTS = run/process.o
DEVICES_OBJECTS = devices/devices.o
OTHER_OBJECTS =
SYNC_OBJECTS =
TARGET_OBJECTS = $(FILE_OBJECTS) $(RUN_OBJECTS) $(DEVICES_OBJECTS) \
$(MISC_OBJECTS) $(OTHER_OBJECTS) $(SYNC_OBJECTS)
#TARGET_CLEAN = file/*.o vio/*.o sync/*.o mem/*.o \
# misc/*.o mou/*.o kbd/*.o run/*.o \
# doscalls.dll temp.exp
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,40 @@
// TODO: HEader: To be pasted
// INCL_DOSMEMMGR || !INCL_NOCOMMON
#define INCL_DOSMEMMGR
#undefine INCL_NOCOMMON
#include <os2.h>
// TODO: Expain that this is for memory alloc/free funcs of Os2 api
// TODO: Implement functions and give them bodies
ULONG DosAllocMem (PPVOID pBaseAddress, ULONG ulObjectSize,
ULONG ulAllocationFlags);
ULONG DosAllocSharedMem (PPVOID pBaseAddress, PCSZ pszName,
ULONG ulObjectSize, ULONG ulAllocationFlags);
ULONG DosFreeMem (PVOID pBaseAddress);
ULONG DosGetNamedSharedMem (PPVOID pBaseAddress, PCSZ pszSharedMemName,
ULONG ulAttributeFlags);
ULONG DosGetSharedMem (CPVOID pBaseAddress, ULONG ulAttributeFlags);
ULONG DosGiveSharedMem (CPVOID pBaseAddress, PID idProcessId,
ULONG ulAttributeFlags);
ULONG DosQueryMem (CPVOID pBaseAddress, PULONG pulRegionSize,
PULONG pulAllocationFlags);
ULONG DosSetMem (CPVOID pBaseAddress, ULONG ulRegionSize,
ULONG ulAttributeFlags);
ULONG DosSubAllocMem (PVOID pOffset, PPVOID pBlockOffset, ULONG ulSize);
ULONG DosSubFreeMem (PVOID pOffset, PVOID pBlockOffset, ULONG ulSize);
ULONG DosSubSetMem (PVOID pOffset, ULONG ulFlags, ULONG ulSize);
ULONG DosSubUnsetMem (PVOID pOffset);
// TODO: Add file to makefile

View File

@@ -0,0 +1,33 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* FILE: dll/doscalls.c
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
*/
// here's only the NTDLL needet
#include <ddk/ntddk.h>
BOOL STDCALL DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case 1://DLL_PROCESS_ATTACH:
case 2://DLL_THREAD_ATTACH:
case 3://DLL_THREAD_DETACH:
case 0://DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View File

@@ -0,0 +1,165 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: error.cpp
* CONTAINS: Error related CP-functions.
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
* 25-07-2002 Work to make it compile
*/
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#include "ros2.h"
// we need the extra definitions of this file
namespace NT {
#include <ddk/ntddbeep.h>
}
/*******************************************
DosBeep generates sound from the
speaker.
freq (ULONG) - input
Cycles per second (Hertz) in the range of 0x25 to
0x7FFF.
dur (ULONG) - input
The length of the sound in milliseconds.
ulrc (APIRET) - returns
Return Code.
DosBeep returns one of the following values:
0 NO_ERROR
395 ERROR_INVALID_FREQUENCY
*******************************************/
APIRET STDCALL DosBeep(ULONG freq, ULONG dur)
{
NT::BEEP_SET_PARAMETERS BeepSetParameters;
NT::HANDLE hBeep;
NT::IO_STATUS_BLOCK ComplStatus;
NT::UNICODE_STRING unistr;
NT::NTSTATUS stat;
NT::OBJECT_ATTRIBUTES oa = {sizeof oa, 0, &unistr, NT::OBJ_CASE_INSENSITIVE, 0, 0};
// init String still bevore use.
NT::RtlInitUnicodeString( &unistr, (NT::PWSTR)L"\\\\.\\Beep" );
if( freq<0x25 || freq>0x7FFF )
return ERROR_INVALID_FREQUENCY; //395; //
/* Set beep data */
BeepSetParameters.Frequency = freq;
BeepSetParameters.Duration = dur;
/* open the beep dirver */
stat = NT::ZwOpenFile( &hBeep,
FILE_READ_DATA | FILE_WRITE_DATA,
&oa,
&ComplStatus,
0, // no sharing
FILE_OPEN );
if ( stat<0 )
{
return ERROR_NOT_READY;
}
/* actually beep */
NT::ZwDeviceIoControlFile(hBeep, 0, // Event
0, // APC-routine
0, // UserAPCContext
&ComplStatus, IOCTL_BEEP_SET,
&BeepSetParameters,
sizeof(NT::BEEP_SET_PARAMETERS),
NULL,
0 );
NT::ZwClose(hBeep);
return NO_ERROR;
}
/******************************************
DosError disables or enables error
notification to end users.
error (ULONG) - input
Error and Exception pop-up flags.
The unused high-order bits are reserved, and must be zero. The following values can be specified
for this parameter. They can be combined using the "logical or" ( | ) operator.
FERR_DISABLEHARDERR (0x00000000)
Disable hard error pop-ups.
FERR_ENABLEHARDERR (0x00000001)
Enable hard error pop-ups.
FERR_ENABLEEXCEPTION (0x00000000)
Enable program exception and untrapped numeric-processor exception pop-ups.
FERR_DISABLEEXCEPTION (0x00000002)
Disable program exception and untrapped numeric-processor exception pop-ups.
ulrc (APIRET) - returns
Return Code.
DosError returns one of the following values:
0 NO_ERROR
87 ERROR_INVALID_PARAMETER
*******************************************/
APIRET DosError( ULONG error)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/*******************************************
DosMove moves a file object to another
location, and changes its name.
pszOld (PSZ) - input
Address of the old path name of the file or
subdirectory to be moved.
pszNew (PSZ) - input
Address of the new path name of the file or
subdirectory.
ulrc (APIRET) - returns
Return Code.
DosMove returns the one of following values:
0 NO_ERROR
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
17 ERROR_NOT_SAME_DEVICE
26 ERROR_NOT_DOS_DISK
32 ERROR_SHARING_VIOLATION
36 ERROR_SHARING_BUFFER_EXCEEDED
87 ERROR_INVALID_PARAMETER
108 ERROR_DRIVE_LOCKED
206 ERROR_FILENAME_EXCED_RANGE
250 ERROR_CIRCULARITY_REQUESTED
251 ERROR_DIRECTORY_IN_CDS
*******************************************/
APIRET DosMove(PSZ pszOld, PSZ pszNew)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

View File

@@ -0,0 +1,58 @@
/* $Id$
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* PART: doscalls.dll
* FILE: process.cpp
* CONTAINS: process and thread related CP-functions.
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. nonvolatil@yahoo.de
* REVISION HISTORY:
* 13-03-2002 Created
* 25-07-2002 Work to make it compile
*/
//#if defined (INCL_DOS)
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#include "ros2.h"
APIRET STDCALL DosSleep(ULONG msec)
{
NT::NTSTATUS stat;
NT::TIME Interv;
Interv.QuadPart= -(10000 * msec);
stat = NT::NtDelayExecution( TRUE, &Interv );
return 0;
}
/* $Id$ */
/* Terminates the current thread or the current Process.
Decission is made by action
FIXME: move this code to OS2.EXE */
VOID APIENTRY DosExit(ULONG action, ULONG result)
{
// decide what to do
if( action == EXIT_THREAD)
{
NT::NtTerminateThread( NULL, result );
}
else // EXIT_PROCESS
{
NT::NtTerminateProcess( NULL, result );
}
}
APIRET STDCALL DosCreateThread(PTID ptid, PFNTHREAD pfn,
ULONG param, ULONG flag, ULONG cbStack)
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
/* EOF */

14
os2/makefile Normal file
View File

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

50
os2/server/dllmain.c Normal file
View File

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

3
os2/server/os2srv.def Normal file
View File

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

13
os2/server/os2srv.h Normal file
View File

@@ -0,0 +1,13 @@
#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_ */

4
os2/server/os2srv.rc Normal file
View File

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

11
os2/server/os2srv.xml Normal file
View File

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

84
os2/server/server.c Normal file
View File

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

BIN
os2/utils/LXDUMP.EXE Normal file

Binary file not shown.

14
posix/Makefile Normal file
View File

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

View File

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

View File

@@ -0,0 +1,30 @@
# $Id: Makefile,v 1.9 2003/01/05 18:27:19 robd Exp $
#
# To run it in Win32 console mode, undefine __SUBSYSTEM_WINDOWS__
# and pass "console" in the ld's --subsystem option.
#
#
PATH_TO_TOP = ../../../reactos
PATH_TO_PSX_TOP = ../..
TARGET_TYPE = program
#TARGET_APPTYPE = console
TARGET_APPTYPE = windows
TARGET_NAME = baresh
TARGET_CFLAGS = -D__SUBSYSTEM_WINDOWS__
TARGET_LIBS = $(PATH_TO_PSX_TOP)/lib/crt0w32.o \
$(PATH_TO_TOP)/dk/psx/lib/psxdll.a
TARGET_OBJECTS = sh.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,4 @@
#define REACTOS_STR_FILE_DESCRIPTION "Bare sh for ReactOS POSIX Subsystem\0"
#define REACTOS_STR_INTERNAL_NAME "sh\0"
#define REACTOS_STR_ORIGINAL_FILENAME "sh\0"
#include <reactos/version.rc>

60
posix/apps/baresh/sh.c Normal file
View File

@@ -0,0 +1,60 @@
/* $Id: sh.c,v 1.3 2002/10/29 04:44:59 rex Exp $
*
* baresh - Bare Shell for the PSX subsystem.
* Copyright (c) 2002 Emanuele Aliberti
* License: GNU GPL v2
*/
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#define INPUT_BUFFER_SIZE 128
int run=1;
void cmd_exit(char*buf)
{
run=0;
}
void cmd_pwd(char * buf)
{
char pwd[1024];
getcwd(pwd,sizeof pwd);
printf("%s\n",pwd);
}
void cmd_ls(char*buf)
{
char pwd[1024];
DIR * dir;
struct dirent * entry;
getcwd(pwd,sizeof pwd);
dir=opendir(pwd);
while (NULL!=(entry=readdir(dir)))
{
printf("%s\n",entry->d_name);
}
closedir(dir);
}
int main(int argc,char*argv[])
{
char buf[INPUT_BUFFER_SIZE];
while (run)
{
printf("# ");
if (gets(buf))
{
if (!strcmp("exit",buf)) cmd_exit(buf);
else if (!strcmp("pwd",buf)) cmd_pwd(buf);
else if (!strcmp("ls",buf)) cmd_ls(buf);
else printf("%s: unknown command\n",argv[0]);
}
}
return 0;
}
/* EOF */

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