Pointers support

Explore, browse and analyze .NET assemblies

Moderators: Luke Jefferson, Clive Tong, nick.maidment

Pointers support

Postby alehandro » Tue Jan 25, 2011 4:31 pm

Hi
does Reflector 7 support pointers? (ie unsafe types)

I'm asking because instead of pointers (->) I see the points (.)

Example:

public struct struct012c
{
public const int f00002e = 0x80;
public const int f00000f = 280;
public uint f00003f;
public uint f000040;
public uint f000031;
public enum0128 f00021a;
public unsafe struct0125* f000225;
public uint f000034;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=0x80, ArraySubType=UnmanagedType.U2)]
public char[] f0001e7;
}


and here is the usage (wrong):

public static unsafe int m000152(IntPtr A_0, uint A_1, delegate012e A_2, enum0130 A_3)
{
int num2;
int cb = sizeof(struct0125) + 0x10000;
IntPtr hglobal = Marshal.AllocHGlobal(cb);
try
{
struct012c structc;
structc = new struct012c {
f0001e7 = new char[0x80],
f00003f = (uint) Marshal.SizeOf(structc),
f000031 = A_1,
f000225 = (struct0125*) hglobal
};
structc.f000225.f000112 = (ushort) A_1;
structc.f000034 = (uint) cb;
num2 = acmFormatEnum(A_0, ref structc, A_2, IntPtr.Zero, A_3);
}
finally
{
Marshal.FreeHGlobal(hglobal);
}
return num2;
}


Please comment
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am

Postby Clive Tong » Wed Jan 26, 2011 9:31 am

-> seems to be used correctly in some circumstances.
For example, in the following,

Code: Select all
        public struct Foo
        {
            public unsafe Foo* x;
            public int y;
        }

        static void Main(string[] args)
        {
            unsafe
            {
                Foo foo = new Foo();
                int xx = foo.x->y;

                Foo* bar = &foo;
                int yy = bar->x->y;
            }
        }


Reflector uses -> for the top level indirections.

Code: Select all
    Foo foo = new Foo();
    int y = foo.x.y;
    Foo* fooPtr = &foo;
    int num2 = fooPtr->x.y;


I've logged it as RP-947.
Clive Tong
 
Posts: 283
Joined: Thu Dec 04, 2008 5:42 pm

Postby alehandro » Thu Jan 27, 2011 12:50 pm

Thank you
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am


Return to .NET Reflector 7 EAP

Who is online

Users browsing this forum: No registered users and 0 guests

cron