Author: tfaber Date: Thu Sep 15 16:49:22 2011 New Revision: 53712
URL: http://svn.reactos.org/svn/reactos?rev=53712&view=rev Log: [KMTESTS] - MmSection: properly clean up on failure - Some more x64 build fixing
Modified: trunk/rostests/kmtests/ntos_ke/KeSpinLock.c trunk/rostests/kmtests/ntos_mm/MmSection.c
Modified: trunk/rostests/kmtests/ntos_ke/KeSpinLock.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_ke/KeSpinLock... ============================================================================== --- trunk/rostests/kmtests/ntos_ke/KeSpinLock.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_ke/KeSpinLock.c [iso-8859-1] Thu Sep 15 16:49:22 2011 @@ -88,8 +88,13 @@
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))
Modified: trunk/rostests/kmtests/ntos_mm/MmSection.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/MmSection.... ============================================================================== --- trunk/rostests/kmtests/ntos_mm/MmSection.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/MmSection.c [iso-8859-1] Thu Sep 15 16:49:22 2011 @@ -14,7 +14,7 @@ { 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 @@ 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 @@ 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,11 +77,17 @@ 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; @@ -73,6 +97,9 @@ ok_eq_hex(Status, STATUS_INVALID_PARAMETER_4); ok_eq_longlong(MaximumSize.QuadPart, 0LL); ok_eq_pointer(SectionObject, InvalidPointer); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject);
SectionObject = InvalidPointer; MaximumSize.QuadPart = 1; @@ -86,13 +113,4 @@
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); }