VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/switcher/sw_common.c@ 38565

Last change on this file since 38565 was 35319, checked in by vboxsync, 14 years ago
  1. wddm: 64bit support 2. wddm: installation fixes (64bit support, unsigned driver warning) 3. propper fix for #5438 (compile with disabled CROGL)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1/* $Id: sw_common.c 35319 2010-12-24 15:42:36Z vboxsync $ */
2
3/** @file
4 * VBox D3D8/9 dll switcher
5 */
6
7/*
8 * Copyright (C) 2009 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#include <windows.h>
20#include "switcher.h"
21
22static char* gsBlackList[] = {"Dwm.exe", "java.exe", "javaw.exe", "javaws.exe"/*, "taskeng.exe"*/, NULL};
23
24/* Checks if 3D is enabled for VM and it works on host machine */
25BOOL isVBox3DEnabled(void)
26{
27 DrvValidateVersionProc pDrvValidateVersion;
28 HANDLE hDLL;
29 BOOL result = FALSE;
30
31#ifdef VBOX_WDDM_WOW64
32 hDLL = LoadLibrary("VBoxOGL-x86.dll");
33#else
34 hDLL = LoadLibrary("VBoxOGL.dll");
35#endif
36
37 /* note: this isn't really needed as our library will refuse to load if it can't connect to host.
38 so it's in case we'd change it one day.
39 */
40 pDrvValidateVersion = (DrvValidateVersionProc) GetProcAddress(hDLL, "DrvValidateVersion");
41 if (pDrvValidateVersion)
42 {
43 result = pDrvValidateVersion(0);
44 }
45 FreeLibrary(hDLL);
46 return result;
47}
48
49BOOL checkOptions(void)
50{
51 char name[1000];
52 char *filename = name, *pName;
53 int i;
54
55 if (!GetModuleFileName(NULL, name, 1000))
56 return TRUE;
57
58 /*Extract filename*/
59 for (pName=name; *pName; ++pName)
60 {
61 switch (*pName)
62 {
63 case ':':
64 case '\\':
65 case '/':
66 filename = pName + 1;
67 break;
68 }
69 }
70
71 for (i=0; gsBlackList[i]; ++i)
72 {
73 if (!stricmp(filename, gsBlackList[i]))
74 return FALSE;
75 }
76
77 return TRUE;
78}
79
80void InitD3DExports(const char *vboxName, const char *msName)
81{
82 const char *dllName;
83 HANDLE hDLL;
84
85 if (isVBox3DEnabled() && checkOptions())
86 {
87 dllName = vboxName;
88 } else
89 {
90 dllName = msName;
91 }
92
93 hDLL = LoadLibrary(dllName);
94 FillD3DExports(hDLL);
95}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette