Author: weiden
Date: Mon Oct 9 19:09:50 2006
New Revision: 24472
URL:
http://svn.reactos.org/svn/reactos?rev=24472&view=rev
Log:
Some portability fixes that address possible alignment issues. Read R. Chen's blog
10/06/06 for more information.
Modified:
trunk/reactos/dll/win32/aclui/aclui.c
trunk/reactos/dll/win32/advapi32/sec/sid.c
trunk/reactos/lib/rtl/sd.c
trunk/reactos/lib/rtl/sid.c
trunk/reactos/ntoskrnl/se/sid.c
Modified: trunk/reactos/dll/win32/aclui/aclui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/aclui/aclui.c?re…
==============================================================================
--- trunk/reactos/dll/win32/aclui/aclui.c (original)
+++ trunk/reactos/dll/win32/aclui/aclui.c Mon Oct 9 19:09:50 2006
@@ -1047,7 +1047,8 @@
WORD AceSize;
SidLen = GetLengthSid(pSid);
- AceSize = sizeof(ACCESS_ALLOWED_ACE) + (WORD)SidLen - sizeof(DWORD);
+ AceSize = FIELD_OFFSET(ACCESS_ALLOWED_ACE,
+ SidStart) + (WORD)SidLen;
Ace = HeapAlloc(GetProcessHeap(),
0,
AceSize);
Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/sid…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/sec/sid.c (original)
+++ trunk/reactos/dll/win32/advapi32/sec/sid.c Mon Oct 9 19:09:50 2006
@@ -184,7 +184,7 @@
return !status;
}
-#define WINE_SIZE_OF_WORLD_ACCESS_ACL (sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) +
sizeof(sidWorld) - sizeof(DWORD))
+#define WINE_SIZE_OF_WORLD_ACCESS_ACL (sizeof(ACL) + FIELD_OFFSET(ACCESS_ALLOWED_ACE,
SidStart) + sizeof(sidWorld))
/* some helper functions - taken from winehq cvs 20050916 */
@@ -428,7 +428,7 @@
goto lerr;
StringAcl++;
- length += sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) + sidlen;
+ length += FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + sidlen;
}
*cBytes = length;
Modified: trunk/reactos/lib/rtl/sd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/sd.c?rev=24472&…
==============================================================================
--- trunk/reactos/lib/rtl/sd.c (original)
+++ trunk/reactos/lib/rtl/sd.c Mon Oct 9 19:09:50 2006
@@ -812,8 +812,6 @@
&pSacl,
&SaclLength);
- ASSERT(sizeof(SECURITY_DESCRIPTOR) > sizeof(SECURITY_DESCRIPTOR_RELATIVE));
-
/* calculate the start and end of the data area, we simply just move the
data by the difference between the size of the relative and absolute
security descriptor structure */
Modified: trunk/reactos/lib/rtl/sid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/sid.c?rev=24472&am…
==============================================================================
--- trunk/reactos/lib/rtl/sid.c (original)
+++ trunk/reactos/lib/rtl/sid.c Mon Oct 9 19:09:50 2006
@@ -42,8 +42,8 @@
{
PAGED_CODE_RTL();
- return (sizeof(SID) - (ANYSIZE_ARRAY * sizeof(ULONG)) +
- (SubAuthorityCount * sizeof(ULONG)));
+ return (ULONG)FIELD_OFFSET(SID,
+ SubAuthority[SubAuthorityCount]);
}
@@ -132,8 +132,8 @@
PAGED_CODE_RTL();
- return (sizeof(SID) - sizeof(Sid->SubAuthority) +
- (Sid->SubAuthorityCount * sizeof(ULONG)));
+ return (ULONG)FIELD_OFFSET(SID,
+ SubAuthority[Sid->SubAuthorityCount]);
}
Modified: trunk/reactos/ntoskrnl/se/sid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sid.c?rev=2447…
==============================================================================
--- trunk/reactos/ntoskrnl/se/sid.c (original)
+++ trunk/reactos/ntoskrnl/se/sid.c Mon Oct 9 19:09:50 2006
@@ -246,7 +246,8 @@
_SEH_TRY
{
ProbeForRead(Sid,
- sizeof(*Sid) - sizeof(Sid->SubAuthority),
+ FIELD_OFFSET(SID,
+ SubAuthority),
sizeof(UCHAR));
SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount);
ProbeForRead(Sid,