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
aa0188cd
Commit
aa0188cd
authored
Jul 27, 2008
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jul 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Zero the out buffer.
parent
0fb6e308
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
12 deletions
+20
-12
device.c
dlls/dinput/device.c
+3
-1
device_private.h
dlls/dinput/device_private.h
+1
-1
joystick_linux.c
dlls/dinput/joystick_linux.c
+1
-1
joystick_linuxinput.c
dlls/dinput/joystick_linuxinput.c
+1
-1
keyboard.c
dlls/dinput/keyboard.c
+1
-1
mouse.c
dlls/dinput/mouse.c
+1
-1
keyboard.c
dlls/dinput/tests/keyboard.c
+12
-6
No files found.
dlls/dinput/device.c
View file @
aa0188cd
...
...
@@ -265,11 +265,13 @@ DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
}
/* Conversion between internal data buffer and external data buffer */
void
fill_DataFormat
(
void
*
out
,
const
void
*
in
,
const
DataFormat
*
df
)
{
void
fill_DataFormat
(
void
*
out
,
DWORD
size
,
const
void
*
in
,
const
DataFormat
*
df
)
{
int
i
;
const
char
*
in_c
=
in
;
char
*
out_c
=
(
char
*
)
out
;
memset
(
out
,
0
,
size
);
if
(
df
->
dt
==
NULL
)
{
/* This means that the app uses Wine's internal data format */
memcpy
(
out
,
in
,
df
->
internal_format_size
);
...
...
dlls/dinput/device_private.h
View file @
aa0188cd
...
...
@@ -76,7 +76,7 @@ extern BOOL get_app_key(HKEY*, HKEY*);
extern
DWORD
get_config_key
(
HKEY
,
HKEY
,
const
char
*
,
char
*
,
DWORD
);
/* Routines to do DataFormat / WineFormat conversions */
extern
void
fill_DataFormat
(
void
*
out
,
const
void
*
in
,
const
DataFormat
*
df
)
;
extern
void
fill_DataFormat
(
void
*
out
,
DWORD
size
,
const
void
*
in
,
const
DataFormat
*
df
)
;
extern
HRESULT
create_DataFormat
(
LPCDIDATAFORMAT
asked_format
,
DataFormat
*
format
);
extern
void
release_DataFormat
(
DataFormat
*
df
)
;
extern
void
queue_event
(
LPDIRECTINPUTDEVICE8A
iface
,
int
ofs
,
DWORD
data
,
DWORD
time
,
DWORD
seq
);
...
...
dlls/dinput/joystick_linux.c
View file @
aa0188cd
...
...
@@ -767,7 +767,7 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceState(
joy_polldev
(
This
);
/* convert and copy data to user supplied buffer */
fill_DataFormat
(
ptr
,
&
This
->
js
,
&
This
->
base
.
data_format
);
fill_DataFormat
(
ptr
,
len
,
&
This
->
js
,
&
This
->
base
.
data_format
);
return
DI_OK
;
}
...
...
dlls/dinput/joystick_linuxinput.c
View file @
aa0188cd
...
...
@@ -802,7 +802,7 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceState(
joy_polldev
(
This
);
/* convert and copy data to user supplied buffer */
fill_DataFormat
(
ptr
,
&
This
->
js
,
&
This
->
base
.
data_format
);
fill_DataFormat
(
ptr
,
len
,
&
This
->
js
,
&
This
->
base
.
data_format
);
return
DI_OK
;
}
...
...
dlls/dinput/keyboard.c
View file @
aa0188cd
...
...
@@ -283,7 +283,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
}
}
fill_DataFormat
(
ptr
,
This
->
DInputKeyState
,
&
This
->
base
.
data_format
);
fill_DataFormat
(
ptr
,
len
,
This
->
DInputKeyState
,
&
This
->
base
.
data_format
);
LeaveCriticalSection
(
&
This
->
base
.
crit
);
return
DI_OK
;
...
...
dlls/dinput/mouse.c
View file @
aa0188cd
...
...
@@ -490,7 +490,7 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
EnterCriticalSection
(
&
This
->
base
.
crit
);
/* Copy the current mouse state */
fill_DataFormat
(
ptr
,
&
(
This
->
m_state
)
,
&
This
->
base
.
data_format
);
fill_DataFormat
(
ptr
,
len
,
&
This
->
m_state
,
&
This
->
base
.
data_format
);
/* Initialize the buffer when in relative mode */
if
(
!
(
This
->
base
.
data_format
.
user_df
->
dwFlags
&
DIDF_ABSAXIS
))
...
...
dlls/dinput/tests/keyboard.c
View file @
aa0188cd
...
...
@@ -70,20 +70,21 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd)
HRESULT
hr
;
LPDIRECTINPUTDEVICE
pKeyboard
;
BYTE
kbd_state
[
256
];
BYTE
custom_state
[
4
];
LONG
custom_state
[
6
];
int
i
;
DIOBJECTDATAFORMAT
dodf
[]
=
{
{
&
GUID_Key
,
0
,
DIDFT_MAKEINSTANCE
(
DIK_Q
)
|
DIDFT_BUTTON
,
0
},
{
&
GUID_Key
,
1
,
DIDFT_MAKEINSTANCE
(
DIK_W
)
|
DIDFT_BUTTON
,
0
},
{
&
GUID_Key
,
2
,
DIDFT_MAKEINSTANCE
(
DIK_E
)
|
DIDFT_BUTTON
,
0
},
{
&
GUID_Key
,
3
,
DIDFT_MAKEINSTANCE
(
DIK_R
)
|
DIDFT_BUTTON
,
0
},
{
&
GUID_Key
,
sizeof
(
LONG
)
*
0
,
DIDFT_MAKEINSTANCE
(
DIK_Q
)
|
DIDFT_BUTTON
,
0
},
{
&
GUID_Key
,
sizeof
(
LONG
)
*
1
,
DIDFT_MAKEINSTANCE
(
DIK_W
)
|
DIDFT_BUTTON
,
0
},
{
&
GUID_Key
,
sizeof
(
LONG
)
*
2
,
DIDFT_MAKEINSTANCE
(
DIK_E
)
|
DIDFT_BUTTON
,
0
},
{
&
GUID_Key
,
sizeof
(
LONG
)
*
4
,
DIDFT_MAKEINSTANCE
(
DIK_R
)
|
DIDFT_BUTTON
,
0
},
};
DIDATAFORMAT
df
;
df
.
dwSize
=
sizeof
(
df
);
df
.
dwObjSize
=
sizeof
(
DIOBJECTDATAFORMAT
);
df
.
dwFlags
=
DIDF_RELAXIS
;
df
.
dwDataSize
=
sizeof
(
dodf
)
/
sizeof
(
dodf
[
0
]
);
df
.
dwDataSize
=
sizeof
(
custom_state
);
df
.
dwNumObjs
=
sizeof
(
dodf
)
/
sizeof
(
dodf
[
0
]
);
df
.
rgodf
=
dodf
;
...
...
@@ -120,6 +121,11 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd)
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice_GetDeviceState(256,) should have failed: %08x
\n
"
,
hr
);
memset
(
custom_state
,
0x56
,
sizeof
(
custom_state
));
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
for
(
i
=
0
;
i
<
sizeof
(
custom_state
)
/
sizeof
(
custom_state
[
0
]);
i
++
)
ok
(
custom_state
[
i
]
==
0
,
"Should be zeroed, got 0x%08x
\n
"
,
custom_state
[
i
]);
if
(
pKeyboard
)
IUnknown_Release
(
pKeyboard
);
}
...
...
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