windowscodecs: Do not assume that vtable is the first element of the object, avoid...
[wine] / include / sti.h
1 /*
2  * Copyright (C) 2009 Damjan Jovanovic
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef __WINE_STI_H
20 #define __WINE_STI_H
21
22 #include <objbase.h>
23 /* #include <stireg.h> */
24 /* #include <stierr.h> */
25
26 #include <pshpack8.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 DEFINE_GUID(CLSID_Sti, 0xB323F8E0, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);
33
34 DEFINE_GUID(IID_IStillImageW, 0x641BD880, 0x2DC8, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);
35
36 DEFINE_GUID(IID_IStillImageA, 0xA7B1F740, 0x1D7F, 0x11D1, 0xAC, 0xA9, 0x00, 0xA0, 0x24, 0x38, 0xAD, 0x48);
37
38 #define STI_VERSION_REAL         0x00000002
39 #define STI_VERSION_FLAG_UNICODE 0x01000000
40
41 #ifndef WINE_NO_UNICODE_MACROS
42 # ifdef UNICODE
43 #  define STI_VERSION (STI_VERSION_REAL | STI_VERSION_FLAG_UNICODE)
44 # else
45 #  define STI_VERSION (STI_VERSION_REAL)
46 # endif
47 #endif
48
49 typedef struct IStillImageA *PSTIA;
50 typedef struct IStillImageW *PSTIW;
51 DECL_WINELIB_TYPE_AW(PSTI)
52 typedef struct IStillImageA *LPSTILLIMAGEA;
53 typedef struct IStillImageW *LPSTILLIMAGEW;
54 DECL_WINELIB_TYPE_AW(LPSTILLIMAGE)
55 typedef struct IStiDeviceA *PSTIDEVICEA;
56 typedef struct IStiDeviceW *PSTIDEVICEW;
57 DECL_WINELIB_TYPE_AW(PSTIDEVICE)
58
59 HRESULT WINAPI StiCreateInstanceA(HINSTANCE hinst, DWORD dwVer, PSTIA *ppSti, LPUNKNOWN pUnkOuter);
60 HRESULT WINAPI StiCreateInstanceW(HINSTANCE hinst, DWORD dwVer, PSTIW *ppSti, LPUNKNOWN pUnkOuter);
61 #define        StiCreateInstance WINELIB_NAME_AW(StiCreateInstance)
62
63 typedef DWORD STI_DEVICE_TYPE;
64 typedef enum _STI_DEVICE_MJ_TYPE
65 {
66     StiDeviceTypeDefault           = 0,
67     StiDeviceTypeScanner           = 1,
68     StiDeviceTypeDigitalCamera     = 2,
69     StiDeviceTypeStreamingVideo    = 3
70 } STI_DEVICE_MJ_TYPE;
71
72 #define GET_STIDEVICE_TYPE(dwDevType) HIWORD(dwDevType)
73 #define GET_STIDEVICE_SUBTYPE(dwDevType) LOWORD(dwDevType)
74
75 typedef struct _STI_DEV_CAPS {
76     DWORD dwGeneric;
77 } STI_DEV_CAPS, *PSTI_DEV_CAPS;
78
79 #define STI_MAX_INTERNAL_NAME_LENGTH 128
80
81 typedef struct _STI_DEVICE_INFORMATIONW {
82     DWORD dwSize;
83     STI_DEVICE_TYPE DeviceType;
84     WCHAR szDeviceInternalName[STI_MAX_INTERNAL_NAME_LENGTH];
85     STI_DEV_CAPS DeviceCapabilities;
86     DWORD dwHardwareConfiguration;
87     LPWSTR pszVendorDescription;
88     LPWSTR pszDeviceDescription;
89     LPWSTR pszPortName;
90     LPWSTR pszPropProvider;
91     LPWSTR pszLocalName;
92 } STI_DEVICE_INFORMATIONW, *PSTI_DEVICE_INFORMATIONW;
93
94 typedef STI_DEVICE_INFORMATIONW STI_DEVICE_INFORMATION;
95 typedef PSTI_DEVICE_INFORMATIONW PSTI_DEVICE_INFORMATION;
96
97 #define MAX_NOTIFICATION_DATA 64
98
99 typedef struct _STINOTIFY {
100     DWORD dwSize;
101     GUID guidNotificationCode;
102     BYTE abNotificationData[MAX_NOTIFICATION_DATA];
103 } STINOTIFY,*LPSTINOTIFY;
104
105 #define INTERFACE IStillImageW
106 DECLARE_INTERFACE_(IStillImageW, IUnknown)
107 {
108     /*** IUnknown methods ***/
109     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
110     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
111     STDMETHOD_(ULONG,Release)(THIS) PURE;
112     /*** IStillImageW methods ***/
113     STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE;
114     STDMETHOD(GetDeviceList)(THIS_ DWORD dwType, DWORD dwFlags, DWORD *pdwItemsReturned, LPVOID *ppBuffer) PURE;
115     STDMETHOD(GetDeviceInfo)(THIS_ LPWSTR pwszDeviceName, LPVOID *ppBuffer) PURE;
116     STDMETHOD(CreateDevice)(THIS_ LPWSTR pwszDeviceName, DWORD dwMode, PSTIDEVICEW *pDevice, LPUNKNOWN pUnkOuter) PURE;
117     STDMETHOD(GetDeviceValue)(THIS_ LPWSTR pwszDeviceName, LPWSTR pValueName, LPDWORD pType, LPBYTE pData, LPDWORD cbData) PURE;
118     STDMETHOD(SetDeviceValue)(THIS_ LPWSTR pwszDeviceName, LPWSTR pValueName, DWORD type, LPBYTE pData, DWORD cbData) PURE;
119     STDMETHOD(GetSTILaunchInformation)(THIS_ LPWSTR pwszDeviceName, DWORD *pdwEventCode, LPWSTR pwszEventName) PURE;
120     STDMETHOD(RegisterLaunchApplication)(THIS_ LPWSTR pwszAppName, LPWSTR pwszCommandLine) PURE;
121     STDMETHOD(UnregisterLaunchApplication)(THIS_ LPWSTR pwszAppName) PURE;
122     STDMETHOD(EnableHwNotifications)(THIS_ LPCWSTR pwszDeviceName, BOOL bNewState) PURE;
123     STDMETHOD(GetHwNotificationState)(THIS_ LPCWSTR pwszDeviceName, BOOL *pbCurrentState) PURE;
124     STDMETHOD(RefreshDeviceBus)(THIS_ LPCWSTR pwszDeviceName) PURE;
125     STDMETHOD(LaunchApplicationForDevice)(THIS_ LPWSTR pwszDeviceName, LPWSTR pwszAppName, LPSTINOTIFY pStiNotify);
126     STDMETHOD(SetupDeviceParameters)(THIS_ PSTI_DEVICE_INFORMATIONW pDevInfo);
127     STDMETHOD(WriteToErrorLog)(THIS_ DWORD dwMessageType, LPCWSTR pszMessage) PURE;
128 };
129 #undef INTERFACE
130
131 #if !defined(__cplusplus) || defined(CINTERFACE)
132 /*** IUnknown methods ***/
133 #define IStillImage_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
134 #define IStillImage_AddRef(p)             (p)->lpVtbl->AddRef(p)
135 #define IStillImage_Release(p)            (p)->lpVtbl->Release(p)
136 /*** IStillImage methods ***/
137 #define IStillImage_Initialize(p,a,b)                   (p)->lpVtbl->Initialize(p,a,b)
138 #define IStillImage_GetDeviceList(p,a,b,c,d)            (p)->lpVtbl->GetDeviceList(p,a,b,c,d)
139 #define IStillImage_GetDeviceInfo(p,a,b)                (p)->lpVtbl->GetDeviceInfo(p,a,b)
140 #define IStillImage_CreateDevice(p,a,b,c,d)             (p)->lpVtbl->CreateDevice(p,a,b,c,d)
141 #define IStillImage_GetDeviceValue(p,a,b,c,d,e)         (p)->lpVtbl->GetDeviceValue(p,a,b,c,d,e)
142 #define IStillImage_SetDeviceValue(p,a,b,c,d,e)         (p)->lpVtbl->SetDeviceValue(p,a,b,c,d,e)
143 #define IStillImage_GetSTILaunchInformation(p,a,b,c)    (p)->lpVtbl->GetSTILaunchInformation(p,a,b,c)
144 #define IStillImage_RegisterLaunchApplication(p,a,b)    (p)->lpVtbl->RegisterLaunchApplication(p,a,b)
145 #define IStillImage_UnregisterLaunchApplication(p,a)    (p)->lpVtbl->UnregisterLaunchApplication(p,a)
146 #define IStillImage_EnableHwNotifications(p,a,b)        (p)->lpVtbl->EnableHwNotifications(p,a,b)
147 #define IStillImage_GetHwNotificationState(p,a,b)       (p)->lpVtbl->GetHwNotificationState(p,a,b)
148 #define IStillImage_RefreshDeviceBus(p,a)               (p)->lpVtbl->RefreshDeviceBus(p,a)
149 #define IStillImage_LaunchApplicationForDevice(p,a,b,c) (p)->lpVtbl->LaunchApplicationForDevice(p,a,b,c)
150 #define IStillImage_SetupDeviceParameters(p,a)          (p)->lpVtbl->SetupDeviceParameters(p,a)
151 #define IStillImage_WriteToErrorLog(p,a,b)              (p)->lpVtbl->WriteToErrorLog(p,a,b)
152 #else
153 /*** IUnknown methods ***/
154 #define IStillImage_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
155 #define IStillImage_AddRef(p)             (p)->AddRef()
156 #define IStillImage_Release(p)            (p)->Release()
157 /*** IStillImage methods ***/
158 #define IStillImage_Initialize(p,a,b)                   (p)->Initialize(a,b)
159 #define IStillImage_GetDeviceList(p,a,b,c,d)            (p)->GetDeviceList(a,b,c,d)
160 #define IStillImage_GetDeviceInfo(p,a,b)                (p)->GetDeviceInfo(a,b)
161 #define IStillImage_CreateDevice(p,a,b,c,d)             (p)->CreateDevice(a,b,c,d)
162 #define IStillImage_GetDeviceValue(p,a,b,c,d,e)         (p)->GetDeviceValue(a,b,c,d,e)
163 #define IStillImage_SetDeviceValue(p,a,b,c,d,e)         (p)->SetDeviceValue(a,b,c,d,e)
164 #define IStillImage_GetSTILaunchInformation(p,a,b,c)    (p)->GetSTILaunchInformation(a,b,c)
165 #define IStillImage_RegisterLaunchApplication(p,a,b)    (p)->RegisterLaunchApplication(a,b)
166 #define IStillImage_UnregisterLaunchApplication(p,a)    (p)->UnregisterLaunchApplication(a)
167 #define IStillImage_EnableHwNotifications(p,a,b)        (p)->EnableHwNotifications(a,b)
168 #define IStillImage_GetHwNotificationState(p,a,b)       (p)->GetHwNotificationState(a,b)
169 #define IStillImage_RefreshDeviceBus(p,a)               (p)->RefreshDeviceBus(a)
170 #define IStillImage_LaunchApplicationForDevice(p,a,b,c) (p)->LaunchApplicationForDevice(a,b,c)
171 #define IStillImage_SetupDeviceParameters(p,a)          (p)->SetupDeviceParameters(a)
172 #define IStillImage_WriteToErrorLog(p,a,b)              (p)->WriteToErrorLog(a,b)
173 #endif
174
175 #ifdef __cplusplus
176 };
177 #endif
178
179 #include <poppack.h>
180
181 #endif /* __WINE_STI_H */