Error in winternl.h ?

Here you can discuss ReactOS related topics.

Moderator: Moderator Team

Post Reply
Beyond2000!
Posts: 8
Joined: Sat Apr 07, 2007 12:01 am
Contact:

Error in winternl.h ?

Post by Beyond2000! » Tue Jun 26, 2012 10:11 am

Not sure if the actual version is the same one i have, but...the file winternl.h seems to contains an error on _TEB structure

typedef struct _TEB
(...)
WCHAR StaticUnicodeBuffer[261]; /* c00 used by advapi32 */
(...)

here, it is not 261, but it is 262. So, it will result in
WCHAR StaticUnicodeBuffer[262]; /* c00 used by advapi32 */

Can u please check the size of the members of the structure ?

Best Regards
guga

ThePhysicist
Developer
Posts: 508
Joined: Mon Apr 25, 2005 12:46 pm

Re: Error in winternl.h ?

Post by ThePhysicist » Tue Jun 26, 2012 6:06 pm

I have checked the Windows symbol files and the size is 261 elements.

Where did you get your info from?

Beyond2000!
Posts: 8
Joined: Sat Apr 07, 2007 12:01 am
Contact:

Re: Error in winternl.h ?

Post by Beyond2000! » Wed Jun 27, 2012 8:20 am

here
http://www.koders.com/c/fidE07E131D9EA2 ... 236A6.aspx

Code: Select all

ULONG           LastStatusValue;            /* bf4 */
    UNICODE_STRING  StaticUnicodeString;        /* bf8 used by advapi32 */
    WCHAR           StaticUnicodeBuffer[261];   /* c00 used by advapi32 */
    PVOID           DeallocationStack;          /* e0c */ <----- It is 0E0A and not 0E0C. The fix (to be 0E0C) is in need of a padding of 2 bytes
    PVOID           TlsSlots[64];               /* e10 */
    LIST_ENTRY      TlsLinks;                   /* f10 */
    PVOID           Vdm;                        /* f18 */
If you sum the data type values it won´t fit the proper address at 0E0C for deallocationstack (2*261+0C00 = E0A) and not 0E0C.

This is because right after StaticUnicodeBuffer we have a padding of 2 bytes
http://msdn.mirt.net/winvistasp2_x86.html#_TEB

Code: Select all

/*0xC00*/     WCHAR        StaticUnicodeBuffer[261];
/*0xE0A*/     UINT8        _PADDING0_[0x2];
/*0xE0C*/     VOID*        DeallocationStack;
/*0xE10*/     VOID*        TlsSlots[64];
So...either you simply make 262 (To fit the proper size and address) or add another member with 2 bytes only named as PADDING0 (better IMHO)

Beyond2000!
Posts: 8
Joined: Sat Apr 07, 2007 12:01 am
Contact:

Re: Error in winternl.h ?

Post by Beyond2000! » Wed Jun 27, 2012 9:04 am

Analyzing the structure from both sources, i have a question...

The one in http://msdn.mirt.net/winxpsp3_x86.html#_TEB seems to be more complete then the one existent in ROS ?

It seems to contains different members names of the structure. Ex: What does the ACTIVATION_CONTEXT_STACK do ?

Don´t it have a common documentation of the TEB structure ? I looked for info on this structure and couldn´t find detailed information of all the members of this structure.

Beyond2000!
Posts: 8
Joined: Sat Apr 07, 2007 12:01 am
Contact:

Re: Error in winternl.h ?

Post by Beyond2000! » Tue Jul 03, 2012 12:38 am

No one have documentation on this ?

Best Regards,

guga

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], DotBot [Crawler], Yeti [Bot] and 12 guests