Microsoft Wiki

Checkout our wiki's socials

READ MORE

Microsoft Wiki
Stub
This article is a stub, an article too short to provide more than rudimentary information about a subject. You can help the Microsoft Wiki by expanding it.
This article is incomplete. You can help the Microsoft Wiki by expanding it.

Windows Metafile (WMF) is an image file format originally designed for Microsoft Windows in the early 1990s. The original Windows Metafile format was not device-independent (though could be made more so with placement headers) and may contains both vector graphics and bitmap components. It acts in a similar manner to SVG files. WMF files were later superseded by Enhanced Metafiles (EMF files) which did provide for device-independence. EMF files were themselves enhanced via the EMF+ files.

Essentially, a metafile stores a list of records consisting of drawing commands, property definitions and graphics objects to display an image on screen. The drawing commands used are closely related to the commands of the Graphics Device Interface (GDI) API used for drawing in Windows.

There are three major types of metafiles: WMF, a 16-bit format introduced in Windows 3.0 and a native vector format for Microsoft Office applications such as Word, PowerPoint, and Publisher; EMF files, which replaced WMF files and work on the same principle, with it being 32-bit and allowing for the embedding of private data within "comment" records; and EMF+ files, an extension to EMF files and embedded in these comment records allowing for images and text using commands, objects, and properties that are similar to Windows GDI+.

The format is somewhat similar in prupose and design to the PostScript format used in Unix systems.

SetAbortProc exploit[]

Exploits using the "SetAbortProc" GDI function were discovered in December 2005. The function, which registers an error handler normally intended for use when a print job is cancelled during spooling, allows arbitrary code added to a WMF image to be executed without the permission of the user.

Alternative implementations[]

The WMF format was designed to be executed by the Windows graphics layer GDI in order to restore the image, but as the WMF binary files contain the definition of the GDI graphic primitives that constitute this image, it is possible to design alternative libraries that render WMF binary files, or convert them in other graphic formats.

For example, the Batik library is able to render WMF files and convert them to their SVG equivalent. The Vector Graphics package of the FreeHEP Java library allows to save Java2D drawings as EMF files.

Currently, the only programme that directly unpacks EMZ and WMZ files into EMF and WMF files is SpeedCommander 12.