Files
2026-06-04 11:42:34 +02:00

258 lines
12 KiB
C#

using System;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System
{
/// <summary>A platform-specific type that is used to represent a pointer or a handle.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x02000023 RID: 35
[ComVisible(true)]
[Serializable]
public struct IntPtr : ISerializable
{
/// <summary>Initializes a new instance of <see cref="T:System.IntPtr" /> using the specified 32-bit pointer or handle.</summary>
/// <param name="value">A pointer or handle contained in a 32-bit signed integer. </param>
// Token: 0x0600035D RID: 861 RVA: 0x0000D8BC File Offset: 0x0000BABC
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public IntPtr(int value)
{
this.m_value = value;
}
/// <summary>Initializes a new instance of <see cref="T:System.IntPtr" /> using the specified 64-bit pointer.</summary>
/// <param name="value">A pointer or handle contained in a 64-bit signed integer. </param>
/// <exception cref="T:System.OverflowException">On a 32-bit platform, <paramref name="value" /> is too large or too small to represent as an <see cref="T:System.IntPtr" />. </exception>
// Token: 0x0600035E RID: 862 RVA: 0x0000D8C8 File Offset: 0x0000BAC8
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public IntPtr(long value)
{
this.m_value = value;
}
/// <summary>Initializes a new instance of <see cref="T:System.IntPtr" /> using the specified pointer to an unspecified type.</summary>
/// <param name="value">A pointer to an unspecified type. </param>
// Token: 0x0600035F RID: 863 RVA: 0x0000D8D4 File Offset: 0x0000BAD4
[CLSCompliant(false)]
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public unsafe IntPtr(void* value)
{
this.m_value = value;
}
// Token: 0x06000360 RID: 864 RVA: 0x0000D8E0 File Offset: 0x0000BAE0
private IntPtr(SerializationInfo info, StreamingContext context)
{
long @int = info.GetInt64("value");
this.m_value = @int;
}
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the data needed to serialize the current <see cref="T:System.IntPtr" /> object.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object to populate with data. </param>
/// <param name="context">The destination for this serialization. (This parameter is not used; specify null.)</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="info" /> is null.</exception>
// Token: 0x06000361 RID: 865 RVA: 0x0000D904 File Offset: 0x0000BB04
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
info.AddValue("value", this.ToInt64());
}
/// <summary>Gets the size of this instance.</summary>
/// <returns>The size of a pointer or handle on this platform, measured in bytes. The value of this property is 4 on a 32-bit platform, and 8 on a 64-bit platform.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x1700000B RID: 11
// (get) Token: 0x06000362 RID: 866 RVA: 0x0000D934 File Offset: 0x0000BB34
public unsafe static int Size
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
get
{
return sizeof(void*);
}
}
/// <summary>Returns a value indicating whether this instance is equal to a specified object.</summary>
/// <returns>true if <paramref name="obj" /> is an instance of <see cref="T:System.IntPtr" /> and equals the value of this instance; otherwise, false.</returns>
/// <param name="obj">An object to compare with this instance or null. </param>
/// <filterpriority>2</filterpriority>
// Token: 0x06000363 RID: 867 RVA: 0x0000D93C File Offset: 0x0000BB3C
public override bool Equals(object obj)
{
return obj is IntPtr && ((IntPtr)obj).m_value == this.m_value;
}
/// <summary>Returns the hash code for this instance.</summary>
/// <returns>A 32-bit signed integer hash code.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x06000364 RID: 868 RVA: 0x0000D96C File Offset: 0x0000BB6C
public override int GetHashCode()
{
return this.m_value;
}
/// <summary>Converts the value of this instance to a 32-bit signed integer.</summary>
/// <returns>A 32-bit signed integer equal to the value of this instance.</returns>
/// <exception cref="T:System.OverflowException">On a 64-bit platform, the value of this instance is too large or too small to represent as a 32-bit signed integer. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x06000365 RID: 869 RVA: 0x0000D978 File Offset: 0x0000BB78
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public int ToInt32()
{
return this.m_value;
}
/// <summary>Converts the value of this instance to a 64-bit signed integer.</summary>
/// <returns>A 64-bit signed integer equal to the value of this instance.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x06000366 RID: 870 RVA: 0x0000D984 File Offset: 0x0000BB84
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public long ToInt64()
{
if (IntPtr.Size == 4)
{
return (long)this.m_value;
}
return this.m_value;
}
/// <summary>Converts the value of this instance to a pointer to an unspecified type.</summary>
/// <returns>A pointer to <see cref="T:System.Void" />; that is, a pointer to memory containing data of an unspecified type.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x06000367 RID: 871 RVA: 0x0000D9A4 File Offset: 0x0000BBA4
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public unsafe void* ToPointer()
{
return this.m_value;
}
/// <summary>Converts the numeric value of the current <see cref="T:System.IntPtr" /> object to its equivalent string representation.</summary>
/// <returns>The string representation of the value of this instance.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x06000368 RID: 872 RVA: 0x0000D9AC File Offset: 0x0000BBAC
public override string ToString()
{
return this.ToString(null);
}
/// <summary>Converts the numeric value of the current <see cref="T:System.IntPtr" /> object to its equivalent string representation.</summary>
/// <returns>The string representation of the value of the current <see cref="T:System.IntPtr" /> object.</returns>
/// <param name="format">A format specification that governs how the current <see cref="T:System.IntPtr" /> object is converted. </param>
/// <filterpriority>1</filterpriority>
// Token: 0x06000369 RID: 873 RVA: 0x0000D9B8 File Offset: 0x0000BBB8
public string ToString(string format)
{
if (IntPtr.Size == 4)
{
return this.m_value.ToString(format);
}
return this.m_value.ToString(format);
}
/// <summary>Determines whether two specified instances of <see cref="T:System.IntPtr" /> are equal.</summary>
/// <returns>true if <paramref name="value1" /> equals <paramref name="value2" />; otherwise, false.</returns>
/// <param name="value1">An <see cref="T:System.IntPtr" />. </param>
/// <param name="value2">An <see cref="T:System.IntPtr" />. </param>
/// <filterpriority>3</filterpriority>
// Token: 0x0600036A RID: 874 RVA: 0x0000D9F4 File Offset: 0x0000BBF4
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static bool operator ==(IntPtr value1, IntPtr value2)
{
return value1.m_value == value2.m_value;
}
/// <summary>Determines whether two specified instances of <see cref="T:System.IntPtr" /> are not equal.</summary>
/// <returns>true if <paramref name="value1" /> does not equal <paramref name="value2" />; otherwise, false.</returns>
/// <param name="value1">An <see cref="T:System.IntPtr" />. </param>
/// <param name="value2">An <see cref="T:System.IntPtr" />. </param>
/// <filterpriority>3</filterpriority>
// Token: 0x0600036B RID: 875 RVA: 0x0000DA08 File Offset: 0x0000BC08
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static bool operator !=(IntPtr value1, IntPtr value2)
{
return value1.m_value != value2.m_value;
}
/// <summary>Converts the value of a 32-bit signed integer to an <see cref="T:System.IntPtr" />.</summary>
/// <returns>A new instance of <see cref="T:System.IntPtr" /> initialized to <paramref name="value" />.</returns>
/// <param name="value">A 32-bit signed integer. </param>
/// <filterpriority>3</filterpriority>
// Token: 0x0600036C RID: 876 RVA: 0x0000DA20 File Offset: 0x0000BC20
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static explicit operator IntPtr(int value)
{
return new IntPtr(value);
}
/// <summary>Converts the value of a 64-bit signed integer to an <see cref="T:System.IntPtr" />.</summary>
/// <returns>A new instance of <see cref="T:System.IntPtr" /> initialized to <paramref name="value" />.</returns>
/// <param name="value">A 64-bit signed integer. </param>
/// <exception cref="T:System.OverflowException">On a 32-bit platform, <paramref name="value" /> is too large to represent as an <see cref="T:System.IntPtr" />. </exception>
/// <filterpriority>3</filterpriority>
// Token: 0x0600036D RID: 877 RVA: 0x0000DA28 File Offset: 0x0000BC28
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static explicit operator IntPtr(long value)
{
return new IntPtr(value);
}
/// <summary>Converts the specified pointer to an unspecified type to an <see cref="T:System.IntPtr" />.</summary>
/// <returns>A new instance of <see cref="T:System.IntPtr" /> initialized to <paramref name="value" />.</returns>
/// <param name="value">A pointer to an unspecified type. </param>
/// <filterpriority>3</filterpriority>
// Token: 0x0600036E RID: 878 RVA: 0x0000DA30 File Offset: 0x0000BC30
[CLSCompliant(false)]
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public unsafe static explicit operator IntPtr(void* value)
{
return new IntPtr(value);
}
/// <summary>Converts the value of the specified <see cref="T:System.IntPtr" /> to a 32-bit signed integer.</summary>
/// <returns>The contents of <paramref name="value" />.</returns>
/// <param name="value">An <see cref="T:System.IntPtr" />. </param>
/// <exception cref="T:System.OverflowException">On a 64-bit platform, the value of <paramref name="value" /> is too large to represent as a 32-bit signed integer. </exception>
/// <filterpriority>3</filterpriority>
// Token: 0x0600036F RID: 879 RVA: 0x0000DA38 File Offset: 0x0000BC38
public static explicit operator int(IntPtr value)
{
return value.m_value;
}
/// <summary>Converts the value of the specified <see cref="T:System.IntPtr" /> to a 64-bit signed integer.</summary>
/// <returns>The contents of <paramref name="value" />.</returns>
/// <param name="value">An <see cref="T:System.IntPtr" />. </param>
/// <filterpriority>3</filterpriority>
// Token: 0x06000370 RID: 880 RVA: 0x0000DA44 File Offset: 0x0000BC44
public static explicit operator long(IntPtr value)
{
return value.ToInt64();
}
/// <summary>Converts the value of the specified <see cref="T:System.IntPtr" /> to a pointer to an unspecified type.</summary>
/// <returns>The contents of <paramref name="value" />.</returns>
/// <param name="value">An <see cref="T:System.IntPtr" />. </param>
/// <filterpriority>3</filterpriority>
// Token: 0x06000371 RID: 881 RVA: 0x0000DA50 File Offset: 0x0000BC50
[CLSCompliant(false)]
public unsafe static explicit operator void*(IntPtr value)
{
return value.m_value;
}
// Token: 0x04000056 RID: 86
private unsafe void* m_value;
/// <summary>A read-only field that represents a pointer or handle that has been initialized to zero.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x04000057 RID: 87
public static readonly IntPtr Zero;
}
}