Example #1
0
        public static tAsyncCall *GetTypeFromName(tJITCallNative *pCallNative, byte *pThis_, byte *pParams, byte *pReturnValue)
        {
            byte *       namespaceName = stackalloc byte[256];
            byte *       className     = stackalloc byte[256];
            tMD_TypeDef *pTypeDef;

            DotNetStringToCString(namespaceName, 256, ((tSystemString **)pParams)[1]);
            DotNetStringToCString(className, 256, ((tSystemString **)pParams)[2]);

            if (((/*HEAP_PTR*/ byte **)pParams)[0] == null)
            {
                // assemblyName is null, so search all loaded assemblies
                pTypeDef = CLIFile.FindTypeInAllLoadedAssemblies(namespaceName, className);
            }
            else
            {
                // assemblyName is specified
                byte *assemblyName = stackalloc byte[256];
                DotNetStringToCString(assemblyName, 256, ((tSystemString **)pParams)[0]);
                tMetaData *pAssemblyMetadata = CLIFile.GetMetaDataForAssembly(assemblyName);
                pTypeDef = MetaData.GetTypeDefFromName(pAssemblyMetadata, namespaceName, className, null, /* assertExists */ 1);
            }

            MetaData.Fill_TypeDef(pTypeDef, null, null);
            *(/*HEAP_PTR*/ byte **)pReturnValue = Type.GetTypeObject(pTypeDef);
            return(null);
        }
Example #2
0
        public static tAsyncCall *EnsureAssemblyLoaded(tJITCallNative *pCallNative, byte *pThis_, byte *pParams, byte *pReturnValue)
        {
            byte *assemblyName = stackalloc byte[256];

            DotNetStringToCString(assemblyName, 256, ((tSystemString **)pParams)[0]);
            CLIFile.GetMetaDataForAssembly(assemblyName);

            *(/*HEAP_PTR*/ byte **)pReturnValue = null;
            return(null);
        }