mirror of
https://github.com/reactos/reactos.git
synced 2025-07-25 09:13:53 +00:00
only attach to the process to be queried when necessary
svn path=/trunk/; revision=13421
This commit is contained in:
parent
7cd9c86676
commit
bb766d5404
2 changed files with 10 additions and 6 deletions
|
@ -195,9 +195,7 @@ KiAcquireSpinLock(PKSPIN_LOCK SpinLock)
|
||||||
:
|
:
|
||||||
: "r" (SpinLock));
|
: "r" (SpinLock));
|
||||||
#else
|
#else
|
||||||
while (0 != *(volatile PKSPIN_LOCK)SpinLock)
|
while (0 != *(volatile KSPIN_LOCK*)SpinLock);
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
DbgPrint("Spinning on spinlock %x current value %x\n", SpinLock, i);
|
DbgPrint("Spinning on spinlock %x current value %x\n", SpinLock, i);
|
||||||
|
|
|
@ -1613,10 +1613,14 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
||||||
{
|
{
|
||||||
PRTL_USER_PROCESS_PARAMETERS ProcParams = NULL;
|
PRTL_USER_PROCESS_PARAMETERS ProcParams = NULL;
|
||||||
UNICODE_STRING LocalDest;
|
UNICODE_STRING LocalDest;
|
||||||
|
BOOLEAN Attached;
|
||||||
ULONG ImagePathLen = 0;
|
ULONG ImagePathLen = 0;
|
||||||
PUNICODE_STRING DstPath = (PUNICODE_STRING)ProcessInformation;
|
PUNICODE_STRING DstPath = (PUNICODE_STRING)ProcessInformation;
|
||||||
|
|
||||||
/* we need to attach to the process to make sure we're in the right context! */
|
/* we need to attach to the process to make sure we're in the right context! */
|
||||||
|
Attached = Process != PsGetCurrentProcess();
|
||||||
|
|
||||||
|
if(Attached)
|
||||||
KeAttachProcess(&Process->Pcb);
|
KeAttachProcess(&Process->Pcb);
|
||||||
|
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
|
@ -1677,6 +1681,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
||||||
_SEH_END;
|
_SEH_END;
|
||||||
|
|
||||||
/* detach from the process */
|
/* detach from the process */
|
||||||
|
if(Attached)
|
||||||
KeDetachProcess();
|
KeDetachProcess();
|
||||||
|
|
||||||
/* only copy the string back to the caller if we were able to
|
/* only copy the string back to the caller if we were able to
|
||||||
|
@ -1715,6 +1720,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't forget to detach from the process!!! */
|
/* don't forget to detach from the process!!! */
|
||||||
|
if(Attached)
|
||||||
KeDetachProcess();
|
KeDetachProcess();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue