switcher.h revision 0f4c42cc432d01dc2d69b4cbd2a44624e3ce6ce6
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync/* $Id$ */
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync/** @file
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * VBox D3D8/9 dll switcher
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync */
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync/*
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * Copyright (C) 2009 Oracle Corporation
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync *
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * available from http://www.virtualbox.org. This file is free software;
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * you can redistribute it and/or modify it under the terms of the GNU
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * General Public License (GPL) as published by the Free Software
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync */
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync#ifndef ___CROPENGL_SWITCHER_H_
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync#define ___CROPENGL_SWITCHER_H_
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsynctypedef BOOL (APIENTRY *DrvValidateVersionProc)(DWORD version);
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync#define SW_FILLPROC(dispatch, hdll, name) \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync dispatch.p##name = ((hdll) != NULL) ? (name##Proc) GetProcAddress((hdll), #name) : vbox##name##Stub;
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync#define SW_DISPINIT(dispatch) \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync { \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync if (!dispatch.initialized) \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync { \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync InitD3DExports(dispatch.vboxName, dispatch.msName); \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync dispatch.initialized = 1; \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync } \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync }
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync#define SW_CHECKRET(dispatch, func, failret) \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync { \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync SW_DISPINIT(dispatch) \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync if (!dispatch.p##func) \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync return failret; \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync }
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync#define SW_CHECKCALL(dispatch, func) \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync { \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync SW_DISPINIT(dispatch) \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync if (!dispatch.p##func) return; \
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync }
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsyncextern BOOL IsVBox3DEnabled(void);
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsyncextern BOOL CheckOptions(void);
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsyncextern void FillD3DExports(HANDLE hDLL);
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsyncextern void InitD3DExports(const char *vboxName, const char *msName);
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync#endif /* #ifndef ___CROPENGL_SWITCHER_H_ */
991c9e5bee3cfd192c3a4b19855625f3ce1cc494vboxsync