Add new dmemmgr.h header for Video-memory memory-API.
Modify dmksctrl.h so that missing defines are present, and the interface
works well in C++-mode, too.
diff --git a/mingw-w64-headers/include/dmemmgr.h b/mingw-w64-headers/include/dmemmgr.h
new file mode 100644
index 0000000..ea473a7
--- /dev/null
+++ b/mingw-w64-headers/include/dmemmgr.h
@@ -0,0 +1,134 @@
+/**
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
+#ifndef __DMEMMGR_INCLUDED__
+#define __DMEMMGR_INCLUDED__
+
+#include <winapifamily.h>
+
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+
+#define VMEMHEAP_LINEAR __MSABI_LONG(0x1)
+#define VMEMHEAP_RECTANGULAR __MSABI_LONG(0x2)
+#define VMEMHEAP_ALIGNMENT __MSABI_LONG(0x4)
+
+#define SURFACEALIGN_DISCARDABLE __MSABI_LONG(0x1)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+  typedef ULONG_PTR FLATPTR;
+
+  typedef struct _SURFACEALIGNMENT {
+    __C89_NAMELESS union {
+      struct {
+	DWORD dwStartAlignment;
+	DWORD dwPitchAlignment;
+	DWORD dwFlags;
+	DWORD dwReserved2;
+      } Linear;
+      struct {
+	DWORD dwXAlignment;
+	DWORD dwYAlignment;
+	DWORD dwFlags;
+	DWORD dwReserved2;
+      } Rectangular;
+    };
+  } SURFACEALIGNMENT;
+
+  typedef struct _HEAPALIGNMENT {
+    DWORD dwSize;
+    DDSCAPS ddsCaps;
+    DWORD dwReserved;
+    SURFACEALIGNMENT ExecuteBuffer;
+    SURFACEALIGNMENT Overlay;
+    SURFACEALIGNMENT Texture;
+    SURFACEALIGNMENT ZBuffer;
+    SURFACEALIGNMENT AlphaBuffer;
+    SURFACEALIGNMENT Offscreen;
+    SURFACEALIGNMENT FlipTarget;
+  } HEAPALIGNMENT;
+
+  typedef struct _DD_GETHEAPALIGNMENTDATA {
+    ULONG_PTR dwInstance;
+    DWORD dwHeap;
+    HRESULT ddRVal;
+    VOID *GetHeapAlignment;
+    HEAPALIGNMENT Alignment;
+  } DD_GETHEAPALIGNMENTDATA;
+
+  typedef struct _VMEML {
+    struct _VMEML *next;
+    FLATPTR ptr;
+    DWORD size;
+    WINBOOL bDiscardable;
+  } VMEML,*LPVMEML,**LPLPVMEML;
+
+  typedef struct _VMEMR {
+    struct _VMEMR *next;
+    struct _VMEMR *prev;
+    struct _VMEMR *pUp;
+    struct _VMEMR *pDown;
+    struct _VMEMR *pLeft;
+    struct _VMEMR *pRight;
+    FLATPTR ptr;
+    DWORD size;
+    DWORD x;
+    DWORD y;
+    DWORD cx;
+    DWORD cy;
+    DWORD flags;
+    FLATPTR pBits;
+    WINBOOL bDiscardable;
+  } VMEMR,*LPVMEMR,**LPLPVMEMR;
+
+  typedef struct _VMEMHEAP {
+    DWORD dwFlags;
+    DWORD stride;
+    LPVOID freeList;
+    LPVOID allocList;
+    DWORD dwTotalSize;
+    FLATPTR fpGARTLin;
+    FLATPTR fpGARTDev;
+    DWORD dwCommitedSize;
+    DWORD dwCoalesceCount;
+    HEAPALIGNMENT Alignment;
+    DDSCAPSEX ddsCapsEx;
+    DDSCAPSEX ddsCapsExAlt;
+#ifndef IS_16
+    LARGE_INTEGER liPhysAGPBase;
+#endif
+    HANDLE hdevAGP;
+    LPVOID pvPhysRsrv;
+#if NTDDI_VERSION >= 0x05010000
+    BYTE *pAgpCommitMask;
+    DWORD dwAgpCommitMaskSize;
+#endif
+  } VMEMHEAP;
+
+#ifndef __NTDDKCOMP__
+  typedef struct _VIDMEM *LPVIDMEM;
+#else
+  typedef struct _VIDEOMEMORY *LPVIDMEM;
+#endif
+
+  typedef struct _SURFACEALIGNMENT *LPSURFACEALIGNMENT;
+  typedef struct _HEAPALIGNMENT *LPHEAPALIGNMENT;
+  typedef struct _DD_GETHEAPALIGNMENTDATA *PDD_GETHEAPALIGNMENTDATA;
+  typedef VMEMHEAP *LPVMEMHEAP;
+
+#ifndef __NTDDKCOMP__
+  extern FLATPTR WINAPI VidMemAlloc (LPVMEMHEAP pvmh, DWORD width, DWORD height);
+#endif
+  extern FLATPTR WINAPI HeapVidMemAllocAligned (LPVIDMEM lpVidMem, DWORD dwWidth, DWORD dwHeight, LPSURFACEALIGNMENT lpAlignment, LPLONG lpNewPitch);
+  extern void WINAPI VidMemFree (LPVMEMHEAP pvmh, FLATPTR ptr);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
+#endif
diff --git a/mingw-w64-headers/include/dmksctrl.h b/mingw-w64-headers/include/dmksctrl.h
index 25289b1..c1abc3c 100644
--- a/mingw-w64-headers/include/dmksctrl.h
+++ b/mingw-w64-headers/include/dmksctrl.h
@@ -1,59 +1,105 @@
-/*
+/**
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ *
  * dmksctrl.h
  *
  * Contributors:
  *   Created by Johannes Anderwald
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *   Reworked by Kai Tietz
  *
  */
 
+#ifndef _DMKSCTRL_
+#define _DMKSCTRL_
+
+#include <winapifamily.h>
+
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+
+#include <pshpack8.h>
+#include <objbase.h>
+
+#ifndef _NTRTL_
+#ifndef DEFINE_GUIDEX
+#define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name
+#endif
+
+#ifndef STATICGUIDOF
+#define STATICGUIDOF(guid) STATIC_##guid
+#endif
+#endif
+
+#ifndef STATIC_IID_IKsControl
+#define STATIC_IID_IKsControl 0x28f54685, 0x06fd, 0x11d2, 0xb2, 0x7a, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96
+#endif
+
+#ifndef _KS_
+#define _KS_
+
+typedef struct {
+  __C89_NAMELESS union {
+    __C89_NAMELESS struct {
+      GUID Set;
+      ULONG Id;
+      ULONG Flags;
+    };
+    LONGLONG Alignment;
+  };
+} KSIDENTIFIER,*PKSIDENTIFIER;
+
+typedef KSIDENTIFIER KSPROPERTY,*PKSPROPERTY, KSMETHOD,*PKSMETHOD, KSEVENT,*PKSEVENT;
+
+#define KSMETHOD_TYPE_NONE 0x0
+#define KSMETHOD_TYPE_READ 0x1
+#define KSMETHOD_TYPE_SEND 0x1
+#define KSMETHOD_TYPE_WRITE 0x2
+#define KSMETHOD_TYPE_MODIFY 0x3
+#define KSMETHOD_TYPE_SOURCE 0x4
+#define KSMETHOD_TYPE_SETSUPPORT 0x100
+#define KSMETHOD_TYPE_BASICSUPPORT 0x200
+
+#define KSPROPERTY_TYPE_GET 0x1
+#define KSPROPERTY_TYPE_SET 0x2
+#define KSPROPERTY_TYPE_SETSUPPORT 0x100
+#define KSPROPERTY_TYPE_BASICSUPPORT 0x200
+#define KSPROPERTY_TYPE_RELATIONS 0x400
+#define KSPROPERTY_TYPE_SERIALIZESET 0x800
+#define KSPROPERTY_TYPE_UNSERIALIZESET 0x1000
+#define KSPROPERTY_TYPE_SERIALIZERAW 0x2000
+#define KSPROPERTY_TYPE_UNSERIALIZERAW 0x4000
+#define KSPROPERTY_TYPE_SERIALIZESIZE 0x8000
+#define KSPROPERTY_TYPE_DEFAULTVALUES 0x10000
+#define KSPROPERTY_TYPE_TOPOLOGY 0x10000000
+#endif
+
 #ifndef _IKsControl_
 #define _IKsControl_
 
+#ifdef DECLARE_INTERFACE_
 #undef INTERFACE
 #define INTERFACE IKsControl
-DECLARE_INTERFACE_(IKsControl, IUnknown)
-{
-     /* IUnknown */
-    STDMETHOD(QueryInterface)       (THIS_ REFIID, LPVOID FAR *) PURE;
-    STDMETHOD_(ULONG,AddRef)        (THIS) PURE;
-    STDMETHOD_(ULONG,Release)       (THIS) PURE;
 
-    /*IKsControl*/
-    STDMETHOD(KsProperty)(
-        THIS_
-        PKSPROPERTY Property,
-        ULONG PropertyLength,
-        LPVOID PropertyData,
-        ULONG DataLength,
-        ULONG* BytesReturned
-    ) PURE;
-    STDMETHOD(KsMethod)(
-        THIS_
-        PKSMETHOD Method,
-        ULONG MethodLength,
-        LPVOID MethodData,
-        ULONG DataLength,
-        ULONG* BytesReturned
-    ) PURE;
-    STDMETHOD(KsEvent)(
-        THIS_
-        PKSEVENT Event,
-        ULONG EventLength,
-        LPVOID EventData,
-        ULONG DataLength,
-        ULONG* BytesReturned
-    ) PURE;
+DECLARE_INTERFACE_ (IKsControl, IUnknown) {
+#ifndef __cplusplus
+  STDMETHOD (QueryInterface) (THIS_ REFIID, LPVOID *) PURE;
+  STDMETHOD_ (ULONG, AddRef) (THIS) PURE;
+  STDMETHOD_ (ULONG, Release) (THIS) PURE;
+#endif
+  STDMETHOD (KsProperty) (THIS_ PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData, ULONG DataLength, ULONG *BytesReturned) PURE;
+  STDMETHOD (KsMethod) (THIS_ PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData, ULONG DataLength, ULONG *BytesReturned) PURE;
+  STDMETHOD (KsEvent) (THIS_ PKSEVENT Event, ULONG EventLength, LPVOID EventData, ULONG DataLength, ULONG *BytesReturned) PURE;
 };
+#endif
+#endif
 
-#endif /* _IKsControl_ */
+#include <poppack.h>
 
+DEFINE_GUID (IID_IKsControl, 0x28f54685, 0x06fd, 0x11d2, 0xb2, 0x7a, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96);
+#ifndef _KSMEDIA_
+DEFINE_GUID (KSDATAFORMAT_SUBTYPE_MIDI, 0x1d262760, 0xe957, 0x11cf, 0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00);
+DEFINE_GUID (KSDATAFORMAT_SUBTYPE_DIRECTMUSIC, 0x1a82f8bc, 0x3f8b, 0x11d2, 0xb7, 0x74, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1);
+#endif
+
+#endif
+#endif