- Remove trailing whitespace;
- Tabs --> Spaces;
- Don't always hardcode parameters sizeofs;
- Use ARRAYSIZE where applicable;
- Use UNICODE_NULL

svn path=/trunk/; revision=73232
This commit is contained in:
Hermès Bélusca-Maïto 2016-11-14 16:17:42 +00:00
parent e27a5768be
commit 076082358a
7 changed files with 28 additions and 29 deletions

View file

@ -950,7 +950,7 @@ LsapAppendSidToGroups(
Groups->GroupCount = 1;
Groups->Groups[0].Sid = Sid;
Groups->Groups[0].Attributes =
Groups->Groups[0].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
*TokenGroups = Groups;
@ -985,7 +985,7 @@ LsapAppendSidToGroups(
}
Groups->Groups[Groups->GroupCount].Sid = Sid;
Groups->Groups[Groups->GroupCount].Attributes =
Groups->Groups[Groups->GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
Groups->GroupCount++;

View file

@ -254,11 +254,11 @@ LsapCreateDatabaseObjects(VOID)
/* Initialize the audit log attribute */
AuditLogInfo.AuditLogPercentFull = 0;
AuditLogInfo.MaximumLogSize = 0; // DWORD
AuditLogInfo.AuditRetentionPeriod.QuadPart = 0; // LARGE_INTEGER
AuditLogInfo.AuditLogFullShutdownInProgress = 0; // BYTE
AuditLogInfo.TimeToShutdown.QuadPart = 0; // LARGE_INTEGER
AuditLogInfo.NextAuditRecordId = 0; // DWORD
AuditLogInfo.MaximumLogSize = 0; // DWORD
AuditLogInfo.AuditRetentionPeriod.QuadPart = 0; // LARGE_INTEGER
AuditLogInfo.AuditLogFullShutdownInProgress = 0; // BYTE
AuditLogInfo.TimeToShutdown.QuadPart = 0; // LARGE_INTEGER
AuditLogInfo.NextAuditRecordId = 0; // DWORD
/* Initialize the Audit Events attribute */
AuditEventsInfo = RtlAllocateHeap(RtlGetProcessHeap(),
@ -273,7 +273,7 @@ LsapCreateDatabaseObjects(VOID)
AuditEventsInfo->AuditEvents[i] = 0;
/* Initialize the DNS Domain GUID attribute */
memset(&DnsDomainGuid, 0, sizeof(GUID));
RtlZeroMemory(&DnsDomainGuid, sizeof(DnsDomainGuid));
/* Initialize the modification attribute */
ModificationInfo.ModifiedId.QuadPart = 0;
@ -323,31 +323,31 @@ LsapCreateDatabaseObjects(VOID)
LsapSetObjectAttribute(PolicyObject,
L"DefQuota",
&QuotaInfo,
sizeof(POLICY_DEFAULT_QUOTA_INFO));
sizeof(QuotaInfo));
/* Set the modification attribute */
LsapSetObjectAttribute(PolicyObject,
L"PolMod",
&ModificationInfo,
sizeof(POLICY_MODIFICATION_INFO));
sizeof(ModificationInfo));
/* Set the audit full attribute */
LsapSetObjectAttribute(PolicyObject,
L"PolAdtFl",
&AuditFullInfo,
sizeof(POLICY_AUDIT_FULL_QUERY_INFO));
sizeof(AuditFullInfo));
/* Set the audit log attribute */
LsapSetObjectAttribute(PolicyObject,
L"PolAdtLg",
&AuditLogInfo,
sizeof(POLICY_AUDIT_LOG_INFO));
sizeof(AuditLogInfo));
/* Set the audit events attribute */
LsapSetObjectAttribute(PolicyObject,
L"PolAdtEv",
AuditEventsInfo,
sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA));
sizeof(*AuditEventsInfo));
/* Set the DNS Domain Name attribute */
LsapSetObjectAttribute(PolicyObject,
@ -365,7 +365,7 @@ LsapCreateDatabaseObjects(VOID)
LsapSetObjectAttribute(PolicyObject,
L"PolDnDmG",
&DnsDomainGuid,
sizeof(GUID));
sizeof(DnsDomainGuid));
/* Set the Security Descriptor */
LsapSetObjectAttribute(PolicyObject,
@ -912,7 +912,7 @@ LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject)
{
Status = LsapRegEnumerateSubKey(DbObject->KeyHandle,
Index,
64 * sizeof(WCHAR),
sizeof(KeyName),
KeyName);
if (!NT_SUCCESS(Status))
break;
@ -1081,4 +1081,3 @@ LsapDeleteObjectAttribute(PLSA_DB_OBJECT DbObject,
}
/* EOF */

View file

@ -46,7 +46,7 @@ DsRolepGetBasicInfo(
ULONG Size;
NTSTATUS Status;
ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes));
RtlZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes));
Status = LsarOpenPolicy(NULL,
&ObjectAttributes,
POLICY_VIEW_LOCAL_INFORMATION,
@ -142,7 +142,7 @@ DsRolerGetPrimaryDomainInformation(
{
NET_API_STATUS ret;
TRACE("DsRolerGetPrimaryDomainInformation(%p, %d, %p)\n",
TRACE("DsRolerGetPrimaryDomainInformation(%p, %d, %p)\n",
hBinding, InfoLevel, DomainInfo);
switch (InfoLevel)

View file

@ -88,7 +88,7 @@ LsarpLookupPrivilegeName(PLUID Value,
return STATUS_NO_SUCH_PRIVILEGE;
}
for (Priv = 0; Priv < sizeof(WellKnownPrivileges) / sizeof(WellKnownPrivileges[0]); Priv++)
for (Priv = 0; Priv < ARRAYSIZE(WellKnownPrivileges); Priv++)
{
if (Value->LowPart == WellKnownPrivileges[Priv].Luid.LowPart &&
Value->HighPart == WellKnownPrivileges[Priv].Luid.HighPart)
@ -162,7 +162,7 @@ LsarpLookupPrivilegeValue(
if (Name->Length == 0 || Name->Buffer == NULL)
return NULL;
for (Priv = 0; Priv < sizeof(WellKnownPrivileges) / sizeof(WellKnownPrivileges[0]); Priv++)
for (Priv = 0; Priv < ARRAYSIZE(WellKnownPrivileges); Priv++)
{
if (_wcsicmp(Name->Buffer, WellKnownPrivileges[Priv].Name) == 0)
return (PLUID)&(WellKnownPrivileges[Priv].Luid);
@ -187,7 +187,7 @@ LsarpEnumeratePrivileges(DWORD *EnumerationContext,
EnumIndex = *EnumerationContext;
for (; EnumIndex < sizeof(WellKnownPrivileges) / sizeof(WellKnownPrivileges[0]); EnumIndex++)
for (; EnumIndex < ARRAYSIZE(WellKnownPrivileges); EnumIndex++)
{
TRACE("EnumIndex: %lu\n", EnumIndex);
TRACE("Privilege Name: %S\n", WellKnownPrivileges[EnumIndex].Name);
@ -276,7 +276,7 @@ LsapLookupAccountRightName(ULONG RightValue,
PRPC_UNICODE_STRING NameBuffer;
ULONG i;
for (i = 0; i < sizeof(WellKnownRights) / sizeof(WellKnownRights[0]); i++)
for (i = 0; i < ARRAYSIZE(WellKnownRights); i++)
{
if (WellKnownRights[i].Flag == RightValue)
{
@ -315,7 +315,7 @@ LsapLookupAccountRightValue(
if (Name->Length == 0 || Name->Buffer == NULL)
return 0;
for (i = 0; i < sizeof(WellKnownRights) / sizeof(WellKnownRights[0]); i++)
for (i = 0; i < ARRAYSIZE(WellKnownRights); i++)
{
if (_wcsicmp(Name->Buffer, WellKnownRights[i].Name) == 0)
return WellKnownRights[i].Flag;

View file

@ -132,7 +132,7 @@ LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
KeyInfo->NameLength);
/* Terminate the string */
Buffer[KeyInfo->NameLength / sizeof(WCHAR)] = 0;
Buffer[KeyInfo->NameLength / sizeof(WCHAR)] = UNICODE_NULL;
}
else
{
@ -268,7 +268,7 @@ LsapRegEnumerateValue(IN HANDLE KeyHandle,
ValueInfo->NameLength);
/* Terminate the string */
Name[ValueInfo->NameLength / sizeof(WCHAR)] = 0;
Name[ValueInfo->NameLength / sizeof(WCHAR)] = UNICODE_NULL;
}
else
{
@ -295,7 +295,7 @@ LsapRegEnumerateValue(IN HANDLE KeyHandle,
{
WCHAR *ptr = (WCHAR *)((ULONG_PTR)Data + ValueInfo->DataLength);
if ((ptr > (WCHAR *)Data) && ptr[-1])
*ptr = 0;
*ptr = UNICODE_NULL;
}
}
else
@ -383,7 +383,7 @@ LsapRegQueryValue(IN HANDLE KeyHandle,
{
WCHAR *ptr = (WCHAR *)((ULONG_PTR)Data + ValueInfo->DataLength);
if ((ptr > (WCHAR *)Data) && ptr[-1])
*ptr = 0;
*ptr = UNICODE_NULL;
}
}

View file

@ -125,7 +125,7 @@ LsapCreatePolicySd(PSECURITY_DESCRIPTOR *PolicySd,
/* Allocate and initialize the DACL */
DaclSize = sizeof(ACL) +
sizeof(ACCESS_DENIED_ACE) - sizeof(ULONG) + RtlLengthSid(AnonymousSid) +
sizeof(ACCESS_DENIED_ACE) - sizeof(ULONG) + RtlLengthSid(AnonymousSid) +
sizeof(ACCESS_ALLOWED_ACE) - sizeof(ULONG) + RtlLengthSid(AdministratorsSid) +
sizeof(ACCESS_ALLOWED_ACE) - sizeof(ULONG) + RtlLengthSid(EveryoneSid) +
sizeof(ACCESS_ALLOWED_ACE) - sizeof(ULONG) + RtlLengthSid(AnonymousSid) +

View file

@ -21,4 +21,4 @@ ServiceInit(VOID)
return STATUS_SUCCESS;
}
/* EOF */
/* EOF */