Author: tkreuzer
Date: Wed Dec 19 23:49:13 2012
New Revision: 57954
URL:
http://svn.reactos.org/svn/reactos?rev=57954&view=rev
Log:
[NTOSKRNL]
- Add some missing return value checks
- Add some annotations
- Fix format specifiers
- Fix variable scope conflicts
- Fix possible closing of a NULL handle
- Use ObCloseHandle instead of ZwClose
Modified:
trunk/reactos/ntoskrnl/cache/section/data.c
trunk/reactos/ntoskrnl/cache/section/fault.c
trunk/reactos/ntoskrnl/cache/section/io.c
trunk/reactos/ntoskrnl/cache/section/newmm.h
trunk/reactos/ntoskrnl/cache/section/sptab.c
trunk/reactos/ntoskrnl/cc/pin.c
trunk/reactos/ntoskrnl/config/cmconfig.c
trunk/reactos/ntoskrnl/config/cmdelay.c
trunk/reactos/ntoskrnl/config/cmhook.c
trunk/reactos/ntoskrnl/config/cmlazy.c
trunk/reactos/ntoskrnl/ex/callback.c
trunk/reactos/ntoskrnl/ex/keyedevt.c
trunk/reactos/ntoskrnl/ex/locale.c
trunk/reactos/ntoskrnl/ex/timer.c
trunk/reactos/ntoskrnl/include/internal/i386/ke.h
trunk/reactos/ntoskrnl/io/iomgr/driver.c
Modified: trunk/reactos/ntoskrnl/cache/section/data.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/dat…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -154,9 +154,10 @@
DPRINT("Pulling zero pages for %08x%08x-%08x%08x\n",
FileOffset.u.HighPart, FileOffset.u.LowPart,
End.u.HighPart, End.u.LowPart);
+
while (FileOffset.QuadPart < End.QuadPart)
{
- PVOID Address;
+ PVOID CurrentAddress;
ULONG_PTR Entry;
if (!NT_SUCCESS(MmRequestPageMemoryConsumer(MC_CACHE, TRUE, &Page)))
@@ -169,14 +170,14 @@
if (Entry == 0)
{
MmSetPageEntrySectionSegment(Segment, &FileOffset, MAKE_PFN_SSE(Page));
- Address = ((PCHAR)MemoryArea->StartingAddress) + FileOffset.QuadPart -
FirstMapped.QuadPart;
+ CurrentAddress = ((PCHAR)MemoryArea->StartingAddress) +
FileOffset.QuadPart - FirstMapped.QuadPart;
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmReferencePage(Page);
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
- MmCreateVirtualMapping(NULL, Address, PAGE_READWRITE, &Page, 1);
- MmInsertRmap(Page, NULL, Address);
+ MmCreateVirtualMapping(NULL, CurrentAddress, PAGE_READWRITE, &Page, 1);
+ MmInsertRmap(Page, NULL, CurrentAddress);
}
else
{
Modified: trunk/reactos/ntoskrnl/cache/section/fault.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/fau…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/fault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/fault.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -102,11 +102,12 @@
NTSTATUS
NTAPI
-MmNotPresentFaultCachePage(PMMSUPPORT AddressSpace,
- MEMORY_AREA* MemoryArea,
- PVOID Address,
- BOOLEAN Locked,
- PMM_REQUIRED_RESOURCES Required)
+MmNotPresentFaultCachePage (
+ _In_ PMMSUPPORT AddressSpace,
+ _In_ MEMORY_AREA* MemoryArea,
+ _In_ PVOID Address,
+ _In_ BOOLEAN Locked,
+ _Inout_ PMM_REQUIRED_RESOURCES Required)
{
NTSTATUS Status;
PVOID PAddress;
@@ -317,11 +318,12 @@
NTSTATUS
NTAPI
-MiCowCacheSectionPage(PMMSUPPORT AddressSpace,
- PMEMORY_AREA MemoryArea,
- PVOID Address,
- BOOLEAN Locked,
- PMM_REQUIRED_RESOURCES Required)
+MiCowCacheSectionPage (
+ _In_ PMMSUPPORT AddressSpace,
+ _In_ PMEMORY_AREA MemoryArea,
+ _In_ PVOID Address,
+ _In_ BOOLEAN Locked,
+ _Inout_ PMM_REQUIRED_RESOURCES Required)
{
PMM_SECTION_SEGMENT Segment;
PFN_NUMBER NewPage, OldPage;
@@ -422,8 +424,8 @@
DPRINT("Allocated page %x\n", NewPage);
- /* Unshare the old page */
- MmDeleteRmap(OldPage, Process, PAddress);
+ /* Unshare the old page */
+ MmDeleteRmap(OldPage, Process, PAddress);
/* Copy the old page */
DPRINT("Copying\n");
@@ -474,10 +476,13 @@
*/
+_Function_class_(WORKER_THREAD_ROUTINE)
VOID
NTAPI
-MmpFaultWorker(PWORK_QUEUE_WITH_CONTEXT WorkItem)
+MmpFaultWorker(PVOID Parameter)
{
+ PWORK_QUEUE_WITH_CONTEXT WorkItem = Parameter;
+
DPRINT("Calling work\n");
WorkItem->Status =
WorkItem->Required->DoAcquisition(WorkItem->AddressSpace,
WorkItem->MemoryArea,
@@ -622,7 +627,7 @@
KeInitializeEvent(&Context.Wait, NotificationEvent, FALSE);
ExInitializeWorkItem(&Context.WorkItem,
- (PWORKER_THREAD_ROUTINE)MmpFaultWorker,
+ MmpFaultWorker,
&Context);
DPRINT("Queue work item\n");
Modified: trunk/reactos/ntoskrnl/cache/section/io.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/io.…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/io.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/io.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -71,6 +71,7 @@
nothing, including freeing the mdls.
*/
+_Function_class_(IO_COMPLETION_ROUTINE)
NTSTATUS
NTAPI
MiSimpleReadComplete(PDEVICE_OBJECT DeviceObject,
Modified: trunk/reactos/ntoskrnl/cache/section/newmm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/new…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/newmm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/newmm.h [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -251,13 +251,16 @@
MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment,
PLARGE_INTEGER FileOffset);
-NTSTATUS
-NTAPI
-MiCowCacheSectionPage(PMMSUPPORT AddressSpace,
- PMEMORY_AREA MemoryArea,
- PVOID Address,
- BOOLEAN Locked,
- PMM_REQUIRED_RESOURCES Required);
+_Success_(1)
+_When_(return==STATUS_MORE_PROCESSING_REQUIRED, _At_(Required->DoAcquisition,
_Post_notnull_))
+NTSTATUS
+NTAPI
+MiCowCacheSectionPage (
+ _In_ PMMSUPPORT AddressSpace,
+ _In_ PMEMORY_AREA MemoryArea,
+ _In_ PVOID Address,
+ _In_ BOOLEAN Locked,
+ _Inout_ PMM_REQUIRED_RESOURCES Required);
NTSTATUS
NTAPI
@@ -344,13 +347,16 @@
NTAPI
MmUnmapCacheViewInSystemSpace(PVOID Address);
-NTSTATUS
-NTAPI
-MmNotPresentFaultCachePage(PMMSUPPORT AddressSpace,
- PMEMORY_AREA MemoryArea,
- PVOID Address,
- BOOLEAN Locked,
- PMM_REQUIRED_RESOURCES Required);
+_Success_(1)
+_When_(return==STATUS_MORE_PROCESSING_REQUIRED, _At_(Required->DoAcquisition,
_Post_notnull_))
+NTSTATUS
+NTAPI
+MmNotPresentFaultCachePage (
+ _In_ PMMSUPPORT AddressSpace,
+ _In_ MEMORY_AREA* MemoryArea,
+ _In_ PVOID Address,
+ _In_ BOOLEAN Locked,
+ _Inout_ PMM_REQUIRED_RESOURCES Required);
NTSTATUS
NTAPI
Modified: trunk/reactos/ntoskrnl/cache/section/sptab.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/spt…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/sptab.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/sptab.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -64,6 +64,7 @@
extern KSPIN_LOCK MiSectionPageTableLock;
+_Function_class_(RTL_GENERIC_ALLOCATE_ROUTINE)
static
PVOID
NTAPI
@@ -75,6 +76,7 @@
return Result;
}
+_Function_class_(RTL_GENERIC_FREE_ROUTINE)
static
VOID
NTAPI
@@ -84,6 +86,7 @@
ExFreePoolWithTag(Data, 'MmPt');
}
+_Function_class_(RTL_GENERIC_COMPARE_ROUTINE)
static
RTL_GENERIC_COMPARE_RESULTS
NTAPI
@@ -341,7 +344,7 @@
{
Segment = PageTable->Segment;
Offset->QuadPart = PageTable->FileOffset.QuadPart +
- (RawOffset << PAGE_SHIFT);
+ ((ULONG64)RawOffset << PAGE_SHIFT);
}
return Segment;
Modified: trunk/reactos/ntoskrnl/cc/pin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/pin.c?rev=5795…
==============================================================================
--- trunk/reactos/ntoskrnl/cc/pin.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cc/pin.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -242,6 +242,7 @@
{
PINTERNAL_BCB iBcb = Bcb;
+ IoStatus->Status = STATUS_SUCCESS;
if (--iBcb->RefCount == 0)
{
IoStatus->Information = 0;
Modified: trunk/reactos/ntoskrnl/config/cmconfig.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmconfig.c…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmconfig.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmconfig.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -67,7 +67,12 @@
/* Convert it to Unicode */
RtlInitEmptyUnicodeString(&KeyName, Buffer, sizeof(Buffer));
- RtlAnsiStringToUnicodeString(&KeyName, &TempString, FALSE);
+ Status = RtlAnsiStringToUnicodeString(&KeyName, &TempString, FALSE);
+ if (!NT_SUCCESS(Status))
+ {
+ NtClose(KeyHandle);
+ return Status;
+ }
/* Create the key */
ParentHandle = KeyHandle;
@@ -221,7 +226,7 @@
{
/* EISA */
case EisaAdapter:
-
+
/* Fixup information */
Interface = Eisa;
Bus = CmpTypeCount[EisaAdapter]++;
@@ -229,7 +234,7 @@
/* Turbo-channel */
case TcAdapter:
-
+
/* Fixup information */
Interface = TurboChannel;
Bus = CmpTypeCount[TurboChannel]++;
@@ -237,7 +242,7 @@
/* ISA, PCI, etc busses */
case MultiFunctionAdapter:
-
+
/* Check if we have an identifier */
if (Component->Identifier)
{
@@ -252,7 +257,7 @@
break;
}
}
-
+
/* Fix up information */
Interface = CmpMultifunctionTypes[i].InterfaceType;
Bus = CmpMultifunctionTypes[i].Count++;
@@ -261,7 +266,7 @@
/* SCSI Bus */
case ScsiAdapter:
-
+
/* Fix up */
Interface = Internal;
Bus = CmpTypeCount[ScsiAdapter]++;
@@ -274,7 +279,7 @@
break;
}
}
-
+
/* Dump information on the component */
/* Setup the hardware node */
@@ -285,7 +290,7 @@
Bus,
DeviceIndexTable);
if (!NT_SUCCESS(Status)) return Status;
-
+
/* Check for children */
if (CurrentEntry->Child)
{
@@ -301,12 +306,12 @@
return Status;
}
}
-
+
/* Get to the next entry */
NtClose(NewHandle);
CurrentEntry = CurrentEntry->Sibling;
}
-
+
/* We're done */
return STATUS_SUCCESS;
}
Modified: trunk/reactos/ntoskrnl/config/cmdelay.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmdelay.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmdelay.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmdelay.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -35,6 +35,7 @@
/* FUNCTIONS *****************************************************************/
+_Function_class_(KDEFERRED_ROUTINE)
VOID
NTAPI
CmpDelayCloseDpcRoutine(IN PKDPC Dpc,
@@ -49,6 +50,7 @@
ExQueueWorkItem(&CmpDelayCloseWorkItem, DelayedWorkQueue);
}
+_Function_class_(WORKER_THREAD_ROUTINE)
VOID
NTAPI
CmpDelayCloseWorker(IN PVOID Context)
@@ -188,21 +190,22 @@
INIT_FUNCTION
CmpInitializeDelayedCloseTable(VOID)
{
-
+
/* Setup the delayed close lock */
KeInitializeGuardedMutex(&CmpDelayedCloseTableLock);
-
+
/* Setup the work item */
ExInitializeWorkItem(&CmpDelayCloseWorkItem, CmpDelayCloseWorker, NULL);
-
+
/* Setup the list head */
InitializeListHead(&CmpDelayedLRUListHead);
-
+
/* Setup the DPC and its timer */
KeInitializeDpc(&CmpDelayCloseDpc, CmpDelayCloseDpcRoutine, NULL);
KeInitializeTimer(&CmpDelayCloseTimer);
}
+_Function_class_(KDEFERRED_ROUTINE)
VOID
NTAPI
CmpDelayDerefKCBDpcRoutine(IN PKDPC Dpc,
@@ -217,6 +220,7 @@
ExQueueWorkItem(&CmpDelayDerefKCBWorkItem, DelayedWorkQueue);
}
+_Function_class_(WORKER_THREAD_ROUTINE)
VOID
NTAPI
CmpDelayDerefKCBWorker(IN PVOID Context)
@@ -236,22 +240,22 @@
{
/* Grab an entry */
Entry = (PVOID)RemoveHeadList(&CmpDelayDerefKCBListHead);
-
+
/* We can release the lock now */
KeReleaseGuardedMutex(&CmpDelayDerefKCBLock);
-
+
/* Now grab the actual entry */
Entry = CONTAINING_RECORD(Entry, CM_DELAY_DEREF_KCB_ITEM, ListEntry);
Entry->ListEntry.Flink = Entry->ListEntry.Blink = NULL;
-
+
/* Dereference and free */
CmpDereferenceKeyControlBlock(Entry->Kcb);
CmpFreeDelayItem(Entry);
-
+
/* Lock the list again */
KeAcquireGuardedMutex(&CmpDelayDerefKCBLock);
}
-
+
/* We're done */
CmpDelayDerefKCBWorkItemActive = FALSE;
KeReleaseGuardedMutex(&CmpDelayDerefKCBLock);
@@ -332,7 +336,7 @@
{
LARGE_INTEGER Timeout;
PAGED_CODE();
-
+
/* Set the worker active */
CmpDelayCloseWorkItemActive = TRUE;
@@ -424,36 +428,36 @@
PCM_DELAYED_CLOSE_ENTRY Entry;
ULONG NewRefCount, OldRefCount;
PAGED_CODE();
-
+
/* Sanity checks */
ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) ||
(CmpTestRegistryLockExclusive() == TRUE));
if (Kcb->DelayedCloseIndex == CmpDelayedCloseSize) ASSERT(FALSE);
-
+
/* Get the entry and lock the table */
Entry = Kcb->DelayCloseEntry;
ASSERT(Entry);
KeAcquireGuardedMutex(&CmpDelayedCloseTableLock);
-
+
/* Remove the entry */
RemoveEntryList(&Entry->DelayedLRUList);
-
+
/* Release the lock */
KeReleaseGuardedMutex(&CmpDelayedCloseTableLock);
-
+
/* Free the entry */
CmpFreeDelayItem(Entry);
-
+
/* Reduce the number of elements */
InterlockedDecrement((PLONG)&CmpDelayedCloseElements);
-
+
/* Sanity check */
if (!Kcb->InDelayClose) ASSERT(FALSE);
-
+
/* Get the previous reference count */
OldRefCount = *(PLONG)&Kcb->InDelayClose;
ASSERT(OldRefCount == 1);
-
+
/* Write the new one */
NewRefCount = 0;
if (InterlockedCompareExchange((PLONG)&Kcb->InDelayClose,
@@ -463,10 +467,10 @@
/* Sanity check */
ASSERT(FALSE);
}
-
+
/* Remove the link to the entry */
Kcb->DelayCloseEntry = NULL;
-
+
/* Set new delay size and remove the delete flag */
Kcb->DelayedCloseIndex = CmpDelayedCloseSize;
}
Modified: trunk/reactos/ntoskrnl/config/cmhook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmhook.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmhook.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmhook.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -116,31 +116,31 @@
ASSERT(Function && Cookie);
Callback = ExAllocatePoolWithTag(PagedPool,
- sizeof(REGISTRY_CALLBACK),
- 'bcMC');
- if (Callback != NULL)
+ sizeof(REGISTRY_CALLBACK),
+ 'bcMC');
+ if (Callback == NULL)
{
- /* initialize the callback */
- ExInitializeRundownProtection(&Callback->RundownRef);
- Callback->Function = Function;
- Callback->Context = Context;
- Callback->PendingDelete = FALSE;
-
- /* add it to the callback list and receive a cookie for the callback */
- ExAcquireFastMutex(&CmiCallbackLock);
-
- /* FIXME - to receive a unique cookie we'll just return the pointer to the
- callback object */
- Callback->Cookie.QuadPart = (ULONG_PTR)Callback;
- InsertTailList(&CmiCallbackHead, &Callback->ListEntry);
-
- ExReleaseFastMutex(&CmiCallbackLock);
-
- *Cookie = Callback->Cookie;
- return STATUS_SUCCESS;
+ return STATUS_INSUFFICIENT_RESOURCES;
}
- return STATUS_INSUFFICIENT_RESOURCES;
+ /* initialize the callback */
+ ExInitializeRundownProtection(&Callback->RundownRef);
+ Callback->Function = Function;
+ Callback->Context = Context;
+ Callback->PendingDelete = FALSE;
+
+ /* add it to the callback list and receive a cookie for the callback */
+ ExAcquireFastMutex(&CmiCallbackLock);
+
+ /* FIXME - to receive a unique cookie we'll just return the pointer to the
+ callback object */
+ Callback->Cookie.QuadPart = (ULONG_PTR)Callback;
+ InsertTailList(&CmiCallbackHead, &Callback->ListEntry);
+
+ ExReleaseFastMutex(&CmiCallbackLock);
+
+ *Cookie = Callback->Cookie;
+ return STATUS_SUCCESS;
}
/*
Modified: trunk/reactos/ntoskrnl/config/cmlazy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmlazy.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmlazy.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmlazy.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -38,13 +38,13 @@
NTSTATUS Status;
PLIST_ENTRY NextEntry;
PCMHIVE CmHive;
- BOOLEAN Result;
+ BOOLEAN Result;
ULONG HiveCount = CmpLazyFlushHiveCount;
/* Set Defaults */
*Error = FALSE;
*DirtyCount = 0;
-
+
/* Don't do anything if we're not supposed to */
if (CmpNoWrite) return TRUE;
@@ -66,7 +66,7 @@
{
/* Great sucess! */
Result = TRUE;
-
+
/* Ignore clean or volatile hves */
if (!(CmHive->Hive.DirtyCount) ||
(CmHive->Hive.HiveFlags & HIVE_VOLATILE))
@@ -100,7 +100,7 @@
/* Try the next one */
NextEntry = NextEntry->Flink;
}
-
+
/* Check if we've flushed everything */
if (NextEntry == &CmpHiveListHead)
{
@@ -112,12 +112,13 @@
/* We need to be called again */
Result = TRUE;
}
-
+
/* Unlock the list and return the result */
ExReleasePushLock(&CmpHiveListHeadLock);
return Result;
}
+_Function_class_(KDEFERRED_ROUTINE)
VOID
NTAPI
CmpEnableLazyFlushDpcRoutine(IN PKDPC Dpc,
@@ -129,6 +130,7 @@
CmpHoldLazyFlush = FALSE;
}
+_Function_class_(KDEFERRED_ROUTINE)
VOID
NTAPI
CmpLazyFlushDpcRoutine(IN PKDPC Dpc,
@@ -150,7 +152,7 @@
{
LARGE_INTEGER DueTime;
PAGED_CODE();
-
+
/* Check if we should set the lazy flush timer */
if ((!CmpNoWrite) && (!CmpHoldLazyFlush))
{
@@ -161,6 +163,7 @@
}
}
+_Function_class_(WORKER_THREAD_ROUTINE)
VOID
NTAPI
CmpLazyFlushWorker(IN PVOID Parameter)
@@ -171,7 +174,7 @@
/* Don't do anything if lazy flushing isn't enabled yet */
if (CmpHoldLazyFlush) return;
-
+
/* Check if we are forcing a flush */
ForceFlush = CmpForceForceFlush;
if (ForceFlush)
@@ -185,7 +188,7 @@
CmpLockRegistry();
InterlockedIncrement(&CmpFlushStarveWriters);
}
-
+
/* Flush the next hive */
MoreWork = CmpDoFlushNextHive(ForceFlush, &Result, &DirtyCount);
if (!MoreWork)
@@ -200,7 +203,7 @@
/* Not pending anymore, release the registry lock */
CmpLazyFlushPending = FALSE;
CmpUnlockRegistry();
-
+
/* Check if we need to flush another hive */
if ((MoreWork) || (DirtyCount)) CmpLazyFlush();
}
@@ -209,15 +212,15 @@
NTAPI
CmpCmdInit(IN BOOLEAN SetupBoot)
{
- LARGE_INTEGER DueTime;
- PAGED_CODE();
-
+ LARGE_INTEGER DueTime;
+ PAGED_CODE();
+
/* Setup the lazy DPC */
KeInitializeDpc(&CmpLazyFlushDpc, CmpLazyFlushDpcRoutine, NULL);
-
+
/* Setup the lazy timer */
KeInitializeTimer(&CmpLazyFlushTimer);
-
+
/* Setup the lazy worker */
ExInitializeWorkItem(&CmpLazyWorkItem, CmpLazyFlushWorker, NULL);
@@ -226,7 +229,7 @@
CmpEnableLazyFlushDpcRoutine,
NULL);
KeInitializeTimer(&CmpEnableLazyFlushTimer);
-
+
/* Enable lazy flushing after 10 minutes */
DueTime.QuadPart = Int32x32To64(600, -10 * 1000 * 1000);
KeSetTimer(&CmpEnableLazyFlushTimer, DueTime, &CmpEnableLazyFlushDpc);
@@ -234,10 +237,10 @@
/* Setup flush variables */
CmpNoWrite = CmpMiniNTBoot;
CmpWasSetupBoot = SetupBoot;
-
+
/* Testing: Force Lazy Flushing */
CmpHoldLazyFlush = FALSE;
-
+
/* Setup the hive list */
CmpInitializeHiveList(SetupBoot);
}
Modified: trunk/reactos/ntoskrnl/ex/callback.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/callback.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/callback.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/callback.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -433,7 +433,10 @@
}
/* Everything went fine, so return a pointer to the Object */
- if (NT_SUCCESS(Status)) *CallbackObject = Callback;
+ if (NT_SUCCESS(Status))
+ {
+ *CallbackObject = Callback;
+ }
return Status;
}
Modified: trunk/reactos/ntoskrnl/ex/keyedevt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/keyedevt.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/keyedevt.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/keyedevt.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -51,6 +51,7 @@
/* FUNCTIONS *****************************************************************/
+_IRQL_requires_max_(APC_LEVEL)
BOOLEAN
INIT_FUNCTION
NTAPI
@@ -116,6 +117,7 @@
}
}
+_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
ExpReleaseOrWaitForKeyedEvent(
@@ -203,6 +205,7 @@
return STATUS_SUCCESS;
}
+_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
ExpWaitForKeyedEvent(
@@ -219,6 +222,7 @@
FALSE);
}
+_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
ExpReleaseKeyedEvent(
@@ -235,6 +239,7 @@
TRUE);
}
+_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
NtCreateKeyedEvent(
@@ -311,6 +316,7 @@
return Status;
}
+_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
NtOpenKeyedEvent(
@@ -359,6 +365,7 @@
return Status;
}
+_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
NtWaitForKeyedEvent(
@@ -401,6 +408,7 @@
return Status;
}
+_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
NtReleaseKeyedEvent(
Modified: trunk/reactos/ntoskrnl/ex/locale.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/locale.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/locale.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/locale.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -209,7 +209,7 @@
HANDLE KeyHandle;
ULONG ValueLength;
WCHAR ValueBuffer[20];
- HANDLE UserKey = NULL;
+ HANDLE UserKey;
NTSTATUS Status;
PAGED_CODE();
@@ -231,6 +231,7 @@
L"\\Registry\\Machine\\System\\CurrentControlSet"
L"\\Control\\Nls\\Language");
RtlInitUnicodeString(&ValueName, L"Default");
+ UserKey = NULL;
}
/* Initailize the object attributes */
@@ -286,7 +287,10 @@
}
/* Close the user key */
- ZwClose(UserKey);
+ if (UserKey)
+ {
+ ObCloseHandle(UserKey, KernelMode);
+ }
/* Check for success */
if (NT_SUCCESS(Status))
Modified: trunk/reactos/ntoskrnl/ex/timer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/timer.c?rev=57…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/timer.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/timer.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -133,6 +133,7 @@
KeFlushQueuedDpcs();
}
+_Function_class_(KDEFERRED_ROUTINE)
VOID
NTAPI
ExpTimerDpcRoutine(IN PKDPC Dpc,
@@ -355,7 +356,8 @@
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
-
+ /* Do nothing */
+ (void)0;
}
_SEH2_END;
}
@@ -445,7 +447,8 @@
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
-
+ /* Do nothing */
+ (void)0;
}
_SEH2_END;
}
@@ -500,7 +503,8 @@
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
-
+ /* Do nothing */
+ (void)0;
}
_SEH2_END;
}
@@ -629,9 +633,9 @@
(PVOID*)&Timer,
NULL);
- /*
+ /*
* Tell the user we don't support Wake Timers...
- * when we have the ability to use/detect the Power Management
+ * when we have the ability to use/detect the Power Management
* functionality required to support them, make this check dependent
* on the actual PM capabilities
*/
@@ -740,7 +744,8 @@
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
-
+ /* Do nothing */
+ (void)0;
}
_SEH2_END;
}
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Wed Dec 19 23:49:13
2012
@@ -841,8 +841,8 @@
{
extern ULONGLONG BootCyclesEnd, BootCycles;
BootCyclesEnd = __rdtsc();
- DbgPrint("Boot took %I64d cycles!\n", BootCyclesEnd - BootCycles);
- DbgPrint("Interrupts: %d System Calls: %d Context Switches: %d\n",
+ DbgPrint("Boot took %I64u cycles!\n", BootCyclesEnd - BootCycles);
+ DbgPrint("Interrupts: %u System Calls: %u Context Switches: %u\n",
KeGetCurrentPrcb()->InterruptCount,
KeGetCurrentPrcb()->KeSystemCalls,
KeGetContextSwitches(KeGetCurrentPrcb()));
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Wed Dec 19 23:49:13 2012
@@ -237,10 +237,12 @@
* The input image path isn't freed on error.
*/
-NTSTATUS FASTCALL
+NTSTATUS
+FASTCALL
IopNormalizeImagePath(
- IN OUT PUNICODE_STRING ImagePath,
- IN PUNICODE_STRING ServiceName)
+ _Inout_ _When_(return>=0, _At_(ImagePath->Buffer, _Post_notnull_
__drv_allocatesMem(Mem)))
+ PUNICODE_STRING ImagePath,
+ _In_ PUNICODE_STRING ServiceName)
{
UNICODE_STRING InputImagePath;