Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.2.0 #425

Merged
merged 97 commits into from
Mar 22, 2023
Merged

5.2.0 #425

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
557d91e
Add modi stream models.
Washi1337 Feb 2, 2023
9165e2d
Add PdbModule.
Washi1337 Feb 2, 2023
a03c509
Add SerializedPdbModule.
Washi1337 Feb 2, 2023
957ed70
Add S_OBJNAME symbol read support.
Washi1337 Feb 2, 2023
7d0d26f
Add S_COMPILE2 and S_COMPILE3 read support.
Washi1337 Feb 2, 2023
4e1efa2
Add PdbModule tests.
Washi1337 Feb 3, 2023
5b4d554
BUGFIX: Off-by-one error in CompileAttributes enum.
Washi1337 Feb 3, 2023
3fbe7ce
Extract TpiStreamCache helper class.
Washi1337 Feb 3, 2023
2eaede0
Extract generic TryGetLeafRecord.
Washi1337 Feb 3, 2023
4f076ee
Add read support for LF_STRING_ID, LF_SUBSTR_LIST, LF_BUILDINFO, S_BU…
Washi1337 Feb 3, 2023
8ed4f00
Add read support for S_LOCAL.
Washi1337 Feb 4, 2023
39858dd
Add read support for S_DEFRANGE_REGISTER_REL.
Washi1337 Feb 4, 2023
3ec9eb6
Add read support for S_DEFRANGE_FRAMEPOINTER[_FULLSCOPE].
Washi1337 Feb 4, 2023
d80c675
Add read support for S_REGREL32.
Washi1337 Feb 4, 2023
c3ebbbe
Add read support for S_FRAMEPROC.
Washi1337 Feb 4, 2023
dc95b6f
Add read support for S_UNAMESPACE.
Washi1337 Feb 10, 2023
3d8994e
Add read support S_BPREL32. Rename RelativeRegister to RegisterRelative.
Washi1337 Feb 10, 2023
30b691c
Add read support for S_CALLSITEINFO.
Washi1337 Feb 10, 2023
6c7ec13
Add read support for LF_FUNC_ID, S_CALLERS and S_CALLEES.
Washi1337 Feb 10, 2023
7e97353
Add read support for S_ENVBLOCK.
Washi1337 Feb 10, 2023
15a77af
Extract ICodeViewSymbol, ICodeViewSymbolProvider, IScopeCodeViewSymbol.
Washi1337 Feb 11, 2023
7c26b11
Add read support for S_GPROC32, S_GPROC32_ID, S_LPROC32 and S_LPROC32…
Washi1337 Feb 11, 2023
2434937
Extract SymbolStreamReader class to remove code duplication.
Washi1337 Feb 11, 2023
99cb155
Nest symbols into procedure symbols when possible.
Washi1337 Feb 11, 2023
a3b907d
Add read support for S_THUNK32.
Washi1337 Feb 11, 2023
28c8bac
Add read support S_GDATA32, S_LDATA32. Add missing xmldocs.
Washi1337 Feb 11, 2023
daec1aa
Remove S_END entries from symbol lists.
Washi1337 Feb 11, 2023
b17c191
BUGFIX: Include SentinelParameterTypes in total param count when writ…
Washi1337 Feb 11, 2023
caeef35
BUGFIX: Define methods before references to allow for method def memb…
Washi1337 Feb 11, 2023
3737efd
BUGFIX: Add null check for .NET data directory importing.
Washi1337 Feb 11, 2023
fd08dd0
Avoid allocating empty byte arrays in signatures if no extra data is …
Washi1337 Feb 11, 2023
e0c76e5
Bump build versions and update copyright year.
Washi1337 Feb 11, 2023
a2a079f
Remove spurious IsSentinel, add undocumented NativeVarArg calling con…
Washi1337 Feb 11, 2023
1e64abb
Add read support S_COFFGROUP.
Washi1337 Feb 12, 2023
e938ba5
Add read support for S_DEFRANGE_REGISTER.
Washi1337 Feb 12, 2023
11fcc6f
Add read support for S_FILESTATIC.
Washi1337 Feb 12, 2023
a5ebe86
Add read support for S_FRAMECOOKIE.
Washi1337 Feb 12, 2023
d09c911
Add read support for S_INLINESITE.
Washi1337 Feb 12, 2023
f898516
Add read support for S_LABEL32.
Washi1337 Feb 12, 2023
da8973b
Add read support for S_REGISTER.
Washi1337 Feb 12, 2023
63f4fbe
Add read support S_SECTION.
Washi1337 Feb 12, 2023
9546e45
Add helper ToString methods.
Washi1337 Feb 12, 2023
bba61e2
Merge pull request #414 from Washi1337/issue/sentinel-type-preservation
Washi1337 Feb 14, 2023
2bab60b
Extract ICodeViewLeaf, ITpiLeaf, IIpiLeaf. Rename XXXIdLeaf to XXXIde…
Washi1337 Feb 15, 2023
2243883
Fix casing for some code view leaf kinds.
Washi1337 Feb 15, 2023
39025b9
Improve readability in lookahead of symbol stream reader.
Washi1337 Feb 15, 2023
8420b2b
Rename ID leaf tests to adhere to new naming scheme.
Washi1337 Feb 15, 2023
2e1aaed
Let DataSymbol implement IVariableSymbol. Replace redundant xmldoc wi…
Washi1337 Feb 15, 2023
8f49471
Fix nullability for DataSymbol.Name
Washi1337 Feb 15, 2023
ed249ea
Merge pull request #412 from Washi1337/feature/modi-streams
Washi1337 Feb 15, 2023
bc3c201
Bump BenchmarkDotNet from 0.13.4 to 0.13.5
dependabot[bot] Feb 20, 2023
399523b
Bump Microsoft.NET.Test.Sdk from 17.4.1 to 17.5.0
dependabot[bot] Feb 21, 2023
c8a8a4b
Merge pull request #415 from Washi1337/dependabot/nuget/development/B…
Washi1337 Feb 22, 2023
594ca04
Merge pull request #416 from Washi1337/dependabot/nuget/development/M…
Washi1337 Feb 22, 2023
499e8c3
Bump xunit.runner.visualstudio from 2.4.3 to 2.4.5
dependabot[bot] Feb 27, 2023
1c0cf0c
Add PdbImage.Get[Id]LeafRecords.
Washi1337 Feb 28, 2023
cb59711
Add PdbModule.SourceFiles.
Washi1337 Feb 28, 2023
1acf77b
BUGFIX: Replace direct cast with Convert.ToUInt32 for class type reco…
Washi1337 Feb 28, 2023
ca113e4
Add `Parameter.CreateParameterDefinition` helper method
ElektroKill Feb 28, 2023
e27b6e8
Don't use unbound generic type for virtual hidden this parameter
ElektroKill Feb 28, 2023
0756858
Merge pull request #417 from Washi1337/dependabot/nuget/development/x…
Washi1337 Feb 28, 2023
7d43fb2
Add unit test to cover hidden this parameter changes
ElektroKill Feb 28, 2023
c3a8193
Fix brace style
ElektroKill Feb 28, 2023
dae9909
Fix parameter count calculation for method signatures with ExplicitThis
ElektroKill Feb 28, 2023
87ce374
Improve unit test for instantiated generic virtual this parameter
ElektroKill Mar 2, 2023
2b0c0aa
Replace `CreateParameterDefinition` with `GetOrCreateDefinition`
ElektroKill Mar 2, 2023
a17db5f
Make `GetOrCreateDefinition` throw an exception instead of returning …
ElektroKill Mar 2, 2023
9cbf3aa
Add unit tests for `GetOrCreateDefinition`
ElektroKill Mar 2, 2023
a105ac3
Merge pull request #418 from ElektroKill/feature/parameter-qol-improv…
Washi1337 Mar 2, 2023
8357a77
Add OptionalHeader::SetDataDirectory helper method.
Washi1337 Mar 15, 2023
a5ec100
Add TypeSignature::GetReducedType, GetVerificationType, GetIntermedia…
Washi1337 Mar 15, 2023
8d27fb4
Add TypeSignature::GetUnderlyingType.
Washi1337 Mar 15, 2023
5ae06dc
Add ArrayBaseTypeSignature and TypeSignature::IsCompatibleWith and Is…
Washi1337 Mar 15, 2023
e839a83
Add docs for the new type comparison APIs.
Washi1337 Mar 15, 2023
ac4129e
Simplify, fix code typos in docs.
Washi1337 Mar 15, 2023
1b3d76b
Add DotNetEntryPoint DU struct.
Washi1337 Mar 15, 2023
f535fc0
Use explicit DotNetEntryPoint struct in DotNetDirectoryBuffer.
Washi1337 Mar 15, 2023
cd71838
Add invalid entry point token check. Clarify setting entry point prop…
Washi1337 Mar 16, 2023
7575a7d
Add PdbSourceFile abstraction.
Washi1337 Mar 16, 2023
d3656c3
Add docs on how to access PDB symbols.
Washi1337 Mar 16, 2023
0724dd7
Fix references to pdb docs.
Washi1337 Mar 16, 2023
c6c35ed
Merge pull request #422 from Washi1337/feature/dotnet-entrypoint
Washi1337 Mar 16, 2023
d6da1dc
Add StripModifiers, ignore modifiers on compatibility checks.
Washi1337 Mar 18, 2023
89eefd2
Add BundlerParameters::FromTemplate and FromExistingFile, obsolete co…
Washi1337 Mar 18, 2023
31c9200
Update documentation on new bundle repacking feature.
Washi1337 Mar 18, 2023
6e21d57
Merge pull request #423 from Washi1337/feature/pdb-docs
Washi1337 Mar 18, 2023
f6db4f8
Rename to FromExistingBundle, simplify docs.
Washi1337 Mar 18, 2023
e98f1f5
Add comparer parameter for IsCompatibleWith and related methods.
Washi1337 Mar 18, 2023
078a81d
Add generic interface implementation compatibility checks.
Washi1337 Mar 18, 2023
bf84256
Generalize interface impl traversal. Simplify implementation of IsDir…
Washi1337 Mar 18, 2023
2190f89
Add V1 and V2 repackage tests. Ensure temp dirs are not present on di…
Washi1337 Mar 19, 2023
08dc296
Merge pull request #424 from Washi1337/feature/repackage-apphosts
Washi1337 Mar 19, 2023
cfda2d4
Resolve compiler warnings.
Washi1337 Mar 19, 2023
e4781b1
Merge pull request #421 from Washi1337/feature/is-assignable-to
Washi1337 Mar 19, 2023
7e54ebb
Fix xmldoc path for AsmResolver.Symbols.Pdb.xml
Washi1337 Mar 22, 2023
e28df25
Add basic dbi and info stream properties to PdbImage.
Washi1337 Mar 22, 2023
c81797d
Fix some casing and shorten titles in docs.
Washi1337 Mar 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project>

<PropertyGroup>
<Copyright>Copyright © Washi 2016-2022</Copyright>
<Copyright>Copyright © Washi 2016-2023</Copyright>
<PackageProjectUrl>https://github.com/Washi1337/AsmResolver</PackageProjectUrl>
<PackageLicense>https://github.com/Washi1337/AsmResolver/LICENSE.md</PackageLicense>
<RepositoryUrl>https://github.com/Washi1337/AsmResolver</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<LangVersion>10</LangVersion>
<Version>5.1.0</Version>
<Version>5.2.0</Version>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- master

image: Visual Studio 2022
version: 5.1.0-master-build.{build}
version: 5.2.0-master-build.{build}
configuration: Release

skip_commits:
Expand Down Expand Up @@ -33,7 +33,7 @@
- development

image: Visual Studio 2022
version: 5.1.0-dev-build.{build}
version: 5.2.0-dev-build.{build}
configuration: Release

skip_commits:
Expand Down
36 changes: 31 additions & 5 deletions docs/dotnet/bundles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AppHost / SingleFileHost Bundles

Since the release of .NET Core 3.1, it is possible to deploy .NET assemblies as a single binary. These files are executables that do not contain a traditional .NET metadata header, and run natively on the underlying operating system via a platform-specific application host bootstrapper.

AsmResolver supports extracting the embedded files from these types of binaries. Additionally, given an application host template provided by the .NET SDK, AsmResolver also supports constructing new bundles as well. All relevant code is found in the following namespace:
AsmResolver supports extracting the embedded files from these types of binaries. Additionally, given the original file or an application host template provided by the .NET SDK, AsmResolver also supports constructing new bundles as well. All relevant code is found in the following namespace:

.. code-block:: csharp

Expand Down Expand Up @@ -96,14 +96,14 @@ Constructing new bundled executable files requires a template file that AsmResol
- ``<DOTNET-INSTALLATION-PATH>/sdk/<version>/AppHostTemplate``
- ``<DOTNET-INSTALLATION-PATH>/packs/Microsoft.NETCore.App.Host.<runtime-identifier>/<version>/runtimes/<runtime-identifier>/native``

Using this template file, it is then possible to write a new bundled executable file using ``WriteUsingTemplate``:
Using this template file, it is then possible to write a new bundled executable file using ``WriteUsingTemplate`` and the ``BundlerParameters::FromTemplate`` method:

.. code-block:: csharp

BundleManifest manifest = ...
manifest.WriteUsingTemplate(
@"C:\Path\To\Output\File.exe",
new BundlerParameters(
BundlerParameters.FromTemplate(
appHostTemplatePath: @"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Host.win-x64\6.0.0\runtimes\win-x64\native\apphost.exe",
appBinaryPath: @"HelloWorld.dll"));

Expand All @@ -117,12 +117,38 @@ For bundle executable files targeting Windows, it may be required to copy over s
BundleManifest manifest = ...
manifest.WriteUsingTemplate(
@"C:\Path\To\Output\File.exe",
new BundlerParameters(
BundlerParameters.FromTemplate(
appHostTemplatePath: @"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Host.win-x64\6.0.0\runtimes\win-x64\native\apphost.exe",
appBinaryPath: @"HelloWorld.dll",
imagePathToCopyHeadersFrom: @"C:\Path\To\Original\HelloWorld.exe"));

``BundleManifest`` also defines other ```WriteUsingTemplate`` overloads taking ``byte[]``, ``IDataSource`` or ``IPEImage`` instances instead of paths.

If you do not have access to a template file (e.g., if the SDK is not installed) but have another existing PE file that was packaged in a similar fashion, it is then possible to use this file as a template instead by extracting the bundler parameters using the ``BundlerParameters::FromExistingBundle`` method. This is in particularly useful when trying to patch existing AppHost bundles:

.. code-block:: csharp

string inputPath = @"C:\Path\To\Bundled\HelloWorld.exe";
string outputPath = Path.ChangeExtension(inputPath, ".patched.exe");

// Read manifest.
var manifest = BundleManifest.FromFile(inputPath);

/* ... Make changes to manifest and its files ... */

// Repackage bundle using existing bundle as template.
manifest.WriteUsingTemplate(
outputPath,
BundlerParameters.FromExistingBundle(
originalFile: inputPath,
appBinaryPath: mainFile.RelativePath));


.. warning::

The ``BundlerParameters.FromExistingBundle`` method applies heuristics on the input file to determine the parameters for patching the input file. As heuristics are not perfect, this is not guaranteed to always work.


``BundleManifest`` and ``BundlerParameters`` also define overloads of the ``WriteUsingTemplate`` and ``FromTemplate`` / ``FromExistingBundle`` respectively, taking ``byte[]``, ``IDataSource`` or ``IPEImage`` instances instead of file paths.


Managing Files
Expand Down
89 changes: 78 additions & 11 deletions docs/dotnet/type-signatures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ All relevant classes in this document can be found in the following namespaces:
using AsmResolver.DotNet.Signatures.Types;


Overview of all Type Signatures
-------------------------------
Overview
--------

Basic leaf type signatures:

Expand Down Expand Up @@ -78,8 +78,8 @@ Corlib type signatures can also be looked up by their element type, by their ful
If an invalid element type, name or type descriptor is passed on, these methods return ``null``.


TypeDefOrRefSignature
---------------------
Class and Struct Types
----------------------

The ``TypeDefOrRefSignature`` class is used to reference types in either the ``TypeDef`` or ``TypeRef`` (and sometimes ``TypeSpec``) metadata table.

Expand All @@ -101,8 +101,8 @@ Alternatively, ``CreateTypeReference`` can be used on any ``IResolutionScope``:
While it is technically possible to reference a basic type such as ``System.Int32`` as a ``TypeDefOrRefSignature``, it renders the .NET module invalid by most implementations of the CLR. Always use the ``CorLibTypeSignature`` to reference basic types within your blob signatures.


GenericInstanceTypeSignature
----------------------------
Generic Instance Types
----------------------

The ``GenericInstanceTypeSignature`` class is used to instantiate generic types with type arguments:

Expand All @@ -128,8 +128,8 @@ Alternatively, a generic instance can also be generated via the ``MakeGenericTyp
// listOfString now contains a reference to List<string>.


FunctionPointerTypeSignature
----------------------------
Function Pointer Types
----------------------

Function pointer signatures are strongly-typed pointer types used to describe addresses to functions or methods. In AsmResolver, they are represented using a ``MethodSignature``:

Expand Down Expand Up @@ -175,8 +175,8 @@ To quickly transform any ``ITypeDescriptor`` into a ``TypeSignature``, it is pos
Likewise, a ``TypeSignature`` can also be converted back to a ``ITypeDefOrRef``, which can be referenced using a metadata token, using the ``TypeSignature.ToTypeDefOrRef()`` method.


Decorating type signatures
--------------------------
Decorating Types
----------------

Type signatures can be annotated with extra properties, such as an array or pointer specifier.

Expand Down Expand Up @@ -205,7 +205,7 @@ Below an overview of all factory shortcut methods:
+===================================================================+==================================================================================================================+
| ``MakeArrayType(int dimensionCount)`` | Wraps the type in a new ``ArrayTypeSignature`` with ``dimensionCount`` zero based dimensions with no upperbound. |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| ``MakeArrayType(ArrayDimension[] dimensinos)`` | Wraps the type in a new ``ArrayTypeSignature`` with ``dimensions`` set as dimensions |
| ``MakeArrayType(ArrayDimension[] dimensions)`` | Wraps the type in a new ``ArrayTypeSignature`` with ``dimensions`` set as dimensions |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| ``MakeByReferenceType()`` | Wraps the type in a new ``ByReferenceTypeSignature`` |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
Expand All @@ -219,3 +219,70 @@ Below an overview of all factory shortcut methods:
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| ``MakeGenericInstanceType(TypeSignature[] typeArguments)`` | Wraps the type in a new ``GenericInstanceTypeSignature`` with the provided type arguments. |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+



Comparing Types
---------------

Type signatures can be tested for semantic equivalence using the ``SignatureComparer`` class.
Most use-cases of this class will not require any customization.
In these cases, the default ``SignatureComparer`` can be used:

.. code-block:: csharp

var comparer = SignatureComparer.Default;


However, if you wish to configure the comparer (e.g., for relaxing some of the declaring assembly version comparison rules), it is possible to create a new instance instead:

.. code-block:: csharp

var comparer = new SignatureComparer(SignatureComparisonFlags.AllowNewerVersions);


Once a comparer is obtained, we can test for type equality using any of the overloaded ``Equals`` methods:

.. code-block:: csharp

TypeSignature type1 = ...;
TypeSignature type2 = ...;

if (comparer.Equals(type1, type2))
{
// type1 and type2 are semantically equivalent.
}


The ``SignatureComparer`` class implements various instances of the ``IEqualityComparer<T>`` interface, and as such, it can be used as a comparer for dictionaries and related types:

.. code-block:: csharp

var dictionary = new Dictionary<TypeSignature, TValue>(comparer);


.. note::

The ``SignatureComparer`` class also implements equality comparers for other kinds of metadata, such as field and method descriptors and their signatures.


In some cases, however, exact type equivalence is too strict of a test.
Since .NET facilitates an object oriented environment, many types will inherit or derive from each other, making it difficult to pinpoint exactly which types we would need to compare to test whether two types are compatible with each other.

Section I.8.7 of the ECMA-335 specification defines a set of rules that dictate whether values of a certain type are compatible with or assignable to variables of another type.
These rules are implemented in AsmResolver using the ``IsCompatibleWith`` and ``IsAssignableTo`` methods:

.. code-block:: csharp

if (type1.IsCompatibleWith(type2))
{
// type1 can be converted to type2.
}


.. code-block:: csharp

if (type1.IsAssignableTo(type2))
{
// Values of type1 can be assigned to variables of type2.
}
11 changes: 11 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,14 @@ Table of Contents:
dotnet/type-memory-layout
dotnet/bundles
dotnet/advanced-pe-image-building.rst



.. toctree::
:maxdepth: 1
:caption: PDB Symbols
:name: sec-pdb

pdb/index
pdb/basics
pdb/symbols
113 changes: 113 additions & 0 deletions docs/pdb/basics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
Basic I/O
=========

Every PDB image interaction is done through classes defined by the ``AsmResolver.Symbols.Pdb`` namespace:

.. code-block:: csharp

using AsmResolver.Symbols.Pdb;


Creating a new PDB Image
------------------------

Creating a new image can be done by instantiating a ``PdbImage`` class:

.. code-block:: csharp

var image = new PdbImage();


Opening a PDB Image
-------------------

Opening a PDB Image can be done through one of the ``FromXXX`` methods from the ``PdbImage`` class:

.. code-block:: csharp

byte[] raw = ...
var image = PdbImage.FromBytes(raw);

.. code-block:: csharp

var image = PdbImage.FromFile(@"C:\myfile.pdb");

.. code-block:: csharp

MsfFile msfFile = ...
var image = PdbImage.FromFile(msfFile);

.. code-block:: csharp

BinaryStreamReader reader = ...
var image = PdbImage.FromReader(reader);


If you want to read large files (+100MB), consider using memory mapped I/O instead:

.. code-block:: csharp

using var service = new MemoryMappedFileService();
var image = PdbImage.FromFile(service.OpenFile(@"C:\myfile.pdb"));


Writing a PDB Image
-------------------

Writing PDB images directly is currently not supported yet, however there are plans to making this format fully serializable.


Creating a new MSF File
-----------------------

Multi-Stream Format (MSF) files are files that form the backbone structure of all PDB images.
AsmResolver fully supports this lower level type of access to MSF files using the ``MsfFile`` class.

To create a new MSF file, use one of its constructors:

.. code-block:: csharp

var msfFile = new MsfFile();


.. code-block:: csharp

var msfFile = new MsfFile(blockSize: 4096);


Opening an MSF File
-------------------

Opening existing MSF files can be done in a very similar fashion as reading a PDB Image:

.. code-block:: csharp

byte[] raw = ...
var msfFile = MsfFile.FromBytes(raw);

.. code-block:: csharp

var msfFile = MsfFile.FromFile(@"C:\myfile.pdb");

.. code-block:: csharp

BinaryStreamReader reader = ...
var msfFile = MsfFile.FromReader(reader);


Similar to reading PDB images, if you want to read large files (+100MB), consider using memory mapped I/O instead:

.. code-block:: csharp

using var service = new MemoryMappedFileService();
var msfFile = MsfFile.FromFile(service.OpenFile(@"C:\myfile.pdb"));


Writing an MSF File
-------------------

Writing an MSF file can be done through one of the ``Write`` method overloads.

.. code-block:: csharp

msfFile.Write(@"C:\myfile.patched.pdb");
14 changes: 14 additions & 0 deletions docs/pdb/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Overview
========

The Program Database (PDB) file format is a format developed by Microsoft for storing debugging information about binary files.
PDBs are typically constructed based on the original source code the binary was compiled with, and lists various symbols that the source code defines and/or references.

Since version 5.0, AsmResolver provides a work-in-progress implementation for reading (and sometimes writing) PDB files to allow for better analysis of compiled binaries.
This implementation is fully managed, and thus does not depend on libraries such as the Debug Interface Access (DIA) that only work on the Windows platform.
Furthermore, this project also aims to provide additional documentation on the file format, to make it more accessible to other developers.

.. warning::

As the PDB file format is not very well documented, and mostly is reverse engineered from the official implementation provided by Microsoft, not everything in this API is finalized or stable yet.
As such, this part of AsmResolver's API is still likely to undergo some breaking changes as development continues.
Loading