mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 12:26:09 +00:00
[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:
parent
ed547ad4a5
commit
1a64a18b5e
16 changed files with 163 additions and 112 deletions
9
reactos/ntoskrnl/cache/section/data.c
vendored
9
reactos/ntoskrnl/cache/section/data.c
vendored
|
@ -154,9 +154,10 @@ MiZeroFillSection(PVOID Address, PLARGE_INTEGER FileOffsetPtr, ULONG Length)
|
||||||
DPRINT("Pulling zero pages for %08x%08x-%08x%08x\n",
|
DPRINT("Pulling zero pages for %08x%08x-%08x%08x\n",
|
||||||
FileOffset.u.HighPart, FileOffset.u.LowPart,
|
FileOffset.u.HighPart, FileOffset.u.LowPart,
|
||||||
End.u.HighPart, End.u.LowPart);
|
End.u.HighPart, End.u.LowPart);
|
||||||
|
|
||||||
while (FileOffset.QuadPart < End.QuadPart)
|
while (FileOffset.QuadPart < End.QuadPart)
|
||||||
{
|
{
|
||||||
PVOID Address;
|
PVOID CurrentAddress;
|
||||||
ULONG_PTR Entry;
|
ULONG_PTR Entry;
|
||||||
|
|
||||||
if (!NT_SUCCESS(MmRequestPageMemoryConsumer(MC_CACHE, TRUE, &Page)))
|
if (!NT_SUCCESS(MmRequestPageMemoryConsumer(MC_CACHE, TRUE, &Page)))
|
||||||
|
@ -169,14 +170,14 @@ MiZeroFillSection(PVOID Address, PLARGE_INTEGER FileOffsetPtr, ULONG Length)
|
||||||
if (Entry == 0)
|
if (Entry == 0)
|
||||||
{
|
{
|
||||||
MmSetPageEntrySectionSegment(Segment, &FileOffset, MAKE_PFN_SSE(Page));
|
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);
|
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||||
MmReferencePage(Page);
|
MmReferencePage(Page);
|
||||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||||
|
|
||||||
MmCreateVirtualMapping(NULL, Address, PAGE_READWRITE, &Page, 1);
|
MmCreateVirtualMapping(NULL, CurrentAddress, PAGE_READWRITE, &Page, 1);
|
||||||
MmInsertRmap(Page, NULL, Address);
|
MmInsertRmap(Page, NULL, CurrentAddress);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
33
reactos/ntoskrnl/cache/section/fault.c
vendored
33
reactos/ntoskrnl/cache/section/fault.c
vendored
|
@ -102,11 +102,12 @@ the page is present.
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmNotPresentFaultCachePage(PMMSUPPORT AddressSpace,
|
MmNotPresentFaultCachePage (
|
||||||
MEMORY_AREA* MemoryArea,
|
_In_ PMMSUPPORT AddressSpace,
|
||||||
PVOID Address,
|
_In_ MEMORY_AREA* MemoryArea,
|
||||||
BOOLEAN Locked,
|
_In_ PVOID Address,
|
||||||
PMM_REQUIRED_RESOURCES Required)
|
_In_ BOOLEAN Locked,
|
||||||
|
_Inout_ PMM_REQUIRED_RESOURCES Required)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID PAddress;
|
PVOID PAddress;
|
||||||
|
@ -317,11 +318,12 @@ In the ultimate form of this code, CoW is reenabled.
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MiCowCacheSectionPage(PMMSUPPORT AddressSpace,
|
MiCowCacheSectionPage (
|
||||||
PMEMORY_AREA MemoryArea,
|
_In_ PMMSUPPORT AddressSpace,
|
||||||
PVOID Address,
|
_In_ PMEMORY_AREA MemoryArea,
|
||||||
BOOLEAN Locked,
|
_In_ PVOID Address,
|
||||||
PMM_REQUIRED_RESOURCES Required)
|
_In_ BOOLEAN Locked,
|
||||||
|
_Inout_ PMM_REQUIRED_RESOURCES Required)
|
||||||
{
|
{
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
PFN_NUMBER NewPage, OldPage;
|
PFN_NUMBER NewPage, OldPage;
|
||||||
|
@ -422,8 +424,8 @@ MiCowCacheSectionPage(PMMSUPPORT AddressSpace,
|
||||||
|
|
||||||
DPRINT("Allocated page %x\n", NewPage);
|
DPRINT("Allocated page %x\n", NewPage);
|
||||||
|
|
||||||
/* Unshare the old page */
|
/* Unshare the old page */
|
||||||
MmDeleteRmap(OldPage, Process, PAddress);
|
MmDeleteRmap(OldPage, Process, PAddress);
|
||||||
|
|
||||||
/* Copy the old page */
|
/* Copy the old page */
|
||||||
DPRINT("Copying\n");
|
DPRINT("Copying\n");
|
||||||
|
@ -474,10 +476,13 @@ by fault handling, making recursive fault handling possible when required.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
_Function_class_(WORKER_THREAD_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmpFaultWorker(PWORK_QUEUE_WITH_CONTEXT WorkItem)
|
MmpFaultWorker(PVOID Parameter)
|
||||||
{
|
{
|
||||||
|
PWORK_QUEUE_WITH_CONTEXT WorkItem = Parameter;
|
||||||
|
|
||||||
DPRINT("Calling work\n");
|
DPRINT("Calling work\n");
|
||||||
WorkItem->Status = WorkItem->Required->DoAcquisition(WorkItem->AddressSpace,
|
WorkItem->Status = WorkItem->Required->DoAcquisition(WorkItem->AddressSpace,
|
||||||
WorkItem->MemoryArea,
|
WorkItem->MemoryArea,
|
||||||
|
@ -622,7 +627,7 @@ MmpSectionAccessFaultInner(KPROCESSOR_MODE Mode,
|
||||||
KeInitializeEvent(&Context.Wait, NotificationEvent, FALSE);
|
KeInitializeEvent(&Context.Wait, NotificationEvent, FALSE);
|
||||||
|
|
||||||
ExInitializeWorkItem(&Context.WorkItem,
|
ExInitializeWorkItem(&Context.WorkItem,
|
||||||
(PWORKER_THREAD_ROUTINE)MmpFaultWorker,
|
MmpFaultWorker,
|
||||||
&Context);
|
&Context);
|
||||||
|
|
||||||
DPRINT("Queue work item\n");
|
DPRINT("Queue work item\n");
|
||||||
|
|
1
reactos/ntoskrnl/cache/section/io.c
vendored
1
reactos/ntoskrnl/cache/section/io.c
vendored
|
@ -71,6 +71,7 @@ This completion function is really required. Paging io completion does almost
|
||||||
nothing, including freeing the mdls.
|
nothing, including freeing the mdls.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
_Function_class_(IO_COMPLETION_ROUTINE)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MiSimpleReadComplete(PDEVICE_OBJECT DeviceObject,
|
MiSimpleReadComplete(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
26
reactos/ntoskrnl/cache/section/newmm.h
vendored
26
reactos/ntoskrnl/cache/section/newmm.h
vendored
|
@ -251,13 +251,16 @@ NTAPI
|
||||||
MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment,
|
MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment,
|
||||||
PLARGE_INTEGER FileOffset);
|
PLARGE_INTEGER FileOffset);
|
||||||
|
|
||||||
|
_Success_(1)
|
||||||
|
_When_(return==STATUS_MORE_PROCESSING_REQUIRED, _At_(Required->DoAcquisition, _Post_notnull_))
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MiCowCacheSectionPage(PMMSUPPORT AddressSpace,
|
MiCowCacheSectionPage (
|
||||||
PMEMORY_AREA MemoryArea,
|
_In_ PMMSUPPORT AddressSpace,
|
||||||
PVOID Address,
|
_In_ PMEMORY_AREA MemoryArea,
|
||||||
BOOLEAN Locked,
|
_In_ PVOID Address,
|
||||||
PMM_REQUIRED_RESOURCES Required);
|
_In_ BOOLEAN Locked,
|
||||||
|
_Inout_ PMM_REQUIRED_RESOURCES Required);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -344,13 +347,16 @@ NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmUnmapCacheViewInSystemSpace(PVOID Address);
|
MmUnmapCacheViewInSystemSpace(PVOID Address);
|
||||||
|
|
||||||
|
_Success_(1)
|
||||||
|
_When_(return==STATUS_MORE_PROCESSING_REQUIRED, _At_(Required->DoAcquisition, _Post_notnull_))
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmNotPresentFaultCachePage(PMMSUPPORT AddressSpace,
|
MmNotPresentFaultCachePage (
|
||||||
PMEMORY_AREA MemoryArea,
|
_In_ PMMSUPPORT AddressSpace,
|
||||||
PVOID Address,
|
_In_ MEMORY_AREA* MemoryArea,
|
||||||
BOOLEAN Locked,
|
_In_ PVOID Address,
|
||||||
PMM_REQUIRED_RESOURCES Required);
|
_In_ BOOLEAN Locked,
|
||||||
|
_Inout_ PMM_REQUIRED_RESOURCES Required);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
5
reactos/ntoskrnl/cache/section/sptab.c
vendored
5
reactos/ntoskrnl/cache/section/sptab.c
vendored
|
@ -64,6 +64,7 @@ paging machinery.
|
||||||
|
|
||||||
extern KSPIN_LOCK MiSectionPageTableLock;
|
extern KSPIN_LOCK MiSectionPageTableLock;
|
||||||
|
|
||||||
|
_Function_class_(RTL_GENERIC_ALLOCATE_ROUTINE)
|
||||||
static
|
static
|
||||||
PVOID
|
PVOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -75,6 +76,7 @@ MiSectionPageTableAllocate(PRTL_GENERIC_TABLE Table, CLONG Bytes)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(RTL_GENERIC_FREE_ROUTINE)
|
||||||
static
|
static
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -84,6 +86,7 @@ MiSectionPageTableFree(PRTL_GENERIC_TABLE Table, PVOID Data)
|
||||||
ExFreePoolWithTag(Data, 'MmPt');
|
ExFreePoolWithTag(Data, 'MmPt');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(RTL_GENERIC_COMPARE_ROUTINE)
|
||||||
static
|
static
|
||||||
RTL_GENERIC_COMPARE_RESULTS
|
RTL_GENERIC_COMPARE_RESULTS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -341,7 +344,7 @@ MmGetSectionAssociation(PFN_NUMBER Page,
|
||||||
{
|
{
|
||||||
Segment = PageTable->Segment;
|
Segment = PageTable->Segment;
|
||||||
Offset->QuadPart = PageTable->FileOffset.QuadPart +
|
Offset->QuadPart = PageTable->FileOffset.QuadPart +
|
||||||
(RawOffset << PAGE_SHIFT);
|
((ULONG64)RawOffset << PAGE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Segment;
|
return Segment;
|
||||||
|
|
|
@ -242,6 +242,7 @@ CcUnpinRepinnedBcb (
|
||||||
{
|
{
|
||||||
PINTERNAL_BCB iBcb = Bcb;
|
PINTERNAL_BCB iBcb = Bcb;
|
||||||
|
|
||||||
|
IoStatus->Status = STATUS_SUCCESS;
|
||||||
if (--iBcb->RefCount == 0)
|
if (--iBcb->RefCount == 0)
|
||||||
{
|
{
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
|
|
|
@ -67,7 +67,12 @@ CmpInitializeRegistryNode(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
|
|
||||||
/* Convert it to Unicode */
|
/* Convert it to Unicode */
|
||||||
RtlInitEmptyUnicodeString(&KeyName, Buffer, sizeof(Buffer));
|
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 */
|
/* Create the key */
|
||||||
ParentHandle = KeyHandle;
|
ParentHandle = KeyHandle;
|
||||||
|
@ -221,7 +226,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
{
|
{
|
||||||
/* EISA */
|
/* EISA */
|
||||||
case EisaAdapter:
|
case EisaAdapter:
|
||||||
|
|
||||||
/* Fixup information */
|
/* Fixup information */
|
||||||
Interface = Eisa;
|
Interface = Eisa;
|
||||||
Bus = CmpTypeCount[EisaAdapter]++;
|
Bus = CmpTypeCount[EisaAdapter]++;
|
||||||
|
@ -229,7 +234,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
|
|
||||||
/* Turbo-channel */
|
/* Turbo-channel */
|
||||||
case TcAdapter:
|
case TcAdapter:
|
||||||
|
|
||||||
/* Fixup information */
|
/* Fixup information */
|
||||||
Interface = TurboChannel;
|
Interface = TurboChannel;
|
||||||
Bus = CmpTypeCount[TurboChannel]++;
|
Bus = CmpTypeCount[TurboChannel]++;
|
||||||
|
@ -237,7 +242,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
|
|
||||||
/* ISA, PCI, etc busses */
|
/* ISA, PCI, etc busses */
|
||||||
case MultiFunctionAdapter:
|
case MultiFunctionAdapter:
|
||||||
|
|
||||||
/* Check if we have an identifier */
|
/* Check if we have an identifier */
|
||||||
if (Component->Identifier)
|
if (Component->Identifier)
|
||||||
{
|
{
|
||||||
|
@ -252,7 +257,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fix up information */
|
/* Fix up information */
|
||||||
Interface = CmpMultifunctionTypes[i].InterfaceType;
|
Interface = CmpMultifunctionTypes[i].InterfaceType;
|
||||||
Bus = CmpMultifunctionTypes[i].Count++;
|
Bus = CmpMultifunctionTypes[i].Count++;
|
||||||
|
@ -261,7 +266,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
|
|
||||||
/* SCSI Bus */
|
/* SCSI Bus */
|
||||||
case ScsiAdapter:
|
case ScsiAdapter:
|
||||||
|
|
||||||
/* Fix up */
|
/* Fix up */
|
||||||
Interface = Internal;
|
Interface = Internal;
|
||||||
Bus = CmpTypeCount[ScsiAdapter]++;
|
Bus = CmpTypeCount[ScsiAdapter]++;
|
||||||
|
@ -274,7 +279,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump information on the component */
|
/* Dump information on the component */
|
||||||
|
|
||||||
/* Setup the hardware node */
|
/* Setup the hardware node */
|
||||||
|
@ -285,7 +290,7 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
Bus,
|
Bus,
|
||||||
DeviceIndexTable);
|
DeviceIndexTable);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* Check for children */
|
/* Check for children */
|
||||||
if (CurrentEntry->Child)
|
if (CurrentEntry->Child)
|
||||||
{
|
{
|
||||||
|
@ -301,12 +306,12 @@ CmpSetupConfigurationTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get to the next entry */
|
/* Get to the next entry */
|
||||||
NtClose(NewHandle);
|
NtClose(NewHandle);
|
||||||
CurrentEntry = CurrentEntry->Sibling;
|
CurrentEntry = CurrentEntry->Sibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ KTIMER CmpDelayDerefKCBTimer;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
_Function_class_(KDEFERRED_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpDelayCloseDpcRoutine(IN PKDPC Dpc,
|
CmpDelayCloseDpcRoutine(IN PKDPC Dpc,
|
||||||
|
@ -49,6 +50,7 @@ CmpDelayCloseDpcRoutine(IN PKDPC Dpc,
|
||||||
ExQueueWorkItem(&CmpDelayCloseWorkItem, DelayedWorkQueue);
|
ExQueueWorkItem(&CmpDelayCloseWorkItem, DelayedWorkQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(WORKER_THREAD_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpDelayCloseWorker(IN PVOID Context)
|
CmpDelayCloseWorker(IN PVOID Context)
|
||||||
|
@ -188,21 +190,22 @@ NTAPI
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
CmpInitializeDelayedCloseTable(VOID)
|
CmpInitializeDelayedCloseTable(VOID)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Setup the delayed close lock */
|
/* Setup the delayed close lock */
|
||||||
KeInitializeGuardedMutex(&CmpDelayedCloseTableLock);
|
KeInitializeGuardedMutex(&CmpDelayedCloseTableLock);
|
||||||
|
|
||||||
/* Setup the work item */
|
/* Setup the work item */
|
||||||
ExInitializeWorkItem(&CmpDelayCloseWorkItem, CmpDelayCloseWorker, NULL);
|
ExInitializeWorkItem(&CmpDelayCloseWorkItem, CmpDelayCloseWorker, NULL);
|
||||||
|
|
||||||
/* Setup the list head */
|
/* Setup the list head */
|
||||||
InitializeListHead(&CmpDelayedLRUListHead);
|
InitializeListHead(&CmpDelayedLRUListHead);
|
||||||
|
|
||||||
/* Setup the DPC and its timer */
|
/* Setup the DPC and its timer */
|
||||||
KeInitializeDpc(&CmpDelayCloseDpc, CmpDelayCloseDpcRoutine, NULL);
|
KeInitializeDpc(&CmpDelayCloseDpc, CmpDelayCloseDpcRoutine, NULL);
|
||||||
KeInitializeTimer(&CmpDelayCloseTimer);
|
KeInitializeTimer(&CmpDelayCloseTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(KDEFERRED_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpDelayDerefKCBDpcRoutine(IN PKDPC Dpc,
|
CmpDelayDerefKCBDpcRoutine(IN PKDPC Dpc,
|
||||||
|
@ -217,6 +220,7 @@ CmpDelayDerefKCBDpcRoutine(IN PKDPC Dpc,
|
||||||
ExQueueWorkItem(&CmpDelayDerefKCBWorkItem, DelayedWorkQueue);
|
ExQueueWorkItem(&CmpDelayDerefKCBWorkItem, DelayedWorkQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(WORKER_THREAD_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpDelayDerefKCBWorker(IN PVOID Context)
|
CmpDelayDerefKCBWorker(IN PVOID Context)
|
||||||
|
@ -236,22 +240,22 @@ CmpDelayDerefKCBWorker(IN PVOID Context)
|
||||||
{
|
{
|
||||||
/* Grab an entry */
|
/* Grab an entry */
|
||||||
Entry = (PVOID)RemoveHeadList(&CmpDelayDerefKCBListHead);
|
Entry = (PVOID)RemoveHeadList(&CmpDelayDerefKCBListHead);
|
||||||
|
|
||||||
/* We can release the lock now */
|
/* We can release the lock now */
|
||||||
KeReleaseGuardedMutex(&CmpDelayDerefKCBLock);
|
KeReleaseGuardedMutex(&CmpDelayDerefKCBLock);
|
||||||
|
|
||||||
/* Now grab the actual entry */
|
/* Now grab the actual entry */
|
||||||
Entry = CONTAINING_RECORD(Entry, CM_DELAY_DEREF_KCB_ITEM, ListEntry);
|
Entry = CONTAINING_RECORD(Entry, CM_DELAY_DEREF_KCB_ITEM, ListEntry);
|
||||||
Entry->ListEntry.Flink = Entry->ListEntry.Blink = NULL;
|
Entry->ListEntry.Flink = Entry->ListEntry.Blink = NULL;
|
||||||
|
|
||||||
/* Dereference and free */
|
/* Dereference and free */
|
||||||
CmpDereferenceKeyControlBlock(Entry->Kcb);
|
CmpDereferenceKeyControlBlock(Entry->Kcb);
|
||||||
CmpFreeDelayItem(Entry);
|
CmpFreeDelayItem(Entry);
|
||||||
|
|
||||||
/* Lock the list again */
|
/* Lock the list again */
|
||||||
KeAcquireGuardedMutex(&CmpDelayDerefKCBLock);
|
KeAcquireGuardedMutex(&CmpDelayDerefKCBLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
CmpDelayDerefKCBWorkItemActive = FALSE;
|
CmpDelayDerefKCBWorkItemActive = FALSE;
|
||||||
KeReleaseGuardedMutex(&CmpDelayDerefKCBLock);
|
KeReleaseGuardedMutex(&CmpDelayDerefKCBLock);
|
||||||
|
@ -332,7 +336,7 @@ CmpArmDelayedCloseTimer(VOID)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER Timeout;
|
LARGE_INTEGER Timeout;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Set the worker active */
|
/* Set the worker active */
|
||||||
CmpDelayCloseWorkItemActive = TRUE;
|
CmpDelayCloseWorkItemActive = TRUE;
|
||||||
|
|
||||||
|
@ -424,36 +428,36 @@ CmpRemoveFromDelayedClose(IN PCM_KEY_CONTROL_BLOCK Kcb)
|
||||||
PCM_DELAYED_CLOSE_ENTRY Entry;
|
PCM_DELAYED_CLOSE_ENTRY Entry;
|
||||||
ULONG NewRefCount, OldRefCount;
|
ULONG NewRefCount, OldRefCount;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) ||
|
ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) ||
|
||||||
(CmpTestRegistryLockExclusive() == TRUE));
|
(CmpTestRegistryLockExclusive() == TRUE));
|
||||||
if (Kcb->DelayedCloseIndex == CmpDelayedCloseSize) ASSERT(FALSE);
|
if (Kcb->DelayedCloseIndex == CmpDelayedCloseSize) ASSERT(FALSE);
|
||||||
|
|
||||||
/* Get the entry and lock the table */
|
/* Get the entry and lock the table */
|
||||||
Entry = Kcb->DelayCloseEntry;
|
Entry = Kcb->DelayCloseEntry;
|
||||||
ASSERT(Entry);
|
ASSERT(Entry);
|
||||||
KeAcquireGuardedMutex(&CmpDelayedCloseTableLock);
|
KeAcquireGuardedMutex(&CmpDelayedCloseTableLock);
|
||||||
|
|
||||||
/* Remove the entry */
|
/* Remove the entry */
|
||||||
RemoveEntryList(&Entry->DelayedLRUList);
|
RemoveEntryList(&Entry->DelayedLRUList);
|
||||||
|
|
||||||
/* Release the lock */
|
/* Release the lock */
|
||||||
KeReleaseGuardedMutex(&CmpDelayedCloseTableLock);
|
KeReleaseGuardedMutex(&CmpDelayedCloseTableLock);
|
||||||
|
|
||||||
/* Free the entry */
|
/* Free the entry */
|
||||||
CmpFreeDelayItem(Entry);
|
CmpFreeDelayItem(Entry);
|
||||||
|
|
||||||
/* Reduce the number of elements */
|
/* Reduce the number of elements */
|
||||||
InterlockedDecrement((PLONG)&CmpDelayedCloseElements);
|
InterlockedDecrement((PLONG)&CmpDelayedCloseElements);
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
if (!Kcb->InDelayClose) ASSERT(FALSE);
|
if (!Kcb->InDelayClose) ASSERT(FALSE);
|
||||||
|
|
||||||
/* Get the previous reference count */
|
/* Get the previous reference count */
|
||||||
OldRefCount = *(PLONG)&Kcb->InDelayClose;
|
OldRefCount = *(PLONG)&Kcb->InDelayClose;
|
||||||
ASSERT(OldRefCount == 1);
|
ASSERT(OldRefCount == 1);
|
||||||
|
|
||||||
/* Write the new one */
|
/* Write the new one */
|
||||||
NewRefCount = 0;
|
NewRefCount = 0;
|
||||||
if (InterlockedCompareExchange((PLONG)&Kcb->InDelayClose,
|
if (InterlockedCompareExchange((PLONG)&Kcb->InDelayClose,
|
||||||
|
@ -463,10 +467,10 @@ CmpRemoveFromDelayedClose(IN PCM_KEY_CONTROL_BLOCK Kcb)
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the link to the entry */
|
/* Remove the link to the entry */
|
||||||
Kcb->DelayCloseEntry = NULL;
|
Kcb->DelayCloseEntry = NULL;
|
||||||
|
|
||||||
/* Set new delay size and remove the delete flag */
|
/* Set new delay size and remove the delete flag */
|
||||||
Kcb->DelayedCloseIndex = CmpDelayedCloseSize;
|
Kcb->DelayedCloseIndex = CmpDelayedCloseSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,31 +116,31 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
|
||||||
ASSERT(Function && Cookie);
|
ASSERT(Function && Cookie);
|
||||||
|
|
||||||
Callback = ExAllocatePoolWithTag(PagedPool,
|
Callback = ExAllocatePoolWithTag(PagedPool,
|
||||||
sizeof(REGISTRY_CALLBACK),
|
sizeof(REGISTRY_CALLBACK),
|
||||||
'bcMC');
|
'bcMC');
|
||||||
if (Callback != NULL)
|
if (Callback == NULL)
|
||||||
{
|
{
|
||||||
/* initialize the callback */
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
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;
|
/* 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -38,13 +38,13 @@ CmpDoFlushNextHive(IN BOOLEAN ForceFlush,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PLIST_ENTRY NextEntry;
|
PLIST_ENTRY NextEntry;
|
||||||
PCMHIVE CmHive;
|
PCMHIVE CmHive;
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
ULONG HiveCount = CmpLazyFlushHiveCount;
|
ULONG HiveCount = CmpLazyFlushHiveCount;
|
||||||
|
|
||||||
/* Set Defaults */
|
/* Set Defaults */
|
||||||
*Error = FALSE;
|
*Error = FALSE;
|
||||||
*DirtyCount = 0;
|
*DirtyCount = 0;
|
||||||
|
|
||||||
/* Don't do anything if we're not supposed to */
|
/* Don't do anything if we're not supposed to */
|
||||||
if (CmpNoWrite) return TRUE;
|
if (CmpNoWrite) return TRUE;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ CmpDoFlushNextHive(IN BOOLEAN ForceFlush,
|
||||||
{
|
{
|
||||||
/* Great sucess! */
|
/* Great sucess! */
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
|
|
||||||
/* Ignore clean or volatile hves */
|
/* Ignore clean or volatile hves */
|
||||||
if (!(CmHive->Hive.DirtyCount) ||
|
if (!(CmHive->Hive.DirtyCount) ||
|
||||||
(CmHive->Hive.HiveFlags & HIVE_VOLATILE))
|
(CmHive->Hive.HiveFlags & HIVE_VOLATILE))
|
||||||
|
@ -100,7 +100,7 @@ CmpDoFlushNextHive(IN BOOLEAN ForceFlush,
|
||||||
/* Try the next one */
|
/* Try the next one */
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we've flushed everything */
|
/* Check if we've flushed everything */
|
||||||
if (NextEntry == &CmpHiveListHead)
|
if (NextEntry == &CmpHiveListHead)
|
||||||
{
|
{
|
||||||
|
@ -112,12 +112,13 @@ CmpDoFlushNextHive(IN BOOLEAN ForceFlush,
|
||||||
/* We need to be called again */
|
/* We need to be called again */
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unlock the list and return the result */
|
/* Unlock the list and return the result */
|
||||||
ExReleasePushLock(&CmpHiveListHeadLock);
|
ExReleasePushLock(&CmpHiveListHeadLock);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(KDEFERRED_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpEnableLazyFlushDpcRoutine(IN PKDPC Dpc,
|
CmpEnableLazyFlushDpcRoutine(IN PKDPC Dpc,
|
||||||
|
@ -129,6 +130,7 @@ CmpEnableLazyFlushDpcRoutine(IN PKDPC Dpc,
|
||||||
CmpHoldLazyFlush = FALSE;
|
CmpHoldLazyFlush = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(KDEFERRED_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpLazyFlushDpcRoutine(IN PKDPC Dpc,
|
CmpLazyFlushDpcRoutine(IN PKDPC Dpc,
|
||||||
|
@ -150,7 +152,7 @@ CmpLazyFlush(VOID)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER DueTime;
|
LARGE_INTEGER DueTime;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Check if we should set the lazy flush timer */
|
/* Check if we should set the lazy flush timer */
|
||||||
if ((!CmpNoWrite) && (!CmpHoldLazyFlush))
|
if ((!CmpNoWrite) && (!CmpHoldLazyFlush))
|
||||||
{
|
{
|
||||||
|
@ -161,6 +163,7 @@ CmpLazyFlush(VOID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(WORKER_THREAD_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpLazyFlushWorker(IN PVOID Parameter)
|
CmpLazyFlushWorker(IN PVOID Parameter)
|
||||||
|
@ -171,7 +174,7 @@ CmpLazyFlushWorker(IN PVOID Parameter)
|
||||||
|
|
||||||
/* Don't do anything if lazy flushing isn't enabled yet */
|
/* Don't do anything if lazy flushing isn't enabled yet */
|
||||||
if (CmpHoldLazyFlush) return;
|
if (CmpHoldLazyFlush) return;
|
||||||
|
|
||||||
/* Check if we are forcing a flush */
|
/* Check if we are forcing a flush */
|
||||||
ForceFlush = CmpForceForceFlush;
|
ForceFlush = CmpForceForceFlush;
|
||||||
if (ForceFlush)
|
if (ForceFlush)
|
||||||
|
@ -185,7 +188,7 @@ CmpLazyFlushWorker(IN PVOID Parameter)
|
||||||
CmpLockRegistry();
|
CmpLockRegistry();
|
||||||
InterlockedIncrement(&CmpFlushStarveWriters);
|
InterlockedIncrement(&CmpFlushStarveWriters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush the next hive */
|
/* Flush the next hive */
|
||||||
MoreWork = CmpDoFlushNextHive(ForceFlush, &Result, &DirtyCount);
|
MoreWork = CmpDoFlushNextHive(ForceFlush, &Result, &DirtyCount);
|
||||||
if (!MoreWork)
|
if (!MoreWork)
|
||||||
|
@ -200,7 +203,7 @@ CmpLazyFlushWorker(IN PVOID Parameter)
|
||||||
/* Not pending anymore, release the registry lock */
|
/* Not pending anymore, release the registry lock */
|
||||||
CmpLazyFlushPending = FALSE;
|
CmpLazyFlushPending = FALSE;
|
||||||
CmpUnlockRegistry();
|
CmpUnlockRegistry();
|
||||||
|
|
||||||
/* Check if we need to flush another hive */
|
/* Check if we need to flush another hive */
|
||||||
if ((MoreWork) || (DirtyCount)) CmpLazyFlush();
|
if ((MoreWork) || (DirtyCount)) CmpLazyFlush();
|
||||||
}
|
}
|
||||||
|
@ -209,15 +212,15 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpCmdInit(IN BOOLEAN SetupBoot)
|
CmpCmdInit(IN BOOLEAN SetupBoot)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER DueTime;
|
LARGE_INTEGER DueTime;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Setup the lazy DPC */
|
/* Setup the lazy DPC */
|
||||||
KeInitializeDpc(&CmpLazyFlushDpc, CmpLazyFlushDpcRoutine, NULL);
|
KeInitializeDpc(&CmpLazyFlushDpc, CmpLazyFlushDpcRoutine, NULL);
|
||||||
|
|
||||||
/* Setup the lazy timer */
|
/* Setup the lazy timer */
|
||||||
KeInitializeTimer(&CmpLazyFlushTimer);
|
KeInitializeTimer(&CmpLazyFlushTimer);
|
||||||
|
|
||||||
/* Setup the lazy worker */
|
/* Setup the lazy worker */
|
||||||
ExInitializeWorkItem(&CmpLazyWorkItem, CmpLazyFlushWorker, NULL);
|
ExInitializeWorkItem(&CmpLazyWorkItem, CmpLazyFlushWorker, NULL);
|
||||||
|
|
||||||
|
@ -226,7 +229,7 @@ CmpCmdInit(IN BOOLEAN SetupBoot)
|
||||||
CmpEnableLazyFlushDpcRoutine,
|
CmpEnableLazyFlushDpcRoutine,
|
||||||
NULL);
|
NULL);
|
||||||
KeInitializeTimer(&CmpEnableLazyFlushTimer);
|
KeInitializeTimer(&CmpEnableLazyFlushTimer);
|
||||||
|
|
||||||
/* Enable lazy flushing after 10 minutes */
|
/* Enable lazy flushing after 10 minutes */
|
||||||
DueTime.QuadPart = Int32x32To64(600, -10 * 1000 * 1000);
|
DueTime.QuadPart = Int32x32To64(600, -10 * 1000 * 1000);
|
||||||
KeSetTimer(&CmpEnableLazyFlushTimer, DueTime, &CmpEnableLazyFlushDpc);
|
KeSetTimer(&CmpEnableLazyFlushTimer, DueTime, &CmpEnableLazyFlushDpc);
|
||||||
|
@ -234,10 +237,10 @@ CmpCmdInit(IN BOOLEAN SetupBoot)
|
||||||
/* Setup flush variables */
|
/* Setup flush variables */
|
||||||
CmpNoWrite = CmpMiniNTBoot;
|
CmpNoWrite = CmpMiniNTBoot;
|
||||||
CmpWasSetupBoot = SetupBoot;
|
CmpWasSetupBoot = SetupBoot;
|
||||||
|
|
||||||
/* Testing: Force Lazy Flushing */
|
/* Testing: Force Lazy Flushing */
|
||||||
CmpHoldLazyFlush = FALSE;
|
CmpHoldLazyFlush = FALSE;
|
||||||
|
|
||||||
/* Setup the hive list */
|
/* Setup the hive list */
|
||||||
CmpInitializeHiveList(SetupBoot);
|
CmpInitializeHiveList(SetupBoot);
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,7 +433,10 @@ ExCreateCallback(OUT PCALLBACK_OBJECT *CallbackObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Everything went fine, so return a pointer to the Object */
|
/* Everything went fine, so return a pointer to the Object */
|
||||||
if (NT_SUCCESS(Status)) *CallbackObject = Callback;
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
*CallbackObject = Callback;
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ GENERIC_MAPPING ExpKeyedEventMapping =
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
_IRQL_requires_max_(APC_LEVEL)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -116,6 +117,7 @@ ExpInitializeKeyedEvent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_IRQL_requires_max_(APC_LEVEL)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
ExpReleaseOrWaitForKeyedEvent(
|
ExpReleaseOrWaitForKeyedEvent(
|
||||||
|
@ -203,6 +205,7 @@ ExpReleaseOrWaitForKeyedEvent(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_IRQL_requires_max_(APC_LEVEL)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
ExpWaitForKeyedEvent(
|
ExpWaitForKeyedEvent(
|
||||||
|
@ -219,6 +222,7 @@ ExpWaitForKeyedEvent(
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_IRQL_requires_max_(APC_LEVEL)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
ExpReleaseKeyedEvent(
|
ExpReleaseKeyedEvent(
|
||||||
|
@ -235,6 +239,7 @@ ExpReleaseKeyedEvent(
|
||||||
TRUE);
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_IRQL_requires_max_(APC_LEVEL)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
NtCreateKeyedEvent(
|
NtCreateKeyedEvent(
|
||||||
|
@ -311,6 +316,7 @@ NtCreateKeyedEvent(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_IRQL_requires_max_(APC_LEVEL)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
NtOpenKeyedEvent(
|
NtOpenKeyedEvent(
|
||||||
|
@ -359,6 +365,7 @@ NtOpenKeyedEvent(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_IRQL_requires_max_(APC_LEVEL)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
NtWaitForKeyedEvent(
|
NtWaitForKeyedEvent(
|
||||||
|
@ -401,6 +408,7 @@ NtWaitForKeyedEvent(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_IRQL_requires_max_(APC_LEVEL)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
NtReleaseKeyedEvent(
|
NtReleaseKeyedEvent(
|
||||||
|
|
|
@ -209,7 +209,7 @@ NtSetDefaultLocale(IN BOOLEAN UserProfile,
|
||||||
HANDLE KeyHandle;
|
HANDLE KeyHandle;
|
||||||
ULONG ValueLength;
|
ULONG ValueLength;
|
||||||
WCHAR ValueBuffer[20];
|
WCHAR ValueBuffer[20];
|
||||||
HANDLE UserKey = NULL;
|
HANDLE UserKey;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -231,6 +231,7 @@ NtSetDefaultLocale(IN BOOLEAN UserProfile,
|
||||||
L"\\Registry\\Machine\\System\\CurrentControlSet"
|
L"\\Registry\\Machine\\System\\CurrentControlSet"
|
||||||
L"\\Control\\Nls\\Language");
|
L"\\Control\\Nls\\Language");
|
||||||
RtlInitUnicodeString(&ValueName, L"Default");
|
RtlInitUnicodeString(&ValueName, L"Default");
|
||||||
|
UserKey = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initailize the object attributes */
|
/* Initailize the object attributes */
|
||||||
|
@ -286,7 +287,10 @@ NtSetDefaultLocale(IN BOOLEAN UserProfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the user key */
|
/* Close the user key */
|
||||||
ZwClose(UserKey);
|
if (UserKey)
|
||||||
|
{
|
||||||
|
ObCloseHandle(UserKey, KernelMode);
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
|
|
@ -133,6 +133,7 @@ ExpDeleteTimer(IN PVOID ObjectBody)
|
||||||
KeFlushQueuedDpcs();
|
KeFlushQueuedDpcs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Function_class_(KDEFERRED_ROUTINE)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
ExpTimerDpcRoutine(IN PKDPC Dpc,
|
ExpTimerDpcRoutine(IN PKDPC Dpc,
|
||||||
|
@ -355,7 +356,8 @@ NtCancelTimer(IN HANDLE TimerHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
||||||
{
|
{
|
||||||
|
/* Do nothing */
|
||||||
|
(void)0;
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +447,8 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
||||||
{
|
{
|
||||||
|
/* Do nothing */
|
||||||
|
(void)0;
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
@ -500,7 +503,8 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
||||||
{
|
{
|
||||||
|
/* Do nothing */
|
||||||
|
(void)0;
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
@ -629,9 +633,9 @@ NtSetTimer(IN HANDLE TimerHandle,
|
||||||
(PVOID*)&Timer,
|
(PVOID*)&Timer,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tell the user we don't support Wake Timers...
|
* 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
|
* functionality required to support them, make this check dependent
|
||||||
* on the actual PM capabilities
|
* on the actual PM capabilities
|
||||||
*/
|
*/
|
||||||
|
@ -740,7 +744,8 @@ NtSetTimer(IN HANDLE TimerHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
||||||
{
|
{
|
||||||
|
/* Do nothing */
|
||||||
|
(void)0;
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
|
@ -841,8 +841,8 @@ Ki386PerfEnd(VOID)
|
||||||
{
|
{
|
||||||
extern ULONGLONG BootCyclesEnd, BootCycles;
|
extern ULONGLONG BootCyclesEnd, BootCycles;
|
||||||
BootCyclesEnd = __rdtsc();
|
BootCyclesEnd = __rdtsc();
|
||||||
DbgPrint("Boot took %I64d cycles!\n", BootCyclesEnd - BootCycles);
|
DbgPrint("Boot took %I64u cycles!\n", BootCyclesEnd - BootCycles);
|
||||||
DbgPrint("Interrupts: %d System Calls: %d Context Switches: %d\n",
|
DbgPrint("Interrupts: %u System Calls: %u Context Switches: %u\n",
|
||||||
KeGetCurrentPrcb()->InterruptCount,
|
KeGetCurrentPrcb()->InterruptCount,
|
||||||
KeGetCurrentPrcb()->KeSystemCalls,
|
KeGetCurrentPrcb()->KeSystemCalls,
|
||||||
KeGetContextSwitches(KeGetCurrentPrcb()));
|
KeGetContextSwitches(KeGetCurrentPrcb()));
|
||||||
|
|
|
@ -237,10 +237,12 @@ IopDisplayLoadingMessage(PUNICODE_STRING ServiceName)
|
||||||
* The input image path isn't freed on error.
|
* The input image path isn't freed on error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS
|
||||||
|
FASTCALL
|
||||||
IopNormalizeImagePath(
|
IopNormalizeImagePath(
|
||||||
IN OUT PUNICODE_STRING ImagePath,
|
_Inout_ _When_(return>=0, _At_(ImagePath->Buffer, _Post_notnull_ __drv_allocatesMem(Mem)))
|
||||||
IN PUNICODE_STRING ServiceName)
|
PUNICODE_STRING ImagePath,
|
||||||
|
_In_ PUNICODE_STRING ServiceName)
|
||||||
{
|
{
|
||||||
UNICODE_STRING InputImagePath;
|
UNICODE_STRING InputImagePath;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue