Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
aba1ed78
Commit
aba1ed78
authored
Oct 16, 2011
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Oct 17, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Put some checks back into GetDeviceData for DirectInput 8.
parent
d7db5d53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
device.c
dlls/dinput/device.c
+6
-0
device.c
dlls/dinput8/tests/device.c
+35
-1
No files found.
dlls/dinput/device.c
View file @
aba1ed78
...
...
@@ -1283,6 +1283,12 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W ifac
TRACE
(
"(%p) %p -> %p(%d) x%d, 0x%08x
\n
"
,
This
,
dod
,
entries
,
entries
?
*
entries
:
0
,
dodsize
,
flags
);
if
(
This
->
dinput
->
dwVersion
==
0x0800
)
{
if
(
!
This
->
acquired
)
return
DIERR_NOTACQUIRED
;
if
(
!
This
->
queue_len
)
return
DIERR_NOTBUFFERED
;
}
if
(
!
This
->
queue_len
)
return
DI_OK
;
if
(
dodsize
<
sizeof
(
DIDEVICEOBJECTDATA_DX3
))
...
...
dlls/dinput8/tests/device.c
View file @
aba1ed78
...
...
@@ -69,12 +69,13 @@ static void test_device_input(
HRESULT
hr
;
DIDEVICEOBJECTDATA
obj_data
;
DWORD
data_size
=
1
;
int
i
;
hr
=
IDirectInputDevice8_Acquire
(
lpdid
);
ok
(
SUCCEEDED
(
hr
),
"Failed to acquire device hr=%08x
\n
"
,
hr
);
if
(
event_type
==
INPUT_KEYBOARD
)
keybd_event
(
event
,
0
,
0
,
0
);
keybd_event
(
event
,
DIK_SPACE
,
0
,
0
);
if
(
event_type
==
INPUT_MOUSE
)
mouse_event
(
event
,
0
,
0
,
0
,
0
);
...
...
@@ -89,6 +90,28 @@ static void test_device_input(
}
ok
(
obj_data
.
uAppData
==
expected
,
"Retrieval of action failed uAppData=%lu expected=%d
\n
"
,
obj_data
.
uAppData
,
expected
);
/* Check for buffer owerflow */
for
(
i
=
0
;
i
<
17
;
i
++
)
if
(
event_type
==
INPUT_KEYBOARD
)
{
keybd_event
(
VK_SPACE
,
DIK_SPACE
,
0
,
0
);
keybd_event
(
VK_SPACE
,
DIK_SPACE
,
KEYEVENTF_KEYUP
,
0
);
}
else
if
(
event_type
==
INPUT_MOUSE
)
{
mouse_event
(
MOUSEEVENTF_LEFTDOWN
,
1
,
1
,
0
,
0
);
mouse_event
(
MOUSEEVENTF_LEFTUP
,
1
,
1
,
0
,
0
);
}
IDirectInputDevice8_Poll
(
lpdid
);
data_size
=
1
;
hr
=
IDirectInputDevice8_GetDeviceData
(
lpdid
,
sizeof
(
obj_data
),
&
obj_data
,
&
data_size
,
0
);
ok
(
hr
==
DI_BUFFEROVERFLOW
,
"GetDeviceData() failed: %08x
\n
"
,
hr
);
data_size
=
1
;
hr
=
IDirectInputDevice8_GetDeviceData
(
lpdid
,
sizeof
(
obj_data
),
&
obj_data
,
&
data_size
,
0
);
ok
(
hr
==
DI_OK
&&
data_size
==
1
,
"GetDeviceData() failed: %08x cnt:%d
\n
"
,
hr
,
data_size
);
}
static
void
test_build_action_map
(
...
...
@@ -134,6 +157,9 @@ static BOOL CALLBACK enumeration_callback(
DIPROPDWORD
dp
;
DIPROPRANGE
dpr
;
struct
enum_data
*
data
=
pvRef
;
DWORD
cnt
;
DIDEVICEOBJECTDATA
buffer
[
5
];
if
(
!
data
)
return
DIENUM_CONTINUE
;
data
->
ndevices
++
;
...
...
@@ -180,6 +206,10 @@ static BOOL CALLBACK enumeration_callback(
ok
(
SUCCEEDED
(
hr
),
"GetProperty failed hr=%08x
\n
"
,
hr
);
ok
(
dp
.
dwData
==
data
->
lpdiaf
->
dwBufferSize
,
"SetActionMap must set the buffer, buffersize=%d
\n
"
,
dp
.
dwData
);
cnt
=
1
;
hr
=
IDirectInputDevice_GetDeviceData
(
lpdid
,
sizeof
(
buffer
[
0
]),
buffer
,
&
cnt
,
0
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"GetDeviceData() failed hr=%08x
\n
"
,
hr
);
/* Test axis range */
memset
(
&
dpr
,
0
,
sizeof
(
dpr
));
dpr
.
diph
.
dwSize
=
sizeof
(
dpr
);
...
...
@@ -198,6 +228,10 @@ static BOOL CALLBACK enumeration_callback(
hr
=
IDirectInputDevice8_Acquire
(
lpdid
);
ok
(
SUCCEEDED
(
hr
),
"Acquire failed hr=%08x
\n
"
,
hr
);
cnt
=
1
;
hr
=
IDirectInputDevice_GetDeviceData
(
lpdid
,
sizeof
(
buffer
[
0
]),
buffer
,
&
cnt
,
0
);
ok
(
hr
==
DI_OK
,
"GetDeviceData() failed hr=%08x
\n
"
,
hr
);
/* SetActionMap should not work on an acquired device */
hr
=
IDirectInputDevice8_SetActionMap
(
lpdid
,
data
->
lpdiaf
,
NULL
,
0
);
ok
(
hr
==
DIERR_ACQUIRED
,
"SetActionMap succeeded with an acquired device hr=%08x
\n
"
,
hr
);
...
...
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