Merge remote branch 'upstream/master'
[mono.git] / mcs / class / corlib / System / _AppDomain.cs
1 //
2 // System.AppDomain.cs
3 //
4 // Author:
5 //   Duco Fijma (duco@lorentz.xs4all.nl)
6 //
7 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using System.Security;
30 using System.Security.Permissions;
31 using System.Security.Policy;
32 using System.Security.Principal;
33 using System.Reflection;
34 using System.Reflection.Emit;
35 using System.Globalization;
36 using System.Runtime.Remoting;
37 using System.Runtime.InteropServices;
38
39 namespace System
40 {
41         [ComVisible (true)]
42         [CLSCompliant (false)]
43         [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
44         [Guid ("05F696DC-2B29-3663-AD8B-C4389CF2A713")]
45         public interface _AppDomain
46         {
47                 string BaseDirectory {get; }
48                 string DynamicDirectory {get; }
49                 Evidence Evidence {get; }
50                 string FriendlyName {get; }
51                 string RelativeSearchPath {get; }
52                 bool ShadowCopyFiles {get; }
53
54                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
55                 void AppendPrivatePath (string path);
56
57                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
58                 void ClearPrivatePath ();
59
60                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
61                 void ClearShadowCopyPath ();
62
63                 ObjectHandle CreateInstance (string assemblyName, string typeName);
64                 ObjectHandle CreateInstance (string assemblyName, string typeName, object[] activationAttributes);
65                 ObjectHandle CreateInstance (string assemblyName, string typeName, bool ignoreCase,
66                         BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
67                         object[] activationAttributes, Evidence securityAttributes);
68
69                 ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName);
70                 ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, object[] activationAttributes);
71                 ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase,
72                         BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
73                         object[] activationAttributes, Evidence securityAttributes);
74
75                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access);
76                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, Evidence evidence);
77                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir);
78                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir, Evidence evidence);
79                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
80                         PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions);
81                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
82                         Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
83                         PermissionSet refusedPermissions);
84                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
85                         string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions);
86                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
87                         string dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
88                         PermissionSet refusedPermissions);
89                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
90                         Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
91                         PermissionSet refusedPermissions, bool isSynchronized);
92
93                 void DoCallBack (CrossAppDomainDelegate theDelegate);
94                 bool Equals (object other);
95
96                 int ExecuteAssembly (string assemblyFile);
97                 int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity);
98                 int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity, string[] args);
99
100                 Assembly[] GetAssemblies ();
101                 object GetData (string name);
102                 int GetHashCode();
103
104 #if !NET_4_0
105                 [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
106 #endif
107                 object GetLifetimeService ();
108
109                 Type GetType ();
110
111                 [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
112                 object InitializeLifetimeService ();
113
114                 Assembly Load (AssemblyName assemblyRef);
115                 Assembly Load (byte[] rawAssembly);
116                 Assembly Load (string assemblyString);
117                 Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity);
118                 Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore);
119                 Assembly Load (string assemblyString, Evidence assemblySecurity);
120                 Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence);
121
122                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
123                 void SetAppDomainPolicy (PolicyLevel domainPolicy);
124
125                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
126                 void SetCachePath (string s);
127
128                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
129                 void SetData (string name, object data);
130
131                 void SetPrincipalPolicy (PrincipalPolicy policy);
132
133                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
134                 void SetShadowCopyPath (string s);
135
136                 void SetThreadPrincipal (IPrincipal principal);
137                 string ToString ();
138
139                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
140                 event AssemblyLoadEventHandler AssemblyLoad;
141
142                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
143                 event ResolveEventHandler AssemblyResolve;
144
145                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
146                 event EventHandler DomainUnload;
147
148                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
149                 event EventHandler ProcessExit;
150
151                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
152                 event ResolveEventHandler ResourceResolve;
153
154                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
155                 event ResolveEventHandler TypeResolve;
156
157                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
158                 event UnhandledExceptionEventHandler UnhandledException;
159
160                 void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
161
162                 void GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo);
163
164                 void GetTypeInfoCount (out uint pcTInfo);
165
166                 void Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams,
167                         IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
168         }
169 }