Releases: 3F/Conari
1.5
Conari 1.5
📦 Download | What's new in 1.5:
🔨 No more manual type conversions and memory management complexities. Because nothing easier than just use it,
using dynamic l = new ConariX("regXwild.dll");
string data = "number = 888;";
bool found = l.replace<bool>(ref data, "+??;", "2034;");
// found: true; data: number = 2034;
using var u = NativeStruct.Make.f<UIntPtr>("start", "end").Struct;
/* Hey! We just generated a structure like
[StructLayout(LayoutKind.Sequential)]
private struct MatchResult
{
public UIntPtr start;
public UIntPtr end;
}*/
l.Memory.@goto(e_lfanew).eq('P', 'E', '\0', '\0').check()
using NativeArray<short> nr = new(pointer); // points to ~0x2674F89EDF0
nr[0] = 1; nr[1] = 2;
📑 And ...
-
NEW: New modern NativeString<T> replaces UnmanagedString.
- A complete support of CharPtr, WCharPtr, TCharPtr;
- Support optional buffers for receiving and updating values;
- Safe and fast reuse of the allocated memory regions;
- Non sealed, extendable for a new features;
using NativeString<WCharPtr> data = new("Hello {p}!");
-
NEW: New TCharPtr marshalable type which aggregates WCharPtr + CharPtr at runtime.
-
NEW: New modern NativeStruct<T> replaces UnmanagedStructure.
Two modes!
- NativeStruct - Fully automatic way of working with structures without declarations using NativeData chains;
- NativeStruct<T> - Semi-automatic way of working with structures using CLR types declarations;
using var u = NativeStruct.Make.f<UIntPtr>("start", "end").Struct;
using var u = new NativeStruct<MatchResult>();
using NativeStruct u = new();
u.Native
.f<UIntPtr>("start", "end")
.build(out dynamic mres);
- NEW: Direct use "" dotnet strings including ref strings (ByRef&) in DLR.
string data = "number = 888;";
bool found = l.replace<bool>(ref data, "+??;", "2034;");
-
NEW: New VPtr type - Variable long pointer.
This type supports adding long numbers to IntPtr (IntPtr + long),
a complete comparing >,<,>=,<=,==,!= between VPtr and int/long, and more. -
NEW: Added support for optional arguments in DLR via IProviderDLR.TrailingArgs.
Can be applied only if varargs. Useful in avoiding any optional values. Eg. (1, 2, 3, [0, 0]).
bool func(const TCHAR* input, flagcfg_t options = 0, MatchResult* result = nullptr);
l.func<bool>(input); -> input, [+ 0, + nullptr]
- NEW: Added .build() and .build(out dynamic result) to build native chains in a Raw and NativeData objects.
Accessor.Native()
.t<DWORD>("VirtualAddress")
.t<DWORD>("Size")
.build(out dynamic idd);
-
NEW: PE32/PE32+ Memory and Streams implementations.
Configure it through IConfig.PeImplementation or use manually. -
NEW: IMarshalableGeneric for marshaling generic types.
Use or implement this to avoid possible:
- "Exception has been thrown by the target of an invocation"
- "System.Runtime.InteropServices.MarshalDirectiveException :
Cannot marshal 'parameter ...': Generic types cannot be marshaled." - (IntPtr)u -> u
etc.
using NativeString<CharPtr> data = new("Hello {p}!");
l.replace<bool>(data, ...)
- NEW: Easy concatenation for an unmanaged c-strings.
using var str = input + " " + "world";
-
NEW: New lightweight way of generating Dynamic MethodInfo.
As part of optimization,
- https://twitter.com/github3F/status/1396491762315808771
- https://twitter.com/github3F/status/1396492298972717057
This is the default way for DLR starting with 1.5.
Use IProviderDLR.SignaturesViaTypeBuilder to configure it. -
NEW: Native chains. Added support 8/16 bit characters via configurable .readChar() and writeChar().
-
NEW: Native chains. Added conditional .eq(), .or() that verifies input T is equal to T.
It can be checked via .check(), ifTrue(Action)/ifFalse(Action), and failed(bool when).
l.Memory
.@goto(l.PE.Addresses.IMAGE_NT_HEADERS)
.eq('P', 'E', '\0', '\0')
.check()
- NEW: Added NativeArray to work unmanaged arrays.
using NativeArray<short> nr = new(pointer); // points to ~0x2674F89EDF0
nr[0] = 1; nr[1] = 2;
using NativeArray nr = new(2, -4, 6);
Memory memory = nr;
-
NEW: New modern Memory VPtr based implementation in native chains (serializable)
to work with RAM related processes. -
NEW: New modern NativeStream VPtr based implementation in native chains (serializable)
to work with any supported stream related processes. -
NEW: New modern LocalContent VPtr based implementation in native chains (serializable)
to work with any local allocated data. -
NEW: Added generic IConari<TCharIn> for a specific char type by default in used instance.
-
NEW: Added Allocator for allocating any data in unmanaged memory.
Allocator
based onNativeArray<byte>
.
using Allocator alloc = new(0x70, 0xDE, 0x01, 0xAC,
0x04, 0xCB, 0x70, 0xDE,
0x93, 0x12, 0x74, 0x94);
alloc.Memory // access via native chains Memory implementation
-
NEW: The fast way to update an unmanaged strings without allocating new in memory
through modern NativeString<T> and BufferedString<T>. -
NEW: New BufferedString<T> a specialized native strings for future possible changing with additional buffer.
BufferedString<T>
is a type alias forNativeString<T>
with the default buffer
using factor 2.5f relative to the string; -
NEW: Native chains. New working with a different positions
Zone (Initial/Region/Current) and aliases (D/U/V) +rewind(Zone) Rewind the chain to a specific region. +@goto(VPtr) Go to a new address using absolute position. +back\<T\>(int count = 1); - Move back on T type size from the current position. + T1, T2, T3 aliases.
-
NEW: New
achar
andwchar
type markers for a native chains. -
NEW: Added extension methods:
+NativeSize() for objects - Get the size in bytes of the selected managed type to be treated as an unmanaged.
+IAccessor Access() - Accessing data via Memory or LocalContent implementation. -
NEW: New for NativeData:
-
+assign<T>(string[]) - Assigns new fields for each presented name.
+f<T>(string[]) - alias -
+renew(SeekPosition) - An additional way to start the chain with specific SeekPosition
+renew(out VPtr, SeekPosition) -
+region() - Mark new region in the chain.
+region(out int)
+region(out VPtr) -
+ofs<T>(int, string[]) - Use offset to the data.
-
+extend(byte[] bytes) - Extends local data using additional bytes.
-
+mode(ChainMode) - to control chain and its new fields via ChainMode.
-
-
NEW: PeImplType.Disabled to disable all related to PE features
such as mangling, list of exported proc, etc. -
NEW: Added IProviderDLR.TryEvaluateContext.
It can help better understand what are you trying to call without specified casting.
true value by default. -
NEW: Added IProviderDLR.ManageNativeStrings.
Collect information about all input INativeString and delegate control.
true value by default. -
NEW: Added IProviderDLR.BoxingControl.
Control of boxing for input data.
BoxingType.UnboxingAndBoxing value by default. -
NEW: IProvider.addr() address of the specific item such streams std::cin etc.
Part of Issue #17.
l.addr("get_GPtrVal")
-
NEW: ConariL/X Make() wrapper to use both runtime dynamic and compile type objects.
-
NEW: Added manager NativeStringManager for a new modern NativeString<T> strings.
Helps to manage c-strings easily. -
NEW: Added the following static Members:
- +Is64bit
- +EmptyArray<T> for netfx 4
- +SizeOf<T>()
- +SizeOf<T>(int)
-
NEW: Added IProviderDLR.RefModifiableStringBuffer.
Allows configure additional buffer to process ref strings (ByRef&). -
NEW: Adds IModuleIsolationRecipe for configurable isolation handlers.
-
NEW: New IConfig option. LoaderSyncLimit.
Limit in milliseconds for how long to wait signals when synchronization of threads (processes). -
NEW: INativeAccessor and IDlrAccessor unifies ConariL, ConariX objects, Native chains and various raw Memory accessing.
-
NEW: New IConfig option. CancelIfCantIsolate.
Cancel processing in loader if module can't be isolated. -
NEW: New IConfig option. Cts.
Signals to cancel active operations as soon as possible. -
NEW: New IConfig option. PeImplementation.
Use specific implementation around PE processing.
Affects loader, mangling, and other related core features. -
NEW: New for IPE interface:
- + Addresses - Known addresses of the tables.
- + Characteristics
- + Magic
- + Machine
- + Export reference to (addresses + names + ordinals)
-
NEW: IConari now extends IStringMaker to provide direct
_T()
accessing in implemented ConariX / ConariL objects.
l.match<bool>(l._T("test"))
- NEW: IConari now specifies INativeStringManager Strings { get; } property for a quick accessing
to used string manager in implemen...
1.4
Public release. Conari 1.4 * NEW: Starting support of the .NET Core. PR #12 Full support: netcoreapp2.1 and netstandard2.1 (SDK 3). * NEW: Hack of the unmanaged EmitCalli to support .NET Standard 2.0. Issue #13. * NEW: NativeData and BReader now supports CharPtr, WCharPtr, BSTR types. * NEW: Implemented isolation for PE Modules. Issue #15. Manage it through `IConfig.IsolateLoadingOfModule`. Optionaly it will isolate module for a real new loading even if it was already loaded somewhere else. Full details in https://github.com/3F/Conari/issues/15 * NEW: Added `ConariX` as an compatible DLR version of ConariL implementation: ``` using(dynamic l = new ConariX("...")) { // just everything is yours ~ l.curl_easy_setopt(curl, 10002, "https://example.com"); } ``` * NEW: Implemented kernel32 WinApi via new ConariX: ``` dynamic kernel32 = new Kernel32(); kernel32.GetModuleHandleA<IntPtr>("libcurl-x64"); kernel32.GetModuleHandleW<IntPtr>((WCharPtr)ustr); ``` * NEW: Implemented user32 WinApi via new ConariX: ``` dynamic user32 = new User32(); user32.ShowWindow(0x000A0A28, 3); user32.MessageBoxA(0, "Conari in action", "Hello!", 0); ``` * NEW: Added netfx based target platforms: net472. * NEW: Added initialization of UnmanagedString from IntPtr. * FIXED: Fixed bug with typeof(void) for return type when DLR. * FIXED: Fixed bug with x64 for CharPtr, WCharPtr, BSTR types. * CHANGED: Performance: Internal ModuleBuilder now is unified for all our new generated dynamic types. * CHANGED: Added hMSBuild 2.2 + GetNuTool 1.7 in nupkg packages for related build processes: https://www.nuget.org/packages/Conari/ * tools\gnt.bat - https://github.com/3F/GetNuTool * tools\hMSBuild.bat - https://github.com/3F/hMSBuild * NOTE: Official Releases: * NuGet: https://www.nuget.org/packages/Conari/ * GitHub: https://github.com/3F/Conari/releases/latest * NOTE: Please note again, .NET Standard 2.0 support is possible only because of our hack! While other netcoreapp2.1 + netstandard2.1 target platforms will not contain this modifications at all. Means most known behavior. Do not hesitate to contact: https://github.com/3F/Conari/issues
CI-build-64
🎲 Nightly build
of 3be8617 ➾ Worker image: $(APPVEYOR_BUILD_WORKER_IMAGE)
; Console: ci.appveyor.../build-64
❕ Only for tests. 🗨 Commit message:
+kernel32 +user32 via new ConariX [DLR version]:
~
dynamic user32 = new User32();
user32.ShowWindow(0x000A0A28, 3);
user32.MessageBoxA(0, "Conari in action", "Hello!", 0);
dynamic kernel32 = new Kernel32();
kernel32.GetModuleHandleA<IntPtr>("libcurl-x64");
kernel32.GetModuleHandleW<IntPtr>((WCharPtr)ustr);
+Added tests
CI-build-50
🎲 Nightly build
of 9b7e137 ➾ Worker image: Visual Studio 2017
; Console: ci.appveyor.com/.../build-50
❕ Please use this only for tests of latest changes! ❕ 🗨 Commit message:
Implemented initialization of UnmanagedString from IntPtr
$(APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED)
v1.3
public release of Conari engine - v1.3:
New version of Conari engine contains major improvements and fixes with DLR features, ByRef types, new support of Exported-Variables, Aliases, improved Native.Core, ... But it also contains minor incompatible changes with previous versions.
Look here: https://github.com/3F/Conari/wiki/Upgrade-v1.3
- NEW: Improved speed >80% (DLR) & >90% (Lambda) - Issue #10
*
results for regXwild x64 (Unicode) via snet tester - https://github.com/3F/regXwild - NEW: Improved DLR. Automatic detection for ByRef types & null-values for any reference-types that pushed with out/ref modifier.
- +UseCallingContext - To use information about types from CallingContext if it's possible.
- +UseByRef - To use ByRef& (reference-types) for all sent types.
- NEW: Added
NullType<T>
as optional way for work with reference-types. And for other purpose to store additional information about basic type for any null values. - NEW: Added IProvider.NewProcAddress event - When handling new non-zero ProcAddress.
- NEW: Started support of Exported-Variables via IExVar & DLR - Issue #7
l.ExVar.DLR.ADDR_SPEC; // 0x00001CE8
l.ExVar.get<UInt32>("ADDR_SPEC"); // 0x00001CE8
l.ExVar.getField(typeof(UInt32).NativeSize(), "ADDR_SPEC"); // Native.Core.Field via raw size
l.Svc.native("lpProcName"); // Raw access via NativeData & Native.Core !
- NEW: Implemented aliases for Exported-Functions and Variables - Issue #9
l.Aliases["Flag"] = l.Aliases["getFlag"] = l.Aliases["xFunc"]; //Flag() -> getFlag() -> xFunc()->...
l.DLR.getFlag<bool>();
l.Aliases["gmn"] = new ProcAlias(
"GetMagicNum",
new AliasCfg() { NoPrefixR = true } // false by default
);
- NEW: Native.Core improvements - Extensions & new
t
signatures for node (raw alignments via size and managed types)
+t(Type type, string name = null)
+t(Type[] types, params string[] names)
+t(int size, string name = null)
- NEW: Aliases for 'empty' types:
+Action bindFunc(string lpProcName);
+Action bind(string func);
- NEW: New group of binding via regular arguments:
+Method bindFunc(string lpProcName, Type ret, params Type[] args);
+Method<T, object> bindFunc<T>(string lpProcName, Type ret, params Type[] args);
+Method bind(string func, Type ret, params Type[] args);
+Method<T, object> bind<T>(string func, Type ret, params Type[] args);
- FIXED: Fixed possible crashes - 'A heap has been corrupted' when use of shared pointer between several UnmanagedStructure.
- CHANGED: ILoader: minor incompatible changes for PE32/PE32+ features.
* NewIPE PE
property for complex work with PE-file.
* TheExportFunctionNames
property has been removed as obsolete. Use samePE.ExportedProcNamesArray
- CHANGED: IProvider minor incompatible changes
funcName()
->procName()
string funcName(string name);
has been renamed tostring procName(string name);
- as a common method for getting full lpProcName with main prefix etc. - CHANGED:
TDyn IBinder.bind(MethodInfo mi, bool prefix = false);
removed as a deprecated, because for this can be a lot of misunderstandings.
If you need something, use like:prefix ? l.procName(mi.Name) : mi.Name
etc. for any available methods with MethodInfo. - CHANGED: Added User object (+
user
) for Native.Core.Field. To store any additional information that's related for specific field.
v1.2
v1.1
public release [v1.1] NEW: DLR features for core with caching of dynamic types. NEW: Added features for convenient work with Native C/C++ structures without declaration. /Issue #2 NEW: The Mangling features by C rules: to automatically find entry points of exported functions. /Issue #3 NEW: Added access to export functions from PE files. ILoader.ExportFunctionNames NEW: Added LSender as a simple retranslator for loggers. NEW: Added features for convenient work with any binary raw data. NEW: Added Core events: * BeforeUnload - Before unloading a library. * AfterUnload - When library has been unloaded. * AfterLoad - When library has been loaded. * PrefixChanged - When Prefix has been changed. * ConventionChanged - When Convention has been changed. FIXED: bug with CharPtr when unboxing for unmanaged code. FIXED: trivial fixes with implicit conversion for size_t and UIntPtr. CHANGED: Updated CharPtr: +BSTR, +WCharPtr & added new UnmanagedString, that allocates strings for unmanaged code. CHANGED: Other trivial fixes and improvements.