Author: pschweitzer
Date: Sun May 5 17:32:00 2013
New Revision: 58946
URL:
http://svn.reactos.org/svn/reactos?rev=58946&view=rev
Log:
[RTL]
Add a few DPRINTs.
Fix a bug where last status was overrided in case of failure.
Still commented out...
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=58946&a…
==============================================================================
--- trunk/reactos/lib/rtl/priv.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/priv.c [iso-8859-1] Sun May 5 17:32:00 2013
@@ -113,12 +113,14 @@
OUT PVOID *ReturnedState)
{
#if 0
- NTSTATUS Status;
PRTL_ACQUIRE_STATE State;
+ NTSTATUS Status, IntStatus;
ULONG ReturnLength, i, OldSize;
SECURITY_QUALITY_OF_SERVICE Sqos;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE ImpersonationToken = 0, ProcessToken;
+
+ DPRINT("RtlAcquirePrivilege(%p, %u, %u, %p)\n", Privilege, NumPriv, Flags,
ReturnedState);
/* Validate flags */
if (Flags & ~(RTL_ACQUIRE_PRIVILEGE_PROCESS |
RTL_ACQUIRE_PRIVILEGE_IMPERSONATE))
@@ -283,6 +285,7 @@
State->OldPrivileges = RtlAllocateHeap(RtlGetProcessHeap(), 0,
ReturnLength);
if (State->OldPrivileges)
{
+ DPRINT("Allocated old privileges: %p\n",
State->OldPrivileges);
OldSize = ReturnLength;
continue;
}
@@ -313,6 +316,8 @@
*ReturnedState = State;
}
} while (FALSE);
+
+ DPRINT("RtlAcquirePrivilege succeed!\n");
return Status;
@@ -326,12 +331,12 @@
/* Do we have to restore previously active impersonation? */
if (State->Flags & RTL_ACQUIRE_PRIVILEGE_IMPERSONATE)
{
- Status = ZwSetInformationThread(NtCurrentThread(), ThreadImpersonationToken,
- &State->OldImpersonationToken,
sizeof(HANDLE));
+ IntStatus = ZwSetInformationThread(NtCurrentThread(), ThreadImpersonationToken,
+ &State->OldImpersonationToken,
sizeof(HANDLE));
/* If this ever happens, we're in a really bad situation... */
- if (!NT_SUCCESS(Status))
- {
- RtlRaiseStatus(Status);
+ if (!NT_SUCCESS(IntStatus))
+ {
+ RtlRaiseStatus(IntStatus);
}
}
@@ -343,6 +348,8 @@
/* And free our state buffer */
RtlFreeHeap(RtlGetProcessHeap(), 0, State);
+
+ DPRINT("RtlAcquirePrivilege() failed with status: %lx\n", Status);
return Status;
#else
@@ -362,6 +369,8 @@
NTSTATUS Status;
PRTL_ACQUIRE_STATE State = (PRTL_ACQUIRE_STATE)ReturnedState;
+ DPRINT("RtlReleasePrivilege(%p)\n", ReturnedState);
+
/* If we had an active impersonation before we acquired privileges */
if (State->Flags & RTL_ACQUIRE_PRIVILEGE_IMPERSONATE)
{
@@ -388,6 +397,7 @@
/* If we used a different buffer for old privileges, just free it */
if ((PVOID)State->OldPrivBuffer != (PVOID)State->OldPrivileges)
{
+ DPRINT("Releasing old privileges: %p\n", State->OldPrivileges);
RtlFreeHeap(RtlGetProcessHeap(), 0, State->OldPrivileges);
}