[KMTESTS]

- MmSection: properly clean up on failure
- Some more x64 build fixing

svn path=/trunk/; revision=53712
This commit is contained in:
Thomas Faber 2011-09-15 16:49:22 +00:00
parent 8f6cfb2651
commit 2fca6b111a
2 changed files with 33 additions and 10 deletions

View file

@ -88,8 +88,13 @@ static VOID LocalName(PKSPIN_LOCK SpinLock, PCHECK_DATA CheckData) \
DEFINE_ACQUIRE(AcquireNormal, TRUE, KeAcquireSpinLock(SpinLock, &CheckData->Irql))
DEFINE_RELEASE(ReleaseNormal, TRUE, KeReleaseSpinLock(SpinLock, CheckData->Irql))
#ifdef _X86_
DEFINE_ACQUIRE(AcquireExp, TRUE, (KeAcquireSpinLock)(SpinLock, &CheckData->Irql))
DEFINE_RELEASE(ReleaseExp, TRUE, (KeReleaseSpinLock)(SpinLock, CheckData->Irql))
#else
DEFINE_ACQUIRE(AcquireExp, TRUE, KeAcquireSpinLock(SpinLock, &CheckData->Irql))
DEFINE_RELEASE(ReleaseExp, TRUE, KeReleaseSpinLock(SpinLock, CheckData->Irql))
#endif
DEFINE_ACQUIRE(AcquireSynch, TRUE, CheckData->Irql = KeAcquireSpinLockRaiseToSynch(SpinLock))
DEFINE_ACQUIRE(AcquireInStackQueued, TRUE, KeAcquireInStackQueuedSpinLock(SpinLock, &CheckData->QueueHandle))

View file

@ -14,7 +14,7 @@ START_TEST(MmSection)
{
NTSTATUS Status = STATUS_SUCCESS;
NTSTATUS ExceptionStatus;
const PVOID InvalidPointer = (PVOID)0x5555555555555555LLU;
const PVOID InvalidPointer = (PVOID)0x5555555555555555ULL;
PVOID SectionObject;
LARGE_INTEGER MaximumSize;
@ -42,6 +42,9 @@ START_TEST(MmSection)
ok_eq_hex(Status, STATUS_INVALID_PAGE_PROTECTION);
ok_eq_pointer(SectionObject, InvalidPointer);
if (SectionObject && SectionObject != InvalidPointer)
ObDereferenceObject(SectionObject);
StartSeh()
Status = MmCreateSection(NULL, 0, NULL, NULL, PAGE_READONLY, SEC_RESERVE, NULL, NULL);
EndSeh(STATUS_ACCESS_VIOLATION);
@ -52,6 +55,21 @@ START_TEST(MmSection)
EndSeh(STATUS_ACCESS_VIOLATION);
ok_eq_pointer(SectionObject, InvalidPointer);
if (SectionObject && SectionObject != InvalidPointer)
ObDereferenceObject(SectionObject);
SectionObject = InvalidPointer;
MaximumSize.QuadPart = 0;
StartSeh()
Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_IMAGE, NULL, NULL);
EndSeh(STATUS_SUCCESS);
ok_eq_hex(Status, STATUS_INVALID_FILE_FOR_SECTION);
ok_eq_longlong(MaximumSize.QuadPart, 0LL);
ok_eq_pointer(SectionObject, InvalidPointer);
if (SectionObject && SectionObject != InvalidPointer)
ObDereferenceObject(SectionObject);
MaximumSize.QuadPart = 0;
StartSeh()
Status = MmCreateSection(NULL, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_RESERVE, NULL, NULL);
@ -59,12 +77,18 @@ START_TEST(MmSection)
ok_eq_hex(Status, STATUS_INVALID_PARAMETER_4);
ok_eq_longlong(MaximumSize.QuadPart, 0LL);
if (SectionObject && SectionObject != InvalidPointer)
ObDereferenceObject(SectionObject);
MaximumSize.QuadPart = 1;
StartSeh()
Status = MmCreateSection(NULL, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_RESERVE, NULL, NULL);
EndSeh(STATUS_ACCESS_VIOLATION);
ok_eq_longlong(MaximumSize.QuadPart, 1LL);
if (SectionObject && SectionObject != InvalidPointer)
ObDereferenceObject(SectionObject);
SectionObject = InvalidPointer;
MaximumSize.QuadPart = 0;
StartSeh()
@ -74,6 +98,9 @@ START_TEST(MmSection)
ok_eq_longlong(MaximumSize.QuadPart, 0LL);
ok_eq_pointer(SectionObject, InvalidPointer);
if (SectionObject && SectionObject != InvalidPointer)
ObDereferenceObject(SectionObject);
SectionObject = InvalidPointer;
MaximumSize.QuadPart = 1;
StartSeh()
@ -86,13 +113,4 @@ START_TEST(MmSection)
if (SectionObject && SectionObject != InvalidPointer)
ObDereferenceObject(SectionObject);
SectionObject = InvalidPointer;
MaximumSize.QuadPart = 1;
StartSeh()
Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_IMAGE, NULL, NULL);
EndSeh(STATUS_SUCCESS);
ok_eq_hex(Status, STATUS_INVALID_FILE_FOR_SECTION);
ok_eq_longlong(MaximumSize.QuadPart, 1LL);
ok_eq_pointer(SectionObject, InvalidPointer);
}