1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 use shared::basetsd::DWORD_PTR;
7 use shared::guiddef::GUID;
8 use shared::minwindef::{DWORD, WORD};
9 use shared::winerror::HRESULT;
10 use shared::wtypes::{BSTR, VARIANT_BOOL, VARTYPE};
11 use um::oaidl::{DISPID, DISPID_UNKNOWN, DISPPARAMS, EXCEPINFO, IDispatch, IDispatchVtbl, VARIANT};
12 use um::servprov::IServiceProvider;
13 use um::unknwnbase::{IUnknown, IUnknownVtbl};
14 use um::winnt::LCID;
15 DEFINE_GUID!{IID_IDispatchEx,
16     0xa6ef9860, 0xc720, 0x11d0, 0x93, 0x37, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9}
17 DEFINE_GUID!{IID_IDispError,
18     0xa6ef9861, 0xc720, 0x11d0, 0x93, 0x37, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9}
19 DEFINE_GUID!{IID_IVariantChangeType,
20     0xa6ef9862, 0xc720, 0x11d0, 0x93, 0x37, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9}
21 DEFINE_GUID!{SID_VariantConversion,
22     0x1f101481, 0xbccd, 0x11d0, 0x93, 0x36, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9}
23 DEFINE_GUID!{SID_GetCaller,
24     0x4717cc40, 0xbcb9, 0x11d0, 0x93, 0x36, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9}
25 DEFINE_GUID!{SID_ProvideRuntimeContext,
26     0x74a5040c, 0xdd0c, 0x48f0, 0xac, 0x85, 0x19, 0x4c, 0x32, 0x59, 0x18, 0xa}
27 DEFINE_GUID!{IID_IProvideRuntimeContext,
28     0x10e2414a, 0xec59, 0x49d2, 0xbc, 0x51, 0x5a, 0xdd, 0x2c, 0x36, 0xfe, 0xbc}
29 DEFINE_GUID!{IID_IObjectIdentity,
30     0xca04b7e6, 0xd21, 0x11d1, 0x8c, 0xc5, 0x0, 0xc0, 0x4f, 0xc2, 0xb0, 0x85}
31 DEFINE_GUID!{IID_ICanHandleException,
32     0xc5598e60, 0xb307, 0x11d1, 0xb2, 0x7d, 0x0, 0x60, 0x08, 0xc3, 0xfb, 0xfb}
33 // pub const SID_GetScriptSite = IID_IActiveScriptSite;
34 pub const fdexNameCaseSensitive: DWORD = 0x00000001;
35 pub const fdexNameEnsure: DWORD = 0x00000002;
36 pub const fdexNameImplicit: DWORD = 0x00000004;
37 pub const fdexNameCaseInsensitive: DWORD = 0x00000008;
38 pub const fdexNameInternal: DWORD = 0x00000010;
39 pub const fdexNameNoDynamicProperties: DWORD = 0x00000020;
40 pub const fdexPropCanGet: DWORD = 0x00000001;
41 pub const fdexPropCannotGet: DWORD = 0x00000002;
42 pub const fdexPropCanPut: DWORD = 0x00000004;
43 pub const fdexPropCannotPut: DWORD = 0x00000008;
44 pub const fdexPropCanPutRef: DWORD = 0x00000010;
45 pub const fdexPropCannotPutRef: DWORD = 0x00000020;
46 pub const fdexPropNoSideEffects: DWORD = 0x00000040;
47 pub const fdexPropDynamicType: DWORD = 0x00000080;
48 pub const fdexPropCanCall: DWORD = 0x00000100;
49 pub const fdexPropCannotCall: DWORD = 0x00000200;
50 pub const fdexPropCanConstruct: DWORD = 0x00000400;
51 pub const fdexPropCannotConstruct: DWORD = 0x00000800;
52 pub const fdexPropCanSourceEvents: DWORD = 0x00001000;
53 pub const fdexPropCannotSourceEvents: DWORD = 0x00002000;
54 pub const grfdexPropCanAll: DWORD = fdexPropCanGet | fdexPropCanPut | fdexPropCanPutRef
55     | fdexPropCanCall | fdexPropCanConstruct | fdexPropCanSourceEvents;
56 pub const grfdexPropCannotAll: DWORD = fdexPropCannotGet | fdexPropCannotPut | fdexPropCannotPutRef
57     | fdexPropCannotCall | fdexPropCannotConstruct | fdexPropCannotSourceEvents;
58 pub const grfdexPropExtraAll: DWORD = fdexPropNoSideEffects | fdexPropDynamicType;
59 pub const grfdexPropAll: DWORD = grfdexPropCanAll | grfdexPropCannotAll | grfdexPropExtraAll;
60 pub const fdexEnumDefault: DWORD = 0x00000001;
61 pub const fdexEnumAll: DWORD = 0x00000002;
62 pub const DISPATCH_CONSTRUCT: DWORD = 0x4000;
63 pub const DISPID_THIS: DISPID = -613;
64 pub const DISPID_STARTENUM: DISPID = DISPID_UNKNOWN;
65 // extern RPC_IF_HANDLE __MIDL_itf_dispex_0000_0000_v0_0_c_ifspec;
66 // extern RPC_IF_HANDLE __MIDL_itf_dispex_0000_0000_v0_0_s_ifspec;
67 // EXTERN_C const IID IID_IDispatchEx;
68 RIDL!{#[uuid(0xa6ef9860, 0xc720, 0x11d0, 0x93, 0x37, 0x00, 0xa0, 0xc9, 0x0d, 0xca, 0xa9)]
69 interface IDispatchEx(IDispatchExVtbl): IDispatch(IDispatchVtbl) {
70     fn GetDispID(
71         bstrName: BSTR,
72         grfdex: DWORD,
73         pid: *mut DISPID,
74     ) -> HRESULT,
75     fn InvokeEx(
76         id: DISPID,
77         lcid: LCID,
78         wFlags: WORD,
79         pdp: *mut DISPPARAMS,
80         pvarRes: *mut VARIANT,
81         pei: *mut EXCEPINFO,
82         pspCaller: *mut IServiceProvider,
83     ) -> HRESULT,
84     fn DeleteMemberByName(
85         bstrName: BSTR,
86         grfdex: DWORD,
87     ) -> HRESULT,
88     fn DeleteMemberByDispID(
89         id: DISPID,
90     ) -> HRESULT,
91     fn GetMemberProperties(
92         id: DISPID,
93         grfdexFetch: DWORD,
94         pgrfdex: *mut DWORD,
95     ) -> HRESULT,
96     fn GetMemberName(
97         id: DISPID,
98         pbstrName: *mut BSTR,
99     ) -> HRESULT,
100     fn GetNextDispID(
101         grfdex: DWORD,
102         id: DISPID,
103         pid: *mut DISPID,
104     ) -> HRESULT,
105     fn GetNameSpaceParent(
106         ppunk: *mut *mut IUnknown,
107     ) -> HRESULT,
108 }}
109 // HRESULT STDMETHODCALLTYPE IDispatchEx_RemoteInvokeEx_Proxy(
110 //     IDispatchEx * This,
111 //     DISPID id,
112 //     LCID lcid,
113 //     DWORD dwFlags,
114 //     DISPPARAMS *pdp,
115 //     VARIANT *pvarRes,
116 //     EXCEPINFO *pei,
117 //     IServiceProvider *pspCaller,
118 //     UINT cvarRefArg,
119 //     UINT *rgiRefArg,
120 //     VARIANT *rgvarRefArg);
121 // void __RPC_STUB IDispatchEx_RemoteInvokeEx_Stub(
122 //     IRpcStubBuffer *This,
123 //     IRpcChannelBuffer *_pRpcChannelBuffer,
124 //     PRPC_MESSAGE _pRpcMessage,
125 //     DWORD *_pdwStubPhase);
126 // EXTERN_C const IID IID_IDispError;
127 RIDL!{#[uuid(0xa6ef9861, 0xc720, 0x11d0, 0x93, 0x37, 0x00, 0xa0, 0xc9, 0x0d, 0xca, 0xa9)]
128 interface IDispError(IDispErrorVtbl): IUnknown(IUnknownVtbl) {
129     fn QueryErrorInfo(
130         guidErrorType: GUID,
131         ppde: *mut *mut IDispError,
132     ) -> HRESULT,
133     fn GetNext(
134         ppde: *mut *mut IDispError,
135     ) -> HRESULT,
136     fn GetHresult(
137         phr: *mut HRESULT,
138     ) -> HRESULT,
139     fn GetSource(
140         pbstrSource: *mut BSTR,
141     ) -> HRESULT,
142     fn GetHelpInfo(
143         pbstrFileName: *mut BSTR,
144         pdwContext: *mut DWORD,
145     ) -> HRESULT,
146     fn GetDescription(
147         pbstrDescription: *mut BSTR,
148     ) -> HRESULT,
149 }}
150 // EXTERN_C const IID IID_IVariantChangeType;
151 RIDL!{#[uuid(0xa6ef9862, 0xc720, 0x11d0, 0x93, 0x37, 0x00, 0xa0, 0xc9, 0x0d, 0xca, 0xa9)]
152 interface IVariantChangeType(IVariantChangeTypeVtbl): IUnknown(IUnknownVtbl) {
153     fn ChangeType(
154         pvarDst: *mut VARIANT,
155         pvarSrc: *mut VARIANT,
156         lcid: LCID,
157         vtNew: VARTYPE,
158     ) -> HRESULT,
159 }}
160 // EXTERN_C const IID IID_IObjectIdentity;
161 RIDL!{#[uuid(0xca04b7e6, 0x0d21, 0x11d1, 0x8c, 0xc5, 0x00, 0xc0, 0x4f, 0xc2, 0xb0, 0x85)]
162 interface IObjectIdentity(IObjectIdentityVtbl): IUnknown(IUnknownVtbl) {
163     fn IsEqualObject(
164         punk: *mut IUnknown,
165     ) -> HRESULT,
166 }}
167 // EXTERN_C const IID IID_ICanHandleException;
168 RIDL!{#[uuid(0xc5598e60, 0xb307, 0x11d1, 0xb2, 0x7d, 0x00, 0x60, 0x08, 0xc3, 0xfb, 0xfb)]
169 interface ICanHandleException(ICanHandleExceptionVtbl): IUnknown(IUnknownVtbl) {
170     fn CanHandleException(
171         pExcepInfo: *mut EXCEPINFO,
172         pvar: *mut VARIANT,
173     ) -> HRESULT,
174 }}
175 // EXTERN_C const IID IID_IProvideRuntimeContext;
176 RIDL!{#[uuid(0x10e2414a, 0xec59, 0x49d2, 0xbc, 0x51, 0x5a, 0xdd, 0x2c, 0x36, 0xfe, 0xbc)]
177 interface IProvideRuntimeContext(IProvideRuntimeContextVtbl): IUnknown(IUnknownVtbl) {
178     fn GetCurrentSourceContext(
179         pdwContext: *mut DWORD_PTR,
180         pfExecutingGlobalCode: *mut VARIANT_BOOL,
181     ) -> HRESULT,
182 }}
183 // extern RPC_IF_HANDLE __MIDL_itf_dispex_0000_0006_v0_0_c_ifspec;
184 // extern RPC_IF_HANDLE __MIDL_itf_dispex_0000_0006_v0_0_s_ifspec;
185 // unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long, __RPC__in BSTR * );
186 // unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * );
187 // unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * );
188 // void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * );
189 // unsigned long __RPC_USER VARIANT_UserSize( __RPC__in unsigned long *, unsigned long, __RPC__in VARIANT * );
190 // unsigned char * __RPC_USER VARIANT_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in VARIANT * );
191 // unsigned char * __RPC_USER VARIANT_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out VARIANT * );
192 // void __RPC_USER VARIANT_UserFree( __RPC__in unsigned long *, __RPC__in VARIANT * );
193 // unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long, __RPC__in BSTR * );
194 // unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * );
195 // unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * );
196 // void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * );
197 // unsigned long __RPC_USER VARIANT_UserSize64( __RPC__in unsigned long *, unsigned long, __RPC__in VARIANT * );
198 // unsigned char * __RPC_USER VARIANT_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in VARIANT * );
199 // unsigned char * __RPC_USER VARIANT_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out VARIANT * );
200 // void __RPC_USER VARIANT_UserFree64( __RPC__in unsigned long *, __RPC__in VARIANT * );
201 // HRESULT STDMETHODCALLTYPE IDispatchEx_InvokeEx_Proxy(
202 //     IDispatchEx * This,
203 //     DISPID id,
204 //     LCID lcid,
205 //     WORD wFlags,
206 //     DISPPARAMS *pdp,
207 //     VARIANT *pvarRes,
208 //     EXCEPINFO *pei,
209 //     IServiceProvider *pspCaller);
210 // HRESULT STDMETHODCALLTYPE IDispatchEx_InvokeEx_Stub(
211 //     IDispatchEx * This,
212 //     DISPID id,
213 //     LCID lcid,
214 //     DWORD dwFlags,
215 //     DISPPARAMS *pdp,
216 //     VARIANT *pvarRes,
217 //     EXCEPINFO *pei,
218 //     IServiceProvider *pspCaller,
219 //     UINT cvarRefArg,
220 //     UINT *rgiRefArg,
221 //     VARIANT *rgvarRefArg);
222