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
bc144069
Commit
bc144069
authored
Apr 01, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Apr 03, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Keyboard should be acquired before calling GetDeviceState.
parent
5656fa8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
keyboard.c
dlls/dinput/keyboard.c
+2
-1
keyboard.c
dlls/dinput/tests/keyboard.c
+39
-2
No files found.
dlls/dinput/keyboard.c
View file @
bc144069
...
...
@@ -369,7 +369,8 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
SysKeyboardImpl
*
This
=
(
SysKeyboardImpl
*
)
iface
;
TRACE
(
"(%p)->(%ld,%p)
\n
"
,
This
,
len
,
ptr
);
/* Note: device does not need to be acquired */
if
(
This
->
acquired
==
0
)
return
DIERR_NOTACQUIRED
;
if
(
len
!=
WINE_DINPUT_KEYBOARD_MAX_KEYS
)
return
DIERR_INVALIDPARAM
;
...
...
dlls/dinput/tests/keyboard.c
View file @
bc144069
...
...
@@ -66,8 +66,45 @@ const char * get_file_version(const char * file_name)
return
version
;
}
static
void
keyboard_tests
(
void
)
static
void
keyboard_tests
(
DWORD
version
)
{
HRESULT
hr
;
LPDIRECTINPUT
pDI
;
LPDIRECTINPUTDEVICE
pKeyboard
;
HINSTANCE
hInstance
=
GetModuleHandle
(
NULL
);
BYTE
kbd_state
[
256
];
ULONG
ref
;
hr
=
DirectInputCreate
(
hInstance
,
version
,
&
pDI
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
FAILED
(
hr
))
return
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysKeyboard
,
&
pKeyboard
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
FAILED
(
hr
))
{
IDirectInput_Release
(
pDI
);
return
;
}
hr
=
IDirectInputDevice_SetDataFormat
(
pKeyboard
,
&
c_dfDIKeyboard
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetDataFormat() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pKeyboard
,
NULL
,
DISCL_NONEXCLUSIVE
|
DISCL_BACKGROUND
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetCooperativeLevel() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
10
,
kbd_state
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"IDirectInputDevice_GetDeviceState(10,) should have failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"IDirectInputDevice_GetDeviceState() should have failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_Acquire
(
pKeyboard
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
10
,
kbd_state
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice_GetDeviceState(10,) should have failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
ref
=
IDirectInput_Release
(
pDI
);
ok
(
!
ref
,
"IDirectInput_Release() reference count = %ld
\n
"
,
ref
);
}
START_TEST
(
keyboard
)
...
...
@@ -76,7 +113,7 @@ START_TEST(keyboard)
trace
(
"DLL Version: %s
\n
"
,
get_file_version
(
"dinput.dll"
));
keyboard_tests
();
keyboard_tests
(
0x0700
);
CoUninitialize
();
}
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