Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Tambi Ashmoz

@Tambi Ashmoz
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Pointers,Classes,Objects... II
    T Tambi Ashmoz

    Yes, but I still wanted to do this by comparing objects. I want to know how to get a variable pointer as IntPtr and how to read from unknown type object from a specific place.

    C# question debugging help tutorial

  • Pointers,Classes,Objects... II
    T Tambi Ashmoz

    How can I get a variable pointer (as IntPtr) ? I am trying to compare between two objects, the objects are not the same but they could be from some place ... Example - let say we have two classes one derived from another ... public class A {   protected h=0;   public virtual func()   {    h=0;   } } public class B:A {   public override func()   {    h=1;   } } Now ... I'am creating the objects ... obj1=Activator.CreateInstance(t1); //Type t1; class A c.Invoke(obj1,null); //ConstructorInfo c; getting constructor from class A the same with the other class... obj1=Activator.CreateInstance(t2); //Type t2; class B c.Invoke(obj2,null); //ConstructorInfo c; getting constructor from class B From this point you can see in the debugger obj1,obj2 (with the variable h=0 in both) Now I'am invoking my function... //MethodInfo m1,m2; getting my virtual AND override functions each from it's class ... and after that running functions , with null as parametter... object []parametersForFunction=new object[m1.GetParameters().Length]; //m1 or m2 doesn't matter they have the same parameters... virtual,override m1.Invoke(obj1,parametersForFunction); m2.Invoke(obj2,parametersForFunction); I can't check "h" with the GetFields() couse its not public().. My problem is here... Now if wee go back to the debugger we can see that in obj1.h=0 and obj2.h=1 Somthing like this obj1.A.h=0 obj2.B.A.h=1 My idea was to try the Marshal.ReadIntPtr(IntPtr,offset) so I can read obj2 after some offset, So I needed my variable Address. (somehow even in unsafe we cant do object *p=obj1; on objetcs...) I tried Marshel.ReadByte and it's not working cause my object type could be anything... Anyone have some idea ??? Thanks

    C# question debugging help tutorial

  • Pointers, Objects, Classes ...
    T Tambi Ashmoz

    How can I get the address of an object (as IntPtr) or any other variable type ? Though I could get a variable address in unsafe, (or maybe there is a better c# way ... I dont know) unsafe { int x=0; int *p=&x; } With objects it's not working, and still I have to convert it from int* to IntPtr ... Thanks

    C# question csharp
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups