Sequential Structs

If you find any bugs, please post them here.

Sequential Structs

Postby theit8514 » Tue Jun 22, 2010 11:24 pm

I'm having a bit of trouble with Sequential structs and Regionerate. Whenever Regionerate runs, it reorders all the items in the struct to be by-name instead of in their places (for sequential).

For now, I've moved the Sequential structs to a seperate file (hurrah for partial classes). However, it would be nice for Regionerate to ignore Sequential structs, or provide a way to ignore segments of code.

An example of this is:
Code: Select all
        [StructLayout(LayoutKind.Sequential)]
        internal struct WINSTATIONINFORMATIONW
        {
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 70)]
            Byte[] Reserved1;
            public UInt32 SessionId;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
            Byte[] Reserved2;
            public System.Runtime.InteropServices.ComTypes.FILETIME ConnectTime;
            public System.Runtime.InteropServices.ComTypes.FILETIME DisconnectTime;
            public System.Runtime.InteropServices.ComTypes.FILETIME LastInputTime;
            public System.Runtime.InteropServices.ComTypes.FILETIME LoginTime;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1096)]
            Byte[] Reserved3;
            public System.Runtime.InteropServices.ComTypes.FILETIME CurrentTime;
        }

Which ends up as:
Code: Select all
        [StructLayout(LayoutKind.Sequential)]
        internal struct WINSTATIONINFORMATIONW
        {
      #region Data Members (9) 

            public System.Runtime.InteropServices.ComTypes.FILETIME ConnectTime;
            public System.Runtime.InteropServices.ComTypes.FILETIME CurrentTime;
            public System.Runtime.InteropServices.ComTypes.FILETIME DisconnectTime;
            public System.Runtime.InteropServices.ComTypes.FILETIME LastInputTime;
            public System.Runtime.InteropServices.ComTypes.FILETIME LoginTime;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 70)]
            Byte[] Reserved1;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
            Byte[] Reserved2;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1096)]
            Byte[] Reserved3;
            public UInt32 SessionId;

      #endregion Data Members 
        }
theit8514
 
Posts: 1
Joined: Tue Jun 22, 2010 11:17 pm

Re: Sequential Structs

Postby rauchy » Wed Jun 30, 2010 6:14 pm

This is the first time I hear of sequential structs :-)

I don't see support for sequential structs any time soon (what would you group by anyway?), but you can just remove the <ForEach Type="Struct"> element from your code layout, and these structs will not be touched.

Hope this helps.
-- rauchy.
rauchy
Site Admin
 
Posts: 267
Joined: Wed May 09, 2007 2:39 am
Location: Israel


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest

cron