Fix the PSID and PSECURITY_DESCRIPTOR types
Francois Gouget
fgouget at free.fr
Fri Aug 13 06:33:18 CDT 2004
In the Windows headers, PSID is not an SID*, its a void* pointer. This
is probably because at some time the SID structure was not public.
Then it's been added to the Windows headers and the corresponding
pointer is called PISID (the I probably standard for Internal).
Anyway, the Wine headers got that wrong for PSID and
PSECURITY_DESCRIPTOR too.
* include/winnt.h
dlls/advapi32/security.c
dlls/ntdll/om.c
dlls/ntdll/sec.c
dlls/ntdll/tests/generated.c
Fix the PSID and PSECURITY_DESCRIPTOR types.
Add PISID and PISECURITY_DESCRIPTOR.
Index: include/winnt.h
===================================================================
RCS file: /var/cvs/wine/include/winnt.h,v
retrieving revision 1.185
diff -u -r1.185 winnt.h
--- include/winnt.h 19 Jul 2004 19:33:08 -0000 1.185
+++ include/winnt.h 11 Aug 2004 14:40:00 -0000
@@ -2616,6 +2616,8 @@
/* FIXME: Orphan. What does it point to? */
typedef PVOID PACCESS_TOKEN;
+typedef PVOID PSECURITY_DESCRIPTOR;
+typedef PVOID PSID;
/*
* TOKEN_INFORMATION_CLASS
@@ -2693,7 +2695,7 @@
BYTE SubAuthorityCount;
SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
DWORD SubAuthority[1];
-} SID,*PSID;
+} SID,*PISID;
#endif /* !defined(SID_DEFINED) */
#define SID_REVISION (1) /* Current revision */
@@ -2825,7 +2827,7 @@
PSID Group;
PACL Sacl;
PACL Dacl;
-} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
+} SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
Index: dlls/advapi32/security.c
===================================================================
RCS file: /var/cvs/wine/dlls/advapi32/security.c,v
retrieving revision 1.73
diff -u -r1.73 security.c
--- dlls/advapi32/security.c 9 Aug 2004 22:55:47 -0000 1.73
+++ dlls/advapi32/security.c 12 Aug 2004 08:08:32 -0000
@@ -48,7 +48,7 @@
static DWORD ParseAceStringRights(LPCWSTR* StringAcl);
static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(
LPCWSTR StringSecurityDescriptor,
- PSECURITY_DESCRIPTOR SecurityDescriptor,
+ SECURITY_DESCRIPTOR* SecurityDescriptor,
LPDWORD cBytes);
static DWORD ParseAclStringFlags(LPCWSTR* StringAcl);
@@ -555,7 +555,7 @@
* revision []
*/
BOOL WINAPI
-InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
+InitializeSecurityDescriptor( PSECURITY_DESCRIPTOR pDescr, DWORD revision )
{
CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
}
@@ -587,7 +587,7 @@
/******************************************************************************
* GetSecurityDescriptorLength [ADVAPI32.@]
*/
-DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
+DWORD WINAPI GetSecurityDescriptorLength( PSECURITY_DESCRIPTOR pDescr)
{
return (RtlLengthSecurityDescriptor(pDescr));
}
@@ -600,7 +600,7 @@
* lpbOwnerDefaulted []
*/
BOOL WINAPI
-GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
+GetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pDescr, PSID *pOwner,
LPBOOL lpbOwnerDefaulted )
{
CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
@@ -1890,7 +1890,7 @@
*/
static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(
LPCWSTR StringSecurityDescriptor,
- PSECURITY_DESCRIPTOR SecurityDescriptor,
+ SECURITY_DESCRIPTOR* SecurityDescriptor,
LPDWORD cBytes)
{
BOOL bret = FALSE;
@@ -2034,7 +2034,7 @@
PULONG SecurityDescriptorSize)
{
DWORD cBytes;
- PSECURITY_DESCRIPTOR psd;
+ SECURITY_DESCRIPTOR* psd;
BOOL bret = FALSE;
TRACE("%s\n", debugstr_w(StringSecurityDescriptor));
@@ -2055,7 +2055,7 @@
NULL, &cBytes))
goto lend;
- psd = *SecurityDescriptor = (PSECURITY_DESCRIPTOR) LocalAlloc(
+ psd = *SecurityDescriptor = (SECURITY_DESCRIPTOR*) LocalAlloc(
GMEM_ZEROINIT, cBytes);
psd->Revision = SID_REVISION;
@@ -2117,26 +2117,27 @@
WCHAR fmt[] = {
'S','-','%','u','-','%','2','X','%','2','X','%','X','%','X','%','X','%','X',0 };
WCHAR subauthfmt[] = { '-','%','u',0 };
+ SID* pisid=pSid;
TRACE("%p %p\n", pSid, pstr );
if( !IsValidSid( pSid ) )
return FALSE;
- if (pSid->Revision != SDDL_REVISION)
+ if (pisid->Revision != SDDL_REVISION)
return FALSE;
- sz = 14 + pSid->SubAuthorityCount * 11;
+ sz = 14 + pisid->SubAuthorityCount * 11;
str = LocalAlloc( 0, sz*sizeof(WCHAR) );
- sprintfW( str, fmt, pSid->Revision,
- pSid->IdentifierAuthority.Value[2],
- pSid->IdentifierAuthority.Value[3],
- pSid->IdentifierAuthority.Value[0]&0x0f,
- pSid->IdentifierAuthority.Value[4]&0x0f,
- pSid->IdentifierAuthority.Value[1]&0x0f,
- pSid->IdentifierAuthority.Value[5]&0x0f);
- for( i=0; i<pSid->SubAuthorityCount; i++ )
- sprintfW( str + strlenW(str), subauthfmt, pSid->SubAuthority[i] );
+ sprintfW( str, fmt, pisid->Revision,
+ pisid->IdentifierAuthority.Value[2],
+ pisid->IdentifierAuthority.Value[3],
+ pisid->IdentifierAuthority.Value[0]&0x0f,
+ pisid->IdentifierAuthority.Value[4]&0x0f,
+ pisid->IdentifierAuthority.Value[1]&0x0f,
+ pisid->IdentifierAuthority.Value[5]&0x0f);
+ for( i=0; i<pisid->SubAuthorityCount; i++ )
+ sprintfW( str + strlenW(str), subauthfmt, pisid->SubAuthority[i] );
*pstr = str;
return TRUE;
@@ -2193,6 +2194,7 @@
static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
{
BOOL bret = FALSE;
+ SID* pisid=pSid;
if (!StringSid)
{
@@ -2201,7 +2203,7 @@
}
*cBytes = ComputeStringSidSize(StringSid);
- if (!pSid) /* Simply compute the size */
+ if (!pisid) /* Simply compute the size */
return TRUE;
if (*StringSid != 'S' || *StringSid != '-') /* S-R-I-S-S */
@@ -2210,19 +2212,19 @@
int csubauth = ((*cBytes - sizeof(SID)) / sizeof(DWORD)) + 1;
StringSid += 2; /* Advance to Revision */
- pSid->Revision = atoiW(StringSid);
+ pisid->Revision = atoiW(StringSid);
- if (pSid->Revision != SDDL_REVISION)
+ if (pisid->Revision != SDDL_REVISION)
goto lend; /* ERROR_INVALID_SID */
- pSid->SubAuthorityCount = csubauth;
+ pisid->SubAuthorityCount = csubauth;
while (*StringSid && *StringSid != '-')
StringSid++; /* Advance to identifier authority */
- pSid->IdentifierAuthority.Value[5] = atoiW(StringSid);
+ pisid->IdentifierAuthority.Value[5] = atoiW(StringSid);
- if (pSid->IdentifierAuthority.Value[5] > 5)
+ if (pisid->IdentifierAuthority.Value[5] > 5)
goto lend; /* ERROR_INVALID_SID */
while (*StringSid)
@@ -2230,24 +2232,24 @@
while (*StringSid && *StringSid != '-')
StringSid++;
- pSid->SubAuthority[i++] = atoiW(StringSid);
+ pisid->SubAuthority[i++] = atoiW(StringSid);
}
- if (i != pSid->SubAuthorityCount)
+ if (i != pisid->SubAuthorityCount)
goto lend; /* ERROR_INVALID_SID */
bret = TRUE;
}
else /* String constant format - Only available in winxp and above */
{
- pSid->Revision = SDDL_REVISION;
- pSid->SubAuthorityCount = 1;
+ pisid->Revision = SDDL_REVISION;
+ pisid->SubAuthorityCount = 1;
FIXME("String constant not supported: %s\n", debugstr_wn(StringSid, 2));
/* TODO: Lookup string of well-known SIDs in table */
- pSid->IdentifierAuthority.Value[5] = 0;
- pSid->SubAuthority[0] = 0;
+ pisid->IdentifierAuthority.Value[5] = 0;
+ pisid->SubAuthority[0] = 0;
bret = TRUE;
}
Index: dlls/ntdll/om.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/om.c,v
retrieving revision 1.28
diff -u -r1.28 om.c
--- dlls/ntdll/om.c 5 Sep 2003 23:08:34 -0000 1.28
+++ dlls/ntdll/om.c 12 Aug 2004 07:26:04 -0000
@@ -179,7 +179,7 @@
/* owner: administrator S-1-5-20-220*/
if (OWNER_SECURITY_INFORMATION & RequestedInformation)
{
- PSID psid = (PSID)&(Buffer[BufferIndex]);
+ SID* psid = (SID*)&(Buffer[BufferIndex]);
psd->Owner = BufferIndex;
BufferIndex += RtlLengthRequiredSid(2);
@@ -194,7 +194,7 @@
/* group: built in domain S-1-5-12 */
if (GROUP_SECURITY_INFORMATION & RequestedInformation)
{
- PSID psid = (PSID) &(Buffer[BufferIndex]);
+ SID* psid = (SID*) &(Buffer[BufferIndex]);
psd->Group = BufferIndex;
BufferIndex += RtlLengthRequiredSid(1);
@@ -211,7 +211,7 @@
/* acl header */
PACL pacl = (PACL)&(Buffer[BufferIndex]);
PACCESS_ALLOWED_ACE pace;
- PSID psid;
+ SID* psid;
psd->Dacl = BufferIndex;
@@ -232,7 +232,7 @@
pace->SidStart = BufferIndex;
/* SID S-1-5-12 (System) */
- psid = (PSID)&(Buffer[BufferIndex]);
+ psid = (SID*)&(Buffer[BufferIndex]);
BufferIndex += RtlLengthRequiredSid(1);
@@ -252,7 +252,7 @@
pace->SidStart = BufferIndex;
/* S-1-5-12 (Administrators) */
- psid = (PSID)&(Buffer[BufferIndex]);
+ psid = (SID*)&(Buffer[BufferIndex]);
BufferIndex += RtlLengthRequiredSid(2);
@@ -273,7 +273,7 @@
pace->SidStart = BufferIndex;
/* SID S-1-1-0 (Everyone) */
- psid = (PSID)&(Buffer[BufferIndex]);
+ psid = (SID*)&(Buffer[BufferIndex]);
BufferIndex += RtlLengthRequiredSid(1);
Index: dlls/ntdll/sec.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/sec.c,v
retrieving revision 1.43
diff -u -r1.43 sec.c
--- dlls/ntdll/sec.c 7 May 2004 04:01:28 -0000 1.43
+++ dlls/ntdll/sec.c 11 Aug 2004 16:00:21 -0000
@@ -73,6 +73,7 @@
DWORD nSubAuthority6, DWORD nSubAuthority7,
PSID *pSid )
{
+
TRACE("(%p, 0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p)\n",
pIdentifierAuthority,nSubAuthorityCount,
nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
@@ -82,10 +83,10 @@
RtlLengthRequiredSid(nSubAuthorityCount))))
return FALSE;
- (*pSid)->Revision = SID_REVISION;
+ ((SID*)*pSid)->Revision = SID_REVISION;
if (pIdentifierAuthority)
- memcpy(&(*pSid)->IdentifierAuthority, pIdentifierAuthority, sizeof (SID_IDENTIFIER_AUTHORITY));
+ memcpy(&((SID*)*pSid)->IdentifierAuthority, pIdentifierAuthority, sizeof (SID_IDENTIFIER_AUTHORITY));
*RtlSubAuthorityCountSid(*pSid) = nSubAuthorityCount;
if (nSubAuthorityCount > 0)
@@ -145,7 +146,7 @@
if (*RtlSubAuthorityCountSid(pSid1) != *RtlSubAuthorityCountSid(pSid2))
return FALSE;
- if (memcmp(pSid1, pSid2, RtlLengthRequiredSid(pSid1->SubAuthorityCount - 1)) != 0)
+ if (memcmp(pSid1, pSid2, RtlLengthRequiredSid(((SID*)pSid1)->SubAuthorityCount - 1)) != 0)
return FALSE;
return TRUE;
@@ -224,13 +225,15 @@
BYTE nSubAuthorityCount)
{
int i;
+ SID* pisid=pSid;
+
if (nSubAuthorityCount >= SID_MAX_SUB_AUTHORITIES)
return FALSE;
- pSid->Revision = SID_REVISION;
- pSid->SubAuthorityCount = nSubAuthorityCount;
+ pisid->Revision = SID_REVISION;
+ pisid->SubAuthorityCount = nSubAuthorityCount;
if (pIdentifierAuthority)
- memcpy(&pSid->IdentifierAuthority, pIdentifierAuthority, sizeof (SID_IDENTIFIER_AUTHORITY));
+ memcpy(&pisid->IdentifierAuthority, pIdentifierAuthority, sizeof (SID_IDENTIFIER_AUTHORITY));
for (i = 0; i < nSubAuthorityCount; i++)
*RtlSubAuthoritySid(pSid, i) = 0;
@@ -252,7 +255,7 @@
*/
LPDWORD WINAPI RtlSubAuthoritySid( PSID pSid, DWORD nSubAuthority )
{
- return &(pSid->SubAuthority[nSubAuthority]);
+ return &(((SID*)pSid)->SubAuthority[nSubAuthority]);
}
/**************************************************************************
@@ -268,7 +271,7 @@
*/
PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid( PSID pSid )
{
- return &(pSid->IdentifierAuthority);
+ return &(((SID*)pSid)->IdentifierAuthority);
}
/**************************************************************************
@@ -284,7 +287,7 @@
*/
LPBYTE WINAPI RtlSubAuthorityCountSid(PSID pSid)
{
- return &(pSid->SubAuthorityCount);
+ return &(((SID*)pSid)->SubAuthorityCount);
}
/**************************************************************************
@@ -296,10 +299,10 @@
(nDestinationSidLength < RtlLengthSid(pSourceSid)))
return FALSE;
- if (nDestinationSidLength < (pSourceSid->SubAuthorityCount*4+8))
+ if (nDestinationSidLength < (((SID*)pSourceSid)->SubAuthorityCount*4+8))
return FALSE;
- memmove(pDestinationSid, pSourceSid, pSourceSid->SubAuthorityCount*4+8);
+ memmove(pDestinationSid, pSourceSid, ((SID*)pSourceSid)->SubAuthorityCount*4+8);
return TRUE;
}
/******************************************************************************
@@ -320,8 +323,8 @@
__TRY
{
ret = TRUE;
- if (!pSid || pSid->Revision != SID_REVISION ||
- pSid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES)
+ if (!pSid || ((SID*)pSid)->Revision != SID_REVISION ||
+ ((SID*)pSid)->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES)
{
ret = FALSE;
}
@@ -360,7 +363,7 @@
if (rev!=SECURITY_DESCRIPTOR_REVISION)
return STATUS_UNKNOWN_REVISION;
memset(lpsd,'\0',sizeof(*lpsd));
- lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
+ ((SECURITY_DESCRIPTOR*)lpsd)->Revision = SECURITY_DESCRIPTOR_REVISION;
return STATUS_SUCCESS;
}
/**************************************************************************
@@ -380,7 +383,7 @@
{
if ( ! SecurityDescriptor )
return STATUS_INVALID_SECURITY_DESCR;
- if ( SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION )
+ if ( ((SECURITY_DESCRIPTOR*)SecurityDescriptor)->Revision != SECURITY_DESCRIPTOR_REVISION )
return STATUS_UNKNOWN_REVISION;
return STATUS_SUCCESS;
@@ -390,28 +393,29 @@
* RtlLengthSecurityDescriptor [NTDLL.@]
*/
ULONG WINAPI RtlLengthSecurityDescriptor(
- PSECURITY_DESCRIPTOR SecurityDescriptor)
+ PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
ULONG offset = 0;
ULONG Size = SECURITY_DESCRIPTOR_MIN_LENGTH;
- if ( SecurityDescriptor == NULL )
+ if ( lpsd == NULL )
return 0;
- if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
- offset = (ULONG) SecurityDescriptor;
+ if ( lpsd->Control & SE_SELF_RELATIVE)
+ offset = (ULONG) lpsd;
- if ( SecurityDescriptor->Owner != NULL )
- Size += RtlLengthSid((PSID)((LPBYTE)SecurityDescriptor->Owner + offset));
+ if ( lpsd->Owner != NULL )
+ Size += RtlLengthSid((PSID)((LPBYTE)lpsd->Owner + offset));
- if ( SecurityDescriptor->Group != NULL )
- Size += RtlLengthSid((PSID)((LPBYTE)SecurityDescriptor->Group + offset));
+ if ( lpsd->Group != NULL )
+ Size += RtlLengthSid((PSID)((LPBYTE)lpsd->Group + offset));
- if ( SecurityDescriptor->Sacl != NULL )
- Size += ((PACL)((LPBYTE)SecurityDescriptor->Sacl + offset))->AclSize;
+ if ( lpsd->Sacl != NULL )
+ Size += ((PACL)((LPBYTE)lpsd->Sacl + offset))->AclSize;
- if ( SecurityDescriptor->Dacl != NULL )
- Size += ((PACL)((LPBYTE)SecurityDescriptor->Dacl + offset))->AclSize;
+ if ( lpsd->Dacl != NULL )
+ Size += ((PACL)((LPBYTE)lpsd->Dacl + offset))->AclSize;
return Size;
}
@@ -426,23 +430,25 @@
OUT PACL *pDacl,
OUT PBOOLEAN lpbDaclDefaulted)
{
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
+
TRACE("(%p,%p,%p,%p)\n",
pSecurityDescriptor, lpbDaclPresent, *pDacl, lpbDaclDefaulted);
- if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
+ if (lpsd->Revision != SECURITY_DESCRIPTOR_REVISION)
return STATUS_UNKNOWN_REVISION ;
- if ( (*lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
+ if ( (*lpbDaclPresent = (SE_DACL_PRESENT & lpsd->Control) ? 1 : 0) )
{
- if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
- { *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl);
+ if ( SE_SELF_RELATIVE & lpsd->Control)
+ { *pDacl = (PACL) ((LPBYTE)lpsd + (DWORD)lpsd->Dacl);
}
else
- { *pDacl = pSecurityDescriptor->Dacl;
+ { *pDacl = lpsd->Dacl;
}
}
- *lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
+ *lpbDaclDefaulted = (( SE_DACL_DEFAULTED & lpsd->Control ) ? 1 : 0);
return STATUS_SUCCESS;
}
@@ -451,11 +457,13 @@
* RtlSetDaclSecurityDescriptor [NTDLL.@]
*/
NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (
- PSECURITY_DESCRIPTOR lpsd,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
BOOLEAN daclpresent,
PACL dacl,
BOOLEAN dacldefaulted )
{
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
+
if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
return STATUS_UNKNOWN_REVISION;
if (lpsd->Control & SE_SELF_RELATIVE)
@@ -487,23 +495,25 @@
OUT PACL *pSacl,
OUT PBOOLEAN lpbSaclDefaulted)
{
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
+
TRACE("(%p,%p,%p,%p)\n",
pSecurityDescriptor, lpbSaclPresent, *pSacl, lpbSaclDefaulted);
- if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
+ if (lpsd->Revision != SECURITY_DESCRIPTOR_REVISION)
return STATUS_UNKNOWN_REVISION ;
- if ( (*lpbSaclPresent = (SE_SACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
+ if ( (*lpbSaclPresent = (SE_SACL_PRESENT & lpsd->Control) ? 1 : 0) )
{
- if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
- { *pSacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Sacl);
+ if ( SE_SELF_RELATIVE & lpsd->Control)
+ { *pSacl = (PACL) ((LPBYTE)lpsd + (DWORD)lpsd->Sacl);
}
else
- { *pSacl = pSecurityDescriptor->Sacl;
+ { *pSacl = lpsd->Sacl;
}
}
- *lpbSaclDefaulted = (( SE_SACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
+ *lpbSaclDefaulted = (( SE_SACL_DEFAULTED & lpsd->Control ) ? 1 : 0);
return STATUS_SUCCESS;
}
@@ -512,11 +522,13 @@
* RtlSetSaclSecurityDescriptor [NTDLL.@]
*/
NTSTATUS WINAPI RtlSetSaclSecurityDescriptor (
- PSECURITY_DESCRIPTOR lpsd,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
BOOLEAN saclpresent,
PACL sacl,
BOOLEAN sacldefaulted)
{
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
+
if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
return STATUS_UNKNOWN_REVISION;
if (lpsd->Control & SE_SELF_RELATIVE)
@@ -538,22 +550,24 @@
* RtlGetOwnerSecurityDescriptor [NTDLL.@]
*/
NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
- PSECURITY_DESCRIPTOR SecurityDescriptor,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID *Owner,
PBOOLEAN OwnerDefaulted)
{
- if ( !SecurityDescriptor || !Owner || !OwnerDefaulted )
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
+
+ if ( !lpsd || !Owner || !OwnerDefaulted )
return STATUS_INVALID_PARAMETER;
- if (SecurityDescriptor->Owner != NULL)
+ if (lpsd->Owner != NULL)
{
- if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
- *Owner = (PSID)((LPBYTE)SecurityDescriptor +
- (ULONG)SecurityDescriptor->Owner);
+ if (lpsd->Control & SE_SELF_RELATIVE)
+ *Owner = (PSID)((LPBYTE)lpsd +
+ (ULONG)lpsd->Owner);
else
- *Owner = SecurityDescriptor->Owner;
+ *Owner = lpsd->Owner;
- if ( SecurityDescriptor->Control & SE_OWNER_DEFAULTED )
+ if ( lpsd->Control & SE_OWNER_DEFAULTED )
*OwnerDefaulted = TRUE;
else
*OwnerDefaulted = FALSE;
@@ -568,10 +582,12 @@
* RtlSetOwnerSecurityDescriptor [NTDLL.@]
*/
NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(
- PSECURITY_DESCRIPTOR lpsd,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID owner,
BOOLEAN ownerdefaulted)
{
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
+
if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
return STATUS_UNKNOWN_REVISION;
if (lpsd->Control & SE_SELF_RELATIVE)
@@ -589,10 +605,12 @@
* RtlSetGroupSecurityDescriptor [NTDLL.@]
*/
NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (
- PSECURITY_DESCRIPTOR lpsd,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID group,
BOOLEAN groupdefaulted)
{
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
+
if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
return STATUS_UNKNOWN_REVISION;
if (lpsd->Control & SE_SELF_RELATIVE)
@@ -609,22 +627,24 @@
* RtlGetGroupSecurityDescriptor [NTDLL.@]
*/
NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
- PSECURITY_DESCRIPTOR SecurityDescriptor,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID *Group,
PBOOLEAN GroupDefaulted)
{
- if ( !SecurityDescriptor || !Group || !GroupDefaulted )
+ SECURITY_DESCRIPTOR* lpsd=pSecurityDescriptor;
+
+ if ( !lpsd || !Group || !GroupDefaulted )
return STATUS_INVALID_PARAMETER;
- if (SecurityDescriptor->Group != NULL)
+ if (lpsd->Group != NULL)
{
- if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
- *Group = (PSID)((LPBYTE)SecurityDescriptor +
- (ULONG)SecurityDescriptor->Group);
+ if (lpsd->Control & SE_SELF_RELATIVE)
+ *Group = (PSID)((LPBYTE)lpsd +
+ (ULONG)lpsd->Group);
else
- *Group = SecurityDescriptor->Group;
+ *Group = lpsd->Group;
- if ( SecurityDescriptor->Control & SE_GROUP_DEFAULTED )
+ if ( lpsd->Control & SE_GROUP_DEFAULTED )
*GroupDefaulted = TRUE;
else
*GroupDefaulted = FALSE;
@@ -645,8 +665,8 @@
{
ULONG offsetRel;
ULONG length;
- PSECURITY_DESCRIPTOR pAbs = pAbsoluteSecurityDescriptor;
- PSECURITY_DESCRIPTOR pRel = pSelfRelativeSecurityDescriptor;
+ SECURITY_DESCRIPTOR* pAbs = pAbsoluteSecurityDescriptor;
+ SECURITY_DESCRIPTOR* pRel = pSelfRelativeSecurityDescriptor;
TRACE(" %p %p %p(%ld)\n", pAbs, pRel, lpdwBufferLength,
lpdwBufferLength ? *lpdwBufferLength: -1);
@@ -729,8 +749,8 @@
OUT LPDWORD lpdwPrimaryGroupSize)
{
NTSTATUS status = STATUS_SUCCESS;
- PSECURITY_DESCRIPTOR pAbs = pAbsoluteSecurityDescriptor;
- PSECURITY_DESCRIPTOR pRel = pSelfRelativeSecurityDescriptor;
+ SECURITY_DESCRIPTOR* pAbs = pAbsoluteSecurityDescriptor;
+ SECURITY_DESCRIPTOR* pRel = pSelfRelativeSecurityDescriptor;
if (!pRel ||
!lpdwAbsoluteSecurityDescriptorSize ||
Index: dlls/ntdll/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/generated.c,v
retrieving revision 1.9
diff -u -r1.9 generated.c
--- dlls/ntdll/tests/generated.c 4 May 2004 00:41:11 -0000 1.9
+++ dlls/ntdll/tests/generated.c 11 Aug 2004 14:43:39 -0000
@@ -1287,6 +1186,13 @@
TEST_TYPE_POINTER(PIMAGE_VXD_HEADER, 196, 2);
}
+static void test_pack_PISECURITY_DESCRIPTOR(void)
+{
+ /* PISECURITY_DESCRIPTOR */
+ TEST_TYPE(PISECURITY_DESCRIPTOR, 4, 4);
+ TEST_TYPE_POINTER(PISECURITY_DESCRIPTOR, 20, 4);
+}
+
static void test_pack_PISECURITY_DESCRIPTOR_RELATIVE(void)
{
/* PISECURITY_DESCRIPTOR_RELATIVE */
@@ -1294,6 +1200,13 @@
TEST_TYPE_POINTER(PISECURITY_DESCRIPTOR_RELATIVE, 20, 4);
}
+static void test_pack_PISID(void)
+{
+ /* PISID */
+ TEST_TYPE(PISID, 4, 4);
+ TEST_TYPE_POINTER(PISID, 12, 4);
+}
+
static void test_pack_PLARGE_INTEGER(void)
{
/* PLARGE_INTEGER */
@@ -1418,14 +1319,12 @@
{
/* PSECURITY_DESCRIPTOR */
TEST_TYPE(PSECURITY_DESCRIPTOR, 4, 4);
- TEST_TYPE_POINTER(PSECURITY_DESCRIPTOR, 20, 4);
}
static void test_pack_PSID(void)
{
/* PSID */
TEST_TYPE(PSID, 4, 4);
- TEST_TYPE_POINTER(PSID, 12, 4);
}
static void test_pack_PSID_IDENTIFIER_AUTHORITY(void)
Index: tools/winapi/tests.dat
===================================================================
RCS file: /var/cvs/wine/tools/winapi/tests.dat,v
retrieving revision 1.13
diff -u -r1.13 tests.dat
--- tools/winapi/tests.dat 11 Aug 2004 20:52:37 -0000 1.13
+++ tools/winapi/tests.dat 13 Aug 2004 11:25:34 -0000
@@ -807,7 +802,9 @@
PIMAGE_TLS_DIRECTORY
PIMAGE_VXD_HEADER
!PIO_COUNTERS
+PISECURITY_DESCRIPTOR
PISECURITY_DESCRIPTOR_RELATIVE
+PISID
PLARGE_INTEGER
PLIST_ENTRY
PLUID
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
Linux: the choice of a GNU generation
More information about the wine-patches
mailing list