Files
Dec2017-Script-Dump/System/ComponentModel/Win32Exception.cs
T
2026-06-04 11:42:34 +02:00

107 lines
4.8 KiB
C#

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
namespace System.ComponentModel
{
/// <summary>Throws an exception for a Win32 error code.</summary>
// Token: 0x020000DC RID: 220
[SuppressUnmanagedCodeSecurity]
[Serializable]
public class Win32Exception : ExternalException
{
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.Win32Exception" /> class with the last Win32 error that occurred.</summary>
// Token: 0x06000760 RID: 1888 RVA: 0x00013DE8 File Offset: 0x00011FE8
public Win32Exception()
: base(Win32Exception.W32ErrorMessage(Marshal.GetLastWin32Error()))
{
this.native_error_code = Marshal.GetLastWin32Error();
}
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.Win32Exception" /> class with the specified error.</summary>
/// <param name="error">The Win32 error code associated with this exception. </param>
// Token: 0x06000761 RID: 1889 RVA: 0x00013E08 File Offset: 0x00012008
public Win32Exception(int error)
: base(Win32Exception.W32ErrorMessage(error))
{
this.native_error_code = error;
}
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.Win32Exception" /> class with the specified error and the specified detailed description.</summary>
/// <param name="error">The Win32 error code associated with this exception. </param>
/// <param name="message">A detailed description of the error. </param>
// Token: 0x06000762 RID: 1890 RVA: 0x00013E20 File Offset: 0x00012020
public Win32Exception(int error, string message)
: base(message)
{
this.native_error_code = error;
}
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.Win32Exception" /> class with the specified detailed description. </summary>
/// <param name="message">A detailed description of the error.</param>
// Token: 0x06000763 RID: 1891 RVA: 0x00013E30 File Offset: 0x00012030
public Win32Exception(string message)
: base(message)
{
this.native_error_code = Marshal.GetLastWin32Error();
}
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.Win32Exception" /> class with the specified detailed description and the specified exception.</summary>
/// <param name="message">A detailed description of the error.</param>
/// <param name="innerException">A reference to the inner exception that is the cause of this exception.</param>
// Token: 0x06000764 RID: 1892 RVA: 0x00013E44 File Offset: 0x00012044
public Win32Exception(string message, Exception innerException)
: base(message, innerException)
{
this.native_error_code = Marshal.GetLastWin32Error();
}
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.Win32Exception" /> class with the specified context and the serialization information.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> associated with this exception. </param>
/// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that represents the context of this exception. </param>
// Token: 0x06000765 RID: 1893 RVA: 0x00013E5C File Offset: 0x0001205C
protected Win32Exception(SerializationInfo info, StreamingContext context)
: base(info, context)
{
this.native_error_code = info.GetInt32("NativeErrorCode");
}
/// <summary>Gets the Win32 error code associated with this exception.</summary>
/// <returns>The Win32 error code associated with this exception.</returns>
// Token: 0x170001C2 RID: 450
// (get) Token: 0x06000766 RID: 1894 RVA: 0x00013E78 File Offset: 0x00012078
public int NativeErrorCode
{
get
{
return this.native_error_code;
}
}
/// <summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the file name and line number at which this <see cref="T:System.ComponentModel.Win32Exception" /> occurred.</summary>
/// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" />.</param>
/// <param name="context">The contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="info" /> is null.</exception>
// Token: 0x06000767 RID: 1895 RVA: 0x00013E80 File Offset: 0x00012080
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
info.AddValue("NativeErrorCode", this.native_error_code);
base.GetObjectData(info, context);
}
// Token: 0x06000768 RID: 1896
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern string W32ErrorMessage(int error_code);
// Token: 0x04000215 RID: 533
private int native_error_code;
}
}