Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
68e3b185
Commit
68e3b185
authored
Feb 11, 2014
by
Erich E. Hoover
Committed by
Alexandre Julliard
Feb 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Return the D3D identifier when GetDeviceIdentifier is called with no flags.
parent
2cb3aeb7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
10 deletions
+55
-10
ddraw.c
dlls/ddraw/ddraw.c
+35
-8
ddrawmodes.c
dlls/ddraw/tests/ddrawmodes.c
+18
-0
directx.c
dlls/wined3d/directx.c
+2
-2
No files found.
dlls/ddraw/ddraw.c
View file @
68e3b185
...
...
@@ -2561,19 +2561,46 @@ static HRESULT WINAPI ddraw7_EvaluateMode(IDirectDraw7 *iface, DWORD Flags, DWOR
static
HRESULT
WINAPI
ddraw7_GetDeviceIdentifier
(
IDirectDraw7
*
iface
,
DDDEVICEIDENTIFIER2
*
DDDI
,
DWORD
Flags
)
{
struct
ddraw
*
ddraw
=
impl_from_IDirectDraw7
(
iface
);
struct
wined3d_adapter_identifier
adapter_id
;
HRESULT
hr
=
S_OK
;
TRACE
(
"iface %p, device_identifier %p, flags %#x.
\n
"
,
iface
,
DDDI
,
Flags
);
if
(
!
DDDI
)
if
(
!
DDDI
)
return
DDERR_INVALIDPARAMS
;
/* The DDGDI_GETHOSTIDENTIFIER returns the information about the 2D
* host adapter, if there's a secondary 3D adapter. This doesn't apply
* to any modern hardware, nor is it interesting for Wine, so ignore it.
* Size of DDDEVICEIDENTIFIER2 may be aligned to 8 bytes and thus 4
* bytes too long. So only copy the relevant part of the structure
*/
if
(
Flags
&
DDGDI_GETHOSTIDENTIFIER
)
{
/* The DDGDI_GETHOSTIDENTIFIER returns the information about the 2D
* host adapter, if there's a secondary 3D adapter. This doesn't apply
* to any modern hardware, nor is it interesting for Wine, so ignore it.
* Size of DDDEVICEIDENTIFIER2 may be aligned to 8 bytes and thus 4
* bytes too long. So only copy the relevant part of the structure
*/
memcpy
(
DDDI
,
&
deviceidentifier
,
FIELD_OFFSET
(
DDDEVICEIDENTIFIER2
,
dwWHQLLevel
)
+
sizeof
(
DWORD
));
memcpy
(
DDDI
,
&
deviceidentifier
,
FIELD_OFFSET
(
DDDEVICEIDENTIFIER2
,
dwWHQLLevel
)
+
sizeof
(
DWORD
));
return
DD_OK
;
}
/* Drakan: Order of the Flame expects accurate D3D device information from ddraw */
adapter_id
.
driver
=
DDDI
->
szDriver
;
adapter_id
.
driver_size
=
sizeof
(
DDDI
->
szDriver
);
adapter_id
.
description
=
DDDI
->
szDescription
;
adapter_id
.
description_size
=
sizeof
(
DDDI
->
szDescription
);
adapter_id
.
device_name_size
=
0
;
wined3d_mutex_lock
();
hr
=
wined3d_get_adapter_identifier
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
0x0
,
&
adapter_id
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
return
hr
;
DDDI
->
liDriverVersion
=
adapter_id
.
driver_version
;
DDDI
->
dwVendorId
=
adapter_id
.
vendor_id
;
DDDI
->
dwDeviceId
=
adapter_id
.
device_id
;
DDDI
->
dwSubSysId
=
adapter_id
.
subsystem_id
;
DDDI
->
dwRevision
=
adapter_id
.
revision
;
DDDI
->
guidDeviceIdentifier
=
adapter_id
.
device_identifier
;
DDDI
->
dwWHQLLevel
=
adapter_id
.
whql_level
;
return
DD_OK
;
}
...
...
dlls/ddraw/tests/ddrawmodes.c
View file @
68e3b185
...
...
@@ -999,6 +999,24 @@ static void testddraw7(void)
ok
(
pend
[
1
]
==
0xdeadbeef
,
"memory beyond DDDEVICEIDENTIFIER2 overwritten
\n
"
);
}
/* recheck with the DDGDI_GETHOSTIDENTIFIER flag */
pend
[
0
]
=
0xdeadbeef
;
pend
[
1
]
=
0xdeadbeef
;
hr
=
IDirectDraw7_GetDeviceIdentifier
(
dd7
,
pdddi2
,
DDGDI_GETHOSTIDENTIFIER
);
ok
(
hr
==
DD_OK
,
"get device identifier failed with %08x
\n
"
,
hr
);
if
(
hr
==
DD_OK
)
{
/* szDriver contains the name of the driver DLL */
ok
(
strstr
(
pdddi2
->
szDriver
,
".dll"
)
!=
NULL
,
"szDriver does not contain DLL name
\n
"
);
/* check how strings are copied into the structure */
ok
(
pdddi2
->
szDriver
[
MAX_DDDEVICEID_STRING
-
1
]
==
0
,
"szDriver not cleared
\n
"
);
ok
(
pdddi2
->
szDescription
[
MAX_DDDEVICEID_STRING
-
1
]
==
0
,
"szDescription not cleared
\n
"
);
/* verify that 8 byte structure size alignment will not overwrite memory */
ok
(
pend
[
0
]
==
0xdeadbeef
||
broken
(
pend
[
0
]
!=
0xdeadbeef
),
/* win2k */
"memory beyond DDDEVICEIDENTIFIER2 overwritten
\n
"
);
ok
(
pend
[
1
]
==
0xdeadbeef
,
"memory beyond DDDEVICEIDENTIFIER2 overwritten
\n
"
);
}
IDirectDraw_Release
(
dd7
);
HeapFree
(
GetProcessHeap
(),
0
,
pdddi2
);
}
...
...
dlls/wined3d/directx.c
View file @
68e3b185
...
...
@@ -3413,7 +3413,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
const
char
*
name
=
adapter
->
driver_info
.
name
;
len
=
min
(
strlen
(
name
),
identifier
->
driver_size
-
1
);
memcpy
(
identifier
->
driver
,
name
,
len
);
identifier
->
driver
[
len
]
=
'\0'
;
memset
(
&
identifier
->
driver
[
len
],
0
,
identifier
->
driver_size
-
len
)
;
}
if
(
identifier
->
description_size
)
...
...
@@ -3421,7 +3421,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
const
char
*
description
=
adapter
->
driver_info
.
description
;
len
=
min
(
strlen
(
description
),
identifier
->
description_size
-
1
);
memcpy
(
identifier
->
description
,
description
,
len
);
identifier
->
description
[
len
]
=
'\0'
;
memset
(
&
identifier
->
description
[
len
],
0
,
identifier
->
description_size
-
len
)
;
}
/* Note that d3d8 doesn't supply a device name. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment