mscorlib(4.0.0.0) API with additions
ProcessModule.cs
4 
5 namespace System.Diagnostics
6 {
8  [Designer("System.Diagnostics.Design.ProcessModuleDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
9  [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
10  [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
11  public class ProcessModule : Component
12  {
13  internal ModuleInfo moduleInfo;
14 
15  private FileVersionInfo fileVersionInfo;
16 
19  [MonitoringDescription("ProcModModuleName")]
20  public string ModuleName
21  {
22  get
23  {
24  return moduleInfo.baseName;
25  }
26  }
27 
30  [MonitoringDescription("ProcModFileName")]
31  public string FileName
32  {
33  get
34  {
35  return moduleInfo.fileName;
36  }
37  }
38 
41  [MonitoringDescription("ProcModBaseAddress")]
42  public IntPtr BaseAddress
43  {
44  get
45  {
46  return moduleInfo.baseOfDll;
47  }
48  }
49 
52  [MonitoringDescription("ProcModModuleMemorySize")]
53  public int ModuleMemorySize
54  {
55  get
56  {
57  return moduleInfo.sizeOfImage;
58  }
59  }
60 
63  [MonitoringDescription("ProcModEntryPointAddress")]
65  {
66  get
67  {
68  EnsureNtProcessInfo();
69  return moduleInfo.entryPoint;
70  }
71  }
72 
75  [Browsable(false)]
77  {
78  get
79  {
80  if (fileVersionInfo == null)
81  {
82  fileVersionInfo = FileVersionInfo.GetVersionInfo(FileName);
83  }
84  return fileVersionInfo;
85  }
86  }
87 
88  internal ProcessModule(ModuleInfo moduleInfo)
89  {
90  this.moduleInfo = moduleInfo;
91  GC.SuppressFinalize(this);
92  }
93 
94  internal void EnsureNtProcessInfo()
95  {
97  {
98  throw new PlatformNotSupportedException(SR.GetString("WinNTRequired"));
99  }
100  }
101 
104  public override string ToString()
105  {
106  return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", new object[2]
107  {
108  base.ToString(),
109  ModuleName
110  });
111  }
112  }
113 }
PlatformID
Identifies the operating system, or platform, supported by an assembly.
Definition: PlatformID.cs:8
IntPtr BaseAddress
Gets the memory address where the module was loaded.
static void SuppressFinalize(object obj)
Requests that the common language runtime not call the finalizer for the specified object.
Definition: GC.cs:308
Definition: __Canon.cs:3
static OperatingSystem OSVersion
Gets an T:System.OperatingSystem object that contains the current platform identifier and version num...
Definition: Environment.cs:477
int ModuleMemorySize
Gets the amount of memory that is required to load the module.
IntPtr EntryPointAddress
Gets the memory address for the function that runs when the system loads and runs the module.
PlatformID Platform
Gets a T:System.PlatformID enumeration value that identifies the operating system platform.
Represents a.dll or .exe file that is loaded into a particular process.
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
string ModuleName
Gets the name of the process module.
The exception that is thrown when a feature does not run on a particular platform.
A platform-specific type that is used to represent a pointer or a handle.
Definition: IntPtr.cs:14
Provides the base implementation for the T:System.ComponentModel.IComponent interface and enables obj...
Definition: Component.cs:9
static unsafe FileVersionInfo GetVersionInfo(string fileName)
Returns a T:System.Diagnostics.FileVersionInfo representing the version information associated with t...
string FileName
Gets the full path to the module.
Provides version information for a physical file on disk.
Controls the system garbage collector, a service that automatically reclaims unused memory.
Definition: GC.cs:11
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
Definition: CultureInfo.cs:120
override string ToString()
Converts the name of the module to a string.
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16