winmd library

Dart language support for working with Windows Metadata.

This library may be used to interrogate the Windows developer API, whether unmanaged APIs like Win32 or COM, or APIs like Windows Runtime that include their own metadata.

The library consumes metadata in the ECMA-335 format, which originated as part of the Common Language Infrastructure (CLI), part of the standardized interface offered by .NET libraries. Since its creation, Windows Metadata has been used to provide a language-neutral specification of the Windows Runtime APIs. More recently still, the same format has been used to provide machine-readable metadata for the traditional Win32 and COM APIs that have been available in Windows for many years.

Being able to interpret this format from Dart is useful for a variety of reasons; however, the original reason for this package's creation was to support a Dart language projection of the Win32 API. Using Windows Metadata allows for a projection of the Win32 API to be generated programmatically, and provides resilience against errors or changes over time.

In addition to the package above and more specialized alternatives, other tooling may also find this package useful for creating Windows utilities with Dart or Flutter.

To start using this library, it's necessary to obtain a Scope, which contains a named set of metadata. For most scenarios, you should retrieve a scope through one of the static methods of the MetadataStore class, which caches retrieved scopes. The winmd package embeds the Win32 API metadata for ease of distribution. so the following can be used to get to the Win32 scope:

  final scope = MetadataStore.getWin32Scope();

From here, you can interrogate the scope object for its children; in particular, the collection of TypeDef objects that in turn contain Method, Field, Event and Property members.

In general, the model presented by this package is consistent with the APIs exposed by the IMetaDataImport COM interface exposed by rometadata.dll.

Classes

Architecture
The architectures supported by a specific Win32 method or struct.
ClassLayout
Layout information for the class referenced by a specified token.
CustomAttribute
A custom (named) attribute.
CustomAttributeParameter
A single parameter within a custom attribute.
Event
An event.
Field
A field.
FieldOffset
A tuple of a field and its byte offset within a parent struct.
GenericParam
A generic parameter.
GenericParamConstraint
A generic parameter constraint.
MemberRef
A member reference.
MetadataStore
Caches a reader for each file scope.
Method
A method.
MethodImplementationFeatures
Contains values that describe method implementation features.
ModuleRef
A module reference.
Parameter
A parameter or return type.
PEKind
A representation of the assembly file's portable executable format.
PinvokeMap
A P/Invoke method representation.
Property
A property object.
Scope
A metadata scope, which typically matches an on-disk file.
SpecialConstraints
Identifies special constraints on a generic parameter.
TokenObject
The base object for metadata objects.
TypeDef
Represents a TypeDef in the Windows Metadata file
TypeIdentifier
Represents a type, as for example used in a parameter. Return types use the same class, although they have no name.
TypeTuple
An intermediate representation of a segment of a signature.
UncompressedData
A utility class for uncompressing data from the metadata blob heap.

Enums

BaseType
Specifies a common language runtime Type, a type modifier, or information about a type in a metadata type signature.
BestFit
Convention for mapping Unicode characters in P/Invoke calls.
CallingConvention
Platform calling convention.
CodeType
Code type of contained code.
FieldAccess
Field accessibility information.
ImageType
The platform targeted by an executable.
MemberAccess
Specifies member access.
PreferredArchitecture
Indicates the preferred architecture for a requested TypeDef.
StringFormat
Specifies how string types are interpreted.
StringMarshalConvention
Convention for marshalling P/Invoke function strings.
ThrowOnUnmappableChar
Convention for how the interop marshaler should respond to an unmappable character.
TokenType
The type of object represented by a given token.
TypeLayout
Specifies how fields are laid out in the type.
TypeVisibility
Specifies visibility of a type to other types.
Variance
Indicates the kind of variance for a delegate / interface generic parameter.
VtableLayout
Specifies virtual table layout.

Mixins

CustomAttributesMixin
Represents an object that has custom (named) attributes associated with it.
GenericParamsMixin
Represents an object that contains generic parameters.
SupportedArchitecturesMixin
Represents an object that may have an attribute for supported platform architectures.

Constants

MAX_STRING_SIZE → const int

Exceptions / Errors

WinmdException
An exception generated by the winmd package.