Rework PublishProduct to use MSI_IterateRecords.
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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
29 /* Device implementation */
30 typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl;
31 struct IDirectInputDevice2AImpl
32 {
33         const IDirectInputDevice2AVtbl *lpVtbl;
34         DWORD                           ref;
35         GUID                            guid;
36 };
37
38 /* Routines to do DataFormat / WineFormat conversions */
39 typedef struct {
40   int size;
41   int offset_in;
42   int offset_out;
43   int value;
44 } DataTransform;
45
46 typedef struct {
47   int size;
48   int internal_format_size;
49   DataTransform *dt;
50 } DataFormat;
51 extern void fill_DataFormat(void *out, const void *in, DataFormat *df) ;
52 extern DataFormat *create_DataFormat(const DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_format, int *offset) ;
53 extern void release_DataFormat(DataFormat *df) ;
54
55 /* Used to fill events in the queue */
56 #define GEN_EVENT(offset,data,xtime,seq)                                        \
57 {                                                                               \
58   /* If queue_len > 0, queuing is requested -> TRACE the event queued */        \
59   if (This->queue_len > 0) {                                                    \
60     int nq;                                                                     \
61     TRACE(" queueing %d at offset %d (queue head %d / size %d)\n",              \
62           (int) (data), (int) (offset),                                         \
63           (int) (This->queue_head), (int) (This->queue_len));                   \
64                                                                                 \
65     nq = This->queue_head+1;                                                    \
66     while (nq >= This->queue_len) nq -= This->queue_len;                        \
67     if ((offset >= 0) && (nq != This->queue_tail)) {                            \
68       This->data_queue[This->queue_head].dwOfs = offset;                        \
69       This->data_queue[This->queue_head].dwData = data;                         \
70       This->data_queue[This->queue_head].dwTimeStamp = xtime;                   \
71       This->data_queue[This->queue_head].dwSequence = seq;                      \
72       This->queue_head = nq;                                                    \
73     } else                                                                      \
74       This->overflow = TRUE;                                                    \
75   }                                                                             \
76 }
77
78 /**
79  * Callback Data used by specific callback 
80  *  for EnumObject on 'W' interfaces
81  */
82 typedef struct {
83   LPDIENUMDEVICEOBJECTSCALLBACKW lpCallBack;
84   LPVOID lpvRef;
85 } device_enumobjects_AtoWcb_data;
86
87 extern BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA, LPVOID);
88
89
90 /* Various debug tools */
91 extern void _dump_cooperativelevel_DI(DWORD dwFlags) ;
92 extern void _dump_EnumObjects_flags(DWORD dwFlags) ;
93 extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) ;
94 extern void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) ;
95 extern void _dump_OBJECTINSTANCEW(DIDEVICEOBJECTINSTANCEW *ddoi) ;
96 extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) ;
97 extern const char *_dump_dinput_GUID(const GUID *guid) ;
98
99 /* And the stubs */
100 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
101         LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df ) ;
102 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(
103         LPDIRECTINPUTDEVICE8A iface,HWND hwnd,DWORD dwflags ) ;
104 extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
105         LPDIRECTINPUTDEVICE8A iface,HANDLE hnd ) ;
106 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) ;
107 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface,REFIID riid,LPVOID *ppobj);
108 extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface,REFIID riid,LPVOID *ppobj);
109 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(
110         LPDIRECTINPUTDEVICE8A iface) ;
111 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
112         LPDIRECTINPUTDEVICE8A iface,
113         LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
114         LPVOID lpvRef,
115         DWORD dwFlags) ;
116 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects(
117         LPDIRECTINPUTDEVICE8W iface,
118         LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
119         LPVOID lpvRef,
120         DWORD dwFlags) ;
121 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
122         LPDIRECTINPUTDEVICE8A iface,
123         REFGUID rguid,
124         LPDIPROPHEADER pdiph) ;
125 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
126         LPDIRECTINPUTDEVICE8A iface,
127         LPDIDEVICEOBJECTINSTANCEA pdidoi,
128         DWORD dwObj,
129         DWORD dwHow) ;
130 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, 
131                                                              LPDIDEVICEOBJECTINSTANCEW pdidoi,
132                                                              DWORD dwObj,
133                                                              DWORD dwHow);
134 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
135         LPDIRECTINPUTDEVICE8A iface,
136         LPDIDEVICEINSTANCEA pdidi) ;
137 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo(
138         LPDIRECTINPUTDEVICE8W iface,
139         LPDIDEVICEINSTANCEW pdidi) ;
140 extern HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
141         LPDIRECTINPUTDEVICE8A iface,
142         HWND hwndOwner,
143         DWORD dwFlags) ;
144 extern HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
145         LPDIRECTINPUTDEVICE8A iface,
146         HINSTANCE hinst,
147         DWORD dwVersion,
148         REFGUID rguid) ;
149 extern HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect(
150         LPDIRECTINPUTDEVICE8A iface,
151         REFGUID rguid,
152         LPCDIEFFECT lpeff,
153         LPDIRECTINPUTEFFECT *ppdef,
154         LPUNKNOWN pUnkOuter) ;
155 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
156         LPDIRECTINPUTDEVICE8A iface,
157         LPDIENUMEFFECTSCALLBACKA lpCallback,
158         LPVOID lpvRef,
159         DWORD dwFlags) ;
160 extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
161         LPDIRECTINPUTDEVICE8W iface,
162         LPDIENUMEFFECTSCALLBACKW lpCallback,
163         LPVOID lpvRef,
164         DWORD dwFlags) ;
165 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
166         LPDIRECTINPUTDEVICE8A iface,
167         LPDIEFFECTINFOA lpdei,
168         REFGUID rguid) ;
169 extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
170         LPDIRECTINPUTDEVICE8W iface,
171         LPDIEFFECTINFOW lpdei,
172         REFGUID rguid) ;
173 extern HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState(
174         LPDIRECTINPUTDEVICE8A iface,
175         LPDWORD pdwOut) ;
176 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
177         LPDIRECTINPUTDEVICE8A iface,
178         DWORD dwFlags) ;
179 extern HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
180         LPDIRECTINPUTDEVICE8A iface,
181         LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
182         LPVOID lpvRef,
183         DWORD dwFlags) ;
184 extern HRESULT WINAPI IDirectInputDevice2AImpl_Escape(
185         LPDIRECTINPUTDEVICE8A iface,
186         LPDIEFFESCAPE lpDIEEsc) ;
187 extern HRESULT WINAPI IDirectInputDevice2AImpl_Poll(
188         LPDIRECTINPUTDEVICE8A iface) ;
189 extern HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
190         LPDIRECTINPUTDEVICE8A iface,
191         DWORD cbObjectData,
192         LPCDIDEVICEOBJECTDATA rgdod,
193         LPDWORD pdwInOut,
194         DWORD dwFlags) ;
195 extern HRESULT WINAPI IDirectInputDevice7AImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8A iface,
196                                                                  LPCSTR lpszFileName,
197                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
198                                                                  LPVOID pvRef,
199                                                                  DWORD dwFlags) ;
200 extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface,
201                                                                  LPCWSTR lpszFileName,
202                                                                  LPDIENUMEFFECTSINFILECALLBACK pec,
203                                                                  LPVOID pvRef,
204                                                                  DWORD dwFlags) ;
205 extern HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8A iface,
206                                                                  LPCSTR lpszFileName,
207                                                                  DWORD dwEntries,
208                                                                  LPDIFILEEFFECT rgDiFileEft,
209                                                                  DWORD dwFlags) ;
210 extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface,
211                                                                  LPCWSTR lpszFileName,
212                                                                  DWORD dwEntries,
213                                                                  LPDIFILEEFFECT rgDiFileEft,
214                                                                  DWORD dwFlags) ;
215 extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface,
216                                                               LPDIACTIONFORMATA lpdiaf,
217                                                               LPCSTR lpszUserName,
218                                                               DWORD dwFlags);
219 extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
220                                                               LPDIACTIONFORMATW lpdiaf,
221                                                               LPCWSTR lpszUserName,
222                                                               DWORD dwFlags);
223 extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
224                                                             LPDIACTIONFORMATA lpdiaf,
225                                                             LPCSTR lpszUserName,
226                                                             DWORD dwFlags);
227 extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
228                                                             LPDIACTIONFORMATW lpdiaf,
229                                                             LPCWSTR lpszUserName,
230                                                             DWORD dwFlags);
231 extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface,
232                                                             LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader);
233 extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface,
234                                                             LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
235
236 #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */