https://git.reactos.org/?p=reactos.git;a=commitdiff;h=31c4c2efe90818bf430c2…
commit 31c4c2efe90818bf430c2a876750326ba0a9ba80
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Sep 26 18:58:28 2021 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Sep 26 19:04:08 2021 +0200
[USER32] GetUserObjectSecurity/SetUserObjectSecurity: Just use UserSetLastNTError() in
failure path.
---
win32ss/user/user32/misc/misc.c | 44 ++++++++++++++++-------------------------
1 file changed, 17 insertions(+), 27 deletions(-)
diff --git a/win32ss/user/user32/misc/misc.c b/win32ss/user/user32/misc/misc.c
index 5c8e961c305..621ec567f8e 100644
--- a/win32ss/user/user32/misc/misc.c
+++ b/win32ss/user/user32/misc/misc.c
@@ -80,21 +80,16 @@ GetUserObjectSecurity(
OUT PDWORD pdwLengthNeeded
)
{
-DWORD dwWin32Error;
-NTSTATUS Status;
-
-
- Status = NtQuerySecurityObject(
- hObject, // Object Handle
- *pSecurityInfo, // Security Information
- pSecurityDescriptor,// Security Descriptor
- dwLength, // Buffer Length
- pdwLengthNeeded // Actual Length
- );
-
- if ( ! NT_SUCCESS( Status ) ) {
- dwWin32Error = RtlNtStatusToDosError( Status );
- NtCurrentTeb()->LastErrorValue = dwWin32Error;
+ NTSTATUS Status;
+
+ Status = NtQuerySecurityObject(hObject,
+ *pSecurityInfo,
+ pSecurityDescriptor,
+ dwLength,
+ pdwLengthNeeded);
+ if (!NT_SUCCESS(Status))
+ {
+ UserSetLastNTError(Status);
return FALSE;
}
@@ -128,19 +123,14 @@ SetUserObjectSecurity(
IN PSECURITY_DESCRIPTOR pSecurityDescriptor
)
{
-DWORD dwWin32Error;
-NTSTATUS Status;
+ NTSTATUS Status;
-
- Status = NtSetSecurityObject(
- hObject, // Object Handle
- *pSecurityInfo, // Security Information
- pSecurityDescriptor // Security Descriptor
- );
-
- if ( ! NT_SUCCESS( Status ) ) {
- dwWin32Error = RtlNtStatusToDosError( Status );
- NtCurrentTeb()->LastErrorValue = dwWin32Error;
+ Status = NtSetSecurityObject(hObject,
+ *pSecurityInfo,
+ pSecurityDescriptor);
+ if (!NT_SUCCESS(Status))
+ {
+ UserSetLastNTError(Status);
return FALSE;
}