mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-07-01 20:40:27 +03:00
changes all over the place
This commit is contained in:
56
X86Disassembler/Analysers/FileAbsoluteAddress.cs
Normal file
56
X86Disassembler/Analysers/FileAbsoluteAddress.cs
Normal file
@ -0,0 +1,56 @@
|
||||
namespace X86Disassembler.Analysers;
|
||||
|
||||
public abstract class Address(ulong value, ulong imageBase)
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual value of the address, not specifically typed.
|
||||
/// </summary>
|
||||
protected readonly ulong Value = value;
|
||||
|
||||
/// <summary>
|
||||
/// PE.ImageBase from which this address is constructed
|
||||
/// </summary>
|
||||
protected readonly ulong ImageBase = imageBase;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Absolute address in the PE file
|
||||
/// </summary>
|
||||
public class FileAbsoluteAddress(ulong value, ulong imageBase) : Address(value, imageBase)
|
||||
{
|
||||
public ulong GetValue()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
|
||||
public virtual VirtualAddress AsImageBaseAddress()
|
||||
{
|
||||
return new VirtualAddress(Value + ImageBase, ImageBase);
|
||||
}
|
||||
|
||||
public virtual FileAbsoluteAddress AsFileAbsolute()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Address from PE.ImageBase
|
||||
/// </summary>
|
||||
public class VirtualAddress : FileAbsoluteAddress
|
||||
{
|
||||
public VirtualAddress(ulong value, ulong imageBase) : base(value, imageBase)
|
||||
{
|
||||
}
|
||||
|
||||
public override VirtualAddress AsImageBaseAddress()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public override FileAbsoluteAddress AsFileAbsolute()
|
||||
{
|
||||
return new FileAbsoluteAddress(Value - ImageBase, ImageBase);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user