VirtualBox

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

Last change on this file since 33281 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1/* $Id: sw_common.c 28800 2010-04-27 08:22:32Z 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 hDLL = LoadLibrary("VBoxOGL.dll");
32
33 /* note: this isn't really needed as our library will refuse to load if it can't connect to host.
34 so it's in case we'd change it one day.
35 */
36 pDrvValidateVersion = (DrvValidateVersionProc) GetProcAddress(hDLL, "DrvValidateVersion");
37 if (pDrvValidateVersion)
38 {
39 result = pDrvValidateVersion(0);
40 }
41 FreeLibrary(hDLL);
42 return result;
43}
44
45BOOL checkOptions(void)
46{
47 char name[1000];
48 char *filename = name, *pName;
49 int i;
50
51 if (!GetModuleFileName(NULL, name, 1000))
52 return TRUE;
53
54 /*Extract filename*/
55 for (pName=name; *pName; ++pName)
56 {
57 switch (*pName)
58 {
59 case ':':
60 case '\\':
61 case '/':
62 filename = pName + 1;
63 break;
64 }
65 }
66
67 for (i=0; gsBlackList[i]; ++i)
68 {
69 if (!stricmp(filename, gsBlackList[i]))
70 return FALSE;
71 }
72
73 return TRUE;
74}
75
76void InitD3DExports(const char *vboxName, const char *msName)
77{
78 const char *dllName;
79 HANDLE hDLL;
80
81 if (isVBox3DEnabled() && checkOptions())
82 {
83 dllName = vboxName;
84 } else
85 {
86 dllName = msName;
87 }
88
89 hDLL = LoadLibrary(dllName);
90 FillD3DExports(hDLL);
91}
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