Use the allocated buffer size in the call to NtGetPlugPlayEvent.
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
_____
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
--- trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-02-05 10:31:37 UTC
(rev 13421)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-02-05 10:54:00 UTC
(rev 13422)
@@ -79,7 +79,7 @@
DPRINT("Calling NtGetPlugPlayEvent()\n");
/* Wait for the next pnp event */
- Status = NtGetPlugPlayEvent(0, 0, PnpEvent, 1024);
+ Status = NtGetPlugPlayEvent(0, 0, PnpEvent, PnpEventSize);
/* Resize the buffer for the PnP event if it's too small. */
if (Status == STATUS_BUFFER_TOO_SMALL)
{
only attach to the process to be queried when necessary
Modified: trunk/reactos/ntoskrnl/ke/spinlock.c
Modified: trunk/reactos/ntoskrnl/ps/process.c
_____
Modified: trunk/reactos/ntoskrnl/ke/spinlock.c
--- trunk/reactos/ntoskrnl/ke/spinlock.c 2005-02-05 10:19:49 UTC
(rev 13420)
+++ trunk/reactos/ntoskrnl/ke/spinlock.c 2005-02-05 10:31:37 UTC
(rev 13421)
@@ -195,9 +195,7 @@
:
: "r" (SpinLock));
#else
- while (0 != *(volatile PKSPIN_LOCK)SpinLock)
- {
- }
+ while (0 != *(volatile KSPIN_LOCK*)SpinLock);
#endif
#else
DbgPrint("Spinning on spinlock %x current value %x\n", SpinLock,
i);
_____
Modified: trunk/reactos/ntoskrnl/ps/process.c
--- trunk/reactos/ntoskrnl/ps/process.c 2005-02-05 10:19:49 UTC (rev
13420)
+++ trunk/reactos/ntoskrnl/ps/process.c 2005-02-05 10:31:37 UTC (rev
13421)
@@ -1613,11 +1613,15 @@
{
PRTL_USER_PROCESS_PARAMETERS ProcParams = NULL;
UNICODE_STRING LocalDest;
+ BOOLEAN Attached;
ULONG ImagePathLen = 0;
PUNICODE_STRING DstPath =
(PUNICODE_STRING)ProcessInformation;
/* we need to attach to the process to make sure we're in the
right context! */
- KeAttachProcess(&Process->Pcb);
+ Attached = Process != PsGetCurrentProcess();
+
+ if(Attached)
+ KeAttachProcess(&Process->Pcb);
_SEH_TRY
{
@@ -1677,7 +1681,8 @@
_SEH_END;
/* detach from the process */
- KeDetachProcess();
+ if(Attached)
+ KeDetachProcess();
/* only copy the string back to the caller if we were
able to
copy it into the temporary buffer! */
@@ -1715,7 +1720,8 @@
}
/* don't forget to detach from the process!!! */
- KeDetachProcess();
+ if(Attached)
+ KeDetachProcess();
}
else
{