how to compare 2 version of dll's and find the modified methods - mono.cecil

Note: I don't have pdb files for those dll's.
I tried to compare the dll's using " Mono.Cecil" but was able to succeed in comparing the method signature only.
Is there a way to compare the method body and find the modified methods.

Would it be maybe helpful if you compare the different instructions of the methods?
E.g.:
List<Mono.Cecil.Cil.Instruction> listOfInstructionsOfMethod = method.Body.Instructions.ToList();
type of variable "method" is MethodDefinition

Related

How to get parameters of RFC module in node-rfc?

I want to introspect input parameters (and maybe output as well) of a RFC given it's name.
I found methods RfcGetParameterCount and RfcGetParameterDescByIndex which have been used by the node-rfc library itself. But I am not able to figure out how to call these methods using client.invoke() or any other way.
https://www.npmjs.com/package/node-rfc
RFC_GET_FUNCTION_INTERFACE returns the parameters of a given RFC.
You may try this new rfmcall package: https://www.npmjs.com/package/rfmcall

Get a list of all the arguments a constructor takes

Is it possible to get a list of all the arguments a constructor takes?
With the names and types of the parameters?
I want to automatically check the values of a JSON are good to use for building their equivalent as a class instance.
Preferably without macros... I have build a few, but I still find them quiet confusing.
Must work with neko and JS, if that maters.
Thanks.
I think you want to look at Runtime Type Information (rtti)
From the Haxe Manual: The Haxe compiler generates runtime type information (RTTI) for classes that are annotated or extend classes that are annotated with the #:rtti metadata. This information is stored as a XML string in a static field __rtti and can be processed through haxe.rtti.XmlParser. The resulting structure is described in RTTI structure.
Alternative; If you want to go with macros, this might be a good start
http://code.haxe.org/category/macros/add-parameters-as-fields.html

Groovy - extensions structure

I'd like to extend String's asType method to handle LocalDateTime. I know how to override this method, however I've no idea where should I put it in project structure to work globally - for all strings in my project. Is it enough to put such extension wherever in the classpath? I know that there's a special convention for extensions (META-INF/services), how does it work for method overriding?
All documentation regarding this topic can be found here. And here exactly the relevant part can be found.
Module extension and module descriptor
For Groovy to be able to load your extension methods, you must declare
your extension helper classes. You must create a file named
org.codehaus.groovy.runtime.ExtensionModule into the META-INF/services
directory:
org.codehaus.groovy.runtime.ExtensionModule moduleName=Test module for
specifications moduleVersion=1.0-test
extensionClasses=support.MaxRetriesExtension
staticExtensionClasses=support.StaticStringExtension The module
descriptor requires 4 keys:
moduleName : the name of your module
moduleVersion: the version of your module. Note that version number is
only used to check that you don’t load the same module in two
different versions.
extensionClasses: the list of extension helper classes for instance
methods. You can provide several classes, given that they are comma
separated.
staticExtensionClasses: the list of extension helper classes for
static methods. You can provide several classes, given that they are
comma separated.
Note that it is not required for a module to define both static
helpers and instance helpers, and that you may add several classes to
a single module. You can also extend different classes in a single
module without problem. It is even possible to use different classes
in a single extension class, but it is recommended to group extension
methods into classes by feature set.
Module extension and classpath
It’s worth noting that you can’t use an extension which is compiled at
the same time as code using it. That means that to use an extension,
it has to be available on classpath, as compiled classes, before the
code using it gets compiled. Usually, this means that you can’t have
the test classes in the same source unit as the extension class
itself. Since in general, test sources are separated from normal
sources and executed in another step of the build, this is not an
issue.

Linux library code injection & calls to identically named functions in SOs

I have built a linux shared object which I inject into a 3rd party program to intercept some dynamic function calls using LD_PRELOAD.
The 3rd party program uses a SO "libabc.so" located at some path. My injected SO uses another SO, also called "libabc.so" located at another path (essentially identical but slight code differences).
My problem is now, that calls to a function "def" which appear in both libabc.so are always resolved by the first. (Presumably because it is loaded first?!) How can I get them to be resolved with the second libabc.so?
Many thanks!
Unless something changed since I used to do this, you will need to dlopen() the library you want to pass calls on to and call the function manually, something like;
handle = dlopen("/path/to/libabc.so", RTLD_LAZY);
otherDef = dlsym(handle, "def");
orderDef(parameter);
There is a complete example how to do this very thing at LinuxJournal.
If you only want to use one libabc.so version, you can always use LD_PRELOAD to load it along with your own shared object before anything else.
If you want to use multiple versions, you have a few alternatives:
Use dlopen() in your shared object to load that library. Since you have created a function injection object you should be familiar with this procedure. This is the more generic and powerful way - you could even mix & match functions from different library versions.
Use a different DT_SONAME for the library version your shared object links against. Unfortunately this requires (slightly) changing the build system of that library and recompiling.
Link your shared object statically against the library in question. Not always possible but it does not require modifying the library in question. The main issue with this alternative is that any change in the library should be followed by a relinking of your shared object for the changes to be pulled in.
Warning: you may need to use a custom linker script or specific linker options to avoid symbol conflicts.

How to get function name (function declaration) from VC++ .dll file?

Can anybody tell me how can i get the function declaration i mean function name from VC++ DLL file.
I have .dll of VC++ and i want to extract function name from it ?
Is it possible then let me know.
Thanks in Advance
Thanks,
Neel
Since the DLL is not built with debug info, you can only look at functions that are exported by the DLL. Use "Dependency Walker" to see which functions are exported by the DLL. You will see 2 types of functions.
If the name of the function is not mangled (like all functions in the Windows DLL's) you're out of luck. There is (as far as I know) no way to get the arguments of these functions (except looking in the documentation or in include files that might be delivered with the DLL).
If the name of the function is mangled, it will have a name like this: ?makeSizePositive#?$RectangleTemplate#J#TOOLS##QAEXXZ. This method was originally named makeSizePositive, and all the gibberish added to it give some clue about the class where the method is located, the namespace, and the arguments. See http://www.kegel.com/mangle.html#operators about an explanation.

Resources