Author: pschweitzer
Date: Sun May 5 22:19:54 2013
New Revision: 58959
URL: http://svn.reactos.org/svn/reactos?rev=58959&view=rev
Log:
[RTL]
When we are impersonating, also set the flag, so that on release, we can kill it.
This hopefully fixes 2nd stage and the whole mess it was causing in privileges.
Modified:
trunk/reactos/lib/rtl/priv.c
Modified: trunk/reactos/lib/rtl/priv.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/priv.c?rev=58959&r…
==============================================================================
--- trunk/reactos/lib/rtl/priv.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/priv.c [iso-8859-1] Sun May 5 22:19:54 2013
@@ -247,8 +247,9 @@
goto Cleanup;
}
- /* Save said token */
+ /* Save said token and the fact we have impersonated */
State->Token = ImpersonationToken;
+ State->Flags |= RTL_ACQUIRE_PRIVILEGE_IMPERSONATE;
ZwClose(ProcessToken);
}
@@ -372,7 +373,9 @@
DPRINT("RtlReleasePrivilege(%p)\n", ReturnedState);
- /* If we had an active impersonation before we acquired privileges */
+ /* If we had an active impersonation before we acquired privileges
+ * Or if we have impersonated, quit it
+ */
if (State->Flags & RTL_ACQUIRE_PRIVILEGE_IMPERSONATE)
{
/* Restore it for the current thread */
Author: hbelusca
Date: Sun May 5 20:05:50 2013
New Revision: 58954
URL: http://svn.reactos.org/svn/reactos?rev=58954&view=rev
Log:
Legacy code from KdPortInitialize, which was put in KdPortInitializeEx, is deactivated because it was unusued (the actual code doesn't call KdPortInitialize).
Modified:
branches/kd++/drivers/base/kdrosdbg/i386/kdbg.c
Modified: branches/kd++/drivers/base/kdrosdbg/i386/kdbg.c
URL: http://svn.reactos.org/svn/reactos/branches/kd%2B%2B/drivers/base/kdrosdbg/…
==============================================================================
--- branches/kd++/drivers/base/kdrosdbg/i386/kdbg.c [iso-8859-1] (original)
+++ branches/kd++/drivers/base/kdrosdbg/i386/kdbg.c [iso-8859-1] Sun May 5 20:05:50 2013
@@ -122,7 +122,7 @@
static KD_PORT_INFORMATION DefaultPort = { 0, 0, 0 };
/* The com port must only be initialized once! */
-static BOOLEAN PortInitialized = FALSE;
+// static BOOLEAN PortInitialized = FALSE;
/* FUNCTIONS ****************************************************************/
@@ -135,15 +135,16 @@
IN ULONG Unknown1,
IN ULONG Unknown2)
{
- SIZE_T i;
ULONG ComPortBase;
CHAR buffer[80];
ULONG divisor;
UCHAR lcr;
+#if 0 // Deactivated because never used in fact (was in KdPortInitialize but we use KdPortInitializeEx)
/*
* Find the port if needed
*/
+ SIZE_T i;
if (!PortInitialized)
{
@@ -177,6 +178,7 @@
PortInitialized = TRUE;
}
+#endif
/*
* Initialize the port
@@ -271,17 +273,6 @@
return FALSE;
}
-/* HAL.KdPortPutByte */
-VOID
-NTAPI
-KdPortPutByte(
- IN UCHAR ByteToSend)
-{
- if (!PortInitialized)
- return;
- KdPortPutByteEx(&DefaultPort, ByteToSend);
-}
-
/* ReactOS-specific */
VOID
NTAPI
Author: pschweitzer
Date: Sun May 5 20:01:14 2013
New Revision: 58953
URL: http://svn.reactos.org/svn/reactos?rev=58953&view=rev
Log:
[KERNEL32]
Also "fix" hack of RtlAcquirePrivilege in SetSystemTime(). Spotted by Thomas.
Note for syssetup/rtl/kernel32 devs:
Make it crystal clear that this is a hack and has to be deleted once RAP is fine.
Also note that for SetLocalTime() and 2nd stage, syssetup acquires the privilege itself
in SetSystemLocalTime() before calling SetLocalTime().
This will also have to be deleted once RAP is working fine. Otherwise it will keep failing:
it is not possible to acquire a privilege already held.
Modified:
trunk/reactos/dll/win32/kernel32/client/time.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 20:01:14 2013
@@ -386,7 +386,7 @@
}
else
{
- DPRINT1("Workaround RtlAcquirePrivilege failure!\n");
+ DPRINT1("HACK: Workaround RtlAcquirePrivilege failure! Remove me once RAP is fine\n");
Status = NtSetSystemTime(&NewSystemTime, NULL);
}
@@ -427,11 +427,15 @@
}
Status = RtlAcquirePrivilege(&Privilege, 1, 0, &State);
- Status = STATUS_SUCCESS;
if (NT_SUCCESS(Status))
{
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))