msi: Implement MsiQueryFeatureStateExA/W.
[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 typedef struct
51 {
52     unsigned int offset;
53     UINT_PTR uAppData;
54 } ActionMap;
55
56 /* Device implementation */
57 typedef struct IDirectInputDeviceImpl IDirectInputDeviceImpl;
58 struct IDirectInputDeviceImpl
59 {
60     IDirectInputDevice8A        IDirectInputDevice8A_iface;
61     IDirectInputDevice8W        IDirectInputDevice8W_iface;
62     LONG                        ref;
63     GUID                        guid;
64     CRITICAL_SECTION            crit;
65     IDirectInputImpl           *dinput;
66     struct list                 entry;       /* entry into IDirectInput devices list */
67     HANDLE                      hEvent;
68     DWORD                       dwCoopLevel;
69     HWND                        win;
70     int                         acquired;
71     DI_EVENT_PROC               event_proc;  /* function to receive mouse & keyboard events */
72
73     LPDIDEVICEOBJECTDATA        data_queue;  /* buffer for 'GetDeviceData'.                 */
74     int                         queue_len;   /* size of the queue - set in 'SetProperty'    */
75     int                         queue_head;  /* position to write new event into queue      */
76     int                         queue_tail;  /* next event to read from queue               */
77     BOOL                        overflow;    /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
78
79     DataFormat                  data_format; /* user data format and wine to user format converter */
80
81     /* Action mapping */
82     int                         num_actions; /* number of actions mapped */
83     ActionMap                  *action_map;  /* array of mappings */
84 };
85
86 extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
87 extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD) DECLSPEC_HIDDEN;
88
89 /* Routines to do DataFormat / WineFormat conversions */
90 extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df)  DECLSPEC_HIDDEN;
91 extern void release_DataFormat(DataFormat *df)  DECLSPEC_HIDDEN;
92 extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq) DECLSPEC_HIDDEN;
93 /* Helper functions to work with data format */
94 extern int id_to_object(LPCDIDATAFORMAT df, int id) DECLSPEC_HIDDEN;
95 extern int find_property(const DataFormat *df, LPCDIPROPHEADER ph) DECLSPEC_HIDDEN;
96
97 /* Common joystick stuff */
98 typedef struct
99 {
100     LONG lDevMin;
101     LONG lDevMax;
102     LONG lMin;
103     LONG lMax;
104     LONG lDeadZone;
105     LONG lSaturation;
106 } ObjProps;
107
108 extern DWORD joystick_map_pov(const POINTL *p) DECLSPEC_HIDDEN;
109 extern LONG joystick_map_axis(ObjProps *props, int val) DECLSPEC_HIDDEN;
110
111 typedef struct
112 {
113     struct list entry;
114     LPDIRECTINPUTEFFECT ref;
115 } effect_list_item;
116
117 extern const GUID DInput_Wine_Keyboard_GUID DECLSPEC_HIDDEN;
118 extern const GUID DInput_Wine_Mouse_GUID DECLSPEC_HIDDEN;
119
120 /* Various debug tools */
121 extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph)  DECLSPEC_HIDDEN;
122 extern void _dump_OBJECTINSTANCEA(const DIDEVICEOBJECTINSTANCEA *ddoi)  DECLSPEC_HIDDEN;
123 extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi)  DECLSPEC_HIDDEN;
124 extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df)  DECLSPEC_HIDDEN;
125 extern const char *_dump_dinput_GUID(const GUID *guid)  DECLSPEC_HIDDEN;
126
127 extern LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type)   DECLSPEC_HIDDEN;
128
129 extern HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)  DECLSPEC_HIDDEN;
130 extern HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
131
132 /* And the stubs */
133 extern HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN;
134 extern HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
135 extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN;
136 extern HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
137 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
138 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
139 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags) DECLSPEC_HIDDEN;
140 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags) DECLSPEC_HIDDEN;
141 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface, HANDLE hnd) DECLSPEC_HIDDEN;
142 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE hnd) DECLSPEC_HIDDEN;
143 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)  DECLSPEC_HIDDEN;
144 extern ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
145 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
146 extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
147 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN;
148 extern ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
149 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
150         LPDIRECTINPUTDEVICE8A iface,
151         LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
152         LPVOID lpvRef,
153         DWORD dwFlags)  DECLSPEC_HIDDEN;
154 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
155         LPDIRECTINPUTDEVICE8W iface,
156         LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
157         LPVOID lpvRef,
158         DWORD dwFlags)  DECLSPEC_HIDDEN;
159 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
160 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
161 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
162 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
163 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
164         LPDIRECTINPUTDEVICE8A iface,
165         LPDIDEVICEOBJECTINSTANCEA pdidoi,
166         DWORD dwObj,
167         DWORD dwHow)  DECLSPEC_HIDDEN;
168 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, 
169                                                              LPDIDEVICEOBJECTINSTANCEW pdidoi,
170                                                              DWORD dwObj,
171                                                              DWORD dwHow) DECLSPEC_HIDDEN;
172 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
173                                                              LPDWORD entries, DWORD flags) DECLSPEC_HIDDEN;
174 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
175                                                              LPDWORD entries, DWORD flags) DECLSPEC_HIDDEN;
176 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(LPDIRECTINPUTDEVICE8A iface, HWND hwndOwner, DWORD dwFlags) DECLSPEC_HIDDEN;
177 extern HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags) DECLSPEC_HIDDEN;
178 extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(LPDIRECTINPUTDEVICE8A iface, HINSTANCE hinst, DWORD dwVersion,
179                                                           REFGUID rguid) DECLSPEC_HIDDEN;
180 extern HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion,
181                                                           REFGUID rguid) DECLSPEC_HIDDEN;
182 extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIEFFECT lpeff,
183                                                             LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
184 extern HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff,
185                                                             LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
186 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
187         LPDIRECTINPUTDEVICE8A iface,
188         LPDIENUMEFFECTSCALLBACKA lpCallback,
189         LPVOID lpvRef,
190         DWORD dwFlags)  DECLSPEC_HIDDEN;
191 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
192         LPDIRECTINPUTDEVICE8W iface,
193         LPDIENUMEFFECTSCALLBACKW lpCallback,
194         LPVOID lpvRef,
195         DWORD dwFlags)  DECLSPEC_HIDDEN;
196 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
197         LPDIRECTINPUTDEVICE8A iface,
198         LPDIEFFECTINFOA lpdei,
199         REFGUID rguid)  DECLSPEC_HIDDEN;
200 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
201         LPDIRECTINPUTDEVICE8W iface,
202         LPDIEFFECTINFOW lpdei,
203         REFGUID rguid)  DECLSPEC_HIDDEN;
204 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8A iface, LPDWORD pdwOut) DECLSPEC_HIDDEN;
205 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut) DECLSPEC_HIDDEN;
206 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8A iface, DWORD dwFlags) DECLSPEC_HIDDEN;
207 extern HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags) DECLSPEC_HIDDEN;
208 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8A iface,
209                                                                         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
210                                                                         LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN;
211 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface,
212                                                                         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
213                                                                         LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN;
214 extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(LPDIRECTINPUTDEVICE8A iface, LPDIEFFESCAPE lpDIEEsc) DECLSPEC_HIDDEN;
215 extern HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc) DECLSPEC_HIDDEN;
216 extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN;
217 extern HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
218 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD cbObjectData,
219                                                               LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) DECLSPEC_HIDDEN;
220 extern HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData,
221                                                               LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) DECLSPEC_HIDDEN;
222 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
223                                                                  LPCSTR lpszFileName,
224                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
225                                                                  LPVOID pvRef,
226                                                                  DWORD dwFlags)  DECLSPEC_HIDDEN;
227 extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
228                                                                  LPCWSTR lpszFileName,
229                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
230                                                                  LPVOID pvRef,
231                                                                  DWORD dwFlags)  DECLSPEC_HIDDEN;
232 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
233                                                                  LPCSTR lpszFileName,
234                                                                  DWORD dwEntries,
235                                                                  LPDIFILEEFFECT rgDiFileEft,
236                                                                  DWORD dwFlags)  DECLSPEC_HIDDEN;
237 extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
238                                                                  LPCWSTR lpszFileName,
239                                                                  DWORD dwEntries,
240                                                                  LPDIFILEEFFECT rgDiFileEft,
241                                                                  DWORD dwFlags)  DECLSPEC_HIDDEN;
242 extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
243                                                               LPDIACTIONFORMATW lpdiaf,
244                                                               LPCWSTR lpszUserName,
245                                                               DWORD dwFlags) DECLSPEC_HIDDEN;
246 extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
247                                                             LPDIACTIONFORMATW lpdiaf,
248                                                             LPCWSTR lpszUserName,
249                                                             DWORD dwFlags) DECLSPEC_HIDDEN;
250 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
251                                                             LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) DECLSPEC_HIDDEN;
252 extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
253                                                             LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) DECLSPEC_HIDDEN;
254
255 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */