summaryrefslogtreecommitdiffstats
path: root/src/VBox/Additions/3D/win/VBoxWddmUmHlp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Additions/3D/win/VBoxWddmUmHlp')
-rw-r--r--src/VBox/Additions/3D/win/VBoxWddmUmHlp/D3DKMT.cpp247
-rw-r--r--src/VBox/Additions/3D/win/VBoxWddmUmHlp/Makefile.kmk45
-rw-r--r--src/VBox/Additions/3D/win/VBoxWddmUmHlp/UmHlpInternal.h26
-rw-r--r--src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxMpLogger.cpp131
-rw-r--r--src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxWddmUmHlp.h100
5 files changed, 549 insertions, 0 deletions
diff --git a/src/VBox/Additions/3D/win/VBoxWddmUmHlp/D3DKMT.cpp b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/D3DKMT.cpp
new file mode 100644
index 00000000..67215393
--- /dev/null
+++ b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/D3DKMT.cpp
@@ -0,0 +1,247 @@
+/* $Id: D3DKMT.cpp $ */
+/** @file
+ * WDDM Kernel Mode Thunks helpers.
+ */
+
+/*
+ * Copyright (C) 2018-2019 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/* We're unable to use standard r3 vbgl-based backdoor logging API because win8 Metro apps
+ * can not do CreateFile/Read/Write by default.
+ * This is why we use miniport escape functionality to issue backdoor log string to the miniport
+ * and submit it to host via standard r0 backdoor logging api accordingly
+ */
+
+#include "UmHlpInternal.h"
+
+
+/** Loads a system DLL.
+ *
+ * @returns Module handle or NULL
+ * @param pszName The DLL name.
+ */
+DECLCALLBACK(HMODULE) VBoxWddmLoadSystemDll(const char *pszName)
+{
+ char szPath[MAX_PATH];
+ UINT cchPath = GetSystemDirectoryA(szPath, sizeof(szPath));
+ size_t cbName = strlen(pszName) + 1;
+ if (cchPath + 1 + cbName > sizeof(szPath))
+ {
+ SetLastError(ERROR_FILENAME_EXCED_RANGE);
+ return NULL;
+ }
+ szPath[cchPath] = '\\';
+ memcpy(&szPath[cchPath + 1], pszName, cbName);
+ return LoadLibraryA(szPath);
+}
+
+DECLCALLBACK(void) VBoxWddmLoadAdresses(HMODULE hmod, VBOXWDDMDLLPROC *paProcs)
+{
+ struct VBOXWDDMDLLPROC *pIter = paProcs;
+ while (pIter->pszName)
+ {
+ FARPROC pfn = GetProcAddress(hmod, pIter->pszName);
+ *pIter->ppfn = pfn;
+ ++pIter;
+ }
+}
+
+/*
+ * Kernel Mode Thunks (KMT) initialization.
+ */
+
+#define D3DKMT_LOAD_ENTRY(a) { #a, (FARPROC *)&g_D3DKMT.pfn##a }
+
+static D3DKMTFUNCTIONS g_D3DKMT = { 0 };
+static VBOXWDDMDLLPROC g_D3DKMTLoadTable[] =
+{
+ D3DKMT_LOAD_ENTRY(D3DKMTOpenAdapterFromHdc),
+ D3DKMT_LOAD_ENTRY(D3DKMTOpenAdapterFromDeviceName),
+ D3DKMT_LOAD_ENTRY(D3DKMTCloseAdapter),
+ D3DKMT_LOAD_ENTRY(D3DKMTQueryAdapterInfo),
+ D3DKMT_LOAD_ENTRY(D3DKMTEscape),
+ D3DKMT_LOAD_ENTRY(D3DKMTCreateDevice),
+ D3DKMT_LOAD_ENTRY(D3DKMTDestroyDevice),
+ D3DKMT_LOAD_ENTRY(D3DKMTCreateContext),
+ D3DKMT_LOAD_ENTRY(D3DKMTDestroyContext),
+ D3DKMT_LOAD_ENTRY(D3DKMTCreateAllocation),
+ D3DKMT_LOAD_ENTRY(D3DKMTDestroyAllocation),
+ D3DKMT_LOAD_ENTRY(D3DKMTRender),
+ D3DKMT_LOAD_ENTRY(D3DKMTPresent),
+ D3DKMT_LOAD_ENTRY(D3DKMTGetSharedPrimaryHandle),
+ D3DKMT_LOAD_ENTRY(D3DKMTQueryResourceInfo),
+ D3DKMT_LOAD_ENTRY(D3DKMTOpenResource),
+ D3DKMT_LOAD_ENTRY(D3DKMTEnumAdapters),
+ D3DKMT_LOAD_ENTRY(D3DKMTOpenAdapterFromLuid),
+ {NULL, NULL},
+};
+
+#undef D3DKMT_LOAD_ENTRY
+
+/** Initialize Kernel Mode Thunks (KMT) pointers in the g_D3DKMT structure.
+ *
+ * @returns True if successful.
+ */
+DECLCALLBACK(int) D3DKMTLoad(void)
+{
+ /* Modules which use D3DKMT must link with gdi32. */
+ HMODULE hmod = GetModuleHandleA("gdi32.dll");
+ Assert(hmod);
+ if (hmod)
+ {
+ VBoxWddmLoadAdresses(hmod, g_D3DKMTLoadTable);
+ }
+ return hmod != NULL;
+}
+
+DECLCALLBACK(D3DKMTFUNCTIONS const *) D3DKMTFunctions(void)
+{
+ return &g_D3DKMT;
+}
+
+
+/*
+ * Getting VirtualBox Graphics Adapter handle.
+ */
+
+static NTSTATUS vboxDispKmtOpenAdapterFromHdc(D3DKMT_HANDLE *phAdapter, LUID *pLuid)
+{
+ *phAdapter = 0;
+
+ D3DKMTFUNCTIONS const *d3dkmt = D3DKMTFunctions();
+ if (d3dkmt->pfnD3DKMTOpenAdapterFromHdc == NULL)
+ return STATUS_NOT_SUPPORTED;
+
+ D3DKMT_OPENADAPTERFROMHDC OpenAdapterData;
+ memset(&OpenAdapterData, 0, sizeof(OpenAdapterData));
+
+ for (int i = 0; ; ++i)
+ {
+ DISPLAY_DEVICEA dd;
+ memset(&dd, 0, sizeof(dd));
+ dd.cb = sizeof(dd);
+
+ if (!EnumDisplayDevicesA(NULL, i, &dd, 0))
+ break;
+
+ if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
+ {
+ OpenAdapterData.hDc = CreateDCA(NULL, dd.DeviceName, NULL, NULL);
+ break;
+ }
+ }
+
+ Assert(OpenAdapterData.hDc);
+
+ NTSTATUS Status;
+ if (OpenAdapterData.hDc)
+ {
+ Status = d3dkmt->pfnD3DKMTOpenAdapterFromHdc(&OpenAdapterData);
+ Assert(Status == STATUS_SUCCESS);
+ if (Status == STATUS_SUCCESS)
+ {
+ *phAdapter = OpenAdapterData.hAdapter;
+ if (pLuid)
+ {
+ *pLuid = OpenAdapterData.AdapterLuid;
+ }
+ }
+
+ DeleteDC(OpenAdapterData.hDc);
+ }
+ else
+ {
+ Status = STATUS_NOT_SUPPORTED;
+ }
+
+ return Status;
+}
+
+static NTSTATUS vboxDispKmtOpenAdapterFromLuid(D3DKMT_HANDLE *phAdapter, LUID *pLuid)
+{
+ *phAdapter = 0;
+
+ D3DKMTFUNCTIONS const *d3dkmt = D3DKMTFunctions();
+ if ( d3dkmt->pfnD3DKMTOpenAdapterFromLuid == NULL
+ || d3dkmt->pfnD3DKMTEnumAdapters == NULL)
+ return STATUS_NOT_SUPPORTED;
+
+ D3DKMT_ENUMADAPTERS EnumAdaptersData;
+ memset(&EnumAdaptersData, 0, sizeof(EnumAdaptersData));
+ EnumAdaptersData.NumAdapters = RT_ELEMENTS(EnumAdaptersData.Adapters);
+
+ NTSTATUS Status = d3dkmt->pfnD3DKMTEnumAdapters(&EnumAdaptersData);
+ Assert(Status == STATUS_SUCCESS);
+ if (Status == STATUS_SUCCESS)
+ {
+ Assert(EnumAdaptersData.NumAdapters);
+
+ /* Try the same twice: if we fail to open the adapter containing present sources,
+ * then try to open any adapter.
+ */
+ for (int iPass = 0; iPass < 2 && *phAdapter == 0; ++iPass)
+ {
+ for (ULONG i = 0; i < EnumAdaptersData.NumAdapters; ++i)
+ {
+ if (iPass > 0 || EnumAdaptersData.Adapters[i].NumOfSources)
+ {
+ D3DKMT_OPENADAPTERFROMLUID OpenAdapterData;
+ memset(&OpenAdapterData, 0, sizeof(OpenAdapterData));
+ OpenAdapterData.AdapterLuid = EnumAdaptersData.Adapters[i].AdapterLuid;
+
+ Status = d3dkmt->pfnD3DKMTOpenAdapterFromLuid(&OpenAdapterData);
+ Assert(Status == STATUS_SUCCESS);
+ if (Status == STATUS_SUCCESS)
+ {
+ *phAdapter = OpenAdapterData.hAdapter;
+ if (pLuid)
+ {
+ *pLuid = EnumAdaptersData.Adapters[i].AdapterLuid;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return Status;
+}
+
+NTSTATUS vboxDispKmtOpenAdapter2(D3DKMT_HANDLE *phAdapter, LUID *pLuid)
+{
+ NTSTATUS Status = vboxDispKmtOpenAdapterFromHdc(phAdapter, pLuid);
+ if (Status != STATUS_SUCCESS)
+ Status = vboxDispKmtOpenAdapterFromLuid(phAdapter, pLuid);
+
+ return Status;
+}
+
+NTSTATUS vboxDispKmtOpenAdapter(D3DKMT_HANDLE *phAdapter)
+{
+ return vboxDispKmtOpenAdapter2(phAdapter, NULL);
+}
+
+NTSTATUS vboxDispKmtCloseAdapter(D3DKMT_HANDLE hAdapter)
+{
+ D3DKMTFUNCTIONS const *d3dkmt = D3DKMTFunctions();
+ if (d3dkmt->pfnD3DKMTCloseAdapter == NULL)
+ return STATUS_NOT_SUPPORTED;
+
+ D3DKMT_CLOSEADAPTER CloseAdapterData;
+ CloseAdapterData.hAdapter = hAdapter;
+
+ NTSTATUS Status = d3dkmt->pfnD3DKMTCloseAdapter(&CloseAdapterData);
+ Assert(Status == STATUS_SUCCESS);
+
+ return Status;
+}
diff --git a/src/VBox/Additions/3D/win/VBoxWddmUmHlp/Makefile.kmk b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/Makefile.kmk
new file mode 100644
index 00000000..fbf1f18a
--- /dev/null
+++ b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/Makefile.kmk
@@ -0,0 +1,45 @@
+# $Id: Makefile.kmk $
+## @file
+# Sub-Makefile for the VirtualBox WDDM user mode driver
+#
+
+#
+# Copyright (C) 2018-2019 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+SUB_DEPTH = ../../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+LIBRARIES += VBoxWddmUmHlp
+LIBRARIES.amd64 += VBoxWddmUmHlp-x86
+
+#
+# VBoxWddmUmHlp - logger and other helpers for user mode driver
+#
+VBoxWddmUmHlp_TEMPLATE = VBoxMesa3DGuestR3DllMinVista
+VBoxWddmUmHlp_INST = $(INST_ADDITIONS_LIB)
+VBoxWddmUmHlp_DEFS = VBOX_WITH_WDDM
+VBoxWddmUmHlp_INCS = \
+ $(PATH_ROOT)/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/shared \
+ $(VBOX_PATH_3D)/win/include \
+ $(VBOX_GRAPHICS_INCS)
+VBoxWddmUmHlp_SOURCES = \
+ D3DKMT.cpp \
+ VBoxMpLogger.cpp
+
+#
+# 64-bit version for 32-bit build.
+#
+VBoxWddmUmHlp-x86_EXTENDS = VBoxWddmUmHlp
+VBoxWddmUmHlp-x86_BLD_TRG_ARCH = x86
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/Additions/3D/win/VBoxWddmUmHlp/UmHlpInternal.h b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/UmHlpInternal.h
new file mode 100644
index 00000000..43e2943e
--- /dev/null
+++ b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/UmHlpInternal.h
@@ -0,0 +1,26 @@
+/* $Id: UmHlpInternal.h $ */
+/** @file
+ * VBox WDDM User Mode Driver Helpers
+ */
+
+/*
+ * Copyright (C) 2018-2019 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef GA_INCLUDED_SRC_3D_win_VBoxWddmUmHlp_UmHlpInternal_h
+#define GA_INCLUDED_SRC_3D_win_VBoxWddmUmHlp_UmHlpInternal_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include "VBoxWddmUmHlp.h"
+
+#endif /* !GA_INCLUDED_SRC_3D_win_VBoxWddmUmHlp_UmHlpInternal_h */
diff --git a/src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxMpLogger.cpp b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxMpLogger.cpp
new file mode 100644
index 00000000..8bf91db3
--- /dev/null
+++ b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxMpLogger.cpp
@@ -0,0 +1,131 @@
+/* $Id: VBoxMpLogger.cpp $ */
+/** @file
+ * VBox WDDM Display logger implementation
+ */
+
+/*
+ * Copyright (C) 2018-2019 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/* We're unable to use standard r3 vbgl-based backdoor logging API because win8 Metro apps
+ * can not do CreateFile/Read/Write by default.
+ * This is why we use miniport escape functionality to issue backdoor log string to the miniport
+ * and submit it to host via standard r0 backdoor logging api accordingly
+ */
+
+#include "UmHlpInternal.h"
+
+#include <../../../common/wddm/VBoxMPIf.h>
+
+#include <stdio.h>
+
+DECLCALLBACK(void) VBoxDispMpLoggerLog(const char *pszString)
+{
+ D3DKMTFUNCTIONS const *d3dkmt = D3DKMTFunctions();
+ if (d3dkmt->pfnD3DKMTEscape == NULL)
+ return;
+
+ D3DKMT_HANDLE hAdapter;
+ NTSTATUS Status = vboxDispKmtOpenAdapter(&hAdapter);
+ Assert(Status == STATUS_SUCCESS);
+ if (Status == 0)
+ {
+ uint32_t cbString = (uint32_t)strlen(pszString) + 1;
+ uint32_t cbCmd = RT_UOFFSETOF_DYN(VBOXDISPIFESCAPE_DBGPRINT, aStringBuf[cbString]);
+ PVBOXDISPIFESCAPE_DBGPRINT pCmd = (PVBOXDISPIFESCAPE_DBGPRINT)malloc(cbCmd);
+ Assert(pCmd);
+ if (pCmd)
+ {
+ pCmd->EscapeHdr.escapeCode = VBOXESC_DBGPRINT;
+ pCmd->EscapeHdr.u32CmdSpecific = 0;
+ memcpy(pCmd->aStringBuf, pszString, cbString);
+
+ D3DKMT_ESCAPE EscapeData;
+ memset(&EscapeData, 0, sizeof(EscapeData));
+ EscapeData.hAdapter = hAdapter;
+ // EscapeData.hDevice = NULL;
+ EscapeData.Type = D3DKMT_ESCAPE_DRIVERPRIVATE;
+ // EscapeData.Flags.HardwareAccess = 0;
+ EscapeData.pPrivateDriverData = pCmd;
+ EscapeData.PrivateDriverDataSize = cbCmd;
+ // EscapeData.hContext = NULL;
+
+ Status = d3dkmt->pfnD3DKMTEscape(&EscapeData);
+ Assert(Status == STATUS_SUCCESS);
+
+ free(pCmd);
+ }
+
+ Status = vboxDispKmtCloseAdapter(hAdapter);
+ Assert(Status == STATUS_SUCCESS);
+ }
+}
+
+DECLCALLBACK(void) VBoxDispMpLoggerLogF(const char *pszString, ...)
+{
+ char szBuffer[4096] = {0};
+ va_list pArgList;
+ va_start(pArgList, pszString);
+ _vsnprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), pszString, pArgList);
+ va_end(pArgList);
+
+ VBoxDispMpLoggerLog(szBuffer);
+}
+
+/*
+ * Prefix the output string with module name and pid/tid.
+ */
+static const char *vboxUmLogGetModuleName(void)
+{
+ static int s_fModuleNameInited = 0;
+ static char s_szModuleName[MAX_PATH];
+
+ if (!s_fModuleNameInited)
+ {
+ const DWORD cchName = GetModuleFileNameA(NULL, s_szModuleName, RT_ELEMENTS(s_szModuleName));
+ if (cchName == 0)
+ {
+ return "<no module>";
+ }
+ s_fModuleNameInited = 1;
+ }
+ return &s_szModuleName[0];
+}
+
+DECLCALLBACK(void) VBoxWddmUmLog(const char *pszString)
+{
+ char szBuffer[4096];
+ const int cbBuffer = sizeof(szBuffer);
+ char *pszBuffer = &szBuffer[0];
+
+ int cbWritten = _snprintf(pszBuffer, cbBuffer, "['%s' 0x%x.0x%x]: ",
+ vboxUmLogGetModuleName(), GetCurrentProcessId(), GetCurrentThreadId());
+ if (cbWritten < 0 || cbWritten >= cbBuffer)
+ {
+ Assert(0);
+ pszBuffer[0] = 0;
+ cbWritten = 0;
+ }
+
+ const size_t cbLeft = cbBuffer - cbWritten;
+ const size_t cbString = strlen(pszString) + 1;
+ if (cbString <= cbLeft)
+ {
+ memcpy(pszBuffer + cbWritten, pszString, cbString);
+ }
+ else
+ {
+ memcpy(pszBuffer + cbWritten, pszString, cbLeft - 1);
+ pszBuffer[cbWritten + cbLeft - 1] = 0;
+ }
+
+ VBoxDispMpLoggerLog(szBuffer);
+}
diff --git a/src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxWddmUmHlp.h b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxWddmUmHlp.h
new file mode 100644
index 00000000..051817a2
--- /dev/null
+++ b/src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxWddmUmHlp.h
@@ -0,0 +1,100 @@
+/* $Id: VBoxWddmUmHlp.h $ */
+/** @file
+ * VBox WDDM User Mode Driver Helpers
+ */
+
+/*
+ * Copyright (C) 2018-2019 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef GA_INCLUDED_SRC_3D_win_VBoxWddmUmHlp_VBoxWddmUmHlp_h
+#define GA_INCLUDED_SRC_3D_win_VBoxWddmUmHlp_VBoxWddmUmHlp_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <iprt/win/d3d9.h>
+#include <d3dumddi.h>
+#include <d3dkmthk.h>
+
+#include <iprt/asm.h>
+#include <iprt/cdefs.h>
+
+/* Do not require IPRT library. */
+#if defined(Assert)
+#undef Assert
+#endif
+#ifdef RT_STRICT
+#define Assert(_e) (void)( (!!(_e)) || (ASMBreakpoint(), 0) )
+#else
+#define Assert(_e) (void)( 0 )
+#endif
+
+/* Do not require ntstatus.h.
+ * D3DKMT functions return NTSTATUS, but the driver code uses it only as a success/failure indicator.
+ * Therefore define the success and a failure status here.
+ */
+#ifndef STATUS_SUCCESS
+#define STATUS_SUCCESS 0
+#endif
+#ifndef STATUS_NOT_SUPPORTED
+#define STATUS_NOT_SUPPORTED ((NTSTATUS)0xC00000BBL)
+#endif
+
+RT_C_DECLS_BEGIN
+
+typedef struct VBOXWDDMDLLPROC
+{
+ char const *pszName;
+ FARPROC *ppfn;
+} VBOXWDDMDLLPROC;
+
+typedef struct D3DKMTFUNCTIONS
+{
+ PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc;
+ PFND3DKMT_OPENADAPTERFROMDEVICENAME pfnD3DKMTOpenAdapterFromDeviceName;
+ PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter;
+ PFND3DKMT_QUERYADAPTERINFO pfnD3DKMTQueryAdapterInfo;
+ PFND3DKMT_ESCAPE pfnD3DKMTEscape;
+ PFND3DKMT_CREATEDEVICE pfnD3DKMTCreateDevice;
+ PFND3DKMT_DESTROYDEVICE pfnD3DKMTDestroyDevice;
+ PFND3DKMT_CREATECONTEXT pfnD3DKMTCreateContext;
+ PFND3DKMT_DESTROYCONTEXT pfnD3DKMTDestroyContext;
+ PFND3DKMT_CREATEALLOCATION pfnD3DKMTCreateAllocation;
+ PFND3DKMT_DESTROYALLOCATION pfnD3DKMTDestroyAllocation;
+ PFND3DKMT_RENDER pfnD3DKMTRender;
+ PFND3DKMT_PRESENT pfnD3DKMTPresent;
+ PFND3DKMT_GETSHAREDPRIMARYHANDLE pfnD3DKMTGetSharedPrimaryHandle;
+ PFND3DKMT_QUERYRESOURCEINFO pfnD3DKMTQueryResourceInfo;
+ PFND3DKMT_OPENRESOURCE pfnD3DKMTOpenResource;
+
+ /* Win 8+ */
+ PFND3DKMT_ENUMADAPTERS pfnD3DKMTEnumAdapters;
+ PFND3DKMT_OPENADAPTERFROMLUID pfnD3DKMTOpenAdapterFromLuid;
+} D3DKMTFUNCTIONS;
+
+DECLCALLBACK(HMODULE) VBoxWddmLoadSystemDll(const char *pszName);
+DECLCALLBACK(void) VBoxWddmLoadAdresses(HMODULE hmod, VBOXWDDMDLLPROC *paProcs);
+
+DECLCALLBACK(int) D3DKMTLoad(void);
+DECLCALLBACK(D3DKMTFUNCTIONS const *) D3DKMTFunctions(void);
+
+DECLCALLBACK(void) VBoxDispMpLoggerLogF(const char *pszString, ...);
+DECLCALLBACK(void) VBoxWddmUmLog(const char *pszString);
+
+/** @todo Rename to VBoxWddm* */
+NTSTATUS vboxDispKmtOpenAdapter2(D3DKMT_HANDLE *phAdapter, LUID *pLuid);
+NTSTATUS vboxDispKmtOpenAdapter(D3DKMT_HANDLE *phAdapter);
+NTSTATUS vboxDispKmtCloseAdapter(D3DKMT_HANDLE hAdapter);
+
+RT_C_DECLS_END
+
+#endif /* !GA_INCLUDED_SRC_3D_win_VBoxWddmUmHlp_VBoxWddmUmHlp_h */