mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[NTOSKRNL]
Coverity code defects fixes : - Cache: CID 701441 - Config: CIDs 716570, 716669, 716760 - Dbgk: Kdbg: CIDs 716571, 515128/9, 500432 - Ex: CIDs 500156/7, 515122, 716200/67, 701301, 514669 - Fsrtl: Fstub: CIDs 701341/2, 701288, 716770, 701302, and CIDs 716576/7/8 + 514636 + 716805 thanks to Thomas Faber - Io: CIDs 514576, 514643, 514672/3, 716203, 716269, 716581, 716591, 716713 - Ke: CIDs 515125, 716592 - Ps: CIDs 716603/4, 701422 - Ob: Po: CIDs 514671/680, 701419/420/421, 716763, 716601/2 All the details are given in the different bug reports. CORE-6677 CORE-6679 CORE-6680 CORE-6683 CORE-6686 CORE-6692 CORE-6693 CORE-6694 CORE-6695 CORE-6696 #comment Committed in rev.57400 #resolve #close svn path=/trunk/; revision=57400
This commit is contained in:
parent
31418a2eb5
commit
572d5fcaeb
31 changed files with 264 additions and 217 deletions
|
@ -103,6 +103,12 @@ RtlpCheckIntegerAtom(PWSTR AtomName,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AtomName cannot be NULL because this
|
||||||
|
* case was caught by the previous test.
|
||||||
|
*/
|
||||||
|
ASSERT(AtomName != NULL);
|
||||||
|
|
||||||
if (*AtomName != L'#')
|
if (*AtomName != L'#')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
19
reactos/ntoskrnl/cache/section/swapout.c
vendored
19
reactos/ntoskrnl/cache/section/swapout.c
vendored
|
@ -348,7 +348,7 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
PMM_SECTION_SEGMENT Segment = NULL;
|
PMM_SECTION_SEGMENT Segment = NULL;
|
||||||
LARGE_INTEGER FileOffset;
|
LARGE_INTEGER FileOffset;
|
||||||
PMEMORY_AREA MemoryArea;
|
PMEMORY_AREA MemoryArea;
|
||||||
PMMSUPPORT AddressSpace = MmGetKernelAddressSpace();
|
PMMSUPPORT AddressSpace = NULL;
|
||||||
BOOLEAN Dirty = FALSE;
|
BOOLEAN Dirty = FALSE;
|
||||||
PVOID Address = NULL;
|
PVOID Address = NULL;
|
||||||
PEPROCESS Process = NULL;
|
PEPROCESS Process = NULL;
|
||||||
|
@ -385,7 +385,6 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
DPRINT("No segment association for %x\n", Page);
|
DPRINT("No segment association for %x\n", Page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dirty = MmIsDirtyPageRmap(Page);
|
Dirty = MmIsDirtyPageRmap(Page);
|
||||||
|
|
||||||
DPRINTC("Trying to unmap all instances of %x\n", Page);
|
DPRINTC("Trying to unmap all instances of %x\n", Page);
|
||||||
|
@ -409,7 +408,8 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
|
|
||||||
DPRINTC("Process %x Address %x Page %x\n", Process, Address, Page);
|
DPRINTC("Process %x Address %x Page %x\n", Process, Address, Page);
|
||||||
|
|
||||||
if (RMAP_IS_SEGMENT(Address)) {
|
if (RMAP_IS_SEGMENT(Address))
|
||||||
|
{
|
||||||
entry = entry->Next;
|
entry = entry->Next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -440,10 +440,10 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
KeBugCheck(MEMORY_MANAGEMENT);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
MmLockAddressSpace(AddressSpace);
|
||||||
|
|
||||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
|
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
|
||||||
if (MemoryArea == NULL || MemoryArea->DeleteInProgress)
|
if (MemoryArea == NULL || MemoryArea->DeleteInProgress)
|
||||||
{
|
{
|
||||||
|
@ -505,15 +505,14 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
DPRINT1("bail\n");
|
DPRINT1("bail\n");
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
else Status = STATUS_MM_RESTART_OPERATION;
|
else
|
||||||
|
{
|
||||||
|
Status = STATUS_MM_RESTART_OPERATION;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
|
||||||
}
|
}
|
||||||
while (Status == STATUS_MM_RESTART_OPERATION);
|
while (Status == STATUS_MM_RESTART_OPERATION);
|
||||||
|
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
|
||||||
|
|
||||||
if (ProcRef)
|
if (ProcRef)
|
||||||
{
|
{
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
|
|
|
@ -116,13 +116,24 @@ CmpInitializeHive(OUT PCMHIVE *RegistryHive,
|
||||||
Hive->ViewLock = ExAllocatePoolWithTag(NonPagedPool,
|
Hive->ViewLock = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
sizeof(KGUARDED_MUTEX),
|
sizeof(KGUARDED_MUTEX),
|
||||||
TAG_CM);
|
TAG_CM);
|
||||||
if (!Hive->ViewLock) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!Hive->ViewLock)
|
||||||
|
{
|
||||||
|
/* Cleanup allocation and fail */
|
||||||
|
ExFreePoolWithTag(Hive, TAG_CM);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate the flush lock */
|
/* Allocate the flush lock */
|
||||||
Hive->FlusherLock = ExAllocatePoolWithTag(NonPagedPool,
|
Hive->FlusherLock = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
sizeof(ERESOURCE),
|
sizeof(ERESOURCE),
|
||||||
TAG_CM);
|
TAG_CM);
|
||||||
if (!Hive->FlusherLock) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!Hive->FlusherLock)
|
||||||
|
{
|
||||||
|
/* Cleanup allocations and fail */
|
||||||
|
ExFreePoolWithTag(Hive->ViewLock, TAG_CM);
|
||||||
|
ExFreePoolWithTag(Hive, TAG_CM);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
/* Setup the handles */
|
/* Setup the handles */
|
||||||
Hive->FileHandles[HFILE_TYPE_PRIMARY] = Primary;
|
Hive->FileHandles[HFILE_TYPE_PRIMARY] = Primary;
|
||||||
|
@ -189,10 +200,10 @@ CmpInitializeHive(OUT PCMHIVE *RegistryHive,
|
||||||
(PUNICODE_STRING)FileName);
|
(PUNICODE_STRING)FileName);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Clear allocations and fail */
|
/* Cleanup allocations and fail */
|
||||||
ExFreePool(Hive->ViewLock);
|
ExFreePoolWithTag(Hive->FlusherLock, TAG_CM);
|
||||||
ExFreePool(Hive->FlusherLock);
|
ExFreePoolWithTag(Hive->ViewLock, TAG_CM);
|
||||||
ExFreePool(Hive);
|
ExFreePoolWithTag(Hive, TAG_CM);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,10 +216,10 @@ CmpInitializeHive(OUT PCMHIVE *RegistryHive,
|
||||||
/* Verify integrity */
|
/* Verify integrity */
|
||||||
if (CmCheckRegistry((PCMHIVE)Hive, TRUE))
|
if (CmCheckRegistry((PCMHIVE)Hive, TRUE))
|
||||||
{
|
{
|
||||||
/* Free all alocations */
|
/* Cleanup allocations and fail */
|
||||||
ExFreePool(Hive->ViewLock);
|
ExFreePoolWithTag(Hive->FlusherLock, TAG_CM);
|
||||||
ExFreePool(Hive->FlusherLock);
|
ExFreePoolWithTag(Hive->ViewLock, TAG_CM);
|
||||||
ExFreePool(Hive);
|
ExFreePoolWithTag(Hive, TAG_CM);
|
||||||
return STATUS_REGISTRY_CORRUPT;
|
return STATUS_REGISTRY_CORRUPT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,10 +242,10 @@ NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName,
|
CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName,
|
||||||
IN PCWSTR Extension OPTIONAL,
|
IN PCWSTR Extension OPTIONAL,
|
||||||
IN PHANDLE Primary,
|
OUT PHANDLE Primary,
|
||||||
IN PHANDLE Log,
|
OUT PHANDLE Log,
|
||||||
IN PULONG PrimaryDisposition,
|
OUT PULONG PrimaryDisposition,
|
||||||
IN PULONG LogDisposition,
|
OUT PULONG LogDisposition,
|
||||||
IN BOOLEAN CreateAllowed,
|
IN BOOLEAN CreateAllowed,
|
||||||
IN BOOLEAN MarkAsSystemHive,
|
IN BOOLEAN MarkAsSystemHive,
|
||||||
IN BOOLEAN NoBuffering,
|
IN BOOLEAN NoBuffering,
|
||||||
|
|
|
@ -1074,6 +1074,9 @@ CmpParseKey(IN PVOID ParseObject,
|
||||||
/* Grab the KCB */
|
/* Grab the KCB */
|
||||||
Kcb = ((PCM_KEY_BODY)ParseObject)->KeyControlBlock;
|
Kcb = ((PCM_KEY_BODY)ParseObject)->KeyControlBlock;
|
||||||
|
|
||||||
|
/* Sanity check */
|
||||||
|
ASSERT(Kcb != NULL);
|
||||||
|
|
||||||
/* Fail if the key was marked as deleted */
|
/* Fail if the key was marked as deleted */
|
||||||
if (Kcb->Delete)
|
if (Kcb->Delete)
|
||||||
return STATUS_KEY_DELETED;
|
return STATUS_KEY_DELETED;
|
||||||
|
@ -1093,6 +1096,9 @@ CmpParseKey(IN PVOID ParseObject,
|
||||||
/* This is now the parent */
|
/* This is now the parent */
|
||||||
ParentKcb = Kcb;
|
ParentKcb = Kcb;
|
||||||
|
|
||||||
|
/* Sanity check */
|
||||||
|
ASSERT(ParentKcb != NULL);
|
||||||
|
|
||||||
/* Check if everything was found cached */
|
/* Check if everything was found cached */
|
||||||
if (!TotalRemainingSubkeys) ASSERTMSG("Caching not implemented", FALSE);
|
if (!TotalRemainingSubkeys) ASSERTMSG("Caching not implemented", FALSE);
|
||||||
|
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
||||||
//ULONG RegStart;
|
//ULONG RegStart;
|
||||||
ULONG PrimaryDisposition, SecondaryDisposition, ClusterSize;
|
ULONG PrimaryDisposition, SecondaryDisposition, ClusterSize;
|
||||||
PCMHIVE CmHive;
|
PCMHIVE CmHive;
|
||||||
HANDLE PrimaryHandle, LogHandle;
|
HANDLE PrimaryHandle = NULL, LogHandle = NULL;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PVOID ErrorParameters;
|
PVOID ErrorParameters;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
|
@ -192,7 +192,7 @@ DbgkpQueueMessage(IN PEPROCESS Process,
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
|
|
||||||
/* Free the debug event */
|
/* Free the debug event */
|
||||||
ExFreePool(DebugEvent);
|
ExFreePoolWithTag(DebugEvent, 'EgbD');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ DbgkpFreeDebugEvent(IN PDEBUG_EVENT DebugEvent)
|
||||||
/* Dereference process and thread and free the event */
|
/* Dereference process and thread and free the event */
|
||||||
ObDereferenceObject(DebugEvent->Process);
|
ObDereferenceObject(DebugEvent->Process);
|
||||||
ObDereferenceObject(DebugEvent->Thread);
|
ObDereferenceObject(DebugEvent->Thread);
|
||||||
ExFreePool(DebugEvent);
|
ExFreePoolWithTag(DebugEvent, 'EgbD');
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -211,7 +211,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
|
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
|
||||||
ULONG NlsTablesEncountered = 0;
|
ULONG NlsTablesEncountered = 0;
|
||||||
SIZE_T NlsTableSizes[3]; /* 3 NLS tables */
|
SIZE_T NlsTableSizes[3] = {0, 0, 0}; /* 3 NLS tables */
|
||||||
|
|
||||||
/* Check if this is boot-time phase 0 initialization */
|
/* Check if this is boot-time phase 0 initialization */
|
||||||
if (!ExpInitializationPhase)
|
if (!ExpInitializationPhase)
|
||||||
|
@ -405,12 +405,11 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Failed, display error */
|
/* Failed, display error */
|
||||||
p = InitBuffer->DebugBuffer;
|
_snwprintf(InitBuffer->DebugBuffer,
|
||||||
_snwprintf(p,
|
sizeof(InitBuffer->DebugBuffer)/sizeof(WCHAR),
|
||||||
256 * sizeof(WCHAR),
|
|
||||||
L"INIT: Unable to allocate Process Parameters. 0x%lx",
|
L"INIT: Unable to allocate Process Parameters. 0x%lx",
|
||||||
Status);
|
Status);
|
||||||
RtlInitUnicodeString(&DebugString, p);
|
RtlInitUnicodeString(&DebugString, InitBuffer->DebugBuffer);
|
||||||
ZwDisplayString(&DebugString);
|
ZwDisplayString(&DebugString);
|
||||||
|
|
||||||
/* Bugcheck the system */
|
/* Bugcheck the system */
|
||||||
|
@ -434,12 +433,11 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Failed, display error */
|
/* Failed, display error */
|
||||||
p = InitBuffer->DebugBuffer;
|
_snwprintf(InitBuffer->DebugBuffer,
|
||||||
_snwprintf(p,
|
sizeof(InitBuffer->DebugBuffer)/sizeof(WCHAR),
|
||||||
256 * sizeof(WCHAR),
|
|
||||||
L"INIT: Unable to allocate Process Environment. 0x%lx",
|
L"INIT: Unable to allocate Process Environment. 0x%lx",
|
||||||
Status);
|
Status);
|
||||||
RtlInitUnicodeString(&DebugString, p);
|
RtlInitUnicodeString(&DebugString, InitBuffer->DebugBuffer);
|
||||||
ZwDisplayString(&DebugString);
|
ZwDisplayString(&DebugString);
|
||||||
|
|
||||||
/* Bugcheck the system */
|
/* Bugcheck the system */
|
||||||
|
@ -560,12 +558,11 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Failed, display error */
|
/* Failed, display error */
|
||||||
p = InitBuffer->DebugBuffer;
|
_snwprintf(InitBuffer->DebugBuffer,
|
||||||
_snwprintf(p,
|
sizeof(InitBuffer->DebugBuffer)/sizeof(WCHAR),
|
||||||
256 * sizeof(WCHAR),
|
|
||||||
L"INIT: Unable to create Session Manager. 0x%lx",
|
L"INIT: Unable to create Session Manager. 0x%lx",
|
||||||
Status);
|
Status);
|
||||||
RtlInitUnicodeString(&DebugString, p);
|
RtlInitUnicodeString(&DebugString, InitBuffer->DebugBuffer);
|
||||||
ZwDisplayString(&DebugString);
|
ZwDisplayString(&DebugString);
|
||||||
|
|
||||||
/* Bugcheck the system */
|
/* Bugcheck the system */
|
||||||
|
@ -577,12 +574,11 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Failed, display error */
|
/* Failed, display error */
|
||||||
p = InitBuffer->DebugBuffer;
|
_snwprintf(InitBuffer->DebugBuffer,
|
||||||
_snwprintf(p,
|
sizeof(InitBuffer->DebugBuffer)/sizeof(WCHAR),
|
||||||
256 * sizeof(WCHAR),
|
|
||||||
L"INIT: Unable to resume Session Manager. 0x%lx",
|
L"INIT: Unable to resume Session Manager. 0x%lx",
|
||||||
Status);
|
Status);
|
||||||
RtlInitUnicodeString(&DebugString, p);
|
RtlInitUnicodeString(&DebugString, InitBuffer->DebugBuffer);
|
||||||
ZwDisplayString(&DebugString);
|
ZwDisplayString(&DebugString);
|
||||||
|
|
||||||
/* Bugcheck the system */
|
/* Bugcheck the system */
|
||||||
|
|
|
@ -150,7 +150,7 @@ ExGetCurrentProcessorCpuUsage(PULONG CpuUsage)
|
||||||
|
|
||||||
Prcb = KeGetCurrentPrcb();
|
Prcb = KeGetCurrentPrcb();
|
||||||
|
|
||||||
ScaledIdle = Prcb->IdleThread->KernelTime * 100;
|
ScaledIdle = (ULONGLONG)Prcb->IdleThread->KernelTime * 100;
|
||||||
TotalTime = Prcb->KernelTime + Prcb->UserTime;
|
TotalTime = Prcb->KernelTime + Prcb->UserTime;
|
||||||
if (TotalTime != 0)
|
if (TotalTime != 0)
|
||||||
*CpuUsage = (ULONG)(100 - (ScaledIdle / TotalTime));
|
*CpuUsage = (ULONG)(100 - (ScaledIdle / TotalTime));
|
||||||
|
@ -785,7 +785,7 @@ QSI_DEF(SystemProcessInformation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ImageNameLength && Process != PsIdleProcess && Process->ImageFileName)
|
if (!ImageNameLength && Process != PsIdleProcess)
|
||||||
{
|
{
|
||||||
ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
|
ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
|
@ -824,7 +824,7 @@ QSI_DEF(SystemProcessInformation)
|
||||||
/* Release the memory allocated by SeLocateProcessImageName */
|
/* Release the memory allocated by SeLocateProcessImageName */
|
||||||
ExFreePool(ProcessImageName);
|
ExFreePool(ProcessImageName);
|
||||||
}
|
}
|
||||||
else if (Process->ImageFileName)
|
else
|
||||||
{
|
{
|
||||||
RtlInitAnsiString(&ImageName, Process->ImageFileName);
|
RtlInitAnsiString(&ImageName, Process->ImageFileName);
|
||||||
RtlAnsiStringToUnicodeString(&SpiCurrent->ImageName, &ImageName, FALSE);
|
RtlAnsiStringToUnicodeString(&SpiCurrent->ImageName, &ImageName, FALSE);
|
||||||
|
|
|
@ -380,11 +380,12 @@ FsRtlPrivateLock(IN PFILE_LOCK FileLock,
|
||||||
if (!FileLock->LockInformation)
|
if (!FileLock->LockInformation)
|
||||||
{
|
{
|
||||||
LockInfo = ExAllocatePoolWithTag(NonPagedPool, sizeof(LOCK_INFORMATION), 'FLCK');
|
LockInfo = ExAllocatePoolWithTag(NonPagedPool, sizeof(LOCK_INFORMATION), 'FLCK');
|
||||||
FileLock->LockInformation = LockInfo;
|
if (!LockInfo)
|
||||||
if (!FileLock) {
|
{
|
||||||
IoStatus->Status = STATUS_NO_MEMORY;
|
IoStatus->Status = STATUS_NO_MEMORY;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
FileLock->LockInformation = LockInfo;
|
||||||
|
|
||||||
LockInfo->BelongsTo = FileLock;
|
LockInfo->BelongsTo = FileLock;
|
||||||
InitializeListHead(&LockInfo->SharedLocks);
|
InitializeListHead(&LockInfo->SharedLocks);
|
||||||
|
@ -475,8 +476,9 @@ FsRtlPrivateLock(IN PFILE_LOCK FileLock,
|
||||||
for (i = 0; i < RtlNumberGenericTableElements(&LockInfo->RangeTable); i++)
|
for (i = 0; i < RtlNumberGenericTableElements(&LockInfo->RangeTable); i++)
|
||||||
{
|
{
|
||||||
Conflict = RtlGetElementGenericTable(&LockInfo->RangeTable, i);
|
Conflict = RtlGetElementGenericTable(&LockInfo->RangeTable, i);
|
||||||
|
|
||||||
/* The first argument will be inserted as a shared range */
|
/* The first argument will be inserted as a shared range */
|
||||||
if (LockCompare(&LockInfo->RangeTable, Conflict, &ToInsert) == GenericEqual)
|
if (Conflict && (LockCompare(&LockInfo->RangeTable, Conflict, &ToInsert) == GenericEqual))
|
||||||
{
|
{
|
||||||
if (Conflict->Exclusive.FileLock.ExclusiveLock)
|
if (Conflict->Exclusive.FileLock.ExclusiveLock)
|
||||||
{
|
{
|
||||||
|
@ -520,8 +522,9 @@ FsRtlPrivateLock(IN PFILE_LOCK FileLock,
|
||||||
Conflict->Exclusive.FileLock.StartingByte.LowPart,
|
Conflict->Exclusive.FileLock.StartingByte.LowPart,
|
||||||
Conflict->Exclusive.FileLock.EndingByte.HighPart,
|
Conflict->Exclusive.FileLock.EndingByte.HighPart,
|
||||||
Conflict->Exclusive.FileLock.EndingByte.LowPart);
|
Conflict->Exclusive.FileLock.EndingByte.LowPart);
|
||||||
Conflict = FsRtlpRebuildSharedLockRange
|
Conflict = FsRtlpRebuildSharedLockRange(FileLock,
|
||||||
(FileLock, LockInfo, &ToInsert);
|
LockInfo,
|
||||||
|
&ToInsert);
|
||||||
if (!Conflict)
|
if (!Conflict)
|
||||||
{
|
{
|
||||||
IoStatus->Status = STATUS_NO_MEMORY;
|
IoStatus->Status = STATUS_NO_MEMORY;
|
||||||
|
@ -918,7 +921,6 @@ FsRtlFastUnlockSingle(IN PFILE_LOCK FileLock,
|
||||||
PLIST_ENTRY SharedRangeEntry;
|
PLIST_ENTRY SharedRangeEntry;
|
||||||
PLOCK_SHARED_RANGE WatchSharedRange;
|
PLOCK_SHARED_RANGE WatchSharedRange;
|
||||||
COMBINED_LOCK_ELEMENT RemadeElement;
|
COMBINED_LOCK_ELEMENT RemadeElement;
|
||||||
PCOMBINED_LOCK_ELEMENT RemadeElementInserted = NULL;
|
|
||||||
Find.Exclusive.FileLock.StartingByte = SharedRange->Start;
|
Find.Exclusive.FileLock.StartingByte = SharedRange->Start;
|
||||||
Find.Exclusive.FileLock.EndingByte = SharedRange->End;
|
Find.Exclusive.FileLock.EndingByte = SharedRange->End;
|
||||||
SharedEntry = SharedRange->Entry.Flink;
|
SharedEntry = SharedRange->Entry.Flink;
|
||||||
|
@ -939,30 +941,28 @@ FsRtlFastUnlockSingle(IN PFILE_LOCK FileLock,
|
||||||
SharedRangeEntry != &InternalInfo->SharedLocks;
|
SharedRangeEntry != &InternalInfo->SharedLocks;
|
||||||
SharedRangeEntry = SharedRangeEntry->Flink)
|
SharedRangeEntry = SharedRangeEntry->Flink)
|
||||||
{
|
{
|
||||||
COMBINED_LOCK_ELEMENT Find;
|
COMBINED_LOCK_ELEMENT LockElement;
|
||||||
WatchSharedRange = CONTAINING_RECORD(SharedRangeEntry, LOCK_SHARED_RANGE, Entry);
|
WatchSharedRange = CONTAINING_RECORD(SharedRangeEntry, LOCK_SHARED_RANGE, Entry);
|
||||||
Find.Exclusive.FileLock.StartingByte = WatchSharedRange->Start;
|
LockElement.Exclusive.FileLock.StartingByte = WatchSharedRange->Start;
|
||||||
Find.Exclusive.FileLock.EndingByte = WatchSharedRange->End;
|
LockElement.Exclusive.FileLock.EndingByte = WatchSharedRange->End;
|
||||||
if (LockCompare(&InternalInfo->RangeTable, &RemadeElement, &Find) != GenericEqual)
|
if (LockCompare(&InternalInfo->RangeTable, &RemadeElement, &LockElement) != GenericEqual)
|
||||||
{
|
{
|
||||||
DPRINT("Skipping range %08x%08x:%08x%08x\n",
|
DPRINT("Skipping range %08x%08x:%08x%08x\n",
|
||||||
Find.Exclusive.FileLock.StartingByte.HighPart,
|
LockElement.Exclusive.FileLock.StartingByte.HighPart,
|
||||||
Find.Exclusive.FileLock.StartingByte.LowPart,
|
LockElement.Exclusive.FileLock.StartingByte.LowPart,
|
||||||
Find.Exclusive.FileLock.EndingByte.HighPart,
|
LockElement.Exclusive.FileLock.EndingByte.HighPart,
|
||||||
Find.Exclusive.FileLock.EndingByte.LowPart);
|
LockElement.Exclusive.FileLock.EndingByte.LowPart);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DPRINT("Re-creating range %08x%08x:%08x%08x\n",
|
DPRINT("Re-creating range %08x%08x:%08x%08x\n",
|
||||||
Find.Exclusive.FileLock.StartingByte.HighPart,
|
LockElement.Exclusive.FileLock.StartingByte.HighPart,
|
||||||
Find.Exclusive.FileLock.StartingByte.LowPart,
|
LockElement.Exclusive.FileLock.StartingByte.LowPart,
|
||||||
Find.Exclusive.FileLock.EndingByte.HighPart,
|
LockElement.Exclusive.FileLock.EndingByte.HighPart,
|
||||||
Find.Exclusive.FileLock.EndingByte.LowPart);
|
LockElement.Exclusive.FileLock.EndingByte.LowPart);
|
||||||
RtlZeroMemory(&RemadeElement, sizeof(RemadeElement));
|
RtlZeroMemory(&RemadeElement, sizeof(RemadeElement));
|
||||||
RemadeElement.Exclusive.FileLock.StartingByte = WatchSharedRange->Start;
|
RemadeElement.Exclusive.FileLock.StartingByte = WatchSharedRange->Start;
|
||||||
RemadeElement.Exclusive.FileLock.EndingByte = WatchSharedRange->End;
|
RemadeElement.Exclusive.FileLock.EndingByte = WatchSharedRange->End;
|
||||||
RemadeElementInserted =
|
FsRtlpRebuildSharedLockRange(FileLock, InternalInfo, &RemadeElement);
|
||||||
FsRtlpRebuildSharedLockRange
|
|
||||||
(FileLock, InternalInfo, &RemadeElement);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -586,6 +586,13 @@ FsRtlNotifyFilterChangeDirectory(IN PNOTIFY_SYNC NotifySync,
|
||||||
/* Allocate new notification */
|
/* Allocate new notification */
|
||||||
NotifyChange = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
|
NotifyChange = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
|
||||||
sizeof(NOTIFY_CHANGE), 'FSrN');
|
sizeof(NOTIFY_CHANGE), 'FSrN');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If NotifyChange == NULL then an
|
||||||
|
* exception was already raised.
|
||||||
|
*/
|
||||||
|
ASSERT(NotifyChange != NULL);
|
||||||
|
|
||||||
RtlZeroMemory(NotifyChange, sizeof(NOTIFY_CHANGE));
|
RtlZeroMemory(NotifyChange, sizeof(NOTIFY_CHANGE));
|
||||||
|
|
||||||
/* Set basic information */
|
/* Set basic information */
|
||||||
|
|
|
@ -446,30 +446,39 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
|
||||||
DPRINT("RDiskCount %d\n", RDiskCount);
|
DPRINT("RDiskCount %d\n", RDiskCount);
|
||||||
|
|
||||||
Buffer1 = (PWSTR)ExAllocatePoolWithTag(PagedPool,
|
Buffer1 = ExAllocatePoolWithTag(PagedPool,
|
||||||
64 * sizeof(WCHAR), TAG_FILE_SYSTEM);
|
64 * sizeof(WCHAR),
|
||||||
Buffer2 = (PWSTR)ExAllocatePoolWithTag(PagedPool,
|
TAG_FILE_SYSTEM);
|
||||||
32 * sizeof(WCHAR), TAG_FILE_SYSTEM);
|
if (!Buffer1) return;
|
||||||
|
|
||||||
PartialInformation = (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePoolWithTag(PagedPool,
|
Buffer2 = ExAllocatePoolWithTag(PagedPool,
|
||||||
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(REG_DISK_MOUNT_INFO), TAG_FILE_SYSTEM);
|
32 * sizeof(WCHAR),
|
||||||
|
TAG_FILE_SYSTEM);
|
||||||
|
if (!Buffer2)
|
||||||
|
{
|
||||||
|
ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Buffer1 || !Buffer2 || !PartialInformation) return;
|
PartialInformation = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(REG_DISK_MOUNT_INFO),
|
||||||
|
TAG_FILE_SYSTEM);
|
||||||
|
if (!PartialInformation)
|
||||||
|
{
|
||||||
|
ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM);
|
||||||
|
ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DiskMountInfo = (PREG_DISK_MOUNT_INFO) PartialInformation->Data;
|
DiskMountInfo = (PREG_DISK_MOUNT_INFO) PartialInformation->Data;
|
||||||
|
|
||||||
/* Open or Create the 'MountedDevices' key */
|
/* Create or open the 'MountedDevices' key */
|
||||||
RtlInitUnicodeString(&UnicodeString1, L"\\Registry\\Machine\\SYSTEM\\MountedDevices");
|
RtlInitUnicodeString(&UnicodeString1, L"\\Registry\\Machine\\SYSTEM\\MountedDevices");
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&UnicodeString1,
|
&UnicodeString1,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = ZwOpenKey(&hKey,
|
|
||||||
KEY_ALL_ACCESS,
|
|
||||||
&ObjectAttributes);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
Status = ZwCreateKey(&hKey,
|
Status = ZwCreateKey(&hKey,
|
||||||
KEY_ALL_ACCESS,
|
KEY_ALL_ACCESS,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
|
@ -477,7 +486,6 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
NULL,
|
NULL,
|
||||||
REG_OPTION_NON_VOLATILE,
|
REG_OPTION_NON_VOLATILE,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
hKey = NULL;
|
hKey = NULL;
|
||||||
|
@ -535,7 +543,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
ExFreePoolWithTag(PartialInformation, TAG_FILE_SYSTEM);
|
ExFreePoolWithTag(PartialInformation, TAG_FILE_SYSTEM);
|
||||||
ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM);
|
ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM);
|
||||||
ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM);
|
ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM);
|
||||||
if (hKey) ZwClose(hKey);
|
if (hKey) ObCloseHandle(hKey, KernelMode);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(LayoutArray,
|
RtlZeroMemory(LayoutArray,
|
||||||
|
@ -951,10 +960,7 @@ end_assign_disks:
|
||||||
ExFreePoolWithTag(PartialInformation, TAG_FILE_SYSTEM);
|
ExFreePoolWithTag(PartialInformation, TAG_FILE_SYSTEM);
|
||||||
ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM);
|
ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM);
|
||||||
ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM);
|
ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM);
|
||||||
if (hKey)
|
if (hKey) ObCloseHandle(hKey, KernelMode);
|
||||||
{
|
|
||||||
ZwClose(hKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -985,7 +985,7 @@ FstubReadPartitionTableEFI(IN PDISK_INFORMATION Disk,
|
||||||
if ((Disk->SectorCount - 1ULL) != EfiHeader.AlternateLBA)
|
if ((Disk->SectorCount - 1ULL) != EfiHeader.AlternateLBA)
|
||||||
{
|
{
|
||||||
/* We'll update it. First, count number of sectors needed to store partitions */
|
/* We'll update it. First, count number of sectors needed to store partitions */
|
||||||
SectorsForPartitions = (EfiHeader.NumberOfEntries * PARTITION_ENTRY_SIZE) / Disk->SectorSize;
|
SectorsForPartitions = ((ULONGLONG)EfiHeader.NumberOfEntries * PARTITION_ENTRY_SIZE) / Disk->SectorSize;
|
||||||
/* Then set first usable LBA: Legacy MBR + GPT header + Partitions entries */
|
/* Then set first usable LBA: Legacy MBR + GPT header + Partitions entries */
|
||||||
EfiHeader.FirstUsableLBA = SectorsForPartitions + 2;
|
EfiHeader.FirstUsableLBA = SectorsForPartitions + 2;
|
||||||
/* Then set last usable LBA: Last sector - GPT header - Partitions entries */
|
/* Then set last usable LBA: Last sector - GPT header - Partitions entries */
|
||||||
|
|
|
@ -801,10 +801,10 @@ NTAPI
|
||||||
CmpOpenHiveFiles(
|
CmpOpenHiveFiles(
|
||||||
IN PCUNICODE_STRING BaseName,
|
IN PCUNICODE_STRING BaseName,
|
||||||
IN PCWSTR Extension OPTIONAL,
|
IN PCWSTR Extension OPTIONAL,
|
||||||
IN PHANDLE Primary,
|
OUT PHANDLE Primary,
|
||||||
IN PHANDLE Log,
|
OUT PHANDLE Log,
|
||||||
IN PULONG PrimaryDisposition,
|
OUT PULONG PrimaryDisposition,
|
||||||
IN PULONG LogDisposition,
|
OUT PULONG LogDisposition,
|
||||||
IN BOOLEAN CreateAllowed,
|
IN BOOLEAN CreateAllowed,
|
||||||
IN BOOLEAN MarkAsSystemHive,
|
IN BOOLEAN MarkAsSystemHive,
|
||||||
IN BOOLEAN NoBuffering,
|
IN BOOLEAN NoBuffering,
|
||||||
|
|
|
@ -227,12 +227,15 @@ IoShutdownSystem(IN ULONG Phase)
|
||||||
NULL,
|
NULL,
|
||||||
&Event,
|
&Event,
|
||||||
&StatusBlock);
|
&StatusBlock);
|
||||||
|
if (Irp)
|
||||||
|
{
|
||||||
Status = IoCallDriver(DeviceObject, Irp);
|
Status = IoCallDriver(DeviceObject, Irp);
|
||||||
if (Status == STATUS_PENDING)
|
if (Status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
/* Wait on the driver */
|
/* Wait on the driver */
|
||||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove the flag */
|
/* Remove the flag */
|
||||||
ShutdownEntry->DeviceObject->Flags &= ~DO_SHUTDOWN_REGISTERED;
|
ShutdownEntry->DeviceObject->Flags &= ~DO_SHUTDOWN_REGISTERED;
|
||||||
|
|
|
@ -795,6 +795,11 @@ LdrProcessDriverModule(PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||||
&MissingApiName,
|
&MissingApiName,
|
||||||
&MissingDriverName,
|
&MissingDriverName,
|
||||||
&LoadedImports);
|
&LoadedImports);
|
||||||
|
|
||||||
|
/* Free the temporary buffer */
|
||||||
|
ExFreePoolWithTag(Buffer, TAG_LDR_WSTR);
|
||||||
|
|
||||||
|
/* Check the result of the imports resolution */
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* Return */
|
/* Return */
|
||||||
|
|
|
@ -42,12 +42,17 @@ IopCreateEvent(IN PUNICODE_STRING EventName,
|
||||||
if (!NT_SUCCESS(Status)) return NULL;
|
if (!NT_SUCCESS(Status)) return NULL;
|
||||||
|
|
||||||
/* Get a handle to it */
|
/* Get a handle to it */
|
||||||
ObReferenceObjectByHandle(Handle,
|
Status = ObReferenceObjectByHandle(Handle,
|
||||||
0,
|
0,
|
||||||
ExEventObjectType,
|
ExEventObjectType,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
(PVOID*)&Event,
|
(PVOID*)&Event,
|
||||||
NULL);
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ZwClose(Handle);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Dereference the extra count, and return the handle */
|
/* Dereference the extra count, and return the handle */
|
||||||
ObDereferenceObject(Event);
|
ObDereferenceObject(Event);
|
||||||
|
|
|
@ -119,7 +119,7 @@ IopPerformSynchronousRequest(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKNORMAL_ROUTINE NormalRoutine;
|
PKNORMAL_ROUTINE NormalRoutine;
|
||||||
PVOID NormalContext;
|
PVOID NormalContext = NULL;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
IOTRACE(IO_API_DEBUG, "IRP: %p. DO: %p. FO: %p \n",
|
IOTRACE(IO_API_DEBUG, "IRP: %p. DO: %p. FO: %p \n",
|
||||||
|
|
|
@ -701,7 +701,7 @@ IopStoreSystemPartitionInformation(IN PUNICODE_STRING NtSystemPartitionDeviceNam
|
||||||
UNICODE_STRING LinkTarget, KeyName;
|
UNICODE_STRING LinkTarget, KeyName;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
HANDLE LinkHandle, RegistryHandle, KeyHandle;
|
HANDLE LinkHandle, RegistryHandle, KeyHandle;
|
||||||
WCHAR LinkTargetBuffer[256], KeyNameBuffer[sizeof(L"SystemPartition") / sizeof(WCHAR)];
|
WCHAR LinkTargetBuffer[256];
|
||||||
UNICODE_STRING CmRegistryMachineSystemName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM");
|
UNICODE_STRING CmRegistryMachineSystemName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM");
|
||||||
|
|
||||||
ASSERT(NtSystemPartitionDeviceName->MaximumLength >= NtSystemPartitionDeviceName->Length + sizeof(WCHAR));
|
ASSERT(NtSystemPartitionDeviceName->MaximumLength >= NtSystemPartitionDeviceName->Length + sizeof(WCHAR));
|
||||||
|
@ -760,13 +760,9 @@ IopStoreSystemPartitionInformation(IN PUNICODE_STRING NtSystemPartitionDeviceNam
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We'll store in Setup subkey, and as we love fun, we use only one buffer for three writings... */
|
/* Open or create the Setup subkey where we'll store in */
|
||||||
wcscpy(KeyNameBuffer, L"Setup");
|
RtlInitUnicodeString(&KeyName, L"Setup");
|
||||||
KeyName.Length = sizeof(L"Setup") - sizeof(UNICODE_NULL);
|
|
||||||
KeyName.MaximumLength = sizeof(L"Setup");
|
|
||||||
KeyName.Buffer = KeyNameBuffer;
|
|
||||||
|
|
||||||
/* So, open or create the subkey */
|
|
||||||
Status = IopCreateRegistryKeyEx(&KeyHandle,
|
Status = IopCreateRegistryKeyEx(&KeyHandle,
|
||||||
RegistryHandle,
|
RegistryHandle,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
|
@ -784,9 +780,7 @@ IopStoreSystemPartitionInformation(IN PUNICODE_STRING NtSystemPartitionDeviceNam
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare first data writing... */
|
/* Prepare first data writing... */
|
||||||
wcscpy(KeyNameBuffer, L"SystemPartition");
|
RtlInitUnicodeString(&KeyName, L"SystemPartition");
|
||||||
KeyName.Length = sizeof(L"SystemPartition") - sizeof(UNICODE_NULL);
|
|
||||||
KeyName.MaximumLength = sizeof(L"SystemPartition");
|
|
||||||
|
|
||||||
/* Write SystemPartition value which is the target of the symbolic link */
|
/* Write SystemPartition value which is the target of the symbolic link */
|
||||||
Status = ZwSetValueKey(KeyHandle,
|
Status = ZwSetValueKey(KeyHandle,
|
||||||
|
@ -801,9 +795,7 @@ IopStoreSystemPartitionInformation(IN PUNICODE_STRING NtSystemPartitionDeviceNam
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare for second data writing... */
|
/* Prepare for second data writing... */
|
||||||
wcscpy(KeyName.Buffer, L"OsLoaderPath");
|
RtlInitUnicodeString(&KeyName, L"OsLoaderPath");
|
||||||
KeyName.Length = sizeof(L"OsLoaderPath") - sizeof(UNICODE_NULL);
|
|
||||||
KeyName.MaximumLength = sizeof(L"OsLoaderPath");
|
|
||||||
|
|
||||||
/* Remove trailing slash if any (one slash only excepted) */
|
/* Remove trailing slash if any (one slash only excepted) */
|
||||||
if (OsLoaderPathName->Length > sizeof(WCHAR) &&
|
if (OsLoaderPathName->Length > sizeof(WCHAR) &&
|
||||||
|
|
|
@ -224,7 +224,7 @@ IopStartRamdisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
// Build the symbolic link name and target
|
// Build the symbolic link name and target
|
||||||
//
|
//
|
||||||
_snwprintf(SourceString,
|
_snwprintf(SourceString,
|
||||||
sizeof(SourceString),
|
sizeof(SourceString)/sizeof(WCHAR),
|
||||||
L"\\Device\\Ramdisk%wZ",
|
L"\\Device\\Ramdisk%wZ",
|
||||||
&GuidString);
|
&GuidString);
|
||||||
SymbolicLinkName.Length = 38;
|
SymbolicLinkName.Length = 38;
|
||||||
|
|
|
@ -377,12 +377,15 @@ IopShutdownBaseFileSystems(IN PLIST_ENTRY ListHead)
|
||||||
NULL,
|
NULL,
|
||||||
&Event,
|
&Event,
|
||||||
&StatusBlock);
|
&StatusBlock);
|
||||||
|
if (Irp)
|
||||||
|
{
|
||||||
Status = IoCallDriver(DeviceObject, Irp);
|
Status = IoCallDriver(DeviceObject, Irp);
|
||||||
if (Status == STATUS_PENDING)
|
if (Status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
/* Wait on the driver */
|
/* Wait on the driver */
|
||||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset the event */
|
/* Reset the event */
|
||||||
KeClearEvent(&Event);
|
KeClearEvent(&Event);
|
||||||
|
|
|
@ -80,7 +80,7 @@ IopNotifyPlugPlayNotification(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
KeReleaseGuardedMutex(&PnpNotifyListLock);
|
KeReleaseGuardedMutex(&PnpNotifyListLock);
|
||||||
ExFreePool(NotificationStructure);
|
ExFreePoolWithTag(NotificationStructure, TAG_PNP_NOTIFY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -192,6 +192,7 @@ IopNotifyPlugPlayNotification(
|
||||||
CallCurrentEntry = TRUE;
|
CallCurrentEntry = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|
|
@ -864,7 +864,7 @@ KdbpCmdRegs(
|
||||||
else if (Argv[0][0] == 'c') /* cregs */
|
else if (Argv[0][0] == 'c') /* cregs */
|
||||||
{
|
{
|
||||||
ULONG Cr0, Cr2, Cr3, Cr4;
|
ULONG Cr0, Cr2, Cr3, Cr4;
|
||||||
KDESCRIPTOR Gdtr, Idtr;
|
KDESCRIPTOR Gdtr = {0, 0, 0}, Idtr = {0, 0, 0};
|
||||||
USHORT Ldtr;
|
USHORT Ldtr;
|
||||||
static const PCHAR Cr0Bits[32] = { " PE", " MP", " EM", " TS", " ET", " NE", NULL, NULL,
|
static const PCHAR Cr0Bits[32] = { " PE", " MP", " EM", " TS", " ET", " NE", NULL, NULL,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
|
@ -1137,7 +1137,7 @@ NTAPI
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
KiI386PentiumLockErrataFixup(VOID)
|
KiI386PentiumLockErrataFixup(VOID)
|
||||||
{
|
{
|
||||||
KDESCRIPTOR IdtDescriptor;
|
KDESCRIPTOR IdtDescriptor = {0, 0, 0};
|
||||||
PKIDTENTRY NewIdt, NewIdt2;
|
PKIDTENTRY NewIdt, NewIdt2;
|
||||||
|
|
||||||
/* Allocate memory for a new IDT */
|
/* Allocate memory for a new IDT */
|
||||||
|
|
|
@ -142,7 +142,7 @@ KeStartProfile(IN PKPROFILE Profile,
|
||||||
KeLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
|
|
||||||
/* Free the pool */
|
/* Free the pool */
|
||||||
if (FreeBuffer) ExFreePool(SourceBuffer);
|
if (FreeBuffer) ExFreePoolWithTag(SourceBuffer, 'forP');
|
||||||
|
|
||||||
/* Return whether we could start the profile */
|
/* Return whether we could start the profile */
|
||||||
return StartedProfile;
|
return StartedProfile;
|
||||||
|
|
|
@ -1429,7 +1429,7 @@ NtQueryObject(IN HANDLE ObjectHandle,
|
||||||
POBJECT_HEADER ObjectHeader = NULL;
|
POBJECT_HEADER ObjectHeader = NULL;
|
||||||
POBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleFlags;
|
POBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleFlags;
|
||||||
POBJECT_BASIC_INFORMATION BasicInfo;
|
POBJECT_BASIC_INFORMATION BasicInfo;
|
||||||
ULONG InfoLength;
|
ULONG InfoLength = 0;
|
||||||
PVOID Object = NULL;
|
PVOID Object = NULL;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
|
|
|
@ -595,7 +595,12 @@ NtCreateSymbolicLinkObject(OUT PHANDLE LinkHandle,
|
||||||
ExAllocatePoolWithTag(PagedPool,
|
ExAllocatePoolWithTag(PagedPool,
|
||||||
CapturedLinkTarget.MaximumLength,
|
CapturedLinkTarget.MaximumLength,
|
||||||
TAG_SYMLINK_TARGET);
|
TAG_SYMLINK_TARGET);
|
||||||
if (!SymbolicLink->LinkTarget.Buffer) return STATUS_NO_MEMORY;
|
if (!SymbolicLink->LinkTarget.Buffer)
|
||||||
|
{
|
||||||
|
/* Dereference the symbolic link object and fail */
|
||||||
|
ObDereferenceObject(SymbolicLink);
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy it */
|
/* Copy it */
|
||||||
RtlCopyMemory(SymbolicLink->LinkTarget.Buffer,
|
RtlCopyMemory(SymbolicLink->LinkTarget.Buffer,
|
||||||
|
|
|
@ -427,7 +427,7 @@ ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor,
|
||||||
*OutputSecurityDescriptor = &SdHeader->SecurityDescriptor;
|
*OutputSecurityDescriptor = &SdHeader->SecurityDescriptor;
|
||||||
|
|
||||||
/* Free anything that we may have had to create */
|
/* Free anything that we may have had to create */
|
||||||
if (NewHeader) ExFreePool(NewHeader);
|
if (NewHeader) ExFreePoolWithTag(NewHeader, TAG_OB_SD_CACHE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ ObCheckCreateObjectAccess(IN PVOID Object,
|
||||||
{
|
{
|
||||||
POBJECT_HEADER ObjectHeader;
|
POBJECT_HEADER ObjectHeader;
|
||||||
POBJECT_TYPE ObjectType;
|
POBJECT_TYPE ObjectType;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
|
||||||
BOOLEAN SdAllocated;
|
BOOLEAN SdAllocated;
|
||||||
BOOLEAN Result = TRUE;
|
BOOLEAN Result = TRUE;
|
||||||
ACCESS_MASK GrantedAccess = 0;
|
ACCESS_MASK GrantedAccess = 0;
|
||||||
|
@ -280,7 +280,7 @@ ObpCheckTraverseAccess(IN PVOID Object,
|
||||||
{
|
{
|
||||||
POBJECT_HEADER ObjectHeader;
|
POBJECT_HEADER ObjectHeader;
|
||||||
POBJECT_TYPE ObjectType;
|
POBJECT_TYPE ObjectType;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
|
||||||
BOOLEAN SdAllocated;
|
BOOLEAN SdAllocated;
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
ACCESS_MASK GrantedAccess = 0;
|
ACCESS_MASK GrantedAccess = 0;
|
||||||
|
@ -338,7 +338,7 @@ ObpCheckObjectReference(IN PVOID Object,
|
||||||
{
|
{
|
||||||
POBJECT_HEADER ObjectHeader;
|
POBJECT_HEADER ObjectHeader;
|
||||||
POBJECT_TYPE ObjectType;
|
POBJECT_TYPE ObjectType;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
|
||||||
BOOLEAN SdAllocated;
|
BOOLEAN SdAllocated;
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
ACCESS_MASK GrantedAccess = 0;
|
ACCESS_MASK GrantedAccess = 0;
|
||||||
|
|
|
@ -91,6 +91,7 @@ PopSendQuerySystemPowerState(PDEVICE_OBJECT DeviceObject, SYSTEM_POWER_STATE Sys
|
||||||
NULL,
|
NULL,
|
||||||
&Event,
|
&Event,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
|
if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
IrpSp = IoGetNextIrpStackLocation(Irp);
|
IrpSp = IoGetNextIrpStackLocation(Irp);
|
||||||
IrpSp->MinorFunction = IRP_MN_QUERY_POWER;
|
IrpSp->MinorFunction = IRP_MN_QUERY_POWER;
|
||||||
|
@ -132,6 +133,7 @@ PopSendSetSystemPowerState(PDEVICE_OBJECT DeviceObject, SYSTEM_POWER_STATE Syste
|
||||||
NULL,
|
NULL,
|
||||||
&Event,
|
&Event,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
|
if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
IrpSp = IoGetNextIrpStackLocation(Irp);
|
IrpSp = IoGetNextIrpStackLocation(Irp);
|
||||||
IrpSp->MinorFunction = IRP_MN_SET_POWER;
|
IrpSp->MinorFunction = IRP_MN_SET_POWER;
|
||||||
|
|
|
@ -1006,7 +1006,7 @@ PspTerminateThreadByPointer(IN PETHREAD Thread,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We failed, free the APC */
|
/* We failed, free the APC */
|
||||||
ExFreePool(Apc);
|
ExFreePoolWithTag(Apc, TAG_TERMINATE_APC);
|
||||||
|
|
||||||
/* Return Status */
|
/* Return Status */
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -221,7 +221,7 @@ PspSetPrimaryToken(IN PEPROCESS Process,
|
||||||
PACCESS_TOKEN NewToken = Token;
|
PACCESS_TOKEN NewToken = Token;
|
||||||
NTSTATUS Status, AccessStatus;
|
NTSTATUS Status, AccessStatus;
|
||||||
BOOLEAN Result, SdAllocated;
|
BOOLEAN Result, SdAllocated;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
|
||||||
SECURITY_SUBJECT_CONTEXT SubjectContext;
|
SECURITY_SUBJECT_CONTEXT SubjectContext;
|
||||||
PSTRACE(PS_SECURITY_DEBUG, "Process: %p Token: %p\n", Process, Token);
|
PSTRACE(PS_SECURITY_DEBUG, "Process: %p Token: %p\n", Process, Token);
|
||||||
|
|
||||||
|
@ -638,7 +638,7 @@ PsImpersonateClient(IN PETHREAD Thread,
|
||||||
if (OldData)
|
if (OldData)
|
||||||
{
|
{
|
||||||
/* Someone beat us to it, free our copy */
|
/* Someone beat us to it, free our copy */
|
||||||
ExFreePool(Impersonation);
|
ExFreePoolWithTag(Impersonation, TAG_PS_IMPERSONATION);
|
||||||
Impersonation = OldData;
|
Impersonation = OldData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue