/
ProcessModule.cs
62 lines (52 loc) · 2.28 KB
/
ProcessModule.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.ComponentModel;
namespace System.Diagnostics
{
/// <devdoc>
/// A process module component represents a DLL or EXE loaded into
/// a particular process. Using this component, you can determine
/// information about the module.
/// </devdoc>
[Designer("System.Diagnostics.Design.ProcessModuleDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class ProcessModule : Component
{
private readonly string _fileName;
private readonly string _moduleName;
private FileVersionInfo? _fileVersionInfo;
internal ProcessModule(string fileName, string moduleName)
{
_fileName = fileName;
_moduleName = moduleName;
}
/// <devdoc>
/// Returns the name of the Module.
/// </devdoc>
public string ModuleName => _moduleName;
/// <devdoc>
/// Returns the full file path for the location of the module.
/// </devdoc>
public string FileName => _fileName;
/// <devdoc>
/// Returns the memory address that the module was loaded at.
/// </devdoc>
public IntPtr BaseAddress { get; internal set; }
/// <devdoc>
/// Returns the amount of memory required to load the module. This does
/// not include any additional memory allocations made by the module once
/// it is running; it only includes the size of the static code and data
/// in the module file.
/// </devdoc>
public int ModuleMemorySize { get; internal set; }
/// <devdoc>
/// Returns the memory address for function that runs when the module is
/// loaded and run.
/// </devdoc>
public IntPtr EntryPointAddress { get; internal set; }
/// <devdoc>
/// Returns version information about the module.
/// </devdoc>
public FileVersionInfo FileVersionInfo => _fileVersionInfo ??= FileVersionInfo.GetVersionInfo(_fileName);
public override string ToString() => $"{base.ToString()} ({ModuleName})";
}
}