[NTOSKRNL]

- Fix 2 broken failure cases (forgot to detach from process and/or forgot to dereference process)

svn path=/trunk/; revision=54389
This commit is contained in:
Cameron Gutman 2011-11-15 22:16:57 +00:00
parent fcb309055e
commit 75ff9ef0c0

View file

@ -683,6 +683,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
{
/* Fail without it */
DPRINT1("Privilege not held for MEM_LARGE_PAGES\n");
if (Attached) KeUnstackDetachProcess(&ApcState);
if (ProcessHandle != NtCurrentProcess()) ObDereferenceObject(Process);
return STATUS_PRIVILEGE_NOT_HELD;
}
@ -701,6 +702,8 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
(Protect & (PAGE_WRITECOPY | PAGE_EXECUTE_WRITECOPY)))
{
DPRINT1("Copy on write is not supported by VirtualAlloc\n");
if (Attached) KeUnstackDetachProcess(&ApcState);
if (ProcessHandle != NtCurrentProcess()) ObDereferenceObject(Process);
return STATUS_INVALID_PAGE_PROTECTION;
}