2 * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
\r
6 using System.Runtime.InteropServices;
\r
8 namespace Mono.PEToolkit {
\r
11 /// IMAGE_DATA_DIRECTORY.
\r
13 [StructLayoutAttribute(LayoutKind.Sequential)]
\r
14 public struct DataDir {
\r
16 public static readonly DataDir Null;
\r
18 public RVA virtAddr;
\r
28 public RVA VirtualAddress {
\r
46 public bool IsNull {
\r
48 return (this == Null);
\r
52 public override int GetHashCode()
\r
54 return (virtAddr.GetHashCode() ^ (int)(size << 1));
\r
57 public override bool Equals(object obj)
\r
59 bool res = (obj is DataDir);
\r
61 DataDir that = (DataDir) obj;
\r
62 res = (this.virtAddr == that.virtAddr) &&
\r
63 (this.size == that.size);
\r
68 public static bool operator == (DataDir d1, DataDir d2)
\r
70 return d1.Equals(d2);
\r
73 public static bool operator != (DataDir d1, DataDir d2)
\r
75 return !d1.Equals(d2);
\r
80 /// <returns></returns>
\r
81 public override string ToString()
\r
83 if (this.IsNull) return "NULL";
\r
84 return String.Format("RVA = {0}, size = 0x{1}", virtAddr, size.ToString("X"));
\r