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