Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/System.IO')
-rw-r--r--mcs/class/corlib/System.IO/BinaryReader.cs388
-rwxr-xr-xmcs/class/corlib/System.IO/BinaryWriter.cs207
-rw-r--r--mcs/class/corlib/System.IO/BufferedStream.cs163
-rw-r--r--mcs/class/corlib/System.IO/ChangeLog685
-rw-r--r--mcs/class/corlib/System.IO/CheckArgument.cs166
-rw-r--r--mcs/class/corlib/System.IO/CheckPermission.cs87
-rw-r--r--mcs/class/corlib/System.IO/Directory.cs416
-rw-r--r--mcs/class/corlib/System.IO/DirectoryInfo.cs135
-rwxr-xr-xmcs/class/corlib/System.IO/DirectoryNotFoundException.cs38
-rw-r--r--mcs/class/corlib/System.IO/EndOfStreamException.cs43
-rw-r--r--mcs/class/corlib/System.IO/File.cs297
-rw-r--r--mcs/class/corlib/System.IO/FileAccess.cs34
-rw-r--r--mcs/class/corlib/System.IO/FileAttributes.cs35
-rw-r--r--mcs/class/corlib/System.IO/FileInfo.cs147
-rwxr-xr-xmcs/class/corlib/System.IO/FileLoadException.cs106
-rw-r--r--mcs/class/corlib/System.IO/FileMode.cs45
-rwxr-xr-xmcs/class/corlib/System.IO/FileNotFoundException.cs97
-rw-r--r--mcs/class/corlib/System.IO/FileShare.cs28
-rw-r--r--mcs/class/corlib/System.IO/FileStream.cs487
-rw-r--r--mcs/class/corlib/System.IO/FileSystemInfo.cs149
-rw-r--r--mcs/class/corlib/System.IO/IOException.cs43
-rw-r--r--mcs/class/corlib/System.IO/MemoryStream.cs398
-rwxr-xr-xmcs/class/corlib/System.IO/MonoFileType.cs20
-rw-r--r--mcs/class/corlib/System.IO/MonoIO.cs267
-rw-r--r--mcs/class/corlib/System.IO/MonoIOError.cs1798
-rw-r--r--mcs/class/corlib/System.IO/MonoIOStat.cs22
-rw-r--r--mcs/class/corlib/System.IO/Path.cs277
-rw-r--r--mcs/class/corlib/System.IO/PathTooLongException.cs43
-rw-r--r--mcs/class/corlib/System.IO/SearchPattern.cs169
-rw-r--r--mcs/class/corlib/System.IO/SeekOrigin.cs34
-rwxr-xr-xmcs/class/corlib/System.IO/Stream.cs323
-rw-r--r--mcs/class/corlib/System.IO/StreamReader.cs388
-rw-r--r--mcs/class/corlib/System.IO/StreamWriter.cs219
-rw-r--r--mcs/class/corlib/System.IO/StringReader.cs133
-rw-r--r--mcs/class/corlib/System.IO/StringWriter.cs83
-rw-r--r--mcs/class/corlib/System.IO/TextReader.cs87
-rw-r--r--mcs/class/corlib/System.IO/TextWriter.cs289
37 files changed, 8346 insertions, 0 deletions
diff --git a/mcs/class/corlib/System.IO/BinaryReader.cs b/mcs/class/corlib/System.IO/BinaryReader.cs
new file mode 100644
index 00000000000..747f67817ac
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BinaryReader.cs
@@ -0,0 +1,388 @@
+//
+// System.IO.BinaryReader
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+// Dick Porter (dick@ximian.com)
+//
+
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace System.IO {
+ public class BinaryReader : IDisposable {
+ Stream m_stream;
+ Encoding m_encoding;
+ int m_encoding_max_byte;
+
+ byte[] m_buffer;
+
+ public BinaryReader(Stream input) : this(input, Encoding.UTF8Unmarked) {
+ }
+
+ public BinaryReader(Stream input, Encoding encoding) {
+ if (input == null || encoding == null)
+ throw new ArgumentNullException(Locale.GetText ("Input or Encoding is a null reference."));
+ if (!input.CanRead)
+ throw new ArgumentException(Locale.GetText ("The stream doesn't support reading."));
+
+ m_stream = input;
+ m_encoding = encoding;
+ m_encoding_max_byte = m_encoding.GetMaxByteCount(1);
+ m_buffer = new byte [32];
+ }
+
+ public virtual Stream BaseStream {
+ get {
+ return m_stream;
+ }
+ }
+
+ public virtual void Close() {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing && m_stream != null)
+ m_stream.Close ();
+
+ m_buffer = null;
+ m_encoding = null;
+ m_stream = null;
+ }
+
+ void IDisposable.Dispose()
+ {
+ Dispose (true);
+ }
+
+ protected virtual void FillBuffer(int bytes) {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ CheckBuffer(bytes);
+
+ /* Cope with partial reads */
+ int pos=0;
+ while(pos<bytes) {
+ int n=m_stream.Read(m_buffer, pos, bytes-pos);
+ if(n==0) {
+ throw new EndOfStreamException();
+ }
+
+ pos+=n;
+ }
+ }
+
+ public virtual int PeekChar() {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ if(!m_stream.CanSeek) {
+ return(-1);
+ }
+
+ long pos=m_stream.Position;
+ int ch=Read();
+ m_stream.Position=pos;
+
+ return(ch);
+ }
+
+ public virtual int Read() {
+ char[] decode = new char[1];
+
+ int count=Read(decode, 0, 1);
+ if(count==0) {
+ /* No chars available */
+ return(-1);
+ }
+
+ return decode[0];
+ }
+
+ public virtual int Read(byte[] buffer, int index, int count) {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ if (buffer == null) {
+ throw new ArgumentNullException("buffer is null");
+ }
+ if (buffer.Length - index < count) {
+ throw new ArgumentException("buffer is too small");
+ }
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException("index is less than 0");
+ }
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than 0");
+ }
+
+ int bytes_read=m_stream.Read(buffer, index, count);
+
+ return(bytes_read);
+ }
+
+ public virtual int Read(char[] buffer, int index, int count) {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ if (buffer == null) {
+ throw new ArgumentNullException("buffer is null");
+ }
+ if (buffer.Length - index < count) {
+ throw new ArgumentException("buffer is too small");
+ }
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException("index is less than 0");
+ }
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than 0");
+ }
+
+ int chars_read=0;
+ int bytes_read=0;
+
+ while(chars_read < count) {
+ CheckBuffer(bytes_read);
+
+ int read_byte=m_stream.ReadByte();
+ if(read_byte==-1) {
+ /* EOF */
+ return(chars_read);
+ }
+
+ m_buffer[bytes_read]=(byte)read_byte;
+ bytes_read++;
+
+ chars_read=m_encoding.GetChars(m_buffer, 0,
+ bytes_read,
+ buffer, index);
+
+ }
+
+ return(chars_read);
+ }
+
+ protected int Read7BitEncodedInt() {
+ int ret = 0;
+ int shift = 0;
+ byte b;
+
+ do {
+ b = ReadByte();
+
+ ret = ret | ((b & 0x7f) << shift);
+ shift += 7;
+ } while ((b & 0x80) == 0x80);
+
+ return ret;
+ }
+
+ public virtual bool ReadBoolean() {
+ FillBuffer(1);
+
+ // Return value:
+ // true if the byte is non-zero; otherwise false.
+ return(m_buffer[0] != 0);
+ }
+
+ public virtual byte ReadByte() {
+ FillBuffer(1);
+
+ return(m_buffer[0]);
+ }
+
+ public virtual byte[] ReadBytes(int count) {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than 0");
+ }
+
+ /* Can't use FillBuffer() here, because it's OK to
+ * return fewer bytes than were requested
+ */
+
+ byte[] buf = new byte[count];
+ int pos=0;
+
+ while(pos < count) {
+ int n=m_stream.Read(buf, pos, count-pos);
+ if(n==0) {
+ /* EOF */
+ break;
+ }
+
+ pos+=n;
+ }
+
+ if (pos!=count) {
+ byte[] new_buffer=new byte[pos];
+ Array.Copy(buf, new_buffer, pos);
+ return(new_buffer);
+ }
+
+ return(buf);
+ }
+
+ public virtual char ReadChar() {
+ int ch=Read();
+
+ if(ch==-1) {
+ throw new EndOfStreamException();
+ }
+
+ return((char)ch);
+ }
+
+ public virtual char[] ReadChars(int count) {
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than 0");
+ }
+
+ char[] full = new char[count];
+ int chars = Read(full, 0, count);
+
+ if (chars == 0) {
+ throw new EndOfStreamException();
+ } else if (chars != full.Length) {
+ char[] ret = new char[chars];
+ Array.Copy(full, 0, ret, 0, chars);
+ return ret;
+ } else {
+ return full;
+ }
+ }
+
+ unsafe public virtual decimal ReadDecimal() {
+ FillBuffer(16);
+
+ decimal ret;
+ byte* ret_ptr = (byte *)&ret;
+ for (int i = 0; i < 16; i++) {
+ ret_ptr[i] = m_buffer[i];
+ }
+
+ return ret;
+ }
+
+ public virtual double ReadDouble() {
+ FillBuffer(8);
+
+ return(BitConverter.ToDouble(m_buffer, 0));
+ }
+
+ public virtual short ReadInt16() {
+ FillBuffer(2);
+
+ return((short) (m_buffer[0] | (m_buffer[1] << 8)));
+ }
+
+ public virtual int ReadInt32() {
+ FillBuffer(4);
+
+ return(m_buffer[0] | (m_buffer[1] << 8) |
+ (m_buffer[2] << 16) | (m_buffer[3] << 24));
+ }
+
+ public virtual long ReadInt64() {
+ FillBuffer(8);
+
+ uint ret_low = (uint) (m_buffer[0] |
+ (m_buffer[1] << 8) |
+ (m_buffer[2] << 16) |
+ (m_buffer[3] << 24)
+ );
+ uint ret_high = (uint) (m_buffer[4] |
+ (m_buffer[5] << 8) |
+ (m_buffer[6] << 16) |
+ (m_buffer[7] << 24)
+ );
+ return (long) ((((ulong) ret_high) << 32) | ret_low);
+ }
+
+ [CLSCompliant(false)]
+ public virtual sbyte ReadSByte() {
+ FillBuffer(1);
+
+ return((sbyte)m_buffer[0]);
+ }
+
+ public virtual string ReadString() {
+ /* Inspection of BinaryWriter-written files
+ * shows that the length is given in bytes,
+ * not chars
+ */
+ int len = Read7BitEncodedInt();
+
+ FillBuffer(len);
+
+ char[] str = m_encoding.GetChars(m_buffer, 0, len);
+
+ return(new String(str));
+ }
+
+ public virtual float ReadSingle() {
+ FillBuffer(4);
+
+ return(BitConverter.ToSingle(m_buffer, 0));
+ }
+
+ [CLSCompliant(false)]
+ public virtual ushort ReadUInt16() {
+ FillBuffer(2);
+
+ return((ushort) (m_buffer[0] | (m_buffer[1] << 8)));
+ }
+
+ [CLSCompliant(false)]
+ public virtual uint ReadUInt32() {
+ FillBuffer(4);
+
+
+ return((uint) (m_buffer[0] |
+ (m_buffer[1] << 8) |
+ (m_buffer[2] << 16) |
+ (m_buffer[3] << 24)));
+ }
+
+ [CLSCompliant(false)]
+ public virtual ulong ReadUInt64() {
+ FillBuffer(8);
+
+ uint ret_low = (uint) (m_buffer[0] |
+ (m_buffer[1] << 8) |
+ (m_buffer[2] << 16) |
+ (m_buffer[3] << 24)
+ );
+ uint ret_high = (uint) (m_buffer[4] |
+ (m_buffer[5] << 8) |
+ (m_buffer[6] << 16) |
+ (m_buffer[7] << 24)
+ );
+ return (((ulong) ret_high) << 32) | ret_low;
+ }
+
+ /* Ensures that m_buffer is at least length bytes
+ * long, growing it if necessary
+ */
+ private void CheckBuffer(int length)
+ {
+ if(m_buffer.Length <= length) {
+ byte[] new_buffer=new byte[length];
+ Array.Copy(m_buffer, new_buffer,
+ m_buffer.Length);
+ m_buffer=new_buffer;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/BinaryWriter.cs b/mcs/class/corlib/System.IO/BinaryWriter.cs
new file mode 100755
index 00000000000..2ff0e1f5d41
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BinaryWriter.cs
@@ -0,0 +1,207 @@
+//
+// System.IO.BinaryWriter
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace System.IO {
+ [Serializable]
+ public class BinaryWriter : IDisposable {
+
+ // Null is a BinaryWriter with no backing store.
+ public static readonly BinaryWriter Null;
+
+ protected Stream OutStream;
+ private Encoding m_encoding;
+ private byte [] buffer;
+
+ static BinaryWriter() {
+ Null = new BinaryWriter();
+ }
+
+ protected BinaryWriter() : this (Stream.Null, Encoding.UTF8Unmarked) {
+ }
+
+ public BinaryWriter(Stream output) : this(output, Encoding.UTF8Unmarked) {
+ }
+
+ public BinaryWriter(Stream output, Encoding encoding) {
+ if (output == null || encoding == null)
+ throw new ArgumentNullException(Locale.GetText ("Output or Encoding is a null reference."));
+ if (!output.CanWrite)
+ throw new ArgumentException(Locale.GetText ("Stream does not support writing or already closed."));
+
+ OutStream = output;
+ m_encoding = encoding;
+ buffer = new byte [16];
+ }
+
+ public virtual Stream BaseStream {
+ get {
+ return OutStream;
+ }
+ }
+
+ public virtual void Close() {
+ Dispose (true);
+ }
+
+ void IDisposable.Dispose() {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing && OutStream != null)
+ OutStream.Close();
+
+ buffer = null;
+ m_encoding = null;
+ OutStream = null;
+ }
+
+ public virtual void Flush() {
+ OutStream.Flush();
+ }
+
+ public virtual long Seek(int offset, SeekOrigin origin) {
+ return OutStream.Seek(offset, origin);
+ }
+
+ public virtual void Write(bool value) {
+ buffer [0] = (byte) (value ? 1 : 0);
+ OutStream.Write(buffer, 0, 1);
+ }
+
+ public virtual void Write(byte value) {
+ OutStream.WriteByte(value);
+ }
+
+ public virtual void Write(byte[] value) {
+ if (value == null)
+ throw new ArgumentNullException(Locale.GetText ("Byte buffer is a null reference."));
+ OutStream.Write(value, 0, value.Length);
+ }
+
+ public virtual void Write(byte[] value, int offset, int length) {
+ if (value == null)
+ throw new ArgumentNullException(Locale.GetText ("Byte buffer is a null reference."));
+ OutStream.Write(value, offset, length);
+ }
+
+ public virtual void Write(char value) {
+ char[] dec = new char[1];
+ dec[0] = value;
+ byte[] enc = m_encoding.GetBytes(dec, 0, 1);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ public virtual void Write(char[] value) {
+ if (value == null)
+ throw new ArgumentNullException(Locale.GetText ("Chars is a null reference."));
+ byte[] enc = m_encoding.GetBytes(value, 0, value.Length);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ public virtual void Write(char[] value, int offset, int length) {
+ if (value == null)
+ throw new ArgumentNullException(Locale.GetText ("Chars is a null reference."));
+ byte[] enc = m_encoding.GetBytes(value, offset, length);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ unsafe public virtual void Write(decimal value) {
+ byte* value_ptr = (byte *)&value;
+ for (int i = 0; i < 16; i++) {
+ buffer [i] = value_ptr [i];
+ }
+
+ OutStream.Write(buffer, 0, 16);
+ }
+
+ public virtual void Write(double value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 8);
+ }
+
+ public virtual void Write(short value) {
+ buffer [0] = (byte) value;
+ buffer [1] = (byte) (value >> 8);
+ OutStream.Write(buffer, 0, 2);
+ }
+
+ public virtual void Write(int value) {
+ buffer [0] = (byte) value;
+ buffer [1] = (byte) (value >> 8);
+ buffer [2] = (byte) (value >> 16);
+ buffer [3] = (byte) (value >> 24);
+ OutStream.Write(buffer, 0, 4);
+ }
+
+ public virtual void Write(long value) {
+ for (int i = 0, sh = 0; i < 8; i++, sh += 8)
+ buffer [i] = (byte) (value >> sh);
+ OutStream.Write(buffer, 0, 8);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(sbyte value) {
+ buffer [0] = (byte) value;
+ OutStream.Write(buffer, 0, 1);
+ }
+
+ public virtual void Write(float value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 4);
+ }
+
+ public virtual void Write(string value) {
+ /* The length field is the byte count, not the
+ * char count
+ */
+ byte[] enc = m_encoding.GetBytes(value);
+ Write7BitEncodedInt(enc.Length);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(ushort value) {
+ buffer [0] = (byte) value;
+ buffer [1] = (byte) (value >> 8);
+ OutStream.Write(buffer, 0, 2);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(uint value) {
+ buffer [0] = (byte) value;
+ buffer [1] = (byte) (value >> 8);
+ buffer [2] = (byte) (value >> 16);
+ buffer [3] = (byte) (value >> 24);
+ OutStream.Write(buffer, 0, 4);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(ulong value) {
+ for (int i = 0, sh = 0; i < 8; i++, sh += 8)
+ buffer [i] = (byte) (value >> sh);
+ OutStream.Write(buffer, 0, 8);
+ }
+
+ protected void Write7BitEncodedInt(int value) {
+ do {
+ int high = (value >> 7) & 0x01ffffff;
+ byte b = (byte)(value & 0x7f);
+
+ if (high != 0) {
+ b = (byte)(b | 0x80);
+ }
+
+ Write(b);
+ value = high;
+ } while(value != 0);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/BufferedStream.cs b/mcs/class/corlib/System.IO/BufferedStream.cs
new file mode 100644
index 00000000000..ac7d17a5e23
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BufferedStream.cs
@@ -0,0 +1,163 @@
+//
+// System.IO.BufferedStream
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+namespace System.IO {
+ public sealed class BufferedStream : Stream {
+ Stream m_stream;
+ byte[] m_buffer;
+ int m_buffer_pos;
+ int m_buffer_read_ahead;
+ bool m_buffer_reading;
+
+ public BufferedStream(Stream stream) : this(stream, 4096) {
+ }
+
+ public BufferedStream(Stream stream, int buffer_size) {
+ m_stream = stream;
+ m_buffer = new byte[buffer_size];
+ }
+
+ public override bool CanRead {
+ get {
+ return m_stream.CanRead;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return m_stream.CanWrite;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return m_stream.CanSeek;
+ }
+ }
+
+ public override long Length {
+ get {
+ return m_stream.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ return m_stream.Position - m_buffer_read_ahead + m_buffer_pos;
+ }
+
+ set {
+ Flush();
+ m_stream.Position = value;
+ }
+ }
+
+ public override void Close() {
+ Flush();
+ m_stream.Close();
+ m_stream = null;
+ m_buffer = null;
+ }
+
+ public override void Flush() {
+ if (m_buffer_reading) {
+ if (CanSeek)
+ m_stream.Position = Position;
+ } else {
+ m_stream.Write(m_buffer, 0, m_buffer_pos);
+ }
+
+ m_buffer_read_ahead = 0;
+ m_buffer_pos = 0;
+ }
+
+ public override long Seek(long offset, SeekOrigin origin) {
+ Flush();
+ return m_stream.Seek(offset, origin);
+ }
+
+ public override void SetLength(long value) {
+ m_stream.SetLength(value);
+ }
+
+ public override int ReadByte() {
+ byte[] b = new byte[1];
+
+ if (Read(b, 0, 1) == 1) {
+ return b[0];
+ } else {
+ return -1;
+ }
+ }
+
+ public override void WriteByte(byte value) {
+ byte[] b = new byte[1];
+
+ b[0] = value;
+ Write(b, 0, 1);
+ }
+
+ public override int Read(byte[] array, int offset, int count) {
+ if (!m_buffer_reading) {
+ Flush();
+ m_buffer_reading = true;
+ }
+
+ if (count <= m_buffer_read_ahead - m_buffer_pos) {
+ Array.Copy(m_buffer, m_buffer_pos, array, offset, count);
+
+ m_buffer_pos += count;
+ if (m_buffer_pos == m_buffer_read_ahead) {
+ m_buffer_pos = 0;
+ m_buffer_read_ahead = 0;
+ }
+
+ return count;
+ }
+
+ int ret = m_buffer_read_ahead - m_buffer_pos;
+ Array.Copy(m_buffer, m_buffer_pos, array, offset, ret);
+ m_buffer_pos = 0;
+ m_buffer_read_ahead = 0;
+ offset += ret;
+ count -= ret;
+
+ if (count >= m_buffer.Length) {
+ ret += m_stream.Read(array, offset, count);
+ } else {
+ m_buffer_read_ahead = m_stream.Read(m_buffer, 0, m_buffer.Length);
+
+ if (count < m_buffer_read_ahead) {
+ Array.Copy(m_buffer, 0, array, offset, count);
+ m_buffer_pos = count;
+ ret += count;
+ } else {
+ Array.Copy(m_buffer, 0, array, offset, m_buffer_read_ahead);
+ ret += m_buffer_read_ahead;
+ m_buffer_read_ahead = 0;
+ }
+ }
+
+ return ret;
+ }
+
+ public override void Write(byte[] array, int offset, int count) {
+ if (m_buffer_reading) {
+ Flush();
+ m_buffer_reading = false;
+ }
+
+ if (m_buffer_pos + count >= m_buffer.Length) {
+ Flush();
+ m_stream.Write(array, offset, count);
+ } else {
+ Array.Copy(array, offset, m_buffer, m_buffer_pos, count);
+ m_buffer_pos += count;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/ChangeLog b/mcs/class/corlib/System.IO/ChangeLog
new file mode 100644
index 00000000000..90b58635de2
--- /dev/null
+++ b/mcs/class/corlib/System.IO/ChangeLog
@@ -0,0 +1,685 @@
+2003-01-18 Jonathan Pryor <jonpryor@vt.edu>
+
+ * FileStream.cs: Add IsAsync property. (Documented in "C# In A Nutshell".)
+
+2003-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MemoryStream.cs: fixed bug #36319.
+
+2002-12-16 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: Some fixes to SMB shares handling, and not compiling
+ with csc, mcs compiles it correctly (mcs bug 35652)
+
+2002-12-14 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: Some fixes related to correct some exceptions thrown
+
+2002-12-11 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: Some Exceptions added, fixed GetParent(),
+ CreateDirectory() should work with unix, native windows and
+ windows samba shares. Converted end-lines from dos-mode to unix-mode
+
+2002-12-08 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: CreateDirectory works now with Absolute paths
+ too, not only with relative ones.
+
+2002-12-07 Peter Williams <peterw@ximian.com>
+
+ * Directory.cs: Don't use the uninitialized pathsumm here.
+ Don't try and create "" if we're using an absolute path.
+
+2002-12-07 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: Now the creation of a new directory works recursively
+ it will make parents as needed.
+
+2002-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BufferedStream.cs: applied patch from <carlosga@telefonica.net> that
+ fixes Flush ().
+
+Tue Nov 19 13:01:22 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StreamWriter.cs: output the encoding preamble at the start of a
+ stream if needed.
+
+2002-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs: Changed all Encoding.UTF8 to Encoding.UTF8Unmarked.
+
+2002-11-06 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamWriter.cs: Changed all Encoding.UTF8 to Encoding.UTF8Unmarked.
+
+2002-10-31 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: Fix buffering properly this time. Also kludge
+ around broken pipe errors, treating them as EOF instead of
+ throwing an IO exception.
+
+ * MonoIO.cs: Return the error status in a parameter, as the
+ GetLastError() value has long since been blown away if we try and
+ look it up in a subsequent internal call invocation.
+
+ * FileSystemInfo.cs:
+ * FileInfo.cs:
+ * File.cs:
+ * Directory.cs: MonoIO methods now have an error parameter
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TextReader.cs: implemented ReadBlock ().
+
+2002-10-30 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamWriter.cs: Ditto for Null stream.
+
+ * BinaryReader.cs: Use Unmarked here too.
+
+ * BinaryWriter.cs: Use the UTF8Unmarker encoding by default, this
+ is what .NET does.
+
+2002-10-23 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: Implemented CanSeek, and used it around all the
+ calls to MonoIO.Seek. Fixed buffering in Read() so that it
+ doesn't block forever on short reads.
+
+ * MonoFileType.cs: New enum for GetFileType
+
+ * MonoIO.cs: Added GetFileType
+
+2002-10-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs: ReadLine now treats a \r not followed by a \n as a
+ \n (this is what MS does).
+
+2002-10-18 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: SeekOrigin.End still calculates the offset from
+ the end of the file with positive values extending the length.
+ Fixes bug 32471.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Path.cs: some cleanup. Thanks to Martin Aliger.
+
+2002-10-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileStream.cs: throw an exception if trying to open a directory.
+ Thanks to Martin Aliger.
+
+2002-10-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Path.cs: fixes bug #28046.
+
+2002-09-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs: give more information when wrong parameters passed.
+
+2002-09-21 Miguel de Icaza <miguel@ximian.com>
+
+ * FileStream.cs: Do not call FSync on the file.
+
+2002-09-16 Miguel de Icaza <miguel@ximian.com>
+
+ * TextWriter.cs (Null): The Null field should be an instance of a
+ TextWriter class that does nothing, so it is an instance of the
+ NullTextWriter class.
+
+2002-09-16 Nick Drochak <ndrochak@gol.com>
+
+ * MemoryStream.cs (Close): Don't throw an exception if the stream
+ is already closed.
+
+2002-09-15 Miguel de Icaza <miguel@ximian.com>
+
+ * FileStream.cs (Dispose): Call FlushBuffer(), and not Flush, as
+ Flush calls fsync().
+
+ The API docs show no explicit mention that Flush() should even do
+ an fsync, I am thinking that we should drop that from the
+ runtime.
+
+2002-09-09 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamWriter.cs: When no encoding is provided, create an
+ encoding without markers, this is what MS does.
+
+2002-09-06 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamReader.cs: Implement detection of byte marks and skipping
+ of byte marks at the beginning of the stream.
+
+ (ReadToEnd): Use buffered read instead of char-by-char
+ processing.
+
+ Correct the default arguments for creating the StreamReader.
+
+2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckArgument.cs: fixed check for empty string.
+ * Path.cs: various fixes. It passes all the tests in new PathTest.
+
+2002-08-29 Duncan Mak <duncan@ximian.com>
+
+ * StreamWriter.cs: Set DisposedAlready after calling flush. Fixes
+ the build for gtk#.
+
+2002-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BinaryReader.cs:
+ * BinaryWriter.cs:
+ * MemoryStream.cs:
+ * StreamReader.cs:
+ * StreamWriter.cs:
+ * StringReader.cs:
+ * StringWriter.cs:
+ * TextWriter.cs: IDisposable fixes.
+
+2002-08-24 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamReader.cs: Removed TODOs, as the code seems to be
+ complete.
+
+ * Path.cs (GetTempFileName): Make this routine atomic by not
+ testing and then creating, but using the create call to ensure
+ that we own the filename.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileLoadException.cs: implemented ToString.
+
+ * StreamWriter.cs: added Null field and implemented Write (char) and
+ Write (char []).
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs: implemented NullStreamReader.
+
+2002-08-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Path.cs (GetDirectoryName): Fix for filenames with size = 1
+
+ * File.cs: Removed all references that threw exceptions when the
+ paths contains a colon, as this is a valid part of an identifier
+ on Unix.
+
+ Everywhere: The String.Empty return from GetDirectoryName means
+ that there is no directory information about the path.
+
+2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileNotFoundException.cs: use Message and InnerException from base
+ class. Changed Message and ToString ().
+
+2002-08-19 Dick Porter <dick@ximian.com>
+
+ * BinaryWriter.cs: The length of a string is counted in bytes, not
+ chars
+
+2002-08-18 Dick Porter <dick@ximian.com>
+
+ * BinaryReader.cs: Fixed buffering
+
+2002-08-09 Nick Drochak <ndrochak@gol.com>
+
+ * BinaryReader.cs: added virtual to Dispose(bool).
+
+2002-08-03 Jason Diamond <jason@injektilo.org>
+
+ * StringWriter.cs: Return UnicodeEncoding for Encoding property.
+
+2002-08-03 Jason Diamond <jason@injektilo.org>
+
+ * StreamWriter.cs: Use GetByteCount() to get exact length instead
+ of GetMaxByteCount when converting chars to bytes.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * StreamReader.cs:
+ (Dispose): Added and implmented.
+
+ * StreamWriter.cs:
+ (Dispose): Fixed visibility.
+ (Initialize): Fixed visibility, made internal.
+
+ * BinaryReader.cs:
+ (Dispose): Fixed visibility.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * File.cs:
+ (Create): allow file names without path.
+
+Fri Jul 26 15:45:04 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * FileStream.cs: patch from erik@bagfors.nu to add
+ Name property support.
+
+2002-07-20 Dick Porter <dick@ximian.com>
+
+ * MonoIO.cs: Added icall to CreatePipe
+
+2002-07-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileInfo.cs: fixes buglet #27940
+
+2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Path.cs: removed unneeded line from GetExtension.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileStream.cs:
+ (.ctor): call MonoIO.GetException with the file name.
+
+2002-07-02 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs: Guard against ^\n lines as pointed out by Gonzalo.
+
+2002-07-02 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs: Revert the last Peek change and fix the ReadLine
+ end of line detection code instead.
+
+2002-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs:
+ (Peek): no need to have seek capabilitites.
+
+2002-06-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * Path.cs (ChangeExtension): handle some special cases (fixes bug #25319)
+
+ * File.cs (Delete): only call Directory.Exists() if DirName != ""
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Directory.cs: fixed bug #26133 and also test if the directory exist
+ before performing the search.
+
+2002-06-12 Nick Drochak <ndrochak@gol.com>
+
+ * StringReader.cs (ReadLine): Return null when we get to end of the
+ string.
+
+2002-05-22 Lawrence Pit <loz@cable.a2000.nl>
+
+ * StreamWriter.cs: added ability to write null value
+
+2002-05-19 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Stream.cs: NullStream.ReadByte now returns -1 instead of 0 to
+ prevent endless loops.
+
+2002-05-17 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * FileStream.cs: Enforce lower bound on buffer size.
+
+2002-05-16 Piers Haken <piersh@friskit.com>
+
+ * Stream.cs: Implement synchronous {Begin|End}{Read|Write}() methods.
+
+2002-05-17 Nick Drochak <ndrochak@gol.com>
+
+ * StreamWriter.cs: Implement buffering. Also implemented dispose
+ pattern as recommended by the MS docs. Must call Close() now
+ to ensure the buffer is flushed.
+
+2002-05-15 Nick Drochak <ndrochak@gol.com>
+
+ * Path.cs (GetDirectoryName): Return String.Empty if there is no
+ directory
+
+ * StreamReader.cs: Add some parameter checking on file names.
+
+ * StreamWriter.cs: Add some parameter checking on file names.
+
+2002-05-14 Nick Drochak <ndrochak@gol.com>
+
+ * File.cs: Add parameter checks to most methods. Not completely done,
+ but all current unit tests pass.
+
+ * Path.cs: Implement GetTempFileName().
+
+2002-05-10 Nick Drochak <ndrochak@gol.com>
+
+ * StreamWriter.cs (Flush): Throw proper exception if internal stream
+ has already been closed when we try to flush.
+
+2002/05/10 Nick Drochak <ndrochak@gol.com>
+
+ * FileNotFoundException.cs (ToString): Don't try to use the inner
+ exception, because it might be null. Use the message instead.
+
+2002-05-09 Nick Drochak <ndrochak@gol.com>
+
+ * File.cs (Delete): Do not throw an exception if the file does not
+ exist.
+
+2002-05-08 Mike Gray <mikeg@mikegray.org>
+
+ * File.cs: According to ECMA spec and MS docs Copy(src, dest)
+ should not overwrite dest by default.
+
+2002-05-08 Nick Drochak <ndrochak@gol.com>
+
+ * StreamWriter.cs: Add paramter check to constructors and throw
+ exceptions where appropriate.
+
+Tue May 7 11:47:46 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StreamReader.cs: return the number of chars read even if we diddn't
+ fill the whole buffer (makes Sergey's ilasm work with mono).
+
+2002-05-07 Mike Gray <mikeg_us@hotmail.com>
+
+ * FileInfo.cs (Create): Implement missing method.
+
+2002-05-07 Mike Gray <mikeg_us@hotmail.com>
+
+ * File.cs: Implemented CreateText method, and fixed dst compares
+ to compare against "" instead of null twice.
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * StreamReader.cs: Throw exceptions where needed. Changed Null field to
+ use new internal class since null cannot be passed to constructor
+ anymore. Also, fix a coule of small bugs.
+
+2002-05-03 Nick Drochak <ndrochak@gol.com>
+
+ * MemoryStream.cs: Refrain from allocating array until the space is
+ really needed. This fixes a bug in the Length property when the
+ constructor without the byte array is used.
+
+2002-05-01 Duncan Mak <duncan@ximian.com>
+
+ * DirectoryNotFoundException.cs (constructor): Added missing
+ serialization constructor.
+
+2002-04-30 Duncan Mak <duncan@ximian.com>
+
+ * FileLoadException.cs (constructors): Added missing (string,
+ string) ctor, as well as (string, string, Exception) ctor.
+
+ (Message): Added more info to the error message
+
+ (ToString): Added. We'll need to add the StackTrace stuff when
+ that works.
+
+ * FileShare.cs: Add a missing field, Inheritable.
+
+ * TextReader.cs: Renamed Synchronised method to Synchronized.
+
+ * TextWriter.cs: Renamed Synchronised method to Synchronized.
+ Renamed protected member coreNewLine to CoreNewLine.
+
+2002-04-30 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * BinaryReader.cs: Allocate buffer before its first use.
+ Handle end of stream properly. Methods to read native types
+ (ReadInt* etc.) are little-endian (see Compact Framework docs).
+
+ * BinaryWriter.cs: Store data in little-endian format.
+ Use internal buffer for conversions.
+
+2002-03-31 Dick Porter <dick@ximian.com>
+
+ * Directory.cs: Strip out "." and ".." from returned list
+
+ * FileAttributes.cs: Get the right enum values
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * TextWriter.cs (write): added check for null
+
+2002-03-28 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Directory.cs: Throws DirectoryNotFoundException.
+ * MonoIO.cs: Fixed to work around enum problem.
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * StreamReader.cs: Implemented ReadLine() and ReadEnd().
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Directory.cs, File.cs, FileSystemInfo.cs, FileInfo.cs,
+ DirectoryInfo.cs, Path.cs: Modified to use MonoIO class instead of
+ wrapper and PAL classes.
+
+ * MonoIO.cs, MonoIOStat.cs, MonoIOError.cs: Added.
+
+2002-03-25 Mike Kestner <mkestner@speakeasy.net>
+
+ * MemoryStream.cs (Read): Fixed bug in exception throw.
+
+2002-03-24 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs (ReadBuffer): Fix buffer merging bugs.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * StreamReader.cs: Always do buffered reading, use 4k blocks.
+ (Read (char[], int, int)): Implemented.
+ (DiscardBufferedData): Implemented.
+
+2002-03-21 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs : Fill out, add buffering, and use encoding.
+
+2002-03-19 Martin Baulig <martin@gnome.org>
+
+ * StreamWriter.cs (StreamWriter (string)): The default is to override
+ the file, not to append to it.
+ (StreamWriter (string path, bool append)): When appending, seek to the
+ end of the file, otherwise truncate the file to zero length.
+ (Dispose (bool)): Close the internalStream.
+ (Flush): Flush the interalStream.
+ (Write (char[], int, int)): Flush the internalStream in auto-flush-mode.
+
+2002-03-19 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * FileStream.cs: Flush buffer before FileSetLength.
+
+2002-02-28 Miguel de Icaza <miguel@ximian.com>
+
+ * Stream.cs (NullStream): Do not track position, this beast does
+ nothing in practice.
+
+2002-03-15 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * SearchPattern.cs: New class. Glob matching code for Directory.
+ * Directory.cs: Changed to use SearchPattern instead of mono_glob_*()
+
+2002/03/15 Nick Drochak <ndrochak@gol.com>
+
+ * DirectoryInfo.cs: Fixed the overloaded GetDirectories and GetFiles.
+ This code seemed to be copied from somewhere, and it was close,
+ but didn't match the docs. This was the last bit needed to get
+ NAnt to compile with our class libs.
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * EndOfStreamException.cs:
+ * FileLoadException.cs:
+ * FileNotFoundException.cs:
+ * PathTooLongException.cs: Changed the base classes to IOException
+ instead of SystemException.
+
+ * IOException.cs: Added missing constructors.
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * FileMode.cs: Docs don't say this should be explicitly derived from
+ int, so just make it a normal Enum.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * StringReader.cs: Fixed off-by-one error in Peek() and Read().
+
+2002-02-12 Nick Drochak <ndrochak@gol.com>
+
+ * PathTooLongException.cs: put it in the correct namespace
+ * EndOfStreamException.cs: put it in the correct namespace
+
+Thu Jan 31 17:32:32 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Directory.cs: handle opendir() return NULL and absolute filenames.
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * FileLoadException.cs:
+ * FileNotFoundException: Added missing bits for serialization.
+
+Thu Jan 24 17:42:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Directory.cs: allow directories in GetFiles() mask.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * FileInfo.c (CopyTo, MoveTo): Implement.
+
+ * FileStream.cs: Add argument checking to the constructor.
+
+ * File.cs: Rewrote most of the file. Implement Copy, Open, Create,
+ OpenText, OpenWrite, Move. Made pending methods flagged as MonoTODO.
+
+ * Directory.cs (Delete): reimplement without using DirectoryInfo.
+ (Delete): Implement the recursive version.
+ (GetCreationTime, GetLastWriteTime, GetLastAccessTime): Implement.
+ (Move): Reimplement.
+ (getNames): dead code removal.
+
+ * Path.cs: define an internal DirectorySeparatorStr that we use in
+ a few spots.
+
+ * Wrapper.cs: Updated to new version.
+
+ * DirectoryInfo (Delete): Implement using the Directory API.
+
+ * DirectoryInfo.cs (GetFiles, GetDirectories, GetFileSystemInfos,
+ Delete, Create, Parent, Exists, MoveTo): Implement.
+
+ * Directory.cs (GetListing): implement new utility function.
+ (GetDirectories): Implement.
+ (GetFileSystemEntries): Implement.
+ (GetFiles): Implement.
+
+ * CheckArgument.cs (Path): Do not allow null by default.
+
+Tue Jan 22 22:53:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * DirectoryInfo.cs, FileInfo.cs: do not use Debug from the system
+ assembly in corlib.
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * SeekOrigin.cs: Added Serializable attribute.
+
+2002-01-19 Duncan Mak <duncan@ximian.com>
+
+ * PathTooLongException.cs:
+ * EndOfStreamException.cs: Added to CVS.
+
+Thu Jan 10 12:06:46 MST 2002 Matt Kimball <matt@kimball.net>
+
+ * BufferedStream.cs: Initial implemenation. The synchronous
+ methods for both reading and writing are implemented. I'll do the
+ asynchronous methods in a bit.
+
+Wed Jan 9 16:04:39 MST 2002 Matt Kimball <matt@kimball.net>
+
+ * BinaryWriter.cs: Initial implementation. And it's all there.
+
+ * BinaryReader.cs: The constructor now uses the passed in encoding,
+ not UTF8 always.
+
+Wed Jan 9 13:54:28 MST 2002 Matt Kimball <matt@kimbal.net>
+
+ * BinaryReader.cs: Initial implementation. I think it's complete.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * CheckArgument.cs, CheckPermission.cs, Directory.cs: MonoTODO
+ attribute decorations.
+
+ * DirectoryInfo.cs, File.cs, FileInfo.cs, FileSystemInfo.cs,
+ Path.cs, TextReader.cs, TextWriter.cs : Ditto.
+
+ * FileLoadException.cs, FileNotFoundException.cs, StreamReader.cs:
+ Ditto.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: Use handles rather than casting file descriptors.
+ Added Handle property.
+
+Wed Nov 14 16:47:47 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * CheckPermission.cs: disable ModeAccess() code: it's wrong.
+ * FileStream.cs: only trow an exception if the read failed in ReadByte().
+ * StreamReader.cs: implement Peek and Read.
+ * TextWriter.cs: CLSCompliant updates.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * FileNotFoundException.cs: Added some constructors
+
+ * Path.cs (GetFullPath): Fixed implementation
+
+Fri Nov 2 18:27:58 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * DirectoryNotFoundException.cs: implemented.
+
+Tue Sep 25 18:54:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * File.cs: fix signatures of the Open() and OpenRead() functions
+ (they are static).
+
+Thu Sep 13 18:04:23 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FileLoadException.cs, FileNotFoundException.cs: added.
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * TextReader.cs: implemented the Read method
+
+ * StreamReader.cs: impl. stubs
+
+ * StreamWriter.cs: impl.
+
+ * TextWriter.cs: implemented Write and WriteLine methods
+
+Sun Aug 26 23:01:41 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FileAccess.cs, FileMode.cs: change values to be compatible with
+ the ms ones.
+
+Sun Aug 26 11:47:56 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * IOException.cs: Implemented System.IO.Exception.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ *SeekOrigin.cs.cs, FileShare.cs, FileMode.cs, FileAccess.cs: Add.
+
+2001-07-19 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * System.IO.MemoryStream.cs: Added. Had quite a few cases of
+ "LAMESPEC", but the tests work against the MS implementation so
+ the major functions are right (ie. Read/Write/Seek). Some more
+ tests required for the various constructors and exceptions.
+
+2001-07-16 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * StringReader.cs, StringWriter.cs, TextReader.cs, TextWriter.cs:
+ New class implemenations.
+
+ * StringReaderTest.cs, StringWriterTest.cs: Test suite for the above.
+
diff --git a/mcs/class/corlib/System.IO/CheckArgument.cs b/mcs/class/corlib/System.IO/CheckArgument.cs
new file mode 100644
index 00000000000..0e879cf3cc8
--- /dev/null
+++ b/mcs/class/corlib/System.IO/CheckArgument.cs
@@ -0,0 +1,166 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.CheckArgument.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Saturday, August 25, 2001
+//
+// NOTE: All contributors can freely add to this class or make modifications
+// that do not break existing usage of methods
+//------------------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+
+namespace System.IO
+{
+ /// <summary>
+ /// A utility class to assist with various argument validations in System.IO
+ /// </summary>
+ internal sealed class CheckArgument
+ {
+ /// <summary>
+ /// Generates and exception if arg contains whitepace only
+ /// </summary>
+ public static void WhitespaceOnly (string arg, string desc)
+ {
+ if (arg != null && arg.Length > 0)
+ {
+ string temp = arg.Trim ();
+ if (temp.Length == 0)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg contains whitepace only
+ /// </summary>
+ public static void WhitespaceOnly (string arg)
+ {
+ WhitespaceOnly (arg, "Argument string consists of whitespace characters only.");
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is empty
+ /// </summary>
+ public static void Empty (string arg, string desc)
+ {
+ if (arg != null && arg.Length == 0)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is empty
+ /// </summary>
+ public static void Empty (string arg)
+ {
+ Empty (arg, "Argument string is empty.");
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is null
+ /// </summary>
+ public static void Null (Object arg, string desc)
+ {
+ if (arg == null)
+ {
+ throw new ArgumentNullException (desc);
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is null
+ /// </summary>
+ public static void Null (Object arg)
+ {
+ if (arg == null)
+ {
+ throw new ArgumentNullException ();
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path contains invalid path characters
+ /// </summary>
+ public static void PathChars (string path, string desc)
+ {
+ if (path != null)
+ {
+ if (path.IndexOfAny (System.IO.Path.InvalidPathChars) > -1)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path contains invalid path characters
+ /// </summary>
+ public static void PathChars (string path)
+ {
+ PathChars (path, "Path contains invalid characters");
+ }
+
+ /// <summary>
+ /// Generates and exception if path too long
+ /// </summary>
+ [MonoTODO]
+ public static void PathLength (string path, string desc)
+ {
+ //TODO: find out how long is too long
+ }
+
+ /// <summary>
+ /// Generates and exception if path too long
+ /// </summary>
+ public static void PathLength (string path)
+ {
+ PathLength (path);
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path, bool bAllowNull, bool bLength)
+ {
+ if (path != null) //allow null
+ {
+ Empty (path, "Path cannot be the empty string"); // path can't be empty
+ WhitespaceOnly (path, "Path cannot be all whitespace"); // path can't be all whitespace
+ PathChars (path); // path can't contain invalid characters
+ if (bLength)
+ {
+ PathLength ("Path too long");
+ }
+ }
+ else if (!bAllowNull)
+ {
+ throw new ArgumentNullException ("Parameter name: path");
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path, bool bAllowNull)
+ {
+ Path (path, bAllowNull, false);
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path)
+ {
+ Path (path, false, false);
+ }
+
+ }
+} // namespace System.IO.Private
diff --git a/mcs/class/corlib/System.IO/CheckPermission.cs b/mcs/class/corlib/System.IO/CheckPermission.cs
new file mode 100644
index 00000000000..3418850c065
--- /dev/null
+++ b/mcs/class/corlib/System.IO/CheckPermission.cs
@@ -0,0 +1,87 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.CheckPermission.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Saturday, August 25, 2001
+//
+// NOTE: All contributors can freely add to this class or make modifications
+// that do not break existing usage of methods
+//------------------------------------------------------------------------------
+
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.IO
+{
+ /// <summary>
+ /// A utility class to assist with various permission validation in System.IO
+ /// </summary>
+ internal sealed class CheckPermission
+ {
+ /// <summary>
+ /// Generates and exception if caller doesn't have flags access to filesystem item specified by path
+ /// </summary>
+ [MonoTODO]
+ public static void Demand(FileIOPermissionAccess flags, string path)
+ {
+ FileIOPermission ioPerm = new FileIOPermission(flags, path);
+ // FIXME: FileIOPermission is not yet implemented
+ //ioPerm.Demand();
+ }
+
+ public static void Access(FileAccess access, string path)
+ {
+ switch(access)
+ {
+ case FileAccess.Read:
+ Demand(FileIOPermissionAccess.Read, path);
+ break;
+ case FileAccess.Write:
+ Demand(FileIOPermissionAccess.Write, path);
+ break;
+ case FileAccess.ReadWrite:
+ Demand(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, path);
+ break;
+ default:
+ // TODO: determine what best to do here
+ throw new ArgumentException("Invalid FileAccess parameter");
+ }
+ }
+
+ [MonoTODO]
+ public static void ModeAccess(FileMode mode, FileAccess access, string path, bool exists)
+ {
+#if false
+ // TODO: this logic isn't entirely complete and accurate, yet
+ if((mode & (FileMode.CreateNew | FileMode.Create)) != 0)
+ {
+ CheckPermission.Demand(FileIOPermissionAccess.Write, Path.GetDirectoryName(path));
+ }
+ else if((mode & FileMode.OpenOrCreate) != 0)
+ {
+ if(!exists)
+ {
+ CheckPermission.Demand(FileIOPermissionAccess.Write, Path.GetDirectoryName(path));
+ }
+ else
+ {
+ CheckPermission.Access(access, path);
+ }
+ }
+ else if(exists)
+ {
+ CheckPermission.Access(access, path);
+ }
+ else
+ {
+ throw new FileNotFoundException();
+ }
+#endif
+ }
+ }
+} // namespace System.IO.Private
diff --git a/mcs/class/corlib/System.IO/Directory.cs b/mcs/class/corlib/System.IO/Directory.cs
new file mode 100644
index 00000000000..d55ec3e9e87
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Directory.cs
@@ -0,0 +1,416 @@
+//
+// System.IO.Directory.cs
+//
+// Authors:
+// Jim Richardson (develop@wtfo-guru.com)
+// Miguel de Icaza (miguel@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Eduardo Garcia (kiwnix@yahoo.es)
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+// Copyright (C) 2002 Ximian, Inc.
+//
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security.Permissions;
+using System.Collections;
+using System.Text;
+
+namespace System.IO
+{
+ public sealed class Directory : Object
+ {
+ private Directory () {}
+
+ public static DirectoryInfo CreateDirectory (string path)
+ {
+ DirectoryInfo tmpinfo = null;
+
+ if (path == null) {
+ throw new ArgumentNullException ("path");
+ }
+
+ if (path == "") {
+ throw new ArgumentException ("Path is empty");
+ }
+
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1) {
+ throw new ArgumentException ("Path contains invalid chars");
+ }
+
+ if (path.Trim().Length == 0){
+ throw new ArgumentException ("Only blank characters in path");
+ }
+
+ if (path == ":")
+ throw new NotSupportedException ("Only ':' In path");
+
+ string[] pathcomponents = path.Split(new char[] { Path.DirectorySeparatorChar });
+
+
+ if (pathcomponents.Length == 1){
+ tmpinfo = Directory.RealCreateDirectory(path);
+ return tmpinfo;
+ }
+ else {
+ if ((path[0]== Path.DirectorySeparatorChar) ||
+ ((path[1] == ':') && (path[2] == Path.DirectorySeparatorChar))) //Absolute Path
+ {
+ //Should Work in Unix, Win* native Directoryes and Samba Shares
+ //FIXME: This is not thread safe
+
+
+ string actual_path = Directory.GetCurrentDirectory();
+
+ if (Environment.OSVersion.Platform == PlatformID.Unix) //Is Unix
+ {
+ StringBuilder pathsumm = new StringBuilder(path);
+ Directory.SetCurrentDirectory ("/");
+ pathsumm.Remove (0,1);
+ tmpinfo = Directory.CreateDirectory(pathsumm.ToString());
+ }
+ else //We asume is Win*
+ {
+ if ((path[1] == ':') || (path[0] == Path.DirectorySeparatorChar)) //Is a regular path
+ {
+ StringBuilder pathsumm = new StringBuilder(path);
+ Directory.SetCurrentDirectory(path.Substring(0,2));
+ pathsumm.Remove(0,2);
+ tmpinfo = Directory.CreateDirectory(pathsumm.ToString());
+ }
+ else if((path[0] == '\\') && (path[1] == '\\')) //Is a Samba Share
+ {
+ if (Directory.Exists(pathcomponents[0] + "\\"
+ + pathcomponents[1] + "\\"
+ + pathcomponents[2]))
+ {
+ StringBuilder pathsumm = new StringBuilder();
+ Directory.SetCurrentDirectory(pathcomponents[0] +
+ "\\" + pathcomponents[1] +
+ "\\" + pathcomponents[2] +
+ "\\" + pathcomponents[3]);
+ pathcomponents[0] = ""; pathcomponents[1] = ""; pathcomponents[2] = "";
+ pathcomponents[3] = "";
+ foreach(string dir in pathcomponents)
+ {
+ if (dir != "")
+ pathsumm.Append(dir + "\\");
+ }
+ Directory.CreateDirectory(pathsumm.ToString());
+ }
+ else
+ {
+ throw new DirectoryNotFoundException("The samba share do not Exists");
+ }
+ }
+
+ }
+ Directory.SetCurrentDirectory(actual_path);
+ }
+ else //Relative Path
+ {
+ StringBuilder pathsumm = new StringBuilder();
+
+ foreach(string dir in pathcomponents)
+ {
+ if (dir.Length != 0) {
+ if (pathsumm.Length == 0) {
+ pathsumm.Append (dir);
+ }
+ else {
+ pathsumm.Append (Path.DirectorySeparatorChar + dir);
+ }
+
+ if (!Directory.Exists (pathsumm.ToString())) {
+ tmpinfo = Directory.RealCreateDirectory (pathsumm.ToString());
+ }
+ }
+ }
+ }
+ }
+ return tmpinfo;
+ }
+
+ private static DirectoryInfo RealCreateDirectory (string path)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.CreateDirectory (path, out error)) {
+ throw MonoIO.GetException (error);
+ }
+
+ return new DirectoryInfo (path);
+ }
+
+ public static void Delete (string path)
+ {
+ if (path == null) {
+ throw new ArgumentNullException ("path");
+ }
+
+ if (path == "") {
+ throw new ArgumentException ("Path is empty");
+ }
+
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1) {
+ throw new ArgumentException ("Path contains invalid chars");
+ }
+ if (path.Trim().Length == 0)
+ throw new ArgumentException ("Only blank characters in path");
+ if (path == ":")
+ throw new NotSupportedException ("Only ':' In path");
+
+
+
+ MonoIOError error;
+
+ if (!MonoIO.RemoveDirectory (path, out error)) {
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ static void RecursiveDelete (string path)
+ {
+ foreach (string dir in GetDirectories (path))
+ RecursiveDelete (dir);
+
+ foreach (string file in GetFiles (path))
+ File.Delete (file);
+
+ Directory.Delete (path);
+ }
+
+ public static void Delete (string path, bool recurse)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path == "")
+ throw new System.ArgumentException("Path is Empty");
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid characters");
+ if (path.Trim().Length == 0)
+ throw new ArgumentException ("Only blank characters in path");
+ if (path == ":")
+ throw new NotSupportedException ("Only ':' In path");
+
+
+ if (recurse == false){
+ Delete (path);
+ return;
+ }
+
+ RecursiveDelete (path);
+ }
+
+ public static bool Exists (string path)
+ {
+ if (path == null)
+ return false;
+
+ MonoIOError error;
+
+ return MonoIO.ExistsDirectory (path, out error);
+ }
+
+ public static DateTime GetLastAccessTime (string path)
+ {
+ return File.GetLastAccessTime (path);
+ }
+
+ public static DateTime GetLastWriteTime (string path)
+ {
+ return File.GetLastWriteTime (path);
+ }
+
+ public static DateTime GetCreationTime (string path)
+ {
+ if (path == null)
+ throw new System.ArgumentNullException("Path is Null");
+ if (path == "")
+ throw new System.ArgumentException("Path is Empty");
+ if (path.Trim().Length == 0)
+ throw new ArgumentException ("Only blank characters in path");
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid chars");
+ if (path == ":")
+ throw new NotSupportedException ("Only ':' In path");
+
+
+
+ return File.GetLastWriteTime (path);
+ }
+
+ public static string GetCurrentDirectory ()
+ {
+ /*
+ // Implementation complete 08/25/2001 14:24 except for
+ // LAMESPEC: documentation specifies invalid exceptions (i think)
+ // also shouldn't need Write to getcurrrent should we?
+ string str = Environment.CurrentDirectory;
+ CheckPermission.Demand (FileIOPermissionAccess.Read & FileIOPermissionAccess.Write, str);
+ */
+ return Environment.CurrentDirectory;
+ }
+
+ public static string [] GetDirectories (string path)
+ {
+ return GetDirectories (path, "*");
+ }
+
+ public static string [] GetDirectories (string path, string pattern)
+ {
+ return GetFileSystemEntries (path, pattern, FileAttributes.Directory, FileAttributes.Directory);
+ }
+
+ public static string GetDirectoryRoot (string path)
+ {
+ return new String(Path.DirectorySeparatorChar,1);
+ }
+
+ public static string [] GetFiles (string path)
+ {
+ return GetFiles (path, "*");
+ }
+
+ public static string [] GetFiles (string path, string pattern)
+ {
+ return GetFileSystemEntries (path, pattern, FileAttributes.Directory, 0);
+ }
+
+ public static string [] GetFileSystemEntries (string path)
+ {
+ return GetFileSystemEntries (path, "*");
+ }
+
+ public static string [] GetFileSystemEntries (string path, string pattern)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid characters");
+ if (path == "")
+ throw new ArgumentException ("The Path do not have a valid format");
+
+ return GetFileSystemEntries (path, pattern, 0, 0);
+ }
+
+ public static string[] GetLogicalDrives ()
+ {
+ //FIXME: Hardcoded Paths
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ return new string[] { "/" };
+ else
+ return new string [] { "A:\\", "C:\\" };
+ }
+
+ public static DirectoryInfo GetParent (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid characters");
+ if (path == "")
+ throw new ArgumentException ("The Path do not have a valid format");
+
+ return new DirectoryInfo (Path.GetDirectoryName (path + Path.DirectorySeparatorChar + ".."));
+ }
+
+ public static void Move (string src, string dest)
+ {
+ File.Move (src, dest);
+ }
+
+ public static void SetCreationTime (string path, DateTime creation_time)
+ {
+ File.SetCreationTime (path, creation_time);
+ }
+
+ public static void SetCurrentDirectory (string path)
+ {
+ /*
+ // Implementation complete 08/25/2001 14:24 except for
+ // LAMESPEC: documentation specifies invalid exceptions IOException (i think)
+ CheckArgument.Path (path, true);
+ CheckPermission.Demand (FileIOPermissionAccess.Read & FileIOPermissionAccess.Write, path);
+ */
+ if (!Exists (path))
+ {
+ throw new DirectoryNotFoundException ("Directory \"" + path + "\" not found.");
+ }
+ Environment.CurrentDirectory = path;
+ }
+
+ public static void SetLastAccessTime (string path, DateTime last_access_time)
+ {
+ File.SetLastAccessTime (path, last_access_time);
+ }
+
+ public static void SetLastWriteTime (string path, DateTime last_write_time)
+ {
+ File.SetLastWriteTime (path, last_write_time);
+ }
+
+ // private
+
+ private static string [] GetFileSystemEntries (string path, string pattern, FileAttributes mask, FileAttributes attrs)
+ {
+ SearchPattern search;
+ MonoIOStat stat;
+ IntPtr find;
+
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1) {
+ throw new ArgumentException ("Path contains invalid characters.");
+ }
+
+ if (!Directory.Exists (path)) {
+ throw new DirectoryNotFoundException ("Directory '" + path + "' not found.");
+ }
+
+ search = new SearchPattern (pattern);
+
+ MonoIOError error;
+
+ find = MonoIO.FindFirstFile (Path.Combine (path , "*"), out stat, out error);
+ if (find == MonoIO.InvalidHandle) {
+ switch (error) {
+ case MonoIOError.ERROR_FILE_NOT_FOUND:
+ case MonoIOError.ERROR_PATH_NOT_FOUND:
+ string message = String.Format ("Could not find a part of the path \"{0}\"", path);
+ throw new DirectoryNotFoundException (message);
+ case MonoIOError.ERROR_NO_MORE_FILES:
+ return new string [0];
+
+ default:
+ throw MonoIO.GetException (path,
+ error);
+ }
+ }
+
+ ArrayList entries = new ArrayList ();
+
+ while (true) {
+ // Ignore entries of "." and ".." -
+ // the documentation doesn't mention
+ // it (surprise!) but empirical
+ // testing indicates .net never
+ // returns "." or ".." in a
+ // GetDirectories() list.
+ if ((stat.Attributes & mask) == attrs &&
+ search.IsMatch (stat.Name) &&
+ stat.Name != "." &&
+ stat.Name != "..")
+ entries.Add (Path.Combine (path, stat.Name));
+
+ if (!MonoIO.FindNextFile (find, out stat,
+ out error))
+ break;
+ }
+ MonoIO.FindClose (find, out error);
+
+ return (string []) entries.ToArray (typeof (string));
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/DirectoryInfo.cs b/mcs/class/corlib/System.IO/DirectoryInfo.cs
new file mode 100644
index 00000000000..21d0329b5a9
--- /dev/null
+++ b/mcs/class/corlib/System.IO/DirectoryInfo.cs
@@ -0,0 +1,135 @@
+//
+// System.IO.DirectoryInfo.cs
+//
+// Author:
+// Miguel de Icaza, miguel@ximian.com
+// Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis, dihlewis@yahoo.co.uk
+//
+// Copyright (C) 2002 Ximian, Inc.
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+
+using System;
+using System.Collections;
+
+namespace System.IO {
+
+ [Serializable]
+ public sealed class DirectoryInfo : FileSystemInfo {
+
+ public DirectoryInfo (string path) {
+ CheckPath (path);
+
+ OriginalPath = path;
+ FullPath = Path.GetFullPath (path);
+ }
+
+ // properties
+
+ public override bool Exists {
+ get {
+ Refresh (false);
+
+ if (stat.Attributes == MonoIO.InvalidFileAttributes)
+ return false;
+
+ if ((stat.Attributes & FileAttributes.Directory) == 0)
+ return false;
+
+ return true;
+ }
+ }
+
+ public override string Name {
+ get {
+ return Path.GetFileName (FullPath);
+ }
+ }
+
+ public DirectoryInfo Parent {
+ get {
+ return new DirectoryInfo (Path.GetDirectoryName (FullPath));
+ }
+ }
+
+ public DirectoryInfo Root {
+ get {
+ return new DirectoryInfo (Path.GetPathRoot (FullPath));
+ }
+ }
+
+ // creational methods
+
+ public void Create () {
+ Directory.CreateDirectory (FullPath);
+ }
+
+ public DirectoryInfo CreateSubdirectory (string name) {
+ string path = Path.Combine (FullPath, Path.GetFileName (name));
+ Directory.CreateDirectory (path);
+
+ return new DirectoryInfo (path);
+ }
+
+ // directory listing methods
+
+ public FileInfo [] GetFiles () {
+ return GetFiles ("*");
+ }
+
+ public FileInfo [] GetFiles (string pattern) {
+ string [] names = Directory.GetFiles (FullPath, pattern);
+
+ ArrayList infos = new ArrayList ();
+ foreach (string name in names)
+ infos.Add (new FileInfo (name));
+
+ return (FileInfo []) infos.ToArray (typeof (FileInfo));
+ }
+
+ public DirectoryInfo [] GetDirectories () {
+ return GetDirectories ("*");
+ }
+
+ public DirectoryInfo [] GetDirectories (string pattern) {
+ string [] names = Directory.GetDirectories (FullPath, pattern);
+
+ ArrayList infos = new ArrayList ();
+ foreach (string name in names)
+ infos.Add (new DirectoryInfo (name));
+
+ return (DirectoryInfo []) infos.ToArray (typeof (DirectoryInfo));
+ }
+
+ public FileSystemInfo [] GetFileSystemInfos () {
+ return GetFileSystemInfos ("*");
+ }
+
+ public FileSystemInfo [] GetFileSystemInfos (string pattern) {
+ ArrayList infos = new ArrayList ();
+ infos.AddRange (GetDirectories (pattern));
+ infos.AddRange (GetFiles (pattern));
+
+ return (FileSystemInfo []) infos.ToArray (typeof (FileSystemInfo));
+ }
+
+ // directory management methods
+
+ public override void Delete () {
+ Delete (false);
+ }
+
+ public void Delete (bool recurse) {
+ Directory.Delete (FullPath, recurse);
+ }
+
+ public void MoveTo (string dest) {
+ Directory.Move (FullPath, dest);
+ }
+
+ public override string ToString () {
+ return OriginalPath;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs b/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs
new file mode 100755
index 00000000000..1332758d48f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs
@@ -0,0 +1,38 @@
+//
+// System.IO.DirectoryNotFoundException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.IO {
+
+ [Serializable]
+ public class DirectoryNotFoundException : IOException {
+
+ // Constructors
+ public DirectoryNotFoundException ()
+ : base ("Directory not found")
+ {
+ }
+
+ public DirectoryNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ public DirectoryNotFoundException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected DirectoryNotFoundException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/EndOfStreamException.cs b/mcs/class/corlib/System.IO/EndOfStreamException.cs
new file mode 100644
index 00000000000..88f8460d87a
--- /dev/null
+++ b/mcs/class/corlib/System.IO/EndOfStreamException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.EndOfStreamException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO
+{
+ [Serializable]
+ public class EndOfStreamException : IOException
+ {
+ // Constructors
+ public EndOfStreamException ()
+ : base (Locale.GetText ("Failed to read past end of stream."))
+ {
+ }
+
+ public EndOfStreamException (string message)
+ : base (message)
+ {
+ }
+
+ protected EndOfStreamException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public EndOfStreamException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/File.cs b/mcs/class/corlib/System.IO/File.cs
new file mode 100644
index 00000000000..e9e90e575e4
--- /dev/null
+++ b/mcs/class/corlib/System.IO/File.cs
@@ -0,0 +1,297 @@
+//
+// System.IO.FIle.cs
+//
+//
+// Authors:
+// Miguel de Icaza (miguel@ximian.com)
+// Jim Richardson (develop@wtfo-guru.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// Copyright 2002 Ximian, Inc. http://www.ximian.com
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+
+using System;
+
+namespace System.IO
+{
+ /// <summary>
+ ///
+ /// </summary>
+ public sealed class File
+ {
+ private File () {}
+
+
+
+ public static StreamWriter AppendText (string path)
+ {
+ return new StreamWriter (path, true);
+ }
+
+ [MonoTODO("Security Permision Checks")]
+ public static void Copy (string sourceFilename, string destFilename)
+ {
+ Copy (sourceFilename, destFilename, false);
+ }
+
+ public static void Copy (string src, string dest, bool overwrite)
+ {
+ if (src == null)
+ throw new ArgumentNullException ("src");
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
+ if (src.Trim () == "" || src.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("src");
+ if (dest.Trim () == "" || dest.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("dest");
+ if (!Exists (src))
+ throw new FileNotFoundException (src + " does not exist");
+
+ if ((GetAttributes(src) & FileAttributes.Directory) == FileAttributes.Directory){
+ throw new ArgumentException(src + " is a directory");
+ }
+
+ if (Exists (dest)) {
+ if ((GetAttributes(dest) & FileAttributes.Directory) == FileAttributes.Directory){
+ throw new ArgumentException(dest + " is a directory");
+ }
+ if (!overwrite)
+ throw new IOException (dest + " already exists");
+ }
+
+ string DirName = Path.GetDirectoryName(dest);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Destination directory not found: " + DirName);
+
+ MonoIOError error;
+
+ if (!MonoIO.CopyFile (src, dest, overwrite, out error))
+ throw MonoIO.GetException (error);
+ }
+
+ public static FileStream Create (string path)
+ {
+ return Create (path, 8192);
+ }
+
+ public static FileStream Create (string path, int buffersize)
+ {
+ if (null == path)
+ throw new ArgumentNullException("path");
+ if (String.Empty == path.Trim() || path.IndexOfAny(Path.InvalidPathChars) >= 0)
+ throw new ArgumentException("path");
+
+ string DirName = Path.GetDirectoryName(path);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Destination directory not found: " + DirName);
+ if (Exists(path)){
+ if ((GetAttributes(path) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly){
+ throw new UnauthorizedAccessException(path + " is a read-only");
+ }
+ }
+
+ return new FileStream (path, FileMode.Create, FileAccess.ReadWrite,
+ FileShare.None, buffersize);
+ }
+
+ public static StreamWriter CreateText(string path)
+
+ {
+ return new StreamWriter (path, false);
+
+ }
+
+
+
+ public static void Delete (string path)
+ {
+ if (null == path)
+ throw new ArgumentNullException("path");
+ if (String.Empty == path.Trim() || path.IndexOfAny(Path.InvalidPathChars) >= 0)
+ throw new ArgumentException("path");
+ if (Directory.Exists (path))
+ throw new UnauthorizedAccessException("path is a directory");
+
+ string DirName = Path.GetDirectoryName(path);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Destination directory not found: " + DirName);
+
+ MonoIOError error;
+
+ if (!MonoIO.DeleteFile (path, out error)){
+ Exception e = MonoIO.GetException (error);
+ if (! (e is FileNotFoundException))
+ throw e;
+ }
+ }
+
+ public static bool Exists (string path)
+ {
+ // For security reasons no exceptions are
+ // thrown, only false is returned if there is
+ // any problem with the path or permissions.
+ // Minimizes what information can be
+ // discovered by using this method.
+ if (null == path || String.Empty == path.Trim()
+ || path.IndexOfAny(Path.InvalidPathChars) >= 0) {
+ return false;
+ }
+
+ MonoIOError error;
+
+ return MonoIO.ExistsFile (path, out error);
+ }
+
+ public static FileAttributes GetAttributes (string path)
+ {
+ if (null == path) {
+ throw new ArgumentNullException("path");
+ }
+
+ if (String.Empty == path.Trim()) {
+ throw new ArgumentException("Path is empty");
+ }
+
+ if (path.IndexOfAny(Path.InvalidPathChars) >= 0) {
+ throw new ArgumentException("Path contains invalid chars");
+ }
+
+ MonoIOError error;
+
+ return MonoIO.GetFileAttributes (path, out error);
+ }
+
+ public static DateTime GetCreationTime (string path)
+ {
+ MonoIOStat stat;
+ MonoIOError error;
+
+ MonoIO.GetFileStat (path, out stat, out error);
+ return DateTime.FromFileTime (stat.CreationTime);
+ }
+
+ public static DateTime GetLastAccessTime (string path)
+ {
+ MonoIOStat stat;
+ MonoIOError error;
+
+ MonoIO.GetFileStat (path, out stat, out error);
+ return DateTime.FromFileTime (stat.LastAccessTime);
+ }
+
+ public static DateTime GetLastWriteTime (string path)
+ {
+ MonoIOStat stat;
+ MonoIOError error;
+
+ MonoIO.GetFileStat (path, out stat, out error);
+ return DateTime.FromFileTime (stat.LastWriteTime);
+ }
+
+ public static void Move (string src, string dest)
+ {
+ if (src == null)
+ throw new ArgumentNullException ("src");
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
+ if (src.Trim () == "" || src.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("src");
+ if (dest.Trim () == "" || dest.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("dest");
+ if (!Exists (src))
+ throw new FileNotFoundException (src + " does not exist");
+ if (Exists (dest) && ((GetAttributes(dest) & FileAttributes.Directory) == FileAttributes.Directory))
+ throw new ArgumentException(dest + " is a directory");
+
+ string DirName;
+ DirName = Path.GetDirectoryName(src);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Source directory not found: " + DirName);
+ DirName = Path.GetDirectoryName(dest);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Destination directory not found: " + DirName);
+
+ MonoIOError error;
+
+ if (!MonoIO.MoveFile (src, dest, out error))
+ throw MonoIO.GetException (error);
+ }
+
+ public static FileStream Open (string path, FileMode mode)
+ {
+ return new FileStream (path, mode, FileAccess.ReadWrite, FileShare.None);
+ }
+
+ public static FileStream Open (string path, FileMode mode, FileAccess access)
+ {
+ return new FileStream (path, mode, access, FileShare.None);
+ }
+
+ public static FileStream Open (string path, FileMode mode, FileAccess access,
+ FileShare share)
+ {
+ return new FileStream (path, mode, access, share);
+ }
+
+ public static FileStream OpenRead (string path)
+ {
+ return new FileStream (path, FileMode.Open, FileAccess.Read, FileShare.Read);
+ }
+
+ public static StreamReader OpenText (string path)
+ {
+ return new StreamReader (path);
+ }
+
+ public static FileStream OpenWrite (string path)
+ {
+ return new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
+ }
+
+ public static void SetAttributes (string path,
+ FileAttributes attributes)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileAttributes (path, attributes,
+ out error)) {
+ throw MonoIO.GetException (path, error);
+ }
+ }
+
+ public static void SetCreationTime (string path,
+ DateTime creation_time)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (path, creation_time.Ticks,
+ -1, -1, out error)) {
+ throw MonoIO.GetException (path, error);
+ }
+ }
+
+ public static void SetLastAccessTime (string path,DateTime last_access_time)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (path, -1,
+ last_access_time.Ticks, -1,
+ out error)) {
+ throw MonoIO.GetException (path, error);
+ }
+ }
+
+ public static void SetLastWriteTime (string path,
+ DateTime last_write_time)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (path, -1, -1,
+ last_write_time.Ticks,
+ out error)) {
+ throw MonoIO.GetException (path, error);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileAccess.cs b/mcs/class/corlib/System.IO/FileAccess.cs
new file mode 100644
index 00000000000..c6eefb3aa6f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileAccess.cs
@@ -0,0 +1,34 @@
+// FileAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:20 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum FileAccess : int {
+
+ /// <summary>
+ /// </summary>
+ Read = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Write = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ ReadWrite = Read | Write,
+ } // FileAccess
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileAttributes.cs b/mcs/class/corlib/System.IO/FileAttributes.cs
new file mode 100644
index 00000000000..3f187be6910
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileAttributes.cs
@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileAttributes.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+
+namespace System.IO
+{
+ [Flags]
+ [Serializable]
+ public enum FileAttributes : int
+ {
+ Archive = 0x00020,
+ Compressed = 0x00800,
+ Device = 0x00040, // Reserved for future use (NOT the w32 value).
+ Directory = 0x00010,
+ Encrypted = 0x04000, // NOT the w32 value
+ Hidden = 0x00002,
+ Normal = 0x00080,
+ NotContentIndexed = 0x02000,
+ Offline = 0x01000,
+ ReadOnly = 0x00001,
+ ReparsePoint = 0x00400,
+ SparseFile = 0x00200,
+ System = 0x00004,
+ Temporary = 0x00100
+ }
+
+}
diff --git a/mcs/class/corlib/System.IO/FileInfo.cs b/mcs/class/corlib/System.IO/FileInfo.cs
new file mode 100644
index 00000000000..4cb45ca8a69
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileInfo.cs
@@ -0,0 +1,147 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileInfo.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public sealed class FileInfo : FileSystemInfo {
+
+ public FileInfo (string path) {
+ CheckPath (path);
+
+ OriginalPath = path;
+ FullPath = Path.GetFullPath (path);
+ }
+
+ // public properties
+
+ public override bool Exists {
+ get {
+ Refresh (false);
+
+ if (stat.Attributes == MonoIO.InvalidFileAttributes)
+ return false;
+
+ if ((stat.Attributes & FileAttributes.Directory) != 0)
+ return false;
+
+ return File.Exists (FullPath);
+ }
+ }
+
+ public override string Name {
+ get {
+ return Path.GetFileName (FullPath);
+ }
+ }
+
+ public long Length {
+ get {
+ if (!Exists)
+ throw new FileNotFoundException ("Could not find file \"" + OriginalPath + "\".");
+
+ return stat.Length;
+ }
+ }
+
+ public string DirectoryName {
+ get {
+ return Path.GetDirectoryName (FullPath);
+ }
+ }
+
+ public DirectoryInfo Directory {
+ get {
+ return new DirectoryInfo (DirectoryName);
+ }
+ }
+
+ // streamreader methods
+
+ public StreamReader OpenText () {
+ return new StreamReader (Open (FileMode.Open, FileAccess.Read));
+ }
+
+ public StreamWriter CreateText () {
+ return new StreamWriter (Open (FileMode.Create, FileAccess.Write));
+ }
+
+ public StreamWriter AppendText () {
+ return new StreamWriter (Open (FileMode.Append, FileAccess.Write));
+ }
+
+ // filestream methods
+
+ public FileStream Create ()
+ {
+ return File.Create (FullPath);
+ }
+
+
+ public FileStream OpenRead () {
+ return Open (FileMode.Open, FileAccess.Read);
+ }
+
+ public FileStream OpenWrite () {
+ return Open (FileMode.OpenOrCreate, FileAccess.Write);
+ }
+
+ public FileStream Open (FileMode mode) {
+ return Open (mode, FileAccess.ReadWrite);
+ }
+
+ public FileStream Open (FileMode mode, FileAccess access) {
+ return Open (mode, access, FileShare.None);
+ }
+
+ public FileStream Open (FileMode mode, FileAccess access, FileShare share) {
+ return new FileStream (FullPath, mode, access, share);
+ }
+
+ // file methods
+
+ public override void Delete () {
+ MonoIOError error;
+
+ if (!MonoIO.Exists (FullPath, out error)) {
+ // a weird MS.NET behaviour
+ return;
+ }
+
+ if (!MonoIO.DeleteFile (FullPath, out error)) {
+ throw MonoIO.GetException (OriginalPath,
+ error);
+ }
+ }
+
+ public void MoveTo (string dest) {
+ File.Move (FullPath, dest);
+ }
+
+ public FileInfo CopyTo (string path) {
+ return CopyTo (path, false);
+ }
+
+ public FileInfo CopyTo (string path, bool overwrite) {
+ string dest = Path.GetFullPath (path);
+ File.Copy (FullPath, dest);
+
+ return new FileInfo (dest);
+ }
+
+ public override string ToString () {
+ return OriginalPath;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileLoadException.cs b/mcs/class/corlib/System.IO/FileLoadException.cs
new file mode 100755
index 00000000000..2ee1546b36c
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileLoadException.cs
@@ -0,0 +1,106 @@
+//
+// System.IO.FileLoadException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO {
+ [Serializable]
+ public class FileLoadException : IOException {
+
+ // Fields
+ string msg;
+ Exception inner;
+ string fileName;
+ string fusionLog;
+
+ // Constructors
+ public FileLoadException ()
+ : base (Locale.GetText ("I/O Error"))
+ {
+ msg = Locale.GetText ("I/O Error");
+ }
+
+ public FileLoadException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ public FileLoadException (string message, string fileName)
+ : base (message)
+ {
+ this.msg = message;
+ this.fileName = fileName;
+ }
+
+ public FileLoadException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ this.inner = inner;
+ }
+
+ public FileLoadException (string message, string fileName, Exception inner)
+ : base (message, inner)
+ {
+ this.msg = message;
+ this.fileName = fileName;
+ this.inner = inner;
+ }
+
+ protected FileLoadException (SerializationInfo info, StreamingContext context)
+ {
+ fileName = info.GetString ("FileLoad_FileName");
+ fusionLog = info.GetString ("FileLoad_FusionLog");
+ }
+
+ // Properties
+ public override string Message
+ {
+ get {
+ if (fileName != null)
+ return Locale.GetText (msg + ": " + fileName);
+ else
+ return msg;
+ }
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ }
+
+ public string FusionLog
+ {
+ get { return fusionLog; }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("FileLoad_FileName", fileName);
+ info.AddValue ("FileLoad_FusionLog", fusionLog);
+ }
+
+ public override string ToString ()
+ {
+ string result = GetType ().FullName + ": " + Message;
+ if (this.InnerException != null)
+ result +=" ----> " + InnerException;
+ if (this.StackTrace != null)
+ result += '\n' + StackTrace;
+
+ return result;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileMode.cs b/mcs/class/corlib/System.IO/FileMode.cs
new file mode 100644
index 00000000000..c32a53408bf
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileMode.cs
@@ -0,0 +1,45 @@
+// FileMode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:13 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FileMode {
+
+ /// <summary>
+ /// </summary>
+ CreateNew = 1,
+
+ /// <summary>
+ /// </summary>
+ Create = 2,
+
+ /// <summary>
+ /// </summary>
+ Open = 3,
+
+ /// <summary>
+ /// </summary>
+ OpenOrCreate = 4,
+
+ /// <summary>
+ /// </summary>
+ Truncate = 5,
+
+ /// <summary>
+ /// </summary>
+ Append = 6,
+ } // FileMode
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileNotFoundException.cs b/mcs/class/corlib/System.IO/FileNotFoundException.cs
new file mode 100755
index 00000000000..e6b8f75a5ce
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileNotFoundException.cs
@@ -0,0 +1,97 @@
+//
+// System.IO.FileNotFoundException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO {
+
+ [Serializable]
+ public class FileNotFoundException : IOException {
+ private string fileName;
+ private string fusionLog;
+
+ // Constructors
+ public FileNotFoundException ()
+ : base (Locale.GetText ("File not found"))
+ {
+ }
+
+ public FileNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ public FileNotFoundException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public FileNotFoundException (string message, string fileName)
+ : base (message)
+ {
+ this.fileName = fileName;
+ }
+
+ public FileNotFoundException (string message, string fileName, Exception innerException)
+ : base (message, innerException)
+ {
+ this.fileName = fileName;
+ }
+
+ protected FileNotFoundException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ fileName = info.GetString ("FileNotFound_FileName");
+ fusionLog = info.GetString ("FileNotFound_FusionLog");
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ }
+
+ public string FusionLog
+ {
+ get { return fusionLog; }
+ }
+
+ public override string Message
+ {
+ get {
+ if (base.Message == null)
+ return "File not found";
+
+ if (fileName == null)
+ return base.Message;
+
+ return "File '" + fileName + "' not found.";
+ }
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("FileNotFound_FileName", fileName);
+ info.AddValue ("FileNotFound_FusionLog", fusionLog);
+ }
+
+ public override string ToString ()
+ {
+ string result = GetType ().FullName + ": " + Message;
+ if (InnerException != null)
+ result += " ----> " + InnerException.ToString ();
+
+ if (StackTrace != null)
+ result += "\n" + StackTrace;
+
+ return result;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileShare.cs b/mcs/class/corlib/System.IO/FileShare.cs
new file mode 100644
index 00000000000..8e4fac4eef7
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileShare.cs
@@ -0,0 +1,28 @@
+// FileShare.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:26 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum FileShare : int {
+
+ None = 0,
+ Read = 1,
+ Write = 2,
+ ReadWrite = 3,
+ Inheritable = 16,
+ } // FileShare
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs
new file mode 100644
index 00000000000..b5fef581589
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileStream.cs
@@ -0,0 +1,487 @@
+//
+// System.IO/FileStream.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+// FIXME: emit the correct exceptions everywhere. add error handling.
+
+namespace System.IO
+{
+
+ public class FileStream : Stream
+ {
+ // construct from handle
+
+ public FileStream (IntPtr handle, FileAccess access)
+ : this (handle, access, true, DefaultBufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle)
+ : this (handle, access, ownsHandle, DefaultBufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
+ : this (handle, access, ownsHandle, bufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync)
+ {
+ this.handle = handle;
+ this.access = access;
+ this.owner = ownsHandle;
+ this.async = isAsync;
+
+ MonoIOError error;
+
+ if(MonoIO.GetFileType (handle, out error) ==
+ MonoFileType.Disk) {
+ this.canseek = true;
+ } else {
+ this.canseek = false;
+ }
+
+ InitBuffer (bufferSize);
+ }
+
+ // construct from filename
+
+ public FileStream (string name, FileMode mode)
+ : this (name, mode, FileAccess.ReadWrite, FileShare.ReadWrite, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access)
+ : this (name, mode, access, FileShare.ReadWrite, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share)
+ : this (name, mode, access, share, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize)
+ : this (name, mode, access, share, bufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync)
+ {
+ if (name == null) {
+ throw new ArgumentNullException ("Name is null");
+ }
+
+ if (name == "") {
+ throw new ArgumentException ("Name is empty");
+ }
+
+ if (name.IndexOfAny (Path.InvalidPathChars) != -1) {
+ throw new ArgumentException ("Name has invalid chars");
+ }
+
+ if (Directory.Exists (name)) {
+ throw new UnauthorizedAccessException ("Access to the path '" + Path.GetFullPath (name) + "' is denied.");
+ }
+
+ this.name = name;
+
+ // TODO: demand permissions
+
+ MonoIOError error;
+
+ this.handle = MonoIO.Open (name, mode, access, share,
+ out error);
+ if (handle == MonoIO.InvalidHandle) {
+ throw MonoIO.GetException (name, error);
+ }
+
+ this.access = access;
+ this.owner = true;
+ this.async = isAsync;
+
+ /* Can we open non-files by name? */
+
+ if (MonoIO.GetFileType (handle, out error) ==
+ MonoFileType.Disk) {
+ this.canseek = true;
+ } else {
+ this.canseek = false;
+ }
+
+ InitBuffer (bufferSize);
+ }
+
+ // properties
+
+ public override bool CanRead {
+ get {
+ return access == FileAccess.Read ||
+ access == FileAccess.ReadWrite;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return access == FileAccess.Write ||
+ access == FileAccess.ReadWrite;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return(canseek);
+ }
+ }
+
+ public virtual bool IsAsync {
+ get {
+ return (async);
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public override long Length {
+ get {
+ MonoIOError error;
+
+ return MonoIO.GetLength (handle, out error);
+ }
+ }
+
+ public override long Position {
+ get {
+ if(CanSeek == false) {
+ throw new NotSupportedException("The stream does not support seeking");
+ }
+
+ return(buf_start + buf_offset);
+ }
+ set {
+ if(CanSeek == false) {
+ throw new NotSupportedException("The stream does not support seeking");
+ }
+
+ if(value < 0) {
+ throw new ArgumentOutOfRangeException("Attempt to set the position to a negative value");
+ }
+
+ Seek (value, SeekOrigin.Begin);
+ }
+ }
+
+ public virtual IntPtr Handle {
+ get { return handle; }
+ }
+
+ // methods
+
+ public override int ReadByte ()
+ {
+ if (buf_offset >= buf_length) {
+ RefillBuffer ();
+
+ if (buf_length == 0)
+ return -1;
+ }
+
+ return buf [buf_offset ++];
+ }
+
+ public override void WriteByte (byte value)
+ {
+ if (buf_offset == buf_size)
+ FlushBuffer ();
+
+ buf [buf_offset ++] = value;
+ if (buf_offset > buf_length)
+ buf_length = buf_offset;
+
+ buf_dirty = true;
+ }
+
+ public override int Read (byte[] dest, int dest_offset, int count)
+ {
+ int copied = 0;
+
+ int n = ReadSegment (dest, dest_offset, count);
+ copied += n;
+ count -= n;
+
+ if (count == 0) {
+ /* If there was already enough
+ * buffered, no need to read more from
+ * the file.
+ */
+ return (copied);
+ }
+
+ if (count > buf_size) {
+ /* Read as much as we can, up to count
+ * bytes
+ */
+ FlushBuffer();
+ n = ReadData (handle, dest,
+ dest_offset+copied, count);
+
+ /* Make the next buffer read start
+ * from the right place
+ */
+ buf_start += n;
+ } else {
+ RefillBuffer ();
+ n = ReadSegment (dest, dest_offset+copied,
+ count);
+ }
+
+ copied += n;
+
+ return(copied);
+ }
+
+ public override void Write (byte[] src, int src_offset, int count)
+ {
+ int copied = 0;
+ while (count > 0) {
+ int n = WriteSegment (src, src_offset + copied, count);
+ copied += n;
+ count -= n;
+
+ if (count == 0)
+ break;
+
+ FlushBuffer ();
+
+ if (count > buf_size) {
+ // shortcut for long writes
+ MonoIOError error;
+
+ MonoIO.Write (handle, src, src_offset + copied, count, out error);
+ buf_start += count;
+ break;
+ }
+ }
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ long pos;
+
+ // make absolute
+
+ if(CanSeek == false) {
+ throw new NotSupportedException("The stream does not support seeking");
+ }
+
+ switch (origin) {
+ case SeekOrigin.End:
+ pos = Length + offset;
+ break;
+
+ case SeekOrigin.Current:
+ pos = Position + offset;
+ break;
+
+ case SeekOrigin.Begin: default:
+ pos = offset;
+ break;
+ }
+
+ if (pos < 0) {
+ /* LAMESPEC: shouldn't this be
+ * ArgumentOutOfRangeException?
+ */
+ throw new ArgumentException("Attempted to Seek before the beginning of the stream");
+ }
+
+ if (pos >= buf_start && pos <= buf_start + buf_length) {
+ buf_offset = (int) (pos - buf_start);
+ return pos;
+ }
+
+ FlushBuffer ();
+
+ MonoIOError error;
+
+ buf_start = MonoIO.Seek (handle, pos,
+ SeekOrigin.Begin, out error);
+
+ return buf_start;
+ }
+
+ public override void SetLength (long length)
+ {
+ if(CanSeek == false) {
+ throw new NotSupportedException("The stream does not support seeking");
+ }
+
+ if(CanWrite == false) {
+ throw new NotSupportedException("The stream does not support writing");
+ }
+
+ if(length < 0) {
+ throw new ArgumentOutOfRangeException("Length is less than 0");
+ }
+
+ Flush ();
+
+ MonoIOError error;
+
+ MonoIO.SetLength (handle, length, out error);
+ }
+
+ public override void Flush ()
+ {
+ FlushBuffer ();
+
+ //
+ // The flushing is not actually required, in the mono runtime we were
+ // mapping flush to `fsync' which is not the same.
+ //
+ //MonoIO.Flush (handle);
+ }
+
+ public override void Close ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // remove from finalize queue
+ }
+
+ // protected
+
+ ~FileStream ()
+ {
+ Dispose (false);
+ }
+
+ protected virtual void Dispose (bool disposing) {
+ if (handle != MonoIO.InvalidHandle) {
+ FlushBuffer ();
+
+ MonoIOError error;
+
+ MonoIO.Close (handle, out error);
+
+ handle = MonoIO.InvalidHandle;
+ }
+
+ if (disposing) {
+ buf = null;
+ }
+ }
+
+ // private
+
+ private int ReadSegment (byte [] dest, int dest_offset, int count)
+ {
+ if (count > buf_length - buf_offset)
+ count = buf_length - buf_offset;
+
+ if (count > 0) {
+ Buffer.BlockCopy (buf, buf_offset, dest, dest_offset, count);
+ buf_offset += count;
+ }
+
+ return count;
+ }
+
+ private int WriteSegment (byte [] src, int src_offset, int count)
+ {
+ if (count > buf_size - buf_offset)
+ count = buf_size - buf_offset;
+
+ if (count > 0) {
+ Buffer.BlockCopy (src, src_offset, buf, buf_offset, count);
+ buf_offset += count;
+ if (buf_offset > buf_length)
+ buf_length = buf_offset;
+
+ buf_dirty = true;
+ }
+
+ return count;
+ }
+
+ private void FlushBuffer ()
+ {
+ if (buf_dirty) {
+ MonoIOError error;
+
+ if (CanSeek == true) {
+ MonoIO.Seek (handle, buf_start,
+ SeekOrigin.Begin,
+ out error);
+ }
+ MonoIO.Write (handle, buf, 0, buf_length,
+ out error);
+ }
+
+ buf_start += buf_length;
+ buf_offset = buf_length = 0;
+ buf_dirty = false;
+ }
+
+ private void RefillBuffer ()
+ {
+ FlushBuffer();
+
+ buf_length = ReadData (handle, buf, 0, buf_size);
+ }
+
+ private int ReadData (IntPtr handle, byte[] buf, int offset,
+ int count)
+ {
+ MonoIOError error;
+
+ int amount = MonoIO.Read (handle, buf, offset, count,
+ out error);
+
+ /* Check for read error */
+ if(amount == -1) {
+ /* Kludge around broken pipes */
+ if(error == MonoIOError.ERROR_BROKEN_PIPE) {
+ amount = 0;
+ } else {
+ throw new IOException ();
+ }
+ }
+
+ return(amount);
+ }
+
+
+ private void InitBuffer (int size)
+ {
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("Buffer size cannot be negative.");
+ if (size < 8)
+ size = 8;
+
+ buf = new byte [size];
+ buf_size = size;
+ buf_start = 0;
+ buf_offset = buf_length = 0;
+ buf_dirty = false;
+ }
+
+ // fields
+
+ private static int DefaultBufferSize = 8192;
+
+ private FileAccess access;
+ private bool owner;
+ private bool async;
+ private bool canseek;
+
+ private byte [] buf; // the buffer
+ private int buf_size; // capacity in bytes
+ private int buf_length; // number of valid bytes in buffer
+ private int buf_offset; // position of next byte
+ private bool buf_dirty; // true if buffer has been written to
+ private long buf_start; // location of buffer in file
+ private string name = "[Unknown]"; // name of file.
+
+ IntPtr handle; // handle to underlying file
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileSystemInfo.cs b/mcs/class/corlib/System.IO/FileSystemInfo.cs
new file mode 100644
index 00000000000..80f481b04f1
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileSystemInfo.cs
@@ -0,0 +1,149 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileSystemInfo.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public abstract class FileSystemInfo : MarshalByRefObject {
+ // public properties
+
+ public abstract bool Exists { get; }
+
+ public abstract string Name { get; }
+
+ public virtual string FullName {
+ get {
+ return FullPath;
+ }
+ }
+
+ public string Extension {
+ get {
+ return Path.GetExtension (Name);
+ }
+ }
+
+ public FileAttributes Attributes {
+ get {
+ Refresh (false);
+ return stat.Attributes;
+ }
+
+ set {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileAttributes (FullName,
+ value,
+ out error))
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ public DateTime CreationTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.CreationTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (FullName, filetime,
+ -1, -1, out error))
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ public DateTime LastAccessTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.LastAccessTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (FullName, -1,
+ filetime, -1,
+ out error))
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ public DateTime LastWriteTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.LastWriteTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (FullName, -1, -1,
+ filetime, out error))
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ // public methods
+
+ public abstract void Delete ();
+
+ public void Refresh ()
+ {
+ Refresh (true);
+ }
+
+ // protected
+
+ protected FileSystemInfo ()
+ {
+ this.valid = false;
+ this.FullPath = null;
+ }
+
+ protected string FullPath;
+ protected string OriginalPath;
+
+ // internal
+
+ internal void Refresh (bool force)
+ {
+ if (valid && !force)
+ return;
+
+ MonoIOError error;
+
+ MonoIO.GetFileStat (FullName, out stat, out error);
+ valid = true;
+ }
+
+ internal void CheckPath (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Invalid characters in path.");
+ }
+
+ internal MonoIOStat stat;
+ internal bool valid;
+ }
+}
diff --git a/mcs/class/corlib/System.IO/IOException.cs b/mcs/class/corlib/System.IO/IOException.cs
new file mode 100644
index 00000000000..74593cd03cf
--- /dev/null
+++ b/mcs/class/corlib/System.IO/IOException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.IOException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.IO {
+ [Serializable]
+ public class IOException : SystemException {
+
+ // Constructors
+ public IOException ()
+ : base ("I/O Error")
+ {
+ }
+
+ public IOException (string message)
+ : base (message)
+ {
+ }
+
+ public IOException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected IOException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public IOException (string message, int hresult)
+ : base (message)
+ {
+ this.HResult = hresult;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/MemoryStream.cs b/mcs/class/corlib/System.IO/MemoryStream.cs
new file mode 100644
index 00000000000..3d703db8e7f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MemoryStream.cs
@@ -0,0 +1,398 @@
+//
+// System.IO.MemoryStream
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Clarify some of the lamespec issues
+//
+
+namespace System.IO {
+ [Serializable]
+ public class MemoryStream : Stream {
+ private bool canRead;
+ private bool canSeek;
+ private bool canWrite;
+
+ private bool allowGetBuffer;
+
+ private int capacity;
+
+ private byte[] internalBuffer;
+
+ private int initialLength;
+ private bool expandable;
+
+ private bool streamClosed = false;
+
+ private long position = 0;
+
+ public MemoryStream() {
+ canRead = true;
+ canSeek = true;
+ canWrite = true;
+
+ capacity = 0;
+
+ internalBuffer = new byte[0];
+
+ allowGetBuffer = true;
+ expandable = true;
+ }
+
+ public MemoryStream( byte[] buffer ) {
+ InternalConstructor( buffer, 0, buffer.Length, true, false );
+ }
+
+ public MemoryStream( int capacity ) {
+
+ canRead = true;
+ canSeek = true;
+ canWrite = true;
+
+ this.capacity = capacity;
+ initialLength = 0;
+ internalBuffer = new byte[ 0 ];
+
+ expandable = true;
+ allowGetBuffer = true;
+ }
+
+ public MemoryStream( byte[] buffer, bool writeable ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, 0, buffer.Length, writeable, true );
+
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, index, count, true, false );
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count, bool writeable ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, index, count, writeable, true );
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count, bool writeable, bool publicallyVisible ) {
+ InternalConstructor( buffer, index, count, writeable, publicallyVisible );
+ }
+
+ private void InternalConstructor( byte[] buffer, int index, int count, bool writeable, bool publicallyVisible ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if ( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if ( buffer.Length - index < count ) {
+ throw new ArgumentException();
+ }
+
+ // LAMESPEC: The spec says to throw an UnauthorisedAccessException if
+ // publicallyVisibile is fale?! Doesn't that defy the point of having
+ // it there in the first place. I'll leave it out for now.
+
+ canRead = true;
+ canSeek = true;
+ canWrite = writeable;
+
+ initialLength = count;
+
+ internalBuffer = new byte[ count ];
+ capacity = count;
+
+ Array.Copy( buffer, index, internalBuffer, 0, count );
+
+ allowGetBuffer = publicallyVisible;
+ expandable = false;
+ }
+
+ public override bool CanRead {
+ get {
+ return this.canRead;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return this.canSeek;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return this.canWrite;
+ }
+ }
+
+ public virtual int Capacity {
+ get {
+ return this.capacity;
+ }
+
+ set {
+ if( value < 0 || value < capacity ) {
+ throw new ArgumentOutOfRangeException("value",
+ "New capacity cannot be negative or less than the current capacity" );
+ } else if( !expandable ) {
+ throw new NotSupportedException( "Cannot expand this MemoryStream" );
+ }
+
+ byte[] newBuffer = new byte[ value ];
+ Array.Copy( internalBuffer, 0, newBuffer, 0, capacity );
+ capacity = value;
+ }
+ }
+
+ public override long Length {
+ get {
+ // LAMESPEC: The spec says to throw an IOException if the
+ // stream is closed and an ObjectDisposedException if
+ // "methods were called after the stream was closed". What
+ // is the difference?
+
+ if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ return internalBuffer.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ return position;
+ }
+
+ set {
+
+ if( position < 0 ) {
+ throw new ArgumentOutOfRangeException ("value", "Position cannot be negative" );
+ } else if (position > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException ("value",
+ "Length must be non-negative and less than 2^31 - 1 - origin");
+ } else if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ position = value;
+ }
+ }
+
+ public override void Close() {
+ if( streamClosed ) {
+ return;
+ }
+
+ streamClosed = true;
+ internalBuffer = null;
+ }
+
+ public override void Flush() { }
+
+ public virtual byte[] GetBuffer() {
+ if( !allowGetBuffer ) {
+ throw new UnauthorizedAccessException();
+ }
+
+ return internalBuffer;
+ }
+
+ public override int Read( byte[] buffer, int offset, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( offset < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( buffer.Length - offset < count ) {
+ throw new ArgumentException();
+ } else if ( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ long ReadTo;
+
+ if( position + count > internalBuffer.Length ) {
+ ReadTo = internalBuffer.Length;
+ } else {
+ ReadTo = position + (long)count;
+ }
+
+ Array.Copy( internalBuffer, (int)position, buffer, offset, (int)(ReadTo - position) );
+
+ int bytesRead = (int)(ReadTo - position);
+
+ position = ReadTo;
+
+ return bytesRead;
+ }
+
+ public override int ReadByte( ) {
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+
+ // LAMESPEC: What happens if we're at the end of the stream? It's unspecified in the
+ // docs but tests against the MS impl. show it returns -1
+ //
+
+ if( position >= internalBuffer.Length ) {
+ return -1;
+ } else {
+ return internalBuffer[ position++ ];
+ }
+ }
+
+ public override long Seek( long offset, SeekOrigin loc ) {
+ long refPoint;
+
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ switch( loc ) {
+ case SeekOrigin.Begin:
+ refPoint = 0;
+ break;
+ case SeekOrigin.Current:
+ refPoint = position;
+ break;
+ case SeekOrigin.End:
+ refPoint = internalBuffer.Length;
+ break;
+ default:
+ throw new ArgumentException( "Invalid SeekOrigin" );
+ }
+
+ // LAMESPEC: My goodness, how may LAMESPECs are there in this
+ // class! :) In the spec for the Position property it's stated
+ // "The position must not be more than one byte beyond the end of the stream."
+ // In the spec for seek it says "Seeking to any location beyond the length of the
+ // stream is supported." That's a contradiction i'd say.
+ // I guess seek can go anywhere but if you use position it may get moved back.
+
+ if( refPoint + offset < 0 ) {
+ throw new IOException( "Attempted to seek before start of MemoryStream" );
+ } else if( offset > internalBuffer.Length ) {
+ throw new ArgumentOutOfRangeException("offset",
+ "Offset cannot be greater than length of MemoryStream" );
+ }
+
+ position = refPoint + offset;
+
+ return position;
+ }
+
+
+ public override void SetLength( long value ) {
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ } else if( !expandable && value > capacity ) {
+ throw new NotSupportedException( "Expanding this MemoryStream is not supported" );
+ } else if( !canWrite ) {
+ throw new IOException( "Cannot write to this MemoryStream" );
+ } else if( value < 0 ) {
+
+ // LAMESPEC: AGAIN! It says to throw this exception if value is
+ // greater than "the maximum length of the MemoryStream". I haven't
+ // seen anywhere mention what the maximum length of a MemoryStream is and
+ // since we're this far this memory stream is expandable.
+
+ throw new ArgumentOutOfRangeException();
+ }
+
+ byte[] newBuffer;
+ newBuffer = new byte[ value ];
+
+ if (value < internalBuffer.Length) {
+ // truncate
+ Array.Copy( internalBuffer, 0, newBuffer, 0, (int)value );
+ } else {
+ // expand
+ Array.Copy( internalBuffer, 0, newBuffer, 0, internalBuffer.Length );
+ }
+ internalBuffer = newBuffer;
+ capacity = (int)value;
+
+ }
+
+
+ public virtual byte[] ToArray() {
+ byte[] outBuffer = new byte[capacity];
+ Array.Copy( internalBuffer, 0, outBuffer, 0, capacity);
+ return outBuffer;
+ }
+
+ public override void Write( byte[] buffer, int offset, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( !canWrite ) {
+ throw new NotSupportedException();
+ } else if( buffer.Length - offset < count ) {
+ throw new ArgumentException();
+ } else if( offset < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ if( position + count > capacity ) {
+ if( expandable ) {
+ // expand the buffer
+ SetLength( position + count );
+ } else {
+ // only write as many bytes as will fit
+ count = (int)((long)capacity - position);
+ }
+ }
+
+ // internal buffer may not be allocated all the way up to capacity
+ // count will already be limited to capacity above if non-expandable
+ if( position + count >= internalBuffer.Length )
+ SetLength( position + count );
+
+ Array.Copy( buffer, offset, internalBuffer, (int)position, count );
+ position += count;
+ }
+
+
+ public override void WriteByte( byte value ) {
+ if ( streamClosed )
+ throw new ObjectDisposedException( "MemoryStream" );
+ else if( !canWrite || (position >= capacity && !expandable))
+ throw new NotSupportedException();
+
+ if( position >= internalBuffer.Length )
+ SetLength ( position + 1 );
+
+ internalBuffer[ position++ ] = value;
+ }
+
+
+ public virtual void WriteTo( Stream stream ) {
+ if( stream == null ) {
+ throw new ArgumentNullException();
+ }
+
+ stream.Write( internalBuffer, 0, internalBuffer.Length );
+
+ }
+
+
+ }
+
+
+}
diff --git a/mcs/class/corlib/System.IO/MonoFileType.cs b/mcs/class/corlib/System.IO/MonoFileType.cs
new file mode 100755
index 00000000000..6194c6476a8
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoFileType.cs
@@ -0,0 +1,20 @@
+//
+// System.IO.MonoFileType.cs: enum for GetFileType return
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.IO
+{
+ internal enum MonoFileType {
+ Unknown=0x0000,
+ Disk=0x0001,
+ Char=0x0002,
+ Pipe=0x0003,
+ Remote=0x8000,
+ }
+}
+
diff --git a/mcs/class/corlib/System.IO/MonoIO.cs b/mcs/class/corlib/System.IO/MonoIO.cs
new file mode 100644
index 00000000000..6615306c24f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIO.cs
@@ -0,0 +1,267 @@
+//
+// System.IO.MonoIO.cs: static interface to native filesystem.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.IO
+{
+ internal sealed class MonoIO {
+ public static readonly FileAttributes
+ InvalidFileAttributes = (FileAttributes)(-1);
+
+ public static readonly IntPtr
+ InvalidHandle = (IntPtr)(-1);
+
+ // error methods
+
+ public static Exception GetException (MonoIOError error)
+ {
+ return GetException (String.Empty, error);
+ }
+
+ public static Exception GetException (string path,
+ MonoIOError error)
+ {
+ string message;
+
+ switch (error) {
+ // FIXME: add more exception mappings here
+ case MonoIOError.ERROR_FILE_NOT_FOUND:
+ message = String.Format ("Could not find file \"{0}\"", path);
+ return new FileNotFoundException (message);
+
+ case MonoIOError.ERROR_PATH_NOT_FOUND:
+ message = String.Format ("Could not find a part of the path \"{0}\"", path);
+ return new DirectoryNotFoundException (message);
+
+ case MonoIOError.ERROR_ACCESS_DENIED:
+ message = String.Format ("Access to the path \"{0}\" is denied.", path);
+ return new UnauthorizedAccessException (message);
+
+ default:
+ message = String.Format ("Win32 IO returned {0}", error);
+ return new IOException (message);
+ }
+ }
+
+ // directory methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CreateDirectory (string path, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool RemoveDirectory (string path, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static IntPtr FindFirstFile (string path, out MonoIOStat stat, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool FindNextFile (IntPtr find, out MonoIOStat stat, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool FindClose (IntPtr find,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static string GetCurrentDirectory (out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetCurrentDirectory (string path, out MonoIOError error);
+
+ // file methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool MoveFile (string path, string dest,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CopyFile (string path, string dest,
+ bool overwrite,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool DeleteFile (string path,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static FileAttributes GetFileAttributes (string path, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetFileAttributes (string path, FileAttributes attrs, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static MonoFileType GetFileType (IntPtr handle, out MonoIOError error);
+
+ public static bool Exists (string path, out MonoIOError error)
+ {
+ FileAttributes attrs = GetFileAttributes (path,
+ out error);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ return true;
+ }
+
+ public static bool ExistsFile (string path,
+ out MonoIOError error)
+ {
+ FileAttributes attrs = GetFileAttributes (path,
+ out error);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ if ((attrs & FileAttributes.Directory) != 0)
+ return false;
+
+ return true;
+ }
+
+ public static bool ExistsDirectory (string path,
+ out MonoIOError error)
+ {
+ FileAttributes attrs = GetFileAttributes (path,
+ out error);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ if ((attrs & FileAttributes.Directory) == 0)
+ return false;
+
+ return true;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool GetFileStat (string path,
+ out MonoIOStat stat,
+ out MonoIOError error);
+
+ // handle methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static IntPtr Open (string filename,
+ FileMode mode,
+ FileAccess access,
+ FileShare share,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool Close (IntPtr handle,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static int Read (IntPtr handle, byte [] dest,
+ int dest_offset, int count,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static int Write (IntPtr handle, byte [] src,
+ int src_offset, int count,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long Seek (IntPtr handle, long offset,
+ SeekOrigin origin,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool Flush (IntPtr handle,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long GetLength (IntPtr handle,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetLength (IntPtr handle,
+ long length,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetFileTime (IntPtr handle,
+ long creation_time,
+ long last_access_time,
+ long last_write_time,
+ out MonoIOError error);
+
+ public static bool SetFileTime (string path,
+ long creation_time,
+ long last_access_time,
+ long last_write_time,
+ out MonoIOError error)
+ {
+ IntPtr handle;
+ bool result;
+
+ handle = Open (path, FileMode.Open,
+ FileAccess.ReadWrite,
+ FileShare.ReadWrite, out error);
+ if (handle == IntPtr.Zero)
+ return false;
+
+ result = SetFileTime (handle, creation_time,
+ last_access_time,
+ last_write_time, out error);
+ Close (handle, out error);
+
+ return result;
+ }
+
+ // console handles
+
+ public extern static IntPtr ConsoleOutput {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static IntPtr ConsoleInput {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static IntPtr ConsoleError {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ // pipe handles
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CreatePipe (out IntPtr read_handle, out IntPtr write_handle);
+
+ // path characters
+
+ public extern static char VolumeSeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char DirectorySeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char AltDirectorySeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char PathSeparator {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char [] InvalidPathChars {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.IO/MonoIOError.cs b/mcs/class/corlib/System.IO/MonoIOError.cs
new file mode 100644
index 00000000000..e0f43fc0367
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIOError.cs
@@ -0,0 +1,1798 @@
+//
+// System.IO.MonoIOError.cs: Win32 error codes. Yuck.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO
+{
+ internal enum MonoIOError: int {
+ ERROR_SUCCESS = 0,
+ ERROR_INVALID_FUNCTION = 1,
+ ERROR_FILE_NOT_FOUND = 2,
+ ERROR_PATH_NOT_FOUND = 3,
+ ERROR_TOO_MANY_OPEN_FILES = 4,
+ ERROR_ACCESS_DENIED = 5,
+ ERROR_INVALID_HANDLE = 6,
+ ERROR_ARENA_TRASHED = 7,
+ ERROR_NOT_ENOUGH_MEMORY = 8,
+ ERROR_INVALID_BLOCK = 9,
+ ERROR_BAD_ENVIRONMENT = 10,
+ ERROR_BAD_FORMAT = 11,
+ ERROR_INVALID_ACCESS = 12,
+ ERROR_INVALID_DATA = 13,
+ ERROR_OUTOFMEMORY = 14,
+ ERROR_INVALID_DRIVE = 15,
+ ERROR_CURRENT_DIRECTORY = 16,
+ ERROR_NOT_SAME_DEVICE = 17,
+ ERROR_NO_MORE_FILES = 18,
+ ERROR_WRITE_PROTECT = 19,
+ ERROR_BAD_UNIT = 20,
+ ERROR_NOT_READY = 21,
+ ERROR_BAD_COMMAND = 22,
+ ERROR_CRC = 23,
+ ERROR_BAD_LENGTH = 24,
+ ERROR_SEEK = 25,
+ ERROR_NOT_DOS_DISK = 26,
+ ERROR_SECTOR_NOT_FOUND = 27,
+ ERROR_OUT_OF_PAPER = 28,
+ ERROR_WRITE_FAULT = 29,
+ ERROR_READ_FAULT = 30,
+ ERROR_GEN_FAILURE = 31,
+ ERROR_SHARING_VIOLATION = 32,
+ ERROR_LOCK_VIOLATION = 33,
+ ERROR_WRONG_DISK = 34,
+ ERROR_SHARING_BUFFER_EXCEEDED = 36,
+ ERROR_HANDLE_EOF = 38,
+ ERROR_HANDLE_DISK_FULL = 39,
+ ERROR_NOT_SUPPORTED = 50,
+ ERROR_REM_NOT_LIST = 51,
+ ERROR_DUP_NAME = 52,
+ ERROR_BAD_NETPATH = 53,
+ ERROR_NETWORK_BUSY = 54,
+ ERROR_DEV_NOT_EXIST = 55,
+ ERROR_TOO_MANY_CMDS = 56,
+ ERROR_ADAP_HDW_ERR = 57,
+ ERROR_BAD_NET_RESP = 58,
+ ERROR_UNEXP_NET_ERR = 59,
+ ERROR_BAD_REM_ADAP = 60,
+ ERROR_PRINTQ_FULL = 61,
+ ERROR_NO_SPOOL_SPACE = 62,
+ ERROR_PRINT_CANCELLED = 63,
+ ERROR_NETNAME_DELETED = 64,
+ ERROR_NETWORK_ACCESS_DENIED = 65,
+ ERROR_BAD_DEV_TYPE = 66,
+ ERROR_BAD_NET_NAME = 67,
+ ERROR_TOO_MANY_NAMES = 68,
+ ERROR_TOO_MANY_SESS = 69,
+ ERROR_SHARING_PAUSED = 70,
+ ERROR_REQ_NOT_ACCEP = 71,
+ ERROR_REDIR_PAUSED = 72,
+ ERROR_FILE_EXISTS = 80,
+ ERROR_CANNOT_MAKE = 82,
+ ERROR_FAIL_I24 = 83,
+ ERROR_OUT_OF_STRUCTURES = 84,
+ ERROR_ALREADY_ASSIGNED = 85,
+ ERROR_INVALID_PASSWORD = 86,
+ ERROR_INVALID_PARAMETER = 87,
+ ERROR_NET_WRITE_FAULT = 88,
+ ERROR_NO_PROC_SLOTS = 89,
+ ERROR_TOO_MANY_SEMAPHORES = 100,
+ ERROR_EXCL_SEM_ALREADY_OWNED = 101,
+ ERROR_SEM_IS_SET = 102,
+ ERROR_TOO_MANY_SEM_REQUESTS = 103,
+ ERROR_INVALID_AT_INTERRUPT_TIME = 104,
+ ERROR_SEM_OWNER_DIED = 105,
+ ERROR_SEM_USER_LIMIT = 106,
+ ERROR_DISK_CHANGE = 107,
+ ERROR_DRIVE_LOCKED = 108,
+ ERROR_BROKEN_PIPE = 109,
+ ERROR_OPEN_FAILED = 110,
+ ERROR_BUFFER_OVERFLOW = 111,
+ ERROR_DISK_FULL = 112,
+ ERROR_NO_MORE_SEARCH_HANDLES = 113,
+ ERROR_INVALID_TARGET_HANDLE = 114,
+ ERROR_INVALID_CATEGORY = 117,
+ ERROR_INVALID_VERIFY_SWITCH = 118,
+ ERROR_BAD_DRIVER_LEVEL = 119,
+ ERROR_CALL_NOT_IMPLEMENTED = 120,
+ ERROR_SEM_TIMEOUT = 121,
+ ERROR_INSUFFICIENT_BUFFER = 122,
+ ERROR_INVALID_NAME = 123,
+ ERROR_INVALID_LEVEL = 124,
+ ERROR_NO_VOLUME_LABEL = 125,
+ ERROR_MOD_NOT_FOUND = 126,
+ ERROR_PROC_NOT_FOUND = 127,
+ ERROR_WAIT_NO_CHILDREN = 128,
+ ERROR_CHILD_NOT_COMPLETE = 129,
+ ERROR_DIRECT_ACCESS_HANDLE = 130,
+ ERROR_NEGATIVE_SEEK = 131,
+ ERROR_SEEK_ON_DEVICE = 132,
+ ERROR_IS_JOIN_TARGET = 133,
+ ERROR_IS_JOINED = 134,
+ ERROR_IS_SUBSTED = 135,
+ ERROR_NOT_JOINED = 136,
+ ERROR_NOT_SUBSTED = 137,
+ ERROR_JOIN_TO_JOIN = 138,
+ ERROR_SUBST_TO_SUBST = 139,
+ ERROR_JOIN_TO_SUBST = 140,
+ ERROR_SUBST_TO_JOIN = 141,
+ ERROR_BUSY_DRIVE = 142,
+ ERROR_SAME_DRIVE = 143,
+ ERROR_DIR_NOT_ROOT = 144,
+ ERROR_DIR_NOT_EMPTY = 145,
+ ERROR_IS_SUBST_PATH = 146,
+ ERROR_IS_JOIN_PATH = 147,
+ ERROR_PATH_BUSY = 148,
+ ERROR_IS_SUBST_TARGET = 149,
+ ERROR_SYSTEM_TRACE = 150,
+ ERROR_INVALID_EVENT_COUNT = 151,
+ ERROR_TOO_MANY_MUXWAITERS = 152,
+ ERROR_INVALID_LIST_FORMAT = 153,
+ ERROR_LABEL_TOO_LONG = 154,
+ ERROR_TOO_MANY_TCBS = 155,
+ ERROR_SIGNAL_REFUSED = 156,
+ ERROR_DISCARDED = 157,
+ ERROR_NOT_LOCKED = 158,
+ ERROR_BAD_THREADID_ADDR = 159,
+ ERROR_BAD_ARGUMENTS = 160,
+ ERROR_BAD_PATHNAME = 161,
+ ERROR_SIGNAL_PENDING = 162,
+ ERROR_MAX_THRDS_REACHED = 164,
+ ERROR_LOCK_FAILED = 167,
+ ERROR_BUSY = 170,
+ ERROR_CANCEL_VIOLATION = 173,
+ ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174,
+ ERROR_INVALID_SEGMENT_NUMBER = 180,
+ ERROR_INVALID_ORDINAL = 182,
+ ERROR_ALREADY_EXISTS = 183,
+ ERROR_INVALID_FLAG_NUMBER = 186,
+ ERROR_SEM_NOT_FOUND = 187,
+ ERROR_INVALID_STARTING_CODESEG = 188,
+ ERROR_INVALID_STACKSEG = 189,
+ ERROR_INVALID_MODULETYPE = 190,
+ ERROR_INVALID_EXE_SIGNATURE = 191,
+ ERROR_EXE_MARKED_INVALID = 192,
+ ERROR_BAD_EXE_FORMAT = 193,
+ ERROR_ITERATED_DATA_EXCEEDS_64k = 194,
+ ERROR_INVALID_MINALLOCSIZE = 195,
+ ERROR_DYNLINK_FROM_INVALID_RING = 196,
+ ERROR_IOPL_NOT_ENABLED = 197,
+ ERROR_INVALID_SEGDPL = 198,
+ ERROR_AUTODATASEG_EXCEEDS_64k = 199,
+ ERROR_RING2SEG_MUST_BE_MOVABLE = 200,
+ ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201,
+ ERROR_INFLOOP_IN_RELOC_CHAIN = 202,
+ ERROR_ENVVAR_NOT_FOUND = 203,
+ ERROR_NO_SIGNAL_SENT = 205,
+ ERROR_FILENAME_EXCED_RANGE = 206,
+ ERROR_RING2_STACK_IN_USE = 207,
+ ERROR_META_EXPANSION_TOO_LONG = 208,
+ ERROR_INVALID_SIGNAL_NUMBER = 209,
+ ERROR_THREAD_1_INACTIVE = 210,
+ ERROR_LOCKED = 212,
+ ERROR_TOO_MANY_MODULES = 214,
+ ERROR_NESTING_NOT_ALLOWED = 215,
+ ERROR_EXE_MACHINE_TYPE_MISMATCH = 216,
+ ERROR_BAD_PIPE = 230,
+ ERROR_PIPE_BUSY = 231,
+ ERROR_NO_DATA = 232,
+ ERROR_PIPE_NOT_CONNECTED = 233,
+ ERROR_MORE_DATA = 234,
+ ERROR_VC_DISCONNECTED = 240,
+ ERROR_INVALID_EA_NAME = 254,
+ ERROR_EA_LIST_INCONSISTENT = 255,
+ WAIT_TIMEOUT = 258,
+ ERROR_NO_MORE_ITEMS = 259,
+ ERROR_CANNOT_COPY = 266,
+ ERROR_DIRECTORY = 267,
+ ERROR_EAS_DIDNT_FIT = 275,
+ ERROR_EA_FILE_CORRUPT = 276,
+ ERROR_EA_TABLE_FULL = 277,
+ ERROR_INVALID_EA_HANDLE = 278,
+ ERROR_EAS_NOT_SUPPORTED = 282,
+ ERROR_NOT_OWNER = 288,
+ ERROR_TOO_MANY_POSTS = 298,
+ ERROR_PARTIAL_COPY = 299,
+ ERROR_OPLOCK_NOT_GRANTED = 300,
+ ERROR_INVALID_OPLOCK_PROTOCOL = 301,
+ ERROR_DISK_TOO_FRAGMENTED = 302,
+ ERROR_DELETE_PENDING = 303,
+ ERROR_MR_MID_NOT_FOUND = 317,
+ ERROR_INVALID_ADDRESS = 487,
+ ERROR_ARITHMETIC_OVERFLOW = 534,
+ ERROR_PIPE_CONNECTED = 535,
+ ERROR_PIPE_LISTENING = 536,
+ ERROR_EA_ACCESS_DENIED = 994,
+ ERROR_OPERATION_ABORTED = 995,
+ ERROR_IO_INCOMPLETE = 996,
+ ERROR_IO_PENDING = 997,
+ ERROR_NOACCESS = 998,
+ ERROR_SWAPERROR = 999,
+ ERROR_STACK_OVERFLOW = 1001,
+ ERROR_INVALID_MESSAGE = 1002,
+ ERROR_CAN_NOT_COMPLETE = 1003,
+ ERROR_INVALID_FLAGS = 1004,
+ ERROR_UNRECOGNIZED_VOLUME = 1005,
+ ERROR_FILE_INVALID = 1006,
+ ERROR_FULLSCREEN_MODE = 1007,
+ ERROR_NO_TOKEN = 1008,
+ ERROR_BADDB = 1009,
+ ERROR_BADKEY = 1010,
+ ERROR_CANTOPEN = 1011,
+ ERROR_CANTREAD = 1012,
+ ERROR_CANTWRITE = 1013,
+ ERROR_REGISTRY_RECOVERED = 1014,
+ ERROR_REGISTRY_CORRUPT = 1015,
+ ERROR_REGISTRY_IO_FAILED = 1016,
+ ERROR_NOT_REGISTRY_FILE = 1017,
+ ERROR_KEY_DELETED = 1018,
+ ERROR_NO_LOG_SPACE = 1019,
+ ERROR_KEY_HAS_CHILDREN = 1020,
+ ERROR_CHILD_MUST_BE_VOLATILE = 1021,
+ ERROR_NOTIFY_ENUM_DIR = 1022,
+ ERROR_DEPENDENT_SERVICES_RUNNING = 1051,
+ ERROR_INVALID_SERVICE_CONTROL = 1052,
+ ERROR_SERVICE_REQUEST_TIMEOUT = 1053,
+ ERROR_SERVICE_NO_THREAD = 1054,
+ ERROR_SERVICE_DATABASE_LOCKED = 1055,
+ ERROR_SERVICE_ALREADY_RUNNING = 1056,
+ ERROR_INVALID_SERVICE_ACCOUNT = 1057,
+ ERROR_SERVICE_DISABLED = 1058,
+ ERROR_CIRCULAR_DEPENDENCY = 1059,
+ ERROR_SERVICE_DOES_NOT_EXIST = 1060,
+ ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061,
+ ERROR_SERVICE_NOT_ACTIVE = 1062,
+ ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063,
+ ERROR_EXCEPTION_IN_SERVICE = 1064,
+ ERROR_DATABASE_DOES_NOT_EXIST = 1065,
+ ERROR_SERVICE_SPECIFIC_ERROR = 1066,
+ ERROR_PROCESS_ABORTED = 1067,
+ ERROR_SERVICE_DEPENDENCY_FAIL = 1068,
+ ERROR_SERVICE_LOGON_FAILED = 1069,
+ ERROR_SERVICE_START_HANG = 1070,
+ ERROR_INVALID_SERVICE_LOCK = 1071,
+ ERROR_SERVICE_MARKED_FOR_DELETE = 1072,
+ ERROR_SERVICE_EXISTS = 1073,
+ ERROR_ALREADY_RUNNING_LKG = 1074,
+ ERROR_SERVICE_DEPENDENCY_DELETED = 1075,
+ ERROR_BOOT_ALREADY_ACCEPTED = 1076,
+ ERROR_SERVICE_NEVER_STARTED = 1077,
+ ERROR_DUPLICATE_SERVICE_NAME = 1078,
+ ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079,
+ ERROR_CANNOT_DETECT_DRIVER_FAILURE = 1080,
+ ERROR_CANNOT_DETECT_PROCESS_ABORT = 1081,
+ ERROR_NO_RECOVERY_PROGRAM = 1082,
+ ERROR_SERVICE_NOT_IN_EXE = 1083,
+ ERROR_NOT_SAFEBOOT_SERVICE = 1084,
+ ERROR_END_OF_MEDIA = 1100,
+ ERROR_FILEMARK_DETECTED = 1101,
+ ERROR_BEGINNING_OF_MEDIA = 1102,
+ ERROR_SETMARK_DETECTED = 1103,
+ ERROR_NO_DATA_DETECTED = 1104,
+ ERROR_PARTITION_FAILURE = 1105,
+ ERROR_INVALID_BLOCK_LENGTH = 1106,
+ ERROR_DEVICE_NOT_PARTITIONED = 1107,
+ ERROR_UNABLE_TO_LOCK_MEDIA = 1108,
+ ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109,
+ ERROR_MEDIA_CHANGED = 1110,
+ ERROR_BUS_RESET = 1111,
+ ERROR_NO_MEDIA_IN_DRIVE = 1112,
+ ERROR_NO_UNICODE_TRANSLATION = 1113,
+ ERROR_DLL_INIT_FAILED = 1114,
+ ERROR_SHUTDOWN_IN_PROGRESS = 1115,
+ ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116,
+ ERROR_IO_DEVICE = 1117,
+ ERROR_SERIAL_NO_DEVICE = 1118,
+ ERROR_IRQ_BUSY = 1119,
+ ERROR_MORE_WRITES = 1120,
+ ERROR_COUNTER_TIMEOUT = 1121,
+ ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122,
+ ERROR_FLOPPY_WRONG_CYLINDER = 1123,
+ ERROR_FLOPPY_UNKNOWN_ERROR = 1124,
+ ERROR_FLOPPY_BAD_REGISTERS = 1125,
+ ERROR_DISK_RECALIBRATE_FAILED = 1126,
+ ERROR_DISK_OPERATION_FAILED = 1127,
+ ERROR_DISK_RESET_FAILED = 1128,
+ ERROR_EOM_OVERFLOW = 1129,
+ ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130,
+ ERROR_POSSIBLE_DEADLOCK = 1131,
+ ERROR_MAPPED_ALIGNMENT = 1132,
+ ERROR_SET_POWER_STATE_VETOED = 1140,
+ ERROR_SET_POWER_STATE_FAILED = 1141,
+ ERROR_TOO_MANY_LINKS = 1142,
+ ERROR_OLD_WIN_VERSION = 1150,
+ ERROR_APP_WRONG_OS = 1151,
+ ERROR_SINGLE_INSTANCE_APP = 1152,
+ ERROR_RMODE_APP = 1153,
+ ERROR_INVALID_DLL = 1154,
+ ERROR_NO_ASSOCIATION = 1155,
+ ERROR_DDE_FAIL = 1156,
+ ERROR_DLL_NOT_FOUND = 1157,
+ ERROR_NO_MORE_USER_HANDLES = 1158,
+ ERROR_MESSAGE_SYNC_ONLY = 1159,
+ ERROR_SOURCE_ELEMENT_EMPTY = 1160,
+ ERROR_DESTINATION_ELEMENT_FULL = 1161,
+ ERROR_ILLEGAL_ELEMENT_ADDRESS = 1162,
+ ERROR_MAGAZINE_NOT_PRESENT = 1163,
+ ERROR_DEVICE_REINITIALIZATION_NEEDED = 1164,
+ ERROR_DEVICE_REQUIRES_CLEANING = 1165,
+ ERROR_DEVICE_DOOR_OPEN = 1166,
+ ERROR_DEVICE_NOT_CONNECTED = 1167,
+ ERROR_NOT_FOUND = 1168,
+ ERROR_NO_MATCH = 1169,
+ ERROR_SET_NOT_FOUND = 1170,
+ ERROR_POINT_NOT_FOUND = 1171,
+ ERROR_NO_TRACKING_SERVICE = 1172,
+ ERROR_NO_VOLUME_ID = 1173,
+ ERROR_UNABLE_TO_REMOVE_REPLACED = 1175,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT = 1176,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = 1177,
+ ERROR_JOURNAL_DELETE_IN_PROGRESS = 1178,
+ ERROR_JOURNAL_NOT_ACTIVE = 1179,
+ ERROR_POTENTIAL_FILE_FOUND = 1180,
+ ERROR_JOURNAL_ENTRY_DELETED = 1181,
+ ERROR_BAD_DEVICE = 1200,
+ ERROR_CONNECTION_UNAVAIL = 1201,
+ ERROR_DEVICE_ALREADY_REMEMBERED = 1202,
+ ERROR_NO_NET_OR_BAD_PATH = 1203,
+ ERROR_BAD_PROVIDER = 1204,
+ ERROR_CANNOT_OPEN_PROFILE = 1205,
+ ERROR_BAD_PROFILE = 1206,
+ ERROR_NOT_CONTAINER = 1207,
+ ERROR_EXTENDED_ERROR = 1208,
+ ERROR_INVALID_GROUPNAME = 1209,
+ ERROR_INVALID_COMPUTERNAME = 1210,
+ ERROR_INVALID_EVENTNAME = 1211,
+ ERROR_INVALID_DOMAINNAME = 1212,
+ ERROR_INVALID_SERVICENAME = 1213,
+ ERROR_INVALID_NETNAME = 1214,
+ ERROR_INVALID_SHARENAME = 1215,
+ ERROR_INVALID_PASSWORDNAME = 1216,
+ ERROR_INVALID_MESSAGENAME = 1217,
+ ERROR_INVALID_MESSAGEDEST = 1218,
+ ERROR_SESSION_CREDENTIAL_CONFLICT = 1219,
+ ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220,
+ ERROR_DUP_DOMAINNAME = 1221,
+ ERROR_NO_NETWORK = 1222,
+ ERROR_CANCELLED = 1223,
+ ERROR_USER_MAPPED_FILE = 1224,
+ ERROR_CONNECTION_REFUSED = 1225,
+ ERROR_GRACEFUL_DISCONNECT = 1226,
+ ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227,
+ ERROR_ADDRESS_NOT_ASSOCIATED = 1228,
+ ERROR_CONNECTION_INVALID = 1229,
+ ERROR_CONNECTION_ACTIVE = 1230,
+ ERROR_NETWORK_UNREACHABLE = 1231,
+ ERROR_HOST_UNREACHABLE = 1232,
+ ERROR_PROTOCOL_UNREACHABLE = 1233,
+ ERROR_PORT_UNREACHABLE = 1234,
+ ERROR_REQUEST_ABORTED = 1235,
+ ERROR_CONNECTION_ABORTED = 1236,
+ ERROR_RETRY = 1237,
+ ERROR_CONNECTION_COUNT_LIMIT = 1238,
+ ERROR_LOGIN_TIME_RESTRICTION = 1239,
+ ERROR_LOGIN_WKSTA_RESTRICTION = 1240,
+ ERROR_INCORRECT_ADDRESS = 1241,
+ ERROR_ALREADY_REGISTERED = 1242,
+ ERROR_SERVICE_NOT_FOUND = 1243,
+ ERROR_NOT_AUTHENTICATED = 1244,
+ ERROR_NOT_LOGGED_ON = 1245,
+ ERROR_CONTINUE = 1246,
+ ERROR_ALREADY_INITIALIZED = 1247,
+ ERROR_NO_MORE_DEVICES = 1248,
+ ERROR_NO_SUCH_SITE = 1249,
+ ERROR_DOMAIN_CONTROLLER_EXISTS = 1250,
+ ERROR_ONLY_IF_CONNECTED = 1251,
+ ERROR_OVERRIDE_NOCHANGES = 1252,
+ ERROR_BAD_USER_PROFILE = 1253,
+ ERROR_NOT_SUPPORTED_ON_SBS = 1254,
+ ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255,
+ ERROR_HOST_DOWN = 1256,
+ ERROR_NON_ACCOUNT_SID = 1257,
+ ERROR_NON_DOMAIN_SID = 1258,
+ ERROR_APPHELP_BLOCK = 1259,
+ ERROR_ACCESS_DISABLED_BY_POLICY = 1260,
+ ERROR_REG_NAT_CONSUMPTION = 1261,
+ ERROR_CSCSHARE_OFFLINE = 1262,
+ ERROR_PKINIT_FAILURE = 1263,
+ ERROR_SMARTCARD_SUBSYSTEM_FAILURE = 1264,
+ ERROR_DOWNGRADE_DETECTED = 1265,
+ SEC_E_SMARTCARD_CERT_REVOKED = 1266,
+ SEC_E_ISSUING_CA_UNTRUSTED = 1267,
+ SEC_E_REVOCATION_OFFLINE_C = 1268,
+ SEC_E_PKINIT_CLIENT_FAILUR = 1269,
+ SEC_E_SMARTCARD_CERT_EXPIRED = 1270,
+ ERROR_MACHINE_LOCKED = 1271,
+ ERROR_CALLBACK_SUPPLIED_INVALID_DATA = 1273,
+ ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED = 1274,
+ ERROR_DRIVER_BLOCKED = 1275,
+ ERROR_INVALID_IMPORT_OF_NON_DLL = 1276,
+ ERROR_NOT_ALL_ASSIGNED = 1300,
+ ERROR_SOME_NOT_MAPPED = 1301,
+ ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302,
+ ERROR_LOCAL_USER_SESSION_KEY = 1303,
+ ERROR_NULL_LM_PASSWORD = 1304,
+ ERROR_UNKNOWN_REVISION = 1305,
+ ERROR_REVISION_MISMATCH = 1306,
+ ERROR_INVALID_OWNER = 1307,
+ ERROR_INVALID_PRIMARY_GROUP = 1308,
+ ERROR_NO_IMPERSONATION_TOKEN = 1309,
+ ERROR_CANT_DISABLE_MANDATORY = 1310,
+ ERROR_NO_LOGON_SERVERS = 1311,
+ ERROR_NO_SUCH_LOGON_SESSION = 1312,
+ ERROR_NO_SUCH_PRIVILEGE = 1313,
+ ERROR_PRIVILEGE_NOT_HELD = 1314,
+ ERROR_INVALID_ACCOUNT_NAME = 1315,
+ ERROR_USER_EXISTS = 1316,
+ ERROR_NO_SUCH_USER = 1317,
+ ERROR_GROUP_EXISTS = 1318,
+ ERROR_NO_SUCH_GROUP = 1319,
+ ERROR_MEMBER_IN_GROUP = 1320,
+ ERROR_MEMBER_NOT_IN_GROUP = 1321,
+ ERROR_LAST_ADMIN = 1322,
+ ERROR_WRONG_PASSWORD = 1323,
+ ERROR_ILL_FORMED_PASSWORD = 1324,
+ ERROR_PASSWORD_RESTRICTION = 1325,
+ ERROR_LOGON_FAILURE = 1326,
+ ERROR_ACCOUNT_RESTRICTION = 1327,
+ ERROR_INVALID_LOGON_HOURS = 1328,
+ ERROR_INVALID_WORKSTATION = 1329,
+ ERROR_PASSWORD_EXPIRED = 1330,
+ ERROR_ACCOUNT_DISABLED = 1331,
+ ERROR_NONE_MAPPED = 1332,
+ ERROR_TOO_MANY_LUIDS_REQUESTED = 1333,
+ ERROR_LUIDS_EXHAUSTED = 1334,
+ ERROR_INVALID_SUB_AUTHORITY = 1335,
+ ERROR_INVALID_ACL = 1336,
+ ERROR_INVALID_SID = 1337,
+ ERROR_INVALID_SECURITY_DESCR = 1338,
+ ERROR_BAD_INHERITANCE_ACL = 1340,
+ ERROR_SERVER_DISABLED = 1341,
+ ERROR_SERVER_NOT_DISABLED = 1342,
+ ERROR_INVALID_ID_AUTHORITY = 1343,
+ ERROR_ALLOTTED_SPACE_EXCEEDED = 1344,
+ ERROR_INVALID_GROUP_ATTRIBUTES = 1345,
+ ERROR_BAD_IMPERSONATION_LEVEL = 1346,
+ ERROR_CANT_OPEN_ANONYMOUS = 1347,
+ ERROR_BAD_VALIDATION_CLASS = 1348,
+ ERROR_BAD_TOKEN_TYPE = 1349,
+ ERROR_NO_SECURITY_ON_OBJECT = 1350,
+ ERROR_CANT_ACCESS_DOMAIN_INFO = 1351,
+ ERROR_INVALID_SERVER_STATE = 1352,
+ ERROR_INVALID_DOMAIN_STATE = 1353,
+ ERROR_INVALID_DOMAIN_ROLE = 1354,
+ ERROR_NO_SUCH_DOMAIN = 1355,
+ ERROR_DOMAIN_EXISTS = 1356,
+ ERROR_DOMAIN_LIMIT_EXCEEDED = 1357,
+ ERROR_INTERNAL_DB_CORRUPTION = 1358,
+ ERROR_INTERNAL_ERROR = 1359,
+ ERROR_GENERIC_NOT_MAPPED = 1360,
+ ERROR_BAD_DESCRIPTOR_FORMAT = 1361,
+ ERROR_NOT_LOGON_PROCESS = 1362,
+ ERROR_LOGON_SESSION_EXISTS = 1363,
+ ERROR_NO_SUCH_PACKAGE = 1364,
+ ERROR_BAD_LOGON_SESSION_STATE = 1365,
+ ERROR_LOGON_SESSION_COLLISION = 1366,
+ ERROR_INVALID_LOGON_TYPE = 1367,
+ ERROR_CANNOT_IMPERSONATE = 1368,
+ ERROR_RXACT_INVALID_STATE = 1369,
+ ERROR_RXACT_COMMIT_FAILURE = 1370,
+ ERROR_SPECIAL_ACCOUNT = 1371,
+ ERROR_SPECIAL_GROUP = 1372,
+ ERROR_SPECIAL_USER = 1373,
+ ERROR_MEMBERS_PRIMARY_GROUP = 1374,
+ ERROR_TOKEN_ALREADY_IN_USE = 1375,
+ ERROR_NO_SUCH_ALIAS = 1376,
+ ERROR_MEMBER_NOT_IN_ALIAS = 1377,
+ ERROR_MEMBER_IN_ALIAS = 1378,
+ ERROR_ALIAS_EXISTS = 1379,
+ ERROR_LOGON_NOT_GRANTED = 1380,
+ ERROR_TOO_MANY_SECRETS = 1381,
+ ERROR_SECRET_TOO_LONG = 1382,
+ ERROR_INTERNAL_DB_ERROR = 1383,
+ ERROR_TOO_MANY_CONTEXT_IDS = 1384,
+ ERROR_LOGON_TYPE_NOT_GRANTED = 1385,
+ ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386,
+ ERROR_NO_SUCH_MEMBER = 1387,
+ ERROR_INVALID_MEMBER = 1388,
+ ERROR_TOO_MANY_SIDS = 1389,
+ ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390,
+ ERROR_NO_INHERITANCE = 1391,
+ ERROR_FILE_CORRUPT = 1392,
+ ERROR_DISK_CORRUPT = 1393,
+ ERROR_NO_USER_SESSION_KEY = 1394,
+ ERROR_LICENSE_QUOTA_EXCEEDED = 1395,
+ ERROR_WRONG_TARGET_NAME = 1396,
+ ERROR_MUTUAL_AUTH_FAILED = 1397,
+ ERROR_TIME_SKEW = 1398,
+ ERROR_CURRENT_DOMAIN_NOT_ALLOWED = 1399,
+ ERROR_INVALID_WINDOW_HANDLE = 1400,
+ ERROR_INVALID_MENU_HANDLE = 1401,
+ ERROR_INVALID_CURSOR_HANDLE = 1402,
+ ERROR_INVALID_ACCEL_HANDLE = 1403,
+ ERROR_INVALID_HOOK_HANDLE = 1404,
+ ERROR_INVALID_DWP_HANDLE = 1405,
+ ERROR_TLW_WITH_WSCHILD = 1406,
+ ERROR_CANNOT_FIND_WND_CLASS = 1407,
+ ERROR_WINDOW_OF_OTHER_THREAD = 1408,
+ ERROR_HOTKEY_ALREADY_REGISTERED = 1409,
+ ERROR_CLASS_ALREADY_EXISTS = 1410,
+ ERROR_CLASS_DOES_NOT_EXIST = 1411,
+ ERROR_CLASS_HAS_WINDOWS = 1412,
+ ERROR_INVALID_INDEX = 1413,
+ ERROR_INVALID_ICON_HANDLE = 1414,
+ ERROR_PRIVATE_DIALOG_INDEX = 1415,
+ ERROR_LISTBOX_ID_NOT_FOUND = 1416,
+ ERROR_NO_WILDCARD_CHARACTERS = 1417,
+ ERROR_CLIPBOARD_NOT_OPEN = 1418,
+ ERROR_HOTKEY_NOT_REGISTERED = 1419,
+ ERROR_WINDOW_NOT_DIALOG = 1420,
+ ERROR_CONTROL_ID_NOT_FOUND = 1421,
+ ERROR_INVALID_COMBOBOX_MESSAGE = 1422,
+ ERROR_WINDOW_NOT_COMBOBOX = 1423,
+ ERROR_INVALID_EDIT_HEIGHT = 1424,
+ ERROR_DC_NOT_FOUND = 1425,
+ ERROR_INVALID_HOOK_FILTER = 1426,
+ ERROR_INVALID_FILTER_PROC = 1427,
+ ERROR_HOOK_NEEDS_HMOD = 1428,
+ ERROR_GLOBAL_ONLY_HOOK = 1429,
+ ERROR_JOURNAL_HOOK_SET = 1430,
+ ERROR_HOOK_NOT_INSTALLED = 1431,
+ ERROR_INVALID_LB_MESSAGE = 1432,
+ ERROR_SETCOUNT_ON_BAD_LB = 1433,
+ ERROR_LB_WITHOUT_TABSTOPS = 1434,
+ ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435,
+ ERROR_CHILD_WINDOW_MENU = 1436,
+ ERROR_NO_SYSTEM_MENU = 1437,
+ ERROR_INVALID_MSGBOX_STYLE = 1438,
+ ERROR_INVALID_SPI_VALUE = 1439,
+ ERROR_SCREEN_ALREADY_LOCKED = 1440,
+ ERROR_HWNDS_HAVE_DIFF_PARENT = 1441,
+ ERROR_NOT_CHILD_WINDOW = 1442,
+ ERROR_INVALID_GW_COMMAND = 1443,
+ ERROR_INVALID_THREAD_ID = 1444,
+ ERROR_NON_MDICHILD_WINDOW = 1445,
+ ERROR_POPUP_ALREADY_ACTIVE = 1446,
+ ERROR_NO_SCROLLBARS = 1447,
+ ERROR_INVALID_SCROLLBAR_RANGE = 1448,
+ ERROR_INVALID_SHOWWIN_COMMAND = 1449,
+ ERROR_NO_SYSTEM_RESOURCES = 1450,
+ ERROR_NONPAGED_SYSTEM_RESOURCES = 1451,
+ ERROR_PAGED_SYSTEM_RESOURCES = 1452,
+ ERROR_WORKING_SET_QUOTA = 1453,
+ ERROR_PAGEFILE_QUOTA = 1454,
+ ERROR_COMMITMENT_LIMIT = 1455,
+ ERROR_MENU_ITEM_NOT_FOUND = 1456,
+ ERROR_INVALID_KEYBOARD_HANDLE = 1457,
+ ERROR_HOOK_TYPE_NOT_ALLOWED = 1458,
+ ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459,
+ ERROR_TIMEOUT = 1460,
+ ERROR_INVALID_MONITOR_HANDLE = 1461,
+ ERROR_EVENTLOG_FILE_CORRUPT = 1500,
+ ERROR_EVENTLOG_CANT_START = 1501,
+ ERROR_LOG_FILE_FULL = 1502,
+ ERROR_EVENTLOG_FILE_CHANGED = 1503,
+ ERROR_INSTALL_SERVICE_FAILURE = 1601,
+ ERROR_INSTALL_USEREXIT = 1602,
+ ERROR_INSTALL_FAILURE = 1603,
+ ERROR_INSTALL_SUSPEND = 1604,
+ ERROR_UNKNOWN_PRODUCT = 1605,
+ ERROR_UNKNOWN_FEATURE = 1606,
+ ERROR_UNKNOWN_COMPONENT = 1607,
+ ERROR_UNKNOWN_PROPERTY = 1608,
+ ERROR_INVALID_HANDLE_STATE = 1609,
+ ERROR_BAD_CONFIGURATION = 1610,
+ ERROR_INDEX_ABSENT = 1611,
+ ERROR_INSTALL_SOURCE_ABSENT = 1612,
+ ERROR_INSTALL_PACKAGE_VERSION = 1613,
+ ERROR_PRODUCT_UNINSTALLED = 1614,
+ ERROR_BAD_QUERY_SYNTAX = 1615,
+ ERROR_INVALID_FIELD = 1616,
+ ERROR_DEVICE_REMOVED = 1617,
+ ERROR_INSTALL_ALREADY_RUNNING = 1618,
+ ERROR_INSTALL_PACKAGE_OPEN_FAILED = 1619,
+ ERROR_INSTALL_PACKAGE_INVALID = 1620,
+ ERROR_INSTALL_UI_FAILURE = 1621,
+ ERROR_INSTALL_LOG_FAILURE = 1622,
+ ERROR_INSTALL_LANGUAGE_UNSUPPORTED = 1623,
+ ERROR_INSTALL_TRANSFORM_FAILURE = 1624,
+ ERROR_INSTALL_PACKAGE_REJECTED = 1625,
+ ERROR_FUNCTION_NOT_CALLED = 1626,
+ ERROR_FUNCTION_FAILED = 1627,
+ ERROR_INVALID_TABLE = 1628,
+ ERROR_DATATYPE_MISMATCH = 1629,
+ ERROR_UNSUPPORTED_TYPE = 1630,
+ ERROR_CREATE_FAILED = 1631,
+ ERROR_INSTALL_TEMP_UNWRITABLE = 1632,
+ ERROR_INSTALL_PLATFORM_UNSUPPORTED = 1633,
+ ERROR_INSTALL_NOTUSED = 1634,
+ ERROR_PATCH_PACKAGE_OPEN_FAILED = 1635,
+ ERROR_PATCH_PACKAGE_INVALID = 1636,
+ ERROR_PATCH_PACKAGE_UNSUPPORTED = 1637,
+ ERROR_PRODUCT_VERSION = 1638,
+ ERROR_INVALID_COMMAND_LINE = 1639,
+ ERROR_INSTALL_REMOTE_DISALLOWED = 1640,
+ ERROR_SUCCESS_REBOOT_INITIATED = 1641,
+ ERROR_PATCH_TARGET_NOT_FOUND = 1642,
+ ERROR_PATCH_PACKAGE_REJECTED = 1643,
+ ERROR_INSTALL_TRANSFORM_REJECTED = 1644,
+ RPC_S_INVALID_STRING_BINDING = 1700,
+ RPC_S_WRONG_KIND_OF_BINDING = 1701,
+ RPC_S_INVALID_BINDING = 1702,
+ RPC_S_PROTSEQ_NOT_SUPPORTED = 1703,
+ RPC_S_INVALID_RPC_PROTSEQ = 1704,
+ RPC_S_INVALID_STRING_UUID = 1705,
+ RPC_S_INVALID_ENDPOINT_FORMAT = 1706,
+ RPC_S_INVALID_NET_ADDR = 1707,
+ RPC_S_NO_ENDPOINT_FOUND = 1708,
+ RPC_S_INVALID_TIMEOUT = 1709,
+ RPC_S_OBJECT_NOT_FOUND = 1710,
+ RPC_S_ALREADY_REGISTERED = 1711,
+ RPC_S_TYPE_ALREADY_REGISTERED = 1712,
+ RPC_S_ALREADY_LISTENING = 1713,
+ RPC_S_NO_PROTSEQS_REGISTERED = 1714,
+ RPC_S_NOT_LISTENING = 1715,
+ RPC_S_UNKNOWN_MGR_TYPE = 1716,
+ RPC_S_UNKNOWN_IF = 1717,
+ RPC_S_NO_BINDINGS = 1718,
+ RPC_S_NO_PROTSEQS = 1719,
+ RPC_S_CANT_CREATE_ENDPOINT = 1720,
+ RPC_S_OUT_OF_RESOURCES = 1721,
+ RPC_S_SERVER_UNAVAILABLE = 1722,
+ RPC_S_SERVER_TOO_BUSY = 1723,
+ RPC_S_INVALID_NETWORK_OPTIONS = 1724,
+ RPC_S_NO_CALL_ACTIVE = 1725,
+ RPC_S_CALL_FAILED = 1726,
+ RPC_S_CALL_FAILED_DNE = 1727,
+ RPC_S_PROTOCOL_ERROR = 1728,
+ RPC_S_UNSUPPORTED_TRANS_SYN = 1730,
+ RPC_S_UNSUPPORTED_TYPE = 1732,
+ RPC_S_INVALID_TAG = 1733,
+ RPC_S_INVALID_BOUND = 1734,
+ RPC_S_NO_ENTRY_NAME = 1735,
+ RPC_S_INVALID_NAME_SYNTAX = 1736,
+ RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737,
+ RPC_S_UUID_NO_ADDRESS = 1739,
+ RPC_S_DUPLICATE_ENDPOINT = 1740,
+ RPC_S_UNKNOWN_AUTHN_TYPE = 1741,
+ RPC_S_MAX_CALLS_TOO_SMALL = 1742,
+ RPC_S_STRING_TOO_LONG = 1743,
+ RPC_S_PROTSEQ_NOT_FOUND = 1744,
+ RPC_S_PROCNUM_OUT_OF_RANGE = 1745,
+ RPC_S_BINDING_HAS_NO_AUTH = 1746,
+ RPC_S_UNKNOWN_AUTHN_SERVICE = 1747,
+ RPC_S_UNKNOWN_AUTHN_LEVEL = 1748,
+ RPC_S_INVALID_AUTH_IDENTITY = 1749,
+ RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750,
+ EPT_S_INVALID_ENTRY = 1751,
+ EPT_S_CANT_PERFORM_OP = 1752,
+ EPT_S_NOT_REGISTERED = 1753,
+ RPC_S_NOTHING_TO_EXPORT = 1754,
+ RPC_S_INCOMPLETE_NAME = 1755,
+ RPC_S_INVALID_VERS_OPTION = 1756,
+ RPC_S_NO_MORE_MEMBERS = 1757,
+ RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758,
+ RPC_S_INTERFACE_NOT_FOUND = 1759,
+ RPC_S_ENTRY_ALREADY_EXISTS = 1760,
+ RPC_S_ENTRY_NOT_FOUND = 1761,
+ RPC_S_NAME_SERVICE_UNAVAILABLE = 1762,
+ RPC_S_INVALID_NAF_ID = 1763,
+ RPC_S_CANNOT_SUPPORT = 1764,
+ RPC_S_NO_CONTEXT_AVAILABLE = 1765,
+ RPC_S_INTERNAL_ERROR = 1766,
+ RPC_S_ZERO_DIVIDE = 1767,
+ RPC_S_ADDRESS_ERROR = 1768,
+ RPC_S_FP_DIV_ZERO = 1769,
+ RPC_S_FP_UNDERFLOW = 1770,
+ RPC_S_FP_OVERFLOW = 1771,
+ RPC_X_NO_MORE_ENTRIES = 1772,
+ RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773,
+ RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774,
+ RPC_X_SS_IN_NULL_CONTEXT = 1775,
+ RPC_X_SS_CONTEXT_DAMAGED = 1777,
+ RPC_X_SS_HANDLES_MISMATCH = 1778,
+ RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779,
+ RPC_X_NULL_REF_POINTER = 1780,
+ RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781,
+ RPC_X_BYTE_COUNT_TOO_SMALL = 1782,
+ RPC_X_BAD_STUB_DATA = 1783,
+ ERROR_INVALID_USER_BUFFER = 1784,
+ ERROR_UNRECOGNIZED_MEDIA = 1785,
+ ERROR_NO_TRUST_LSA_SECRET = 1786,
+ ERROR_NO_TRUST_SAM_ACCOUNT = 1787,
+ ERROR_TRUSTED_DOMAIN_FAILURE = 1788,
+ ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789,
+ ERROR_TRUST_FAILURE = 1790,
+ RPC_S_CALL_IN_PROGRESS = 1791,
+ ERROR_NETLOGON_NOT_STARTED = 1792,
+ ERROR_ACCOUNT_EXPIRED = 1793,
+ ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794,
+ ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795,
+ ERROR_UNKNOWN_PORT = 1796,
+ ERROR_UNKNOWN_PRINTER_DRIVER = 1797,
+ ERROR_UNKNOWN_PRINTPROCESSOR = 1798,
+ ERROR_INVALID_SEPARATOR_FILE = 1799,
+ ERROR_INVALID_PRIORITY = 1800,
+ ERROR_INVALID_PRINTER_NAME = 1801,
+ ERROR_PRINTER_ALREADY_EXISTS = 1802,
+ ERROR_INVALID_PRINTER_COMMAND = 1803,
+ ERROR_INVALID_DATATYPE = 1804,
+ ERROR_INVALID_ENVIRONMENT = 1805,
+ RPC_S_NO_MORE_BINDINGS = 1806,
+ ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807,
+ ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808,
+ ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809,
+ ERROR_DOMAIN_TRUST_INCONSISTENT = 1810,
+ ERROR_SERVER_HAS_OPEN_HANDLES = 1811,
+ ERROR_RESOURCE_DATA_NOT_FOUND = 1812,
+ ERROR_RESOURCE_TYPE_NOT_FOUND = 1813,
+ ERROR_RESOURCE_NAME_NOT_FOUND = 1814,
+ ERROR_RESOURCE_LANG_NOT_FOUND = 1815,
+ ERROR_NOT_ENOUGH_QUOTA = 1816,
+ RPC_S_NO_INTERFACES = 1817,
+ RPC_S_CALL_CANCELLED = 1818,
+ RPC_S_BINDING_INCOMPLETE = 1819,
+ RPC_S_COMM_FAILURE = 1820,
+ RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821,
+ RPC_S_NO_PRINC_NAME = 1822,
+ RPC_S_NOT_RPC_ERROR = 1823,
+ RPC_S_UUID_LOCAL_ONLY = 1824,
+ RPC_S_SEC_PKG_ERROR = 1825,
+ RPC_S_NOT_CANCELLED = 1826,
+ RPC_X_INVALID_ES_ACTION = 1827,
+ RPC_X_WRONG_ES_VERSION = 1828,
+ RPC_X_WRONG_STUB_VERSION = 1829,
+ RPC_X_INVALID_PIPE_OBJECT = 1830,
+ RPC_X_WRONG_PIPE_ORDER = 1831,
+ RPC_X_WRONG_PIPE_VERSION = 1832,
+ RPC_S_GROUP_MEMBER_NOT_FOUND = 1898,
+ EPT_S_CANT_CREATE = 1899,
+ RPC_S_INVALID_OBJECT = 1900,
+ ERROR_INVALID_TIME = 1901,
+ ERROR_INVALID_FORM_NAME = 1902,
+ ERROR_INVALID_FORM_SIZE = 1903,
+ ERROR_ALREADY_WAITING = 1904,
+ ERROR_PRINTER_DELETED = 1905,
+ ERROR_INVALID_PRINTER_STATE = 1906,
+ ERROR_PASSWORD_MUST_CHANGE = 1907,
+ ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908,
+ ERROR_ACCOUNT_LOCKED_OUT = 1909,
+ OR_INVALID_OXID = 1910,
+ OR_INVALID_OID = 1911,
+ OR_INVALID_SET = 1912,
+ RPC_S_SEND_INCOMPLETE = 1913,
+ RPC_S_INVALID_ASYNC_HANDLE = 1914,
+ RPC_S_INVALID_ASYNC_CALL = 1915,
+ RPC_X_PIPE_CLOSED = 1916,
+ RPC_X_PIPE_DISCIPLINE_ERROR = 1917,
+ RPC_X_PIPE_EMPTY = 1918,
+ ERROR_NO_SITENAME = 1919,
+ ERROR_CANT_ACCESS_FILE = 1920,
+ ERROR_CANT_RESOLVE_FILENAME = 1921,
+ RPC_S_ENTRY_TYPE_MISMATCH = 1922,
+ RPC_S_NOT_ALL_OBJS_EXPORTED = 1923,
+ RPC_S_INTERFACE_NOT_EXPORTED = 1924,
+ RPC_S_PROFILE_NOT_ADDED = 1925,
+ RPC_S_PRF_ELT_NOT_ADDED = 1926,
+ RPC_S_PRF_ELT_NOT_REMOVED = 1927,
+ RPC_S_GRP_ELT_NOT_ADDED = 1928,
+ RPC_S_GRP_ELT_NOT_REMOVED = 1929,
+ ERROR_KM_DRIVER_BLOCKED = 1930,
+ ERROR_CONTEXT_EXPIRED = 1931,
+ ERROR_INVALID_PIXEL_FORMAT = 2000,
+ ERROR_BAD_DRIVER = 2001,
+ ERROR_INVALID_WINDOW_STYLE = 2002,
+ ERROR_METAFILE_NOT_SUPPORTED = 2003,
+ ERROR_TRANSFORM_NOT_SUPPORTED = 2004,
+ ERROR_CLIPPING_NOT_SUPPORTED = 2005,
+ ERROR_INVALID_CMM = 2010,
+ ERROR_INVALID_PROFILE = 2011,
+ ERROR_TAG_NOT_FOUND = 2012,
+ ERROR_TAG_NOT_PRESENT = 2013,
+ ERROR_DUPLICATE_TAG = 2014,
+ ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015,
+ ERROR_PROFILE_NOT_FOUND = 2016,
+ ERROR_INVALID_COLORSPACE = 2017,
+ ERROR_ICM_NOT_ENABLED = 2018,
+ ERROR_DELETING_ICM_XFORM = 2019,
+ ERROR_INVALID_TRANSFORM = 2020,
+ ERROR_COLORSPACE_MISMATCH = 2021,
+ ERROR_INVALID_COLORINDEX = 2022,
+ ERROR_CONNECTED_OTHER_PASSWORD = 2108,
+ ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT = 2109,
+ ERROR_BAD_USERNAME = 2202,
+ ERROR_NOT_CONNECTED = 2250,
+ ERROR_OPEN_FILES = 2401,
+ ERROR_ACTIVE_CONNECTIONS = 2402,
+ ERROR_DEVICE_IN_USE = 2404,
+ ERROR_UNKNOWN_PRINT_MONITOR = 3000,
+ ERROR_PRINTER_DRIVER_IN_USE = 3001,
+ ERROR_SPOOL_FILE_NOT_FOUND = 3002,
+ ERROR_SPL_NO_STARTDOC = 3003,
+ ERROR_SPL_NO_ADDJOB = 3004,
+ ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005,
+ ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006,
+ ERROR_INVALID_PRINT_MONITOR = 3007,
+ ERROR_PRINT_MONITOR_IN_USE = 3008,
+ ERROR_PRINTER_HAS_JOBS_QUEUED = 3009,
+ ERROR_SUCCESS_REBOOT_REQUIRED = 3010,
+ ERROR_SUCCESS_RESTART_REQUIRED = 3011,
+ ERROR_PRINTER_NOT_FOUND = 3012,
+ ERROR_PRINTER_DRIVER_WARNED = 3013,
+ ERROR_PRINTER_DRIVER_BLOCKED = 3014,
+ ERROR_WINS_INTERNAL = 4000,
+ ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001,
+ ERROR_STATIC_INIT = 4002,
+ ERROR_INC_BACKUP = 4003,
+ ERROR_FULL_BACKUP = 4004,
+ ERROR_REC_NON_EXISTENT = 4005,
+ ERROR_RPL_NOT_ALLOWED = 4006,
+ ERROR_DHCP_ADDRESS_CONFLICT = 4100,
+ ERROR_WMI_GUID_NOT_FOUND = 4200,
+ ERROR_WMI_INSTANCE_NOT_FOUND = 4201,
+ ERROR_WMI_ITEMID_NOT_FOUND = 4202,
+ ERROR_WMI_TRY_AGAIN = 4203,
+ ERROR_WMI_DP_NOT_FOUND = 4204,
+ ERROR_WMI_UNRESOLVED_INSTANCE_REF = 4205,
+ ERROR_WMI_ALREADY_ENABLED = 4206,
+ ERROR_WMI_GUID_DISCONNECTED = 4207,
+ ERROR_WMI_SERVER_UNAVAILABLE = 4208,
+ ERROR_WMI_DP_FAILED = 4209,
+ ERROR_WMI_INVALID_MOF = 4210,
+ ERROR_WMI_INVALID_REGINFO = 4211,
+ ERROR_WMI_ALREADY_DISABLED = 4212,
+ ERROR_WMI_READ_ONLY = 4213,
+ ERROR_WMI_SET_FAILURE = 4214,
+ ERROR_INVALID_MEDIA = 4300,
+ ERROR_INVALID_LIBRARY = 4301,
+ ERROR_INVALID_MEDIA_POOL = 4302,
+ ERROR_DRIVE_MEDIA_MISMATCH = 4303,
+ ERROR_MEDIA_OFFLINE = 4304,
+ ERROR_LIBRARY_OFFLINE = 4305,
+ ERROR_EMPTY = 4306,
+ ERROR_NOT_EMPTY = 4307,
+ ERROR_MEDIA_UNAVAILABLE = 4308,
+ ERROR_RESOURCE_DISABLED = 4309,
+ ERROR_INVALID_CLEANER = 4310,
+ ERROR_UNABLE_TO_CLEAN = 4311,
+ ERROR_OBJECT_NOT_FOUND = 4312,
+ ERROR_DATABASE_FAILURE = 4313,
+ ERROR_DATABASE_FULL = 4314,
+ ERROR_MEDIA_INCOMPATIBLE = 4315,
+ ERROR_RESOURCE_NOT_PRESENT = 4316,
+ ERROR_INVALID_OPERATION = 4317,
+ ERROR_MEDIA_NOT_AVAILABLE = 4318,
+ ERROR_DEVICE_NOT_AVAILABLE = 4319,
+ ERROR_REQUEST_REFUSED = 4320,
+ ERROR_INVALID_DRIVE_OBJECT = 4321,
+ ERROR_LIBRARY_FULL = 4322,
+ ERROR_MEDIUM_NOT_ACCESSIBLE = 4323,
+ ERROR_UNABLE_TO_LOAD_MEDIUM = 4324,
+ ERROR_UNABLE_TO_INVENTORY_DRIVE = 4325,
+ ERROR_UNABLE_TO_INVENTORY_SLOT = 4326,
+ ERROR_UNABLE_TO_INVENTORY_TRANSPORT = 4327,
+ ERROR_TRANSPORT_FULL = 4328,
+ ERROR_CONTROLLING_IEPORT = 4329,
+ ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA = 4330,
+ ERROR_CLEANER_SLOT_SET = 4331,
+ ERROR_CLEANER_SLOT_NOT_SET = 4332,
+ ERROR_CLEANER_CARTRIDGE_SPENT = 4333,
+ ERROR_UNEXPECTED_OMID = 4334,
+ ERROR_CANT_DELETE_LAST_ITEM = 4335,
+ ERROR_MESSAGE_EXCEEDS_MAX_SIZE = 4336,
+ ERROR_VOLUME_CONTAINS_SYS_FILES = 4337,
+ ERROR_INDIGENOUS_TYPE = 4338,
+ ERROR_NO_SUPPORTING_DRIVES = 4339,
+ ERROR_CLEANER_CARTRIDGE_INSTALLED = 4340,
+ ERROR_FILE_OFFLINE = 4350,
+ ERROR_REMOTE_STORAGE_NOT_ACTIVE = 4351,
+ ERROR_REMOTE_STORAGE_MEDIA_ERROR = 4352,
+ ERROR_NOT_A_REPARSE_POINT = 4390,
+ ERROR_REPARSE_ATTRIBUTE_CONFLICT = 4391,
+ ERROR_INVALID_REPARSE_DATA = 4392,
+ ERROR_REPARSE_TAG_INVALID = 4393,
+ ERROR_REPARSE_TAG_MISMATCH = 4394,
+ ERROR_VOLUME_NOT_SIS_ENABLED = 4500,
+ ERROR_DEPENDENT_RESOURCE_EXISTS = 5001,
+ ERROR_DEPENDENCY_NOT_FOUND = 5002,
+ ERROR_DEPENDENCY_ALREADY_EXISTS = 5003,
+ ERROR_RESOURCE_NOT_ONLINE = 5004,
+ ERROR_HOST_NODE_NOT_AVAILABLE = 5005,
+ ERROR_RESOURCE_NOT_AVAILABLE = 5006,
+ ERROR_RESOURCE_NOT_FOUND = 5007,
+ ERROR_SHUTDOWN_CLUSTER = 5008,
+ ERROR_CANT_EVICT_ACTIVE_NODE = 5009,
+ ERROR_OBJECT_ALREADY_EXISTS = 5010,
+ ERROR_OBJECT_IN_LIST = 5011,
+ ERROR_GROUP_NOT_AVAILABLE = 5012,
+ ERROR_GROUP_NOT_FOUND = 5013,
+ ERROR_GROUP_NOT_ONLINE = 5014,
+ ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015,
+ ERROR_HOST_NODE_NOT_GROUP_OWNER = 5016,
+ ERROR_RESMON_CREATE_FAILED = 5017,
+ ERROR_RESMON_ONLINE_FAILED = 5018,
+ ERROR_RESOURCE_ONLINE = 5019,
+ ERROR_QUORUM_RESOURCE = 5020,
+ ERROR_NOT_QUORUM_CAPABLE = 5021,
+ ERROR_CLUSTER_SHUTTING_DOWN = 5022,
+ ERROR_INVALID_STATE = 5023,
+ ERROR_RESOURCE_PROPERTIES_STORED = 5024,
+ ERROR_NOT_QUORUM_CLASS = 5025,
+ ERROR_CORE_RESOURCE = 5026,
+ ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027,
+ ERROR_QUORUMLOG_OPEN_FAILED = 5028,
+ ERROR_CLUSTERLOG_CORRUPT = 5029,
+ ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE = 5030,
+ ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE = 5031,
+ ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND = 5032,
+ ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE = 5033,
+ ERROR_QUORUM_OWNER_ALIVE = 5034,
+ ERROR_NETWORK_NOT_AVAILABLE = 5035,
+ ERROR_NODE_NOT_AVAILABLE = 5036,
+ ERROR_ALL_NODES_NOT_AVAILABLE = 5037,
+ ERROR_RESOURCE_FAILED = 5038,
+ ERROR_CLUSTER_INVALID_NODE = 5039,
+ ERROR_CLUSTER_NODE_EXISTS = 5040,
+ ERROR_CLUSTER_JOIN_IN_PROGRESS = 5041,
+ ERROR_CLUSTER_NODE_NOT_FOUND = 5042,
+ ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND = 5043,
+ ERROR_CLUSTER_NETWORK_EXISTS = 5044,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND = 5045,
+ ERROR_CLUSTER_NETINTERFACE_EXISTS = 5046,
+ ERROR_CLUSTER_NETINTERFACE_NOT_FOUND = 5047,
+ ERROR_CLUSTER_INVALID_REQUEST = 5048,
+ ERROR_CLUSTER_INVALID_NETWORK_PROVIDER = 5049,
+ ERROR_CLUSTER_NODE_DOWN = 5050,
+ ERROR_CLUSTER_NODE_UNREACHABLE = 5051,
+ ERROR_CLUSTER_NODE_NOT_MEMBER = 5052,
+ ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS = 5053,
+ ERROR_CLUSTER_INVALID_NETWORK = 5054,
+ ERROR_CLUSTER_NODE_UP = 5056,
+ ERROR_CLUSTER_IPADDR_IN_USE = 5057,
+ ERROR_CLUSTER_NODE_NOT_PAUSED = 5058,
+ ERROR_CLUSTER_NO_SECURITY_CONTEXT = 5059,
+ ERROR_CLUSTER_NETWORK_NOT_INTERNAL = 5060,
+ ERROR_CLUSTER_NODE_ALREADY_UP = 5061,
+ ERROR_CLUSTER_NODE_ALREADY_DOWN = 5062,
+ ERROR_CLUSTER_NETWORK_ALREADY_ONLINE = 5063,
+ ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE = 5064,
+ ERROR_CLUSTER_NODE_ALREADY_MEMBER = 5065,
+ ERROR_CLUSTER_LAST_INTERNAL_NETWORK = 5066,
+ ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS = 5067,
+ ERROR_INVALID_OPERATION_ON_QUORUM = 5068,
+ ERROR_DEPENDENCY_NOT_ALLOWED = 5069,
+ ERROR_CLUSTER_NODE_PAUSED = 5070,
+ ERROR_NODE_CANT_HOST_RESOURCE = 5071,
+ ERROR_CLUSTER_NODE_NOT_READY = 5072,
+ ERROR_CLUSTER_NODE_SHUTTING_DOWN = 5073,
+ ERROR_CLUSTER_JOIN_ABORTED = 5074,
+ ERROR_CLUSTER_INCOMPATIBLE_VERSIONS = 5075,
+ ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076,
+ ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED = 5077,
+ ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078,
+ ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED = 5079,
+ ERROR_CLUSTER_RESNAME_NOT_FOUND = 5080,
+ ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED = 5081,
+ ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST = 5082,
+ ERROR_CLUSTER_DATABASE_SEQMISMATCH = 5083,
+ ERROR_RESMON_INVALID_STATE = 5084,
+ ERROR_CLUSTER_GUM_NOT_LOCKER = 5085,
+ ERROR_QUORUM_DISK_NOT_FOUND = 5086,
+ ERROR_DATABASE_BACKUP_CORRUPT = 5087,
+ ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT = 5088,
+ ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089,
+ ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE = 5890,
+ ERROR_CLUSTER_QUORUMLOG_NOT_FOUND = 5891,
+ ERROR_CLUSTER_MEMBERSHIP_HALT = 5892,
+ ERROR_CLUSTER_INSTANCE_ID_MISMATCH = 5893,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP = 5894,
+ ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH = 5895,
+ ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP = 5896,
+ ERROR_CLUSTER_PARAMETER_MISMATCH = 5897,
+ ERROR_NODE_CANNOT_BE_CLUSTERED = 5898,
+ ERROR_CLUSTER_WRONG_OS_VERSION = 5899,
+ ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900,
+ ERROR_ENCRYPTION_FAILED = 6000,
+ ERROR_DECRYPTION_FAILED = 6001,
+ ERROR_FILE_ENCRYPTED = 6002,
+ ERROR_NO_RECOVERY_POLICY = 6003,
+ ERROR_NO_EFS = 6004,
+ ERROR_WRONG_EFS = 6005,
+ ERROR_NO_USER_KEYS = 6006,
+ ERROR_FILE_NOT_ENCRYPTED = 6007,
+ ERROR_NOT_EXPORT_FORMAT = 6008,
+ ERROR_FILE_READ_ONLY = 6009,
+ ERROR_DIR_EFS_DISALLOWED = 6010,
+ ERROR_EFS_SERVER_NOT_TRUSTED = 6011,
+ ERROR_BAD_RECOVERY_POLICY = 6012,
+ ERROR_EFS_ALG_BLOB_TOO_BIG = 6013,
+ ERROR_VOLUME_NOT_SUPPORT_EFS = 6014,
+ ERROR_EFS_DISABLED = 6015,
+ ERROR_EFS_VERSION_NOT_SUPPORT = 6016,
+ ERROR_NO_BROWSER_SERVERS_FOUND = 6118,
+ SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200,
+ ERROR_CTX_WINSTATION_NAME_INVALID = 7001,
+ ERROR_CTX_INVALID_PD = 7002,
+ ERROR_CTX_PD_NOT_FOUND = 7003,
+ ERROR_CTX_WD_NOT_FOUND = 7004,
+ ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY = 7005,
+ ERROR_CTX_SERVICE_NAME_COLLISION = 7006,
+ ERROR_CTX_CLOSE_PENDING = 7007,
+ ERROR_CTX_NO_OUTBUF = 7008,
+ ERROR_CTX_MODEM_INF_NOT_FOUND = 7009,
+ ERROR_CTX_INVALID_MODEMNAME = 7010,
+ ERROR_CTX_MODEM_RESPONSE_ERROR = 7011,
+ ERROR_CTX_MODEM_RESPONSE_TIMEOUT = 7012,
+ ERROR_CTX_MODEM_RESPONSE_NO_CARRIER = 7013,
+ ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE = 7014,
+ ERROR_CTX_MODEM_RESPONSE_BUSY = 7015,
+ ERROR_CTX_MODEM_RESPONSE_VOICE = 7016,
+ ERROR_CTX_TD_ERROR = 7017,
+ ERROR_CTX_WINSTATION_NOT_FOUND = 7022,
+ ERROR_CTX_WINSTATION_ALREADY_EXISTS = 7023,
+ ERROR_CTX_WINSTATION_BUSY = 7024,
+ ERROR_CTX_BAD_VIDEO_MODE = 7025,
+ ERROR_CTX_GRAPHICS_INVALID = 7035,
+ ERROR_CTX_LOGON_DISABLED = 7037,
+ ERROR_CTX_NOT_CONSOLE = 7038,
+ ERROR_CTX_CLIENT_QUERY_TIMEOUT = 7040,
+ ERROR_CTX_CONSOLE_DISCONNECT = 7041,
+ ERROR_CTX_CONSOLE_CONNECT = 7042,
+ ERROR_CTX_SHADOW_DENIED = 7044,
+ ERROR_CTX_WINSTATION_ACCESS_DENIED = 7045,
+ ERROR_CTX_INVALID_WD = 7049,
+ ERROR_CTX_SHADOW_INVALID = 7050,
+ ERROR_CTX_SHADOW_DISABLED = 7051,
+ ERROR_CTX_CLIENT_LICENSE_IN_USE = 7052,
+ ERROR_CTX_CLIENT_LICENSE_NOT_SET = 7053,
+ ERROR_CTX_LICENSE_NOT_AVAILABLE = 7054,
+ ERROR_CTX_LICENSE_CLIENT_INVALID = 7055,
+ ERROR_CTX_LICENSE_EXPIRED = 7056,
+ ERROR_CTX_SHADOW_NOT_RUNNING = 7057,
+ ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE = 7058,
+ FRS_ERR_INVALID_API_SEQUENCE = 8001,
+ FRS_ERR_STARTING_SERVICE = 8002,
+ FRS_ERR_STOPPING_SERVICE = 8003,
+ FRS_ERR_INTERNAL_API = 8004,
+ FRS_ERR_INTERNAL = 8005,
+ FRS_ERR_SERVICE_COMM = 8006,
+ FRS_ERR_INSUFFICIENT_PRIV = 8007,
+ FRS_ERR_AUTHENTICATION = 8008,
+ FRS_ERR_PARENT_INSUFFICIENT_PRIV = 8009,
+ FRS_ERR_PARENT_AUTHENTICATION = 8010,
+ FRS_ERR_CHILD_TO_PARENT_COMM = 8011,
+ FRS_ERR_PARENT_TO_CHILD_COMM = 8012,
+ FRS_ERR_SYSVOL_POPULATE = 8013,
+ FRS_ERR_SYSVOL_POPULATE_TIMEOUT = 8014,
+ FRS_ERR_SYSVOL_IS_BUSY = 8015,
+ FRS_ERR_SYSVOL_DEMOTE = 8016,
+ FRS_ERR_INVALID_SERVICE_PARAMETER = 8017,
+ ERROR_DS_NOT_INSTALLED = 8200,
+ ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY = 8201,
+ ERROR_DS_NO_ATTRIBUTE_OR_VALUE = 8202,
+ ERROR_DS_INVALID_ATTRIBUTE_SYNTAX = 8203,
+ ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED = 8204,
+ ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS = 8205,
+ ERROR_DS_BUSY = 8206,
+ ERROR_DS_UNAVAILABLE = 8207,
+ ERROR_DS_NO_RIDS_ALLOCATED = 8208,
+ ERROR_DS_NO_MORE_RIDS = 8209,
+ ERROR_DS_INCORRECT_ROLE_OWNER = 8210,
+ ERROR_DS_RIDMGR_INIT_ERROR = 8211,
+ ERROR_DS_OBJ_CLASS_VIOLATION = 8212,
+ ERROR_DS_CANT_ON_NON_LEAF = 8213,
+ ERROR_DS_CANT_ON_RDN = 8214,
+ ERROR_DS_CANT_MOD_OBJ_CLASS = 8215,
+ ERROR_DS_CROSS_DOM_MOVE_ERROR = 8216,
+ ERROR_DS_GC_NOT_AVAILABLE = 8217,
+ ERROR_SHARED_POLICY = 8218,
+ ERROR_POLICY_OBJECT_NOT_FOUND = 8219,
+ ERROR_POLICY_ONLY_IN_DS = 8220,
+ ERROR_PROMOTION_ACTIVE = 8221,
+ ERROR_NO_PROMOTION_ACTIVE = 8222,
+ ERROR_DS_OPERATIONS_ERROR = 8224,
+ ERROR_DS_PROTOCOL_ERROR = 8225,
+ ERROR_DS_TIMELIMIT_EXCEEDED = 8226,
+ ERROR_DS_SIZELIMIT_EXCEEDED = 8227,
+ ERROR_DS_ADMIN_LIMIT_EXCEEDED = 8228,
+ ERROR_DS_COMPARE_FALSE = 8229,
+ ERROR_DS_COMPARE_TRUE = 8230,
+ ERROR_DS_AUTH_METHOD_NOT_SUPPORTED = 8231,
+ ERROR_DS_STRONG_AUTH_REQUIRED = 8232,
+ ERROR_DS_INAPPROPRIATE_AUTH = 8233,
+ ERROR_DS_AUTH_UNKNOWN = 8234,
+ ERROR_DS_REFERRAL = 8235,
+ ERROR_DS_UNAVAILABLE_CRIT_EXTENSION = 8236,
+ ERROR_DS_CONFIDENTIALITY_REQUIRED = 8237,
+ ERROR_DS_INAPPROPRIATE_MATCHING = 8238,
+ ERROR_DS_CONSTRAINT_VIOLATION = 8239,
+ ERROR_DS_NO_SUCH_OBJECT = 8240,
+ ERROR_DS_ALIAS_PROBLEM = 8241,
+ ERROR_DS_INVALID_DN_SYNTAX = 8242,
+ ERROR_DS_IS_LEAF = 8243,
+ ERROR_DS_ALIAS_DEREF_PROBLEM = 8244,
+ ERROR_DS_UNWILLING_TO_PERFORM = 8245,
+ ERROR_DS_LOOP_DETECT = 8246,
+ ERROR_DS_NAMING_VIOLATION = 8247,
+ ERROR_DS_OBJECT_RESULTS_TOO_LARGE = 8248,
+ ERROR_DS_AFFECTS_MULTIPLE_DSAS = 8249,
+ ERROR_DS_SERVER_DOWN = 8250,
+ ERROR_DS_LOCAL_ERROR = 8251,
+ ERROR_DS_ENCODING_ERROR = 8252,
+ ERROR_DS_DECODING_ERROR = 8253,
+ ERROR_DS_FILTER_UNKNOWN = 8254,
+ ERROR_DS_PARAM_ERROR = 8255,
+ ERROR_DS_NOT_SUPPORTED = 8256,
+ ERROR_DS_NO_RESULTS_RETURNED = 8257,
+ ERROR_DS_CONTROL_NOT_FOUND = 8258,
+ ERROR_DS_CLIENT_LOOP = 8259,
+ ERROR_DS_REFERRAL_LIMIT_EXCEEDED = 8260,
+ ERROR_DS_SORT_CONTROL_MISSING = 8261,
+ ERROR_DS_OFFSET_RANGE_ERROR = 8262,
+ ERROR_DS_ROOT_MUST_BE_NC = 8301,
+ ERROR_DS_ADD_REPLICA_INHIBITED = 8302,
+ ERROR_DS_ATT_NOT_DEF_IN_SCHEMA = 8303,
+ ERROR_DS_MAX_OBJ_SIZE_EXCEEDED = 8304,
+ ERROR_DS_OBJ_STRING_NAME_EXISTS = 8305,
+ ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA = 8306,
+ ERROR_DS_RDN_DOESNT_MATCH_SCHEMA = 8307,
+ ERROR_DS_NO_REQUESTED_ATTS_FOUND = 8308,
+ ERROR_DS_USER_BUFFER_TO_SMALL = 8309,
+ ERROR_DS_ATT_IS_NOT_ON_OBJ = 8310,
+ ERROR_DS_ILLEGAL_MOD_OPERATION = 8311,
+ ERROR_DS_OBJ_TOO_LARGE = 8312,
+ ERROR_DS_BAD_INSTANCE_TYPE = 8313,
+ ERROR_DS_MASTERDSA_REQUIRED = 8314,
+ ERROR_DS_OBJECT_CLASS_REQUIRED = 8315,
+ ERROR_DS_MISSING_REQUIRED_ATT = 8316,
+ ERROR_DS_ATT_NOT_DEF_FOR_CLASS = 8317,
+ ERROR_DS_ATT_ALREADY_EXISTS = 8318,
+ ERROR_DS_CANT_ADD_ATT_VALUES = 8320,
+ ERROR_DS_SINGLE_VALUE_CONSTRAINT = 8321,
+ ERROR_DS_RANGE_CONSTRAINT = 8322,
+ ERROR_DS_ATT_VAL_ALREADY_EXISTS = 8323,
+ ERROR_DS_CANT_REM_MISSING_ATT = 8324,
+ ERROR_DS_CANT_REM_MISSING_ATT_VAL = 8325,
+ ERROR_DS_ROOT_CANT_BE_SUBREF = 8326,
+ ERROR_DS_NO_CHAINING = 8327,
+ ERROR_DS_NO_CHAINED_EVAL = 8328,
+ ERROR_DS_NO_PARENT_OBJECT = 8329,
+ ERROR_DS_PARENT_IS_AN_ALIAS = 8330,
+ ERROR_DS_CANT_MIX_MASTER_AND_REPS = 8331,
+ ERROR_DS_CHILDREN_EXIST = 8332,
+ ERROR_DS_OBJ_NOT_FOUND = 8333,
+ ERROR_DS_ALIASED_OBJ_MISSING = 8334,
+ ERROR_DS_BAD_NAME_SYNTAX = 8335,
+ ERROR_DS_ALIAS_POINTS_TO_ALIAS = 8336,
+ ERROR_DS_CANT_DEREF_ALIAS = 8337,
+ ERROR_DS_OUT_OF_SCOPE = 8338,
+ ERROR_DS_OBJECT_BEING_REMOVED = 8339,
+ ERROR_DS_CANT_DELETE_DSA_OBJ = 8340,
+ ERROR_DS_GENERIC_ERROR = 8341,
+ ERROR_DS_DSA_MUST_BE_INT_MASTER = 8342,
+ ERROR_DS_CLASS_NOT_DSA = 8343,
+ ERROR_DS_INSUFF_ACCESS_RIGHTS = 8344,
+ ERROR_DS_ILLEGAL_SUPERIOR = 8345,
+ ERROR_DS_ATTRIBUTE_OWNED_BY_SAM = 8346,
+ ERROR_DS_NAME_TOO_MANY_PARTS = 8347,
+ ERROR_DS_NAME_TOO_LONG = 8348,
+ ERROR_DS_NAME_VALUE_TOO_LONG = 8349,
+ ERROR_DS_NAME_UNPARSEABLE = 8350,
+ ERROR_DS_NAME_TYPE_UNKNOWN = 8351,
+ ERROR_DS_NOT_AN_OBJECT = 8352,
+ ERROR_DS_SEC_DESC_TOO_SHORT = 8353,
+ ERROR_DS_SEC_DESC_INVALID = 8354,
+ ERROR_DS_NO_DELETED_NAME = 8355,
+ ERROR_DS_SUBREF_MUST_HAVE_PARENT = 8356,
+ ERROR_DS_NCNAME_MUST_BE_NC = 8357,
+ ERROR_DS_CANT_ADD_SYSTEM_ONLY = 8358,
+ ERROR_DS_CLASS_MUST_BE_CONCRETE = 8359,
+ ERROR_DS_INVALID_DMD = 8360,
+ ERROR_DS_OBJ_GUID_EXISTS = 8361,
+ ERROR_DS_NOT_ON_BACKLINK = 8362,
+ ERROR_DS_NO_CROSSREF_FOR_NC = 8363,
+ ERROR_DS_SHUTTING_DOWN = 8364,
+ ERROR_DS_UNKNOWN_OPERATION = 8365,
+ ERROR_DS_INVALID_ROLE_OWNER = 8366,
+ ERROR_DS_COULDNT_CONTACT_FSMO = 8367,
+ ERROR_DS_CROSS_NC_DN_RENAME = 8368,
+ ERROR_DS_CANT_MOD_SYSTEM_ONLY = 8369,
+ ERROR_DS_REPLICATOR_ONLY = 8370,
+ ERROR_DS_OBJ_CLASS_NOT_DEFINED = 8371,
+ ERROR_DS_OBJ_CLASS_NOT_SUBCLASS = 8372,
+ ERROR_DS_NAME_REFERENCE_INVALID = 8373,
+ ERROR_DS_CROSS_REF_EXISTS = 8374,
+ ERROR_DS_CANT_DEL_MASTER_CROSSREF = 8375,
+ ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD = 8376,
+ ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX = 8377,
+ ERROR_DS_DUP_RDN = 8378,
+ ERROR_DS_DUP_OID = 8379,
+ ERROR_DS_DUP_MAPI_ID = 8380,
+ ERROR_DS_DUP_SCHEMA_ID_GUID = 8381,
+ ERROR_DS_DUP_LDAP_DISPLAY_NAME = 8382,
+ ERROR_DS_SEMANTIC_ATT_TEST = 8383,
+ ERROR_DS_SYNTAX_MISMATCH = 8384,
+ ERROR_DS_EXISTS_IN_MUST_HAVE = 8385,
+ ERROR_DS_EXISTS_IN_MAY_HAVE = 8386,
+ ERROR_DS_NONEXISTENT_MAY_HAVE = 8387,
+ ERROR_DS_NONEXISTENT_MUST_HAVE = 8388,
+ ERROR_DS_AUX_CLS_TEST_FAIL = 8389,
+ ERROR_DS_NONEXISTENT_POSS_SUP = 8390,
+ ERROR_DS_SUB_CLS_TEST_FAIL = 8391,
+ ERROR_DS_BAD_RDN_ATT_ID_SYNTAX = 8392,
+ ERROR_DS_EXISTS_IN_AUX_CLS = 8393,
+ ERROR_DS_EXISTS_IN_SUB_CLS = 8394,
+ ERROR_DS_EXISTS_IN_POSS_SUP = 8395,
+ ERROR_DS_RECALCSCHEMA_FAILED = 8396,
+ ERROR_DS_TREE_DELETE_NOT_FINISHED = 8397,
+ ERROR_DS_CANT_DELETE = 8398,
+ ERROR_DS_ATT_SCHEMA_REQ_ID = 8399,
+ ERROR_DS_BAD_ATT_SCHEMA_SYNTAX = 8400,
+ ERROR_DS_CANT_CACHE_ATT = 8401,
+ ERROR_DS_CANT_CACHE_CLASS = 8402,
+ ERROR_DS_CANT_REMOVE_ATT_CACHE = 8403,
+ ERROR_DS_CANT_REMOVE_CLASS_CACHE = 8404,
+ ERROR_DS_CANT_RETRIEVE_DN = 8405,
+ ERROR_DS_MISSING_SUPREF = 8406,
+ ERROR_DS_CANT_RETRIEVE_INSTANCE = 8407,
+ ERROR_DS_CODE_INCONSISTENCY = 8408,
+ ERROR_DS_DATABASE_ERROR = 8409,
+ ERROR_DS_GOVERNSID_MISSING = 8410,
+ ERROR_DS_MISSING_EXPECTED_ATT = 8411,
+ ERROR_DS_NCNAME_MISSING_CR_REF = 8412,
+ ERROR_DS_SECURITY_CHECKING_ERROR = 8413,
+ ERROR_DS_SCHEMA_NOT_LOADED = 8414,
+ ERROR_DS_SCHEMA_ALLOC_FAILED = 8415,
+ ERROR_DS_ATT_SCHEMA_REQ_SYNTAX = 8416,
+ ERROR_DS_GCVERIFY_ERROR = 8417,
+ ERROR_DS_DRA_SCHEMA_MISMATCH = 8418,
+ ERROR_DS_CANT_FIND_DSA_OBJ = 8419,
+ ERROR_DS_CANT_FIND_EXPECTED_NC = 8420,
+ ERROR_DS_CANT_FIND_NC_IN_CACHE = 8421,
+ ERROR_DS_CANT_RETRIEVE_CHILD = 8422,
+ ERROR_DS_SECURITY_ILLEGAL_MODIFY = 8423,
+ ERROR_DS_CANT_REPLACE_HIDDEN_REC = 8424,
+ ERROR_DS_BAD_HIERARCHY_FILE = 8425,
+ ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED = 8426,
+ ERROR_DS_CONFIG_PARAM_MISSING = 8427,
+ ERROR_DS_COUNTING_AB_INDICES_FAILED = 8428,
+ ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED = 8429,
+ ERROR_DS_INTERNAL_FAILURE = 8430,
+ ERROR_DS_UNKNOWN_ERROR = 8431,
+ ERROR_DS_ROOT_REQUIRES_CLASS_TOP = 8432,
+ ERROR_DS_REFUSING_FSMO_ROLES = 8433,
+ ERROR_DS_MISSING_FSMO_SETTINGS = 8434,
+ ERROR_DS_UNABLE_TO_SURRENDER_ROLES = 8435,
+ ERROR_DS_DRA_GENERIC = 8436,
+ ERROR_DS_DRA_INVALID_PARAMETER = 8437,
+ ERROR_DS_DRA_BUSY = 8438,
+ ERROR_DS_DRA_BAD_DN = 8439,
+ ERROR_DS_DRA_BAD_NC = 8440,
+ ERROR_DS_DRA_DN_EXISTS = 8441,
+ ERROR_DS_DRA_INTERNAL_ERROR = 8442,
+ ERROR_DS_DRA_INCONSISTENT_DIT = 8443,
+ ERROR_DS_DRA_CONNECTION_FAILED = 8444,
+ ERROR_DS_DRA_BAD_INSTANCE_TYPE = 8445,
+ ERROR_DS_DRA_OUT_OF_MEM = 8446,
+ ERROR_DS_DRA_MAIL_PROBLEM = 8447,
+ ERROR_DS_DRA_REF_ALREADY_EXISTS = 8448,
+ ERROR_DS_DRA_REF_NOT_FOUND = 8449,
+ ERROR_DS_DRA_OBJ_IS_REP_SOURCE = 8450,
+ ERROR_DS_DRA_DB_ERROR = 8451,
+ ERROR_DS_DRA_NO_REPLICA = 8452,
+ ERROR_DS_DRA_ACCESS_DENIED = 8453,
+ ERROR_DS_DRA_NOT_SUPPORTED = 8454,
+ ERROR_DS_DRA_RPC_CANCELLED = 8455,
+ ERROR_DS_DRA_SOURCE_DISABLED = 8456,
+ ERROR_DS_DRA_SINK_DISABLED = 8457,
+ ERROR_DS_DRA_NAME_COLLISION = 8458,
+ ERROR_DS_DRA_SOURCE_REINSTALLED = 8459,
+ ERROR_DS_DRA_MISSING_PARENT = 8460,
+ ERROR_DS_DRA_PREEMPTED = 8461,
+ ERROR_DS_DRA_ABANDON_SYNC = 8462,
+ ERROR_DS_DRA_SHUTDOWN = 8463,
+ ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET = 8464,
+ ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA = 8465,
+ ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466,
+ ERROR_DS_INSTALL_SCHEMA_MISMATCH = 8467,
+ ERROR_DS_DUP_LINK_ID = 8468,
+ ERROR_DS_NAME_ERROR_RESOLVING = 8469,
+ ERROR_DS_NAME_ERROR_NOT_FOUND = 8470,
+ ERROR_DS_NAME_ERROR_NOT_UNIQUE = 8471,
+ ERROR_DS_NAME_ERROR_NO_MAPPING = 8472,
+ ERROR_DS_NAME_ERROR_DOMAIN_ONLY = 8473,
+ ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 8474,
+ ERROR_DS_CONSTRUCTED_ATT_MOD = 8475,
+ ERROR_DS_WRONG_OM_OBJ_CLASS = 8476,
+ ERROR_DS_DRA_REPL_PENDING = 8477,
+ ERROR_DS_DS_REQUIRED = 8478,
+ ERROR_DS_INVALID_LDAP_DISPLAY_NAME = 8479,
+ ERROR_DS_NON_BASE_SEARCH = 8480,
+ ERROR_DS_CANT_RETRIEVE_ATTS = 8481,
+ ERROR_DS_BACKLINK_WITHOUT_LINK = 8482,
+ ERROR_DS_EPOCH_MISMATCH = 8483,
+ ERROR_DS_SRC_NAME_MISMATCH = 8484,
+ ERROR_DS_SRC_AND_DST_NC_IDENTICAL = 8485,
+ ERROR_DS_DST_NC_MISMATCH = 8486,
+ ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = 8487,
+ ERROR_DS_SRC_GUID_MISMATCH = 8488,
+ ERROR_DS_CANT_MOVE_DELETED_OBJECT = 8489,
+ ERROR_DS_PDC_OPERATION_IN_PROGRESS = 8490,
+ ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD = 8491,
+ ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION = 8492,
+ ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS = 8493,
+ ERROR_DS_NC_MUST_HAVE_NC_PARENT = 8494,
+ ERROR_DS_DST_DOMAIN_NOT_NATIVE = 8496,
+ ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER = 8497,
+ ERROR_DS_CANT_MOVE_ACCOUNT_GROUP = 8498,
+ ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499,
+ ERROR_DS_INVALID_SEARCH_FLAG = 8500,
+ ERROR_DS_NO_TREE_DELETE_ABOVE_NC = 8501,
+ ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE = 8502,
+ ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE = 8503,
+ ERROR_DS_SAM_INIT_FAILURE = 8504,
+ ERROR_DS_SENSITIVE_GROUP_VIOLATION = 8505,
+ ERROR_DS_CANT_MOD_PRIMARYGROUPID = 8506,
+ ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD = 8507,
+ ERROR_DS_NONSAFE_SCHEMA_CHANGE = 8508,
+ ERROR_DS_SCHEMA_UPDATE_DISALLOWED = 8509,
+ ERROR_DS_CANT_CREATE_UNDER_SCHEMA = 8510,
+ ERROR_DS_INSTALL_NO_SRC_SCH_VERSION = 8511,
+ ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE = 8512,
+ ERROR_DS_INVALID_GROUP_TYPE = 8513,
+ ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 8514,
+ ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 8515,
+ ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 8516,
+ ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 8517,
+ ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 8518,
+ ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 8519,
+ ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 8520,
+ ERROR_DS_HAVE_PRIMARY_MEMBERS = 8521,
+ ERROR_DS_STRING_SD_CONVERSION_FAILED = 8522,
+ ERROR_DS_NAMING_MASTER_GC = 8523,
+ ERROR_DS_LOOKUP_FAILURE = 8524,
+ ERROR_DS_COULDNT_UPDATE_SPNS = 8525,
+ ERROR_DS_CANT_RETRIEVE_SD = 8526,
+ ERROR_DS_KEY_NOT_UNIQUE = 8527,
+ ERROR_DS_WRONG_LINKED_ATT_SYNTAX = 8528,
+ ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD = 8529,
+ ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY = 8530,
+ ERROR_DS_CANT_START = 8531,
+ ERROR_DS_INIT_FAILURE = 8532,
+ ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533,
+ ERROR_DS_SOURCE_DOMAIN_IN_FOREST = 8534,
+ ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST = 8535,
+ ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED = 8536,
+ ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN = 8537,
+ ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER = 8538,
+ ERROR_DS_SRC_SID_EXISTS_IN_FOREST = 8539,
+ ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH = 8540,
+ ERROR_SAM_INIT_FAILURE = 8541,
+ ERROR_DS_DRA_SCHEMA_INFO_SHIP = 8542,
+ ERROR_DS_DRA_SCHEMA_CONFLICT = 8543,
+ ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT = 8544,
+ ERROR_DS_DRA_OBJ_NC_MISMATCH = 8545,
+ ERROR_DS_NC_STILL_HAS_DSAS = 8546,
+ ERROR_DS_GC_REQUIRED = 8547,
+ ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 8548,
+ ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS = 8549,
+ ERROR_DS_CANT_ADD_TO_GC = 8550,
+ ERROR_DS_NO_CHECKPOINT_WITH_PDC = 8551,
+ ERROR_DS_SOURCE_AUDITING_NOT_ENABLED = 8552,
+ ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC = 8553,
+ ERROR_DS_INVALID_NAME_FOR_SPN = 8554,
+ ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = 8555,
+ ERROR_DS_UNICODEPWD_NOT_IN_QUOTES = 8556,
+ ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 8557,
+ ERROR_DS_MUST_BE_RUN_ON_DST_DC = 8558,
+ ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER = 8559,
+ ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ = 8560,
+ ERROR_DS_INIT_FAILURE_CONSOLE = 8561,
+ ERROR_DS_SAM_INIT_FAILURE_CONSOLE = 8562,
+ ERROR_DS_FOREST_VERSION_TOO_HIGH = 8563,
+ ERROR_DS_DOMAIN_VERSION_TOO_HIGH = 8564,
+ ERROR_DS_FOREST_VERSION_TOO_LOW = 8565,
+ ERROR_DS_DOMAIN_VERSION_TOO_LOW = 8566,
+ ERROR_DS_INCOMPATIBLE_VERSION = 8567,
+ ERROR_DS_LOW_DSA_VERSION = 8568,
+ ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN = 8569,
+ ERROR_DS_NOT_SUPPORTED_SORT_ORDER = 8570,
+ ERROR_DS_NAME_NOT_UNIQUE = 8571,
+ ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 = 8572,
+ ERROR_DS_OUT_OF_VERSION_STORE = 8573,
+ ERROR_DS_INCOMPATIBLE_CONTROLS_USED = 8574,
+ ERROR_DS_NO_REF_DOMAIN = 8575,
+ ERROR_DS_RESERVED_LINK_ID = 8576,
+ ERROR_DS_LINK_ID_NOT_AVAILABLE = 8577,
+ ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 8578,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE = 8579,
+ ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC = 8580,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG = 8581,
+ ERROR_DS_MODIFYDN_WRONG_GRANDPARENT = 8582,
+ ERROR_DS_NAME_ERROR_TRUST_REFERRAL = 8583,
+ ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER = 8584,
+ ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD = 8585,
+ ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE = 8586,
+ ERROR_DS_THREAD_LIMIT_EXCEEDED = 8587,
+ ERROR_DS_NOT_CLOSEST = 8588,
+ ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF = 8589,
+ ERROR_DS_SINGLE_USER_MODE_FAILED = 8590,
+ ERROR_DS_NTDSCRIPT_SYNTAX_ERROR = 8591,
+ ERROR_DS_NTDSCRIPT_PROCESS_ERROR = 8592,
+ ERROR_DS_DIFFERENT_REPL_EPOCHS = 8593,
+ ERROR_DS_DRS_EXTENSIONS_CHANGED = 8594,
+ ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR = 8595,
+ ERROR_DS_NO_MSDS_INTID = 8596,
+ ERROR_DS_DUP_MSDS_INTID = 8597,
+ ERROR_DS_EXISTS_IN_RDNATTID = 8598,
+ ERROR_DS_AUTHORIZATION_FAILED = 8599,
+ ERROR_DS_INVALID_SCRIPT = 8600,
+ ERROR_DS_REMOTE_CROSSREF_OP_FAILED = 8601,
+ DNS_ERROR_RCODE_FORMAT_ERROR = 9001,
+ DNS_ERROR_RCODE_SERVER_FAILURE = 9002,
+ DNS_ERROR_RCODE_NAME_ERROR = 9003,
+ DNS_ERROR_RCODE_NOT_IMPLEMENTED = 9004,
+ DNS_ERROR_RCODE_REFUSED = 9005,
+ DNS_ERROR_RCODE_YXDOMAIN = 9006,
+ DNS_ERROR_RCODE_YXRRSET = 9007,
+ DNS_ERROR_RCODE_NXRRSET = 9008,
+ DNS_ERROR_RCODE_NOTAUTH = 9009,
+ DNS_ERROR_RCODE_NOTZONE = 9010,
+ DNS_ERROR_RCODE_BADSIG = 9016,
+ DNS_ERROR_RCODE_BADKEY = 9017,
+ DNS_ERROR_RCODE_BADTIME = 9018,
+ DNS_INFO_NO_RECORDS = 9501,
+ DNS_ERROR_BAD_PACKET = 9502,
+ DNS_ERROR_NO_PACKET = 9503,
+ DNS_ERROR_RCODE = 9504,
+ DNS_ERROR_UNSECURE_PACKET = 9505,
+ DNS_ERROR_INVALID_TYPE = 9551,
+ DNS_ERROR_INVALID_IP_ADDRESS = 9552,
+ DNS_ERROR_INVALID_PROPERTY = 9553,
+ DNS_ERROR_TRY_AGAIN_LATER = 9554,
+ DNS_ERROR_NOT_UNIQUE = 9555,
+ DNS_ERROR_NON_RFC_NAME = 9556,
+ DNS_STATUS_FQDN = 9557,
+ DNS_STATUS_DOTTED_NAME = 9558,
+ DNS_STATUS_SINGLE_PART_NAME = 9559,
+ DNS_ERROR_INVALID_NAME_CHAR = 9560,
+ DNS_ERROR_NUMERIC_NAME = 9561,
+ DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER = 9562,
+ DNS_ERROR_ZONE_DOES_NOT_EXIST = 9601,
+ DNS_ERROR_NO_ZONE_INFO = 9602,
+ DNS_ERROR_INVALID_ZONE_OPERATION = 9603,
+ DNS_ERROR_ZONE_CONFIGURATION_ERROR = 9604,
+ DNS_ERROR_ZONE_HAS_NO_SOA_RECORD = 9605,
+ DNS_ERROR_ZONE_HAS_NO_NS_RECORDS = 9606,
+ DNS_ERROR_ZONE_LOCKED = 9607,
+ DNS_ERROR_ZONE_CREATION_FAILED = 9608,
+ DNS_ERROR_ZONE_ALREADY_EXISTS = 9609,
+ DNS_ERROR_AUTOZONE_ALREADY_EXISTS = 9610,
+ DNS_ERROR_INVALID_ZONE_TYPE = 9611,
+ DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP = 9612,
+ DNS_ERROR_ZONE_NOT_SECONDARY = 9613,
+ DNS_ERROR_NEED_SECONDARY_ADDRESSES = 9614,
+ DNS_ERROR_WINS_INIT_FAILED = 9615,
+ DNS_ERROR_NEED_WINS_SERVERS = 9616,
+ DNS_ERROR_NBSTAT_INIT_FAILED = 9617,
+ DNS_ERROR_SOA_DELETE_INVALID = 9618,
+ DNS_ERROR_FORWARDER_ALREADY_EXISTS = 9619,
+ DNS_ERROR_ZONE_REQUIRES_MASTER_IP = 9620,
+ DNS_ERROR_ZONE_IS_SHUTDOWN = 9621,
+ DNS_ERROR_PRIMARY_REQUIRES_DATAFILE = 9651,
+ DNS_ERROR_INVALID_DATAFILE_NAME = 9652,
+ DNS_ERROR_DATAFILE_OPEN_FAILURE = 9653,
+ DNS_ERROR_FILE_WRITEBACK_FAILED = 9654,
+ DNS_ERROR_DATAFILE_PARSING = 9655,
+ DNS_ERROR_RECORD_DOES_NOT_EXIST = 9701,
+ DNS_ERROR_RECORD_FORMAT = 9702,
+ DNS_ERROR_NODE_CREATION_FAILED = 9703,
+ DNS_ERROR_UNKNOWN_RECORD_TYPE = 9704,
+ DNS_ERROR_RECORD_TIMED_OUT = 9705,
+ DNS_ERROR_NAME_NOT_IN_ZONE = 9706,
+ DNS_ERROR_CNAME_LOOP = 9707,
+ DNS_ERROR_NODE_IS_CNAME = 9708,
+ DNS_ERROR_CNAME_COLLISION = 9709,
+ DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT = 9710,
+ DNS_ERROR_RECORD_ALREADY_EXISTS = 9711,
+ DNS_ERROR_SECONDARY_DATA = 9712,
+ DNS_ERROR_NO_CREATE_CACHE_DATA = 9713,
+ DNS_ERROR_NAME_DOES_NOT_EXIST = 9714,
+ DNS_WARNING_PTR_CREATE_FAILED = 9715,
+ DNS_WARNING_DOMAIN_UNDELETED = 9716,
+ DNS_ERROR_DS_UNAVAILABLE = 9717,
+ DNS_ERROR_DS_ZONE_ALREADY_EXISTS = 9718,
+ DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE = 9719,
+ DNS_INFO_AXFR_COMPLETE = 9751,
+ DNS_ERROR_AXFR = 9752,
+ DNS_INFO_ADDED_LOCAL_WINS = 9753,
+ DNS_STATUS_CONTINUE_NEEDED = 9801,
+ DNS_ERROR_NO_TCPIP = 9851,
+ DNS_ERROR_NO_DNS_SERVERS = 9852,
+ DNS_ERROR_DP_DOES_NOT_EXIST = 9901,
+ DNS_ERROR_DP_ALREADY_EXISTS = 9902,
+ DNS_ERROR_DP_NOT_ENLISTED = 9903,
+ DNS_ERROR_DP_ALREADY_ENLISTED = 9904,
+ WSAEINTR = 10004,
+ WSAEBADF = 10009,
+ WSAEACCES = 10013,
+ WSAEFAULT = 10014,
+ WSAEINVAL = 10022,
+ WSAEMFILE = 10024,
+ WSAEWOULDBLOCK = 10035,
+ WSAEINPROGRESS = 10036,
+ WSAEALREADY = 10037,
+ WSAENOTSOCK = 10038,
+ WSAEDESTADDRREQ = 10039,
+ WSAEMSGSIZE = 10040,
+ WSAEPROTOTYPE = 10041,
+ WSAENOPROTOOPT = 10042,
+ WSAEPROTONOSUPPORT = 10043,
+ WSAESOCKTNOSUPPORT = 10044,
+ WSAEOPNOTSUPP = 10045,
+ WSAEPFNOSUPPORT = 10046,
+ WSAEAFNOSUPPORT = 10047,
+ WSAEADDRINUSE = 10048,
+ WSAEADDRNOTAVAIL = 10049,
+ WSAENETDOWN = 10050,
+ WSAENETUNREACH = 10051,
+ WSAENETRESET = 10052,
+ WSAECONNABORTED = 10053,
+ WSAECONNRESET = 10054,
+ WSAENOBUFS = 10055,
+ WSAEISCONN = 10056,
+ WSAENOTCONN = 10057,
+ WSAESHUTDOWN = 10058,
+ WSAETOOMANYREFS = 10059,
+ WSAETIMEDOUT = 10060,
+ WSAECONNREFUSED = 10061,
+ WSAELOOP = 10062,
+ WSAENAMETOOLONG = 10063,
+ WSAEHOSTDOWN = 10064,
+ WSAEHOSTUNREACH = 10065,
+ WSAENOTEMPTY = 10066,
+ WSAEPROCLIM = 10067,
+ WSAEUSERS = 10068,
+ WSAEDQUOT = 10069,
+ WSAESTALE = 10070,
+ WSAEREMOTE = 10071,
+ WSASYSNOTREADY = 10091,
+ WSAVERNOTSUPPORTED = 10092,
+ WSANOTINITIALISED = 10093,
+ WSAEDISCON = 10101,
+ WSAENOMORE = 10102,
+ WSAECANCELLED = 10103,
+ WSAEINVALIDPROCTABLE = 10104,
+ WSAEINVALIDPROVIDER = 10105,
+ WSAEPROVIDERFAILEDINIT = 10106,
+ WSASYSCALLFAILURE = 10107,
+ WSASERVICE_NOT_FOUND = 10108,
+ WSATYPE_NOT_FOUND = 10109,
+ WSA_E_NO_MORE = 10110,
+ WSA_E_CANCELLED = 10111,
+ WSAEREFUSED = 10112,
+ WSAHOST_NOT_FOUND = 11001,
+ WSATRY_AGAIN = 11002,
+ WSANO_RECOVERY = 11003,
+ WSANO_DATA = 11004,
+ WSA_QOS_RECEIVERS = 11005,
+ WSA_QOS_SENDERS = 11006,
+ WSA_QOS_NO_SENDERS = 11007,
+ WSA_QOS_NO_RECEIVERS = 11008,
+ WSA_QOS_REQUEST_CONFIRMED = 11009,
+ WSA_QOS_ADMISSION_FAILURE = 11010,
+ WSA_QOS_POLICY_FAILURE = 11011,
+ WSA_QOS_BAD_STYLE = 11012,
+ WSA_QOS_BAD_OBJECT = 11013,
+ WSA_QOS_TRAFFIC_CTRL_ERROR = 11014,
+ WSA_QOS_GENERIC_ERROR = 11015,
+ WSA_QOS_ESERVICETYPE = 11016,
+ WSA_QOS_EFLOWSPEC = 11017,
+ WSA_QOS_EPROVSPECBUF = 11018,
+ WSA_QOS_EFILTERSTYLE = 11019,
+ WSA_QOS_EFILTERTYPE = 11020,
+ WSA_QOS_EFILTERCOUNT = 11021,
+ WSA_QOS_EOBJLENGTH = 11022,
+ WSA_QOS_EFLOWCOUNT = 11023,
+ WSA_QOS_EUNKNOWNPSOBJ = 11024,
+ WSA_QOS_EPOLICYOBJ = 11025,
+ WSA_QOS_EFLOWDESC = 11026,
+ WSA_QOS_EPSFLOWSPEC = 11027,
+ WSA_QOS_EPSFILTERSPEC = 11028,
+ WSA_QOS_ESDMODEOBJ = 11029,
+ WSA_QOS_ESHAPERATEOBJ = 11030,
+ WSA_QOS_RESERVED_PETYPE = 11031,
+ ERROR_IPSEC_QM_POLICY_EXISTS = 13000,
+ ERROR_IPSEC_QM_POLICY_NOT_FOUND = 13001,
+ ERROR_IPSEC_QM_POLICY_IN_USE = 13002,
+ ERROR_IPSEC_MM_POLICY_EXISTS = 13003,
+ ERROR_IPSEC_MM_POLICY_NOT_FOUND = 13004,
+ ERROR_IPSEC_MM_POLICY_IN_USE = 13005,
+ ERROR_IPSEC_MM_FILTER_EXISTS = 13006,
+ ERROR_IPSEC_MM_FILTER_NOT_FOUND = 13007,
+ ERROR_IPSEC_TRANSPORT_FILTER_EXISTS = 13008,
+ ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND = 13009,
+ ERROR_IPSEC_MM_AUTH_EXISTS = 13010,
+ ERROR_IPSEC_MM_AUTH_NOT_FOUND = 13011,
+ ERROR_IPSEC_MM_AUTH_IN_USE = 13012,
+ ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND = 13013,
+ ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND = 13014,
+ ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND = 13015,
+ ERROR_IPSEC_TUNNEL_FILTER_EXISTS = 13016,
+ ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND = 13017,
+ ERROR_IPSEC_MM_FILTER_PENDING_DELETION = 13018,
+ ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION = 13019,
+ ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION = 13020,
+ ERROR_IPSEC_MM_POLICY_PENDING_DELETION = 13021,
+ ERROR_IPSEC_MM_AUTH_PENDING_DELETION = 13022,
+ ERROR_IPSEC_QM_POLICY_PENDING_DELETION = 13023,
+ ERROR_IPSEC_IKE_AUTH_FAIL = 13801,
+ ERROR_IPSEC_IKE_ATTRIB_FAIL = 13802,
+ ERROR_IPSEC_IKE_NEGOTIATION_PENDING = 13803,
+ ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR = 13804,
+ ERROR_IPSEC_IKE_TIMED_OUT = 13805,
+ ERROR_IPSEC_IKE_NO_CERT = 13806,
+ ERROR_IPSEC_IKE_SA_DELETED = 13807,
+ ERROR_IPSEC_IKE_SA_REAPED = 13808,
+ ERROR_IPSEC_IKE_MM_ACQUIRE_DROP = 13809,
+ ERROR_IPSEC_IKE_QM_ACQUIRE_DROP = 13810,
+ ERROR_IPSEC_IKE_QUEUE_DROP_MM = 13811,
+ ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM = 13812,
+ ERROR_IPSEC_IKE_DROP_NO_RESPONSE = 13813,
+ ERROR_IPSEC_IKE_MM_DELAY_DROP = 13814,
+ ERROR_IPSEC_IKE_QM_DELAY_DROP = 13815,
+ ERROR_IPSEC_IKE_ERROR = 13816,
+ ERROR_IPSEC_IKE_CRL_FAILED = 13817,
+ ERROR_IPSEC_IKE_INVALID_KEY_USAGE = 13818,
+ ERROR_IPSEC_IKE_INVALID_CERT_TYPE = 13819,
+ ERROR_IPSEC_IKE_NO_PRIVATE_KEY = 13820,
+ ERROR_IPSEC_IKE_DH_FAIL = 13822,
+ ERROR_IPSEC_IKE_INVALID_HEADER = 13824,
+ ERROR_IPSEC_IKE_NO_POLICY = 13825,
+ ERROR_IPSEC_IKE_INVALID_SIGNATURE = 13826,
+ ERROR_IPSEC_IKE_KERBEROS_ERROR = 13827,
+ ERROR_IPSEC_IKE_NO_PUBLIC_KEY = 13828,
+ ERROR_IPSEC_IKE_PROCESS_ERR = 13829,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SA = 13830,
+ ERROR_IPSEC_IKE_PROCESS_ERR_PROP = 13831,
+ ERROR_IPSEC_IKE_PROCESS_ERR_TRANS = 13832,
+ ERROR_IPSEC_IKE_PROCESS_ERR_KE = 13833,
+ ERROR_IPSEC_IKE_PROCESS_ERR_ID = 13834,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT = 13835,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ = 13836,
+ ERROR_IPSEC_IKE_PROCESS_ERR_HASH = 13837,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SIG = 13838,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NONCE = 13839,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY = 13840,
+ ERROR_IPSEC_IKE_PROCESS_ERR_DELETE = 13841,
+ ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR = 13842,
+ ERROR_IPSEC_IKE_INVALID_PAYLOAD = 13843,
+ ERROR_IPSEC_IKE_LOAD_SOFT_SA = 13844,
+ ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN = 13845,
+ ERROR_IPSEC_IKE_INVALID_COOKIE = 13846,
+ ERROR_IPSEC_IKE_NO_PEER_CERT = 13847,
+ ERROR_IPSEC_IKE_PEER_CRL_FAILED = 13848,
+ ERROR_IPSEC_IKE_POLICY_CHANGE = 13849,
+ ERROR_IPSEC_IKE_NO_MM_POLICY = 13850,
+ ERROR_IPSEC_IKE_NOTCBPRIV = 13851,
+ ERROR_IPSEC_IKE_SECLOADFAIL = 13852,
+ ERROR_IPSEC_IKE_FAILSSPINIT = 13853,
+ ERROR_IPSEC_IKE_FAILQUERYSSP = 13854,
+ ERROR_IPSEC_IKE_SRVACQFAIL = 13855,
+ ERROR_IPSEC_IKE_SRVQUERYCRED = 13856,
+ ERROR_IPSEC_IKE_GETSPIFAIL = 13857,
+ ERROR_IPSEC_IKE_INVALID_FILTER = 13858,
+ ERROR_IPSEC_IKE_OUT_OF_MEMORY = 13859,
+ ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED = 13860,
+ ERROR_IPSEC_IKE_INVALID_POLICY = 13861,
+ ERROR_IPSEC_IKE_UNKNOWN_DOI = 13862,
+ ERROR_IPSEC_IKE_INVALID_SITUATION = 13863,
+ ERROR_IPSEC_IKE_DH_FAILURE = 13864,
+ ERROR_IPSEC_IKE_INVALID_GROUP = 13865,
+ ERROR_IPSEC_IKE_ENCRYPT = 13866,
+ ERROR_IPSEC_IKE_DECRYPT = 13867,
+ ERROR_IPSEC_IKE_POLICY_MATCH = 13868,
+ ERROR_IPSEC_IKE_UNSUPPORTED_ID = 13869,
+ ERROR_IPSEC_IKE_INVALID_HASH = 13870,
+ ERROR_IPSEC_IKE_INVALID_HASH_ALG = 13871,
+ ERROR_IPSEC_IKE_INVALID_HASH_SIZE = 13872,
+ ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG = 13873,
+ ERROR_IPSEC_IKE_INVALID_AUTH_ALG = 13874,
+ ERROR_IPSEC_IKE_INVALID_SIG = 13875,
+ ERROR_IPSEC_IKE_LOAD_FAILED = 13876,
+ ERROR_IPSEC_IKE_RPC_DELETE = 13877,
+ ERROR_IPSEC_IKE_BENIGN_REINIT = 13878,
+ ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY = 13879,
+ ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN = 13881,
+ ERROR_IPSEC_IKE_MM_LIMIT = 13882,
+ ERROR_IPSEC_IKE_NEGOTIATION_DISABLED = 13883,
+ ERROR_IPSEC_IKE_NEG_STATUS_END = 13884,
+ ERROR_SXS_SECTION_NOT_FOUND = 14000,
+ ERROR_SXS_CANT_GEN_ACTCTX = 14001,
+ ERROR_SXS_INVALID_ACTCTXDATA_FORMAT = 14002,
+ ERROR_SXS_ASSEMBLY_NOT_FOUND = 14003,
+ ERROR_SXS_MANIFEST_FORMAT_ERROR = 14004,
+ ERROR_SXS_MANIFEST_PARSE_ERROR = 14005,
+ ERROR_SXS_ACTIVATION_CONTEXT_DISABLED = 14006,
+ ERROR_SXS_KEY_NOT_FOUND = 14007,
+ ERROR_SXS_VERSION_CONFLICT = 14008,
+ ERROR_SXS_WRONG_SECTION_TYPE = 14009,
+ ERROR_SXS_THREAD_QUERIES_DISABLED = 14010,
+ ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET = 14011,
+ ERROR_SXS_UNKNOWN_ENCODING_GROUP = 14012,
+ ERROR_SXS_UNKNOWN_ENCODING = 14013,
+ ERROR_SXS_INVALID_XML_NAMESPACE_URI = 14014,
+ ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14015,
+ ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14016,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE = 14017,
+ ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE = 14018,
+ ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE = 14019,
+ ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT = 14020,
+ ERROR_SXS_DUPLICATE_DLL_NAME = 14021,
+ ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME = 14022,
+ ERROR_SXS_DUPLICATE_CLSID = 14023,
+ ERROR_SXS_DUPLICATE_IID = 14024,
+ ERROR_SXS_DUPLICATE_TLBID = 14025,
+ ERROR_SXS_DUPLICATE_PROGID = 14026,
+ ERROR_SXS_DUPLICATE_ASSEMBLY_NAME = 14027,
+ ERROR_SXS_FILE_HASH_MISMATCH = 14028,
+ ERROR_SXS_POLICY_PARSE_ERROR = 14029,
+ ERROR_SXS_XML_E_MISSINGQUOTE = 14030,
+ ERROR_SXS_XML_E_COMMENTSYNTAX = 14031,
+ ERROR_SXS_XML_E_BADSTARTNAMECHAR = 14032,
+ ERROR_SXS_XML_E_BADNAMECHAR = 14033,
+ ERROR_SXS_XML_E_BADCHARINSTRING = 14034,
+ ERROR_SXS_XML_E_XMLDECLSYNTAX = 14035,
+ ERROR_SXS_XML_E_BADCHARDATA = 14036,
+ ERROR_SXS_XML_E_MISSINGWHITESPACE = 14037,
+ ERROR_SXS_XML_E_EXPECTINGTAGEND = 14038,
+ ERROR_SXS_XML_E_MISSINGSEMICOLON = 14039,
+ ERROR_SXS_XML_E_UNBALANCEDPAREN = 14040,
+ ERROR_SXS_XML_E_INTERNALERROR = 14041,
+ ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE = 14042,
+ ERROR_SXS_XML_E_INCOMPLETE_ENCODING = 14043,
+ ERROR_SXS_XML_E_MISSING_PAREN = 14044,
+ ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE = 14045,
+ ERROR_SXS_XML_E_MULTIPLE_COLONS = 14046,
+ ERROR_SXS_XML_E_INVALID_DECIMAL = 14047,
+ ERROR_SXS_XML_E_INVALID_HEXIDECIMAL = 14048,
+ ERROR_SXS_XML_E_INVALID_UNICODE = 14049,
+ ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK = 14050,
+ ERROR_SXS_XML_E_UNEXPECTEDENDTAG = 14051,
+ ERROR_SXS_XML_E_UNCLOSEDTAG = 14052,
+ ERROR_SXS_XML_E_DUPLICATEATTRIBUTE = 14053,
+ ERROR_SXS_XML_E_MULTIPLEROOTS = 14054,
+ ERROR_SXS_XML_E_INVALIDATROOTLEVEL = 14055,
+ ERROR_SXS_XML_E_BADXMLDECL = 14056,
+ ERROR_SXS_XML_E_MISSINGROOT = 14057,
+ ERROR_SXS_XML_E_UNEXPECTEDEOF = 14058,
+ ERROR_SXS_XML_E_BADPEREFINSUBSET = 14059,
+ ERROR_SXS_XML_E_UNCLOSEDSTARTTAG = 14060,
+ ERROR_SXS_XML_E_UNCLOSEDENDTAG = 14061,
+ ERROR_SXS_XML_E_UNCLOSEDSTRING = 14062,
+ ERROR_SXS_XML_E_UNCLOSEDCOMMENT = 14063,
+ ERROR_SXS_XML_E_UNCLOSEDDECL = 14064,
+ ERROR_SXS_XML_E_UNCLOSEDCDATA = 14065,
+ ERROR_SXS_XML_E_RESERVEDNAMESPACE = 14066,
+ ERROR_SXS_XML_E_INVALIDENCODING = 14067,
+ ERROR_SXS_XML_E_INVALIDSWITCH = 14068,
+ ERROR_SXS_XML_E_BADXMLCASE = 14069,
+ ERROR_SXS_XML_E_INVALID_STANDALONE = 14070,
+ ERROR_SXS_XML_E_UNEXPECTED_STANDALONE = 14071,
+ ERROR_SXS_XML_E_INVALID_VERSION = 14072,
+ ERROR_SXS_XML_E_MISSINGEQUALS = 14073,
+ ERROR_SXS_PROTECTION_RECOVERY_FAILED = 14074,
+ ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT = 14075,
+ ERROR_SXS_PROTECTION_CATALOG_NOT_VALID = 14076,
+ ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077,
+ ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING = 14078,
+ ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE = 14079,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME = 14080
+ }
+}
diff --git a/mcs/class/corlib/System.IO/MonoIOStat.cs b/mcs/class/corlib/System.IO/MonoIOStat.cs
new file mode 100644
index 00000000000..caf4ccc6e5c
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIOStat.cs
@@ -0,0 +1,22 @@
+//
+// System.IO.MonoIOStat.cs: Idealized structure for file information.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO
+{
+ internal struct MonoIOStat {
+ public string Name;
+ public FileAttributes Attributes;
+ public long Length;
+ public long CreationTime;
+ public long LastAccessTime;
+ public long LastWriteTime;
+ }
+}
diff --git a/mcs/class/corlib/System.IO/Path.cs b/mcs/class/corlib/System.IO/Path.cs
new file mode 100644
index 00000000000..c1f4d303601
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Path.cs
@@ -0,0 +1,277 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.Path.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+// Copyright (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Created: Saturday, August 11, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.IO
+{
+ public sealed class Path
+ {
+ public static readonly char AltDirectorySeparatorChar;
+ public static readonly char DirectorySeparatorChar;
+ public static readonly char[] InvalidPathChars;
+ public static readonly char PathSeparator;
+ internal static readonly string DirectorySeparatorStr;
+ public static readonly char VolumeSeparatorChar;
+
+ private static readonly char[] PathSeparatorChars;
+ private static bool dirEqualsVolume;
+
+ private Path () {}
+
+ // class methods
+ public static string ChangeExtension (string path, string extension)
+ {
+ if (path == null)
+ {
+ return null;
+ }
+
+ if (path.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path");
+
+ int iExt = findExtension (path);
+
+ if (extension != null) {
+ if (extension [0] != '.')
+ extension = "." + extension;
+ } else
+ extension = String.Empty;
+
+ if (iExt < 0) {
+ return path + extension;
+ } else if (iExt > 0) {
+ string temp = path.Substring (0, iExt);
+ return temp + extension;
+ }
+
+ return extension;
+ }
+
+ public static string Combine (string path1, string path2)
+ {
+ if (path1 == null)
+ throw new ArgumentNullException ("path1");
+
+ if (path2 == null)
+ throw new ArgumentNullException ("path2");
+
+ if (path1 == String.Empty)
+ return path2;
+
+ if (path2 == String.Empty)
+ return path1;
+
+ if (path1.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path1");
+
+ if (path2.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path2");
+
+ //TODO???: UNC names
+ // LAMESPEC: MS says that if path1 is not empty and path2 is a full path
+ // it should throw ArgumentException
+ if (IsPathRooted (path2))
+ return path2;
+
+ if (Array.IndexOf (PathSeparatorChars, path1 [path1.Length - 1]) == -1)
+ return path1 + DirectorySeparatorChar + path2;
+
+ return path1 + path2;
+ }
+
+ public static string GetDirectoryName (string path)
+ {
+ if (path != null)
+ {
+ CheckArgument.Empty (path);
+ CheckArgument.WhitespaceOnly (path);
+ CheckArgument.PathChars (path);
+
+ if (path.Length > 0)
+ {
+ int nLast = path.LastIndexOfAny (PathSeparatorChars);
+
+ if (nLast > 0)
+ return path.Substring (0, nLast);
+ else
+ return String.Empty;
+ }
+ }
+ return path;
+ }
+
+ public static string GetExtension (string path)
+ {
+ if (path == null)
+ return null;
+
+ if (path.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path");
+
+ int iExt = findExtension (path);
+
+ if (iExt > -1)
+ { // okay it has an extension
+ return path.Substring (iExt);
+ }
+ return string.Empty;
+ }
+
+ public static string GetFileName (string path)
+ {
+ if (path == null || path == String.Empty)
+ return path;
+
+ if (path.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path");
+
+ int nLast = path.LastIndexOfAny (PathSeparatorChars);
+ if (nLast > 0)
+ return path.Substring (nLast + 1);
+
+ return nLast == 0 ? null : path;
+ }
+
+ public static string GetFileNameWithoutExtension (string path)
+ {
+ return ChangeExtension (GetFileName (path), null);
+ }
+
+ public static string GetFullPath (string path)
+ {
+ if (path == null)
+ throw (new ArgumentNullException (
+ "path",
+ "You must specify a path when calling System.IO.Path.GetFullPath"));
+
+ if (path == String.Empty)
+ throw new ArgumentException ("The path is not of a legal form", "path");
+
+ if (IsPathRooted (path))
+ return path;
+
+ return Directory.GetCurrentDirectory () + DirectorySeparatorStr + path;
+ }
+
+ public static string GetPathRoot (string path)
+ {
+ if (path == null)
+ return null;
+
+ if (!IsPathRooted (path))
+ return String.Empty;
+
+ int i = path.IndexOfAny (new char [] {DirectorySeparatorChar, AltDirectorySeparatorChar});
+ if (i == -1)
+ return null; // This should never happen, cause IsPathRooted returned true
+
+ return path.Substring (0, i + 1);
+ }
+
+ public static string GetTempFileName ()
+ {
+ FileStream f = null;
+ string path;
+ Random rnd;
+ int num = 0;
+
+ rnd = new Random ();
+ do {
+ num = rnd.Next ();
+ num++;
+ path = GetTempPath() + DirectorySeparatorChar + "tmp" + num.ToString("x");
+
+ try {
+ f = new FileStream (path, FileMode.CreateNew);
+ } catch {
+ }
+ } while (f == null);
+
+ f.Close();
+ return path;
+ }
+
+ /// <summary>
+ /// Returns the path of the current systems temp directory
+ /// </summary>
+ public static string GetTempPath ()
+ {
+ return get_temp_path ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern string get_temp_path ();
+
+ public static bool HasExtension (string path)
+ {
+ CheckArgument.Null (path);
+ CheckArgument.Empty (path);
+ CheckArgument.WhitespaceOnly (path);
+
+ return findExtension (path) > -1;
+ }
+
+ public static bool IsPathRooted (string path)
+ {
+ if (path == null || path.Length == 0)
+ return false;
+
+ if (path.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path");
+
+ char c = path [0];
+ return (c == DirectorySeparatorChar ||
+ c == AltDirectorySeparatorChar ||
+ (!dirEqualsVolume && path.Length > 1 && path [1] == VolumeSeparatorChar));
+ }
+
+ // private class methods
+
+ private static int findExtension (string path)
+ {
+ // method should return the index of the path extension
+ // start or -1 if no valid extension
+ if (path != null){
+ int iLastDot = path.LastIndexOf (".");
+ int iLastSep = path.LastIndexOfAny ( PathSeparatorChars );
+
+ if (iLastDot > iLastSep)
+ return iLastDot;
+ }
+ return -1;
+ }
+
+ static Path () {
+ VolumeSeparatorChar = MonoIO.VolumeSeparatorChar;
+ DirectorySeparatorChar = MonoIO.DirectorySeparatorChar;
+ AltDirectorySeparatorChar = MonoIO.AltDirectorySeparatorChar;
+
+ PathSeparator = MonoIO.PathSeparator;
+ InvalidPathChars = MonoIO.InvalidPathChars;
+
+ // internal fields
+
+ DirectorySeparatorStr = DirectorySeparatorChar.ToString ();
+ PathSeparatorChars = new char [] {
+ DirectorySeparatorChar,
+ AltDirectorySeparatorChar,
+ VolumeSeparatorChar
+ };
+
+ dirEqualsVolume = (DirectorySeparatorChar == VolumeSeparatorChar);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/PathTooLongException.cs b/mcs/class/corlib/System.IO/PathTooLongException.cs
new file mode 100644
index 00000000000..5f5f5229a18
--- /dev/null
+++ b/mcs/class/corlib/System.IO/PathTooLongException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.PathTooLongException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO
+{
+ [Serializable]
+ public class PathTooLongException : IOException
+ {
+ // Constructors
+ public PathTooLongException ()
+ : base (Locale.GetText ("Pathname is longer than the maximum length"))
+ {
+ }
+
+ public PathTooLongException (string message)
+ : base (message)
+ {
+ }
+
+ protected PathTooLongException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public PathTooLongException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/SearchPattern.cs b/mcs/class/corlib/System.IO/SearchPattern.cs
new file mode 100644
index 00000000000..4db60d2fadc
--- /dev/null
+++ b/mcs/class/corlib/System.IO/SearchPattern.cs
@@ -0,0 +1,169 @@
+//
+// System.IO.SearchPattern.cs: Filename glob support.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO {
+
+ // FIXME: there's a complication with this algorithm under windows.
+ // the pattern '*.*' matches all files (i think . matches the extension),
+ // whereas under UNIX it should only match files containing the '.' character.
+
+ class SearchPattern {
+ public SearchPattern (string pattern) : this (pattern, false) { }
+
+ public SearchPattern (string pattern, bool ignore)
+ {
+ this.ignore = ignore;
+ Compile (pattern);
+ }
+
+ public bool IsMatch (string text)
+ {
+ return Match (ops, text, 0);
+ }
+
+ // private
+
+ private Op ops; // the compiled pattern
+ private bool ignore; // ignore case
+
+ private void Compile (string pattern)
+ {
+ if (pattern == null || pattern.IndexOfAny (InvalidChars) >= 0)
+ throw new ArgumentException ("Invalid search pattern.");
+
+ if (pattern == "*") { // common case
+ ops = new Op (OpCode.True);
+ return;
+ }
+
+ ops = null;
+
+ int ptr = 0;
+ Op last_op = null;
+ while (ptr < pattern.Length) {
+ Op op;
+
+ switch (pattern [ptr]) {
+ case '?':
+ op = new Op (OpCode.AnyChar);
+ ++ ptr;
+ break;
+
+ case '*':
+ op = new Op (OpCode.AnyString);
+ ++ ptr;
+ break;
+
+ default:
+ op = new Op (OpCode.ExactString);
+ int end = pattern.IndexOfAny (WildcardChars, ptr);
+ if (end < 0)
+ end = pattern.Length;
+
+ op.Argument = pattern.Substring (ptr, end - ptr);
+ if (ignore)
+ op.Argument = op.Argument.ToLower ();
+
+ ptr = end;
+ break;
+ }
+
+ if (last_op == null)
+ ops = op;
+ else
+ last_op.Next = op;
+
+ last_op = op;
+ }
+
+ if (last_op == null)
+ ops = new Op (OpCode.End);
+ else
+ last_op.Next = new Op (OpCode.End);
+ }
+
+ private bool Match (Op op, string text, int ptr)
+ {
+ while (op != null) {
+ switch (op.Code) {
+ case OpCode.True:
+ return true;
+
+ case OpCode.End:
+ if (ptr == text.Length)
+ return true;
+
+ return false;
+
+ case OpCode.ExactString:
+ int length = op.Argument.Length;
+ if (ptr + length > text.Length)
+ return false;
+
+ string str = text.Substring (ptr, length);
+ if (ignore)
+ str = str.ToLower ();
+
+ if (str != op.Argument)
+ return false;
+
+ ptr += length;
+ break;
+
+ case OpCode.AnyChar:
+ if (++ ptr > text.Length)
+ return false;
+ break;
+
+ case OpCode.AnyString:
+ while (ptr <= text.Length) {
+ if (Match (op.Next, text, ptr))
+ return true;
+
+ ++ ptr;
+ }
+
+ return false;
+ }
+
+ op = op.Next;
+ }
+
+ return true;
+ }
+
+ // private static
+
+ private static readonly char [] WildcardChars = { '*', '?' };
+ private static readonly char [] InvalidChars = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
+
+ private class Op {
+ public Op (OpCode code)
+ {
+ this.Code = code;
+ this.Argument = null;
+ this.Next = null;
+ }
+
+ public OpCode Code;
+ public string Argument;
+ public Op Next;
+ }
+
+ private enum OpCode {
+ ExactString, // literal
+ AnyChar, // ?
+ AnyString, // *
+ End, // end of pattern
+ True // always succeeds
+ };
+ }
+}
diff --git a/mcs/class/corlib/System.IO/SeekOrigin.cs b/mcs/class/corlib/System.IO/SeekOrigin.cs
new file mode 100644
index 00000000000..1cd2cf84165
--- /dev/null
+++ b/mcs/class/corlib/System.IO/SeekOrigin.cs
@@ -0,0 +1,34 @@
+// SeekOrigin.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:32 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Serializable]
+ public enum SeekOrigin : int {
+
+ /// <summary>
+ /// </summary>
+ Begin = 0,
+
+ /// <summary>
+ /// </summary>
+ Current = 1,
+
+ /// <summary>
+ /// </summary>
+ End = 2,
+ } // SeekOrigin
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/Stream.cs b/mcs/class/corlib/System.IO/Stream.cs
new file mode 100755
index 00000000000..244585e8e96
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Stream.cs
@@ -0,0 +1,323 @@
+//
+// System.IO/Stream.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Threading;
+
+namespace System.IO
+{
+ [Serializable]
+ public abstract class Stream : MarshalByRefObject, IDisposable
+ {
+ public static readonly Stream Null;
+
+ static Stream ()
+ {
+ Null = new NullStream ();
+ }
+
+ protected Stream ()
+ {
+ }
+
+ public abstract bool CanRead
+ {
+ get;
+ }
+
+ public abstract bool CanSeek
+ {
+ get;
+ }
+
+ public abstract bool CanWrite
+ {
+ get;
+ }
+
+ public abstract long Length
+ {
+ get;
+ }
+
+ public abstract long Position
+ {
+ get;
+ set;
+ }
+
+
+ public virtual void Close ()
+ {
+ Flush ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Close ();
+ }
+
+ protected virtual WaitHandle CreateWaitHandle()
+ {
+ return new ManualResetEvent (false);
+ }
+
+ public abstract void Flush ();
+
+ public abstract int Read (byte[] buffer,
+ int offset,
+ int count);
+
+ public virtual int ReadByte ()
+ {
+ byte[] buffer = new byte [1];
+
+ if (Read (buffer, 0, 1) == 1)
+ return buffer [0];
+
+ return -1;
+ }
+
+ public abstract long Seek (long offset,
+ SeekOrigin origin);
+
+ public abstract void SetLength (long value);
+
+ public abstract void Write (byte[] buffer,
+ int offset,
+ int count);
+
+ public virtual void WriteByte (byte value)
+ {
+ byte[] buffer = new byte [1];
+
+ buffer [0] = value;
+
+ Write (buffer, 0, 1);
+ }
+
+ delegate int ReadDelegate (byte [] buffer, int offset, int count);
+
+ public virtual IAsyncResult
+ BeginRead (byte [] buffer, int offset, int count, AsyncCallback cback, object state)
+ {
+ if (!CanRead)
+ throw new NotSupportedException ("This stream does not support reading");
+
+ SyncReadResult srr = new SyncReadResult (state);
+ try
+ {
+ srr.Complete (Read (buffer, offset, count));
+ }
+ catch (IOException e)
+ {
+ srr._exception = e;
+ }
+
+ if (cback != null)
+ cback (srr);
+
+ return srr;
+ }
+
+ public virtual IAsyncResult
+ BeginWrite (byte [] buffer, int offset, int count, AsyncCallback cback, object state)
+ {
+ if (!CanWrite)
+ throw new NotSupportedException ("This stream does not support reading");
+
+ SyncWriteResult swr = new SyncWriteResult (state);
+ try
+ {
+ Write (buffer, offset, count);
+ swr.Complete ();
+ }
+ catch (IOException e)
+ {
+ swr._exception = e;
+ }
+
+ if (cback != null)
+ cback (swr);
+
+ return swr;
+ }
+
+ public virtual int EndRead (IAsyncResult async_result)
+ {
+ if (async_result == null)
+ throw new ArgumentNullException ("async_result");
+ SyncReadResult srr = async_result as SyncReadResult;
+ if (srr == null)
+ throw new ArgumentException ("async_result is invalid");
+ if (srr._fEndCalled)
+ throw new InvalidOperationException ("EndRead called twice");
+ srr._fEndCalled = true;
+ if (srr._exception != null)
+ throw srr._exception;
+ return srr._cbRead;
+ }
+
+ public virtual void EndWrite (IAsyncResult async_result)
+ {
+ if (async_result == null)
+ throw new ArgumentNullException ("async_result");
+ SyncWriteResult swr = async_result as SyncWriteResult;
+ if (swr == null)
+ throw new ArgumentException ("async_result is invalid");
+ if (swr._fEndCalled)
+ throw new InvalidOperationException ("EndRead called twice");
+ swr._fEndCalled = true;
+ if (swr._exception != null)
+ throw swr._exception;
+ }
+
+ // this class implements the synchronous IASyncResult for the obove methods
+ private class SyncResult : IAsyncResult
+ {
+ object _objState; // client-supplied state
+ bool _fComplete; // if the IO operation completed successfully
+ ManualResetEvent _hWait; // the wait event
+ public bool _fEndCalled; // true iff the End method was called already
+ public Exception _exception; // holds any exception throw during IO operation
+
+ public SyncResult (object objState)
+ {
+ _objState = objState;
+ _hWait = new ManualResetEvent (false);
+ }
+
+ public void Complete ()
+ {
+ _fComplete = true;
+ _hWait.Set ();
+ }
+
+ // IAsyncResult members
+ object IAsyncResult.AsyncState
+ {
+ get { return _objState; }
+ }
+
+ WaitHandle IAsyncResult.AsyncWaitHandle
+ {
+ get { return _hWait; }
+ }
+
+ bool IAsyncResult.CompletedSynchronously
+ {
+ get { return true; }
+ }
+
+ bool IAsyncResult.IsCompleted
+ {
+ get { return _fComplete; }
+ }
+ }
+ private class SyncReadResult : SyncResult
+ {
+ public int _cbRead; // the number of bytes read
+
+ public SyncReadResult (object objState) : base (objState) {}
+
+ public void Complete (int cbRead)
+ {
+ _cbRead = cbRead;
+ Complete ();
+ }
+ }
+ private class SyncWriteResult : SyncResult
+ {
+ public SyncWriteResult (object objState) : base (objState) {}
+ }
+ }
+
+ class NullStream : Stream
+ {
+ public override bool CanRead
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanSeek
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanWrite
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override long Length
+ {
+ get {
+ return 0;
+ }
+ }
+
+ public override long Position
+ {
+ get {
+ return 0;
+ }
+ set {
+ }
+ }
+
+ public override void Flush ()
+ {
+ }
+
+ public override int Read (byte[] buffer,
+ int offset,
+ int count)
+ {
+ return 0;
+ }
+
+ public override int ReadByte ()
+ {
+ return -1;
+ }
+
+ public override long Seek (long offset,
+ SeekOrigin origin)
+ {
+ return 0;
+ }
+
+ public override void SetLength (long value)
+ {
+ }
+
+ public override void Write (byte[] buffer,
+ int offset,
+ int count)
+ {
+ }
+
+ public override void WriteByte (byte value)
+ {
+ }
+ }
+}
+
+
+
+
+
+
+
diff --git a/mcs/class/corlib/System.IO/StreamReader.cs b/mcs/class/corlib/System.IO/StreamReader.cs
new file mode 100644
index 00000000000..7293b5ec95b
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StreamReader.cs
@@ -0,0 +1,388 @@
+//
+// System.IO.StreamReader.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Text;
+
+
+namespace System.IO {
+ [Serializable]
+ public class StreamReader : TextReader {
+
+ private const int DefaultBufferSize = 1024;
+ private const int DefaultFileBufferSize = 4096;
+ private const int MinimumBufferSize = 128;
+
+ //
+ // The input buffer
+ //
+ private byte [] input_buffer;
+
+ //
+ // The decoded buffer from the above input buffer
+ //
+ private char [] decoded_buffer;
+
+ //
+ // Decoded bytes in decoded_buffer.
+ //
+ private int decoded_count;
+
+ //
+ // Current position in the decoded_buffer
+ //
+ private int pos;
+
+ //
+ // The buffer size that we are using
+ //
+ private int buffer_size;
+
+ //
+ // Index into `input_buffer' where we start decoding
+ //
+ private int parse_start;
+
+ int do_checks;
+
+ private Encoding encoding;
+ private Decoder decoder;
+
+ private Stream base_stream;
+
+ private class NullStreamReader : StreamReader {
+ public override int Peek ()
+ {
+ return -1;
+ }
+
+ public override int Read ()
+ {
+ return -1;
+ }
+
+ public override int Read (char[] buffer, int index, int count)
+ {
+ return 0;
+ }
+
+ public override string ReadLine ()
+ {
+ return null;
+ }
+
+ public override string ReadToEnd ()
+ {
+ return String.Empty;
+ }
+
+ public override Stream BaseStream
+ {
+ get { return Stream.Null; }
+ }
+
+ public override Encoding CurrentEncoding
+ {
+ get { return Encoding.Unicode; }
+ }
+ }
+
+ public new static readonly StreamReader Null = (StreamReader)(new NullStreamReader());
+
+ internal StreamReader() {}
+
+ public StreamReader(Stream stream)
+ : this (stream, Encoding.UTF8Unmarked, true, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, bool detect_encoding_from_bytemarks)
+ : this (stream, Encoding.UTF8Unmarked, detect_encoding_from_bytemarks, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding)
+ : this (stream, encoding, true, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks)
+ : this (stream, encoding, detect_encoding_from_bytemarks, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size)
+ {
+ Initialize (stream, encoding, detect_encoding_from_bytemarks, buffer_size);
+ }
+
+ public StreamReader(string path)
+ : this (path, Encoding.UTF8Unmarked, true, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, bool detect_encoding_from_bytemarks)
+ : this (path, Encoding.UTF8Unmarked, detect_encoding_from_bytemarks, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, Encoding encoding)
+ : this (path, encoding, true, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, Encoding encoding, bool detect_encoding_from_bytemarks)
+ : this (path, encoding, detect_encoding_from_bytemarks, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size)
+ {
+ if (null == path)
+ throw new ArgumentNullException("path");
+ if (String.Empty == path)
+ throw new ArgumentException("Empty path not allowed");
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException("path contains invalid characters");
+
+ string DirName = Path.GetDirectoryName(path);
+ if (DirName != String.Empty && !Directory.Exists(DirName))
+ throw new DirectoryNotFoundException ("Directory '" + DirName + "' not found.");
+ if (!File.Exists(path))
+ throw new FileNotFoundException(path);
+
+ Stream stream = (Stream) File.OpenRead (path);
+ Initialize (stream, encoding, detect_encoding_from_bytemarks, buffer_size);
+ }
+
+ protected void Initialize (Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size)
+ {
+ if (null == stream)
+ throw new ArgumentNullException("stream");
+ if (!stream.CanRead)
+ throw new ArgumentException("Cannot read stream");
+
+ if (buffer_size < MinimumBufferSize)
+ buffer_size = MinimumBufferSize;
+
+ base_stream = stream;
+ input_buffer = new byte [buffer_size];
+ this.buffer_size = buffer_size;
+ this.encoding = encoding;
+ decoder = encoding.GetDecoder ();
+
+ byte [] preamble = encoding.GetPreamble ();
+ do_checks = detect_encoding_from_bytemarks ? 1 : 0;
+ do_checks += (preamble.Length == 0) ? 0 : 2;
+
+ decoded_buffer = new char [encoding.GetMaxCharCount (buffer_size)];
+ decoded_count = 0;
+ pos = 0;
+ }
+
+ public virtual Stream BaseStream
+ {
+ get {
+ return base_stream;
+ }
+ }
+
+ public virtual Encoding CurrentEncoding
+ {
+ get {
+ if (encoding == null)
+ throw new Exception ();
+ return encoding;
+ }
+ }
+
+ public override void Close ()
+ {
+ Dispose (true);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing && base_stream != null)
+ base_stream.Close ();
+
+ input_buffer = null;
+ decoded_buffer = null;
+ encoding = null;
+ decoder = null;
+ base_stream = null;
+ base.Dispose (disposing);
+ }
+
+ //
+ // Provides auto-detection of the encoding, as well as skipping over
+ // byte marks at the beginning of a stream.
+ //
+ int DoChecks (int count)
+ {
+ if ((do_checks & 2) == 2){
+ byte [] preamble = encoding.GetPreamble ();
+ int c = preamble.Length;
+ if (count >= c){
+ int i;
+
+ for (i = 0; i < c; i++)
+ if (input_buffer [i] != preamble [i])
+ break;
+
+ if (i == c)
+ return i;
+ }
+ }
+
+ if ((do_checks & 1) == 1){
+ if (count < 2)
+ return 0;
+
+ if (input_buffer [0] == 0xfe && input_buffer [1] == 0xff){
+ this.encoding = Encoding.BigEndianUnicode;
+ return 2;
+ }
+
+ if (input_buffer [0] == 0xff && input_buffer [1] == 0xfe){
+ this.encoding = Encoding.Unicode;
+ return 2;
+ }
+
+ if (count < 3)
+ return 0;
+
+ if (input_buffer [0] == 0xef && input_buffer [1] == 0xbb && input_buffer [2] == 0xbf){
+ this.encoding = Encoding.UTF8Unmarked;
+ return 3;
+ }
+ }
+
+ return 0;
+ }
+
+ // the buffer is empty, fill it again
+ private int ReadBuffer ()
+ {
+ pos = 0;
+ int cbEncoded = 0;
+
+ // keep looping until the decoder gives us some chars
+ decoded_count = 0;
+ int parse_start = 0;
+ do
+ {
+ cbEncoded = base_stream.Read (input_buffer, 0, buffer_size);
+
+ if (cbEncoded == 0)
+ return 0;
+
+ if (do_checks > 0){
+ Encoding old = encoding;
+ parse_start = DoChecks (cbEncoded);
+ if (old != encoding){
+ decoder = encoding.GetDecoder ();
+ }
+ do_checks = 0;
+ cbEncoded -= parse_start;
+ }
+
+ decoded_count += decoder.GetChars (input_buffer, parse_start, cbEncoded, decoded_buffer, 0);
+ parse_start = 0;
+ } while (decoded_count == 0);
+
+ return decoded_count;
+ }
+
+ public override int Peek ()
+ {
+ if (!base_stream.CanSeek)
+ return -1;
+
+ if (pos >= decoded_count && ReadBuffer () == 0)
+ return -1;
+
+ return decoded_buffer [pos];
+ }
+
+ public override int Read ()
+ {
+ if (pos >= decoded_count && ReadBuffer () == 0)
+ return -1;
+
+ return decoded_buffer [pos++];
+ }
+
+ public override int Read (char[] dest_buffer, int index, int count)
+ {
+ if (dest_buffer == null)
+ throw new ArgumentException ();
+
+ if ((index < 0) || (count < 0))
+ throw new ArgumentOutOfRangeException ();
+
+ if (index + count > dest_buffer.Length)
+ throw new ArgumentException ();
+
+ int chars_read = 0;
+ while (count > 0)
+ {
+ if (pos >= decoded_count && ReadBuffer () == 0)
+ return chars_read > 0 ? chars_read : 0;
+
+ int cch = Math.Min (decoded_count - pos, count);
+ Array.Copy (decoded_buffer, pos, dest_buffer, index, cch);
+ pos += cch;
+ index += cch;
+ count -= cch;
+ chars_read += cch;
+ }
+ return chars_read;
+ }
+
+ public override string ReadLine()
+ {
+ bool foundCR = false;
+ StringBuilder text = new StringBuilder ();
+
+ while (true) {
+ int c = Read ();
+
+ if (c == -1) { // end of stream
+ if (text.Length == 0)
+ return null;
+
+ if (foundCR)
+ text.Length--;
+
+ break;
+ }
+
+ if (c == '\n') { // newline
+ if ((text.Length > 0) && (text [text.Length - 1] == '\r'))
+ text.Length--;
+
+ foundCR = false;
+ break;
+ } else if (foundCR) {
+ pos--;
+ text.Length--;
+ break;
+ }
+
+ if (c == '\r')
+ foundCR = true;
+
+
+ text.Append ((char) c);
+ }
+
+ return text.ToString ();
+ }
+
+ public override string ReadToEnd()
+ {
+ StringBuilder text = new StringBuilder ();
+
+ int size = decoded_buffer.Length;
+ char [] buffer = new char [size];
+ int len;
+
+ while ((len = Read (buffer, 0, size)) != 0)
+ text.Append (buffer, 0, len);
+
+ return text.ToString ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/StreamWriter.cs b/mcs/class/corlib/System.IO/StreamWriter.cs
new file mode 100644
index 00000000000..93d5931775b
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StreamWriter.cs
@@ -0,0 +1,219 @@
+//
+// System.IO.StreamWriter.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Text;
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public class StreamWriter : TextWriter {
+
+ private Encoding internalEncoding;
+
+ private Stream internalStream;
+ private bool closed = false;
+
+ private bool iflush;
+
+ private const int DefaultBufferSize = 1024;
+ private const int DefaultFileBufferSize = 4096;
+ private const int MinimumBufferSize = 2;
+
+ private int pos;
+ private int BufferSize;
+ private byte[] TheBuffer;
+
+ private bool DisposedAlready = false;
+ private bool preamble_done = false;
+
+ public new static readonly StreamWriter Null = new StreamWriter (Stream.Null, Encoding.UTF8Unmarked, 0);
+
+ public StreamWriter (Stream stream)
+ : this (stream, Encoding.UTF8Unmarked, DefaultBufferSize) {}
+
+ public StreamWriter (Stream stream, Encoding encoding)
+ : this (stream, encoding, DefaultBufferSize) {}
+
+ internal void Initialize(Encoding encoding, int bufferSize) {
+ internalEncoding = encoding;
+ pos = 0;
+ BufferSize = Math.Max(bufferSize, MinimumBufferSize);
+ TheBuffer = new byte[BufferSize];
+ }
+
+ //[MonoTODO("Nothing is done with bufferSize")]
+ public StreamWriter (Stream stream, Encoding encoding, int bufferSize) {
+ if (null == stream)
+ throw new ArgumentNullException("stream");
+ if (null == encoding)
+ throw new ArgumentNullException("encoding");
+ if (bufferSize < 0)
+ throw new ArgumentOutOfRangeException("bufferSize");
+ if (!stream.CanWrite)
+ throw new ArgumentException("bufferSize");
+
+ internalStream = stream;
+
+ Initialize(encoding, bufferSize);
+ }
+
+ public StreamWriter (string path)
+ : this (path, false, Encoding.UTF8Unmarked, DefaultFileBufferSize) {}
+
+ public StreamWriter (string path, bool append)
+ : this (path, append, Encoding.UTF8Unmarked, DefaultFileBufferSize) {}
+
+ public StreamWriter (string path, bool append, Encoding encoding)
+ : this (path, append, encoding, DefaultFileBufferSize) {}
+
+ public StreamWriter (string path, bool append, Encoding encoding, int bufferSize) {
+ if (null == path)
+ throw new ArgumentNullException("path");
+ if (String.Empty == path)
+ throw new ArgumentException("path cannot be empty string");
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException("path contains invalid characters");
+
+ if (null == encoding)
+ throw new ArgumentNullException("encoding");
+ if (bufferSize < 0)
+ throw new ArgumentOutOfRangeException("bufferSize");
+
+ string DirName = Path.GetDirectoryName(path);
+ if (DirName != String.Empty && !Directory.Exists(DirName))
+ throw new DirectoryNotFoundException();
+
+ FileMode mode;
+
+ if (append)
+ mode = FileMode.Append;
+ else
+ mode = FileMode.Create;
+
+ internalStream = new FileStream (path, mode, FileAccess.Write);
+
+ if (append)
+ internalStream.Position = internalStream.Length;
+ else
+ internalStream.SetLength (0);
+
+ Initialize(encoding, bufferSize);
+ }
+
+ public virtual bool AutoFlush {
+ get {
+ return iflush;
+ }
+ set {
+ iflush = value;
+ }
+ }
+
+ public virtual Stream BaseStream {
+ get {
+ return internalStream;
+ }
+ }
+
+ public override Encoding Encoding {
+ get {
+ return internalEncoding;
+ }
+ }
+
+ protected override void Dispose (bool disposing) {
+ if (!DisposedAlready && disposing && internalStream != null) {
+ Flush();
+ DisposedAlready = true;
+ internalStream.Close ();
+ }
+
+ internalStream = null;
+ TheBuffer = null;
+ internalEncoding = null;
+ }
+
+ public override void Flush () {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+
+ if (pos > 0) {
+ internalStream.Write (TheBuffer, 0, pos);
+ internalStream.Flush ();
+ pos = 0;
+ }
+ }
+
+ public override void Write (char[] buffer, int index, int count) {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+
+ byte[] res = new byte [internalEncoding.GetByteCount (buffer)];
+ int len;
+ int BytesToBuffer;
+ int resPos = 0;
+
+ len = internalEncoding.GetBytes (buffer, index, count, res, 0);
+ // write the encoding preamble only at the start of the stream
+ if (!preamble_done && len > 0) {
+ byte[] preamble = internalEncoding.GetPreamble ();
+ if (preamble.Length > 0)
+ internalStream.Write (preamble, 0, preamble.Length);
+ preamble_done = true;
+ }
+
+ // if they want AutoFlush, don't bother buffering
+ if (iflush) {
+ Flush();
+ internalStream.Write (res, 0, len);
+ internalStream.Flush ();
+ } else {
+ // otherwise use the buffer.
+ // NOTE: this logic is not optimized for performance.
+ while (resPos < len) {
+ // fill the buffer if we've got more bytes than will fit
+ BytesToBuffer = Math.Min(BufferSize - pos, len - resPos);
+ Array.Copy(res, resPos, TheBuffer, pos, BytesToBuffer);
+ resPos += BytesToBuffer;
+ pos += BytesToBuffer;
+ // if the buffer is full, flush it out.
+ if (pos == BufferSize) Flush();
+ }
+ }
+ }
+
+ public override void Write (char value)
+ {
+ Write (new char [] {value}, 0, 1);
+ }
+
+ public override void Write (char [] value)
+ {
+ Write (value, 0, value.Length);
+ }
+
+ public override void Write(string value) {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+
+ if (value != null)
+ Write (value.ToCharArray (), 0, value.Length);
+ }
+
+ public override void Close()
+ {
+ Dispose (true);
+ }
+
+ ~StreamWriter() {
+ Dispose(false);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/StringReader.cs b/mcs/class/corlib/System.IO/StringReader.cs
new file mode 100644
index 00000000000..47c4d3f7346
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StringReader.cs
@@ -0,0 +1,133 @@
+//
+// System.IO.StringReader
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+
+
+using System;
+
+namespace System.IO {
+ [Serializable]
+ public class StringReader : TextReader {
+
+ private string source;
+ private char[] sourceChars;
+
+ private int nextChar;
+ private int sourceLength;
+
+ public StringReader( string s ) {
+ this.source = s;
+ nextChar = 0;
+ sourceLength = s.Length;
+ sourceChars = s.ToCharArray();
+ }
+
+ public override void Close() {
+ Dispose( true );
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ sourceChars = null;
+ base.Dispose (disposing);
+ }
+
+ public override int Peek() {
+ if( nextChar >= sourceLength ) {
+ return -1;
+ } else {
+ return (int)source[ nextChar ];
+ }
+ }
+
+ public override int Read() {
+ if( nextChar >= sourceLength ) {
+ return -1;
+ } else {
+ return (int)source[ nextChar++ ];
+ }
+ }
+
+
+ // The method will read up to count characters from the StringReader
+ // into the buffer character array starting at position index. Returns
+ // the actual number of characters read, or zero if the end of the string
+ // has been reached and no characters are read.
+
+ public override int Read( char[] buffer, int index, int count ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( buffer.Length - index < count ) {
+ throw new ArgumentException();
+ } else if( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ int charsToRead;
+
+ if( nextChar + count > sourceLength ) {
+ charsToRead = sourceLength - nextChar;
+ } else {
+ charsToRead = count;
+ }
+
+ Array.Copy(sourceChars, nextChar, buffer, index, charsToRead );
+
+ nextChar += count;
+
+ return charsToRead;
+ }
+
+ public override string ReadLine() {
+ // Reads until next \r or \n or \r\n, otherwise return null
+
+ // LAMESPEC:
+ // The Beta 2 SDK help says that the ReadLine method returns
+ // "The next line from the input stream [...] A line is defined as a sequence of
+ // characters followed by a carriage return (\r), a line feed (\n), or a carriage
+ // return immediately followed by a line feed (\r\n). [...]
+ // The returned value is a null reference if the end of the input stream has been reached."
+ //
+ // HOWEVER, the MS implementation returns the rest of the string if no \r and/or \n is found
+ // in the string
+
+ if (nextChar == source.Length)
+ return null;
+
+ int nextCR = source.IndexOf( '\r', nextChar );
+ int nextLF = source.IndexOf( '\n', nextChar );
+
+ if( nextCR == -1 && nextLF == -1 ) {
+ return ReadToEnd();
+ }
+
+ int readTo;
+
+ if( nextCR == -1 ) {
+ readTo = nextLF;
+ } else {
+ readTo = nextCR;
+ }
+
+ string nextLine = source.Substring( nextChar, readTo - nextChar );
+
+ if( nextLF == nextCR + 1 ) {
+ nextChar = readTo + 2;
+ } else {
+ nextChar = readTo + 1;
+ }
+
+ return nextLine;
+ }
+
+ public override string ReadToEnd() {
+ string toEnd = source.Substring( nextChar, sourceLength - nextChar );
+ nextChar = sourceLength;
+ return toEnd;
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/StringWriter.cs b/mcs/class/corlib/System.IO/StringWriter.cs
new file mode 100644
index 00000000000..7cb175c482b
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StringWriter.cs
@@ -0,0 +1,83 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+
+using System.Text;
+
+namespace System.IO {
+ [Serializable]
+ public class StringWriter : TextWriter {
+
+ private StringBuilder internalString;
+
+ public StringWriter() {
+ internalString = new StringBuilder();
+ }
+
+ public StringWriter( IFormatProvider formatProvider ) {
+ internalFormatProvider = formatProvider;
+ }
+
+ public StringWriter( StringBuilder sb ) {
+ internalString = sb;
+ }
+
+ public StringWriter( StringBuilder sb, IFormatProvider formatProvider ) {
+ internalString = sb;
+ internalFormatProvider = formatProvider;
+ }
+
+ public override System.Text.Encoding Encoding {
+ get {
+ return System.Text.Encoding.Unicode;
+ }
+ }
+
+ public override void Close() {
+ Dispose( true );
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ internalString = null;
+ base.Dispose (disposing);
+ }
+
+ public virtual StringBuilder GetStringBuilder() {
+ return internalString;
+ }
+
+ public override string ToString() {
+ return internalString.ToString();
+ }
+
+ public override void Write( char value ) {
+ internalString.Append( value );
+ }
+
+ public override void Write( string value ) {
+ internalString.Append( value );
+ }
+
+ public override void Write( char[] buffer, int index, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( index > buffer.Length || index + count > buffer.Length ) {
+ throw new ArgumentException();
+ }
+
+ char[] writeBuffer = new char[ count ];
+
+ Array.Copy( buffer, index, writeBuffer, 0, count );
+
+ internalString.Append( writeBuffer );
+ }
+
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.IO/TextReader.cs b/mcs/class/corlib/System.IO/TextReader.cs
new file mode 100644
index 00000000000..07eaa717015
--- /dev/null
+++ b/mcs/class/corlib/System.IO/TextReader.cs
@@ -0,0 +1,87 @@
+//
+// System.IO.TextReader
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Implement the Thread Safe stuff
+//
+
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public abstract class TextReader : MarshalByRefObject, IDisposable {
+
+ protected TextReader() { }
+
+ public static readonly TextReader Null;
+
+ public virtual void Close()
+ {
+ Dispose(true);
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ Dispose(true);
+ }
+
+ protected virtual void Dispose( bool disposing )
+ {
+ return;
+ }
+
+ public virtual int Peek()
+ {
+ return -1;
+ }
+
+ public virtual int Read()
+ {
+ return -1;
+ }
+
+ public virtual int Read (char[] buffer, int index, int count)
+ {
+ int c, i;
+
+ for (i = 0; i < count; i++) {
+ if ((c = Read ()) == -1)
+ return i;
+ buffer [index + i] = (char)c;
+ }
+
+ return i;
+ }
+
+ public virtual int ReadBlock (char [] buffer, int index, int count)
+ {
+ int read_count = 0;
+ do {
+ read_count = Read (buffer, index, count);
+ index += read_count;
+ count -= read_count;
+ } while (read_count != 0 && count > 0);
+
+ return read_count;
+ }
+
+ public virtual string ReadLine()
+ {
+ return String.Empty;
+ }
+
+ public virtual string ReadToEnd()
+ {
+ return String.Empty;
+ }
+
+ [MonoTODO]
+ public static TextReader Synchronized( TextReader reader )
+ {
+ // TODO: Implement
+ return Null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/TextWriter.cs b/mcs/class/corlib/System.IO/TextWriter.cs
new file mode 100644
index 00000000000..59e221ef1fa
--- /dev/null
+++ b/mcs/class/corlib/System.IO/TextWriter.cs
@@ -0,0 +1,289 @@
+//
+// System.IO.TextWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Implement the Thread Safe stuff
+
+using System.Text;
+
+namespace System.IO {
+
+ [Serializable]
+ public abstract class TextWriter : MarshalByRefObject, IDisposable {
+
+ protected TextWriter() {
+ CoreNewLine = "\n".ToCharArray ();
+ }
+
+ protected TextWriter( IFormatProvider formatProvider ) {
+ internalFormatProvider = formatProvider;
+ }
+
+ protected char[] CoreNewLine;
+
+ internal IFormatProvider internalFormatProvider;
+
+ public static readonly TextWriter Null = new NullTextWriter ();
+
+ public abstract Encoding Encoding { get; }
+
+ public virtual IFormatProvider FormatProvider {
+ get {
+ return internalFormatProvider;
+ }
+ }
+
+ public virtual string NewLine {
+ get {
+ return new String(CoreNewLine);
+ }
+
+ set {
+ CoreNewLine = value.ToCharArray();
+ }
+ }
+
+ public virtual void Close () {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing) { }
+
+ void System.IDisposable.Dispose () {
+ Dispose (true);
+ }
+
+
+ public virtual void Flush()
+ {
+ // do nothing
+ }
+
+ [MonoTODO]
+ public static TextWriter Synchronized (TextWriter writer)
+ {
+ // TODO: Implement.
+
+ return Null;
+ }
+
+ public virtual void Write (bool value)
+ {
+ Write (value.ToString ());
+ }
+
+ public virtual void Write (char value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (char[] value)
+ {
+ if (value != null)
+ Write (new String (value));
+ }
+
+ public virtual void Write (decimal value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (double value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (int value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (long value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (object value)
+ {
+ if (value != null)
+ Write (value.ToString ());
+ }
+
+ public virtual void Write (float value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (string value)
+ {
+ // do nothing
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write (uint value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write (ulong value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (string format, object arg0)
+ {
+ Write (String.Format (format, arg0));
+ }
+
+ public virtual void Write (string format, params object[] arg)
+ {
+ Write (String.Format (format, arg));
+ }
+
+ public virtual void Write (char[] buffer, int index, int count)
+ {
+ Write (new String (buffer, index, count));
+ }
+
+ public virtual void Write (string format, object arg0, object arg1)
+ {
+ Write (String.Format (format, arg0, arg1));
+ }
+
+ public virtual void Write (string format, object arg0, object arg1, object arg2 )
+ {
+ Write (String.Format (format, arg0, arg1, arg2));
+ }
+
+ public virtual void WriteLine ()
+ {
+ Write (NewLine);
+ }
+
+ public virtual void WriteLine (bool value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char[] value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (decimal value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (double value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (int value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (long value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (object value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (float value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public virtual void WriteLine (uint value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public virtual void WriteLine (ulong value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0)
+ {
+ Write (format, arg0);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, params object[] arg)
+ {
+ Write (format, arg);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char[] buffer, int index, int count)
+ {
+ Write (buffer, index, count);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0, object arg1)
+ {
+ Write (format, arg0, arg1);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0, object arg1, object arg2)
+ {
+ Write (format, arg0, arg1, arg2);
+ WriteLine();
+ }
+
+ //
+ // Null version of the TextWriter, for the `Null' instance variable
+ //
+ sealed class NullTextWriter : TextWriter {
+ public override Encoding Encoding {
+ get {
+ return Encoding.Default;
+ }
+ }
+
+ public override void Write (string s)
+ {
+ }
+ }
+ }
+}
+
+
+
+
+