This patch adds support for yank-media on MS-Windows. Media is handled in some different ways: - Clipboard data that is already named as a mime-type needs no work besides returning it. For example, Krita provides copied pixels as multiple image/xxxx types, and Firefox provides html as text/html. - Other programs don't use mime types. We try to recognize some names and change then to mime types. For example, GIMP uses the name "PNG" for copied pixels. We change it to image/png. LibreOffice also uses "PNG" for images. It uses "HTML Format" for rich text and also for spreadsheet cells, and we change that to text/html. - Finally, some programs supply image data in DIBV5 format. We offer it as image/png, and convert in on the fly when requested. Firefox does this when using "Copy image". This are the tested media types: - [X] GIMP copy pixels -> image/png - [X] LibreOffice vectorial object -> image/png - [X] LibreOffice embedded image -> image/png - [X] LibreOffice rich text -> text/html - [X] LibreOffice Calc cells -> text/html - [X] Firefox copy image -> image/png (also text/html as embedded image) - [X] Firefox page text -> text/html - [X] Krita pixels -> image/png (and others) - [X] InkScape -> image/svg+xml, image/png Images can be yanked in at least org-mode, message-mode, html-mode. HTML (text/html) can be yanked in at least html-mode. SVG will not work until bug #74044 is fixed. LibreOffice offers vectorial objects as Metafiles, that could be converted to SVG. I may do that at some point. This patch does NOT include the planned functionality to yank rich text as propertized text, or to use RTF format as a source. Those are not Windows-only. It also includes a small fix in sgml-mode.el. It was mangling image files because of Windows new lines. The image conversion is done using GdiPlus functions, which are already used on w32image.c, but are static. I have splitted this file into .c and .h, to be able to reuse those definitions. The image conversion requires that native image functions are activated. Now I think this patch may have been splitted into 2 or 3 for review. Let me know if that would be better.