https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6859348aeae8286f33f65…
commit 6859348aeae8286f33f659dad2fbe73ff54be20a
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Thu Jul 2 22:25:46 2020 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sat Jul 4 19:39:06 2020 +0200
[SVCHOST] Fix PSID initialization
CORE-17151
---
base/services/svchost/globals.c | 21 +++++++++++++++------
base/services/svchost/svchost.h | 4 ++--
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/base/services/svchost/globals.c b/base/services/svchost/globals.c
index 7acc7351835..3f77d725e68 100644
--- a/base/services/svchost/globals.c
+++ b/base/services/svchost/globals.c
@@ -234,7 +234,7 @@ ScDomainIdToSid (
NTSTATUS
NTAPI
ScAllocateAndInitializeSid (
- _Out_ PVOID *Sid,
+ _Out_ PSID *Sid,
_In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
_In_ ULONG SubAuthorityCount
)
@@ -274,13 +274,18 @@ ScCreateWellKnownSids (
for (i = 0; i < RTL_NUMBER_OF(SidData); i++)
{
/* Convert our optimized structure into an actual SID */
- Status = ScAllocateAndInitializeSid(&SidData[i].Sid,
+ Status = ScAllocateAndInitializeSid(SidData[i].Sid,
&SidData[i].Authority,
1);
- if (!NT_SUCCESS(Status)) break;
+
+ if (!NT_SUCCESS(Status))
+ {
+ DBG_ERR("ScAllocateAndInitializeSid failed for %u\n", i);
+ break;
+ }
/* Write the correct sub-authority */
- *RtlSubAuthoritySid(SidData[i].Sid, 0) = SidData[i].SubAuthority;
+ *RtlSubAuthoritySid(*SidData[i].Sid, 0) = SidData[i].SubAuthority;
}
/* Now loop the domain SIDs */
@@ -289,8 +294,12 @@ ScCreateWellKnownSids (
/* Convert our optimized structure into an actual SID */
Status = ScDomainIdToSid(BuiltinDomainSid,
DomainSidData[i].SubAuthority,
- &DomainSidData[i].Sid);
- if (!NT_SUCCESS(Status)) break;
+ DomainSidData[i].Sid);
+ if (!NT_SUCCESS(Status))
+ {
+ DBG_ERR("ScDomainIdToSid failed for %u\n", i);
+ break;
+ }
}
/* If we got to the end, return success */
diff --git a/base/services/svchost/svchost.h b/base/services/svchost/svchost.h
index 519394caff7..192ad994ad8 100644
--- a/base/services/svchost/svchost.h
+++ b/base/services/svchost/svchost.h
@@ -52,7 +52,7 @@ typedef VOID
//
typedef struct _DOMAIN_SID_DATA
{
- PSID Sid;
+ PSID* Sid;
DWORD SubAuthority;
} DOMAIN_SID_DATA;
@@ -61,7 +61,7 @@ typedef struct _DOMAIN_SID_DATA
//
typedef struct _SID_DATA
{
- PSID Sid;
+ PSID* Sid;
SID_IDENTIFIER_AUTHORITY Authority;
DWORD SubAuthority;
} SID_DATA;