DXGL r10 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r9
|
r10
|
r11
>
Date:
01:13, 23 November 2011
Author:
admin
Status:
new
Tags:
Comment:
Fix Windows XP compatibility
Modified paths:
/ddraw/ddraw.cpp
(modified) (
history
)
/dxglcfg/dxglcfg.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/ddraw.cpp
—
—
@@ -19,6 +19,8 @@
20
20
#include "ddraw.h"
21
21
#include "glDirectDraw.h"
22
22
#include "glDirectDrawClipper.h"
23
+#include <intrin.h>
24
+#include <tlhelp32.h>
23
25
24
26
DXGLCFG dxglcfg;
25
27
bool gllock = false;
—
—
@@ -61,10 +63,28 @@
62
64
{
63
65
FIXME("DSoundHelp: stub\n");
64
66
}
67
+int IsCallerOpenGL(void *returnaddress)
68
+{
69
+ int isgl = 0;
70
+ MODULEENTRY32 modentry = {0};
71
+ HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,0);
72
+ modentry.dwSize = sizeof(MODULEENTRY32);
73
+ Module32First(hSnapshot,&modentry);
74
+ do
75
+ {
76
+ if((modentry.modBaseAddr <= returnaddress) &&
77
+ (modentry.modBaseAddr+modentry.modBaseSize > returnaddress))
78
+ {
79
+ if(!_tcsicmp(modentry.szModule,_T("opengl32.dll"))) isgl=1;
80
+ break;
81
+ }
82
+ } while(Module32Next(hSnapshot,&modentry));
83
+ CloseHandle(hSnapshot);
84
+ return isgl;
85
+}
65
86
HRESULT WINAPI DirectDrawCreate(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter)
66
87
{
67
- GetCurrentConfig(&dxglcfg);
68
- if(gllock)
88
+ if(gllock || IsCallerOpenGL(_ReturnAddress()))
69
89
{
70
90
if(!sysddraw)
71
91
{
—
—
@@ -81,6 +101,7 @@
82
102
}
83
103
return sysddrawcreate(lpGUID,lplpDD,pUnkOuter);
84
104
}
105
+ GetCurrentConfig(&dxglcfg);
85
106
glDirectDraw7 *myddraw7;
86
107
glDirectDraw1 *myddraw;
87
108
HRESULT error;
Index: dxglcfg/dxglcfg.cpp
—
—
@@ -267,7 +267,7 @@
268
268
bool hasname;
269
269
void *verinfo;
270
270
COLORREF OldTextColor,OldBackColor;
271
- HANDLE token;
271
+ HANDLE token = NULL;
272
272
TOKEN_ELEVATION elevation;
273
273
switch(Msg)
274
274
{
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version