2009-07-11 Michael Barker <mike@middlesoft.co.uk>
[mono.git] / mcs / class / dlr / Runtime / Microsoft.Dynamic / ComInterop.cs
1 /* ****************************************************************************
2  *
3  * Copyright (c) Microsoft Corporation. 
4  *
5  * This source code is subject to terms and conditions of the Microsoft Public License. A 
6  * copy of the license can be found in the License.html file at the root of this distribution. If 
7  * you cannot locate the  Microsoft Public License, please send an email to 
8  * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
9  * by the terms of the Microsoft Public License.
10  *
11  * You must not remove this notice, or any other, from this software.
12  *
13  *
14  * ***************************************************************************/
15 using System; using Microsoft;
16
17
18 #if !SILVERLIGHT // ComObject
19
20 using System.Runtime.InteropServices;
21 using ComTypes = System.Runtime.InteropServices.ComTypes;
22
23 #if CODEPLEX_40
24 namespace System.Dynamic {
25 #else
26 namespace Microsoft.Scripting {
27 #endif
28
29     [
30     ComImport,
31     InterfaceType(ComInterfaceType.InterfaceIsIDispatch),
32     Guid("00020400-0000-0000-C000-000000000046")
33     ]
34     internal interface IDispatchForReflection {
35     }
36
37     [
38     ComImport,
39     InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
40     Guid("00020400-0000-0000-C000-000000000046"),
41     ]
42     internal interface IDispatch {
43
44         [PreserveSig]
45         int TryGetTypeInfoCount(out uint pctinfo);
46
47         [PreserveSig]
48         int TryGetTypeInfo(uint iTInfo, int lcid, out IntPtr info);
49
50         [PreserveSig]
51         int TryGetIDsOfNames(
52             ref Guid iid,
53             [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 2)]
54             string[] names,
55             uint cNames,
56             int lcid,
57             [Out]
58             [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I4, SizeParamIndex = 2)]
59             int[] rgDispId);
60
61         [PreserveSig]
62         int TryInvoke(
63             int dispIdMember,
64             ref Guid riid,
65             int lcid,
66             ComTypes.INVOKEKIND wFlags,
67             ref ComTypes.DISPPARAMS pDispParams,
68             out object VarResult,
69             out ComTypes.EXCEPINFO pExcepInfo,
70             out uint puArgErr);
71     }
72
73     /// <summary>
74     /// Layout of the IDispatch vtable
75     /// </summary>
76     internal enum IDispatchMethodIndices {
77         IUnknown_QueryInterface,
78         IUnknown_AddRef,
79         IUnknown_Release,
80
81         IDispatch_GetTypeInfoCount ,
82         IDispatch_GetTypeInfo,
83         IDispatch_GetIDsOfNames,
84         IDispatch_Invoke
85     }
86
87     [
88     ComImport,
89     InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
90     Guid("B196B283-BAB4-101A-B69C-00AA00341D07")
91     ]
92     internal interface IProvideClassInfo {
93         void GetClassInfo(out IntPtr info);
94     }
95
96 }
97
98 #endif