1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4////////////////////////////////////////////////////////////////////////////////
5
6
7
8#ifndef _COMModule_H_
9#define _COMModule_H_
10
11#include "invokeutil.h"
12
13class Module;
14
15class COMModule
16{
17public:
18 // Attaches an unmanaged symwriter to a newly created dynamic module.
19 static FCDECL2(LPVOID, nCreateISymWriterForDynamicModule, ReflectModuleBaseObject* reflectionModuleUNSAFE, StringObject* filenameUNSAFE);
20
21
22 // IsTransient
23 // Determine if a Module is transient
24 static
25 BOOL QCALLTYPE IsTransient(QCall::ModuleHandle pModule);
26
27 // GetTypeRef
28 // This function will return the class token for the named element.
29 static
30 mdTypeRef QCALLTYPE GetTypeRef(QCall::ModuleHandle pModule,
31 LPCWSTR wszFullName,
32 QCall::ModuleHandle pRefedModule,
33 LPCWSTR wszRefedModuleFileName,
34 INT32 tkResolution);
35
36 // LoadInMemoryTypeByName
37 // This function will return the class token for the named element.
38 static
39 void QCALLTYPE LoadInMemoryTypeByName(QCall::ModuleHandle pModule, LPCWSTR wszFullName);
40
41
42 // SetFieldRVAContent
43 // This function is used to set the FieldRVA with the content data
44 static
45 void QCALLTYPE SetFieldRVAContent(QCall::ModuleHandle pModule, INT32 tkField, LPCBYTE pContent, INT32 length);
46
47
48 //GetArrayMethodToken
49 static
50 INT32 QCALLTYPE GetArrayMethodToken(QCall::ModuleHandle pModule,
51 INT32 tkTypeSpec,
52 LPCWSTR wszMethodName,
53 LPCBYTE pSignature,
54 INT32 sigLength);
55
56 // GetMemberRefToken
57 // This function will return the MemberRef token
58 static
59 INT32 QCALLTYPE GetMemberRef(QCall::ModuleHandle pModule, QCall::ModuleHandle pRefedModule, INT32 tr, INT32 token);
60
61 // This function return a MemberRef token given a MethodInfo describing a array method
62 static
63 INT32 QCALLTYPE GetMemberRefOfMethodInfo(QCall::ModuleHandle pModule, INT32 tr, MethodDesc * method);
64
65
66 // GetMemberRefOfFieldInfo
67 // This function will return a memberRef token given a FieldInfo
68 static
69 mdMemberRef QCALLTYPE GetMemberRefOfFieldInfo(QCall::ModuleHandle pModule, mdTypeDef tr, EnregisteredTypeHandle th, mdFieldDef tkField);
70
71 // GetMemberRefFromSignature
72 // This function will return the MemberRef token given the signature from managed code
73 static
74 INT32 QCALLTYPE GetMemberRefFromSignature(QCall::ModuleHandle pModule,
75 INT32 tr,
76 LPCWSTR wszMemberName,
77 LPCBYTE pSignature,
78 INT32 sigLength);
79
80 // GetTokenFromTypeSpec
81 static
82 mdTypeSpec QCALLTYPE GetTokenFromTypeSpec(QCall::ModuleHandle pModule, LPCBYTE pSignature, INT32 sigLength);
83
84 // GetType
85 // Given a class type, this method will look for that type
86 // with in the module.
87 static
88 void QCALLTYPE GetType(QCall::ModuleHandle pModule, LPCWSTR wszName, BOOL bThrowOnError, BOOL bIgnoreCase, QCall::ObjectHandleOnStack retType, QCall::ObjectHandleOnStack keepAlive);
89
90 // Get class will return an array contain all of the classes
91 // that are defined within this Module.
92 static FCDECL1(Object*, GetTypes, ReflectModuleBaseObject* pModuleUNSAFE);
93
94 // GetStringConstant
95 // If this is a dynamic module, this routine will define a new
96 // string constant or return the token of an existing constant.
97 static
98 mdString QCALLTYPE GetStringConstant(QCall::ModuleHandle pModule, LPCWSTR pwzValue, INT32 iLength);
99
100
101 static
102 void QCALLTYPE SetModuleName(QCall::ModuleHandle pModule, LPCWSTR wszModuleName);
103
104 static FCDECL1(FC_BOOL_RET, IsResource, ReflectModuleBaseObject* pModuleUNSAFE);
105
106 static FCDECL1(Object*, GetMethods, ReflectModuleBaseObject* refThisUNSAFE);
107
108 static
109 void QCALLTYPE GetScopeName(QCall::ModuleHandle pModule, QCall::StringHandleOnStack retString);
110
111 static
112 void QCALLTYPE GetFullyQualifiedName(QCall::ModuleHandle pModule, QCall::StringHandleOnStack retString);
113
114 static
115 HINSTANCE QCALLTYPE GetHINSTANCE(QCall::ModuleHandle pModule);
116
117 static void DefineTypeRefHelper(
118 IMetaDataEmit *pEmit, // given emit scope
119 mdTypeDef td, // given typedef in the emit scope
120 mdTypeRef *ptr); // return typeref
121
122};
123
124class COMPunkSafeHandle
125{
126 public:
127 static FCDECL0(void*, nGetDReleaseTarget);
128};
129
130#endif
131