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
ce5fb9bb
Commit
ce5fb9bb
authored
Dec 22, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Dec 24, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: AddRef and Release parent DirectInput class.
parent
0ee7db45
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
4 deletions
+25
-4
joystick_linux.c
dlls/dinput/joystick_linux.c
+2
-2
joystick_linuxinput.c
dlls/dinput/joystick_linuxinput.c
+4
-0
keyboard.c
dlls/dinput/keyboard.c
+9
-1
mouse.c
dlls/dinput/mouse.c
+5
-0
keyboard.c
dlls/dinput/tests/keyboard.c
+2
-0
mouse.c
dlls/dinput/tests/mouse.c
+3
-1
No files found.
dlls/dinput/joystick_linux.c
View file @
ce5fb9bb
...
@@ -484,7 +484,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
...
@@ -484,7 +484,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
hr
=
create_DataFormat
(
&
c_dfDIJoystick2
,
&
newDevice
->
base
.
data_format
);
hr
=
create_DataFormat
(
&
c_dfDIJoystick2
,
&
newDevice
->
base
.
data_format
);
if
(
hr
!=
DI_OK
)
goto
FAILED
;
if
(
hr
!=
DI_OK
)
goto
FAILED
;
IDirectInput
Device
_AddRef
((
LPDIRECTINPUTDEVICE8A
)
newDevice
->
dinput
);
IDirectInput_AddRef
((
LPDIRECTINPUTDEVICE8A
)
newDevice
->
dinput
);
newDevice
->
devcaps
.
dwSize
=
sizeof
(
newDevice
->
devcaps
);
newDevice
->
devcaps
.
dwSize
=
sizeof
(
newDevice
->
devcaps
);
newDevice
->
devcaps
.
dwFlags
=
DIDC_ATTACHED
;
newDevice
->
devcaps
.
dwFlags
=
DIDC_ATTACHED
;
...
@@ -613,8 +613,8 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
...
@@ -613,8 +613,8 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
release_DataFormat
(
&
This
->
base
.
data_format
);
release_DataFormat
(
&
This
->
base
.
data_format
);
This
->
base
.
crit
.
DebugInfo
->
Spare
[
0
]
=
0
;
This
->
base
.
crit
.
DebugInfo
->
Spare
[
0
]
=
0
;
IDirectInput_Release
((
LPDIRECTINPUTDEVICE8A
)
This
->
dinput
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
IDirectInputDevice_Release
((
LPDIRECTINPUTDEVICE8A
)
This
->
dinput
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
return
0
;
...
...
dlls/dinput/joystick_linuxinput.c
View file @
ce5fb9bb
...
@@ -393,7 +393,10 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
...
@@ -393,7 +393,10 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
/* create the default transform filter */
/* create the default transform filter */
if
(
create_DataFormat
(
&
c_dfDIJoystick2
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
if
(
create_DataFormat
(
&
c_dfDIJoystick2
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
{
IDirectInput_AddRef
((
LPDIRECTINPUTDEVICE8A
)
newDevice
->
dinput
);
return
newDevice
;
return
newDevice
;
}
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
return
NULL
;
return
NULL
;
...
@@ -491,6 +494,7 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
...
@@ -491,6 +494,7 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
/* release the data transform filter */
/* release the data transform filter */
release_DataFormat
(
&
This
->
base
.
data_format
);
release_DataFormat
(
&
This
->
base
.
data_format
);
IDirectInput_Release
((
LPDIRECTINPUTDEVICE8A
)
This
->
dinput
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
...
...
dlls/dinput/keyboard.c
View file @
ce5fb9bb
...
@@ -198,7 +198,12 @@ static SysKeyboardImpl *alloc_device(REFGUID rguid, const void *kvt, IDirectInpu
...
@@ -198,7 +198,12 @@ static SysKeyboardImpl *alloc_device(REFGUID rguid, const void *kvt, IDirectInpu
newDevice
->
base
.
data_format
.
wine_df
=
&
c_dfDIKeyboard
;
newDevice
->
base
.
data_format
.
wine_df
=
&
c_dfDIKeyboard
;
if
(
create_DataFormat
(
&
c_dfDIKeyboard
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
if
(
create_DataFormat
(
&
c_dfDIKeyboard
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
{
IDirectInput_AddRef
((
LPDIRECTINPUTDEVICE8A
)
newDevice
->
dinput
);
return
newDevice
;
return
newDevice
;
}
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
return
NULL
;
return
NULL
;
}
}
...
@@ -214,6 +219,7 @@ static HRESULT keyboarddev_create_deviceA(IDirectInputImpl *dinput, REFGUID rgui
...
@@ -214,6 +219,7 @@ static HRESULT keyboarddev_create_deviceA(IDirectInputImpl *dinput, REFGUID rgui
IsEqualGUID
(
&
IID_IDirectInputDevice8A
,
riid
))
{
IsEqualGUID
(
&
IID_IDirectInputDevice8A
,
riid
))
{
*
pdev
=
(
IDirectInputDeviceA
*
)
alloc_device
(
rguid
,
&
SysKeyboardAvt
,
dinput
);
*
pdev
=
(
IDirectInputDeviceA
*
)
alloc_device
(
rguid
,
&
SysKeyboardAvt
,
dinput
);
TRACE
(
"Creating a Keyboard device (%p)
\n
"
,
*
pdev
);
TRACE
(
"Creating a Keyboard device (%p)
\n
"
,
*
pdev
);
if
(
!*
pdev
)
return
DIERR_OUTOFMEMORY
;
return
DI_OK
;
return
DI_OK
;
}
else
}
else
return
DIERR_NOINTERFACE
;
return
DIERR_NOINTERFACE
;
...
@@ -232,6 +238,7 @@ static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rgui
...
@@ -232,6 +238,7 @@ static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rgui
IsEqualGUID
(
&
IID_IDirectInputDevice8W
,
riid
))
{
IsEqualGUID
(
&
IID_IDirectInputDevice8W
,
riid
))
{
*
pdev
=
(
IDirectInputDeviceW
*
)
alloc_device
(
rguid
,
&
SysKeyboardWvt
,
dinput
);
*
pdev
=
(
IDirectInputDeviceW
*
)
alloc_device
(
rguid
,
&
SysKeyboardWvt
,
dinput
);
TRACE
(
"Creating a Keyboard device (%p)
\n
"
,
*
pdev
);
TRACE
(
"Creating a Keyboard device (%p)
\n
"
,
*
pdev
);
if
(
!*
pdev
)
return
DIERR_OUTOFMEMORY
;
return
DI_OK
;
return
DI_OK
;
}
else
}
else
return
DIERR_NOINTERFACE
;
return
DIERR_NOINTERFACE
;
...
@@ -257,8 +264,9 @@ static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
...
@@ -257,8 +264,9 @@ static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
set_dinput_hook
(
WH_KEYBOARD_LL
,
NULL
);
set_dinput_hook
(
WH_KEYBOARD_LL
,
NULL
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
base
.
data_queue
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
base
.
data_queue
);
IDirectInput_Release
((
LPDIRECTINPUTDEVICE8A
)
This
->
dinput
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
DI_OK
;
return
DI_OK
;
...
...
dlls/dinput/mouse.c
View file @
ce5fb9bb
...
@@ -194,8 +194,12 @@ static SysMouseImpl *alloc_device(REFGUID rguid, const void *mvt, IDirectInputIm
...
@@ -194,8 +194,12 @@ static SysMouseImpl *alloc_device(REFGUID rguid, const void *mvt, IDirectInputIm
newDevice
->
base
.
data_format
.
wine_df
=
&
c_dfDIMouse2
;
newDevice
->
base
.
data_format
.
wine_df
=
&
c_dfDIMouse2
;
if
(
create_DataFormat
(
&
c_dfDIMouse2
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
if
(
create_DataFormat
(
&
c_dfDIMouse2
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
{
IDirectInput_AddRef
((
LPDIRECTINPUTDEVICE8A
)
newDevice
->
dinput
);
return
newDevice
;
return
newDevice
;
}
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
return
NULL
;
return
NULL
;
}
}
...
@@ -270,6 +274,7 @@ static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
...
@@ -270,6 +274,7 @@ static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
release_DataFormat
(
&
This
->
base
.
data_format
);
release_DataFormat
(
&
This
->
base
.
data_format
);
IDirectInput_Release
((
LPDIRECTINPUTDEVICE8A
)
This
->
dinput
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
return
0
;
...
...
dlls/dinput/tests/keyboard.c
View file @
ce5fb9bb
...
@@ -94,6 +94,8 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd)
...
@@ -94,6 +94,8 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd)
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice_GetDeviceState(10,) should have failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice_GetDeviceState(10,) should have failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
pKeyboard
)
IUnknown_Release
(
pKeyboard
);
}
}
static
const
HRESULT
SetCoop_null_window
[
16
]
=
{
static
const
HRESULT
SetCoop_null_window
[
16
]
=
{
...
...
dlls/dinput/tests/mouse.c
View file @
ce5fb9bb
...
@@ -95,6 +95,7 @@ static void mouse_tests(void)
...
@@ -95,6 +95,7 @@ static void mouse_tests(void)
LPDIRECTINPUT
pDI
=
NULL
;
LPDIRECTINPUT
pDI
=
NULL
;
HINSTANCE
hInstance
=
GetModuleHandle
(
NULL
);
HINSTANCE
hInstance
=
GetModuleHandle
(
NULL
);
HWND
hwnd
;
HWND
hwnd
;
ULONG
ref
=
0
;
hr
=
DirectInputCreate
(
hInstance
,
DIRECTINPUT_VERSION
,
&
pDI
,
NULL
);
hr
=
DirectInputCreate
(
hInstance
,
DIRECTINPUT_VERSION
,
&
pDI
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
...
@@ -112,7 +113,8 @@ static void mouse_tests(void)
...
@@ -112,7 +113,8 @@ static void mouse_tests(void)
DestroyWindow
(
hwnd
);
DestroyWindow
(
hwnd
);
}
}
if
(
pDI
)
IUnknown_Release
(
pDI
);
if
(
pDI
)
ref
=
IUnknown_Release
(
pDI
);
ok
(
!
ref
,
"IDirectInput_Release() reference count = %d
\n
"
,
ref
);
}
}
START_TEST
(
mouse
)
START_TEST
(
mouse
)
...
...
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