mshtml: Removed ref count tests that fail on some Windows.
[wine] / dlls / dinput / device_private.h
1 /*
2  * Copyright 2000 Lionel Ulmer
3  * Copyright 2000-2001 TransGaming Technologies Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19
20 #ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
21 #define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
22
23 #include <stdarg.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "dinput.h"
28 #include "wine/list.h"
29 #include "dinput_private.h"
30
31 typedef struct
32 {
33     int size;
34     int offset_in;
35     int offset_out;
36     int value;
37 } DataTransform;
38
39 typedef struct
40 {
41     int                         size;
42     int                         internal_format_size;
43     DataTransform              *dt;
44
45     int                        *offsets;     /* object offsets */
46     LPDIDATAFORMAT              wine_df;     /* wine internal data format */
47     LPDIDATAFORMAT              user_df;     /* user defined data format */
48 } DataFormat;
49
50 /* Device implementation */
51 typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl;
52 struct IDirectInputDevice2AImpl
53 {
54     const void                 *lpVtbl;
55     LONG                        ref;
56     GUID                        guid;
57     CRITICAL_SECTION            crit;
58     IDirectInputImpl           *dinput;
59     struct list                 entry;       /* entry into IDirectInput devices list */
60     HANDLE                      hEvent;
61     DWORD                       dwCoopLevel;
62     HWND                        win;
63     int                         acquired;
64     DI_EVENT_PROC               event_proc;  /* function to receive mouse & keyboard events */
65
66     LPDIDEVICEOBJECTDATA        data_queue;  /* buffer for 'GetDeviceData'.                 */
67     int                         queue_len;   /* size of the queue - set in 'SetProperty'    */
68     int                         queue_head;  /* position to write new event into queue      */
69     int                         queue_tail;  /* next event to read from queue               */
70     BOOL                        overflow;    /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
71
72     DataFormat                  data_format; /* user data format and wine to user format converter */
73 };
74
75 extern BOOL get_app_key(HKEY*, HKEY*);
76 extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD);
77
78 /* Routines to do DataFormat / WineFormat conversions */
79 extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) ;
80 extern void release_DataFormat(DataFormat *df) ;
81 extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq);
82 /* Helper functions to work with data format */
83 extern int id_to_object(LPCDIDATAFORMAT df, int id);
84 extern int find_property(const DataFormat *df, LPCDIPROPHEADER ph);
85
86 /* Common joystick stuff */
87 typedef struct
88 {
89     LONG lDevMin;
90     LONG lDevMax;
91     LONG lMin;
92     LONG lMax;
93     LONG lDeadZone;
94     LONG lSaturation;
95 } ObjProps;
96
97 extern DWORD joystick_map_pov(POINTL *p);
98 extern LONG joystick_map_axis(ObjProps *props, int val);
99
100 typedef struct
101 {
102     struct list entry;
103     LPDIRECTINPUTEFFECT ref;
104 } effect_list_item;
105
106 extern const GUID DInput_Wine_Keyboard_GUID;
107 extern const GUID DInput_Wine_Mouse_GUID;
108
109 /* Various debug tools */
110 extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) ;
111 extern void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi) ;
112 extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) ;
113 extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) ;
114 extern const char *_dump_dinput_GUID(const GUID *guid) ;
115
116 /* And the stubs */
117 extern HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface);
118 extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
119 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
120         LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ;
121 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
122         LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ;
123 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
124         LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
125 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
126 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj);
127 extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj);
128 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
129         LPDIRECTINPUTDEVICE8A iface) ;
130 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
131         LPDIRECTINPUTDEVICE8A iface,
132         LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
133         LPVOID lpvRef,
134         DWORD dwFlags) ;
135 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
136         LPDIRECTINPUTDEVICE8W iface,
137         LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
138         LPVOID lpvRef,
139         DWORD dwFlags) ;
140 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph);
141 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph);
142 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
143         LPDIRECTINPUTDEVICE8A iface,
144         LPDIDEVICEOBJECTINSTANCEA pdidoi,
145         DWORD dwObj,
146         DWORD dwHow) ;
147 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, 
148                                                              LPDIDEVICEOBJECTINSTANCEW pdidoi,
149                                                              DWORD dwObj,
150                                                              DWORD dwHow);
151 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
152         DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags);
153 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
154         LPDIRECTINPUTDEVICE8A iface,
155         HWND hwndOwner,
156         DWORD dwFlags) ;
157 extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
158         LPDIRECTINPUTDEVICE8A iface,
159         HINSTANCE hinst,
160         DWORD dwVersion,
161         REFGUID rguid) ;
162 extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
163         LPDIRECTINPUTDEVICE8A iface,
164         REFGUID rguid,
165         LPCDIEFFECT lpeff,
166         LPDIRECTINPUTEFFECT *ppdef,
167         LPUNKNOWN pUnkOuter) ;
168 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
169         LPDIRECTINPUTDEVICE8A iface,
170         LPDIENUMEFFECTSCALLBACKA lpCallback,
171         LPVOID lpvRef,
172         DWORD dwFlags) ;
173 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
174         LPDIRECTINPUTDEVICE8W iface,
175         LPDIENUMEFFECTSCALLBACKW lpCallback,
176         LPVOID lpvRef,
177         DWORD dwFlags) ;
178 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
179         LPDIRECTINPUTDEVICE8A iface,
180         LPDIEFFECTINFOA lpdei,
181         REFGUID rguid) ;
182 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
183         LPDIRECTINPUTDEVICE8W iface,
184         LPDIEFFECTINFOW lpdei,
185         REFGUID rguid) ;
186 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
187         LPDIRECTINPUTDEVICE8A iface,
188         LPDWORD pdwOut) ;
189 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
190         LPDIRECTINPUTDEVICE8A iface,
191         DWORD dwFlags) ;
192 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
193         LPDIRECTINPUTDEVICE8A iface,
194         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
195         LPVOID lpvRef,
196         DWORD dwFlags) ;
197 extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
198         LPDIRECTINPUTDEVICE8A iface,
199         LPDIEFFESCAPE lpDIEEsc) ;
200 extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
201         LPDIRECTINPUTDEVICE8A iface) ;
202 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
203         LPDIRECTINPUTDEVICE8A iface,
204         DWORD cbObjectData,
205         LPCDIDEVICEOBJECTDATA rgdod,
206         LPDWORD pdwInOut,
207         DWORD dwFlags) ;
208 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
209                                                                  LPCSTR lpszFileName,
210                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
211                                                                  LPVOID pvRef,
212                                                                  DWORD dwFlags) ;
213 extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
214                                                                  LPCWSTR lpszFileName,
215                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
216                                                                  LPVOID pvRef,
217                                                                  DWORD dwFlags) ;
218 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
219                                                                  LPCSTR lpszFileName,
220                                                                  DWORD dwEntries,
221                                                                  LPDIFILEEFFECT rgDiFileEft,
222                                                                  DWORD dwFlags) ;
223 extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
224                                                                  LPCWSTR lpszFileName,
225                                                                  DWORD dwEntries,
226                                                                  LPDIFILEEFFECT rgDiFileEft,
227                                                                  DWORD dwFlags) ;
228 extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
229                                                               LPDIACTIONFORMATA lpdiaf,
230                                                               LPCSTR lpszUserName,
231                                                               DWORD dwFlags);
232 extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
233                                                               LPDIACTIONFORMATW lpdiaf,
234                                                               LPCWSTR lpszUserName,
235                                                               DWORD dwFlags);
236 extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
237                                                             LPDIACTIONFORMATA lpdiaf,
238                                                             LPCSTR lpszUserName,
239                                                             DWORD dwFlags);
240 extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
241                                                             LPDIACTIONFORMATW lpdiaf,
242                                                             LPCWSTR lpszUserName,
243                                                             DWORD dwFlags);
244 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
245                                                             LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
246 extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
247                                                             LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
248
249 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */