internal Submission( CommonSubmission previous, NamedTypeSymbol scriptClass, Imports imports, Delegate factory) : base(previous, factory) { Debug.Assert(imports != null); this.scriptClass = scriptClass; this.imports = imports; }
public Imports.UserImportApplyResult UserImportApplyResult( string machineName, string securityToken, Imports.UserImportApply importApply, VehicleInfo vehicleInfo) { Imports.UserImportApplyResult result = null; string messageResult = this.GetInvalidLoginTokenResult(machineName, securityToken); if (!string.IsNullOrEmpty(messageResult)) return new Imports.UserImportApplyResult() { HResult = -10, ErrorMsg = messageResult }; throw new NotImplementedException(); if (result != null && result.HResult == 0) { //如果成功申报,则需要清理时间戳,必须重新刷卡登录 SecurityTokenManager.Instance.RemoveToken(securityToken); } }
public static bool ImportFromCVS(string csvFileName, string marketCode,CultureInfo dataCulture, databases.baseDS.priceDataDataTable priceDataTbl, Imports.OnUpdatePriceData onUpdateDataFunc) { return Imports.Libs.CSV_ImportParse(csvFileName, ',', common.dateTimeLibs.DateTimeFormats.YYMMDDhhmmss, marketCode, dataCulture, priceDataTbl, Libs.DoImportRow, onUpdateDataFunc, null); }
public static IntPtr FPDF_BookmarkGetDest(IntPtr document, IntPtr bookmark) { lock (LockString) return(Imports.FPDFBookmark_GetDest(document, bookmark)); }
public TemplateGenerator() { Refs.Add(typeof(TextTransformation).Assembly.Location); Refs.Add(typeof(Uri).Assembly.Location); Imports.Add("System"); }
private void buttonOpen_Click(object sender, EventArgs e) { StringBuilder UnitInfo = new StringBuilder(80); short handle; string[] description = { "Driver Version ", "USB Version ", "Hardware Version ", "Variant Info ", "Serial ", "Cal Date ", "Kernel Ver ", "Digital Hardware ", "Analogue Hardware " }; Imports.DeviceResolution resolution = Imports.DeviceResolution.PS5000A_DR_16BIT; //Imports.DeviceResolution resolution = Imports.DeviceResolution.PS5000A_DR_8BIT; if (_handle > 0) { Imports.CloseUnit(_handle); textBoxUnitInfo.Text = ""; _handle = 0; buttonOpen.Text = "Open"; } else { uint status = Imports.OpenUnit(out handle, null, resolution); if (handle > 0) { _handle = handle; if (status == StatusCodes.PICO_POWER_SUPPLY_NOT_CONNECTED || status == StatusCodes.PICO_USB3_0_DEVICE_NON_USB3_0_PORT) { status = Imports.ChangePowerSource(_handle, status); } else if (status != StatusCodes.PICO_OK) { MessageBox.Show("Cannot open device error code: " + status.ToString(), "Error Opening Device", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } else { // Do nothing - power supply connected } textBoxUnitInfo.Text = "Handle " + _handle.ToString() + "\r\n"; for (int i = 0; i < 9; i++) { short requiredSize; Imports.GetUnitInfo(_handle, UnitInfo, 80, out requiredSize, (uint)i); textBoxUnitInfo.AppendText(description[i] + UnitInfo + "\r\n"); } buttonOpen.Text = "Close"; } } }
public static uint FPDF_BookmarkGetTitle(IntPtr bookmark, byte[] buffer, uint buflen) { lock (LockString) return(Imports.FPDFBookmark_GetTitle(bookmark, buffer, buflen)); }
public static RegistryKeyHandle AssocQueryKey(AssociationFlags flags, AssociationKey key, string association, string extraInfo) { Imports.AssocQueryKeyW(flags, key, association, extraInfo, out RegistryKeyHandle handle) .ThrowIfFailed(); return(handle); }
protected override bool ReleaseHandle() { Imports.FreeEnvironmentStringsW(handle); handle = IntPtr.Zero; return(true); }
/// <summary> /// Gets the session ID of the physical console. If there is no session attached, /// returns uint.MaxValue. /// </summary> public static uint GetActiveConsoleSessionId() { return(Imports.WTSGetActiveConsoleSessionId()); }
protected override bool ReleaseHandle() { return(Imports.RegCloseKey(handle) != WindowsError.ERROR_SUCCESS); }
public MSBuildImport GetImport(string name, string condition = null) { return(Imports.FirstOrDefault(i => string.Equals(i.Project, name, StringComparison.OrdinalIgnoreCase) && (condition == null || i.Condition == condition))); }
protected override bool ReleaseHandle() { return(Imports.FindVolumeMountPointClose(handle)); }
public ServiceCollectionMixinsImport(Func <string, TypeDefinition> findType, ModuleDefinition moduleDefinition, Imports imports) { var type = findType("Microsoft.Extensions.DependencyInjection.AutoDIServiceCollectionMixins"); var addAutoDIService = type.GetMethods().Single(m => m.Name == "AddAutoDIService" && m.Parameters.Count == 5); addAutoDIService.Parameters[0].ParameterType = imports.DependencyInjection.IServiceCollection; addAutoDIService.ReturnType = imports.DependencyInjection.IServiceCollection; AddAutoDIService = moduleDefinition.ImportReference(addAutoDIService); }
/// <summary> /// Adds imports, only if it won't cause any issues to the template generator /// </summary> /// <param name="imports">imports to add</param> private void SafeAddRangeImport(IEnumerable <string> imports) { Imports.AddRange(imports.Where(i => !string.IsNullOrWhiteSpace(i))); }
private void btnDrop_Click(object sender, EventArgs e) { // call CloseUnit method in second base class Imports.CloseUnit(StaticVariable._handle); this.Close(); }
/// <summary> /// Allocates memory inside the opened process. /// </summary> /// <param name="size">Number of bytes to allocate.</param> /// <param name="allocationType">Type of memory allocation. See <see cref="MemoryAllocationType" />.</param> /// <param name="protect">Type of memory protection. See <see cref="MemoryProtectionType" /></param> /// <returns>Returns NULL on failure, or the base address of the allocated memory on success.</returns> internal IntPtr AllocateMemory(int size, MemoryAllocationType allocationType = MemoryAllocationType.MEM_COMMIT, MemoryProtectionType protect = MemoryProtectionType.PAGE_EXECUTE_READWRITE) { return(Imports.VirtualAllocEx(ProcessHandle, 0, size, allocationType, protect)); }
/// <summary> /// Creates a new <see cref="ScriptOptions"/> with the <see cref="Imports"/> changed. /// </summary> /// <exception cref="ArgumentNullException"><paramref name="imports"/> is null or contains a null reference.</exception> private ScriptOptions WithImports(ImmutableArray <string> imports) => Imports.Equals(imports) ? this : new ScriptOptions(this) { Imports = CheckImmutableArray(imports, nameof(imports)) };
public static IPropertyDescriptionList GetPropertyDescriptionListFromString(string value) { Imports.PSGetPropertyDescriptionListFromString(value, new Guid(InterfaceIds.IID_IPropertyDescriptionList), out IPropertyDescriptionList list) .ThrowIfFailed(); return(list); }
protected override bool ReleaseHandle() { Imports.LocalFree(handle); return(true); }
/// <summary> /// Get the name for a given Shell item ID. /// </summary> public static string GetNameFromId(ItemIdList id, ShellItemDisplayNames form = ShellItemDisplayNames.NormalDisplay) { Imports.SHGetNameFromIDList(id, form, out string name).ThrowIfFailed(); return(name); }
private void Drawing(DrawingContext ctx) { if ((Variables.settings.OnlyForeground && Imports.GetForegroundWindow() != Core.Memory.Process.MainWindowHandle) || QuestLogManager.InCutscene) { return; } GameObjectManager.Update(); NVector3 mypos = Core.Me.Location; Vector3 vecStart = new Vector3(mypos.X, mypos.Y, mypos.Z); int myLevel = Core.Me.ClassLevel; String mainName = locman.GetLocationString(WorldManager.ZoneId); if (Variables.settings.EnableStats) // Statistics. { StringBuilder sb = new StringBuilder(); StringBuilder alert = new StringBuilder(); GameObject currentTarget = Core.Me.CurrentTarget; if (!Variables.settings.AlertObject.Equals("")) { foreach (GameObject obj in GameObjectManager.GameObjects) { if (obj.Name.ToLower().Equals(Variables.settings.AlertObject.ToLower()) || (Variables.settings.AlertObject.Equals("*") && obj.Name.Length > 1)) { String details = ""; if (Core.Me.IsFacing(obj)) { details += "Facing!"; } alert.AppendLine(obj.Name + ": " + Math.Floor(obj.Location.X) + " EW, " + Math.Floor(obj.Location.Y) + " ALTI, " + Math.Floor(obj.Location.Z) + " NS\n\tDistance: " + Math.Floor(Core.Me.Distance(obj.Location)) + " yalms " + details); } } } sb.AppendLine(mainName); sb.AppendLine(Math.Floor(Core.Me.Location.X) + " EW," + Math.Floor(Core.Me.Location.Y) + " ALTI," + Math.Floor(Core.Me.Location.Z) + " NS"); if (currentTarget != null) { sb.AppendLine("Current Target: " + currentTarget.Name + ", Distance: " + Math.Round(currentTarget.Distance(), 3)); sb.AppendLine("Can Attack: " + currentTarget.CanAttack.ToString()); NVector3 end = currentTarget.Location; Vector3 vecEnd = new Vector3(end.X, end.Y, end.Z); ctx.DrawLine(vecStart, vecEnd, Color.DeepSkyBlue); } else { sb.AppendLine(""); } sb.AppendLine(); if (true) { ctx.DrawOutlinedText(sb.ToString(), Variables.settings.OverlayXPos, Variables.settings.OverlayYPos, Color.FromArgb(0, 255, 0), Color.FromArgb(0, 0, 0)); ctx.DrawOutlinedText(alert.ToString(), Variables.settings.AlertXPos, Variables.settings.AlertYPos, Color.FromArgb(255, 0, 0), Color.FromArgb(0, 0, 0)); } } if (Variables.settings.EnableOverlay && false) // Target self. { ctx.DrawOutlinedBox(Core.Me.Location.Convert() + new Vector3(0, 1, 0), new Vector3(0.1f), Color.FromArgb(255, Color.Blue)); } if (Variables.settings.EnableOverlay) { foreach (GameObject obj in GameObjectManager.GameObjects) { //if (!obj.IsVisible) // continue; //if (Variables.settings.EnableOverlay) // Only targetable? //{ // if (obj.Type != GameObjectType.EventObject) // { // if (!obj.IsTargetable) // continue; // } //} if (obj.Type == GameObjectType.Mount) { continue; } var name = obj.Name; var vecCenter = obj.Location.Convert() + new Vector3(0, 1, 0); //.Where(i => i.Type == GameObjectType.GatheringPoint || i.Type == GameObjectType.BattleNpc || i.Type == GameObjectType.EventObject || i.Type == GameObjectType.Treasure || i.Type == GameObjectType.Pc) var color = Color.FromArgb(150, Color.Blue); //some generic objects. If you want to add a specific object it should probably go here or in it's own block below this. if ((obj.Type == GameObjectType.GatheringPoint || obj.Type == GameObjectType.EventObject || obj.Type == GameObjectType.Treasure) && false) // Etc Objects. { if (obj.Type == GameObjectType.GatheringPoint) { color = Color.FromArgb(150, Color.BlueViolet); } if (obj.Type == GameObjectType.EventObject) { color = Color.FromArgb(150, Color.Fuchsia); } if (obj.Type == GameObjectType.Treasure) { color = Color.SandyBrown; } if (Variables.settings.EnableOverlay && !string.IsNullOrEmpty(name)) { ctx.Draw3DText(name, vecCenter); } if (Variables.settings.EnableOverlay) { ctx.DrawOutlinedBox(vecCenter, new Vector3(0.1f), Color.FromArgb(150, color)); } //if (Variables.settings.DrawGameObjectLines) //{ // if (!Variables.settings.DrawGameObjectLinesLos || obj.InLineOfSight()) // ctx.DrawLine(vecStart, vecCenter, Color.FromArgb(150, color)); //} } var u = obj as Character; if (u != null && false) // Draw all players? Draw NPC's. { var playerOrPlayerOwned = (!u.IsNpc || u.SummonerObjectId != GameObjectManager.EmptyGameObject); /*if (!Variables.settings.DrawPlayers && playerOrPlayerOwned) * { * continue; * }*/ var hostilityColor = Color.FromArgb(150, Color.Green); var uStatusFlags = u.StatusFlags; if (uStatusFlags.HasFlag(StatusFlags.Hostile)) { hostilityColor = Color.FromArgb(150, Color.Red); //if (Variables.settings.DrawAggroRangeCircles) // ctx.DrawCircle(vecCenter, u.MyAggroRange, 64, // Color.FromArgb(75, Color.DeepSkyBlue)); } if (uStatusFlags == StatusFlags.None) { hostilityColor = Color.FromArgb(150, Color.Yellow); } if (uStatusFlags.HasFlag(StatusFlags.Friend) || uStatusFlags.HasFlag(StatusFlags.PartyMember) || uStatusFlags.HasFlag(StatusFlags.AllianceMember)) { hostilityColor = Color.FromArgb(150, Color.Green); } if (playerOrPlayerOwned) { /*if (Variables.settings.DrawPlayerNames) * { * ctx.Draw3DText(name, vecCenter); * }*/ } else { /*if (Variables.settings.DrawUnitNames) * { * if (!string.IsNullOrEmpty(name) && obj.IsTargetable) * ctx.Draw3DText(name, vecCenter); * }*/ } ctx.DrawOutlinedBox(vecCenter, new Vector3(0.1f), Color.FromArgb(255, hostilityColor)); } else if (u != null && Variables.settings.ShowTargetablePlayers) { var playerOrPlayerOwned = (!u.IsNpc || u.SummonerObjectId != GameObjectManager.EmptyGameObject); Boolean attackable = u.CanAttack; if (playerOrPlayerOwned && attackable) { ctx.DrawOutlinedBox(vecCenter, new Vector3(0.1f), Color.FromArgb(255, Color.Red)); } } } } }
protected override bool ReleaseHandle() { return(Imports.HeapFree(Memory.ProcessHeap, dwFlags: 0, lpMem: handle)); }
static SafeMemory() { Handle = Imports.GetCurrentProcess(); MainModule = Process.GetCurrentProcess().MainModule?.BaseAddress ?? IntPtr.Zero; }
private void buttonStart_Click(object sender, EventArgs e) { uint status; status = Imports.SetChannel(_handle, Imports.Channel.ChannelA, 1, Imports.Coupling.PS5000A_DC, Imports.Range.Range_2V, 0); status = Imports.SetChannel(_handle, Imports.Channel.ChannelB, 0, Imports.Coupling.PS5000A_DC, Imports.Range.Range_2V, 0); status = Imports.SetChannel(_handle, Imports.Channel.ChannelC, 0, Imports.Coupling.PS5000A_DC, Imports.Range.Range_2V, 0); status = Imports.SetChannel(_handle, Imports.Channel.ChannelD, 0, Imports.Coupling.PS5000A_DC, Imports.Range.Range_2V, 0); short enable = 0; uint delay = 0; short threshold = 25000; short auto = 0; status = Imports.SetSimpleTrigger(_handle, enable, Imports.Channel.ChannelA, threshold, Imports.ThresholdDirection.Rising, delay, auto); _ready = false; _callbackDelegate = BlockCallback; _channelCount = 4; string data; int x; textMessage.Clear(); textData.Clear(); bool retry; uint sampleCount = 1000; PinnedArray <short>[] minPinned = new PinnedArray <short> [_channelCount]; PinnedArray <short>[] maxPinned = new PinnedArray <short> [_channelCount]; int timeIndisposed; short[] minBuffers = new short[sampleCount]; short[] maxBuffers = new short[sampleCount]; minPinned[0] = new PinnedArray <short>(minBuffers); maxPinned[0] = new PinnedArray <short>(maxBuffers); status = Imports.SetDataBuffers(_handle, Imports.Channel.ChannelA, maxBuffers, minBuffers, (int)sampleCount, 0, Imports.RatioMode.None); textMessage.AppendText("BlockData\n"); /*Find the maximum number of samples and the time interval(in nanoseconds). * If the function returns PICO_OK, the timebase will be used. */ int timeInterval; int maxSamples; while (Imports.GetTimebase(_handle, _timebase, (int)sampleCount, out timeInterval, out maxSamples, 0) != 0) { textMessage.AppendText("Timebase selection\n"); _timebase++; } textMessage.AppendText("Timebase Set\n"); /* Start it collecting, then wait for completion*/ _ready = false; _callbackDelegate = BlockCallback; do { retry = false; status = Imports.RunBlock(_handle, 0, (int)sampleCount, _timebase, out timeIndisposed, 0, _callbackDelegate, IntPtr.Zero); if (status == (short)StatusCodes.PICO_POWER_SUPPLY_CONNECTED || status == (short)StatusCodes.PICO_POWER_SUPPLY_NOT_CONNECTED || status == (short)StatusCodes.PICO_POWER_SUPPLY_UNDERVOLTAGE) { status = Imports.ChangePowerSource(_handle, status); retry = true; } else { textMessage.AppendText("Run Block Called\n"); } }while (retry); textMessage.AppendText("Waiting for Data\n"); while (!_ready) { Thread.Sleep(100); } Imports.Stop(_handle); if (_ready) { short overflow; status = Imports.GetValues(_handle, 0, ref sampleCount, 1, Imports.RatioMode.None, 0, out overflow); if (status == (short)StatusCodes.PICO_OK) { textMessage.AppendText("Have Data\n"); for (x = 0; x < sampleCount; x++) { data = maxBuffers[x].ToString(); textData.AppendText(data); textData.AppendText("\n"); } } else { textMessage.AppendText("No Data\n"); } } else { textMessage.AppendText("data collection aborted\n"); } Imports.Stop(_handle); foreach (PinnedArray <short> p in minPinned) { if (p != null) { p.Dispose(); } } foreach (PinnedArray <short> p in maxPinned) { if (p != null) { p.Dispose(); } } }
/// <summary> /// Read a byte array from the current process. /// </summary> /// <param name="address">The address to read from.</param> /// <param name="count">The amount of bytes to read.</param> /// <param name="buffer">The result buffer.</param> /// <returns>Whether or not the read succeeded.</returns> public static bool ReadBytes(IntPtr address, int count, out byte[] buffer) { buffer = new byte[count <= 0 ? 0 : count]; return(Imports.ReadProcessMemory(Handle, address, buffer, buffer.Length, out _)); }
public static IntPtr FPDF_BookmarkGetAction(IntPtr bookmark) { lock (LockString) return(Imports.FPDFBookmark_GetAction(bookmark)); }
/// <summary> /// Write a byte array to the current process. /// </summary> /// <param name="address">The address to write to.</param> /// <param name="buffer">The buffer to write.</param> /// <returns>Whether or not the write succeeded.</returns> public static bool WriteBytes(IntPtr address, byte[] buffer) { return(Imports.WriteProcessMemory(Handle, address, buffer, buffer.Length, out _)); }
public static uint FPDF_ActionGetType(IntPtr action) { lock (LockString) return(Imports.FPDFAction_GetType(action)); }
/**************************************************************************** * * Select _timebase, set _oversample to on and time units as nano seconds * ****************************************************************************/ void SetTimebase() { int timeInterval; int maxSamples; short timeunit; bool valid = false; short status = 0; short maxTimebaseIndex = 0; // Use this to place an upper bound on the timebase index selected Console.WriteLine("Available timebases indices and sampling intervals (nanoseconds):\n"); for (short i = 0; i < Imports.PS2200_MAX_TIMEBASE; i++) { status = Imports.GetTimebase(_handle, i, BUFFER_SIZE, out timeInterval, out timeunit, _oversample, out maxSamples); if (status == 1) { Console.WriteLine("{0,2}: {1} ns", i, timeInterval); maxTimebaseIndex = i; } } do { Console.WriteLine("\nSpecify timebase index:"); try { _timebase = short.Parse(Console.ReadLine()); if (_timebase < 0 || _timebase > maxTimebaseIndex) { valid = false; } else { valid = true; } } catch (FormatException) { valid = false; Console.WriteLine("\nEnter numeric values only"); } } while (!valid); status = 0; do { status = Imports.GetTimebase(_handle, _timebase, BUFFER_SIZE, out timeInterval, out timeunit, _oversample, out maxSamples); if (status == 0) { Console.WriteLine("Selected timebase {0} could not be used", _timebase); _timebase++; } }while (status == 0); Console.WriteLine("Timebase {0} - {1} ns", _timebase, timeInterval); _oversample = 1; }
public static Imports.importOHLCV DoImportRow(LumenWorks.Framework.IO.Csv.CsvReader csv, Imports.importStat importStat) { Imports.importOHLCV data = new Imports.importOHLCV(); if (csv[0] == null) return null; data.code = csv[0]; if (!common.dateTimeLibs.Str2Date(csv[1] + csv[2], importStat.dateDataFormat, out tmpDate)) return null; data.dateTime = tmpDate; if (!double.TryParse(csv[3], NumberStyles.Number, importStat.srcCulture, out tmpVal)) return null; if (tmpVal <= 0) return null; data.Open = tmpVal; if (!double.TryParse(csv[4], NumberStyles.Number, importStat.srcCulture, out tmpVal)) return null; if (tmpVal <= 0) return null; data.High = tmpVal; if (!double.TryParse(csv[5], NumberStyles.Number, importStat.srcCulture, out tmpVal)) return null; if (tmpVal <= 0) return null; data.Low = tmpVal; if (!double.TryParse(csv[6], NumberStyles.Number, importStat.srcCulture, out tmpVal)) return null; if (tmpVal <= 0) return null; data.Close = tmpVal; if (!double.TryParse(csv[7], NumberStyles.Number, importStat.srcCulture, out tmpVal)) return null; data.Volume = tmpVal; return data; }
private void FileOpen(string file) { // Set status bar location for the file. tbStatusBarLocation.Text = file; // Parse the PE file if (!PeFile.IsPEFile(file)) { MessageBox.Show("Not a PE file."); return; } var peFile = new PeFile(file); _peFile = peFile; // Set all FileInfo fields. FileInfo.SetFileInfo(peFile); // Set the DOS header fields DosNtHeader.SetDosHeader(peFile); // Set the PE File fields DosNtHeader.SetNtHeader(peFile); // Set the File header FileHeaderDebug.SetFileHeader(peFile); // Set the Debug directory. FileHeaderDebug.SetDebug(peFile); // Set the Optional header OptionalHeader.SetOptionalHeader(peFile); // Set the imports. Imports.SetImports(peFile); // Set the exports. Exports.SetExports(peFile); // Set the resources. Resource.SetResources(peFile); // Set the sections. SectionHeaders.SetSections(peFile); // Set the Exception (only for x64) Exceptions.SetException(peFile); // Set the Relocations. Relocation.SetRelocations(peFile); // Set the Digital Signature information. Signature.SetDigSignature(peFile); // Set the Bound Import directory. DebugBoundImport.SetBoundImport(peFile); // Set the Delay Import descriptor. DebugBoundImport.SetDelayImport(peFile); // Set the TLS directory. TlsDirectory.SetTlsDirectory(peFile); // Set the Load Config Directory LoadConfig.SetLoadConfig(peFile); }
/// <summary> /// Write an array of integral types (int, float, byte, etc) to unmanaged memory. /// </summary> /// <typeparam name="T">Integral type to write. Must be struct, but not all structs are supported (only those supported by Marshal.Copy</typeparam> /// <param name="addr">Address to write array to</param> /// <param name="data">Array data to write</param> public static void WriteArray <T>(this IntPtr addr, T[] data) where T : struct { var size = data.Length * Marshal.SizeOf(typeof(T)); IntPtr temp = Marshal.AllocHGlobal(size); try { switch (Type.GetTypeCode(typeof(T))) { case TypeCode.Byte: var bytes = data.Cast <byte>().ToArray(); Marshal.Copy(bytes, 0, temp, data.Length); break; case TypeCode.Char: var chars = data.Cast <char>().ToArray(); Marshal.Copy(chars, 0, temp, data.Length); break; case TypeCode.Int16: var shorts = data.Cast <short>().ToArray(); Marshal.Copy(shorts, 0, temp, data.Length); break; case TypeCode.Int32: var ints = data.Cast <int>().ToArray(); Marshal.Copy(ints, 0, temp, data.Length); break; case TypeCode.Int64: var longs = data.Cast <long>().ToArray(); Marshal.Copy(longs, 0, temp, data.Length); break; case TypeCode.Single: var floats = data.Cast <float>().ToArray(); Marshal.Copy(floats, 0, temp, data.Length); break; case TypeCode.Double: var doubles = data.Cast <double>().ToArray(); Marshal.Copy(doubles, 0, temp, data.Length); break; default: throw new ArgumentException(string.Format("Unsupported type argument supplied: {0}", typeof(T).Name)); } int numWritten; if (!Imports.WriteProcessMemory(Process.GetCurrentProcess().GetHandle(), addr, temp, (uint)size, out numWritten) || numWritten != size) { throw new Win32Exception(Marshal.GetLastWin32Error()); } } finally { if (temp != IntPtr.Zero) { Marshal.FreeHGlobal(temp); } } }
/// <summary> /// Free the given library. /// </summary> public static void FreeLibrary(IntPtr handle) => Error.ThrowLastErrorIfFalse(Imports.FreeLibrary(handle));