mercredi 7 octobre 2015

How do I replace method addresses in Silverlight?

I'm replacing method addresses in C# desktop Apps by using this approach:

var destMethod = typeof(BaseViewModel).GetMethod("desc");
var srcMethod = typeof(BaseViewModel).GetMethod("src");
*((uint*)new IntPtr(((int*)destMethod.MethodHandle.Value.ToPointer() + 2)).ToPointer()) = *((uint*)new IntPtr(((int*)srcMethod.MethodHandle.Value.ToPointer() + 2)).ToPointer());

It works fine in desktop apps, but in Silverlight it doesn't work. Please advise if this approach can be also used for Silverlight and what should I change to make it woks. Thanks in advance.





Aucun commentaire:

Enregistrer un commentaire