public bool __TryGetImplMap(int token, out ImplMapFlags mappingFlags, out string importName, out string importScope) { foreach (int i in ImplMap.Filter(token)) { mappingFlags = (ImplMapFlags)(ushort)ImplMap.records[i].MappingFlags; importName = GetString(ImplMap.records[i].ImportName); importScope = GetString(ModuleRef.records[(ImplMap.records[i].ImportScope & 0xFFFFFF) - 1]); return(true); } mappingFlags = 0; importName = null; importScope = null; return(false); }
public bool __TryGetImplMap(out ImplMapFlags mappingFlags, out string importName, out string importScope) { Module module = this.Module; foreach (int i in module.ImplMap.Filter(GetCurrentToken())) { mappingFlags = (ImplMapFlags)(ushort)module.ImplMap.records[i].MappingFlags; importName = module.GetString(module.ImplMap.records[i].ImportName); importScope = module.GetString(module.ModuleRef.records[(module.ImplMap.records[i].ImportScope & 0xFFFFFF) - 1]); return(true); } mappingFlags = 0; importName = null; importScope = null; return(false); }
internal static CustomAttributeData CreateDllImportPseudoCustomAttribute(Module module, ImplMapFlags flags, string entryPoint, string dllName, MethodImplAttributes attr) { Type type = module.universe.System_Runtime_InteropServices_DllImportAttribute; ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(module.universe.System_String); List <CustomAttributeNamedArgument> list = new List <CustomAttributeNamedArgument>(); System.Runtime.InteropServices.CharSet charSet; switch (flags & ImplMapFlags.CharSetMask) { case ImplMapFlags.CharSetAnsi: charSet = System.Runtime.InteropServices.CharSet.Ansi; break; case ImplMapFlags.CharSetUnicode: charSet = System.Runtime.InteropServices.CharSet.Unicode; break; case ImplMapFlags.CharSetAuto: charSet = System.Runtime.InteropServices.CharSet.Auto; break; case ImplMapFlags.CharSetNotSpec: default: charSet = System.Runtime.InteropServices.CharSet.None; break; } System.Runtime.InteropServices.CallingConvention callingConvention; switch (flags & ImplMapFlags.CallConvMask) { case ImplMapFlags.CallConvCdecl: callingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl; break; case ImplMapFlags.CallConvFastcall: callingConvention = System.Runtime.InteropServices.CallingConvention.FastCall; break; case ImplMapFlags.CallConvStdcall: callingConvention = System.Runtime.InteropServices.CallingConvention.StdCall; break; case ImplMapFlags.CallConvThiscall: callingConvention = System.Runtime.InteropServices.CallingConvention.ThisCall; break; case ImplMapFlags.CallConvWinapi: callingConvention = System.Runtime.InteropServices.CallingConvention.Winapi; break; default: callingConvention = 0; break; } AddNamedArgument(list, type, "EntryPoint", entryPoint); AddNamedArgument(list, type, "CharSet", module.universe.System_Runtime_InteropServices_CharSet, (int)charSet); AddNamedArgument(list, type, "ExactSpelling", (int)flags, (int)ImplMapFlags.NoMangle); AddNamedArgument(list, type, "SetLastError", (int)flags, (int)ImplMapFlags.SupportsLastError); AddNamedArgument(list, type, "PreserveSig", (int)attr, (int)MethodImplAttributes.PreserveSig); AddNamedArgument(list, type, "CallingConvention", module.universe.System_Runtime_InteropServices_CallingConvention, (int)callingConvention); AddNamedArgument(list, type, "BestFitMapping", (int)flags, (int)ImplMapFlags.BestFitOn); AddNamedArgument(list, type, "ThrowOnUnmappableChar", (int)flags, (int)ImplMapFlags.CharMapErrorOn); return(new CustomAttributeData(module, constructor, new object[] { dllName }, list)); }
public bool __TryGetImplMap(out ImplMapFlags mappingFlags, out string importName, out string importScope) { return(Module.__TryGetImplMap(GetCurrentToken(), out mappingFlags, out importName, out importScope)); }
public bool __TryGetImplMap(out ImplMapFlags mappingFlags, out string importName, out string importScope) { Module module = this.Module; foreach (int i in module.ImplMap.Filter(GetCurrentToken())) { mappingFlags = (ImplMapFlags)(ushort)module.ImplMap.records[i].MappingFlags; importName = module.GetString(module.ImplMap.records[i].ImportName); importScope = module.GetString(module.ModuleRef.records[(module.ImplMap.records[i].ImportScope & 0xFFFFFF) - 1]); return true; } mappingFlags = 0; importName = null; importScope = null; return false; }
internal static CustomAttributeData CreateDllImportPseudoCustomAttribute(Module module, ImplMapFlags flags, string entryPoint, string dllName, MethodImplAttributes attr) { Type type = module.universe.System_Runtime_InteropServices_DllImportAttribute; ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(module.universe.System_String); List<CustomAttributeNamedArgument> list = new List<CustomAttributeNamedArgument>(); System.Runtime.InteropServices.CharSet charSet; switch (flags & ImplMapFlags.CharSetMask) { case ImplMapFlags.CharSetAnsi: charSet = System.Runtime.InteropServices.CharSet.Ansi; break; case ImplMapFlags.CharSetUnicode: charSet = System.Runtime.InteropServices.CharSet.Unicode; break; case ImplMapFlags.CharSetAuto: charSet = System.Runtime.InteropServices.CharSet.Auto; break; case ImplMapFlags.CharSetNotSpec: default: charSet = System.Runtime.InteropServices.CharSet.None; break; } System.Runtime.InteropServices.CallingConvention callingConvention; switch (flags & ImplMapFlags.CallConvMask) { case ImplMapFlags.CallConvCdecl: callingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl; break; case ImplMapFlags.CallConvFastcall: callingConvention = System.Runtime.InteropServices.CallingConvention.FastCall; break; case ImplMapFlags.CallConvStdcall: callingConvention = System.Runtime.InteropServices.CallingConvention.StdCall; break; case ImplMapFlags.CallConvThiscall: callingConvention = System.Runtime.InteropServices.CallingConvention.ThisCall; break; case ImplMapFlags.CallConvWinapi: callingConvention = System.Runtime.InteropServices.CallingConvention.Winapi; break; default: callingConvention = 0; break; } AddNamedArgument(list, type, "EntryPoint", entryPoint); AddNamedArgument(list, type, "CharSet", module.universe.System_Runtime_InteropServices_CharSet, (int)charSet); AddNamedArgument(list, type, "ExactSpelling", (int)flags, (int)ImplMapFlags.NoMangle); AddNamedArgument(list, type, "SetLastError", (int)flags, (int)ImplMapFlags.SupportsLastError); AddNamedArgument(list, type, "PreserveSig", (int)attr, (int)MethodImplAttributes.PreserveSig); AddNamedArgument(list, type, "CallingConvention", module.universe.System_Runtime_InteropServices_CallingConvention, (int)callingConvention); AddNamedArgument(list, type, "BestFitMapping", (int)flags, (int)ImplMapFlags.BestFitOn); AddNamedArgument(list, type, "ThrowOnUnmappableChar", (int)flags, (int)ImplMapFlags.CharMapErrorOn); return new CustomAttributeData(module, constructor, new object[] { dllName }, list); }
public bool __TryGetImplMap(int token, out ImplMapFlags mappingFlags, out string importName, out string importScope) { foreach (int i in ImplMap.Filter(token)) { mappingFlags = (ImplMapFlags)(ushort)ImplMap.records[i].MappingFlags; importName = GetString(ImplMap.records[i].ImportName); importScope = GetString(ModuleRef.records[(ImplMap.records[i].ImportScope & 0xFFFFFF) - 1]); return true; } mappingFlags = 0; importName = null; importScope = null; return false; }
public bool __TryGetImplMap(out ImplMapFlags mappingFlags, out string importName, out string importScope) { return Module.__TryGetImplMap(GetCurrentToken(), out mappingFlags, out importName, out importScope); }