Author: pschweitzer
Date: Sun May 5 22:31:17 2013
New Revision: 58960
URL:
http://svn.reactos.org/svn/reactos?rev=58960&view=rev
Log:
[RTL]
Finally reenable RtlAcquirePrivilege and RtlReleasePrivilege now that they are fixed.
[KERNEL32]
Remove the hacks in SetSystemTime() and SetLocalTime() now that RtlAcquirePrivilege is
working properly.
[SYSSETUP]
Remove the hack for privileges in SetSystemLocalTime() now that SetLocalTime() can
properly acquire needed privilege.
CORE-7168 #comment Fixed with r58960 #resolve
Modified:
trunk/reactos/dll/win32/kernel32/client/time.c
trunk/reactos/dll/win32/syssetup/wizard.c
trunk/reactos/lib/rtl/priv.c
Modified: trunk/reactos/dll/win32/kernel32/client/time.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/time.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/time.c [iso-8859-1] Sun May 5 22:31:17 2013
@@ -384,11 +384,6 @@
Status = NtSetSystemTime(&NewSystemTime, NULL);
RtlReleasePrivilege(State);
}
- else
- {
- DPRINT1("HACK: Workaround RtlAcquirePrivilege failure! Remove me once RAP is
fine\n");
- Status = NtSetSystemTime(&NewSystemTime, NULL);
- }
if (!NT_SUCCESS(Status))
{
@@ -432,11 +427,6 @@
Status = NtSetSystemTime(&NewSystemTime, NULL);
RtlReleasePrivilege(State);
}
- else
- {
- DPRINT1("HACK: Workaround RtlAcquirePrivilege failure! Remove me once RAP is
fine\n");
- Status = NtSetSystemTime(&NewSystemTime, NULL);
- }
if (!NT_SUCCESS(Status))
{
Modified: trunk/reactos/dll/win32/syssetup/wizard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/wizard.…
==============================================================================
--- trunk/reactos/dll/win32/syssetup/wizard.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/syssetup/wizard.c [iso-8859-1] Sun May 5 22:31:17 2013
@@ -1374,57 +1374,13 @@
static BOOL
SetSystemLocalTime(HWND hwnd, PSETUPDATA SetupData)
{
- HANDLE hToken;
- DWORD PrevSize;
- TOKEN_PRIVILEGES priv, previouspriv;
BOOL Ret = FALSE;
/*
- * enable the SeSystemtimePrivilege privilege
+ * Call SetLocalTime twice to ensure correct results
*/
-
- if(OpenProcessToken(GetCurrentProcess(),
- TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
- &hToken))
- {
- priv.PrivilegeCount = 1;
- priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-
- if(LookupPrivilegeValue(NULL,
- SE_SYSTEMTIME_NAME,
- &priv.Privileges[0].Luid))
- {
- if(AdjustTokenPrivileges(hToken,
- FALSE,
- &priv,
- sizeof(previouspriv),
- &previouspriv,
- &PrevSize) &&
- GetLastError() == ERROR_SUCCESS)
- {
- /*
- * We successfully enabled it, we're permitted to change the system
time
- * Call SetLocalTime twice to ensure correct results
- */
- Ret = SetLocalTime(&SetupData->SystemTime) &&
- SetLocalTime(&SetupData->SystemTime);
-
- /*
- * for the sake of security, restore the previous status again
- */
- if(previouspriv.PrivilegeCount > 0)
- {
- AdjustTokenPrivileges(hToken,
- FALSE,
- &previouspriv,
- 0,
- NULL,
- 0);
- }
- }
- }
- CloseHandle(hToken);
- }
+ Ret = SetLocalTime(&SetupData->SystemTime) &&
+ SetLocalTime(&SetupData->SystemTime);
return Ret;
}
Modified: trunk/reactos/lib/rtl/priv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/priv.c?rev=58960&a…
==============================================================================
--- trunk/reactos/lib/rtl/priv.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/priv.c [iso-8859-1] Sun May 5 22:31:17 2013
@@ -11,7 +11,7 @@
#include <rtl.h>
-//#define NDEBUG
+#define NDEBUG
#include <debug.h>
/* FUNCTIONS ***************************************************************/
@@ -112,7 +112,6 @@
IN ULONG Flags,
OUT PVOID *ReturnedState)
{
-#if 0
PRTL_ACQUIRE_STATE State;
NTSTATUS Status, IntStatus;
ULONG ReturnLength, i, OldSize;
@@ -354,10 +353,6 @@
DPRINT("RtlAcquirePrivilege() failed with status: %lx\n", Status);
return Status;
-#else
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-#endif
}
/*
@@ -367,7 +362,6 @@
NTAPI
RtlReleasePrivilege(IN PVOID ReturnedState)
{
-#if 0
NTSTATUS Status;
PRTL_ACQUIRE_STATE State = (PRTL_ACQUIRE_STATE)ReturnedState;
@@ -408,9 +402,6 @@
/* Release token and free state */
ZwClose(State->Token);
RtlFreeHeap(RtlGetProcessHeap(), 0, State);
-#else
- UNIMPLEMENTED;
-#endif
}
/*