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
324c76f3
Commit
324c76f3
authored
Jul 05, 2011
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jul 06, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Improve the behavior of IDirectInput::CreateDevice.
parent
26932c84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
40 deletions
+67
-40
dinput_main.c
dlls/dinput/dinput_main.c
+27
-40
dinput.c
dlls/dinput/tests/dinput.c
+40
-0
No files found.
dlls/dinput/dinput_main.c
View file @
324c76f3
...
@@ -581,61 +581,48 @@ static HRESULT WINAPI IDirectInput2WImpl_FindDevice(LPDIRECTINPUT7W iface, REFGU
...
@@ -581,61 +581,48 @@ static HRESULT WINAPI IDirectInput2WImpl_FindDevice(LPDIRECTINPUT7W iface, REFGU
return
DI_OK
;
return
DI_OK
;
}
}
static
HRESULT
WINAPI
IDirectInput7AImpl_CreateDeviceEx
(
LPDIRECTINPUT7A
iface
,
REFGUID
rguid
,
static
HRESULT
create_device
(
IDirectInputImpl
*
This
,
REFGUID
rguid
,
REFIID
riid
,
LPVOID
*
pvOut
,
BOOL
unicode
)
REFIID
riid
,
LPVOID
*
pvOut
,
LPUNKNOWN
lpUnknownOuter
)
{
{
IDirectInputImpl
*
This
=
impl_from_IDirectInput7A
(
iface
);
unsigned
int
i
;
HRESULT
ret_value
=
DIERR_DEVICENOTREG
;
unsigned
int
i
;
TRACE
(
"(%p)->(%s, %s, %p, %p)
\n
"
,
This
,
debugstr_guid
(
rguid
),
debugstr_guid
(
riid
),
pvOut
,
lpUnknownOuter
);
if
(
!
rguid
||
!
pvOut
)
return
E_POINTER
;
if
(
pvOut
)
*
pvOut
=
NULL
;
/* Loop on all the devices to see if anyone matches the given GUID */
if
(
!
rguid
||
!
pvOut
)
for
(
i
=
0
;
i
<
NB_DINPUT_DEVICES
;
i
++
)
{
return
E_POINTER
;
HRESULT
ret
;
if
(
!
dinput_devices
[
i
]
->
create_device
)
continue
;
/* Loop on all the devices to see if anyone matches the given GUID */
if
((
ret
=
dinput_devices
[
i
]
->
create_device
(
This
,
rguid
,
riid
,
pvOut
,
0
))
==
DI_OK
)
for
(
i
=
0
;
i
<
NB_DINPUT_DEVICES
;
i
++
)
return
DI_OK
;
{
HRESULT
ret
;
if
(
ret
==
DIERR_NOINTERFACE
)
if
(
!
dinput_devices
[
i
]
->
create_device
)
continue
;
ret_value
=
DIERR_NOINTERFACE
;
if
((
ret
=
dinput_devices
[
i
]
->
create_device
(
This
,
rguid
,
riid
,
pvOut
,
unicode
))
==
DI_OK
)
}
return
DI_OK
;
}
if
(
ret_value
==
DIERR_NOINTERFACE
)
{
WARN
(
"invalid device GUID %s
\n
"
,
debugstr_guid
(
rguid
));
WARN
(
"invalid device GUID %s
\n
"
,
debugstr_guid
(
rguid
));
}
return
DIERR_DEVICENOTREG
;
return
ret_value
;
}
}
static
HRESULT
WINAPI
IDirectInput7
WImpl_CreateDeviceEx
(
LPDIRECTINPUT7W
iface
,
REFGUID
rguid
,
static
HRESULT
WINAPI
IDirectInput7
AImpl_CreateDeviceEx
(
LPDIRECTINPUT7A
iface
,
REFGUID
rguid
,
REFIID
riid
,
LPVOID
*
pvOut
,
LPUNKNOWN
lpUnknownOuter
)
REFIID
riid
,
LPVOID
*
pvOut
,
LPUNKNOWN
lpUnknownOuter
)
{
{
IDirectInputImpl
*
This
=
impl_from_IDirectInput7W
(
iface
);
IDirectInputImpl
*
This
=
impl_from_IDirectInput7A
(
iface
);
HRESULT
ret_value
=
DIERR_DEVICENOTREG
;
unsigned
int
i
;
TRACE
(
"(%p)->(%s, %s, %p, %p)
\n
"
,
This
,
debugstr_guid
(
rguid
),
debugstr_guid
(
riid
),
pvOut
,
lpUnknownOuter
);
if
(
!
rguid
||
!
pvOut
)
return
E_POINTER
;
TRACE
(
"(%p)->(%s, %s, %p, %p)
\n
"
,
This
,
debugstr_guid
(
rguid
),
debugstr_guid
(
riid
),
pvOut
,
lpUnknownOuter
)
;
/* Loop on all the devices to see if anyone matches the given GUID */
return
create_device
(
This
,
rguid
,
riid
,
pvOut
,
FALSE
);
for
(
i
=
0
;
i
<
NB_DINPUT_DEVICES
;
i
++
)
{
}
HRESULT
ret
;
if
(
!
dinput_devices
[
i
]
->
create_device
)
continue
;
static
HRESULT
WINAPI
IDirectInput7WImpl_CreateDeviceEx
(
LPDIRECTINPUT7W
iface
,
REFGUID
rguid
,
if
((
ret
=
dinput_devices
[
i
]
->
create_device
(
This
,
rguid
,
riid
,
pvOut
,
1
))
==
DI_OK
)
REFIID
riid
,
LPVOID
*
pvOut
,
LPUNKNOWN
lpUnknownOuter
)
return
DI_OK
;
{
IDirectInputImpl
*
This
=
impl_from_IDirectInput7W
(
iface
);
if
(
ret
==
DIERR_NOINTERFACE
)
TRACE
(
"(%p)->(%s, %s, %p, %p)
\n
"
,
This
,
debugstr_guid
(
rguid
),
debugstr_guid
(
riid
),
pvOut
,
lpUnknownOuter
);
ret_value
=
DIERR_NOINTERFACE
;
}
return
ret_value
;
return
create_device
(
This
,
rguid
,
riid
,
pvOut
,
TRUE
)
;
}
}
static
HRESULT
WINAPI
IDirectInputAImpl_CreateDevice
(
LPDIRECTINPUT7A
iface
,
REFGUID
rguid
,
static
HRESULT
WINAPI
IDirectInputAImpl_CreateDevice
(
LPDIRECTINPUT7A
iface
,
REFGUID
rguid
,
...
...
dlls/dinput/tests/dinput.c
View file @
324c76f3
...
@@ -129,6 +129,45 @@ static void test_QueryInterface(void)
...
@@ -129,6 +129,45 @@ static void test_QueryInterface(void)
IDirectInput_Release
(
pDI
);
IDirectInput_Release
(
pDI
);
}
}
static
void
test_CreateDevice
(
void
)
{
IDirectInputA
*
pDI
;
HRESULT
hr
;
IDirectInputDeviceA
*
pDID
;
hr
=
DirectInputCreateA
(
hInstance
,
DIRECTINPUT_VERSION
,
&
pDI
,
NULL
);
if
(
FAILED
(
hr
))
{
win_skip
(
"Failed to instantiate a IDirectInputA instance: 0x%08x
\n
"
,
hr
);
return
;
}
hr
=
IDirectInput_CreateDevice
(
pDI
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_CreateDevice returned 0x%08x
\n
"
,
hr
);
pDID
=
(
void
*
)
0xdeadbeef
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
NULL
,
&
pDID
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_CreateDevice returned 0x%08x
\n
"
,
hr
);
ok
(
pDID
==
NULL
,
"Output interface pointer is %p
\n
"
,
pDID
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_Unknown
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_CreateDevice returned 0x%08x
\n
"
,
hr
);
pDID
=
(
void
*
)
0xdeadbeef
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_Unknown
,
&
pDID
,
NULL
);
ok
(
hr
==
DIERR_DEVICENOTREG
,
"IDirectInput_CreateDevice returned 0x%08x
\n
"
,
hr
);
ok
(
pDID
==
NULL
,
"Output interface pointer is %p
\n
"
,
pDID
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysMouse
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_CreateDevice returned 0x%08x
\n
"
,
hr
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysMouse
,
&
pDID
,
NULL
);
ok
(
hr
==
DI_OK
,
"IDirectInput_CreateDevice returned 0x%08x
\n
"
,
hr
);
IDirectInputDevice_Release
(
pDID
);
IDirectInput_Release
(
pDI
);
}
static
void
test_Initialize
(
void
)
static
void
test_Initialize
(
void
)
{
{
IDirectInputA
*
pDI
;
IDirectInputA
*
pDI
;
...
@@ -211,6 +250,7 @@ START_TEST(dinput)
...
@@ -211,6 +250,7 @@ START_TEST(dinput)
CoInitialize
(
NULL
);
CoInitialize
(
NULL
);
test_QueryInterface
();
test_QueryInterface
();
test_CreateDevice
();
test_Initialize
();
test_Initialize
();
test_RunControlPanel
();
test_RunControlPanel
();
CoUninitialize
();
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