HiraokaHyperTools.CoffReader 0.2.0

dotnet add package HiraokaHyperTools.CoffReader --version 0.2.0
NuGet\Install-Package HiraokaHyperTools.CoffReader -Version 0.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HiraokaHyperTools.CoffReader" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HiraokaHyperTools.CoffReader --version 0.2.0
#r "nuget: HiraokaHyperTools.CoffReader, 0.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HiraokaHyperTools.CoffReader as a Cake Addin
#addin nuget:?package=HiraokaHyperTools.CoffReader&version=0.2.0

// Install HiraokaHyperTools.CoffReader as a Cake Tool
#tool nuget:?package=HiraokaHyperTools.CoffReader&version=0.2.0

HiraokaHyperTools.CoffReader

Nuget

This will parse .obj file built by modern Visual Studio C++ compiler.

Enumeration usage

var objFileBytes = File.ReadAllBytes(ResolvePath(objFile));

var parsed = CoffParser.Parse(objFileBytes);

parsed.Sections
    .ToList()
    .ForEach(
        it => Console.WriteLine($"{it.Name,-8} {it.Flags:X8} {it.RawDataPosition,6} {it.SectionSize,6} ")
    );

Console.WriteLine();

parsed.Symbols
    .ToList()
    .ForEach(
        it => Console.WriteLine($"0x{it.Value:X8} {it.SectionNumber,3} {it.SymbolType,2} {it.StorageClass} {it.NumAux} {it.Name} ")
    );

cygwin-x64/cyginvokezlibversion_dll_d000001.o

.text    60300020    220      8 
.idata$7 C0300000    228      4 
.idata$5 C0300000    232      8 
.idata$4 C0300000    240      8 
.idata$6 C0300000    248     28 

0x00000000   1  0 3 0 .text 
0x00000000   2  0 3 0 .idata$7 
0x00000000   3  0 3 0 .idata$5 
0x00000000   4  0 3 0 .idata$4 
0x00000000   5  0 3 0 .idata$6 
0x00000000   1  0 2 0 _Z17invokezlibversionv 
0x00000000   3  0 2 0 __imp__Z17invokezlibversionv 
0x00000000   0  0 2 0 _head_cyginvokezlibversion_dll 

Windows import library detection usage

var objData = ArFileParser.ReadData(arFileData, arEntry);

var obj = CoffParser.Parse(objData);
if (obj.Magic == CoffParsed.I386MAGIC || obj.Magic == CoffParsed.AMD64MAGIC)
{
    foreach (var section in obj.Sections.Where(section => section.Name == ".idata$7"))
    {
        var idataV7 = CoffParser.ReadRawData(objData, section);
        list.AddRange(
            Encoding.Latin1.GetString(idataV7)
                .Split('\0')
                .Where(it => it.Length != 0)
        );
    }
}
else
{
    _logger.LogWarning($"Invalid COFF magic 0x{obj.Magic:X4} of `{arEntry.FileName}` in `{libFile}`");
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 229 3/19/2023
0.1.0 201 3/7/2023