[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

svn path=/trunk/; revision=57954
This commit is contained in:
Timo Kreuzer 2012-12-19 23:49:13 +00:00
parent ed547ad4a5
commit 1a64a18b5e
16 changed files with 163 additions and 112 deletions

View file

@ -154,9 +154,10 @@ MiZeroFillSection(PVOID Address, PLARGE_INTEGER FileOffsetPtr, ULONG Length)
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 @@ MiZeroFillSection(PVOID Address, PLARGE_INTEGER FileOffsetPtr, ULONG Length)
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
{

View file

@ -102,11 +102,12 @@ the page is present.
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 @@ In the ultimate form of this code, CoW is reenabled.
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 @@ MiCowCacheSectionPage(PMMSUPPORT AddressSpace,
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 @@ by fault handling, making recursive fault handling possible when required.
*/
_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 @@ MmpSectionAccessFaultInner(KPROCESSOR_MODE Mode,
KeInitializeEvent(&Context.Wait, NotificationEvent, FALSE);
ExInitializeWorkItem(&Context.WorkItem,
(PWORKER_THREAD_ROUTINE)MmpFaultWorker,
MmpFaultWorker,
&Context);
DPRINT("Queue work item\n");

View file

@ -71,6 +71,7 @@ This completion function is really required. Paging io completion does almost
nothing, including freeing the mdls.
*/
_Function_class_(IO_COMPLETION_ROUTINE)
NTSTATUS
NTAPI
MiSimpleReadComplete(PDEVICE_OBJECT DeviceObject,

View file

@ -251,13 +251,16 @@ NTAPI
MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment,
PLARGE_INTEGER FileOffset);
_Success_(1)
_When_(return==STATUS_MORE_PROCESSING_REQUIRED, _At_(Required->DoAcquisition, _Post_notnull_))
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);
NTSTATUS
NTAPI
@ -344,13 +347,16 @@ NTSTATUS
NTAPI
MmUnmapCacheViewInSystemSpace(PVOID Address);
_Success_(1)
_When_(return==STATUS_MORE_PROCESSING_REQUIRED, _At_(Required->DoAcquisition, _Post_notnull_))
NTSTATUS
NTAPI
MmNotPresentFaultCachePage(PMMSUPPORT AddressSpace,
PMEMORY_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
NTAPI

View file

@ -64,6 +64,7 @@ paging machinery.
extern KSPIN_LOCK MiSectionPageTableLock;
_Function_class_(RTL_GENERIC_ALLOCATE_ROUTINE)
static
PVOID
NTAPI
@ -75,6 +76,7 @@ MiSectionPageTableAllocate(PRTL_GENERIC_TABLE Table, CLONG Bytes)
return Result;
}
_Function_class_(RTL_GENERIC_FREE_ROUTINE)
static
VOID
NTAPI
@ -84,6 +86,7 @@ MiSectionPageTableFree(PRTL_GENERIC_TABLE Table, PVOID Data)
ExFreePoolWithTag(Data, 'MmPt');
}
_Function_class_(RTL_GENERIC_COMPARE_ROUTINE)
static
RTL_GENERIC_COMPARE_RESULTS
NTAPI
@ -341,7 +344,7 @@ MmGetSectionAssociation(PFN_NUMBER Page,
{
Segment = PageTable->Segment;
Offset->QuadPart = PageTable->FileOffset.QuadPart +
(RawOffset << PAGE_SHIFT);
((ULONG64)RawOffset << PAGE_SHIFT);
}
return Segment;

View file

@ -242,6 +242,7 @@ CcUnpinRepinnedBcb (
{
PINTERNAL_BCB iBcb = Bcb;
IoStatus->Status = STATUS_SUCCESS;
if (--iBcb->RefCount == 0)
{
IoStatus->Information = 0;

View file

@ -67,7 +67,12 @@ CmpInitializeRegistryNode(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
/* 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 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
{
/* EISA */
case EisaAdapter:
/* Fixup information */
Interface = Eisa;
Bus = CmpTypeCount[EisaAdapter]++;
@ -229,7 +234,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
/* Turbo-channel */
case TcAdapter:
/* Fixup information */
Interface = TurboChannel;
Bus = CmpTypeCount[TurboChannel]++;
@ -237,7 +242,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
/* ISA, PCI, etc busses */
case MultiFunctionAdapter:
/* Check if we have an identifier */
if (Component->Identifier)
{
@ -252,7 +257,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
break;
}
}
/* Fix up information */
Interface = CmpMultifunctionTypes[i].InterfaceType;
Bus = CmpMultifunctionTypes[i].Count++;
@ -261,7 +266,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
/* SCSI Bus */
case ScsiAdapter:
/* Fix up */
Interface = Internal;
Bus = CmpTypeCount[ScsiAdapter]++;
@ -274,7 +279,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
break;
}
}
/* Dump information on the component */
/* Setup the hardware node */
@ -285,7 +290,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
Bus,
DeviceIndexTable);
if (!NT_SUCCESS(Status)) return Status;
/* Check for children */
if (CurrentEntry->Child)
{
@ -301,12 +306,12 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
return Status;
}
}
/* Get to the next entry */
NtClose(NewHandle);
CurrentEntry = CurrentEntry->Sibling;
}
/* We're done */
return STATUS_SUCCESS;
}

View file

@ -35,6 +35,7 @@ KTIMER CmpDelayDerefKCBTimer;
/* FUNCTIONS *****************************************************************/
_Function_class_(KDEFERRED_ROUTINE)
VOID
NTAPI
CmpDelayCloseDpcRoutine(IN PKDPC Dpc,
@ -49,6 +50,7 @@ CmpDelayCloseDpcRoutine(IN PKDPC Dpc,
ExQueueWorkItem(&CmpDelayCloseWorkItem, DelayedWorkQueue);
}
_Function_class_(WORKER_THREAD_ROUTINE)
VOID
NTAPI
CmpDelayCloseWorker(IN PVOID Context)
@ -188,21 +190,22 @@ NTAPI
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 @@ CmpDelayDerefKCBDpcRoutine(IN PKDPC Dpc,
ExQueueWorkItem(&CmpDelayDerefKCBWorkItem, DelayedWorkQueue);
}
_Function_class_(WORKER_THREAD_ROUTINE)
VOID
NTAPI
CmpDelayDerefKCBWorker(IN PVOID Context)
@ -236,22 +240,22 @@ CmpDelayDerefKCBWorker(IN PVOID Context)
{
/* 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 @@ CmpArmDelayedCloseTimer(VOID)
{
LARGE_INTEGER Timeout;
PAGED_CODE();
/* Set the worker active */
CmpDelayCloseWorkItemActive = TRUE;
@ -424,36 +428,36 @@ CmpRemoveFromDelayedClose(IN PCM_KEY_CONTROL_BLOCK Kcb)
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 @@ CmpRemoveFromDelayedClose(IN PCM_KEY_CONTROL_BLOCK Kcb)
/* 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;
}

View file

@ -116,31 +116,31 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
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;
}
/*

View file

@ -38,13 +38,13 @@ CmpDoFlushNextHive(IN BOOLEAN ForceFlush,
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 @@ CmpDoFlushNextHive(IN BOOLEAN ForceFlush,
{
/* Great sucess! */
Result = TRUE;
/* Ignore clean or volatile hves */
if (!(CmHive->Hive.DirtyCount) ||
(CmHive->Hive.HiveFlags & HIVE_VOLATILE))
@ -100,7 +100,7 @@ CmpDoFlushNextHive(IN BOOLEAN ForceFlush,
/* Try the next one */
NextEntry = NextEntry->Flink;
}
/* Check if we've flushed everything */
if (NextEntry == &CmpHiveListHead)
{
@ -112,12 +112,13 @@ CmpDoFlushNextHive(IN BOOLEAN ForceFlush,
/* 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 @@ CmpEnableLazyFlushDpcRoutine(IN PKDPC Dpc,
CmpHoldLazyFlush = FALSE;
}
_Function_class_(KDEFERRED_ROUTINE)
VOID
NTAPI
CmpLazyFlushDpcRoutine(IN PKDPC Dpc,
@ -150,7 +152,7 @@ CmpLazyFlush(VOID)
{
LARGE_INTEGER DueTime;
PAGED_CODE();
/* Check if we should set the lazy flush timer */
if ((!CmpNoWrite) && (!CmpHoldLazyFlush))
{
@ -161,6 +163,7 @@ CmpLazyFlush(VOID)
}
}
_Function_class_(WORKER_THREAD_ROUTINE)
VOID
NTAPI
CmpLazyFlushWorker(IN PVOID Parameter)
@ -171,7 +174,7 @@ CmpLazyFlushWorker(IN PVOID Parameter)
/* 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 @@ CmpLazyFlushWorker(IN PVOID Parameter)
CmpLockRegistry();
InterlockedIncrement(&CmpFlushStarveWriters);
}
/* Flush the next hive */
MoreWork = CmpDoFlushNextHive(ForceFlush, &Result, &DirtyCount);
if (!MoreWork)
@ -200,7 +203,7 @@ CmpLazyFlushWorker(IN PVOID Parameter)
/* 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 @@ VOID
NTAPI
CmpCmdInit(IN BOOLEAN SetupBoot)
{
LARGE_INTEGER DueTime;
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 @@ CmpCmdInit(IN BOOLEAN SetupBoot)
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 @@ CmpCmdInit(IN BOOLEAN SetupBoot)
/* Setup flush variables */
CmpNoWrite = CmpMiniNTBoot;
CmpWasSetupBoot = SetupBoot;
/* Testing: Force Lazy Flushing */
CmpHoldLazyFlush = FALSE;
/* Setup the hive list */
CmpInitializeHiveList(SetupBoot);
}

View file

@ -433,7 +433,10 @@ ExCreateCallback(OUT PCALLBACK_OBJECT *CallbackObject,
}
/* Everything went fine, so return a pointer to the Object */
if (NT_SUCCESS(Status)) *CallbackObject = Callback;
if (NT_SUCCESS(Status))
{
*CallbackObject = Callback;
}
return Status;
}

View file

@ -51,6 +51,7 @@ GENERIC_MAPPING ExpKeyedEventMapping =
/* FUNCTIONS *****************************************************************/
_IRQL_requires_max_(APC_LEVEL)
BOOLEAN
INIT_FUNCTION
NTAPI
@ -116,6 +117,7 @@ ExpInitializeKeyedEvent(
}
}
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
ExpReleaseOrWaitForKeyedEvent(
@ -203,6 +205,7 @@ ExpReleaseOrWaitForKeyedEvent(
return STATUS_SUCCESS;
}
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
ExpWaitForKeyedEvent(
@ -219,6 +222,7 @@ ExpWaitForKeyedEvent(
FALSE);
}
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
ExpReleaseKeyedEvent(
@ -235,6 +239,7 @@ ExpReleaseKeyedEvent(
TRUE);
}
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
NtCreateKeyedEvent(
@ -311,6 +316,7 @@ NtCreateKeyedEvent(
return Status;
}
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
NtOpenKeyedEvent(
@ -359,6 +365,7 @@ NtOpenKeyedEvent(
return Status;
}
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
NtWaitForKeyedEvent(
@ -401,6 +408,7 @@ NtWaitForKeyedEvent(
return Status;
}
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
NTAPI
NtReleaseKeyedEvent(

View file

@ -209,7 +209,7 @@ NtSetDefaultLocale(IN BOOLEAN UserProfile,
HANDLE KeyHandle;
ULONG ValueLength;
WCHAR ValueBuffer[20];
HANDLE UserKey = NULL;
HANDLE UserKey;
NTSTATUS Status;
PAGED_CODE();
@ -231,6 +231,7 @@ NtSetDefaultLocale(IN BOOLEAN UserProfile,
L"\\Registry\\Machine\\System\\CurrentControlSet"
L"\\Control\\Nls\\Language");
RtlInitUnicodeString(&ValueName, L"Default");
UserKey = NULL;
}
/* Initailize the object attributes */
@ -286,7 +287,10 @@ NtSetDefaultLocale(IN BOOLEAN UserProfile,
}
/* Close the user key */
ZwClose(UserKey);
if (UserKey)
{
ObCloseHandle(UserKey, KernelMode);
}
/* Check for success */
if (NT_SUCCESS(Status))

View file

@ -133,6 +133,7 @@ ExpDeleteTimer(IN PVOID ObjectBody)
KeFlushQueuedDpcs();
}
_Function_class_(KDEFERRED_ROUTINE)
VOID
NTAPI
ExpTimerDpcRoutine(IN PKDPC Dpc,
@ -355,7 +356,8 @@ NtCancelTimer(IN HANDLE TimerHandle,
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
/* Do nothing */
(void)0;
}
_SEH2_END;
}
@ -445,7 +447,8 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
/* Do nothing */
(void)0;
}
_SEH2_END;
}
@ -500,7 +503,8 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
/* Do nothing */
(void)0;
}
_SEH2_END;
}
@ -629,9 +633,9 @@ NtSetTimer(IN HANDLE TimerHandle,
(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 @@ NtSetTimer(IN HANDLE TimerHandle,
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
/* Do nothing */
(void)0;
}
_SEH2_END;
}

View file

@ -841,8 +841,8 @@ Ki386PerfEnd(VOID)
{
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()));

View file

@ -237,10 +237,12 @@ IopDisplayLoadingMessage(PUNICODE_STRING ServiceName)
* 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;