strip whitespace from end of lines

svn path=/trunk/; revision=15164
This commit is contained in:
Steven Edwards 2005-05-09 01:38:29 +00:00
parent 2d9fea6a7c
commit e4be245882
260 changed files with 6230 additions and 6230 deletions

View file

@ -1,5 +1,5 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/cc/cacheman.c
@ -31,7 +31,7 @@ CcGetFlushedValidData (
IN BOOLEAN BcbListHeld
)
{
LARGE_INTEGER i;
LARGE_INTEGER i;
UNIMPLEMENTED;

View file

@ -40,7 +40,7 @@ ULONG CcFastReadResourceMiss;
/* FUNCTIONS *****************************************************************/
VOID
VOID
CcInitCacheZeroPage(VOID)
{
NTSTATUS Status;
@ -100,7 +100,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
Buffer = pTemp;
}
#endif
Length = Length - TempLength;
Length = Length - TempLength;
previous = current;
current = current->NextInChain;
CcRosReleaseCacheSegment(Bcb, previous, TRUE, FALSE, FALSE);
@ -126,7 +126,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
current2 = current2->NextInChain;
current_size += Bcb->CacheSegmentSize;
}
/*
* Create an MDL which contains all their pages.
*/
@ -191,7 +191,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
Buffer = pTemp;
}
#endif
Length = Length - TempLength;
Length = Length - TempLength;
CcRosReleaseCacheSegment(Bcb, previous, TRUE, FALSE, FALSE);
current_size += Bcb->CacheSegmentSize;
}
@ -200,7 +200,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length,
return(STATUS_SUCCESS);
}
NTSTATUS
NTSTATUS
ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
{
ULONG Size;
@ -221,7 +221,7 @@ ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
MmBuildMdlForNonPagedPool(Mdl);
Mdl->MdlFlags |= MDL_IO_PAGE_READ;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Status = IoPageRead(CacheSeg->Bcb->FileObject, Mdl, &SegOffset, & Event, &IoStatus);
Status = IoPageRead(CacheSeg->Bcb->FileObject, Mdl, &SegOffset, & Event, &IoStatus);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
@ -235,13 +235,13 @@ ReadCacheSegment(PCACHE_SEGMENT CacheSeg)
}
if (CacheSeg->Bcb->CacheSegmentSize > Size)
{
memset ((char*)CacheSeg->BaseAddress + Size, 0,
memset ((char*)CacheSeg->BaseAddress + Size, 0,
CacheSeg->Bcb->CacheSegmentSize - Size);
}
return STATUS_SUCCESS;
}
NTSTATUS
NTSTATUS
WriteCacheSegment(PCACHE_SEGMENT CacheSeg)
{
ULONG Size;
@ -316,7 +316,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
KIRQL oldirql;
PLIST_ENTRY current_entry;
PCACHE_SEGMENT current;
DPRINT("CcCopyRead(FileObject %x, FileOffset %x, "
"Length %d, Wait %d, Buffer %x, IoStatus %x)\n",
FileObject, (ULONG)FileOffset->QuadPart, Length, Wait,
@ -324,7 +324,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
ReadOffset = (ULONG)FileOffset->QuadPart;
DPRINT("AllocationSize %d, FileSize %d\n",
(ULONG)Bcb->AllocationSize.QuadPart,
(ULONG)Bcb->FileSize.QuadPart);
@ -339,7 +339,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
current_entry = Bcb->BcbSegmentListHead.Flink;
while (current_entry != &Bcb->BcbSegmentListHead)
{
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
BcbSegmentListEntry);
if (!current->Valid && current->FileOffset < ReadOffset + Length
&& current->FileOffset + Bcb->CacheSegmentSize > ReadOffset)
@ -359,7 +359,7 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
{
TempLength = min (Length, Bcb->CacheSegmentSize - TempLength);
Status = CcRosRequestCacheSegment(Bcb,
ROUND_DOWN(ReadOffset,
ROUND_DOWN(ReadOffset,
Bcb->CacheSegmentSize),
&BaseAddress, &Valid, &CacheSeg);
if (!NT_SUCCESS(Status))
@ -380,14 +380,14 @@ CcCopyRead (IN PFILE_OBJECT FileObject,
return FALSE;
}
}
memcpy (Buffer, (char*)BaseAddress + ReadOffset % Bcb->CacheSegmentSize,
memcpy (Buffer, (char*)BaseAddress + ReadOffset % Bcb->CacheSegmentSize,
TempLength);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
ReadLength += TempLength;
Length -= TempLength;
ReadOffset += TempLength;
Buffer = (PVOID)((char*)Buffer + TempLength);
}
}
while (Length > 0)
{
TempLength = min(max(Bcb->CacheSegmentSize, MAX_RW_LENGTH), Length);
@ -445,14 +445,14 @@ CcCopyWrite (IN PFILE_OBJECT FileObject,
current_entry = Bcb->BcbSegmentListHead.Flink;
while (current_entry != &Bcb->BcbSegmentListHead)
{
CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
BcbSegmentListEntry);
if (!CacheSeg->Valid)
{
if ((WriteOffset >= CacheSeg->FileOffset &&
if ((WriteOffset >= CacheSeg->FileOffset &&
WriteOffset < CacheSeg->FileOffset + Bcb->CacheSegmentSize)
|| (WriteOffset + Length > CacheSeg->FileOffset &&
WriteOffset + Length <= CacheSeg->FileOffset +
|| (WriteOffset + Length > CacheSeg->FileOffset &&
WriteOffset + Length <= CacheSeg->FileOffset +
Bcb->CacheSegmentSize))
{
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
@ -484,10 +484,10 @@ CcCopyWrite (IN PFILE_OBJECT FileObject,
return(FALSE);
}
}
memcpy ((char*)BaseAddress + WriteOffset % Bcb->CacheSegmentSize,
memcpy ((char*)BaseAddress + WriteOffset % Bcb->CacheSegmentSize,
Buffer, TempLength);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, TRUE, FALSE);
Length -= TempLength;
WriteOffset += TempLength;
#if defined(__GNUC__)
@ -500,7 +500,7 @@ CcCopyWrite (IN PFILE_OBJECT FileObject,
}
#endif
}
while (Length > 0)
{
TempLength = min (Bcb->CacheSegmentSize, Length);
@ -612,11 +612,11 @@ CcZeroData (IN PFILE_OBJECT FileObject,
ULONG i;
IO_STATUS_BLOCK Iosb;
KEVENT Event;
DPRINT("CcZeroData(FileObject %x, StartOffset %I64x, EndOffset %I64x, "
"Wait %d)\n", FileObject, StartOffset->QuadPart, EndOffset->QuadPart,
"Wait %d)\n", FileObject, StartOffset->QuadPart, EndOffset->QuadPart,
Wait);
Length = EndOffset->u.LowPart - StartOffset->u.LowPart;
WriteOffset.QuadPart = StartOffset->QuadPart;
@ -625,7 +625,7 @@ CcZeroData (IN PFILE_OBJECT FileObject,
/* File is not cached */
Mdl = alloca(MmSizeOfMdl(NULL, MAX_ZERO_LENGTH));
while (Length > 0)
{
if (Length + WriteOffset.u.LowPart % PAGE_SIZE > MAX_ZERO_LENGTH)
@ -649,7 +649,7 @@ CcZeroData (IN PFILE_OBJECT FileObject,
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = Iosb.Status;
}
MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);
MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);
if (!NT_SUCCESS(Status))
{
return(FALSE);
@ -675,14 +675,14 @@ CcZeroData (IN PFILE_OBJECT FileObject,
current_entry = Bcb->BcbSegmentListHead.Flink;
while (current_entry != &Bcb->BcbSegmentListHead)
{
CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
CacheSeg = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
BcbSegmentListEntry);
if (!CacheSeg->Valid)
{
if ((WriteOffset.u.LowPart >= CacheSeg->FileOffset &&
if ((WriteOffset.u.LowPart >= CacheSeg->FileOffset &&
WriteOffset.u.LowPart < CacheSeg->FileOffset + Bcb->CacheSegmentSize)
|| (WriteOffset.u.LowPart + Length > CacheSeg->FileOffset &&
WriteOffset.u.LowPart + Length <=
|| (WriteOffset.u.LowPart + Length > CacheSeg->FileOffset &&
WriteOffset.u.LowPart + Length <=
CacheSeg->FileOffset + Bcb->CacheSegmentSize))
{
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
@ -726,7 +726,7 @@ CcZeroData (IN PFILE_OBJECT FileObject,
Status = ReadCacheSegment(current);
if (!NT_SUCCESS(Status))
{
DPRINT1("ReadCacheSegment failed, status %x\n",
DPRINT1("ReadCacheSegment failed, status %x\n",
Status);
}
}
@ -743,7 +743,7 @@ CcZeroData (IN PFILE_OBJECT FileObject,
Length -= TempLength;
current = current->NextInChain;
}
}
current = CacheSeg;
while (current != NULL)

View file

@ -1,4 +1,4 @@
/* $Id:$
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -17,7 +17,7 @@
#ifndef VACB_MAPPING_GRANULARITY
#define VACB_MAPPING_GRANULARITY (256 * 1024)
#endif
/* GLOBALS *****************************************************************/
extern FAST_MUTEX ViewLock;
@ -41,7 +41,7 @@ CcGetDirtyPages (
{
UNIMPLEMENTED;
LARGE_INTEGER i;
LARGE_INTEGER i;
i.QuadPart = 0;
return i;
}
@ -71,7 +71,7 @@ CcGetLsnForFileObject (
{
UNIMPLEMENTED;
LARGE_INTEGER i;
LARGE_INTEGER i;
i.QuadPart = 0;
return i;
}
@ -136,7 +136,7 @@ CcSetFileSizes (IN PFILE_OBJECT FileObject,
LIST_ENTRY FreeListHead;
NTSTATUS Status;
DPRINT("CcSetFileSizes(FileObject %x, FileSizes %x)\n",
DPRINT("CcSetFileSizes(FileObject %x, FileSizes %x)\n",
FileObject, FileSizes);
DPRINT("AllocationSize %d, FileSize %d, ValidDataLength %d\n",
(ULONG)FileSizes->AllocationSize.QuadPart,
@ -151,7 +151,7 @@ CcSetFileSizes (IN PFILE_OBJECT FileObject,
*/
if (Bcb == NULL)
return;
if (FileSizes->AllocationSize.QuadPart < Bcb->AllocationSize.QuadPart)
{
InitializeListHead(&FreeListHead);
@ -184,7 +184,7 @@ CcSetFileSizes (IN PFILE_OBJECT FileObject,
}
}
}
Bcb->AllocationSize = FileSizes->AllocationSize;
Bcb->FileSize = FileSizes->FileSize;
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);

View file

@ -1,5 +1,5 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/cc/fs.c
@ -49,13 +49,13 @@ CcMdlRead(
* Used by CcMdlReadComplete@8 and FsRtl
*
*/
VOID
VOID
STDCALL
CcMdlReadCompleteDev(IN PMDL MdlChain,
IN PFILE_OBJECT FileObject)
{
PMDL Mdl;
/* Free MDLs */
while ((Mdl = MdlChain))
{
@ -88,11 +88,11 @@ CcMdlReadComplete(IN PFILE_OBJECT FileObject,
{
PDEVICE_OBJECT DeviceObject = NULL;
PFAST_IO_DISPATCH FastDispatch;
/* Get Fast Dispatch Data */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
/* Check if we support Fast Calls, and check this one */
if (FastDispatch && FastDispatch->MdlReadComplete)
{
@ -101,7 +101,7 @@ CcMdlReadComplete(IN PFILE_OBJECT FileObject,
MdlChain,
DeviceObject);
}
/* Use slow path */
CcMdlReadCompleteDev(MdlChain, FileObject);
}
@ -117,11 +117,11 @@ CcMdlWriteComplete(IN PFILE_OBJECT FileObject,
{
PDEVICE_OBJECT DeviceObject = NULL;
PFAST_IO_DISPATCH FastDispatch;
/* Get Fast Dispatch Data */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
/* Check if we support Fast Calls, and check this one */
if (FastDispatch && FastDispatch->MdlWriteComplete)
{
@ -131,7 +131,7 @@ CcMdlWriteComplete(IN PFILE_OBJECT FileObject,
MdlChain,
DeviceObject);
}
/* Use slow path */
CcMdlWriteCompleteDev(FileOffset, MdlChain, FileObject);
}

View file

@ -40,11 +40,11 @@ CcMapData (IN PFILE_OBJECT FileObject,
NTSTATUS Status;
PINTERNAL_BCB iBcb;
ULONG ROffset;
DPRINT("CcMapData(FileObject %x, FileOffset %d, Length %d, Wait %d,"
" pBcb %x, pBuffer %x)\n", FileObject, (ULONG)FileOffset->QuadPart,
Length, Wait, pBcb, pBuffer);
ReadOffset = (ULONG)FileOffset->QuadPart;
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
ASSERT(Bcb);
@ -52,7 +52,7 @@ CcMapData (IN PFILE_OBJECT FileObject,
DPRINT("AllocationSize %d, FileSize %d\n",
(ULONG)Bcb->AllocationSize.QuadPart,
(ULONG)Bcb->FileSize.QuadPart);
if (ReadOffset % Bcb->CacheSegmentSize + Length > Bcb->CacheSegmentSize)
{
return(FALSE);
@ -193,7 +193,7 @@ VOID STDCALL
CcUnpinData (IN PVOID Bcb)
{
PINTERNAL_BCB iBcb = Bcb;
CcRosReleaseCacheSegment(iBcb->CacheSegment->Bcb, iBcb->CacheSegment, TRUE,
CcRosReleaseCacheSegment(iBcb->CacheSegment->Bcb, iBcb->CacheSegment, TRUE,
iBcb->Dirty, FALSE);
if (--iBcb->RefCount == 0)
{

View file

@ -10,24 +10,24 @@
/* NOTES **********************************************************************
*
* This is not the NT implementation of a file cache nor anything much like
* it.
* This is not the NT implementation of a file cache nor anything much like
* it.
*
* The general procedure for a filesystem to implement a read or write
* The general procedure for a filesystem to implement a read or write
* dispatch routine is as follows
*
*
* (1) If caching for the FCB hasn't been initiated then so do by calling
* CcInitializeFileCache.
*
* (2) For each 4k region which is being read or written obtain a cache page
* by calling CcRequestCachePage.
*
* (3) If either the page is being read or not completely written, and it is
* (2) For each 4k region which is being read or written obtain a cache page
* by calling CcRequestCachePage.
*
* (3) If either the page is being read or not completely written, and it is
* not up to date then read its data from the underlying medium. If the read
* fails then call CcReleaseCachePage with VALID as FALSE and return a error.
*
* fails then call CcReleaseCachePage with VALID as FALSE and return a error.
*
* (4) Copy the data into or out of the page as necessary.
*
*
* (5) Release the cache page
*/
/* INCLUDES ******************************************************************/
@ -39,9 +39,9 @@
/* GLOBALS *******************************************************************/
/*
* If CACHE_BITMAP is defined, the cache manager uses one large memory region
* within the kernel address space and allocate/deallocate space from this block
* over a bitmap. If CACHE_BITMAP is used, the size of the mdl mapping region
* If CACHE_BITMAP is defined, the cache manager uses one large memory region
* within the kernel address space and allocate/deallocate space from this block
* over a bitmap. If CACHE_BITMAP is used, the size of the mdl mapping region
* must be reduced (ntoskrnl\mm\mdl.c, MI_MDLMAPPING_REGION_SIZE).
*/
//#define CACHE_BITMAP
@ -148,7 +148,7 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count)
}
NewTarget = WriteCount[0];
Target = max(NewTarget, Target);
current_entry = DirtySegmentListHead.Flink;
@ -158,7 +158,7 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count)
}
while (current_entry != &DirtySegmentListHead && Target > 0)
{
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
DirtySegmentListEntry);
current_entry = current_entry->Flink;
Locked = ExTryToAcquireFastMutex(&current->Lock);
@ -174,7 +174,7 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count)
}
ExReleaseFastMutex(&ViewLock);
PagesPerSegment = current->Bcb->CacheSegmentSize / PAGE_SIZE;
Status = CcRosFlushCacheSegment(current);
Status = CcRosFlushCacheSegment(current);
ExReleaseFastMutex(&current->Lock);
if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE))
{
@ -205,7 +205,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
* ARGUMENTS:
* Target - The number of pages to be freed.
* Priority - The priority of free (currently unused).
* NrFreed - Points to a variable where the number of pages
* NrFreed - Points to a variable where the number of pages
* actually freed is returned.
*/
{
@ -219,17 +219,17 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
DPRINT("CcRosTrimCache(Target %d)\n", Target);
*NrFreed = 0;
InitializeListHead(&FreeList);
ExAcquireFastMutex(&ViewLock);
current_entry = CacheSegmentLRUListHead.Flink;
while (current_entry != &CacheSegmentLRUListHead && Target > 0)
{
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
CacheSegmentLRUListEntry);
current_entry = current_entry->Flink;
KeAcquireSpinLock(&current->Bcb->BcbLock, &oldIrql);
if (current->ReferenceCount == 0)
{
@ -249,7 +249,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
{
ULONG i;
NTSTATUS Status;
current->ReferenceCount++;
last = current;
current->PageOut = TRUE;
@ -281,7 +281,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
while (!IsListEmpty(&FreeList))
{
current_entry = RemoveHeadList(&FreeList);
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
BcbSegmentListEntry);
CcRosInternalFreeCacheSegment(current);
}
@ -290,7 +290,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
return(STATUS_SUCCESS);
}
NTSTATUS
NTSTATUS
CcRosReleaseCacheSegment(PBCB Bcb,
PCACHE_SEGMENT CacheSeg,
BOOLEAN Valid,
@ -334,11 +334,11 @@ CcRosReleaseCacheSegment(PBCB Bcb,
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
ExReleaseFastMutex(&ViewLock);
ExReleaseFastMutex(&CacheSeg->Lock);
return(STATUS_SUCCESS);
}
PCACHE_SEGMENT
PCACHE_SEGMENT
CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset)
{
PLIST_ENTRY current_entry;
@ -353,7 +353,7 @@ CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset)
current_entry = Bcb->BcbSegmentListHead.Flink;
while (current_entry != &Bcb->BcbSegmentListHead)
{
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
BcbSegmentListEntry);
if (current->FileOffset <= FileOffset &&
(current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
@ -499,14 +499,14 @@ CcRosCreateCacheSegment(PBCB Bcb,
/* There is window between the call to CcRosLookupCacheSegment
* and CcRosCreateCacheSegment. We must check if a segment on
* the fileoffset exist. If there exist a segment, we release
* our new created segment and return the existing one.
* our new created segment and return the existing one.
*/
KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql);
current_entry = Bcb->BcbSegmentListHead.Flink;
previous = NULL;
while (current_entry != &Bcb->BcbSegmentListHead)
{
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
BcbSegmentListEntry);
if (current->FileOffset <= FileOffset &&
(current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
@ -554,7 +554,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql);
StartingOffset = RtlFindClearBitsAndSet(&CiCacheSegMappingRegionAllocMap, Bcb->CacheSegmentSize / PAGE_SIZE, CiCacheSegMappingRegionHint);
if (StartingOffset == 0xffffffff)
{
DPRINT1("Out of CacheSeg mapping space\n");
@ -565,7 +565,7 @@ CcRosCreateCacheSegment(PBCB Bcb,
if (CiCacheSegMappingRegionHint == StartingOffset)
{
CiCacheSegMappingRegionHint += Bcb->CacheSegmentSize / PAGE_SIZE;
CiCacheSegMappingRegionHint += Bcb->CacheSegmentSize / PAGE_SIZE;
}
KeReleaseSpinLock(&CiCacheSegMappingRegionLock, oldIrql);
@ -627,10 +627,10 @@ CcRosGetCacheSegmentChain(PBCB Bcb,
Length = ROUND_UP(Length, Bcb->CacheSegmentSize);
#if defined(__GNUC__)
CacheSegList = alloca(sizeof(PCACHE_SEGMENT) *
CacheSegList = alloca(sizeof(PCACHE_SEGMENT) *
(Length / Bcb->CacheSegmentSize));
#elif defined(_MSC_VER)
CacheSegList = _alloca(sizeof(PCACHE_SEGMENT) *
CacheSegList = _alloca(sizeof(PCACHE_SEGMENT) *
(Length / Bcb->CacheSegmentSize));
#else
#error Unknown compiler for alloca intrinsic stack allocation "function"
@ -668,7 +668,7 @@ CcRosGetCacheSegmentChain(PBCB Bcb,
}
}
Previous->NextInChain = NULL;
return(STATUS_SUCCESS);
}
@ -713,7 +713,7 @@ CcRosGetCacheSegment(PBCB Bcb,
return(STATUS_SUCCESS);
}
NTSTATUS STDCALL
NTSTATUS STDCALL
CcRosRequestCacheSegment(PBCB Bcb,
ULONG FileOffset,
PVOID* BaseAddress,
@ -743,8 +743,8 @@ CcRosRequestCacheSegment(PBCB Bcb,
}
#ifdef CACHE_BITMAP
#else
STATIC VOID
CcFreeCachePage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
STATIC VOID
CcFreeCachePage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
PFN_TYPE Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
{
ASSERT(SwapEntry == 0);
@ -754,7 +754,7 @@ CcFreeCachePage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
}
}
#endif
NTSTATUS
NTSTATUS
CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg)
/*
* FUNCTION: Releases a cache segment associated with a BCB
@ -774,7 +774,7 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg)
/* Unmap all the pages. */
for (i = 0; i < RegionSize; i++)
{
MmDeleteVirtualMapping(NULL,
MmDeleteVirtualMapping(NULL,
CacheSeg->BaseAddress + (i * PAGE_SIZE),
FALSE,
NULL,
@ -785,7 +785,7 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg)
KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql);
/* Deallocate all the pages used. */
Base = (ULONG)(CacheSeg->BaseAddress - CiCacheSegMappingRegionBase) / PAGE_SIZE;
RtlClearBits(&CiCacheSegMappingRegionAllocMap, Base, RegionSize);
CiCacheSegMappingRegionHint = min (CiCacheSegMappingRegionHint, Base);
@ -858,12 +858,12 @@ CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointers,
{
Offset = *FileOffset;
}
else
else
{
Offset.QuadPart = (LONGLONG)0;
Length = Bcb->FileSize.u.LowPart;
}
if (IoStatus)
{
IoStatus->Status = STATUS_SUCCESS;
@ -909,7 +909,7 @@ CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointers,
}
}
NTSTATUS
NTSTATUS
CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
/*
* FUNCTION: Releases the BCB associated with a file object
@ -938,7 +938,7 @@ CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
Bcb->BcbRemoveListEntry.Flink = NULL;
}
FileObject->SectionObjectPointer->SharedCacheMap = NULL;
FileObject->SectionObjectPointer->SharedCacheMap = NULL;
/*
* Release all cache segments.
@ -960,7 +960,7 @@ CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
}
InsertHeadList(&FreeList, &current->BcbSegmentListEntry);
}
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
ExReleaseFastMutex(&ViewLock);
ObDereferenceObject (Bcb->FileObject);
@ -971,7 +971,7 @@ CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb)
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, BcbSegmentListEntry);
Status = CcRosInternalFreeCacheSegment(current);
}
ExFreeToNPagedLookasideList(&BcbLookasideList, Bcb);
ExFreeToNPagedLookasideList(&BcbLookasideList, Bcb);
ExAcquireFastMutex(&ViewLock);
}
return(STATUS_SUCCESS);
@ -1042,7 +1042,7 @@ VOID CcRosDereferenceCache(PFILE_OBJECT FileObject)
ExReleaseFastMutex(&ViewLock);
}
NTSTATUS STDCALL
NTSTATUS STDCALL
CcRosReleaseFileCache(PFILE_OBJECT FileObject)
/*
* FUNCTION: Called by the file system when a handle to a file object
@ -1082,7 +1082,7 @@ CcRosReleaseFileCache(PFILE_OBJECT FileObject)
return(STATUS_SUCCESS);
}
NTSTATUS
NTSTATUS
CcTryToInitializeFileCache(PFILE_OBJECT FileObject)
{
PBCB Bcb;
@ -1115,7 +1115,7 @@ CcTryToInitializeFileCache(PFILE_OBJECT FileObject)
}
NTSTATUS STDCALL
NTSTATUS STDCALL
CcRosInitializeFileCache(PFILE_OBJECT FileObject,
ULONG CacheSegmentSize)
/*
@ -1146,9 +1146,9 @@ CcRosInitializeFileCache(PFILE_OBJECT FileObject,
Bcb->CacheSegmentSize = CacheSegmentSize;
if (FileObject->FsContext)
{
Bcb->AllocationSize =
Bcb->AllocationSize =
((PFSRTL_COMMON_FCB_HEADER)FileObject->FsContext)->AllocationSize;
Bcb->FileSize =
Bcb->FileSize =
((PFSRTL_COMMON_FCB_HEADER)FileObject->FsContext)->FileSize;
}
KeInitializeSpinLock(&Bcb->BcbLock);
@ -1219,7 +1219,7 @@ CmLazyCloseThreadMain(PVOID Ignored)
DbgPrint("LazyCloseThread: Terminating\n");
break;
}
ExAcquireFastMutex(&ViewLock);
CcTimeStamp++;
if (CcTimeStamp >= 30)
@ -1250,7 +1250,7 @@ CcInitView(VOID)
#endif
NTSTATUS Status;
KPRIORITY Priority;
DPRINT("CcInitView()\n");
#ifdef CACHE_BITMAP
BoundaryAddressMultiple.QuadPart = 0;
@ -1281,7 +1281,7 @@ CcInitView(VOID)
RtlClearAllBits(&CiCacheSegMappingRegionAllocMap);
KeInitializeSpinLock(&CiCacheSegMappingRegionLock);
#endif
#endif
InitializeListHead(&CacheSegmentListHead);
InitializeListHead(&DirtySegmentListHead);
InitializeListHead(&CacheSegmentLRUListHead);
@ -1310,10 +1310,10 @@ CcInitView(VOID)
20);
MmInitializeMemoryConsumer(MC_CACHE, CcRosTrimCache);
CcInitCacheZeroPage();
CcTimeStamp = 0;
CcTimeStamp = 0;
LazyCloseThreadShouldTerminate = FALSE;
KeInitializeEvent (&LazyCloseThreadEvent, SynchronizationEvent, FALSE);
Status = PsCreateSystemThread(&LazyCloseThreadHandle,

View file

@ -356,7 +356,7 @@ typedef struct _KEY_OBJECT
/* List entry into the global key object list */
LIST_ENTRY ListEntry;
/* Time stamp for the last access by the parse routine */
ULONG TimeStamp;
} KEY_OBJECT, *PKEY_OBJECT;

View file

@ -1,5 +1,5 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/cm/ntfunc.c
@ -39,11 +39,11 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
IN OUT PLARGE_INTEGER Cookie)
{
PREGISTRY_CALLBACK Callback;
PAGED_CODE();
ASSERT(Function && Cookie);
Callback = ExAllocatePoolWithTag(PagedPool,
sizeof(REGISTRY_CALLBACK),
TAG('C', 'M', 'c', 'b'));
@ -54,7 +54,7 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
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
@ -63,7 +63,7 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
InsertTailList(&CmiCallbackHead, &Callback->ListEntry);
ExReleaseFastMutex(&CmiCallbackLock);
*Cookie = Callback->Cookie;
return STATUS_SUCCESS;
}
@ -79,7 +79,7 @@ NTSTATUS STDCALL
CmUnRegisterCallback(IN LARGE_INTEGER Cookie)
{
PLIST_ENTRY CurrentEntry;
PAGED_CODE();
ExAcquireFastMutex(&CmiCallbackLock);
@ -121,7 +121,7 @@ CmUnRegisterCallback(IN LARGE_INTEGER Cookie)
}
}
}
ExReleaseFastMutex(&CmiCallbackLock);
return STATUS_UNSUCCESSFUL;
@ -133,9 +133,9 @@ CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
IN PVOID Argument2)
{
PLIST_ENTRY CurrentEntry;
PAGED_CODE();
ExAcquireFastMutex(&CmiCallbackLock);
for(CurrentEntry = CmiCallbackHead.Flink;
@ -149,10 +149,10 @@ CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
ExAcquireRundownProtectionEx(&CurrentCallback->RundownRef, 1))
{
NTSTATUS Status;
/* don't hold locks during the callbacks! */
ExReleaseFastMutex(&CmiCallbackLock);
Status = CurrentCallback->Function(CurrentCallback->Context,
Argument1,
Argument2);
@ -169,9 +169,9 @@ CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
ExReleaseRundownProtectionEx(&CurrentCallback->RundownRef, 1);
}
}
ExReleaseFastMutex(&CmiCallbackLock);
return STATUS_SUCCESS;
}
@ -191,7 +191,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
PVOID Object;
PWSTR Start;
unsigned i;
PAGED_CODE();
DPRINT("NtCreateKey (Name %wZ KeyHandle %x Root %x)\n",
@ -358,7 +358,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
ExReleaseResourceLite(&CmiRegistryLock);
KeLeaveCriticalRegion();
ObDereferenceObject(Object);
if (Disposition)
@ -376,11 +376,11 @@ NtDeleteKey(IN HANDLE KeyHandle)
KPROCESSOR_MODE PreviousMode;
PKEY_OBJECT KeyObject;
NTSTATUS Status;
PAGED_CODE();
DPRINT1("NtDeleteKey(KeyHandle %x) called\n", KeyHandle);
PreviousMode = ExGetPreviousMode();
/* Verify that the handle is valid and is a registry key */
@ -462,9 +462,9 @@ NtEnumerateKey(IN HANDLE KeyHandle,
ULONG NameSize, ClassSize;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
DPRINT("KH %x I %d KIC %x KI %x L %d RL %x\n",
@ -687,10 +687,10 @@ NtEnumerateKey(IN HANDLE KeyHandle,
Status = STATUS_BUFFER_OVERFLOW;
CHECKPOINT;
}
else if (Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
else if (Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
NameSize < ClassSize)
{
ClassSize = Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
ClassSize = Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
NameSize;
Status = STATUS_BUFFER_OVERFLOW;
CHECKPOINT;
@ -812,7 +812,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation;
PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInformation;
PKEY_VALUE_FULL_INFORMATION ValueFullInformation;
PAGED_CODE();
DPRINT("KH %x I %d KVIC %x KVI %x L %d RL %x\n",
@ -879,7 +879,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
}
else
{
ValueBasicInformation = (PKEY_VALUE_BASIC_INFORMATION)
ValueBasicInformation = (PKEY_VALUE_BASIC_INFORMATION)
KeyValueInformation;
ValueBasicInformation->TitleIndex = 0;
ValueBasicInformation->Type = ValueCell->DataType;
@ -911,7 +911,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
case KeyValuePartialInformation:
DataSize = ValueCell->DataSize & REG_DATA_SIZE_MASK;
*ResultLength = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]) +
*ResultLength = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]) +
DataSize;
if (Length < FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]))
@ -933,18 +933,18 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
Status = STATUS_BUFFER_OVERFLOW;
CHECKPOINT;
}
if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET))
{
DataCell = CmiGetCell (RegistryHive, ValueCell->DataOffset, NULL);
RtlCopyMemory(ValuePartialInformation->Data,
RtlCopyMemory(ValuePartialInformation->Data,
DataCell->Data,
DataSize);
}
else
{
RtlCopyMemory(ValuePartialInformation->Data,
&ValueCell->DataOffset,
RtlCopyMemory(ValuePartialInformation->Data,
&ValueCell->DataOffset,
DataSize);
}
}
@ -967,19 +967,19 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
}
else
{
ValueFullInformation = (PKEY_VALUE_FULL_INFORMATION)
ValueFullInformation = (PKEY_VALUE_FULL_INFORMATION)
KeyValueInformation;
ValueFullInformation->TitleIndex = 0;
ValueFullInformation->Type = ValueCell->DataType;
ValueFullInformation->NameLength = NameSize;
ValueFullInformation->DataOffset =
ValueFullInformation->DataOffset =
(ULONG_PTR)ValueFullInformation->Name -
(ULONG_PTR)ValueFullInformation +
ValueFullInformation->NameLength;
ValueFullInformation->DataOffset =
ROUND_UP(ValueFullInformation->DataOffset, sizeof(PVOID));
ValueFullInformation->DataLength = ValueCell->DataSize & REG_DATA_SIZE_MASK;
if (Length - FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]) <
NameSize)
{
@ -1050,11 +1050,11 @@ NtFlushKey(IN HANDLE KeyHandle)
PKEY_OBJECT KeyObject;
PREGISTRY_HIVE RegistryHive;
KPROCESSOR_MODE PreviousMode;
PAGED_CODE();
DPRINT("NtFlushKey (KeyHandle %lx) called\n", KeyHandle);
PreviousMode = ExGetPreviousMode();
/* Verify that the handle is valid and is a registry key */
@ -1106,7 +1106,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
PVOID Object;
HANDLE hKey;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtOpenKey(KH %x DA %x OA %x OA->ON '%wZ'\n",
@ -1134,7 +1134,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if(!NT_SUCCESS(Status))
{
return Status;
@ -1223,7 +1223,7 @@ NtQueryKey(IN HANDLE KeyHandle,
PKEY_CELL KeyCell;
ULONG NameSize, ClassSize;
NTSTATUS Status;
PAGED_CODE();
DPRINT("NtQueryKey(KH %x KIC %x KI %x L %d RL %x)\n",
@ -1322,10 +1322,10 @@ NtQueryKey(IN HANDLE KeyHandle,
Status = STATUS_BUFFER_OVERFLOW;
CHECKPOINT;
}
else if (Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
else if (Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
NameSize < ClassSize)
{
ClassSize = Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
ClassSize = Length - FIELD_OFFSET(KEY_NODE_INFORMATION, Name[0]) -
NameSize;
Status = STATUS_BUFFER_OVERFLOW;
CHECKPOINT;
@ -1382,7 +1382,7 @@ NtQueryKey(IN HANDLE KeyHandle,
Status = STATUS_BUFFER_OVERFLOW;
CHECKPOINT;
}
if (ClassSize)
{
ClassCell = CmiGetCell (KeyObject->RegistryHive,
@ -1433,7 +1433,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation;
PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInformation;
PKEY_VALUE_FULL_INFORMATION ValueFullInformation;
PAGED_CODE();
DPRINT("NtQueryValueKey(KeyHandle %x ValueName %S Length %x)\n",
@ -1494,7 +1494,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
}
else
{
ValueBasicInformation = (PKEY_VALUE_BASIC_INFORMATION)
ValueBasicInformation = (PKEY_VALUE_BASIC_INFORMATION)
KeyValueInformation;
ValueBasicInformation->TitleIndex = 0;
ValueBasicInformation->Type = ValueCell->DataType;
@ -1587,7 +1587,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
ValueFullInformation->TitleIndex = 0;
ValueFullInformation->Type = ValueCell->DataType;
ValueFullInformation->NameLength = NameSize;
ValueFullInformation->DataOffset =
ValueFullInformation->DataOffset =
(ULONG_PTR)ValueFullInformation->Name -
(ULONG_PTR)ValueFullInformation +
ValueFullInformation->NameLength;
@ -1675,7 +1675,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
PDATA_CELL NewDataCell;
PHBIN pBin;
ULONG DesiredAccess;
PAGED_CODE();
DPRINT("NtSetValueKey(KeyHandle %x ValueName '%wZ' Type %d)\n",
@ -1830,7 +1830,7 @@ NtDeleteValueKey (IN HANDLE KeyHandle,
{
PKEY_OBJECT KeyObject;
NTSTATUS Status;
PAGED_CODE();
/* Verify that the handle is valid and is a registry key */
@ -1903,7 +1903,7 @@ NtLoadKey2 (IN POBJECT_ATTRIBUTES KeyObjectAttributes,
ULONG BufferSize;
ULONG Length;
NTSTATUS Status;
PAGED_CODE();
DPRINT ("NtLoadKey2() called\n");
@ -2038,7 +2038,7 @@ NtNotifyChangeKey (IN HANDLE KeyHandle,
IN ULONG Length,
IN BOOLEAN Asynchronous)
{
return NtNotifyChangeMultipleKeys(KeyHandle,
return NtNotifyChangeMultipleKeys(KeyHandle,
0,
NULL,
Event,
@ -2071,7 +2071,7 @@ NtQueryMultipleValueKey (IN HANDLE KeyHandle,
NTSTATUS Status;
PUCHAR DataPtr;
ULONG i;
PAGED_CODE();
/* Verify that the handle is valid and is a registry key */
@ -2201,7 +2201,7 @@ NtSaveKey (IN HANDLE KeyHandle,
PREGISTRY_HIVE TempHive;
PKEY_OBJECT KeyObject;
NTSTATUS Status;
PAGED_CODE();
DPRINT ("NtSaveKey() called\n");
@ -2305,7 +2305,7 @@ NtSetInformationKey (IN HANDLE KeyHandle,
{
PKEY_OBJECT KeyObject;
NTSTATUS Status;
PAGED_CODE();
if (KeyInformationClass != KeyWriteTimeInformation)
@ -2363,7 +2363,7 @@ NtUnloadKey (IN POBJECT_ATTRIBUTES KeyObjectAttributes)
{
PREGISTRY_HIVE RegistryHive;
NTSTATUS Status;
PAGED_CODE();
DPRINT ("NtUnloadKey() called\n");
@ -2411,7 +2411,7 @@ NTSTATUS STDCALL
NtInitializeRegistry (IN BOOLEAN SetUpBoot)
{
NTSTATUS Status;
PAGED_CODE();
if (CmiRegistryInitialized == TRUE)

View file

@ -1,5 +1,5 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/cm/regfile.c
@ -105,7 +105,7 @@ CmiVerifyBinHeader(PHBIN BinHeader)
//BinHeader->DateModified.dwHighDateTime
if (BinHeader->BinSize != REG_BLOCK_SIZE)
{
DbgPrint("BinSize is %.08x (should be a multiple of %.08x)\n",
@ -2873,7 +2873,7 @@ CmiAddValueToKey(IN PREGISTRY_HIVE RegistryHive,
CmiMarkBlockDirty(RegistryHive, KeyCellOffset);
CmiMarkBlockDirty(RegistryHive, ValueListCellOffset);
}
else if (KeyCell->NumberOfValues >=
else if (KeyCell->NumberOfValues >=
(((ULONG)ABS_VALUE(ValueListCell->CellSize) - sizeof(VALUE_LIST_CELL)) / sizeof(BLOCK_OFFSET)))
{
#if 0
@ -3023,7 +3023,7 @@ CmiAllocateHashTableCell (IN PREGISTRY_HIVE RegistryHive,
Status = STATUS_SUCCESS;
*HashBlock = NULL;
NewHashSize = sizeof(HASH_TABLE_CELL) +
NewHashSize = sizeof(HASH_TABLE_CELL) +
(SubKeyCount * sizeof(HASH_RECORD));
Status = CmiAllocateCell (RegistryHive,
NewHashSize,

View file

@ -255,10 +255,10 @@ CmiWorkerThread(PVOID Param)
while (1)
{
Status = KeWaitForSingleObject(&CmiWorkerTimer,
Executive,
KernelMode,
FALSE,
Status = KeWaitForSingleObject(&CmiWorkerTimer,
Executive,
KernelMode,
FALSE,
NULL);
if (Status == STATUS_SUCCESS)
{
@ -311,25 +311,25 @@ STDCALL
CmInitHives(BOOLEAN SetupBoot)
{
PCHAR BaseAddress;
/* Load Registry Hives. This one can be missing. */
if (CachedModules[SystemRegistry]) {
BaseAddress = (PCHAR)CachedModules[SystemRegistry]->ModStart;
CmImportSystemHive(BaseAddress,
CachedModules[SystemRegistry]->ModEnd - (ULONG_PTR)BaseAddress);
}
BaseAddress = (PCHAR)CachedModules[HardwareRegistry]->ModStart;
CmImportHardwareHive(BaseAddress,
CachedModules[HardwareRegistry]->ModEnd - (ULONG_PTR)BaseAddress);
/* Create dummy keys if no hardware hive was found */
CmImportHardwareHive (NULL, 0);
/* Initialize volatile registry settings */
if (SetupBoot == FALSE) CmInit2((PCHAR)KeLoaderBlock.CommandLine);
}
}
VOID INIT_FUNCTION
CmInitializeRegistry(VOID)
@ -397,14 +397,14 @@ CmInitializeRegistry(VOID)
KEBUGCHECK(0);
}
/* Start the timer */
/* Start the timer */
DueTime.QuadPart = -1;
KeSetTimerEx(&CmiWorkerTimer, DueTime, 5000, NULL); /* 5sec */
/* Build volatile registry store */
Status = CmiCreateVolatileHive (&CmiVolatileHive);
ASSERT(NT_SUCCESS(Status));
InitializeListHead(&CmiCallbackHead);
ExInitializeFastMutex(&CmiCallbackLock);
@ -548,7 +548,7 @@ CmInit2(PCHAR CommandLine)
MiniNT = TRUE;
else if (!_strnicmp(CommandLine, "DEBUGPORT=PICE", 14))
PiceStart = 1;
/* Add a space between the options */
if (Position != 0)
SystemStartOptions[Position++] = L' ';
@ -884,7 +884,7 @@ CmiDisconnectHive (IN POBJECT_ATTRIBUTES KeyObjectAttributes,
{
DPRINT1 ("Hive is still in use (hc %d, rc %d)\n", ObGetObjectHandleCount (KeyObject), ObGetObjectPointerCount (KeyObject));
ObDereferenceObject (KeyObject);
/* Release registry lock */
ExReleaseResourceLite (&CmiRegistryLock);
KeLeaveCriticalRegion();

View file

@ -1,5 +1,5 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/cm/regobj.c
@ -203,7 +203,7 @@ CmiObjectParse(PVOID ParsedObject,
if (NT_SUCCESS(Status))
{
DPRINT("LinkPath '%wZ'\n", &LinkPath);
ExReleaseResourceLite(&CmiRegistryLock);
KeLeaveCriticalRegion();
@ -627,7 +627,7 @@ CmiRemoveKeyFromList(PKEY_OBJECT KeyToRemove)
ParentKey->NumberOfSubKeys--;
DPRINT("Dereference parent key: 0x%x\n", ParentKey);
ObDereferenceObject(ParentKey);
return STATUS_SUCCESS;
}
@ -645,7 +645,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
{
PKEY_OBJECT CurKey;
ULONG Index;
DPRINT("Scanning key list for: %wZ (Parent: %wZ)\n",
KeyName, &Parent->Name);
@ -670,7 +670,7 @@ CmiScanKeyList(PKEY_OBJECT Parent,
}
}
}
if (Index < Parent->NumberOfSubKeys)
{
if (CurKey->Flags & KO_MARKED_FOR_DELETE)

View file

@ -30,17 +30,17 @@ DbgkCreateThread(PVOID StartAddress)
}
Message.Header.MessageSize = sizeof(LPC_DBG_MESSAGE);
Message.Header.DataSize = sizeof(LPC_DBG_MESSAGE) -
Message.Header.DataSize = sizeof(LPC_DBG_MESSAGE) -
sizeof(LPC_MESSAGE);
Message.Type = DBG_EVENT_CREATE_THREAD;
Message.Status = STATUS_SUCCESS;
Message.Data.CreateThread.Reserved = 0;
Message.Data.CreateThread.StartAddress = StartAddress;
/* FIXME: Freeze all threads in process */
/* Send the message to the process's debug port and wait for a reply */
Status =
Status =
LpcSendDebugMessagePort(PsGetCurrentThread()->ThreadsProcess->DebugPort,
&Message,
&Reply);

View file

@ -16,8 +16,8 @@
POBJECT_TYPE DbgkDebugObjectType;
/* FUNCTIONS *****************************************************************/
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtCreateDebugObject(OUT PHANDLE DebugHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
@ -27,27 +27,27 @@ NtCreateDebugObject(OUT PHANDLE DebugHandle,
PDBGK_DEBUG_OBJECT DebugObject;
HANDLE hDebug;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtCreateDebugObject(0x%x, 0x%x, 0x%x)\n", DebugHandle, DesiredAccess, ObjectAttributes);
/* Check Output Safety */
if(PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(DebugHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_HANDLE {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Create the Object */
Status = ObCreateObject(PreviousMode,
DbgkDebugObjectType,
@ -58,22 +58,22 @@ NtCreateDebugObject(OUT PHANDLE DebugHandle,
0,
0,
(PVOID*)&DebugObject);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Initialize the Debug Object's Fast Mutex */
ExInitializeFastMutex(&DebugObject->Mutex);
/* Initialize the State Event List */
InitializeListHead(&DebugObject->StateEventListEntry);
/* Initialize the Debug Object's Wait Event */
KeInitializeEvent(&DebugObject->Event, NotificationEvent, 0);
/* Set the Flags */
DebugObject->KillProcessOnExit = KillProcessOnExit;
/* Insert it */
Status = ObInsertObject((PVOID)DebugObject,
NULL,
@ -82,18 +82,18 @@ NtCreateDebugObject(OUT PHANDLE DebugHandle,
NULL,
&hDebug);
ObDereferenceObject(DebugObject);
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*DebugHandle = hDebug;
} _SEH_HANDLE {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}
@ -111,7 +111,7 @@ NtWaitForDebugEvent(IN HANDLE DebugObject, // Debug object handle must grant DEB
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
@ -123,7 +123,7 @@ NtDebugContinue(IN HANDLE DebugObject, // Debug object handle must grant DEBU
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
@ -134,7 +134,7 @@ NtDebugActiveProcess(IN HANDLE Process, // Process handle must grant PROCESS
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
@ -145,7 +145,7 @@ NtRemoveProcessDebug(IN HANDLE Process, // Process handle must grant PROCESS
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
@ -158,7 +158,7 @@ NtSetInformationDebugObject(IN HANDLE DebugObject, // Debug object handle need n
OUT PULONG ReturnLength OPTIONAL)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/callback.c
* PURPOSE: Executive callbacks
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
* Alex Ionescu (alex@relsoft.net)
*/
@ -171,7 +171,7 @@ ExCreateCallback(
PINT_CALLBACK_OBJECT Callback;
NTSTATUS Status;
HANDLE Handle;
PAGED_CODE();
/* Open a handle to the callback if it exists */
@ -323,7 +323,7 @@ ExNotifyCallback(
* ExRegisterCallback
*
* FUNCTION:
* Allows a function to associate a callback pointer (Function)
* Allows a function to associate a callback pointer (Function)
* to a created Callback object
*
* ARGUMENTS:
@ -348,7 +348,7 @@ ExRegisterCallback(
PINT_CALLBACK_OBJECT CallbackObject = (PINT_CALLBACK_OBJECT)OpaqueCallbackObject;
PCALLBACK_REGISTRATION CallbackRegistration = NULL;
KIRQL OldIrql;
PAGED_CODE();
/* Create reference to Callback Object */
@ -415,7 +415,7 @@ ExUnregisterCallback(
PCALLBACK_REGISTRATION CallbackRegistration;
PINT_CALLBACK_OBJECT CallbackObject;
KIRQL OldIrql;
PAGED_CODE();
/* Convert Handle to valid Structure Pointer */

View file

@ -15,8 +15,8 @@
/* FUNCTIONS *****************************************************************/
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
PVOID InputBuffer,
ULONG InputBufferLength,
@ -24,7 +24,7 @@ NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
ULONG OutputBufferLength,
PULONG ReturnLength)
{
switch (ControlCode)
switch (ControlCode)
{
case DebugGetTraceInformation:
case DebugSetInternalBreakpoint:
@ -33,14 +33,14 @@ NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
case DebugQuerySpecialCalls:
case DebugDbgBreakPoint:
break;
case DebugDbgLoadSymbols:
KDB_LOADUSERMODULE_HOOK((PLDR_MODULE) InputBuffer);
break;
default:
break;
}
return STATUS_SUCCESS;
}

View file

@ -24,7 +24,7 @@ PEPROCESS ExpDefaultErrorPortProcess = NULL;
/*
* @implemented
*/
VOID
VOID
STDCALL
ExRaiseAccessViolation(VOID)
{
@ -46,7 +46,7 @@ ExRaiseDatatypeMisalignment (VOID)
/*
* @implemented
*/
VOID
VOID
STDCALL
ExRaiseStatus(IN NTSTATUS Status)
{
@ -59,7 +59,7 @@ ExRaiseStatus(IN NTSTATUS Status)
ExceptionRecord.NumberParameters = 0;
ExceptionRecord.ExceptionCode = Status;
ExceptionRecord.ExceptionFlags = 0;
/* Call the Rtl Function */
RtlRaiseException(&ExceptionRecord);
}
@ -91,17 +91,17 @@ ExSystemExceptionFilter(VOID)
VOID
STDCALL
ExRaiseHardError(IN NTSTATUS ErrorStatus,
IN ULONG NumberOfParameters,
IN ULONG NumberOfParameters,
IN PUNICODE_STRING UnicodeStringParameterMask OPTIONAL,
IN PVOID *Parameters,
IN HARDERROR_RESPONSE_OPTION ResponseOption,
IN PVOID *Parameters,
IN HARDERROR_RESPONSE_OPTION ResponseOption,
OUT PHARDERROR_RESPONSE Response)
{
UNIMPLEMENTED;
}
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtRaiseHardError(IN NTSTATUS ErrorStatus,
IN ULONG NumberOfParameters,
IN PUNICODE_STRING UnicodeStringParameterMask OPTIONAL,
@ -110,7 +110,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
OUT PHARDERROR_RESPONSE Response)
{
DPRINT1("Hard error %x\n", ErrorStatus);
/* Call the Executive Function (WE SHOULD PUT SEH HERE/CAPTURE!) */
ExRaiseHardError(ErrorStatus,
NumberOfParameters,
@ -118,45 +118,45 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
Parameters,
ResponseOption,
Response);
/* Return Success */
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
{
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_UNSUCCESSFUL;
/* Check if we have the Privilege */
if(!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode)) {
DPRINT1("NtSetDefaultHardErrorPort: Caller requires the SeTcbPrivilege privilege!\n");
return STATUS_PRIVILEGE_NOT_HELD;
}
/* Only called once during bootup, make sure we weren't called yet */
if(!ExReadyForErrors) {
Status = ObReferenceObjectByHandle(PortHandle,
0,
LpcPortObjectType,
PreviousMode,
(PVOID*)&ExpDefaultErrorPort,
NULL);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Save the data */
ExpDefaultErrorPortProcess = PsGetCurrentProcess();
ExReadyForErrors = TRUE;
}
}
return Status;
}

View file

@ -1,9 +1,9 @@
/*
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/nt/event.c
* PURPOSE: Named event support
*
*
* PROGRAMMERS: Alex Ionescu(alex@relsoft.net) - Fixed bugs/commented
* Philip Susi and David Welch
*/
@ -25,14 +25,14 @@ static GENERIC_MAPPING ExpEventMapping = {
EVENT_ALL_ACCESS};
static const INFORMATION_CLASS_INFO ExEventInfoClass[] = {
/* EventBasicInformation */
ICI_SQ_SAME( sizeof(EVENT_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY),
};
/* FUNCTIONS *****************************************************************/
VOID
VOID
INIT_FUNCTION
ExpInitializeEventImplementation(VOID)
{
@ -63,15 +63,15 @@ ExpInitializeEventImplementation(VOID)
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtClearEvent(IN HANDLE EventHandle)
{
PKEVENT Event;
NTSTATUS Status;
PAGED_CODE();
/* Reference the Object */
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_MODIFY_STATE,
@ -79,15 +79,15 @@ NtClearEvent(IN HANDLE EventHandle)
ExGetPreviousMode(),
(PVOID*)&Event,
NULL);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Clear the Event and Dereference */
KeClearEvent(Event);
ObDereferenceObject(Event);
}
/* Return Status */
return Status;
}
@ -96,7 +96,7 @@ NtClearEvent(IN HANDLE EventHandle)
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtCreateEvent(OUT PHANDLE EventHandle,
IN ACCESS_MASK DesiredAccess,
@ -108,27 +108,27 @@ NtCreateEvent(OUT PHANDLE EventHandle,
PKEVENT Event;
HANDLE hEvent;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtCreateEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, DesiredAccess, ObjectAttributes);
/* Check Output Safety */
if(PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(EventHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Create the Object */
Status = ObCreateObject(PreviousMode,
ExEventObjectType,
@ -139,15 +139,15 @@ NtCreateEvent(OUT PHANDLE EventHandle,
0,
0,
(PVOID*)&Event);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Initalize the Event */
KeInitializeEvent(Event,
EventType,
InitialState);
/* Insert it */
Status = ObInsertObject((PVOID)Event,
NULL,
@ -156,18 +156,18 @@ NtCreateEvent(OUT PHANDLE EventHandle,
NULL,
&hEvent);
ObDereferenceObject(Event);
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*EventHandle = hEvent;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}
@ -179,7 +179,7 @@ NtCreateEvent(OUT PHANDLE EventHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtOpenEvent(OUT PHANDLE EventHandle,
IN ACCESS_MASK DesiredAccess,
@ -188,27 +188,27 @@ NtOpenEvent(OUT PHANDLE EventHandle,
HANDLE hEvent;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
PAGED_CODE();
DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, DesiredAccess, ObjectAttributes);
/* Check Output Safety */
if(PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(EventHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Open the Object */
Status = ObOpenObjectByName(ObjectAttributes,
ExEventObjectType,
@ -217,21 +217,21 @@ NtOpenEvent(OUT PHANDLE EventHandle,
DesiredAccess,
NULL,
&hEvent);
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*EventHandle = hEvent;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
/* Return status */
return Status;
}
@ -239,7 +239,7 @@ NtOpenEvent(OUT PHANDLE EventHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtPulseEvent(IN HANDLE EventHandle,
OUT PLONG PreviousState OPTIONAL)
@ -247,28 +247,28 @@ NtPulseEvent(IN HANDLE EventHandle,
PKEVENT Event;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n",
EventHandle, PreviousState);
/* Check buffer validity */
if(PreviousState && PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(PreviousState,
sizeof(LONG),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Open the Object */
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_MODIFY_STATE,
@ -276,25 +276,25 @@ NtPulseEvent(IN HANDLE EventHandle,
PreviousMode,
(PVOID*)&Event,
NULL);
/* Check for success */
if(NT_SUCCESS(Status)) {
/* Pulse the Event */
LONG Prev = KePulseEvent(Event, EVENT_INCREMENT, FALSE);
ObDereferenceObject(Event);
/* Return it */
/* Return it */
if(PreviousState) {
_SEH_TRY {
*PreviousState = Prev;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}
@ -307,7 +307,7 @@ NtPulseEvent(IN HANDLE EventHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtQueryEvent(IN HANDLE EventHandle,
IN EVENT_INFORMATION_CLASS EventInformationClass,
@ -319,10 +319,10 @@ NtQueryEvent(IN HANDLE EventHandle,
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PEVENT_BASIC_INFORMATION BasicInfo = (PEVENT_BASIC_INFORMATION)EventInformation;
PAGED_CODE();
DPRINT("NtQueryEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, EventInformationClass);
/* Check buffers and class validity */
DefaultQueryInfoBufferCheck(EventInformationClass,
ExEventInfoClass,
@ -332,12 +332,12 @@ NtQueryEvent(IN HANDLE EventHandle,
PreviousMode,
&Status);
if(!NT_SUCCESS(Status)) {
/* Invalid buffers */
DPRINT("NtQuerySemaphore() failed, Status: 0x%x\n", Status);
return Status;
}
/* Get the Object */
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_QUERY_STATE,
@ -345,23 +345,23 @@ NtQueryEvent(IN HANDLE EventHandle,
PreviousMode,
(PVOID*)&Event,
NULL);
/* Check for success */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
/* Return Event Type and State */
BasicInfo->EventType = Event->Header.Type;
BasicInfo->EventState = KeReadStateEvent(Event);
/* Return length */
if(ReturnLength) *ReturnLength = sizeof(EVENT_BASIC_INFORMATION);
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
/* Dereference the Object */
@ -375,7 +375,7 @@ NtQueryEvent(IN HANDLE EventHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtResetEvent(IN HANDLE EventHandle,
OUT PLONG PreviousState OPTIONAL)
@ -383,23 +383,23 @@ NtResetEvent(IN HANDLE EventHandle,
PKEVENT Event;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtResetEvent(EventHandle 0%x PreviousState 0%x)\n",
EventHandle, PreviousState);
/* Check buffer validity */
if(PreviousState && PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(PreviousState,
sizeof(LONG),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
@ -412,25 +412,25 @@ NtResetEvent(IN HANDLE EventHandle,
PreviousMode,
(PVOID*)&Event,
NULL);
/* Check for success */
if(NT_SUCCESS(Status)) {
/* Reset the Event */
LONG Prev = KeResetEvent(Event);
ObDereferenceObject(Event);
/* Return it */
/* Return it */
if(PreviousState) {
_SEH_TRY {
*PreviousState = Prev;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}
@ -442,7 +442,7 @@ NtResetEvent(IN HANDLE EventHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtSetEvent(IN HANDLE EventHandle,
OUT PLONG PreviousState OPTIONAL)
@ -450,23 +450,23 @@ NtSetEvent(IN HANDLE EventHandle,
PKEVENT Event;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtSetEvent(EventHandle 0%x PreviousState 0%x)\n",
EventHandle, PreviousState);
/* Check buffer validity */
if(PreviousState != NULL && PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(PreviousState,
sizeof(LONG),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
@ -479,7 +479,7 @@ NtSetEvent(IN HANDLE EventHandle,
PreviousMode,
(PVOID*)&Event,
NULL);
/* Check for success */
if(NT_SUCCESS(Status)) {
@ -487,17 +487,17 @@ NtSetEvent(IN HANDLE EventHandle,
LONG Prev = KeSetEvent(Event, EVENT_INCREMENT, FALSE);
ObDereferenceObject(Event);
/* Return it */
/* Return it */
if(PreviousState) {
_SEH_TRY {
*PreviousState = Prev;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}

View file

@ -67,27 +67,27 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
HANDLE hEventPair;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtCreateEventPair: %x\n", EventPairHandle);
/* Check Output Safety */
if(PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(EventPairHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Create the Object */
DPRINT("Creating EventPair\n");
Status = ObCreateObject(PreviousMode,
@ -99,14 +99,14 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
0,
0,
(PVOID*)&EventPair);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Initalize the Event */
DPRINT("Initializing EventPair\n");
KeInitializeEventPair(EventPair);
/* Insert it */
Status = ObInsertObject((PVOID)EventPair,
NULL,
@ -115,18 +115,18 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
NULL,
&hEventPair);
ObDereferenceObject(EventPair);
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*EventPairHandle = hEventPair;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}
@ -135,7 +135,7 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
return Status;
}
NTSTATUS
NTSTATUS
STDCALL
NtOpenEventPair(OUT PHANDLE EventPairHandle,
IN ACCESS_MASK DesiredAccess,
@ -144,26 +144,26 @@ NtOpenEventPair(OUT PHANDLE EventPairHandle,
HANDLE hEventPair;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Check Output Safety */
if(PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(EventPairHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Open the Object */
Status = ObOpenObjectByName(ObjectAttributes,
ExEventPairObjectType,
@ -172,21 +172,21 @@ NtOpenEventPair(OUT PHANDLE EventPairHandle,
DesiredAccess,
NULL,
&hEventPair);
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*EventPairHandle = hEventPair;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
/* Return status */
return Status;
}
@ -199,10 +199,10 @@ NtSetHighEventPair(IN HANDLE EventPairHandle)
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status;
PAGED_CODE();
DPRINT("NtSetHighEventPair(EventPairHandle %x)\n", EventPairHandle);
/* Open the Object */
Status = ObReferenceObjectByHandle(EventPairHandle,
SYNCHRONIZE,
@ -210,17 +210,17 @@ NtSetHighEventPair(IN HANDLE EventPairHandle)
PreviousMode,
(PVOID*)&EventPair,
NULL);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Set the Event */
KeSetEvent(&EventPair->HighEvent, EVENT_INCREMENT, FALSE);
/* Dereference Object */
ObDereferenceObject(EventPair);
}
/* Return status */
return Status;
}
@ -232,10 +232,10 @@ NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status;
PAGED_CODE();
DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle);
/* Open the Object */
Status = ObReferenceObjectByHandle(EventPairHandle,
SYNCHRONIZE,
@ -243,13 +243,13 @@ NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
PreviousMode,
(PVOID*)&EventPair,
NULL);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Set the Event */
KeSetEvent(&EventPair->HighEvent, EVENT_INCREMENT, FALSE);
/* Wait for the Other one */
KeWaitForSingleObject(&EventPair->LowEvent,
WrEventPair,
@ -260,25 +260,25 @@ NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
/* Dereference Object */
ObDereferenceObject(EventPair);
}
/* Return status */
return Status;
}
NTSTATUS
NTSTATUS
STDCALL
NtSetLowEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
DPRINT1("NtSetHighEventPair(EventPairHandle %x)\n", EventPairHandle);
/* Open the Object */
Status = ObReferenceObjectByHandle(EventPairHandle,
SYNCHRONIZE,
@ -286,17 +286,17 @@ NtSetLowEventPair(IN HANDLE EventPairHandle)
PreviousMode,
(PVOID*)&EventPair,
NULL);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Set the Event */
KeSetEvent(&EventPair->LowEvent, EVENT_INCREMENT, FALSE);
/* Dereference Object */
ObDereferenceObject(EventPair);
}
/* Return status */
return Status;
}
@ -308,10 +308,10 @@ NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status;
PAGED_CODE();
DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle);
/* Open the Object */
Status = ObReferenceObjectByHandle(EventPairHandle,
SYNCHRONIZE,
@ -319,13 +319,13 @@ NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
PreviousMode,
(PVOID*)&EventPair,
NULL);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Set the Event */
KeSetEvent(&EventPair->LowEvent, EVENT_INCREMENT, FALSE);
/* Wait for the Other one */
KeWaitForSingleObject(&EventPair->HighEvent,
WrEventPair,
@ -336,23 +336,23 @@ NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
/* Dereference Object */
ObDereferenceObject(EventPair);
}
/* Return status */
return Status;
}
NTSTATUS
NTSTATUS
STDCALL
NtWaitLowEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status;
PAGED_CODE();
DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle);
/* Open the Object */
Status = ObReferenceObjectByHandle(EventPairHandle,
SYNCHRONIZE,
@ -360,10 +360,10 @@ NtWaitLowEventPair(IN HANDLE EventPairHandle)
PreviousMode,
(PVOID*)&EventPair,
NULL);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Wait for the Event */
KeWaitForSingleObject(&EventPair->LowEvent,
WrEventPair,
@ -374,22 +374,22 @@ NtWaitLowEventPair(IN HANDLE EventPairHandle)
/* Dereference Object */
ObDereferenceObject(EventPair);
}
/* Return status */
return Status;
}
NTSTATUS
NTSTATUS
STDCALL
NtWaitHighEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status;
PAGED_CODE();
DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle);
/* Open the Object */
Status = ObReferenceObjectByHandle(EventPairHandle,
SYNCHRONIZE,
@ -400,7 +400,7 @@ NtWaitHighEventPair(IN HANDLE EventPairHandle)
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Wait for the Event */
KeWaitForSingleObject(&EventPair->HighEvent,
WrEventPair,
@ -411,7 +411,7 @@ NtWaitHighEventPair(IN HANDLE EventPairHandle)
/* Dereference Object */
ObDereferenceObject(EventPair);
}
/* Return status */
return Status;
}

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/fmutex.c
* PURPOSE: Implements fast mutexes
*
*
* PROGRAMMERS: David Welch (welch@cwcom.net)
*/

View file

@ -1,10 +1,10 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/handle.c
* PURPOSE: Generic Executive Handle Tables
*
*
* PROGRAMMERS: Thomas Weidenmueller <w3seek@reactos.com>
*
* TODO:
@ -95,14 +95,14 @@ PHANDLE_TABLE
ExCreateHandleTable(IN PEPROCESS QuotaProcess OPTIONAL)
{
PHANDLE_TABLE HandleTable;
PAGED_CODE();
if(!ExpInitialized)
{
KEBUGCHECK(0);
}
if(QuotaProcess != NULL)
{
/* FIXME - Charge process quota before allocating the handle table! */
@ -154,7 +154,7 @@ ExCreateHandleTable(IN PEPROCESS QuotaProcess OPTIONAL)
{
/* FIXME - return the quota to the process */
}
return HandleTable;
}
@ -215,29 +215,29 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
{
PHANDLE_TABLE_ENTRY **tlp, **lasttlp, *mlp, *lastmlp;
PEPROCESS QuotaProcess;
PAGED_CODE();
ASSERT(HandleTable);
KeEnterCriticalRegion();
/* ensure there's no other operations going by acquiring an exclusive lock */
ExAcquireHandleTableLockExclusive(HandleTable);
ASSERT(!(HandleTable->Flags & EX_HANDLE_TABLE_CLOSING));
HandleTable->Flags |= EX_HANDLE_TABLE_CLOSING;
KePulseEvent(&HandleTable->HandleContentionEvent,
EVENT_INCREMENT,
FALSE);
/* remove the handle table from the global handle table list */
ExAcquireHandleTableListLock();
RemoveEntryList(&HandleTable->HandleTableList);
ExReleaseHandleTableListLock();
/* call the callback function to cleanup the objects associated with the
handle table */
if(DestroyHandleCallback != NULL)
@ -255,7 +255,7 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
if((*mlp) != NULL)
{
PHANDLE_TABLE_ENTRY curee, laste;
for(curee = *mlp, laste = *mlp + N_SUBHANDLE_ENTRIES;
curee != laste;
curee++)
@ -271,9 +271,9 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
}
}
}
QuotaProcess = HandleTable->QuotaProcess;
/* free the tables */
for(tlp = HandleTable->Table, lasttlp = HandleTable->Table + N_TOPLEVEL_POINTERS;
tlp != lasttlp;
@ -288,7 +288,7 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
if((*mlp) != NULL)
{
ExFreePool(*mlp);
if(QuotaProcess != NULL)
{
/* FIXME - return the quota to the process */
@ -297,22 +297,22 @@ ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable,
}
ExFreePool(*tlp);
if(QuotaProcess != NULL)
{
/* FIXME - return the quota to the process */
}
}
}
ExReleaseHandleTableLock(HandleTable);
KeLeaveCriticalRegion();
/* free the handle table */
ExDeleteResource(&HandleTable->HandleTableLock);
ExFreePool(HandleTable);
if(QuotaProcess != NULL)
{
/* FIXME - return the quota to the process */
@ -326,9 +326,9 @@ ExDupHandleTable(IN PEPROCESS QuotaProcess OPTIONAL,
IN PHANDLE_TABLE SourceHandleTable)
{
PHANDLE_TABLE HandleTable;
PAGED_CODE();
ASSERT(SourceHandleTable);
HandleTable = ExCreateHandleTable(QuotaProcess);
@ -336,12 +336,12 @@ ExDupHandleTable(IN PEPROCESS QuotaProcess OPTIONAL,
{
PHANDLE_TABLE_ENTRY **tlp, **srctlp, **etlp, *mlp, *srcmlp, *emlp, stbl, srcstbl, estbl;
LONG tli, mli, eli;
tli = mli = eli = 0;
/* make sure the other handle table isn't being changed during the duplication */
ExAcquireHandleTableLockShared(SourceHandleTable);
/* allocate enough tables */
etlp = SourceHandleTable->Table + N_TOPLEVEL_POINTERS;
for(srctlp = SourceHandleTable->Table, tlp = HandleTable->Table;
@ -355,16 +355,16 @@ ExDupHandleTable(IN PEPROCESS QuotaProcess OPTIONAL,
{
/* FIXME - Charge process quota before allocating the handle table! */
}
*tlp = ExAllocatePoolWithTag(PagedPool,
N_MIDDLELEVEL_POINTERS * sizeof(PHANDLE_TABLE_ENTRY),
TAG('E', 'x', 'H', 't'));
if(*tlp != NULL)
{
RtlZeroMemory(*tlp, N_MIDDLELEVEL_POINTERS * sizeof(PHANDLE_TABLE_ENTRY));
KeMemoryBarrier();
emlp = *srctlp + N_MIDDLELEVEL_POINTERS;
for(srcmlp = *srctlp, mlp = *tlp;
srcmlp != emlp;
@ -402,7 +402,7 @@ freehandletable:
DPRINT1("Failed to duplicate handle table 0x%x\n", SourceHandleTable);
ExReleaseHandleTableLock(SourceHandleTable);
ExDestroyHandleTable(HandleTable,
NULL,
NULL);
@ -481,11 +481,11 @@ freehandletable:
}
}
}
/* release the source handle table */
ExReleaseHandleTableLock(SourceHandleTable);
}
return HandleTable;
}
@ -494,39 +494,39 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
OUT PLONG Handle)
{
PHANDLE_TABLE_ENTRY Entry = NULL;
PAGED_CODE();
ASSERT(HandleTable);
ASSERT(Handle);
ASSERT(KeGetCurrentThread() != NULL);
DPRINT("HT[0x%x]: HandleCount: %d\n", HandleTable, HandleTable->HandleCount);
if(HandleTable->HandleCount < EX_MAX_HANDLES)
{
ULONG tli, mli, eli;
if(HandleTable->FirstFreeTableEntry != -1)
{
/* there's a free handle entry we can just grab and use */
tli = TLI_FROM_HANDLE(HandleTable->FirstFreeTableEntry);
mli = MLI_FROM_HANDLE(HandleTable->FirstFreeTableEntry);
eli = ELI_FROM_HANDLE(HandleTable->FirstFreeTableEntry);
/* the pointer should be valid in any way!!! */
ASSERT(HandleTable->Table[tli]);
ASSERT(HandleTable->Table[tli][mli]);
Entry = &HandleTable->Table[tli][mli][eli];
*Handle = HandleTable->FirstFreeTableEntry;
/* save the index to the next free handle (if available) */
HandleTable->FirstFreeTableEntry = Entry->u2.NextFreeTableEntry;
Entry->u2.NextFreeTableEntry = 0;
Entry->u1.Object = NULL;
HandleTable->HandleCount++;
}
else
@ -537,7 +537,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
BOOLEAN AllocatedMtbl;
ASSERT(HandleTable->NextIndexNeedingPool <= N_MAX_HANDLE);
/* the index of the next table to be allocated was saved in
NextIndexNeedingPool the last time a handle entry was allocated and
the subhandle entry list was full. the subhandle entry index of
@ -550,7 +550,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
ASSERT(ELI_FROM_HANDLE(HandleTable->NextIndexNeedingPool) == 0);
DPRINT("HandleTable->Table[%d] == 0x%x\n", tli, HandleTable->Table[tli]);
/* allocate a middle level entry list if required */
nmtbl = HandleTable->Table[tli];
if(nmtbl == NULL)
@ -559,7 +559,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
{
/* FIXME - Charge process quota before allocating the handle table! */
}
nmtbl = ExAllocatePoolWithTag(PagedPool,
N_MIDDLELEVEL_POINTERS * sizeof(PHANDLE_TABLE_ENTRY),
TAG('E', 'x', 'H', 't'));
@ -569,16 +569,16 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
{
/* FIXME - return the quota to the process */
}
return NULL;
}
/* clear the middle level entry list */
RtlZeroMemory(nmtbl, N_MIDDLELEVEL_POINTERS * sizeof(PHANDLE_TABLE_ENTRY));
/* make sure the table was zeroed before we set one item */
KeMemoryBarrier();
/* note, don't set the the pointer in the top level list yet because we
might screw up lookups if allocating a subhandle entry table failed
and this newly allocated table might get freed again */
@ -587,7 +587,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
else
{
AllocatedMtbl = FALSE;
/* allocate a subhandle entry table in any case! */
ASSERT(nmtbl[mli] == NULL);
}
@ -608,31 +608,31 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
{
/* FIXME - Return process quota charged */
}
/* free the middle level entry list, if allocated, because it's empty and
unused */
if(AllocatedMtbl)
{
ExFreePool(nmtbl);
if(HandleTable->QuotaProcess != NULL)
{
/* FIXME - Return process quota charged */
}
}
return NULL;
}
/* let's just use the very first entry */
Entry = ntbl;
Entry->u1.ObAttributes = EX_HANDLE_ENTRY_LOCKED;
Entry->u2.NextFreeTableEntry = 0;
*Handle = HandleTable->NextIndexNeedingPool;
HandleTable->HandleCount++;
/* set the FirstFreeTableEntry member to the second entry and chain the
free entries */
HandleTable->FirstFreeTableEntry = HandleTable->NextIndexNeedingPool + 1;
@ -652,7 +652,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
{
InterlockedExchangePointer(&HandleTable->Table[tli], nmtbl);
}
/* increment the NextIndexNeedingPool to the next index where we need to
allocate new memory */
HandleTable->NextIndexNeedingPool += N_SUBHANDLE_ENTRIES;
@ -662,7 +662,7 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
{
DPRINT1("Can't allocate any more handles in handle table 0x%x!\n", HandleTable);
}
return Entry;
}
@ -672,20 +672,20 @@ ExpFreeHandleTableEntry(IN PHANDLE_TABLE HandleTable,
IN LONG Handle)
{
PAGED_CODE();
ASSERT(HandleTable);
ASSERT(Entry);
ASSERT(IS_VALID_EX_HANDLE(Handle));
DPRINT("ExpFreeHandleTableEntry HT:0x%x Entry:0x%x\n", HandleTable, Entry);
/* automatically unlock the entry if currently locked. We however don't notify
anyone who waited on the handle because we're holding an exclusive lock after
all and these locks will fail then */
InterlockedExchangePointer(&Entry->u1.Object, NULL);
Entry->u2.NextFreeTableEntry = HandleTable->FirstFreeTableEntry;
HandleTable->FirstFreeTableEntry = Handle;
HandleTable->HandleCount--;
}
@ -694,20 +694,20 @@ ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable,
IN LONG Handle)
{
PHANDLE_TABLE_ENTRY Entry = NULL;
PAGED_CODE();
ASSERT(HandleTable);
if(IS_VALID_EX_HANDLE(Handle))
{
ULONG tli, mli, eli;
PHANDLE_TABLE_ENTRY *mlp;
tli = TLI_FROM_HANDLE(Handle);
mli = MLI_FROM_HANDLE(Handle);
eli = ELI_FROM_HANDLE(Handle);
mlp = HandleTable->Table[tli];
if(Handle < HandleTable->NextIndexNeedingPool &&
mlp != NULL && mlp[mli] != NULL && mlp[mli][eli].u1.Object != NULL)
@ -720,7 +720,7 @@ ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable,
{
DPRINT("Looking up invalid handle 0x%x\n", Handle);
}
return Entry;
}
@ -731,22 +731,22 @@ ExLockHandleTableEntry(IN PHANDLE_TABLE HandleTable,
ULONG_PTR Current, New;
PAGED_CODE();
DPRINT("Entering handle table entry 0x%x lock...\n", Entry);
ASSERT(HandleTable);
ASSERT(Entry);
for(;;)
{
Current = (volatile ULONG_PTR)Entry->u1.Object;
if(!Current || (HandleTable->Flags & EX_HANDLE_TABLE_CLOSING))
{
DPRINT("Attempted to lock empty handle table entry 0x%x or handle table shut down\n", Entry);
break;
}
if(!(Current & EX_HANDLE_ENTRY_LOCKED))
{
New = Current | EX_HANDLE_ENTRY_LOCKED;
@ -779,20 +779,20 @@ ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable,
IN PHANDLE_TABLE_ENTRY Entry)
{
ULONG_PTR Current, New;
PAGED_CODE();
ASSERT(HandleTable);
ASSERT(Entry);
DPRINT("ExUnlockHandleTableEntry HT:0x%x Entry:0x%x\n", HandleTable, Entry);
Current = (volatile ULONG_PTR)Entry->u1.Object;
ASSERT(Current & EX_HANDLE_ENTRY_LOCKED);
New = Current & ~EX_HANDLE_ENTRY_LOCKED;
InterlockedExchangePointer(&Entry->u1.Object,
(PVOID)New);
@ -809,26 +809,26 @@ ExCreateHandle(IN PHANDLE_TABLE HandleTable,
{
PHANDLE_TABLE_ENTRY NewHandleTableEntry;
LONG Handle = EX_INVALID_HANDLE;
PAGED_CODE();
ASSERT(HandleTable);
ASSERT(Entry);
/* The highest bit in Entry->u1.Object has to be 1 so we make sure it's a
pointer to kmode memory. It will cleared though because it also indicates
the lock */
ASSERT((ULONG_PTR)Entry->u1.Object & EX_HANDLE_ENTRY_LOCKED);
KeEnterCriticalRegion();
ExAcquireHandleTableLockExclusive(HandleTable);
NewHandleTableEntry = ExpAllocateHandleTableEntry(HandleTable,
&Handle);
if(NewHandleTableEntry != NULL)
{
*NewHandleTableEntry = *Entry;
ExUnlockHandleTableEntry(HandleTable,
NewHandleTableEntry);
}
@ -845,17 +845,17 @@ ExDestroyHandle(IN PHANDLE_TABLE HandleTable,
{
PHANDLE_TABLE_ENTRY HandleTableEntry;
BOOLEAN Ret = FALSE;
PAGED_CODE();
ASSERT(HandleTable);
KeEnterCriticalRegion();
ExAcquireHandleTableLockExclusive(HandleTable);
HandleTableEntry = ExpLookupHandleTableEntry(HandleTable,
Handle);
if(HandleTableEntry != NULL && ExLockHandleTableEntry(HandleTable, HandleTableEntry))
{
/* free and automatically unlock the handle. However we don't need to pulse
@ -865,10 +865,10 @@ ExDestroyHandle(IN PHANDLE_TABLE HandleTable,
Handle);
Ret = TRUE;
}
ExReleaseHandleTableLock(HandleTable);
KeLeaveCriticalRegion();
return Ret;
}
@ -881,10 +881,10 @@ ExDestroyHandleByEntry(IN PHANDLE_TABLE HandleTable,
ASSERT(HandleTable);
ASSERT(Entry);
/* This routine requires the entry to be locked */
ASSERT((ULONG_PTR)Entry->u1.Object & EX_HANDLE_ENTRY_LOCKED);
DPRINT("DestroyHandleByEntry HT:0x%x Entry:0x%x\n", HandleTable, Entry);
KeEnterCriticalRegion();
@ -909,7 +909,7 @@ ExMapHandleToPointer(IN PHANDLE_TABLE HandleTable,
PAGED_CODE();
ASSERT(HandleTable);
HandleTableEntry = ExpLookupHandleTableEntry(HandleTable,
Handle);
if (HandleTableEntry != NULL && ExLockHandleTableEntry(HandleTable, HandleTableEntry))
@ -917,7 +917,7 @@ ExMapHandleToPointer(IN PHANDLE_TABLE HandleTable,
DPRINT("ExMapHandleToPointer HT:0x%x Entry:0x%x locked\n", HandleTable, HandleTableEntry);
return HandleTableEntry;
}
return NULL;
}
@ -936,7 +936,7 @@ ExChangeHandle(IN PHANDLE_TABLE HandleTable,
ASSERT(ChangeHandleCallback);
KeEnterCriticalRegion();
HandleTableEntry = ExpLookupHandleTableEntry(HandleTable,
Handle);
@ -949,7 +949,7 @@ ExChangeHandle(IN PHANDLE_TABLE HandleTable,
ExUnlockHandleTableEntry(HandleTable,
HandleTableEntry);
}
KeLeaveCriticalRegion();
return Ret;

View file

@ -1,5 +1,5 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/i386/interlck.c
@ -27,7 +27,7 @@
#ifdef CONFIG_SMP
#define LOCK lock
#else
#define LOCK
#define LOCK
#endif
#endif
@ -248,7 +248,7 @@ Exi386InterlockedExchangeUlong(IN PULONG Target,
LONG FASTCALL
InterlockedIncrement(PLONG Addend);
/*
* FUNCTION: Increments a caller supplied variable of type LONG as an
* FUNCTION: Increments a caller supplied variable of type LONG as an
* atomic operation
* ARGUMENTS:
* Addend = Points to a variable whose value is to be increment

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/init.c
* PURPOSE: Executive initalization
*
*
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net) - Added ExpInitializeExecutive
* and optimized/cleaned it.
* Eric Kohl (ekohl@abo.rhein-zeitung.de)
@ -34,8 +34,8 @@ VOID PspPostInitSystemProcess(VOID);
/* FUNCTIONS ****************************************************************/
static
VOID
static
VOID
INIT_FUNCTION
InitSystemSharedUserPage (PCSZ ParameterLine)
{
@ -61,13 +61,13 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
* There is NO need to do this again.
*/
Ki386SetProcessorFeatures();
/* Set the Version Data */
SharedUserData->NtProductType = NtProductWinNt;
SharedUserData->ProductTypeIsValid = TRUE;
SharedUserData->NtMajorVersion = 5;
SharedUserData->NtMinorVersion = 0;
/*
* Retrieve the current dos system path
* (e.g.: C:\reactos) from the given arc path
@ -88,18 +88,18 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
/* Extract path */
p = strchr (ParamBuffer, '\\');
if (p) {
DPRINT("Boot path: %s\n", p);
RtlCreateUnicodeStringFromAsciiz (&BootPath, p);
*p = 0;
} else {
DPRINT("Boot path: %s\n", "\\");
RtlCreateUnicodeStringFromAsciiz (&BootPath, "\\");
}
DPRINT("Arc name: %s\n", ParamBuffer);
/* Only ARC Name left - Build full ARC Name */
ArcNameBuffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
swprintf (ArcNameBuffer, L"\\ArcName\\%S", ParamBuffer);
@ -123,29 +123,29 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
Status = NtOpenSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes);
/* Free the String */
ExFreePool(ArcName.Buffer);
/* Check for Success */
if (!NT_SUCCESS(Status)) {
/* Free the Strings */
RtlFreeUnicodeString(&BootPath);
ExFreePool(ArcDeviceName.Buffer);
CPRINT("NtOpenSymbolicLinkObject() failed (Status %x)\n", Status);
KEBUGCHECK(0);
}
/* Query the Link */
Status = NtQuerySymbolicLinkObject(Handle,
&ArcDeviceName,
&Length);
NtClose (Handle);
/* Check for Success */
if (!NT_SUCCESS(Status)) {
/* Free the Strings */
RtlFreeUnicodeString(&BootPath);
ExFreePool(ArcDeviceName.Buffer);
@ -161,12 +161,12 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
/* Loop Drives */
for (i = 0; i < 26; i++) {
/* Setup the String */
swprintf (DriveNameBuffer, L"\\??\\%C:", 'A' + i);
RtlInitUnicodeString(&DriveName,
DriveNameBuffer);
/* Open the Symbolic Link */
InitializeObjectAttributes(&ObjectAttributes,
&DriveName,
@ -176,18 +176,18 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
Status = NtOpenSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes);
/* If it failed, skip to the next drive */
if (!NT_SUCCESS(Status)) {
DPRINT("Failed to open link %wZ\n", &DriveName);
continue;
}
/* Query it */
Status = NtQuerySymbolicLinkObject(Handle,
&DriveDeviceName,
&Length);
/* If it failed, skip to the next drive */
if (!NT_SUCCESS(Status)) {
DPRINT("Failed to query link %wZ\n", &DriveName);
@ -197,7 +197,7 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
/* See if we've found the boot drive */
if (!RtlCompareUnicodeString (&ArcDeviceName, &DriveDeviceName, FALSE)) {
DPRINT("DOS Boot path: %c:%wZ\n", 'A' + i, &BootPath);
swprintf(SharedUserData->NtSystemRoot, L"%C:%wZ", 'A' + i, &BootPath);
BootDriveFound = TRUE;
@ -206,7 +206,7 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
/* Close this Link */
NtClose (Handle);
}
/* Free all the Strings we have in memory */
RtlFreeUnicodeString (&BootPath);
ExFreePool(DriveDeviceName.Buffer);
@ -214,7 +214,7 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
/* Make sure we found the Boot Drive */
if (BootDriveFound == FALSE) {
DbgPrint("No system drive found!\n");
KEBUGCHECK (NO_BOOT_DEVICE);
}
@ -247,7 +247,7 @@ ExecuteRuntimeAsserts(VOID)
ASSERT(FIELD_OFFSET(KV86M_TRAP_FRAME, orig_ebp) == TF_ORIG_EBP);
ASSERT(FIELD_OFFSET(KPCR, Tib.ExceptionList) == KPCR_EXCEPTION_LIST);
ASSERT(FIELD_OFFSET(KPCR, Self) == KPCR_SELF);
ASSERT(FIELD_OFFSET(KPCR, PrcbData) + FIELD_OFFSET(KPRCB, CurrentThread) == KPCR_CURRENT_THREAD);
ASSERT(FIELD_OFFSET(KPCR, PrcbData) + FIELD_OFFSET(KPRCB, CurrentThread) == KPCR_CURRENT_THREAD);
ASSERT(FIELD_OFFSET(KPCR, PrcbData) + FIELD_OFFSET(KPRCB, NpxThread) == KPCR_NPX_THREAD);
ASSERT(FIELD_OFFSET(KTSS, Esp0) == KTSS_ESP0);
ASSERT(FIELD_OFFSET(KTSS, Eflags) == KTSS_EFLAGS);
@ -262,115 +262,115 @@ ParseAndCacheLoadedModules(PBOOLEAN SetupBoot)
{
ULONG i;
PCHAR Name;
/* Loop the Module List and get the modules we want */
for (i = 1; i < KeLoaderBlock.ModsCount; i++) {
/* Get the Name of this Module */
if (!(Name = strrchr((PCHAR)KeLoaderModules[i].String, '\\'))) {
/* Save the name */
Name = (PCHAR)KeLoaderModules[i].String;
} else {
/* No name, skip */
Name++;
}
/* Now check for any of the modules we will need later */
if (!_stricmp(Name, "ansi.nls")) {
CachedModules[AnsiCodepage] = &KeLoaderModules[i];
} else if (!_stricmp(Name, "oem.nls")) {
CachedModules[OemCodepage] = &KeLoaderModules[i];
} else if (!_stricmp(Name, "casemap.nls")) {
CachedModules[UnicodeCasemap] = &KeLoaderModules[i];
} else if (!_stricmp(Name, "system") || !_stricmp(Name, "system.hiv")) {
CachedModules[SystemRegistry] = &KeLoaderModules[i];
*SetupBoot = FALSE;
} else if (!_stricmp(Name, "hardware") || !_stricmp(Name, "hardware.hiv")) {
CachedModules[HardwareRegistry] = &KeLoaderModules[i];
}
}
}
}
inline
VOID
STDCALL
ParseCommandLine(PULONG MaxMem,
PBOOLEAN NoGuiBoot,
PBOOLEAN BootLog,
ParseCommandLine(PULONG MaxMem,
PBOOLEAN NoGuiBoot,
PBOOLEAN BootLog,
PBOOLEAN ForceAcpiDisable)
{
PCHAR p1, p2;
PCHAR p1, p2;
p1 = (PCHAR)KeLoaderBlock.CommandLine;
while(*p1 && (p2 = strchr(p1, '/'))) {
p2++;
if (!_strnicmp(p2, "MAXMEM", 6)) {
p2 += 6;
while (isspace(*p2)) p2++;
if (*p2 == '=') {
p2++;
while(isspace(*p2)) p2++;
if (isdigit(*p2)) {
while (isdigit(*p2)) {
*MaxMem = *MaxMem * 10 + *p2 - '0';
p2++;
}
}
break;
}
}
} else if (!_strnicmp(p2, "NOGUIBOOT", 9)) {
p2 += 9;
*NoGuiBoot = TRUE;
} else if (!_strnicmp(p2, "CRASHDUMP", 9)) {
p2 += 9;
if (*p2 == ':') {
p2++;
if (!_strnicmp(p2, "FULL", 4)) {
MmCoreDumpType = MM_CORE_DUMP_TYPE_FULL;
} else {
MmCoreDumpType = MM_CORE_DUMP_TYPE_NONE;
}
}
} else if (!_strnicmp(p2, "BOOTLOG", 7)) {
p2 += 7;
*BootLog = TRUE;
} else if (!_strnicmp(p2, "NOACPI", 6)) {
p2 += 6;
*ForceAcpiDisable = TRUE;
}
p1 = p2;
}
}
VOID
VOID
INIT_FUNCTION
STDCALL
ExpInitializeExecutive(VOID)
@ -391,19 +391,19 @@ ExpInitializeExecutive(VOID)
/* Check if the structures match the ASM offset constants */
ExecuteRuntimeAsserts();
/* Sets up the Text Sections of the Kernel and HAL for debugging */
LdrInit1();
/* Lower the IRQL to Dispatch Level */
KeLowerIrql(DISPATCH_LEVEL);
/* Sets up the VDM Data */
NtEarlyInitVdm();
/* Parse Command Line Settings */
ParseCommandLine(&MaxMem, &NoGuiBoot, &BootLog, &ForceAcpiDisable);
/* Initialize Kernel Memory Address Space */
MmInit1(FirstKrnlPhysAddr,
LastKrnlPhysAddr,
@ -414,30 +414,30 @@ ExpInitializeExecutive(VOID)
/* Parse the Loaded Modules (by FreeLoader) and cache the ones we'll need */
ParseAndCacheLoadedModules(&SetupBoot);
/* Initialize the kernel debugger parameters */
KdInitSystem(0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
/* Initialize the Dispatcher, Clock and Bug Check Mechanisms. */
KeInit2();
/* Bring back the IRQL to Passive */
KeLowerIrql(PASSIVE_LEVEL);
/* Initialize Profiling */
InitializeListHead(&KiProfileListHead);
InitializeListHead(&KiProfileSourceListHead);
KeInitializeSpinLock(&KiProfileLock);
/* Load basic Security for other Managers */
if (!SeInit1()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED);
/* Create the Basic Object Manager Types to allow new Object Types */
ObInit();
/* Initialize Lookaside Lists */
ExInit2();
/* Set up Region Maps, Sections and the Paging File */
MmInit2();
@ -446,7 +446,7 @@ ExpInitializeExecutive(VOID)
/* Set 1 CPU for now, we'll increment this later */
KeNumberProcessors = 1;
/* Initalize the Process Manager */
PiInitProcessManager();
@ -455,7 +455,7 @@ ExpInitializeExecutive(VOID)
/* Initialize all processors */
while (!HalAllProcessorsStarted()) {
PVOID ProcessorStack;
/* Set up the Kernel and Process Manager for this CPU */
@ -472,10 +472,10 @@ ExpInitializeExecutive(VOID)
/* Do Phase 1 HAL Initalization */
HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
/* Initialize Basic System Objects and Worker Threads */
ExInit3();
/* Create the system handle table, assign it to the system process, create
the client id table and assign a PID for the system process. This needs
to be done before the worker threads are initialized so the system
@ -484,33 +484,33 @@ ExpInitializeExecutive(VOID)
/* initialize the worker threads */
ExpInitializeWorkerThreads();
/* initialize callbacks */
ExpInitializeCallbacks();
/* Call KD Providers at Phase 1 */
KdInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
/* Initialize I/O Objects, Filesystems, Error Logging and Shutdown */
IoInit();
/* TBD */
PoInit((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock, ForceAcpiDisable);
/* Initialize the Registry (Hives are NOT yet loaded!) */
CmInitializeRegistry();
/* Unmap Low memory, initialize the Page Zeroing and the Balancer Thread */
MmInit3();
/* Initialize Cache Views */
CcInit();
/* Initialize File Locking */
FsRtlpInitFileLockingImplementation();
/* Report all resources used by hal */
HalReportResourceUsage();
HalReportResourceUsage();
/* Clear the screen to blue */
HalInitSystem(2, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
@ -522,7 +522,7 @@ ExpInitializeExecutive(VOID)
HalDisplayString("\n\nReactOS is free software, covered by the GNU General "
"Public License, and you\n");
HalDisplayString("are welcome to change it and/or distribute copies of it "
"under certain\n");
"under certain\n");
HalDisplayString("conditions. There is absolutely no warranty for "
"ReactOS.\n\n");
@ -541,10 +541,10 @@ ExpInitializeExecutive(VOID)
/* Import and Load Registry Hives */
CmInitHives(SetupBoot);
/* Initialize the time zone information from the registry */
ExpInitTimeZoneInfo();
/* Enter the kernel debugger before starting up the boot drivers */
KdbEnter();
@ -553,16 +553,16 @@ ExpInitializeExecutive(VOID)
/* Display the boot screen image if not disabled */
if (!NoGuiBoot) InbvEnableBootDriver(TRUE);
/* Create ARC Names, SystemRoot SymLink, Load Drivers and Assign Letters */
IoInit3();
/* Load the System DLL and its Entrypoints */
LdrpInitializeSystemDll();
/* Initialize the Default Locale */
PiInitDefaultLocale();
/* Initialize shared user page. Set dos system path, dos device map, etc. */
InitSystemSharedUserPage ((PCHAR)KeLoaderBlock.CommandLine);
@ -578,10 +578,10 @@ ExpInitializeExecutive(VOID)
&ObjectAttributes,
SynchronizationEvent,
FALSE);
/* Check for Success */
if (!NT_SUCCESS(Status)) {
DPRINT1("Failed to create 'ReactOSInitDone' event (Status 0x%x)\n", Status);
InitDoneEventHandle = INVALID_HANDLE_VALUE;
}
@ -589,10 +589,10 @@ ExpInitializeExecutive(VOID)
/* Launch initial process */
Status = LdrLoadInitialProcess(&ProcessHandle,
&ThreadHandle);
/* Check for success, Bugcheck if we failed */
if (!NT_SUCCESS(Status)) {
KEBUGCHECKEX(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
@ -613,15 +613,15 @@ ExpInitializeExecutive(VOID)
FALSE,
&Timeout);
if (!NT_SUCCESS(Status)) {
DPRINT1("NtWaitForMultipleObjects failed with status 0x%x!\n", Status);
} else if (Status == STATUS_TIMEOUT) {
DPRINT1("WARNING: System not initialized after 120 seconds.\n");
} else if (Status == STATUS_WAIT_0 + 1) {
/* Crash the system if the initial process was terminated. */
KEBUGCHECKEX(SESSION5_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
@ -632,9 +632,9 @@ ExpInitializeExecutive(VOID)
/* Signal the Event and close the handle */
ZwSetEvent(InitDoneEventHandle, NULL);
ZwClose(InitDoneEventHandle);
} else {
/* On failure to create 'ReactOSInitDone' event, go to text mode ASAP */
if (!NoGuiBoot) InbvEnableBootDriver(FALSE);
@ -643,11 +643,11 @@ ExpInitializeExecutive(VOID)
Status = ZwWaitForSingleObject(ProcessHandle,
FALSE,
&Timeout);
/* Check for timeout, crash if the initial process didn't initalize */
if (Status != STATUS_TIMEOUT) KEBUGCHECKEX(SESSION5_INITIALIZATION_FAILED, Status, 1, 0, 0);
}
/* Enable the Clock, close remaining handles */
KiTimerSystemAuditing = 1;
ZwClose(ThreadHandle);

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/interlck.c
* PURPOSE: Implements interlocked functions
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/
@ -80,16 +80,16 @@ ExInterlockedAddUlong (PULONG Addend,
/*
* ExInterlockedAddUlong adds an unsigned long value to a given unsigned
* integer as an atomic operation.
*
*
* ADDEND = Points to an unsigned long integer whose value is to be adjusted
* by the Increment value.
*
*
* INCREMENT = Is an unsigned long integer to be added.
*
*
* LOCK = Points to a spinlock to be used to synchronize access to ADDEND.
*
* Returns:
*
*
* Returns:
*
* The original value of the unsigned integer pointed to by ADDEND.
*/
{
@ -115,15 +115,15 @@ ExInterlockedAddLargeInteger (PLARGE_INTEGER Addend,
PKSPIN_LOCK Lock)
/*
* Adds two large integer values as an atomic operation.
*
*
* ADDEND = Pointer to a large integer value that will have INCREMENT added.
*
*
* INCREMENT = Value to be added.
*
*
* LOCK = Spinlock used to synchronize access to ADDEND.
*
*
* Returns:
*
*
* The original value of the large integer pointed to by ADDEND.
*/
{
@ -218,16 +218,16 @@ ExfInterlockedAddUlong(PULONG Addend,
/*
* ExInterlockedAddUlong adds an unsigned long value to a given unsigned
* integer as an atomic operation.
*
*
* ADDEND = Points to an unsigned long integer whose value is to be adjusted
* by the Increment value.
*
*
* INCREMENT = Is an unsigned long integer to be added.
*
*
* LOCK = Points to a spinlock to be used to synchronize access to ADDEND.
*
* Returns:
*
*
* Returns:
*
* The original value of the unsigned integer pointed to by ADDEND.
*/
{

View file

@ -446,7 +446,7 @@ InterlockedPopEntrySList(IN PSLIST_HEADER ListHead)
{
SLIST_HEADER newslh, oldslh;
PSLIST_ENTRY le;
do
{
oldslh = *(volatile SLIST_HEADER *)ListHead;
@ -476,9 +476,9 @@ InterlockedPushEntrySList(IN PSLIST_HEADER ListHead,
IN PSLIST_ENTRY ListEntry)
{
SLIST_HEADER newslh, oldslh;
newslh.Next.Next = ListEntry;
do
{
oldslh = *(volatile SLIST_HEADER *)ListHead;

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/lookas.c
* PURPOSE: Lookaside lists
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
* Casper S. Hornstrup (chorns@users.sourceforge.net)
*/

View file

@ -1,9 +1,9 @@
/*
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/mutant.c
* PURPOSE: Executive Management of Mutants
*
*
* PROGRAMMERS: Alex Ionescu - Fix tab/space mismatching, tiny fixes to query function and
* add more debug output.
* David Welch (welch@cwcom.net)
@ -24,14 +24,14 @@ static GENERIC_MAPPING ExpMutantMapping = {
MUTANT_ALL_ACCESS};
static const INFORMATION_CLASS_INFO ExMutantInfoClass[] = {
/* MutantBasicInformation */
ICI_SQ_SAME( sizeof(MUTANT_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ),
};
/* FUNCTIONS *****************************************************************/
VOID
VOID
STDCALL
ExpDeleteMutant(PVOID ObjectBody)
{
@ -45,7 +45,7 @@ ExpDeleteMutant(PVOID ObjectBody)
FALSE);
}
VOID
VOID
INIT_FUNCTION
ExpInitializeMutantImplementation(VOID)
{
@ -79,7 +79,7 @@ ExpInitializeMutantImplementation(VOID)
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtCreateMutant(OUT PHANDLE MutantHandle,
IN ACCESS_MASK DesiredAccess,
@ -90,27 +90,27 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
HANDLE hMutant;
PKMUTANT Mutant;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtCreateMutant(0x%x, 0x%x, 0x%x)\n", MutantHandle, DesiredAccess, ObjectAttributes);
/* Check Output Safety */
if(PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(MutantHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Create the Mutant Object*/
Status = ObCreateObject(PreviousMode,
ExMutantObjectType,
@ -121,10 +121,10 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
0,
0,
(PVOID*)&Mutant);
/* Check for success */
if(NT_SUCCESS(Status)) {
/* Initalize the Kernel Mutant */
DPRINT("Initializing the Mutant\n");
KeInitializeMutant(Mutant, InitialOwner);
@ -137,18 +137,18 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
NULL,
&hMutant);
ObDereferenceObject(Mutant);
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*MutantHandle = hMutant;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}
@ -160,7 +160,7 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtOpenMutant(OUT PHANDLE MutantHandle,
IN ACCESS_MASK DesiredAccess,
@ -169,27 +169,27 @@ NtOpenMutant(OUT PHANDLE MutantHandle,
HANDLE hMutant;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtOpenMutant(0x%x, 0x%x, 0x%x)\n", MutantHandle, DesiredAccess, ObjectAttributes);
/* Check Output Safety */
if(PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(MutantHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Open the Object */
Status = ObOpenObjectByName(ObjectAttributes,
ExMutantObjectType,
@ -201,15 +201,15 @@ NtOpenMutant(OUT PHANDLE MutantHandle,
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*MutantHandle = hMutant;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
@ -220,7 +220,7 @@ NtOpenMutant(OUT PHANDLE MutantHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtQueryMutant(IN HANDLE MutantHandle,
IN MUTANT_INFORMATION_CLASS MutantInformationClass,
@ -232,9 +232,9 @@ NtQueryMutant(IN HANDLE MutantHandle,
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PMUTANT_BASIC_INFORMATION BasicInfo = (PMUTANT_BASIC_INFORMATION)MutantInformation;
PAGED_CODE();
/* Check buffers and parameters */
DefaultQueryInfoBufferCheck(MutantInformationClass,
ExMutantInfoClass,
@ -244,7 +244,7 @@ NtQueryMutant(IN HANDLE MutantHandle,
PreviousMode,
&Status);
if(!NT_SUCCESS(Status)) {
DPRINT("NtQueryMutant() failed, Status: 0x%x\n", Status);
return Status;
}
@ -260,7 +260,7 @@ NtQueryMutant(IN HANDLE MutantHandle,
if(NT_SUCCESS(Status)) {
_SEH_TRY {
/* Fill out the Basic Information Requested */
DPRINT("Returning Mutant Information\n");
BasicInfo->CurrentCount = KeReadStateMutant(Mutant);
@ -269,17 +269,17 @@ NtQueryMutant(IN HANDLE MutantHandle,
/* Return the Result Length if requested */
if(ResultLength) *ResultLength = sizeof(MUTANT_BASIC_INFORMATION);
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
/* Release the Object */
ObDereferenceObject(Mutant);
}
/* Return Status */
return Status;
}
@ -288,7 +288,7 @@ NtQueryMutant(IN HANDLE MutantHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtReleaseMutant(IN HANDLE MutantHandle,
IN PLONG PreviousCount OPTIONAL)
@ -296,31 +296,31 @@ NtReleaseMutant(IN HANDLE MutantHandle,
PKMUTANT Mutant;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
DPRINT("NtReleaseMutant(MutantHandle 0%x PreviousCount 0%x)\n",
MutantHandle,
DPRINT("NtReleaseMutant(MutantHandle 0%x PreviousCount 0%x)\n",
MutantHandle,
PreviousCount);
/* Check Output Safety */
if(PreviousMode != KernelMode && PreviousCount) {
_SEH_TRY {
ProbeForWrite(PreviousCount,
sizeof(LONG),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
}
/* Open the Object */
Status = ObReferenceObjectByHandle(MutantHandle,
@ -329,12 +329,12 @@ NtReleaseMutant(IN HANDLE MutantHandle,
PreviousMode,
(PVOID*)&Mutant,
NULL);
/* Check for Success and release if such */
if(NT_SUCCESS(Status)) {
LONG Prev = 0;
/* release the mutant. doing so might raise an exception which we're
required to catch! */
_SEH_TRY {
@ -346,7 +346,7 @@ NtReleaseMutant(IN HANDLE MutantHandle,
Status = _SEH_GetExceptionCode();
} _SEH_END;
ObDereferenceObject(Mutant);
if(NT_SUCCESS(Status)) {
@ -359,7 +359,7 @@ NtReleaseMutant(IN HANDLE MutantHandle,
*PreviousCount = Prev;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;

View file

@ -1,10 +1,10 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/power.c
* PURPOSE: Power managment
*
*
* PROGRAMMERS: David Welch (welch@cwcom.net)
*/
@ -39,7 +39,7 @@ KiHaltProcessorDpcRoutine(IN PKDPC Dpc,
VOID STDCALL
ShutdownThreadMain(PVOID Context)
{
SHUTDOWN_ACTION Action = (SHUTDOWN_ACTION)Context;
SHUTDOWN_ACTION Action = (SHUTDOWN_ACTION)Context;
LARGE_INTEGER Waittime;
/* Run the thread on the boot processor */
@ -51,7 +51,7 @@ ShutdownThreadMain(PVOID Context)
PiShutdownProcessManager();
MiShutdownMemoryManager();
Waittime.QuadPart = (LONGLONG)-10000000; /* 1sec */
KeDelayExecutionThread(KernelMode, FALSE, &Waittime);
@ -105,7 +105,7 @@ ShutdownThreadMain(PVOID Context)
}
NTSTATUS STDCALL
NTSTATUS STDCALL
NtSetSystemPowerState(IN POWER_ACTION SystemAction,
IN SYSTEM_POWER_STATE MinSystemState,
IN ULONG Flags)
@ -117,7 +117,7 @@ NtSetSystemPowerState(IN POWER_ACTION SystemAction,
/*
* @implemented
*/
NTSTATUS STDCALL
NTSTATUS STDCALL
NtShutdownSystem(IN SHUTDOWN_ACTION Action)
{
NTSTATUS Status;

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/profile.c
* PURPOSE: Support for Executive Profile Objects
*
*
* PROGRAMMERS: Alex Ionescu
*/
@ -41,7 +41,7 @@ static GENERIC_MAPPING ExpProfileMapping = {
STANDARD_RIGHTS_EXECUTE | PROFILE_CONTROL,
STANDARD_RIGHTS_ALL};
VOID
VOID
STDCALL
ExpDeleteProfile(PVOID ObjectBody)
{
@ -49,35 +49,35 @@ ExpDeleteProfile(PVOID ObjectBody)
/* Typecast the Object */
Profile = (PEPROFILE)ObjectBody;
/* Check if there if the Profile was started */
if (Profile->LockedBuffer) {
/* Stop the Profile */
KeStopProfile(Profile->KeProfile);
/* Unmap the Locked Buffer */
MmUnmapLockedPages(Profile->LockedBuffer, Profile->Mdl);
MmUnlockPages(Profile->Mdl);
ExFreePool(Profile->Mdl);
}
/* Check if a Process is associated */
if (Profile->Process != NULL) {
/* Dereference it */
ObDereferenceObject(Profile->Process);
Profile->Process = NULL;
}
}
VOID
VOID
INIT_FUNCTION
ExpInitializeProfileImplementation(VOID)
{
/* Initialize the Mutex to lock the States */
KeInitializeMutex(&ExpProfileMutex, 0x40);
/* Create the Object Type */
ExProfileObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
RtlInitUnicodeString(&ExProfileObjectType->TypeName, L"Profile");
@ -101,12 +101,12 @@ ExpInitializeProfileImplementation(VOID)
ObpCreateTypeObject(ExProfileObjectType);
}
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtCreateProfile(OUT PHANDLE ProfileHandle,
IN HANDLE Process OPTIONAL,
IN PVOID ImageBase,
IN ULONG ImageSize,
IN PVOID ImageBase,
IN ULONG ImageSize,
IN ULONG BucketSize,
IN PVOID Buffer,
IN ULONG BufferSize,
@ -119,7 +119,7 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Easy way out */
@ -127,27 +127,27 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
/* Check the Parameters for validity */
if(PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(ProfileHandle,
sizeof(HANDLE),
sizeof(ULONG));
ProbeForWrite(Buffer,
BufferSize,
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Check if a process was specified */
if (Process) {
/* Reference it */
Status = ObReferenceObjectByHandle(Process,
PROCESS_QUERY_INFORMATION,
@ -156,15 +156,15 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
(PVOID*)&pProcess,
NULL);
if (!NT_SUCCESS(Status)) return(Status);
} else {
/* No process was specified, which means a System-Wide Profile */
pProcess = NULL;
/* For this, we need to check the Privilege */
if(!SeSinglePrivilegeCheck(SeSystemProfilePrivilege, PreviousMode)) {
DPRINT1("NtCreateProfile: Caller requires the SeSystemProfilePrivilege privilege!\n");
return STATUS_PRIVILEGE_NOT_HELD;
}
@ -196,7 +196,7 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
Profile->LockedBuffer = NULL;
Profile->Affinity = Affinity;
Profile->Process = pProcess;
/* Insert into the Object Tree */
Status = ObInsertObject ((PVOID)Profile,
NULL,
@ -205,22 +205,22 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
NULL,
&hProfile);
ObDereferenceObject(Profile);
/* Check for Success */
if (!NT_SUCCESS(Status)) {
/* Dereference Process on failure */
if (pProcess) ObDereferenceObject(pProcess);
return Status;
}
/* Copy the created handle back to the caller*/
_SEH_TRY {
*ProfileHandle = hProfile;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
@ -228,7 +228,7 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
return Status;
}
NTSTATUS
NTSTATUS
STDCALL
NtQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceCounter,
OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL)
@ -236,48 +236,48 @@ NtQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceCounter,
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
LARGE_INTEGER PerfFrequency;
NTSTATUS Status = STATUS_SUCCESS;
/* Check the Parameters for validity */
if(PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(PerformanceCounter,
sizeof(LARGE_INTEGER),
sizeof(ULONG));
ProbeForWrite(PerformanceFrequency,
sizeof(LARGE_INTEGER),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
_SEH_TRY {
/* Query the Kernel */
*PerformanceCounter = KeQueryPerformanceCounter(&PerfFrequency);
/* Return Frequency if requested */
if(PerformanceFrequency) {
*PerformanceFrequency = PerfFrequency;
}
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
return Status;
}
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtStartProfile(IN HANDLE ProfileHandle)
{
PEPROFILE Profile;
@ -285,7 +285,7 @@ NtStartProfile(IN HANDLE ProfileHandle)
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
PVOID TempLockedBuffer;
NTSTATUS Status;
PAGED_CODE();
/* Get the Object */
@ -296,37 +296,37 @@ NtStartProfile(IN HANDLE ProfileHandle)
(PVOID*)&Profile,
NULL);
if (!NT_SUCCESS(Status)) return(Status);
/* To avoid a Race, wait on the Mutex */
KeWaitForSingleObject(&ExpProfileMutex,
KeWaitForSingleObject(&ExpProfileMutex,
Executive,
KernelMode,
FALSE,
NULL);
/* The Profile can still be enabled though, so handle that */
if (Profile->LockedBuffer) {
/* Release our lock, dereference and return */
KeReleaseMutex(&ExpProfileMutex, FALSE);
ObDereferenceObject(Profile);
return STATUS_PROFILING_NOT_STOPPED;
}
/* Allocate a Kernel Profile Object. */
KeProfile = ExAllocatePoolWithTag(NonPagedPool,
KeProfile = ExAllocatePoolWithTag(NonPagedPool,
sizeof(EPROFILE),
TAG('P', 'r', 'o', 'f'));
/* Allocate the Mdl Structure */
Profile->Mdl = MmCreateMdl(NULL, Profile->Buffer, Profile->BufferSize);
/* Probe and Lock for Write Access */
MmProbeAndLockPages(Profile->Mdl, PreviousMode, IoWriteAccess);
/* Map the pages */
TempLockedBuffer = MmMapLockedPages(Profile->Mdl, KernelMode);
/* Initialize the Kernel Profile Object */
Profile->KeProfile = KeProfile;
KeInitializeProfile(KeProfile,
@ -336,13 +336,13 @@ NtStartProfile(IN HANDLE ProfileHandle)
Profile->BucketSize,
Profile->ProfileSource,
Profile->Affinity);
/* Start the Profiling */
KeStartProfile(KeProfile, TempLockedBuffer);
/* Now it's safe to save this */
Profile->LockedBuffer = TempLockedBuffer;
/* Release mutex, dereference and return */
KeReleaseMutex(&ExpProfileMutex, FALSE);
ObDereferenceObject(Profile);
@ -350,13 +350,13 @@ NtStartProfile(IN HANDLE ProfileHandle)
}
NTSTATUS
STDCALL
STDCALL
NtStopProfile(IN HANDLE ProfileHandle)
{
PEPROFILE Profile;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status;
PAGED_CODE();
/* Get the Object */
@ -367,32 +367,32 @@ NtStopProfile(IN HANDLE ProfileHandle)
(PVOID*)&Profile,
NULL);
if (!NT_SUCCESS(Status)) return(Status);
/* Get the Mutex */
KeWaitForSingleObject(&ExpProfileMutex,
KeWaitForSingleObject(&ExpProfileMutex,
Executive,
KernelMode,
FALSE,
NULL);
/* Make sure the Profile Object is really Started */
if (!Profile->LockedBuffer) {
Status = STATUS_PROFILING_NOT_STARTED;
goto Exit;
}
/* Stop the Profile */
KeStopProfile(Profile->KeProfile);
/* Unlock the Buffer */
MmUnmapLockedPages(Profile->LockedBuffer, Profile->Mdl);
MmUnlockPages(Profile->Mdl);
ExFreePool(Profile->KeProfile);
/* Clear the Locked Buffer pointer, meaning the Object is Stopped */
Profile->LockedBuffer = NULL;
Exit:
/* Release Mutex, Dereference and Return */
KeReleaseMutex(&ExpProfileMutex, FALSE);
@ -400,60 +400,60 @@ Exit:
return Status;
}
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtQueryIntervalProfile(IN KPROFILE_SOURCE ProfileSource,
OUT PULONG Interval)
{
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
ULONG ReturnInterval;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Check the Parameters for validity */
if(PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(Interval,
sizeof(ULONG),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Query the Interval */
ReturnInterval = KeQueryIntervalProfile(ProfileSource);
/* Return the data */
_SEH_TRY {
*Interval = ReturnInterval;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
/* Return Success */
/* Return Success */
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtSetIntervalProfile(IN ULONG Interval,
IN KPROFILE_SOURCE Source)
{
/* Let the Kernel do the job */
KeSetIntervalProfile(Interval, Source);
/* Nothing can go wrong */
return STATUS_SUCCESS;
}

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/resource.c
* PURPOSE: Resource synchronization construct
*
*
* PROGRAMMERS: No programmer listed.
*/
@ -105,18 +105,18 @@ ExAcquireResourceExclusiveLite (
*/
{
KIRQL oldIrql;
DPRINT("ExAcquireResourceExclusiveLite(Resource %x, Wait %d)\n",
Resource, Wait);
ASSERT_IRQL_LESS(DISPATCH_LEVEL);
/* undefed for now, since cdfs must be fixed first */
#if 0
/* At least regular kmode APC's must be disabled
#if 0
/* At least regular kmode APC's must be disabled
* Note that this requirement is missing in old DDK's */
ASSERT(KeGetCurrentThread() == NULL || /* <-Early in the boot process the current thread is obseved to be NULL */
KeGetCurrentThread()->KernelApcDisable ||
KeGetCurrentThread()->KernelApcDisable ||
KeGetCurrentIrql() == APC_LEVEL);
#endif
@ -139,17 +139,17 @@ ExAcquireResourceExclusiveLite (
DPRINT("ExAcquireResourceExclusiveLite() = FALSE\n");
return(FALSE);
}
/*
/*
* This is slightly better than it looks because other exclusive
* threads who are waiting won't be woken up but there is a race
* with new threads trying to grab the resource so we must have
* the spinlock, still normally this loop will only be executed
* once
* NOTE: We might want to set a timeout to detect deadlock
* NOTE: We might want to set a timeout to detect deadlock
* (10 minutes?)
*/
while (Resource->ActiveCount)
while (Resource->ActiveCount)
{
Resource->NumberOfExclusiveWaiters++;
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
@ -181,7 +181,7 @@ static BOOLEAN EiRemoveSharedOwner(PERESOURCE Resource,
*/
{
ULONG i;
if (Resource->OwnerThreads[1].OwnerThread == ResourceThreadId)
{
Resource->OwnerThreads[1].OwnerCount--;
@ -192,13 +192,13 @@ static BOOLEAN EiRemoveSharedOwner(PERESOURCE Resource,
}
return(TRUE);
}
if (Resource->OwnerThreads[1].OwnerThread)
if (Resource->OwnerThreads[1].OwnerThread)
{
/* Oh dear, the caller didn't own the resource after all */
return(FALSE);;
return(FALSE);
}
for (i=0; i<Resource->OwnerThreads[1].TableSize; i++)
{
if (Resource->OwnerTable[i].OwnerThread == ResourceThreadId)
@ -227,10 +227,10 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
ERESOURCE_THREAD CurrentThread = ExGetCurrentResourceThread();
POWNER_ENTRY freeEntry;
ULONG i = 0;
DPRINT("EiAddSharedOwner(Resource %x)\n", Resource);
if (Resource->ActiveCount == 0)
if (Resource->ActiveCount == 0)
{
/* no owner, it's easy */
Resource->OwnerThreads[1].OwnerThread = ExGetCurrentResourceThread();
@ -244,19 +244,19 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
DPRINT("EiAddSharedOwner() = TRUE\n");
return(TRUE);
}
/*
* now, we must search if this thread has already acquired this resource
* then increase ownercount if found, else create new entry or reuse free
/*
* now, we must search if this thread has already acquired this resource
* then increase ownercount if found, else create new entry or reuse free
* entry
*/
if (Resource->OwnerTable == NULL)
{
DPRINT("Creating owner table\n");
/* allocate ownertable,memset to 0, initialize first entry */
Resource->OwnerTable =
ExAllocatePoolWithTag(NonPagedPool, sizeof(OWNER_ENTRY)*3,
Resource->OwnerTable =
ExAllocatePoolWithTag(NonPagedPool, sizeof(OWNER_ENTRY)*3,
TAG_OWNER_TABLE);
if (Resource->OwnerTable == NULL)
{
@ -266,22 +266,22 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
memset(Resource->OwnerTable,0,sizeof(OWNER_ENTRY)*3);
memcpy(&Resource->OwnerTable[0], &Resource->OwnerThreads[1],
sizeof(OWNER_ENTRY));
Resource->OwnerThreads[1].OwnerThread = 0;
Resource->OwnerThreads[1].TableSize = 3;
Resource->OwnerTable[1].OwnerThread = CurrentThread;
Resource->OwnerTable[1].OwnerCount = 1;
Resource->ActiveCount++;
return(TRUE);
}
DPRINT("Search free entries\n");
DPRINT("Number of entries %d\n",
DPRINT("Number of entries %d\n",
Resource->OwnerThreads[1].TableSize);
freeEntry = NULL;
for (i=0; i<Resource->OwnerThreads[1].TableSize; i++)
{
@ -297,15 +297,15 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
break;
}
}
DPRINT("Found free entry %x\n", freeEntry);
if (!freeEntry)
{
DPRINT("Allocating new entry\n");
/* reallocate ownertable with one more entry */
freeEntry =
freeEntry =
ExAllocatePoolWithTag(NonPagedPool,
sizeof(OWNER_ENTRY)*
(Resource->OwnerThreads[1].TableSize+1),
@ -351,51 +351,51 @@ ExAcquireResourceSharedLite (
*/
{
KIRQL oldIrql;
DPRINT("ExAcquireResourceSharedLite(Resource %x, Wait %d)\n",
Resource, Wait);
ASSERT_IRQL_LESS(DISPATCH_LEVEL);
/* undefed for now, since cdfs must be fixed first */
#if 0
/* At least regular kmode APC's must be disabled
* Note that this requirement is missing in old DDK's
#if 0
/* At least regular kmode APC's must be disabled
* Note that this requirement is missing in old DDK's
*/
ASSERT(KeGetCurrentThread() == NULL || /* <-Early in the boot process the current thread is obseved to be NULL */
KeGetCurrentThread()->KernelApcDisable ||
KeGetCurrentThread()->KernelApcDisable ||
KeGetCurrentIrql() == APC_LEVEL);
#endif
KeAcquireSpinLock(&Resource->SpinLock, &oldIrql);
/* first, resolve trivial cases */
if (Resource->ActiveCount == 0)
if (Resource->ActiveCount == 0)
{
EiAddSharedOwner(Resource);
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
DPRINT("ExAcquireResourceSharedLite() = TRUE\n");
return(TRUE);
}
if ((Resource->Flag & ResourceOwnedExclusive)
&& Resource->OwnerThreads[0].OwnerThread==ExGetCurrentResourceThread())
{
/* exclusive, but by same thread : it's ok */
/*
* NOTE: Is this correct? Seems the same as ExConvertExclusiveToShared
/*
* NOTE: Is this correct? Seems the same as ExConvertExclusiveToShared
*/
Resource->OwnerThreads[0].OwnerCount++;
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
DPRINT("ExAcquireResourceSharedLite() = TRUE\n");
return(TRUE);
}
if ((Resource->Flag & ResourceOwnedExclusive)
|| Resource->NumberOfExclusiveWaiters)
{
{
/* exclusive by another thread , or thread waiting for exclusive */
if (!Wait)
if (!Wait)
{
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
DPRINT("ExAcquireResourceSharedLite() = FALSE\n");
@ -417,7 +417,7 @@ ExAcquireResourceSharedLite (
Resource->NumberOfSharedWaiters--;
}
}
EiAddSharedOwner(Resource);
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
DPRINT("ExAcquireResourceSharedLite() = TRUE\n");
@ -443,13 +443,13 @@ ExConvertExclusiveToSharedLite (
{
ULONG oldWaiters;
KIRQL oldIrql;
DPRINT("ExConvertExclusiveToSharedLite(Resource %x)\n", Resource);
KeAcquireSpinLock(&Resource->SpinLock, &oldIrql);
oldWaiters = Resource->NumberOfSharedWaiters;
if (!(Resource->Flag & ResourceOwnedExclusive))
{
/* Might not be what the caller expects, better bug check */
@ -457,7 +457,7 @@ ExConvertExclusiveToSharedLite (
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
return;
}
//transfer infos from entry 0 to entry 1 and erase entry 0
Resource->OwnerThreads[1].OwnerThread=Resource->OwnerThreads[0].OwnerThread;
Resource->OwnerThreads[1].OwnerCount=Resource->OwnerThreads[0].OwnerCount;
@ -466,7 +466,7 @@ ExConvertExclusiveToSharedLite (
/* erase exclusive flag */
Resource->Flag &= (~ResourceOwnedExclusive);
/* if no shared waiters, that's all */
if (!oldWaiters)
if (!oldWaiters)
{
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
return;
@ -524,14 +524,14 @@ ExAcquireSharedStarveExclusive (
*/
{
KIRQL oldIrql;
DPRINT("ExAcquireSharedStarveExclusive(Resource %x, Wait %d)\n",
Resource, Wait);
KeAcquireSpinLock(&Resource->SpinLock, &oldIrql);
/* no owner, it's easy */
if (Resource->ActiveCount == 0)
if (Resource->ActiveCount == 0)
{
Resource->OwnerThreads[1].OwnerThread=ExGetCurrentResourceThread();
Resource->OwnerThreads[1].OwnerCount=1;
@ -540,21 +540,21 @@ ExAcquireSharedStarveExclusive (
DPRINT("ExAcquireSharedStarveExclusive() = TRUE\n");
return(TRUE);
}
if ((Resource->Flag & ResourceOwnedExclusive)
&& Resource->OwnerThreads[0].OwnerThread==ExGetCurrentResourceThread())
{
{
/* exclusive, but by same thread : it's ok */
Resource->OwnerThreads[0].OwnerCount++;
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
DPRINT("ExAcquireSharedStarveExclusive() = TRUE\n");
return(TRUE);
}
if (Resource->Flag & ResourceOwnedExclusive)
{
{
/* exclusive by another thread */
if (!Wait)
if (!Wait)
{
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
DPRINT("ExAcquireSharedStarveExclusive() = FALSE\n");
@ -620,7 +620,7 @@ ExDeleteResourceLite (
if (Resource->OwnerTable) ExFreePool(Resource->OwnerTable);
if (Resource->SharedWaiters) ExFreePool(Resource->SharedWaiters);
if (Resource->ExclusiveWaiters) ExFreePool(Resource->ExclusiveWaiters);
return(STATUS_SUCCESS);;
return(STATUS_SUCCESS);
}
/*
@ -664,12 +664,12 @@ ExInitializeResourceLite (PERESOURCE Resource)
Resource->NumberOfExclusiveWaiters = 0;
KeInitializeSpinLock(&Resource->SpinLock);
Resource->Flag = 0;
Resource->ExclusiveWaiters =
Resource->ExclusiveWaiters =
ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_EXCLUSIVE_LOCK);
KeInitializeEvent(Resource->ExclusiveWaiters,
SynchronizationEvent,
FALSE);
Resource->SharedWaiters =
Resource->SharedWaiters =
ExAllocatePoolWithTag(NonPagedPool ,sizeof(KSEMAPHORE), TAG_SHARED_SEM);
KeInitializeSemaphore(Resource->SharedWaiters,0,0x7fffffff);
Resource->ActiveCount = 0;
@ -707,8 +707,8 @@ ExIsResourceAcquiredExclusiveLite (
/*
* @implemented
*/
//NTOSAPI
//DDKAPI
USHORT STDCALL
@ -721,7 +721,7 @@ ExIsResourceAcquiredSharedLite(
* Resource = Points to the resource to be queried
* RETURNS: The number of times the caller has acquired shared access to the
* given resource
*/
*/
{
ULONG i;
if (Resource->OwnerThreads[0].OwnerThread == ExGetCurrentResourceThread())
@ -732,7 +732,7 @@ ExIsResourceAcquiredSharedLite(
{
return (USHORT)(Resource->OwnerThreads[1].OwnerCount);
}
if (!Resource->OwnerThreads[1].TableSize)
if (!Resource->OwnerThreads[1].TableSize)
{
return(0);
}
@ -763,7 +763,7 @@ ExReinitializeResourceLite (
FALSE);
KeInitializeSemaphore(Resource->SharedWaiters,0,0x7fffffff);
Resource->ActiveCount = 0;
if (Resource->OwnerTable)
if (Resource->OwnerTable)
{
ExFreePool(Resource->OwnerTable);
}
@ -827,18 +827,18 @@ ExReleaseResourceForThreadLite (
*/
{
KIRQL oldIrql;
DPRINT("ExReleaseResourceForThreadLite(Resource %x, ResourceThreadId %x)\n",
Resource, ResourceThreadId);
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
KeAcquireSpinLock(&Resource->SpinLock, &oldIrql);
if (Resource->Flag & ResourceOwnedExclusive)
{
DPRINT("Releasing from exclusive access\n");
Resource->OwnerThreads[0].OwnerCount--;
if (Resource->OwnerThreads[0].OwnerCount > 0)
{
@ -846,7 +846,7 @@ ExReleaseResourceForThreadLite (
DPRINT("ExReleaseResourceForThreadLite() finished\n");
return;
}
Resource->OwnerThreads[0].OwnerThread = 0;
Resource->ActiveCount--;
Resource->Flag &=(~ResourceOwnedExclusive);
@ -856,8 +856,8 @@ ExReleaseResourceForThreadLite (
if (Resource->NumberOfExclusiveWaiters)
{
/* get resource to first exclusive waiter */
KeSetEvent(Resource->ExclusiveWaiters,
IO_NO_INCREMENT,
KeSetEvent(Resource->ExclusiveWaiters,
IO_NO_INCREMENT,
FALSE);
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
DPRINT("ExReleaseResourceForThreadLite() finished\n");
@ -877,20 +877,20 @@ ExReleaseResourceForThreadLite (
DPRINT("ExReleaseResourceForThreadLite() finished\n");
return;
}
EiRemoveSharedOwner(Resource, ResourceThreadId);
if (Resource->ActiveCount == 0)
{
if (Resource->NumberOfExclusiveWaiters)
{
{
/* get resource to first exclusive waiter */
KeSetEvent(Resource->ExclusiveWaiters,
IO_NO_INCREMENT,
FALSE);
}
}
KeReleaseSpinLock(&Resource->SpinLock, oldIrql);
DPRINT("ExReleaseResourceForThreadLite() finished\n");
}
@ -909,52 +909,52 @@ ExSetResourceOwnerPointer (
PKTHREAD CurrentThread;
KIRQL OldIrql;
POWNER_ENTRY OwnerEntry;
CurrentThread = KeGetCurrentThread();
/* Lock the resource */
KeAcquireSpinLock(&Resource->SpinLock, &OldIrql);
/* Check if it's exclusive */
if (Resource->Flag & ResourceOwnedExclusive) {
/* If it's exclusive, set the first entry no matter what */
Resource->OwnerThreads[0].OwnerThread = (ULONG_PTR)OwnerPointer;
} else {
/* Check both entries and see which one matches the current thread */
if (Resource->OwnerThreads[0].OwnerThread == (ULONG_PTR)CurrentThread) {
Resource->OwnerThreads[0].OwnerThread = (ULONG_PTR)OwnerPointer;
} else if (Resource->OwnerThreads[1].OwnerThread == (ULONG_PTR)CurrentThread) {
Resource->OwnerThreads[1].OwnerThread = (ULONG_PTR)OwnerPointer;
} else { /* None of the entries match, so we need to do a lookup */
/* Get the first Entry */
OwnerEntry = Resource->OwnerTable;
/* Check if the Current Thread is in the Resource Table Entry */
if ((CurrentThread->ResourceIndex >= OwnerEntry->TableSize) ||
if ((CurrentThread->ResourceIndex >= OwnerEntry->TableSize) ||
(OwnerEntry[CurrentThread->ResourceIndex].OwnerThread != (ULONG_PTR)CurrentThread)) {
/* Loop until we find the current thread in an entry */
for (;OwnerEntry->OwnerThread == (ULONG_PTR)CurrentThread;OwnerEntry++);
} else {
/* It's in the current RTE, so set it */
OwnerEntry = &OwnerEntry[CurrentThread->ResourceIndex];
}
/* Now that we went to the right entry, set the Owner Pointer */
/* Now that we went to the right entry, set the Owner Pointer */
OwnerEntry->OwnerThread = (ULONG_PTR)OwnerPointer;
}
}
/* Release the resource */
KeReleaseSpinLock(&Resource->SpinLock, OldIrql);
}

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/rundown.c
* PURPOSE: Rundown Protection Functions
*
*
* PROGRAMMERS: Alex Ionescu & Thomas Weidenmueller - Implementation
*/
@ -39,16 +39,16 @@ ExAcquireRundownProtectionEx (
)
{
ULONG_PTR PrevCount, Current;
PAGED_CODE();
Count <<= EX_RUNDOWN_COUNT_SHIFT;
/* Loop until successfully incremented the counter */
do
{
Current = RunRef->Count;
/* Make sure a rundown is not active */
if (Current & EX_RUNDOWN_ACTIVE)
{
@ -76,7 +76,7 @@ ExInitializeRundownProtection (
)
{
PAGED_CODE();
/* Set the count to zero */
RunRef->Count = 0;
}
@ -91,7 +91,7 @@ ExReInitializeRundownProtection (
)
{
PAGED_CODE();
/* Reset the count */
#ifdef _WIN64
InterlockedExchangeAdd64((LONGLONG*)&RunRef->Count, 0LL);
@ -114,23 +114,23 @@ ExReleaseRundownProtectionEx (
PAGED_CODE();
Count <<= EX_RUNDOWN_COUNT_SHIFT;
for (;;)
{
ULONG_PTR Current = RunRef->Count;
/* Check if Rundown is active */
if (Current & EX_RUNDOWN_ACTIVE)
{
/* Get Pointer */
PRUNDOWN_DESCRIPTOR RundownDescriptor = (PRUNDOWN_DESCRIPTOR)(Current & ~EX_RUNDOWN_ACTIVE);
if (RundownDescriptor == NULL)
{
/* the rundown was completed and there's no one to notify */
break;
}
Current = RundownDescriptor->References;
/* Decrease RundownDescriptor->References by Count references */
@ -162,10 +162,10 @@ ExReleaseRundownProtectionEx (
/* Successfully decremented the counter, so bail! */
break;
}
Current = PrevCount;
}
break;
}
else
@ -208,7 +208,7 @@ ExRundownCompleted (
)
{
PAGED_CODE();
/* mark the counter as active */
#ifdef _WIN64
InterlockedExchange64((LONGLONG*)&RunRef->Count, (LONGLONG)EX_RUNDOWN_ACTIVE);
@ -228,11 +228,11 @@ ExWaitForRundownProtectionRelease (
{
ULONG_PTR PrevCount, NewPtr, PrevPtr;
RUNDOWN_DESCRIPTOR RundownDescriptor;
PAGED_CODE();
PrevCount = RunRef->Count;
if (PrevCount != 0 && !(PrevCount & EX_RUNDOWN_ACTIVE))
{
/* save the reference counter */
@ -240,11 +240,11 @@ ExWaitForRundownProtectionRelease (
/* Pending references... wait on them to be closed with an event */
KeInitializeEvent(&RundownDescriptor.RundownEvent, NotificationEvent, FALSE);
ASSERT(!((ULONG_PTR)&RundownDescriptor & EX_RUNDOWN_ACTIVE));
NewPtr = (ULONG_PTR)&RundownDescriptor | EX_RUNDOWN_ACTIVE;
for (;;)
{
#ifdef _WIN64
@ -263,9 +263,9 @@ ExWaitForRundownProtectionRelease (
/* some one else was faster, let's just bail */
break;
}
PrevCount = PrevPtr;
/* save the changed reference counter and try again */
RundownDescriptor.References = PrevCount >> EX_RUNDOWN_COUNT_SHIFT;
}

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/sem.c
* PURPOSE: Synchronization primitives
*
*
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)- Reformatting, bug fixes.
* David Welch (welch@mcmail.com)
*/
@ -25,16 +25,16 @@ static GENERIC_MAPPING ExSemaphoreMapping = {
SEMAPHORE_ALL_ACCESS};
static const INFORMATION_CLASS_INFO ExSemaphoreInfoClass[] = {
/* SemaphoreBasicInformation */
ICI_SQ_SAME( sizeof(SEMAPHORE_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ),
};
VOID
VOID
INIT_FUNCTION
ExpInitializeSemaphoreImplementation(VOID)
{
/* Create the Semaphore Object */
ExSemaphoreObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
RtlInitUnicodeString(&ExSemaphoreObjectType->TypeName, L"Semaphore");
@ -62,7 +62,7 @@ ExpInitializeSemaphoreImplementation(VOID)
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess,
@ -74,29 +74,29 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
HANDLE hSemaphore;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Check Output Safety */
if(PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(SemaphoreHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Make sure the counts make sense */
if (!MaximumCount || InitialCount < 0 || InitialCount > MaximumCount) {
DPRINT("Invalid Count Data!\n");
return STATUS_INVALID_PARAMETER;
}
@ -111,15 +111,15 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
0,
0,
(PVOID*)&Semaphore);
/* Check for Success */
if (NT_SUCCESS(Status)) {
/* Initialize it */
KeInitializeSemaphore(Semaphore,
InitialCount,
MaximumCount);
/* Insert it into the Object Tree */
Status = ObInsertObject((PVOID)Semaphore,
NULL,
@ -131,15 +131,15 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*SemaphoreHandle = hSemaphore;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}
@ -151,7 +151,7 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtOpenSemaphore(OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess,
@ -160,26 +160,26 @@ NtOpenSemaphore(OUT PHANDLE SemaphoreHandle,
HANDLE hSemaphore;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Check Output Safety */
if(PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(SemaphoreHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Open the Object */
Status = ObOpenObjectByName(ObjectAttributes,
ExSemaphoreObjectType,
@ -188,18 +188,18 @@ NtOpenSemaphore(OUT PHANDLE SemaphoreHandle,
DesiredAccess,
NULL,
&hSemaphore);
/* Check for success and return handle */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
*SemaphoreHandle = hSemaphore;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
@ -233,12 +233,12 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
PreviousMode,
&Status);
if(!NT_SUCCESS(Status)) {
/* Invalid buffers */
DPRINT("NtQuerySemaphore() failed, Status: 0x%x\n", Status);
return Status;
}
/* Get the Object */
Status = ObReferenceObjectByHandle(SemaphoreHandle,
SEMAPHORE_QUERY_STATE,
@ -246,27 +246,27 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
PreviousMode,
(PVOID*)&Semaphore,
NULL);
/* Check for success */
if(NT_SUCCESS(Status)) {
_SEH_TRY {
PSEMAPHORE_BASIC_INFORMATION BasicInfo = (PSEMAPHORE_BASIC_INFORMATION)SemaphoreInformation;
/* Return the basic information */
BasicInfo->CurrentCount = KeReadStateSemaphore(Semaphore);
BasicInfo->MaximumCount = Semaphore->Limit;
/* Return length */
if(ReturnLength) *ReturnLength = sizeof(SEMAPHORE_BASIC_INFORMATION);
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
/* Dereference the Object */
ObDereferenceObject(Semaphore);
}
@ -278,7 +278,7 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
/*
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
IN LONG ReleaseCount,
@ -286,34 +286,34 @@ NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
{
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
PKSEMAPHORE Semaphore;
NTSTATUS Status = STATUS_SUCCESS;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Check buffer validity */
if(PreviousCount != NULL && PreviousMode == UserMode) {
_SEH_TRY {
ProbeForWrite(PreviousCount,
sizeof(LONG),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Make sure count makes sense */
if (!ReleaseCount) {
DPRINT("Invalid Release Count\n");
return STATUS_INVALID_PARAMETER;
}
/* Get the Object */
Status = ObReferenceObjectByHandle(SemaphoreHandle,
SEMAPHORE_MODIFY_STATE,
@ -321,28 +321,28 @@ NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
PreviousMode,
(PVOID*)&Semaphore,
NULL);
/* Check for success */
if (NT_SUCCESS(Status)) {
/* Release the semaphore */
LONG PrevCount = KeReleaseSemaphore(Semaphore,
IO_NO_INCREMENT,
ReleaseCount,
FALSE);
ObDereferenceObject(Semaphore);
/* Return it */
/* Return it */
if(PreviousCount) {
_SEH_TRY {
*PreviousCount = PrevCount;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}

View file

@ -1,5 +1,5 @@
/* $Id:$
*
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/synch.c

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/sysinfo.c
* PURPOSE: System information functions
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
* Aleksey Bragin (aleksey@studiocerebral.com)
*/
@ -84,7 +84,7 @@ ExGetCurrentProcessorCounts (
/*
* @implemented
*/
BOOLEAN
BOOLEAN
STDCALL
ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
{
@ -109,11 +109,11 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
UNICODE_STRING WValue;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
if(PreviousMode != KernelMode)
{
_SEH_TRY
@ -136,7 +136,7 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if(!NT_SUCCESS(Status))
{
return Status;
@ -165,7 +165,7 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
DPRINT1("NtQuerySystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
return STATUS_PRIVILEGE_NOT_HELD;
}
/*
* convert the value name to ansi
*/
@ -177,7 +177,7 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
{
return Status;
}
/*
* Create a temporary buffer for the value
*/
@ -187,7 +187,7 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
RtlFreeAnsiString(&AName);
return STATUS_INSUFFICIENT_RESOURCES;
}
/*
* Get the environment variable
*/
@ -198,7 +198,7 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
ExFreePool(Value);
return STATUS_UNSUCCESSFUL;
}
/*
* Convert the result to UNICODE, protect with SEH in case the value buffer
* isn't NULL-terminated!
@ -236,7 +236,7 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
}
_SEH_END;
}
/*
* Cleanup allocated resources.
*/
@ -256,11 +256,11 @@ NtSetSystemEnvironmentValue (IN PUNICODE_STRING VariableName,
ANSI_STRING AName, AValue;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
/*
* Copy the strings to kernel space if necessary
*/
@ -309,7 +309,7 @@ NtSetSystemEnvironmentValue (IN PUNICODE_STRING VariableName,
DPRINT1("NtSetSystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
Status = STATUS_PRIVILEGE_NOT_HELD;
}
RtlReleaseCapturedUnicodeString(&CapturedValue,
PreviousMode,
FALSE);
@ -319,7 +319,7 @@ NtSetSystemEnvironmentValue (IN PUNICODE_STRING VariableName,
PreviousMode,
FALSE);
}
return Status;
}
@ -342,12 +342,12 @@ static NTSTATUS SSI_USE(n) (PVOID Buffer, ULONG Size)
/* Class 0 - Basic Information */
QSI_DEF(SystemBasicInformation)
{
PSYSTEM_BASIC_INFORMATION Sbi
PSYSTEM_BASIC_INFORMATION Sbi
= (PSYSTEM_BASIC_INFORMATION) Buffer;
*ReqSize = sizeof (SYSTEM_BASIC_INFORMATION);
/*
* Check user buffer's size
* Check user buffer's size
*/
if (Size < sizeof (SYSTEM_BASIC_INFORMATION))
{
@ -357,7 +357,7 @@ QSI_DEF(SystemBasicInformation)
Sbi->MaximumIncrement = KeMaximumIncrement;
Sbi->PhysicalPageSize = PAGE_SIZE;
Sbi->NumberOfPhysicalPages = MmStats.NrTotalPages;
Sbi->LowestPhysicalPage = 0; /* FIXME */
Sbi->LowestPhysicalPage = 0; /* FIXME */
Sbi->HighestPhysicalPage = MmStats.NrTotalPages; /* FIXME */
Sbi->AllocationGranularity = MM_VIRTMEM_GRANULARITY; /* hard coded on Intel? */
Sbi->LowestUserAddress = 0x10000; /* Top of 64k */
@ -370,12 +370,12 @@ QSI_DEF(SystemBasicInformation)
/* Class 1 - Processor Information */
QSI_DEF(SystemProcessorInformation)
{
PSYSTEM_PROCESSOR_INFORMATION Spi
PSYSTEM_PROCESSOR_INFORMATION Spi
= (PSYSTEM_PROCESSOR_INFORMATION) Buffer;
PKPRCB Prcb;
*ReqSize = sizeof (SYSTEM_PROCESSOR_INFORMATION);
/*
* Check user buffer's size
* Check user buffer's size
*/
if (Size < sizeof (SYSTEM_PROCESSOR_INFORMATION))
{
@ -397,22 +397,22 @@ QSI_DEF(SystemProcessorInformation)
/* Class 2 - Performance Information */
QSI_DEF(SystemPerformanceInformation)
{
PSYSTEM_PERFORMANCE_INFORMATION Spi
PSYSTEM_PERFORMANCE_INFORMATION Spi
= (PSYSTEM_PERFORMANCE_INFORMATION) Buffer;
PEPROCESS TheIdleProcess;
*ReqSize = sizeof (SYSTEM_PERFORMANCE_INFORMATION);
/*
* Check user buffer's size
* Check user buffer's size
*/
if (Size < sizeof (SYSTEM_PERFORMANCE_INFORMATION))
{
return (STATUS_INFO_LENGTH_MISMATCH);
}
TheIdleProcess = PsIdleProcess;
Spi->IdleTime.QuadPart = TheIdleProcess->Pcb.KernelTime * 100000LL;
Spi->ReadTransferCount.QuadPart = IoReadTransferCount;
@ -463,9 +463,9 @@ QSI_DEF(SystemPerformanceInformation)
Spi->NonPagedPoolFrees = 0; /* FIXME */
Spi->TotalFreeSystemPtes = 0; /* FIXME */
Spi->SystemCodePage = MmStats.NrSystemPages; /* FIXME */
Spi->TotalSystemDriverPages = 0; /* FIXME */
Spi->TotalSystemCodePages = 0; /* FIXME */
Spi->SmallNonPagedLookasideListAllocateHits = 0; /* FIXME */
@ -571,7 +571,7 @@ QSI_DEF(SystemProcessInformation)
{
return (STATUS_INFO_LENGTH_MISMATCH); // in case buffer size is too small
}
syspr = PsGetNextProcess(NULL);
pr = syspr;
pCur = (unsigned char *)Spi;
@ -611,7 +611,7 @@ QSI_DEF(SystemProcessInformation)
SpiCur->NextEntryOffset = curSize+inLen; // relative offset to the beginnnig of the next structure
SpiCur->NumberOfThreads = nThreads;
SpiCur->CreateTime = pr->CreateTime;
SpiCur->UserTime.QuadPart = pr->Pcb.UserTime * 100000LL;
SpiCur->UserTime.QuadPart = pr->Pcb.UserTime * 100000LL;
SpiCur->KernelTime.QuadPart = pr->Pcb.KernelTime * 100000LL;
SpiCur->ImageName.Length = strlen(pr->ImageFileName) * sizeof(WCHAR);
SpiCur->ImageName.MaximumLength = inLen;
@ -665,7 +665,7 @@ QSI_DEF(SystemProcessInformation)
i++;
current_entry = current_entry->Flink;
}
pr = PsGetNextProcess(pr);
nThreads = 0;
if ((pr == syspr) || (pr == NULL))
@ -676,7 +676,7 @@ QSI_DEF(SystemProcessInformation)
else
pCur = pCur + curSize + inLen;
} while ((pr != syspr) && (pr != NULL));
if(pr != NULL)
{
ObDereferenceObject(pr);
@ -697,13 +697,13 @@ QSI_DEF(SystemCallCountInformation)
/* Class 7 - Device Information */
QSI_DEF(SystemDeviceInformation)
{
PSYSTEM_DEVICE_INFORMATION Sdi
PSYSTEM_DEVICE_INFORMATION Sdi
= (PSYSTEM_DEVICE_INFORMATION) Buffer;
PCONFIGURATION_INFORMATION ConfigInfo;
*ReqSize = sizeof (SYSTEM_DEVICE_INFORMATION);
/*
* Check user buffer's size
* Check user buffer's size
*/
if (Size < sizeof (SYSTEM_DEVICE_INFORMATION))
{
@ -734,7 +734,7 @@ QSI_DEF(SystemProcessorPerformanceInformation)
*ReqSize = KeNumberProcessors * sizeof (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
/*
* Check user buffer's size
* Check user buffer's size
*/
if (Size < KeNumberProcessors * sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION))
{
@ -754,7 +754,7 @@ QSI_DEF(SystemProcessorPerformanceInformation)
Spi++;
Prcb = (PKPRCB)((ULONG_PTR)Prcb + PAGE_SIZE);
}
return (STATUS_SUCCESS);
}
@ -835,7 +835,7 @@ ObpGetNextHandleByProcessCount(PSYSTEM_HANDLE_TABLE_ENTRY_INFO pshi,
/* Class 16 - Handle Information */
QSI_DEF(SystemHandleInformation)
{
PSYSTEM_HANDLE_INFORMATION Shi =
PSYSTEM_HANDLE_INFORMATION Shi =
(PSYSTEM_HANDLE_INFORMATION) Buffer;
DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
@ -851,7 +851,7 @@ QSI_DEF(SystemHandleInformation)
PEPROCESS pr, syspr;
int curSize, i = 0;
ULONG hCount = 0;
/* First Calc Size from Count. */
syspr = PsGetNextProcess(NULL);
pr = syspr;
@ -864,7 +864,7 @@ QSI_DEF(SystemHandleInformation)
if ((pr == syspr) || (pr == NULL))
break;
} while ((pr != syspr) && (pr != NULL));
if(pr != NULL)
{
ObDereferenceObject(pr);
@ -873,7 +873,7 @@ QSI_DEF(SystemHandleInformation)
DPRINT("SystemHandleInformation 2\n");
curSize = sizeof(SYSTEM_HANDLE_INFORMATION)+
( (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) * hCount) -
( (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) * hCount) -
(sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) ));
Shi->NumberOfHandles = hCount;
@ -921,7 +921,7 @@ QSI_DEF(SystemHandleInformation)
/*
SSI_DEF(SystemHandleInformation)
{
return (STATUS_SUCCESS);
}
*/
@ -985,9 +985,9 @@ QSI_DEF(SystemFileCacheInformation)
return (STATUS_INFO_LENGTH_MISMATCH);
}
/* Return the Byte size not the page size. */
Sci->CurrentSize =
Sci->CurrentSize =
MiMemoryConsumers[MC_CACHE].PagesUsed * PAGE_SIZE;
Sci->PeakSize =
Sci->PeakSize =
MiMemoryConsumers[MC_CACHE].PagesUsed * PAGE_SIZE; /* FIXME */
Sci->PageFaultCount = 0; /* FIXME */
@ -1025,14 +1025,14 @@ QSI_DEF(SystemInterruptInformation)
UINT i;
ULONG ti;
PSYSTEM_INTERRUPT_INFORMATION sii = (PSYSTEM_INTERRUPT_INFORMATION)Buffer;
if(Size < KeNumberProcessors * sizeof(SYSTEM_INTERRUPT_INFORMATION))
{
return (STATUS_INFO_LENGTH_MISMATCH);
}
ti = KeQueryTimeIncrement();
Prcb = ((PKPCR)KPCR_BASE)->Prcb;
for (i = 0; i < KeNumberProcessors; i++)
{
@ -1045,7 +1045,7 @@ QSI_DEF(SystemInterruptInformation)
sii++;
Prcb = (PKPRCB)((ULONG_PTR)Prcb + PAGE_SIZE);
}
return STATUS_SUCCESS;
}
@ -1090,7 +1090,7 @@ QSI_DEF(SystemFullMemoryInformation)
#ifndef NDEBUG
MmPrintMemoryStatistic();
#endif
*Spi = MiMemoryConsumers[MC_USER].PagesUsed;
return (STATUS_SUCCESS);
@ -1506,7 +1506,7 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
PVOID SystemInformation;
NTSTATUS Status;
NTSTATUS FStatus;
PAGED_CODE();
/* DPRINT("NtQuerySystemInformation Start. Class:%d\n",
@ -1524,14 +1524,14 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
return(STATUS_NO_MEMORY);
}
}*/
/* Clear user buffer. */
RtlZeroMemory(SystemInformation, Length);
/*
* Check the request is valid.
*/
if ((SystemInformationClass >= SystemInformationClassMin) &&
if ((SystemInformationClass >= SystemInformationClassMin) &&
(SystemInformationClass < SystemInformationClassMax))
{
if (NULL != CallQS [SystemInformationClass].Query)
@ -1544,7 +1544,7 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
&ResultLength);
/*if (ExGetPreviousMode() != KernelMode)
{
Status = MmCopyToCaller(UnsafeSystemInformation,
Status = MmCopyToCaller(UnsafeSystemInformation,
SystemInformation,
Length);
ExFreePool(SystemInformation);
@ -1586,9 +1586,9 @@ NtSetSystemInformation (
)
{
PAGED_CODE();
/*
* If called from user mode, check
* If called from user mode, check
* possible unsafe arguments.
*/
#if 0
@ -1636,7 +1636,7 @@ NtFlushInstructionCache (
)
{
PAGED_CODE();
__asm__("wbinvd\n");
return STATUS_SUCCESS;
}

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/time.c
* PURPOSE: Time
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/
@ -150,11 +150,11 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
TIME_FIELDS TimeFields;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
if(PreviousMode != KernelMode)
{
_SEH_TRY
@ -175,7 +175,7 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if(!NT_SUCCESS(Status))
{
return Status;
@ -185,14 +185,14 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
{
NewSystemTime = *SystemTime;
}
if(!SeSinglePrivilegeCheck(SeSystemtimePrivilege,
PreviousMode))
{
DPRINT1("NtSetSystemTime: Caller requires the SeSystemtimePrivilege privilege!\n");
return STATUS_PRIVILEGE_NOT_HELD;
}
if(PreviousTime != NULL)
{
KeQuerySystemTime(&OldSystemTime);
@ -235,7 +235,7 @@ NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
{
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@ -263,7 +263,7 @@ NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
{
KeQuerySystemTime(SystemTime);
}
return Status;
}

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/timer.c
* PURPOSE: User-mode timers
*
*
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net) - Reimplemented
* David Welch (welch@mcmail.com)
*/
@ -47,7 +47,7 @@ static GENERIC_MAPPING ExpTimerMapping = {
/* Timer Information Classes */
static const INFORMATION_CLASS_INFO ExTimerInfoClass[] = {
/* TimerBasicInformation */
ICI_SQ_SAME( sizeof(TIMER_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ),
};
@ -62,47 +62,47 @@ ExTimerRundown(VOID)
KIRQL OldIrql;
PLIST_ENTRY CurrentEntry;
PETIMER Timer;
/* Lock the Thread's Active Timer List*/
KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql);
while (!IsListEmpty(&Thread->ActiveTimerListHead))
while (!IsListEmpty(&Thread->ActiveTimerListHead))
{
/* Remove a Timer */
CurrentEntry = RemoveTailList(&Thread->ActiveTimerListHead);
/* Get the Timer */
Timer = CONTAINING_RECORD(CurrentEntry, ETIMER, ActiveTimerListEntry);
ASSERT (Timer->ApcAssociated);
Timer->ApcAssociated = FALSE;
Timer->ApcAssociated = FALSE;
DPRINT("Timer, ThreadList: %x, %x\n", Timer, Thread);
/* Unlock the list */
KeReleaseSpinLockFromDpcLevel(&Thread->ActiveTimerListLock);
/* Lock the Timer */
KeAcquireSpinLockAtDpcLevel(&Timer->Lock);
ASSERT (&Thread->Tcb == Timer->TimerApc.Thread);
KeCancelTimer(&Timer->KeTimer);
KeRemoveQueueDpc(&Timer->TimerDpc);
KeRemoveQueueApc(&Timer->TimerApc);
KeRemoveQueueApc(&Timer->TimerApc);
/* Unlock the Timer */
KeReleaseSpinLock(&Timer->Lock, OldIrql);
/* Dereference it, if needed */
ObDereferenceObject(Timer);
/* Loop again */
KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql);
}
}
KeReleaseSpinLock(&Thread->ActiveTimerListLock, OldIrql);
}
@ -117,16 +117,16 @@ ExpDeleteTimer(PVOID ObjectBody)
/* Lock the Wake List */
KeAcquireSpinLock(&ExpWakeListLock, &OldIrql);
/* Check if it has a Wait List */
if (Timer->WakeTimer) {
/* Remove it from the Wait List */
DPRINT("Removing wake list\n");
RemoveEntryList(&Timer->WakeTimerListEntry);
Timer->WakeTimer = FALSE;
}
/* Release the Wake List */
KeReleaseSpinLock(&ExpWakeListLock, OldIrql);
@ -135,7 +135,7 @@ ExpDeleteTimer(PVOID ObjectBody)
KeCancelTimer(&Timer->KeTimer);
}
VOID
VOID
STDCALL
ExpTimerDpcRoutine(PKDPC Dpc,
PVOID DeferredContext,
@ -152,17 +152,17 @@ ExpTimerDpcRoutine(PKDPC Dpc,
/* Lock the Timer */
KeAcquireSpinLock(&Timer->Lock, &OldIrql);
/* Queue the APC */
if(Timer->ApcAssociated) {
DPRINT("Queuing APC\n");
KeInsertQueueApc(&Timer->TimerApc,
SystemArgument1,
SystemArgument2,
IO_NO_INCREMENT);
}
/* Release the Timer */
KeReleaseSpinLock(&Timer->Lock, OldIrql);
}
@ -183,37 +183,37 @@ ExpTimerApcKernelRoutine(PKAPC Apc,
/* We need to find out which Timer we are */
Timer = CONTAINING_RECORD(Apc, ETIMER, TimerApc);
DPRINT("ExpTimerApcKernelRoutine(Apc: %x. Timer: %x)\n", Apc, Timer);
/* Lock the Timer */
KeAcquireSpinLock(&Timer->Lock, &OldIrql);
/* Lock the Thread's Active Timer List*/
KeAcquireSpinLockAtDpcLevel(&CurrentThread->ActiveTimerListLock);
/*
* Make sure that the Timer is still valid, and that it belongs to this thread
/*
* Make sure that the Timer is still valid, and that it belongs to this thread
* Remove it if it's not periodic
*/
if ((Timer->ApcAssociated) &&
(&CurrentThread->Tcb == Timer->TimerApc.Thread) &&
if ((Timer->ApcAssociated) &&
(&CurrentThread->Tcb == Timer->TimerApc.Thread) &&
(!Timer->KeTimer.Period)) {
/* Remove it from the Active Timers List */
DPRINT("Removing Timer\n");
RemoveEntryList(&Timer->ActiveTimerListEntry);
/* Disable it */
Timer->ApcAssociated = FALSE;
/* Release spinlocks */
KeReleaseSpinLockFromDpcLevel(&CurrentThread->ActiveTimerListLock);
KeReleaseSpinLock(&Timer->Lock, OldIrql);
/* Dereference the Timer Object */
ObDereferenceObject(Timer);
return;
}
/* Release spinlocks */
KeReleaseSpinLockFromDpcLevel(&CurrentThread->ActiveTimerListLock);
KeReleaseSpinLock(&Timer->Lock, OldIrql);
@ -224,7 +224,7 @@ INIT_FUNCTION
ExpInitializeTimerImplementation(VOID)
{
DPRINT("ExpInitializeTimerImplementation()\n");
/* Allocate Memory for the Timer */
ExTimerType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
@ -249,14 +249,14 @@ ExpInitializeTimerImplementation(VOID)
ExTimerType->Create = NULL;
ExTimerType->DuplicationNotify = NULL;
ObpCreateTypeObject(ExTimerType);
/* Initialize the Wait List and Lock */
KeInitializeSpinLock(&ExpWakeListLock);
InitializeListHead(&ExpWakeList);
}
NTSTATUS
NTSTATUS
STDCALL
NtCancelTimer(IN HANDLE TimerHandle,
OUT PBOOLEAN CurrentState OPTIONAL)
@ -268,10 +268,10 @@ NtCancelTimer(IN HANDLE TimerHandle,
PETHREAD TimerThread;
BOOLEAN KillTimer = FALSE;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtCancelTimer(0x%x, 0x%x)\n", TimerHandle, CurrentState);
/* Check Parameter Validity */
if(CurrentState != NULL && PreviousMode != KernelMode) {
_SEH_TRY {
@ -281,7 +281,7 @@ NtCancelTimer(IN HANDLE TimerHandle,
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) {
return Status;
}
@ -294,72 +294,72 @@ NtCancelTimer(IN HANDLE TimerHandle,
PreviousMode,
(PVOID*)&Timer,
NULL);
/* Check for success */
if(NT_SUCCESS(Status)) {
DPRINT("Timer Referencced: %x\n", Timer);
/* Lock the Timer */
KeAcquireSpinLock(&Timer->Lock, &OldIrql);
/* Check if it's enabled */
if (Timer->ApcAssociated) {
/*
* First, remove it from the Thread's Active List
/*
* First, remove it from the Thread's Active List
* Get the Thread.
*/
TimerThread = CONTAINING_RECORD(Timer->TimerApc.Thread, ETHREAD, Tcb);
DPRINT("Removing from Thread: %x\n", TimerThread);
/* Lock its active list */
KeAcquireSpinLockAtDpcLevel(&TimerThread->ActiveTimerListLock);
/* Remove it */
RemoveEntryList(&TimerThread->ActiveTimerListHead);
/* Unlock the list */
KeReleaseSpinLockFromDpcLevel(&TimerThread->ActiveTimerListLock);
/* Cancel the Timer */
KeCancelTimer(&Timer->KeTimer);
KeRemoveQueueDpc(&Timer->TimerDpc);
KeRemoveQueueApc(&Timer->TimerApc);
Timer->ApcAssociated = FALSE;
KillTimer = TRUE;
} else {
/* If timer was disabled, we still need to cancel it */
DPRINT("APC was not Associated. Cancelling Timer\n");
KeCancelTimer(&Timer->KeTimer);
}
/* Read the old State */
State = KeReadStateTimer(&Timer->KeTimer);
/* Dereference the Object */
ObDereferenceObject(Timer);
/* Unlock the Timer */
KeReleaseSpinLock(&Timer->Lock, OldIrql);
/* Dereference if it was previously enabled */
if (KillTimer) ObDereferenceObject(Timer);
DPRINT1("Timer disabled\n");
/* Make sure it's safe to write to the handle */
if(CurrentState != NULL) {
_SEH_TRY {
*CurrentState = State;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}
@ -369,7 +369,7 @@ NtCancelTimer(IN HANDLE TimerHandle,
}
NTSTATUS
NTSTATUS
STDCALL
NtCreateTimer(OUT PHANDLE TimerHandle,
IN ACCESS_MASK DesiredAccess,
@ -380,28 +380,28 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
HANDLE hTimer;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtCreateTimer(Handle: %x, Type: %d)\n", TimerHandle, TimerType);
/* Check Parameter Validity */
if (PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(TimerHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
/* Create the Object */
/* Create the Object */
Status = ObCreateObject(PreviousMode,
ExTimerType,
ObjectAttributes,
@ -411,24 +411,24 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
0,
0,
(PVOID*)&Timer);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Initialize the Kernel Timer */
DPRINT("Initializing Timer: %x\n", Timer);
KeInitializeTimerEx(&Timer->KeTimer, TimerType);
/* Initialize the Timer Lock */
KeInitializeSpinLock(&Timer->Lock);
/* Initialize the DPC */
KeInitializeDpc(&Timer->TimerDpc, ExpTimerDpcRoutine, Timer);
/* Set Initial State */
Timer->ApcAssociated = FALSE;
Timer->WakeTimer = FALSE;
/* Insert the Timer */
Status = ObInsertObject((PVOID)Timer,
NULL,
@ -438,16 +438,16 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
&hTimer);
DPRINT("Timer Inserted\n");
/* Make sure it's safe to write to the handle */
_SEH_TRY {
*TimerHandle = hTimer;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
@ -456,7 +456,7 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
}
NTSTATUS
NTSTATUS
STDCALL
NtOpenTimer(OUT PHANDLE TimerHandle,
IN ACCESS_MASK DesiredAccess,
@ -465,25 +465,25 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
HANDLE hTimer;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtOpenTimer(TimerHandle: %x)\n", TimerHandle);
/* Check Parameter Validity */
if (PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForWrite(TimerHandle,
sizeof(HANDLE),
sizeof(ULONG));
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
}
@ -495,19 +495,19 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
DesiredAccess,
NULL,
&hTimer);
/* Check for success */
if(NT_SUCCESS(Status)) {
/* Make sure it's safe to write to the handle */
_SEH_TRY {
*TimerHandle = hTimer;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
@ -516,7 +516,7 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
}
NTSTATUS
NTSTATUS
STDCALL
NtQueryTimer(IN HANDLE TimerHandle,
IN TIMER_INFORMATION_CLASS TimerInformationClass,
@ -528,7 +528,7 @@ NtQueryTimer(IN HANDLE TimerHandle,
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PTIMER_BASIC_INFORMATION BasicInfo = (PTIMER_BASIC_INFORMATION)TimerInformation;
PAGED_CODE();
DPRINT("NtQueryTimer(TimerHandle: %x, Class: %d)\n", TimerHandle, TimerInformationClass);
@ -541,7 +541,7 @@ NtQueryTimer(IN HANDLE TimerHandle,
PreviousMode,
&Status);
if(!NT_SUCCESS(Status)) {
DPRINT1("NtQueryTimer() failed, Status: 0x%x\n", Status);
return Status;
}
@ -550,16 +550,16 @@ NtQueryTimer(IN HANDLE TimerHandle,
Status = ObReferenceObjectByHandle(TimerHandle,
TIMER_QUERY_STATE,
ExTimerType,
PreviousMode,
PreviousMode,
(PVOID*)&Timer,
NULL);
/* Check for Success */
if(NT_SUCCESS(Status)) {
/* Return the Basic Information */
_SEH_TRY {
/* FIXME: Interrupt correction based on Interrupt Time */
DPRINT("Returning Information for Timer: %x. Time Remaining: %d\n", Timer, Timer->KeTimer.DueTime.QuadPart);
BasicInfo->TimeRemaining.QuadPart = Timer->KeTimer.DueTime.QuadPart;
@ -568,20 +568,20 @@ NtQueryTimer(IN HANDLE TimerHandle,
if(ReturnLength != NULL) *ReturnLength = sizeof(TIMER_BASIC_INFORMATION);
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
/* Dereference Object */
ObDereferenceObject(Timer);
}
/* Return Status */
return Status;
}
NTSTATUS
NTSTATUS
STDCALL
NtSetTimer(IN HANDLE TimerHandle,
IN PLARGE_INTEGER DueTime,
@ -600,84 +600,84 @@ NtSetTimer(IN HANDLE TimerHandle,
PETHREAD TimerThread;
BOOLEAN KillTimer = FALSE;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtSetTimer(TimerHandle: %x, DueTime: %d, Apc: %x, Period: %d)\n", TimerHandle, DueTime->QuadPart, TimerApcRoutine, Period);
/* Check Parameter Validity */
if (PreviousMode != KernelMode) {
_SEH_TRY {
ProbeForRead(DueTime,
sizeof(LARGE_INTEGER),
sizeof(ULONG));
TimerDueTime = *DueTime;
if(PreviousState != NULL) {
ProbeForWrite(PreviousState,
sizeof(BOOLEAN),
sizeof(BOOLEAN));
}
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
if(!NT_SUCCESS(Status)) return Status;
if(!NT_SUCCESS(Status)) return Status;
}
/* Get the Timer Object */
/* Get the Timer Object */
Status = ObReferenceObjectByHandle(TimerHandle,
TIMER_ALL_ACCESS,
ExTimerType,
PreviousMode,
(PVOID*)&Timer,
NULL);
/* Check status */
if (NT_SUCCESS(Status)) {
/* Lock the Timer */
DPRINT("Timer Referencced: %x\n", Timer);
KeAcquireSpinLock(&Timer->Lock, &OldIrql);
/* Cancel Running Timer */
if (Timer->ApcAssociated) {
/*
* First, remove it from the Thread's Active List
/*
* First, remove it from the Thread's Active List
* Get the Thread.
*/
TimerThread = CONTAINING_RECORD(Timer->TimerApc.Thread, ETHREAD, Tcb);
DPRINT("Thread already running. Removing from Thread: %x\n", TimerThread);
/* Lock its active list */
KeAcquireSpinLockAtDpcLevel(&TimerThread->ActiveTimerListLock);
/* Remove it */
RemoveEntryList(&TimerThread->ActiveTimerListHead);
/* Unlock the list */
KeReleaseSpinLockFromDpcLevel(&TimerThread->ActiveTimerListLock);
/* Cancel the Timer */
KeCancelTimer(&Timer->KeTimer);
KeRemoveQueueDpc(&Timer->TimerDpc);
KeRemoveQueueApc(&Timer->TimerApc);
Timer->ApcAssociated = FALSE;
KillTimer = TRUE;
} else {
/* If timer was disabled, we still need to cancel it */
DPRINT("No APCs. Simply cancelling\n");
KeCancelTimer(&Timer->KeTimer);
}
/* Read the State */
State = KeReadStateTimer(&Timer->KeTimer);
@ -685,21 +685,21 @@ NtSetTimer(IN HANDLE TimerHandle,
DPRINT("Doing Wake Semantics\n");
KeAcquireSpinLockAtDpcLevel(&ExpWakeListLock);
if (WakeTimer && !Timer->WakeTimer) {
/* Insert it into the list */
Timer->WakeTimer = TRUE;
InsertTailList(&ExpWakeList, &Timer->WakeTimerListEntry);
} else if (!WakeTimer && Timer->WakeTimer) {
/* Remove it from the list */
RemoveEntryList(&Timer->WakeTimerListEntry);
Timer->WakeTimer = FALSE;
}
KeReleaseSpinLockFromDpcLevel(&ExpWakeListLock);
/* Set up the APC Routine if specified */
if (TimerApcRoutine) {
/* Initialize the APC */
DPRINT("Initializing APC: %x\n", Timer->TimerApc);
KeInitializeApc(&Timer->TimerApc,
@ -710,13 +710,13 @@ NtSetTimer(IN HANDLE TimerHandle,
(PKNORMAL_ROUTINE)TimerApcRoutine,
PreviousMode,
TimerContext);
/* Lock the Thread's Active List and Insert */
KeAcquireSpinLockAtDpcLevel(&CurrentThread->ActiveTimerListLock);
InsertTailList(&CurrentThread->ActiveTimerListHead,
&Timer->ActiveTimerListEntry);
KeReleaseSpinLockFromDpcLevel(&CurrentThread->ActiveTimerListLock);
}
/* Enable and Set the Timer */
@ -726,13 +726,13 @@ NtSetTimer(IN HANDLE TimerHandle,
Period,
TimerApcRoutine ? &Timer->TimerDpc : 0);
Timer->ApcAssociated = TimerApcRoutine ? TRUE : FALSE;
/* Unlock the Timer */
KeReleaseSpinLock(&Timer->Lock, OldIrql);
/* Dereference the Object */
ObDereferenceObject(Timer);
/* Dereference if it was previously enabled */
if (!TimerApcRoutine) ObDereferenceObject(Timer);
if (KillTimer) ObDereferenceObject(Timer);
@ -740,15 +740,15 @@ NtSetTimer(IN HANDLE TimerHandle,
/* Make sure it's safe to write to the handle */
if(PreviousState != NULL) {
_SEH_TRY {
*PreviousState = State;
} _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
}

View file

@ -1,5 +1,5 @@
/* $Id:$
*
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/misc.c

View file

@ -223,7 +223,7 @@ NtAllocateUuids(OUT PULARGE_INTEGER Time,
ULARGE_INTEGER IntTime;
ULONG IntRange;
NTSTATUS Status;
PAGED_CODE();
ExAcquireFastMutex(&UuidMutex);
@ -281,7 +281,7 @@ NTSTATUS STDCALL
NtSetUuidSeed(IN PUCHAR Seed)
{
PAGED_CODE();
RtlCopyMemory(UuidSeed,
Seed,
SEED_BUFFER_SIZE);

View file

@ -1,10 +1,10 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/win32k.c
* PURPOSE: Executive Win32 subsystem support
*
*
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net) - Moved callbacks to win32k and cleanup.
* Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
@ -19,7 +19,7 @@ POBJECT_TYPE EXPORTED ExWindowStationObjectType = NULL;
POBJECT_TYPE EXPORTED ExDesktopObjectType = NULL;
static GENERIC_MAPPING ExpWindowStationMapping = {
STANDARD_RIGHTS_READ | WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | WINSTA_READSCREEN,
STANDARD_RIGHTS_WRITE | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES,
STANDARD_RIGHTS_EXECUTE | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS,
@ -29,7 +29,7 @@ static GENERIC_MAPPING ExpWindowStationMapping = {
};
static GENERIC_MAPPING ExpDesktopMapping = {
STANDARD_RIGHTS_READ | DESKTOP_ENUMERATE | DESKTOP_READOBJECTS,
STANDARD_RIGHTS_WRITE | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_HOOKCONTROL |
DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD | DESKTOP_WRITEOBJECTS,
@ -48,7 +48,7 @@ OBJECT_DELETE_ROUTINE ExpDesktopObjectDelete = NULL;
/* FUNCTIONS ****************************************************************/
NTSTATUS
NTSTATUS
STDCALL
ExpWinStaObjectCreate(PVOID ObjectBody,
PVOID Parent,
@ -56,13 +56,13 @@ ExpWinStaObjectCreate(PVOID ObjectBody,
struct _OBJECT_ATTRIBUTES* ObjectAttributes)
{
/* Call the Registered Callback */
return ExpWindowStationObjectCreate(ObjectBody,
Parent,
RemainingPath,
return ExpWindowStationObjectCreate(ObjectBody,
Parent,
RemainingPath,
ObjectAttributes);
}
VOID
VOID
STDCALL
ExpWinStaObjectDelete(PVOID DeletedObject)
{
@ -77,12 +77,12 @@ ExpWinStaObjectFind(PWINSTATION_OBJECT WinStaObject,
ULONG Attributes)
{
/* Call the Registered Callback */
return ExpWindowStationObjectFind(WinStaObject,
Name,
return ExpWindowStationObjectFind(WinStaObject,
Name,
Attributes);
}
NTSTATUS
NTSTATUS
STDCALL
ExpWinStaObjectParse(PVOID Object,
PVOID *NextObject,
@ -91,14 +91,14 @@ ExpWinStaObjectParse(PVOID Object,
ULONG Attributes)
{
/* Call the Registered Callback */
return ExpWindowStationObjectParse(Object,
NextObject,
FullPath,
return ExpWindowStationObjectParse(Object,
NextObject,
FullPath,
Path,
Attributes);
}
NTSTATUS
NTSTATUS
STDCALL
ExpDesktopCreate(PVOID ObjectBody,
PVOID Parent,
@ -106,13 +106,13 @@ ExpDesktopCreate(PVOID ObjectBody,
struct _OBJECT_ATTRIBUTES* ObjectAttributes)
{
/* Call the Registered Callback */
return ExpDesktopObjectCreate(ObjectBody,
Parent,
RemainingPath,
return ExpDesktopObjectCreate(ObjectBody,
Parent,
RemainingPath,
ObjectAttributes);
}
VOID
VOID
STDCALL
ExpDesktopDelete(PVOID DeletedObject)
{
@ -120,7 +120,7 @@ ExpDesktopDelete(PVOID DeletedObject)
ExpDesktopObjectDelete(DeletedObject);
}
VOID
VOID
INIT_FUNCTION
ExpWin32kInit(VOID)
{

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/work.c
* PURPOSE: Manage system work queues
*
*
* PROGRAMMERS: Alex Ionescu - Used correct work queue array and added some fixes and checks.
* Gunnar Dalsnes - Implemented
*/
@ -38,7 +38,7 @@ EX_WORK_QUEUE ExWorkerQueue[MaximumWorkQueue];
* calls PsTerminateSystemThread
*/
static
VOID
VOID
STDCALL
ExpWorkerThreadEntryPoint(IN PVOID Context)
{
@ -46,53 +46,53 @@ ExpWorkerThreadEntryPoint(IN PVOID Context)
PLIST_ENTRY QueueEntry;
WORK_QUEUE_TYPE WorkQueueType;
PEX_WORK_QUEUE WorkQueue;
/* Get Queue Type and Worker Queue */
WorkQueueType = (WORK_QUEUE_TYPE)Context;
WorkQueue = &ExWorkerQueue[WorkQueueType];
/* Loop forever */
while (TRUE) {
/* Wait for Something to Happen on the Queue */
QueueEntry = KeRemoveQueue(&WorkQueue->WorkerQueue, KernelMode, NULL);
/* Can't happen since we do a KernelMode wait (and we're a system thread) */
ASSERT((NTSTATUS)QueueEntry != STATUS_USER_APC);
/* this should never happen either, since we wait with NULL timeout,
* but there's a slight possibility that STATUS_TIMEOUT is returned
* at queue rundown in NT (unlikely) -Gunnar
*/
ASSERT((NTSTATUS)QueueEntry != STATUS_TIMEOUT);
/* Increment Processed Work Items */
InterlockedIncrement((PLONG)&WorkQueue->WorkItemsProcessed);
/* Get the Work Item */
WorkItem = CONTAINING_RECORD(QueueEntry, WORK_QUEUE_ITEM, List);
/* Call the Worker Routine */
WorkItem->WorkerRoutine(WorkItem->Parameter);
/* Make sure it returned at right IRQL */
if (KeGetCurrentIrql() != PASSIVE_LEVEL) {
/* FIXME: Make this an Ex */
KEBUGCHECK(WORKER_THREAD_RETURNED_AT_BAD_IRQL);
}
/* Make sure it returned with Impersionation Disabled */
if (PsGetCurrentThread()->ActiveImpersonationInfo) {
/* FIXME: Make this an Ex */
KEBUGCHECK(IMPERSONATING_WORKER_THREAD);
}
}
}
static
VOID
static
VOID
STDCALL
ExpInitializeWorkQueue(WORK_QUEUE_TYPE WorkQueueType,
KPRIORITY Priority)
@ -100,10 +100,10 @@ ExpInitializeWorkQueue(WORK_QUEUE_TYPE WorkQueueType,
ULONG i;
PETHREAD Thread;
HANDLE hThread;
/* Loop through how many threads we need to create */
for (i = 0; i < NUMBER_OF_WORKER_THREADS; i++) {
/* Create the System Thread */
PsCreateSystemThread(&hThread,
THREAD_ALL_ACCESS,
@ -112,7 +112,7 @@ ExpInitializeWorkQueue(WORK_QUEUE_TYPE WorkQueueType,
NULL,
ExpWorkerThreadEntryPoint,
(PVOID)WorkQueueType);
/* Get the Thread */
ObReferenceObjectByHandle(hThread,
THREAD_SET_INFORMATION,
@ -120,29 +120,29 @@ ExpInitializeWorkQueue(WORK_QUEUE_TYPE WorkQueueType,
KernelMode,
(PVOID*)&Thread,
NULL);
/* Set the Priority */
KeSetPriorityThread(&Thread->Tcb, Priority);
/* Dereference and close handle */
ObDereferenceObject(Thread);
ZwClose(hThread);
}
}
VOID
VOID
INIT_FUNCTION
ExpInitializeWorkerThreads(VOID)
{
ULONG WorkQueueType;
/* Initialize the Array */
for (WorkQueueType = 0; WorkQueueType < MaximumWorkQueue; WorkQueueType++) {
RtlZeroMemory(&ExWorkerQueue[WorkQueueType], sizeof(EX_WORK_QUEUE));
KeInitializeQueue(&ExWorkerQueue[WorkQueueType].WorkerQueue, 0);
}
/* Create the built-in worker threads for each work queue */
ExpInitializeWorkQueue(CriticalWorkQueue, LOW_REALTIME_PRIORITY);
ExpInitializeWorkQueue(DelayedWorkQueue, LOW_PRIORITY);
@ -158,7 +158,7 @@ ExpInitializeWorkerThreads(VOID)
* WorkItem = Item to insert
* QueueType = Queue to insert it in
*/
VOID
VOID
STDCALL
ExQueueWorkItem(PWORK_QUEUE_ITEM WorkItem,
WORK_QUEUE_TYPE QueueType)
@ -166,7 +166,7 @@ ExQueueWorkItem(PWORK_QUEUE_ITEM WorkItem,
ASSERT(WorkItem!=NULL);
ASSERT_IRQL(DISPATCH_LEVEL);
ASSERT(WorkItem->List.Flink == NULL);
/* Insert the Queue */
KeInsertQueue(&ExWorkerQueue[QueueType].WorkerQueue, &WorkItem->List);
}

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/zone.c
* PURPOSE: Implements zone buffers
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/
@ -37,18 +37,18 @@ ExExtendZone (
PZONE_SEGMENT_HEADER entry;
PZONE_SEGMENT_HEADER seg;
unsigned int i;
seg = (PZONE_SEGMENT_HEADER)Segment;
seg->Reserved = (PVOID) SegmentSize;
PushEntryList(&Zone->SegmentList,&seg->SegmentList);
entry = (PZONE_SEGMENT_HEADER)( ((char*)seg) + sizeof(ZONE_SEGMENT_HEADER) );
for (i=0;i<(SegmentSize / Zone->BlockSize);i++)
{
PushEntryList(&Zone->FreeList,&entry->SegmentList);
entry = (PZONE_SEGMENT_HEADER)(((char*)entry) + sizeof(PZONE_SEGMENT_HEADER) +
entry = (PZONE_SEGMENT_HEADER)(((char*)entry) + sizeof(PZONE_SEGMENT_HEADER) +
Zone->BlockSize);
}
return(STATUS_SUCCESS);
@ -69,7 +69,7 @@ ExInterlockedExtendZone (
{
NTSTATUS ret;
KIRQL oldlvl;
KeAcquireSpinLock(Lock,&oldlvl);
ret = ExExtendZone(Zone,Segment,SegmentSize);
KeReleaseSpinLock(Lock,oldlvl);
@ -93,7 +93,7 @@ ExInitializeZone (
* ARGUMENTS:
* Zone = zone header to be initialized
* BlockSize = Size (in bytes) of the allocation size of the zone
* InitialSegment = Initial segment of storage allocated by the
* InitialSegment = Initial segment of storage allocated by the
* caller
* InitialSegmentSize = Initial size of the segment
*/
@ -101,19 +101,19 @@ ExInitializeZone (
unsigned int i;
PZONE_SEGMENT_HEADER seg;
PZONE_SEGMENT_HEADER entry;
Zone->FreeList.Next=NULL;
Zone->SegmentList.Next=NULL;
Zone->BlockSize=BlockSize;
Zone->TotalSegmentSize = InitialSegmentSize;
seg = (PZONE_SEGMENT_HEADER)InitialSegment;
seg->Reserved = (PVOID*) InitialSegmentSize;
PushEntryList(&Zone->SegmentList,&seg->SegmentList);
entry = (PZONE_SEGMENT_HEADER)( ((char*)seg) + sizeof(ZONE_SEGMENT_HEADER) );
for (i=0;i<(InitialSegmentSize / BlockSize);i++)
{
PushEntryList(&Zone->FreeList,&entry->SegmentList);

View file

@ -72,7 +72,7 @@ FsRtlIncrementCcFastReadNoWait( VOID )
*
* NOTE
* From Bo Branten's ntifs.h v12.
*
*
* @unimplemented
*/
BOOLEAN
@ -99,7 +99,7 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject,
* ARGUMENTS
*
* RETURN VALUE
*
*
* NOTE
* From Bo Branten's ntifs.h v12.
*
@ -129,7 +129,7 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject,
* ARGUMENTS
*
* RETURN VALUE
*
*
* @implemented
*/
NTSTATUS
@ -143,16 +143,16 @@ FsRtlGetFileSize(IN PFILE_OBJECT FileObject,
ULONG Length;
PDEVICE_OBJECT DeviceObject;
PFAST_IO_DISPATCH FastDispatch;
/* Get Device Object and Fast Calls */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
/* Check if we support Fast Calls, and check this one */
if (FastDispatch && FastDispatch->FastIoQueryStandardInfo)
if (FastDispatch && FastDispatch->FastIoQueryStandardInfo)
{
/* Fast Path */
FastDispatch->FastIoQueryStandardInfo(FileObject,
FastDispatch->FastIoQueryStandardInfo(FileObject,
TRUE,
&Info,
&IoStatusBlock,
@ -168,7 +168,7 @@ FsRtlGetFileSize(IN PFILE_OBJECT FileObject,
&Info,
&Length);
}
/* Check success */
if (NT_SUCCESS(Status))
{
@ -202,11 +202,11 @@ FsRtlMdlRead(IN PFILE_OBJECT FileObject,
{
PDEVICE_OBJECT DeviceObject, BaseDeviceObject;
PFAST_IO_DISPATCH FastDispatch;
/* Get Device Object and Fast Calls */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
/* Check if we support Fast Calls, and check this one */
if (FastDispatch && FastDispatch->MdlRead)
{
@ -219,18 +219,18 @@ FsRtlMdlRead(IN PFILE_OBJECT FileObject,
IoStatus,
DeviceObject);
}
/* Get the Base File System (Volume) and Fast Calls */
BaseDeviceObject = IoGetBaseFileSystemDeviceObject(FileObject);
FastDispatch = BaseDeviceObject->DriverObject->FastIoDispatch;
/* If the Base Device Object has its own FastDispatch Routine, fail */
if (FastDispatch && FastDispatch->MdlRead &&
if (FastDispatch && FastDispatch->MdlRead &&
BaseDeviceObject != DeviceObject)
{
return FALSE;
}
/* No fast path, use slow path */
return FsRtlMdlReadDev(FileObject,
FileOffset,
@ -253,18 +253,18 @@ FsRtlMdlRead(IN PFILE_OBJECT FileObject,
*
* @implemented
*/
BOOLEAN
BOOLEAN
STDCALL
FsRtlMdlReadComplete(IN PFILE_OBJECT FileObject,
IN OUT PMDL MdlChain)
{
PDEVICE_OBJECT DeviceObject, BaseDeviceObject;
PFAST_IO_DISPATCH FastDispatch;
/* Get Device Object and Fast Calls */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
/* Check if we support Fast Calls, and check this one */
if (FastDispatch && FastDispatch->MdlReadComplete)
{
@ -273,18 +273,18 @@ FsRtlMdlReadComplete(IN PFILE_OBJECT FileObject,
MdlChain,
DeviceObject);
}
/* Get the Base File System (Volume) and Fast Calls */
BaseDeviceObject = IoGetBaseFileSystemDeviceObject(FileObject);
FastDispatch = BaseDeviceObject->DriverObject->FastIoDispatch;
/* If the Base Device Object has its own FastDispatch Routine, fail */
if (FastDispatch && FastDispatch->MdlReadComplete &&
if (FastDispatch && FastDispatch->MdlReadComplete &&
BaseDeviceObject != DeviceObject)
{
return FALSE;
}
/* No fast path, use slow path */
return FsRtlMdlReadCompleteDev(FileObject, MdlChain, DeviceObject);
}
@ -364,11 +364,11 @@ FsRtlMdlWriteComplete(IN PFILE_OBJECT FileObject,
{
PDEVICE_OBJECT DeviceObject, BaseDeviceObject;
PFAST_IO_DISPATCH FastDispatch;
/* Get Device Object and Fast Calls */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
/* Check if we support Fast Calls, and check this one */
if (FastDispatch && FastDispatch->MdlWriteComplete)
{
@ -378,22 +378,22 @@ FsRtlMdlWriteComplete(IN PFILE_OBJECT FileObject,
MdlChain,
DeviceObject);
}
/* Get the Base File System (Volume) and Fast Calls */
BaseDeviceObject = IoGetBaseFileSystemDeviceObject(FileObject);
FastDispatch = BaseDeviceObject->DriverObject->FastIoDispatch;
/* If the Base Device Object has its own FastDispatch Routine, fail */
if (FastDispatch && FastDispatch->MdlWriteComplete &&
if (FastDispatch && FastDispatch->MdlWriteComplete &&
BaseDeviceObject != DeviceObject)
{
return FALSE;
}
/* No fast path, use slow path */
return FsRtlMdlWriteCompleteDev(FileObject,
FileOffset,
MdlChain,
return FsRtlMdlWriteCompleteDev(FileObject,
FileOffset,
MdlChain,
DeviceObject);
}
@ -402,7 +402,7 @@ FsRtlMdlWriteComplete(IN PFILE_OBJECT FileObject,
* FsRtlMdlWriteCompleteDev@16
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -445,11 +445,11 @@ FsRtlPrepareMdlWrite(IN PFILE_OBJECT FileObject,
{
PDEVICE_OBJECT DeviceObject, BaseDeviceObject;
PFAST_IO_DISPATCH FastDispatch;
/* Get Device Object and Fast Calls */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
/* Check if we support Fast Calls, and check this one */
if (FastDispatch && FastDispatch->PrepareMdlWrite)
{
@ -462,18 +462,18 @@ FsRtlPrepareMdlWrite(IN PFILE_OBJECT FileObject,
IoStatus,
DeviceObject);
}
/* Get the Base File System (Volume) and Fast Calls */
BaseDeviceObject = IoGetBaseFileSystemDeviceObject(FileObject);
FastDispatch = BaseDeviceObject->DriverObject->FastIoDispatch;
/* If the Base Device Object has its own FastDispatch Routine, fail */
if (FastDispatch && FastDispatch->PrepareMdlWrite &&
if (FastDispatch && FastDispatch->PrepareMdlWrite &&
BaseDeviceObject != DeviceObject)
{
return FALSE;
}
/* No fast path, use slow path */
return FsRtlPrepareMdlWriteDev(FileObject,
FileOffset,
@ -489,7 +489,7 @@ FsRtlPrepareMdlWrite(IN PFILE_OBJECT FileObject,
* FsRtlPrepareMdlWriteDev@28
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE

View file

@ -27,7 +27,7 @@ PAGED_LOOKASIDE_LIST LockLookaside;
inline BOOLEAN
inline BOOLEAN
IsOverlappingLock(
PFILE_LOCK_INFO Lock,
PLARGE_INTEGER StartOffset,
@ -36,32 +36,32 @@ IsOverlappingLock(
{
if ((ULONGLONG)StartOffset->QuadPart > (ULONGLONG)Lock->EndingByte.QuadPart)
{
return FALSE;
return FALSE;
}
if ((ULONGLONG)EndOffset->QuadPart < (ULONGLONG)Lock->StartingByte.QuadPart)
{
return FALSE;
return FALSE;
}
return TRUE;
return TRUE;
}
inline BOOLEAN
inline BOOLEAN
IsSurroundingLock(
PFILE_LOCK_INFO Lock,
PLARGE_INTEGER StartOffset,
PLARGE_INTEGER EndOffset
)
{
if ((ULONGLONG)StartOffset->QuadPart >= (ULONGLONG)Lock->StartingByte.QuadPart &&
if ((ULONGLONG)StartOffset->QuadPart >= (ULONGLONG)Lock->StartingByte.QuadPart &&
(ULONGLONG)EndOffset->QuadPart <= (ULONGLONG)Lock->EndingByte.QuadPart)
{
return TRUE;
return TRUE;
}
return FALSE;
return FALSE;
}
@ -102,7 +102,7 @@ FsRtlpInitFileLockingImplementation(VOID)
);
ExInitializeFastMutex(&LockTocMutex);
}
/**********************************************************************
@ -111,9 +111,9 @@ FsRtlpInitFileLockingImplementation(VOID)
*
*/
VOID
STDCALL
STDCALL
FsRtlpFileLockCancelRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
@ -121,28 +121,28 @@ FsRtlpFileLockCancelRoutine(
PKSPIN_LOCK SpinLock;
//don't need this since we have our own sync. protecting irp cancellation
IoReleaseCancelSpinLock(Irp->CancelIrql);
IoReleaseCancelSpinLock(Irp->CancelIrql);
SpinLock = Irp->Tail.Overlay.DriverContext[3];
KeAcquireSpinLock(SpinLock, &oldIrql);
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
KeReleaseSpinLock(SpinLock, oldIrql);
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
/**********************************************************************
* NAME PRIVATE
* FsRtlpCheckLockForReadOrWriteAccess
*
* Return:
* Return:
* TRUE: can read/write
* FALSE: can't read/write
*/
@ -163,12 +163,12 @@ FsRtlpCheckLockForReadOrWriteAccess(
PFILE_LOCK_GRANTED Granted;
PLIST_ENTRY EnumEntry;
LARGE_INTEGER EndOffset;
ASSERT(FileLock);
LockToc = FileLock->LockInformation;
if (LockToc == NULL || Length->QuadPart == 0)
if (LockToc == NULL || Length->QuadPart == 0)
{
return TRUE;
}
@ -180,17 +180,17 @@ FsRtlpCheckLockForReadOrWriteAccess(
LIST_FOR_EACH(EnumEntry, &LockToc->GrantedListHead)
{
Granted = CONTAINING_RECORD(EnumEntry, FILE_LOCK_GRANTED, ListEntry);
//if overlapping
if(IsOverlappingLock(&Granted->Lock, FileOffset, &EndOffset))
if(IsOverlappingLock(&Granted->Lock, FileOffset, &EndOffset))
{
//No read conflict if (shared lock) OR (exclusive + our lock)
//No write conflict if exclusive lock AND our lock
if ((Read && !Granted->Lock.ExclusiveLock) ||
(Granted->Lock.ExclusiveLock &&
(Granted->Lock.ExclusiveLock &&
Granted->Lock.Process == Process &&
Granted->Lock.FileObject == FileObject &&
Granted->Lock.Key == Key ) )
Granted->Lock.Key == Key ) )
{
//AND if lock surround request region, stop searching and grant
if (IsSurroundingLock(&Granted->Lock, FileOffset, &EndOffset) )
@ -198,7 +198,7 @@ FsRtlpCheckLockForReadOrWriteAccess(
KeReleaseSpinLock(&LockToc->SpinLock, oldirql);
return TRUE;
}
//else continue searching for conflicts
continue;
}
@ -376,10 +376,10 @@ FsRtlpFastUnlockAllByKey(
InitializeListHead(&UnlockedListHead);
GotUnlockRoutine = FileLock->UnlockRoutine != NULL;
KeAcquireSpinLock(&LockToc->SpinLock, &oldirql);
LIST_FOR_EACH_SAFE(EnumEntry, &LockToc->GrantedListHead, Granted, FILE_LOCK_GRANTED, ListEntry)
{
if (Granted->Lock.Process == Process &&
Granted->Lock.FileObject == FileObject &&
(!UseKey || (UseKey && Granted->Lock.Key == Key)) )
@ -387,7 +387,7 @@ FsRtlpFastUnlockAllByKey(
RemoveEntryList(&Granted->ListEntry);
Unlock = TRUE;
if (GotUnlockRoutine)
if (GotUnlockRoutine)
{
/*
Put on unlocked list and call unlock routine for them afterwards.
@ -395,23 +395,23 @@ FsRtlpFastUnlockAllByKey(
*/
InsertHeadList(&UnlockedListHead,&Granted->ListEntry);
}
else
else
{
ExFreeToNPagedLookasideList(&GrantedLookaside,Granted);
ExFreeToNPagedLookasideList(&GrantedLookaside,Granted);
}
}
}
KeReleaseSpinLock(&LockToc->SpinLock, oldirql);
if (Unlock)
{
//call unlock routine for each unlocked lock (if any)
while (!IsListEmpty(&UnlockedListHead))
while (!IsListEmpty(&UnlockedListHead))
{
EnumEntry = RemoveTailList(&UnlockedListHead);
Granted = CONTAINING_RECORD(EnumEntry,FILE_LOCK_GRANTED, ListEntry);
FileLock->UnlockRoutine(Granted->UnlockContext, &Granted->Lock);
ExFreeToNPagedLookasideList(&GrantedLookaside,Granted);
}
@ -420,7 +420,7 @@ FsRtlpFastUnlockAllByKey(
KeAcquireSpinLock(&LockToc->SpinLock, &oldirql);
FsRtlpCompletePendingLocks(FileLock, LockToc, &oldirql, Context);
if (IsListEmpty(&LockToc->GrantedListHead))
if (IsListEmpty(&LockToc->GrantedListHead))
{
KeReleaseSpinLock(&LockToc->SpinLock, oldirql);
FsRtlAreThereCurrentFileLocks(FileLock) = FALSE;
@ -429,7 +429,7 @@ FsRtlpFastUnlockAllByKey(
{
KeReleaseSpinLock(&LockToc->SpinLock, oldirql);
}
return STATUS_SUCCESS;
}
@ -456,7 +456,7 @@ FsRtlFastUnlockAll /*ByProcess*/ (
Process,
0, /* Key is ignored */
FALSE, /* Do NOT use Key */
Context
Context
);
}
@ -481,7 +481,7 @@ FsRtlFastUnlockAllByKey (
Process,
Key,
TRUE, /* Use Key */
Context
Context
);
}
@ -509,20 +509,20 @@ FsRtlpAddLock(
PLIST_ENTRY EnumEntry;
PFILE_LOCK_GRANTED Granted;
LARGE_INTEGER EndOffset;
EndOffset.QuadPart = FileOffset->QuadPart + Length->QuadPart - 1;
//loop and try to find conflicking locks
LIST_FOR_EACH(EnumEntry, &LockToc->GrantedListHead)
{
Granted = CONTAINING_RECORD(EnumEntry,FILE_LOCK_GRANTED, ListEntry);
if (IsOverlappingLock(&Granted->Lock, FileOffset, &EndOffset))
{
//we found a locks that overlap with the new lock
//if both locks are shared, we might have a fast path outa here...
if (!Granted->Lock.ExclusiveLock && !ExclusiveLock)
if (!Granted->Lock.ExclusiveLock && !ExclusiveLock)
{
//if existing lock surround new lock, we know that no other exclusive lock
//may overlap with our new lock;-D
@ -530,12 +530,12 @@ FsRtlpAddLock(
{
break;
}
//else keep locking for conflicts
continue;
}
//we found a conflict:
//we found a conflict:
//we want shared access to an excl. lock OR exlc. access to a shared lock
return FALSE;
}
@ -581,10 +581,10 @@ FsRtlpCompletePendingLocks(
PIRP Irp;
PIO_STACK_LOCATION Stack;
LIST_ENTRY CompletedListHead;
InitializeListHead(&CompletedListHead);
LIST_FOR_EACH_SAFE(EnumEntry, &LockToc->PendingListHead, Irp, IRP, Tail.Overlay.ListEntry)
LIST_FOR_EACH_SAFE(EnumEntry, &LockToc->PendingListHead, Irp, IRP, Tail.Overlay.ListEntry)
{
Stack = IoGetCurrentIrpStackLocation(Irp);
if (FsRtlpAddLock(LockToc,
@ -595,7 +595,7 @@ FsRtlpCompletePendingLocks(
Stack->Parameters.LockControl.Key,
Stack->Flags & SL_EXCLUSIVE_LOCK,
Irp->Tail.Overlay.DriverContext[2] //Context
) )
) )
{
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
@ -615,12 +615,12 @@ FsRtlpCompletePendingLocks(
}
KeReleaseSpinLock(&LockToc->SpinLock, *oldirql);
//complete irp's (if any)
while (!IsListEmpty(&CompletedListHead))
while (!IsListEmpty(&CompletedListHead))
{
EnumEntry = RemoveTailList(&CompletedListHead);
Irp = CONTAINING_RECORD(EnumEntry, IRP, Tail.Overlay.ListEntry);
Irp->IoStatus.Status = STATUS_SUCCESS;
@ -631,8 +631,8 @@ FsRtlpCompletePendingLocks(
if (FileLock->CompleteLockIrpRoutine(Context, Irp)!=STATUS_SUCCESS)
{
Stack = IoGetCurrentIrpStackLocation(Irp);
//revert
//revert
FsRtlpUnlockSingle ( FileLock,
Stack->FileObject,
&Stack->Parameters.LockControl.ByteOffset,
@ -689,15 +689,15 @@ FsRtlpUnlockSingle(
KeAcquireSpinLock(&LockToc->SpinLock, &oldirql );
LIST_FOR_EACH_SAFE(EnumEntry, &LockToc->GrantedListHead, Granted,FILE_LOCK_GRANTED,ListEntry)
LIST_FOR_EACH_SAFE(EnumEntry, &LockToc->GrantedListHead, Granted,FILE_LOCK_GRANTED,ListEntry)
{
//must be exact match
if (FileOffset->QuadPart == Granted->Lock.StartingByte.QuadPart &&
Length->QuadPart == Granted->Lock.Length.QuadPart &&
Granted->Lock.Process == Process &&
Granted->Lock.FileObject == FileObject &&
Granted->Lock.Key == Key)
Granted->Lock.Key == Key)
{
RemoveEntryList(&Granted->ListEntry);
FsRtlpCompletePendingLocks(FileLock, LockToc, &oldirql, Context);
@ -705,7 +705,7 @@ FsRtlpUnlockSingle(
if (IsListEmpty(&LockToc->GrantedListHead))
{
KeReleaseSpinLock(&LockToc->SpinLock, oldirql);
FsRtlAreThereCurrentFileLocks(FileLock) = FALSE; //paged data
}
else
@ -784,7 +784,7 @@ FsRtlpDumpFileLocks(
ASSERT(FileLock);
LockToc = FileLock->LockInformation;
if (LockToc == NULL)
if (LockToc == NULL)
{
DPRINT1("No file locks\n");
return;
@ -797,7 +797,7 @@ FsRtlpDumpFileLocks(
LIST_FOR_EACH(EnumEntry, &LockToc->GrantedListHead)
{
Granted = CONTAINING_RECORD(EnumEntry, FILE_LOCK_GRANTED , ListEntry);
DPRINT1("%s, start: %i, len: %i, end: %i, key: %i, proc: 0x%X, fob: 0x%X\n",
Granted->Lock.ExclusiveLock ? "EXCL" : "SHRD",
Granted->Lock.StartingByte.QuadPart,
@ -852,7 +852,7 @@ FsRtlGetNextFileLock (
{
/*
Messy enumeration of granted locks.
What our last ptr. in LastReturnedLock points at, might have been freed between
What our last ptr. in LastReturnedLock points at, might have been freed between
calls, so we have to scan thru the list every time, searching for our last lock.
If it's not there anymore, restart the enumeration...
*/
@ -892,7 +892,7 @@ restart:;
FileLock->LastReturnedLock = EnumEntry;
return &FileLock->LastReturnedLockInfo;
}
else
else
{
KeReleaseSpinLock(&LockToc->SpinLock,oldirql);
return NULL;
@ -900,10 +900,10 @@ restart:;
}
//else: continue enum
while (EnumEntry != &LockToc->GrantedListHead)
while (EnumEntry != &LockToc->GrantedListHead)
{
//found previous lock?
if (EnumEntry == LocalLastReturnedLock)
if (EnumEntry == LocalLastReturnedLock)
{
FoundPrevious = TRUE;
//get next
@ -923,7 +923,7 @@ restart:;
EnumEntry = EnumEntry->Flink;
}
if (!FoundPrevious)
if (!FoundPrevious)
{
//got here? uh no, didn't find our last lock..must have been freed...restart
Restart = TRUE;
@ -989,7 +989,7 @@ FsRtlPrivateLock (
KIRQL oldirql;
ASSERT(FileLock);
if (FileLock->LockInformation == NULL)
if (FileLock->LockInformation == NULL)
{
ExAcquireFastMutex(&LockTocMutex);
//still NULL?
@ -1015,24 +1015,24 @@ FsRtlPrivateLock (
Process,
Key,
ExclusiveLock,
Context
) )
Context
) )
{
IoStatus->Status = STATUS_SUCCESS;
}
else if (Irp && !FailImmediately)
{
else if (Irp && !FailImmediately)
{
//failed + irp + no fail = make. pending
Irp->Tail.Overlay.DriverContext[3] = &LockToc->SpinLock;
Irp->Tail.Overlay.DriverContext[2] = Context;
IoSetCancelRoutine(Irp, FsRtlpFileLockCancelRoutine);
if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
{
{
//irp was canceled
KeReleaseSpinLock(&LockToc->SpinLock, oldirql);
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
@ -1046,7 +1046,7 @@ FsRtlPrivateLock (
InsertHeadList(&LockToc->PendingListHead,&Irp->Tail.Overlay.ListEntry);
}
else
else
{
IoStatus->Status = STATUS_LOCK_NOT_GRANTED;
}
@ -1056,20 +1056,20 @@ FsRtlPrivateLock (
//never pending if no irp;-)
ASSERT(!(IoStatus->Status == STATUS_PENDING && !Irp));
if (IoStatus->Status != STATUS_PENDING)
if (IoStatus->Status != STATUS_PENDING)
{
if (IoStatus->Status == STATUS_SUCCESS)
if (IoStatus->Status == STATUS_SUCCESS)
{
FsRtlAreThereCurrentFileLocks(FileLock) = TRUE;
}
if (Irp)
if (Irp)
{
Irp->IoStatus.Status = IoStatus->Status;
Irp->IoStatus.Information = 0;
if (FileLock->CompleteLockIrpRoutine)
if (FileLock->CompleteLockIrpRoutine)
{
if (FileLock->CompleteLockIrpRoutine(Context,Irp)!=STATUS_SUCCESS)
if (FileLock->CompleteLockIrpRoutine(Context,Irp)!=STATUS_SUCCESS)
{
//CompleteLockIrpRoutine complain: revert changes
FsRtlpUnlockSingle( FileLock,
@ -1083,7 +1083,7 @@ FsRtlPrivateLock (
);
}
}
else
else
{
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
@ -1145,7 +1145,7 @@ FsRtlProcessFileLock (
Stack->Parameters.LockControl.Length,
IoGetRequestorProcess(Irp),
Stack->Parameters.LockControl.Key,
Context,
Context,
FALSE);
break;
@ -1174,7 +1174,7 @@ FsRtlProcessFileLock (
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp,IO_NO_INCREMENT);
return Status;
@ -1210,7 +1210,7 @@ FsRtlUninitializeFileLock (
KeAcquireSpinLock(&LockToc->SpinLock, &oldirql);
//remove and free granted locks
while (!IsListEmpty(&LockToc->GrantedListHead))
while (!IsListEmpty(&LockToc->GrantedListHead))
{
EnumEntry = RemoveTailList(&LockToc->GrantedListHead);
Granted = CONTAINING_RECORD(EnumEntry, FILE_LOCK_GRANTED, ListEntry);
@ -1218,13 +1218,13 @@ FsRtlUninitializeFileLock (
}
//remove, complete and free all pending locks
while (!IsListEmpty(&LockToc->PendingListHead))
while (!IsListEmpty(&LockToc->PendingListHead))
{
EnumEntry = RemoveTailList(&LockToc->PendingListHead);
Irp = CONTAINING_RECORD(EnumEntry, IRP, Tail.Overlay.ListEntry);
if (!IoSetCancelRoutine(Irp, NULL))
{
{
//The cancel routine will be called. When we release the lock it will complete the irp.
InitializeListHead(&Irp->Tail.Overlay.ListEntry);
continue;
@ -1313,10 +1313,10 @@ FsRtlAcquireFileExclusive(
PFAST_IO_DISPATCH FastDispatch;
PDEVICE_OBJECT DeviceObject;
PFSRTL_COMMON_FCB_HEADER FcbHeader;
/* Get the Device Object */
DeviceObject = IoGetBaseFileSystemDeviceObject(FileObject);
/* Check if we have to do a Fast I/O Dispatch */
if ((FastDispatch = DeviceObject->DriverObject->FastIoDispatch)) {
@ -1324,19 +1324,19 @@ FsRtlAcquireFileExclusive(
if (FastDispatch->AcquireFileForNtCreateSection) {
FastDispatch->AcquireFileForNtCreateSection(FileObject);
}
return;
}
/* Do a normal acquire */
if ((FcbHeader = (PFSRTL_COMMON_FCB_HEADER)FileObject->FsContext)) {
/* Use a Resource Acquire */
ExAcquireResourceExclusive(FcbHeader->Resource, TRUE);
return;
}
/* Return...is there some kind of failure we should raise?? */
return;
}
@ -1353,30 +1353,30 @@ FsRtlReleaseFile(
PFAST_IO_DISPATCH FastDispatch;
PDEVICE_OBJECT DeviceObject;
PFSRTL_COMMON_FCB_HEADER FcbHeader;
/* Get the Device Object */
DeviceObject = IoGetBaseFileSystemDeviceObject(FileObject);
/* Check if we have to do a Fast I/O Dispatch */
if ((FastDispatch = DeviceObject->DriverObject->FastIoDispatch)) {
/* Use Fast I/O */
if (FastDispatch->ReleaseFileForNtCreateSection) {
FastDispatch->ReleaseFileForNtCreateSection(FileObject);
}
return;
}
/* Do a normal acquire */
if ((FcbHeader = (PFSRTL_COMMON_FCB_HEADER)FileObject->FsContext)) {
/* Use a Resource Release */
ExReleaseResource(FcbHeader->Resource);
return;
}
/* Return...is there some kind of failure we should raise?? */
return;
}

View file

@ -15,7 +15,7 @@
* NAME EXPORTED
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -87,12 +87,12 @@ FsRtlGetNextMcbEntry (IN PMCB Mcb,
&llVbn,
&llLbn,
&llSectorCount);
/* Return everything typecasted */
*Vbn = (ULONG)llVbn;
*Lbn = (ULONG)llLbn;
*SectorCount = (ULONG)llSectorCount;
/* And return the original value */
return(Return);
}
@ -212,11 +212,11 @@ FsRtlLookupLastMcbEntry(IN PMCB Mcb,
Return = FsRtlLookupLastLargeMcbEntry(&Mcb->LargeMcb,
&llVbn,
&llLbn);
/* Return everything typecasted */
*Vbn = (ULONG)llVbn;
*Lbn = (ULONG)llLbn;
/* And return the original value */
return(Return);
}
@ -244,11 +244,11 @@ FsRtlLookupMcbEntry(IN PMCB Mcb,
NULL,
NULL,
Index);
/* Return everything typecasted */
*Lbn = (ULONG)llLbn;
if (SectorCount) *SectorCount = (ULONG)llSectorCount;
/* And return the original value */
return(Return);
}

View file

@ -168,7 +168,7 @@ PUCHAR EXPORTED FsRtlLegalAnsiCharacterArray = LegalAnsiCharacterArray;
*
* @implemented
*/
BOOLEAN
BOOLEAN
STDCALL
FsRtlAreNamesEqual(IN PUNICODE_STRING Name1,
IN PUNICODE_STRING Name2,
@ -178,13 +178,13 @@ FsRtlAreNamesEqual(IN PUNICODE_STRING Name1,
UNICODE_STRING UpcaseName1;
UNICODE_STRING UpcaseName2;
BOOLEAN StringsAreEqual;
/* Well, first check their size */
if (Name1->Length != Name2->Length) {
/* Not equal! */
return FALSE;
}
/* Turn them into Upcase if we don't have a table */
if (IgnoreCase && !UpcaseTable) {
RtlUpcaseUnicodeString(&UpcaseName1, Name1, TRUE);
@ -192,42 +192,42 @@ FsRtlAreNamesEqual(IN PUNICODE_STRING Name1,
Name1 = &UpcaseName1;
Name2 = &UpcaseName2;
goto ManualCase;
goto ManualCase;
}
/* Do a case-sensitive search */
if (!IgnoreCase) {
ManualCase:
/* Use a raw memory compare */
StringsAreEqual = RtlEqualMemory(Name1->Buffer,
Name2->Buffer,
Name1->Length);
/* Clear the strings if we need to */
if (IgnoreCase) {
RtlFreeUnicodeString(&UpcaseName1);
RtlFreeUnicodeString(&UpcaseName2);
}
/* Return the equality */
return StringsAreEqual;
} else {
/* Case in-sensitive search */
LONG i;
for (i = Name1->Length / sizeof(WCHAR) - 1; i >= 0; i--) {
if (UpcaseTable[Name1->Buffer[i]] != UpcaseTable[Name2->Buffer[i]]) {
/* Non-match found! */
return FALSE;
}
}
}
/* We finished the loop so we are equal */
return TRUE;
}
@ -261,7 +261,7 @@ ManualCase:
*
* @implemented
*/
VOID
VOID
STDCALL
FsRtlDissectDbcs(IN ANSI_STRING Name,
OUT PANSI_STRING FirstPart,
@ -269,39 +269,39 @@ FsRtlDissectDbcs(IN ANSI_STRING Name,
{
ULONG i;
ULONG FirstLoop;
/* Initialize the Outputs */
RtlZeroMemory(&FirstPart, sizeof(ANSI_STRING));
RtlZeroMemory(&RemainingPart, sizeof(ANSI_STRING));
/* Bail out if empty */
if (!Name.Length) return;
/* Ignore backslash */
if (Name.Buffer[0] == '\\') {
i = 1;
} else {
i = 0;
}
/* Loop until we find a backslash */
for (FirstLoop = i;i < Name.Length;i++) {
if (Name.Buffer[i] != '\\') break;
if (FsRtlIsLeadDbcsCharacter(Name.Buffer[i])) i++;
}
/* Now we have the First Part */
FirstPart->Length = (i-FirstLoop);
FirstPart->MaximumLength = FirstPart->Length; /* +2?? */
FirstPart->Buffer = &Name.Buffer[FirstLoop];
/* Make the second part if something is still left */
if (i<Name.Length) {
RemainingPart->Length = (Name.Length - (i+1));
RemainingPart->MaximumLength = RemainingPart->Length; /* +2?? */
RemainingPart->Buffer = &Name.Buffer[i+1];
}
return;
}
@ -334,7 +334,7 @@ FsRtlDissectDbcs(IN ANSI_STRING Name,
*
* @implemented
*/
VOID
VOID
STDCALL
FsRtlDissectName(IN UNICODE_STRING Name,
OUT PUNICODE_STRING FirstPart,
@ -368,7 +368,7 @@ FsRtlDissectName(IN UNICODE_STRING Name,
NameLength++;
}
FirstPart->Length =
FirstPart->Length =
FirstPart->MaximumLength = NameLength * sizeof(WCHAR);
FirstPart->Buffer = &Name.Buffer[NameOffset];
@ -393,15 +393,15 @@ FsRtlDissectName(IN UNICODE_STRING Name,
*
* @implemented
*/
BOOLEAN
BOOLEAN
STDCALL
FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name)
{
ULONG i;
/* Check every character */
for (i=0;i < Name->Length;i++) {
/* First make sure it's not the Lead DBCS */
if (FsRtlIsLeadDbcsCharacter(Name->Buffer[i])) {
i++;
@ -410,7 +410,7 @@ FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name)
return TRUE;
}
}
/* We didn't return above...so none found */
return FALSE;
}
@ -430,7 +430,7 @@ FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name)
*
* @implemented
*/
BOOLEAN
BOOLEAN
STDCALL
FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
{
@ -457,14 +457,14 @@ FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
* FsRtlIsDbcsInExpression@8
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
*
* @unimplemented
*/
BOOLEAN
BOOLEAN
STDCALL
FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
IN PANSI_STRING Name)
@ -486,10 +486,10 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
*/
BOOLEAN
STDCALL
FsRtlIsFatDbcsLegal(IN ANSI_STRING DbcsName,
IN BOOLEAN WildCardsPermissible,
IN BOOLEAN PathNamePermissible,
IN BOOLEAN LeadingBackslashPermissible)
FsRtlIsFatDbcsLegal(IN ANSI_STRING DbcsName,
IN BOOLEAN WildCardsPermissible,
IN BOOLEAN PathNamePermissible,
IN BOOLEAN LeadingBackslashPermissible)
{
return FALSE;
}
@ -499,19 +499,19 @@ FsRtlIsFatDbcsLegal(IN ANSI_STRING DbcsName,
* FsRtlIsHpfsDbcsLegal@20
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
*
* @unimplemented
*/
BOOLEAN
BOOLEAN
STDCALL
FsRtlIsHpfsDbcsLegal(IN ANSI_STRING DbcsName,
IN BOOLEAN WildCardsPermissible,
IN BOOLEAN PathNamePermissible,
IN BOOLEAN LeadingBackslashPermissible)
FsRtlIsHpfsDbcsLegal(IN ANSI_STRING DbcsName,
IN BOOLEAN WildCardsPermissible,
IN BOOLEAN PathNamePermissible,
IN BOOLEAN LeadingBackslashPermissible)
{
return FALSE;
}
@ -533,7 +533,7 @@ FsRtlIsHpfsDbcsLegal(IN ANSI_STRING DbcsName,
*
* @implemented
*/
BOOLEAN
BOOLEAN
STDCALL
FsRtlIsNameInExpression(IN PUNICODE_STRING Expression,
IN PUNICODE_STRING Name,

View file

@ -33,8 +33,8 @@ typedef struct _NOTIFY_ENTRY
BOOLEAN Unicode;
BOOLEAN BufferExhausted;
PVOID Buffer; /* Buffer == NULL equals IgnoreBuffer == TRUE */
ULONG BufferSize;
ULONG NextEntryOffset;
ULONG BufferSize;
ULONG NextEntryOffset;
PFILE_NOTIFY_INFORMATION PrevEntry;
} NOTIFY_ENTRY, *PNOTIFY_ENTRY;
@ -57,7 +57,7 @@ FsRtlpInitNotifyImplementation(VOID)
0
);
}
@ -70,11 +70,11 @@ FsRtlpIsUnicodePath(
)
{
ASSERT(Path->Length);
if (Path->Length == 1) return FALSE;
if (Path->Length == 1) return FALSE;
if (*(WCHAR*)Path->Buffer == '\\') return TRUE;
return FALSE;
}
@ -86,30 +86,30 @@ FsRtlpIsUnicodePath(
*/
static
VOID
STDCALL
STDCALL
FsRtlpNotifyCancelRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PFAST_MUTEX Lock;
//don't need this since we have our own sync. protecting irp cancellation
IoReleaseCancelSpinLock(Irp->CancelIrql);
IoReleaseCancelSpinLock(Irp->CancelIrql);
Lock = (PFAST_MUTEX)Irp->Tail.Overlay.DriverContext[3];
ExAcquireFastMutex(Lock );
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
ExReleaseFastMutex(Lock);
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
@ -124,18 +124,18 @@ FsRtlpFindNotifyEntry(
{
PLIST_ENTRY EnumEntry;
PNOTIFY_ENTRY NotifyEntry;
LIST_FOR_EACH(EnumEntry, NotifyList)
{
NotifyEntry = CONTAINING_RECORD(EnumEntry, NOTIFY_ENTRY, ListEntry);
if (NotifyEntry->FsContext == FsContext)
{
return NotifyEntry;
}
}
return NULL;
return NULL;
}
/**********************************************************************
@ -143,7 +143,7 @@ FsRtlpFindNotifyEntry(
* FsRtlNotifyChangeDirectory@28
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -203,13 +203,13 @@ FsRtlNotifyCleanup (
LIST_ENTRY CompletedListHead;
PLIST_ENTRY TmpEntry;
PIRP Irp;
InitializeListHead(&CompletedListHead);
ExAcquireFastMutex((PFAST_MUTEX)NotifySync);
ExAcquireFastMutex((PFAST_MUTEX)NotifySync);
NotifyEntry = FsRtlpFindNotifyEntry(NotifyList, FsContext);
if (NotifyEntry)
{
/* free buffered changes */
@ -226,7 +226,7 @@ FsRtlNotifyCleanup (
/* irp cancelation bolilerplate */
if (!IoSetCancelRoutine(Irp, NULL))
{
{
//The cancel routine will be called. When we release the lock it will complete the irp.
InitializeListHead(&Irp->Tail.Overlay.ListEntry);
continue;
@ -238,22 +238,22 @@ FsRtlNotifyCleanup (
/* avoid holding lock while completing irp */
InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry);
}
/* Unlink and free the NotifyStruct */
RemoveEntryList(&NotifyEntry->ListEntry);
ExFreeToPagedLookasideList(&NotifyEntryLookaside, NotifyEntry);
}
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
/* complete defered irps */
while (!IsListEmpty(&CompletedListHead))
while (!IsListEmpty(&CompletedListHead))
{
TmpEntry = RemoveHeadList(&CompletedListHead);
Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
}
@ -315,23 +315,23 @@ FsRtlpWatchedDirectoryWasDeleted(
PLIST_ENTRY EnumEntry, TmpEntry;
PNOTIFY_ENTRY NotifyEntry;
PIRP Irp;
InitializeListHead(&CompletedListHead);
ExAcquireFastMutex((PFAST_MUTEX)NotifySync);
LIST_FOR_EACH_SAFE(EnumEntry, NotifyList, NotifyEntry, NOTIFY_ENTRY, ListEntry )
{
if (NotifyEntry->Fcb == Fcb)
{
RemoveEntryList(&NotifyEntry->ListEntry);
RemoveEntryList(&NotifyEntry->ListEntry);
/* free buffered changes */
if (NotifyEntry->Buffer)
{
ExFreePool(NotifyEntry->Buffer);
}
/* cleanup pending irps */
while (!IsListEmpty(&NotifyEntry->IrpQueue))
{
@ -340,31 +340,31 @@ FsRtlpWatchedDirectoryWasDeleted(
/* irp cancelation bolilerplate */
if (!IoSetCancelRoutine(Irp, NULL))
{
{
//The cancel routine will be called. When we release the lock it will complete the irp.
InitializeListHead(&Irp->Tail.Overlay.ListEntry);
continue;
}
Irp->IoStatus.Status = STATUS_DELETE_PENDING;
Irp->IoStatus.Information = 0;
/* avoid holding lock while completing irp */
InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry);
}
}
}
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
/* complete defered irps */
while (!IsListEmpty(&CompletedListHead))
while (!IsListEmpty(&CompletedListHead))
{
TmpEntry = RemoveHeadList(&CompletedListHead);
Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
}
@ -377,7 +377,7 @@ FsRtlpWatchedDirectoryWasDeleted(
* FsRtlNotifyFullChangeDirectory@40
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -399,49 +399,49 @@ FsRtlNotifyFullChangeDirectory (
IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL
)
{
PIO_STACK_LOCATION IrpStack;
PIO_STACK_LOCATION IrpStack;
PNOTIFY_ENTRY NotifyEntry;
ULONG IrpBuffLen;
if (!Irp)
{
/* all other params are ignored if NotifyIrp == NULL */
FsRtlpWatchedDirectoryWasDeleted(NotifySync, NotifyList, FsContext);
return;
}
DPRINT("FullDirectoryName: %wZ\n", FullDirectoryName);
ExAcquireFastMutex((PFAST_MUTEX)NotifySync);
IrpStack = IoGetCurrentIrpStackLocation(Irp);
if (IrpStack->FileObject->Flags & FO_CLEANUP_COMPLETE)
{
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_NOTIFY_CLEANUP;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return;
return;
}
IrpBuffLen = IrpStack->Parameters.NotifyDirectory.Length;
NotifyEntry = FsRtlpFindNotifyEntry(NotifyList, FsContext);
if (!NotifyEntry)
{
/* No NotifyStruct for this FileObject existed */
/* The first request for this FileObject set the standards.
* For subsequent requests, these params will be ignored.
* Ref: Windows NT File System Internals page 516
*/
NotifyEntry = ExAllocateFromPagedLookasideList(&NotifyEntryLookaside);
RtlZeroMemory(NotifyEntry, sizeof(NOTIFY_ENTRY));
NotifyEntry->FsContext = FsContext;
NotifyEntry->FullDirectoryName = FullDirectoryName;
NotifyEntry->WatchTree = WatchTree;
@ -461,7 +461,7 @@ FsRtlNotifyFullChangeDirectory (
IrpBuffLen,
FSRTL_NOTIFY_TAG
);
NotifyEntry->BufferSize = IrpBuffLen;
}
_SEH_HANDLE
@ -474,24 +474,24 @@ FsRtlNotifyFullChangeDirectory (
}
InitializeListHead(&NotifyEntry->IrpQueue);
InsertTailList(NotifyList, &NotifyEntry->ListEntry);
}
if (!NotifyEntry->PendingChanges)
{
/* No changes are pending. Queue the irp */
/* Irp cancelation boilerplate */
/* save NotifySych for use in the cancel routine */
Irp->Tail.Overlay.DriverContext[3] = NotifySync;
IoSetCancelRoutine(Irp, FsRtlpNotifyCancelRoutine);
if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
{
{
//irp was canceled
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
@ -506,17 +506,17 @@ FsRtlNotifyFullChangeDirectory (
//FIXME: any point in setting irp status/information before queueing?
Irp->IoStatus.Status = STATUS_PENDING;
InsertTailList(&NotifyEntry->IrpQueue, &Irp->Tail.Overlay.ListEntry);
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
return;
}
/* Pending changes exist */
if (NotifyEntry->Buffer == NULL ||
if (NotifyEntry->Buffer == NULL ||
NotifyEntry->BufferExhausted ||
IrpBuffLen < NotifyEntry->NextEntryOffset)
{
@ -526,7 +526,7 @@ FsRtlNotifyFullChangeDirectory (
-Buffer were overflowed, OR
-Current irp buff was not large enough
*/
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_NOTIFY_ENUM_DIR;
@ -547,18 +547,18 @@ FsRtlNotifyFullChangeDirectory (
Irp->IoStatus.Status = STATUS_SUCCESS;
}
/* reset buffer */
NotifyEntry->PrevEntry = NULL;
NotifyEntry->NextEntryOffset = 0;
NotifyEntry->BufferExhausted = FALSE;
NotifyEntry->PendingChanges = FALSE;
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
/* caller must return STATUS_PENDING */
}
@ -570,33 +570,33 @@ FASTCALL
FsRtlpGetNextIrp(PNOTIFY_ENTRY NotifyEntry)
{
PIRP Irp;
PLIST_ENTRY TmpEntry;
PLIST_ENTRY TmpEntry;
/* Loop to get a non-canceled irp */
while (!IsListEmpty(&NotifyEntry->IrpQueue))
{
/* If we have queued irp(s) we can't possibly have pending changes too */
ASSERT(!NotifyEntry->PendingChanges);
TmpEntry = RemoveHeadList(&NotifyEntry->IrpQueue);
Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry);
/* irp cancelation bolilerplate */
if (!IoSetCancelRoutine(Irp, NULL))
{
{
//The cancel routine will be called. When we release the lock it will complete the irp.
InitializeListHead(&Irp->Tail.Overlay.ListEntry);
continue;
}
/* Finally we got a non-canceled irp */
return Irp;
return Irp;
}
return NULL;
}
static
inline
VOID
@ -615,7 +615,7 @@ FsRtlpCopyName(
if (StreamName)
{
CurrentEntry->Name[RelativeName->Length/sizeof(WCHAR)] = ':';
memcpy(&CurrentEntry ->Name[(RelativeName->Length/sizeof(WCHAR))+1],
memcpy(&CurrentEntry ->Name[(RelativeName->Length/sizeof(WCHAR))+1],
StreamName->Buffer,
StreamName->Length);
}
@ -633,7 +633,7 @@ FsRtlpCopyName(
* FsRtlNotifyFullReportChange@36
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -663,7 +663,7 @@ FsRtlNotifyFullReportChange (
USHORT NameLenU;
ULONG RecordLen;
PFILE_NOTIFY_INFORMATION CurrentEntry;
InitializeListHead(&CompletedListHead);
DPRINT("FullTargetName: %wZ\n", FullTargetName);
@ -672,40 +672,40 @@ FsRtlNotifyFullReportChange (
I think FullTargetName can include/be a short file name! What the heck do i do with this?
Dont think this apply to FsRtlNotifyFullChangeDirectory's FullDirectoryName.
*/
ExAcquireFastMutex((PFAST_MUTEX)NotifySync);
ExAcquireFastMutex((PFAST_MUTEX)NotifySync);
LIST_FOR_EACH_SAFE(EnumEntry, NotifyList, NotifyEntry, NOTIFY_ENTRY, ListEntry )
{
ASSERT(NotifyEntry->Unicode == FsRtlpIsUnicodePath(FullTargetName));
/* rule out some easy cases */
/* FIXME: short vs. long names??? lower case/upper case/mixed case? */
if (!(FilterMatch & NotifyEntry->CompletionFilter)) continue;
FullDirLen = TargetNameOffset - (NotifyEntry->Unicode ? sizeof(WCHAR) : sizeof(char));
if (FullDirLen == 0)
{
/* special case for root dir */
FullDirLen = (NotifyEntry->Unicode ? sizeof(WCHAR) : sizeof(char));
}
if (FullDirLen < NotifyEntry->FullDirectoryName->Length) continue;
if (!NotifyEntry->WatchTree && FullDirLen != NotifyEntry->FullDirectoryName->Length) continue;
DPRINT("NotifyEntry->FullDirectoryName: %wZ\n", NotifyEntry->FullDirectoryName);
/* FIXME: short vs. long names??? lower case/upper case/mixed case? */
if (memcmp(NotifyEntry->FullDirectoryName->Buffer,
FullTargetName->Buffer,
NotifyEntry->FullDirectoryName->Length) != 0) continue;
if (NotifyEntry->WatchTree &&
/* FIXME: short vs. long names??? lower case/upper case/mixed case? */
if (memcmp(NotifyEntry->FullDirectoryName->Buffer,
FullTargetName->Buffer,
NotifyEntry->FullDirectoryName->Length) != 0) continue;
if (NotifyEntry->WatchTree &&
NotifyEntry->TraverseCallback &&
FullDirLen != NotifyEntry->FullDirectoryName->Length)
{
@ -713,25 +713,25 @@ FsRtlNotifyFullReportChange (
NTSTATUS Status = NotifyEntry->TraverseCallback(NotifyEntry->FsContext,
TargetContext,
NotifyEntry->SubjectContext);
if (!NT_SUCCESS(Status)) continue;
/*
FIXME: notify-dir impl. should release and free the SubjectContext
*/
}
DPRINT("Found match\n");
/* Found a valid change */
RelativeName.Buffer = FullTargetName->Buffer + TargetNameOffset;
RelativeName.MaximumLength =
RelativeName.Length =
RelativeName.MaximumLength =
RelativeName.Length =
FullTargetName->Length - TargetNameOffset;
DPRINT("RelativeName: %wZ\n",&RelativeName);
/* calculate unicode bytes of relative-name + stream-name */
if (NotifyEntry->Unicode)
{
@ -739,25 +739,25 @@ FsRtlNotifyFullReportChange (
}
else
{
NameLenU = RelativeName.Length * sizeof(WCHAR) +
NameLenU = RelativeName.Length * sizeof(WCHAR) +
(StreamName ? ((StreamName->Length * sizeof(WCHAR)) + sizeof(WCHAR)) : 0);
}
RecordLen = FIELD_OFFSET(FILE_NOTIFY_INFORMATION, Name) + NameLenU;
if ((Irp = FsRtlpGetNextIrp(NotifyEntry)))
{
PIO_STACK_LOCATION IrpStack;
ULONG IrpBuffLen;
IrpStack = IoGetCurrentIrpStackLocation(Irp);
IrpBuffLen = IrpStack->Parameters.NotifyDirectory.Length;
DPRINT("Got pending irp\n");
ASSERT(!NotifyEntry->PendingChanges);
if (NotifyEntry->Buffer == NULL || /* aka. IgnoreBuffer */
if (NotifyEntry->Buffer == NULL || /* aka. IgnoreBuffer */
RecordLen > IrpBuffLen)
{
/* ignore buffer / buffer not large enough */
@ -766,12 +766,12 @@ FsRtlNotifyFullReportChange (
}
else
{
CurrentEntry = (PFILE_NOTIFY_INFORMATION)
CurrentEntry = (PFILE_NOTIFY_INFORMATION)
MmGetSystemAddressForMdlSafe(Irp->MdlAddress, LowPagePriority);
if (CurrentEntry)
{
CurrentEntry->Action = Action;
CurrentEntry->Action = Action;
CurrentEntry->NameLength = NameLenU;
CurrentEntry->NextEntryOffset = 0;
@ -781,29 +781,29 @@ FsRtlNotifyFullReportChange (
&RelativeName,
StreamName
);
Irp->IoStatus.Information = RecordLen;
}
else
{
Irp->IoStatus.Information = 0;
}
Irp->IoStatus.Status = STATUS_SUCCESS;
}
/* avoid holding lock while completing irp */
InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry);
}
else
{
DPRINT("No irp\n");
NotifyEntry->PendingChanges = TRUE;
if (NotifyEntry->Buffer == NULL || NotifyEntry->BufferExhausted) continue;
if (RecordLen > NotifyEntry->BufferSize - NotifyEntry->NextEntryOffset)
{
/* overflow. drop these changes and stop buffering any other changes too */
@ -814,10 +814,10 @@ FsRtlNotifyFullReportChange (
/* The buffer has enough room for the changes.
* Copy data to buffer.
*/
CurrentEntry = (PFILE_NOTIFY_INFORMATION)NotifyEntry->Buffer;
CurrentEntry->Action = Action;
CurrentEntry->Action = Action;
CurrentEntry->NameLength = NameLenU;
CurrentEntry->NextEntryOffset = 0;
@ -826,14 +826,14 @@ FsRtlNotifyFullReportChange (
&RelativeName,
StreamName
);
if (NotifyEntry->PrevEntry)
{
NotifyEntry->PrevEntry->NextEntryOffset = (char*)CurrentEntry - (char*)NotifyEntry->PrevEntry;
}
NotifyEntry->PrevEntry = CurrentEntry;
NotifyEntry->NextEntryOffset += RecordLen;
// {
// UNICODE_STRING TmpStr;
@ -841,22 +841,22 @@ FsRtlNotifyFullReportChange (
// TmpStr.MaximumLength = TmpStr.Length = BufferedChange->NameLen;
// DPRINT("BufferedChange->RelativeName: %wZ\n", &TmpStr);
// }
}
}
ExReleaseFastMutex((PFAST_MUTEX)NotifySync);
/* complete defered irps */
while (!IsListEmpty(&CompletedListHead))
while (!IsListEmpty(&CompletedListHead))
{
EnumEntry = RemoveHeadList(&CompletedListHead);
Irp = CONTAINING_RECORD(EnumEntry, IRP, Tail.Overlay.ListEntry);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
}
@ -865,7 +865,7 @@ FsRtlNotifyFullReportChange (
* FsRtlNotifyInitializeSync@4
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -888,7 +888,7 @@ FsRtlNotifyInitializeSync (
* FsRtlNotifyReportChange@20
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE

View file

@ -7,7 +7,7 @@
*
* PROGRAMMERS: No programmer listed.
*/
#include <ntoskrnl.h>
@ -16,7 +16,7 @@
* FsRtlCheckOplock@20
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -39,7 +39,7 @@ FsRtlCheckOplock(IN POPLOCK Oplock,
* FsRtlCurrentBatchOplock@4
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -58,7 +58,7 @@ FsRtlCurrentBatchOplock(IN POPLOCK Oplock)
* FsRtlInitializeOplock@4
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -79,7 +79,7 @@ FsRtlInitializeOplock(IN OUT POPLOCK Oplock)
* FsRtlOplockFsctrl@12
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -100,7 +100,7 @@ FsRtlOplockFsctrl(IN POPLOCK Oplock,
* FsRtlOplockIsFastIoPossible@4
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -119,7 +119,7 @@ FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
* FsRtlUninitializeOplock@4
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE

View file

@ -16,7 +16,7 @@
* FsRtlAllocatePool@8
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -53,7 +53,7 @@ FsRtlAllocatePool (
* FsRtlAllocatePoolWithQuota@8
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -90,7 +90,7 @@ FsRtlAllocatePoolWithQuota (
* FsRtlAllocatePoolWithQuotaTag@12
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -125,7 +125,7 @@ FsRtlAllocatePoolWithQuotaTag (
* FsRtlAllocatePoolWithTag@12
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE

View file

@ -16,7 +16,7 @@
* FsRtlAddToTunnelCache@32
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -43,7 +43,7 @@ FsRtlAddToTunnelCache (
* FsRtlDeleteKeyFromTunnelCache@12
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -65,7 +65,7 @@ FsRtlDeleteKeyFromTunnelCache (
* FsRtlDeleteTunnelCache@4
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -86,7 +86,7 @@ FsRtlDeleteTunnelCache (
* FsRtlFindInTunnelCache@32
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -114,7 +114,7 @@ FsRtlFindInTunnelCache (
* FsRtlInitializeTunnelCache@4
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE

View file

@ -16,7 +16,7 @@
* FsRtlDeregisterUncProvider@4
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE
@ -34,7 +34,7 @@ FsRtlDeregisterUncProvider(IN HANDLE Handle)
* FsRtlRegisterUncProvider@12
*
* DESCRIPTION
*
*
* ARGUMENTS
*
* RETURN VALUE

View file

@ -14,7 +14,7 @@
#define FSRTL_MAX_RESOURCES 16
#define FTTYPE ((ULONG)'f')
#define FTTYPE ((ULONG)'f')
#define FT_BALANCED_READ_MODE \
CTL_CODE(FTTYPE, 6, METHOD_NEITHER, FILE_ANY_ACCESS)
@ -32,11 +32,11 @@ INIT_FUNCTION
RtlpInitializeResources(VOID)
{
ULONG i;
/* Allocate the Resource Buffer */
FsRtlpResources = FsRtlAllocatePool(NonPagedPool,
FsRtlpResources = FsRtlAllocatePool(NonPagedPool,
FSRTL_MAX_RESOURCES*sizeof(ERESOURCE));
/* Initialize the Resources */
for (i = 0; i < FSRTL_MAX_RESOURCES; i++)
{
@ -47,7 +47,7 @@ RtlpInitializeResources(VOID)
/* FUNCTIONS *****************************************************************/
/*++
* @name FsRtlIsTotalDeviceFailure
* @name FsRtlIsTotalDeviceFailure
* @implemented NT 4.0
*
* The FsRtlIsTotalDeviceFailure routine checks if an NTSTATUS error code
@ -65,13 +65,13 @@ BOOLEAN
STDCALL
FsRtlIsTotalDeviceFailure(IN NTSTATUS NtStatus)
{
return((NT_SUCCESS(NtStatus)) ||
return((NT_SUCCESS(NtStatus)) ||
(STATUS_CRC_ERROR == NtStatus) ||
(STATUS_DEVICE_DATA_ERROR == NtStatus) ? FALSE : TRUE);
}
/*++
* @name FsRtlIsNtstatusExpected
* @name FsRtlIsNtstatusExpected
* @implemented NT 4.0
*
* The FsRtlIsNtstatusExpected routine checks if an NTSTATUS error code
@ -90,13 +90,13 @@ STDCALL
FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
{
return((STATUS_DATATYPE_MISALIGNMENT == NtStatus) ||
(STATUS_ACCESS_VIOLATION == NtStatus) ||
(STATUS_ILLEGAL_INSTRUCTION == NtStatus) ||
(STATUS_ACCESS_VIOLATION == NtStatus) ||
(STATUS_ILLEGAL_INSTRUCTION == NtStatus) ||
(STATUS_INSTRUCTION_MISALIGNMENT == NtStatus)) ? FALSE : TRUE;
}
/*++
* @name FsRtlIsPagingFile
* @name FsRtlIsPagingFile
* @implemented NT 4.0
*
* The FsRtlIsPagingFile routine checks if the FileObject is a Paging File.
@ -117,7 +117,7 @@ FsRtlIsPagingFile(IN PFILE_OBJECT FileObject)
}
/*++
* @name FsRtlNormalizeNtstatus
* @name FsRtlNormalizeNtstatus
* @implemented NT 4.0
*
* The FsRtlNormalizeNtstatus routine normalizes an NTSTATUS error code.
@ -129,7 +129,7 @@ FsRtlIsPagingFile(IN PFILE_OBJECT FileObject)
* The NTSTATUS error code to return if the NtStatusToNormalize is not
* a proper expected error code by the File System Library.
*
* @return NtStatusToNormalize if it is an expected value, otherwise
* @return NtStatusToNormalize if it is an expected value, otherwise
* NormalizedNtStatus.
*
* @remarks None.
@ -140,12 +140,12 @@ STDCALL
FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize,
IN NTSTATUS NormalizedNtStatus)
{
return(TRUE == FsRtlIsNtstatusExpected(NtStatusToNormalize)) ?
return(TRUE == FsRtlIsNtstatusExpected(NtStatusToNormalize)) ?
NtStatusToNormalize : NormalizedNtStatus;
}
/*++
* @name FsRtlAllocateResource
* @name FsRtlAllocateResource
* @implemented NT 4.0
*
* The FsRtlAllocateResource routine returns a pre-initialized ERESOURCE
@ -165,11 +165,11 @@ FsRtlAllocateResource(VOID)
}
/*++
* @name FsRtlBalanceReads
* @name FsRtlBalanceReads
* @implemented NT 4.0
*
* The FsRtlBalanceReads routine sends an IRP to an FTDISK Driver
* requesting the driver to balance read requests across a mirror set.
* requesting the driver to balance read requests across a mirror set.
*
* @param TargetDevice
* A pointer to an FTDISK Device Object.
@ -187,10 +187,10 @@ FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice)
KEVENT Event;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
/* Initialize the Local Event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
/* Build the special IOCTL */
Irp = IoBuildDeviceIoControlRequest(FT_BALANCED_READ_MODE,
TargetDevice,
@ -201,10 +201,10 @@ FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice)
FALSE,
&Event,
&IoStatusBlock);
/* Send it */
Status = IoCallDriver(TargetDevice, Irp);
/* Wait if needed */
if (Status == STATUS_PENDING)
{
@ -216,38 +216,38 @@ FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice)
/* Return Status */
Status = IoStatusBlock.Status;
}
return Status;
}
/*++
* @name FsRtlPostPagingFileStackOverflow
* @name FsRtlPostPagingFileStackOverflow
* @unimplemented NT 4.0
*
* The FsRtlPostPagingFileStackOverflow routine
*
* @param Context
* @param Context
*
* @param Event
*
* @param StackOverflowRoutine
*
* @return
* @param StackOverflowRoutine
*
* @return
*
* @remarks None.
*
*--*/
VOID
STDCALL
FsRtlPostPagingFileStackOverflow(IN PVOID Context,
IN PKEVENT Event,
IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine)
FsRtlPostPagingFileStackOverflow(IN PVOID Context,
IN PKEVENT Event,
IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine)
{
UNIMPLEMENTED;
}
/*++
* @name FsRtlPostStackOverflow
* @name FsRtlPostStackOverflow
* @unimplemented NT 4.0
*
* The FsRtlPostStackOverflow routine
@ -255,28 +255,28 @@ FsRtlPostPagingFileStackOverflow(IN PVOID Context,
* @param Context
*
* @param Event
*
* @param StackOverflowRoutine
*
* @return
* @param StackOverflowRoutine
*
* @return
*
* @remarks None.
*
*--*/
VOID
STDCALL
FsRtlPostStackOverflow(IN PVOID Context,
IN PKEVENT Event,
IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine)
FsRtlPostStackOverflow(IN PVOID Context,
IN PKEVENT Event,
IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine)
{
UNIMPLEMENTED;
}
/*++
* @name FsRtlSyncVolumes
* @name FsRtlSyncVolumes
* @implemented NT 4.0
*
* The FsRtlSyncVolumes routine is deprecated.
* The FsRtlSyncVolumes routine is deprecated.
*
* @return Always returns STATUS_SUCCESS.
*

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/inbv/inbv.c
* PURPOSE: Boot video support
*
*
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
*/

View file

@ -30,7 +30,7 @@
/* Tag */
#define CALLBACK_TAG TAG('C','L','B','K')
/* ROS Callback Object */
typedef struct _INT_CALLBACK_OBJECT {
KSPIN_LOCK Lock;
@ -55,7 +55,7 @@ typedef struct _CALLBACK_REGISTRATION {
#define CALLBACK_READ (STANDARD_RIGHTS_READ|SYNCHRONIZE|0x0001)
/* Mapping for Callback Object */
GENERIC_MAPPING ExpCallbackMapping =
GENERIC_MAPPING ExpCallbackMapping =
{
CALLBACK_READ,
CALLBACK_WRITE,

View file

@ -23,16 +23,16 @@ typedef struct _CACHE_SEGMENT
{
/* Base address of the region where the cache segment data is mapped. */
PVOID BaseAddress;
/*
* Memory area representing the region where the cache segment data is
* mapped.
/*
* Memory area representing the region where the cache segment data is
* mapped.
*/
struct _MEMORY_AREA* MemoryArea;
/* Are the contents of the cache segment data valid. */
BOOLEAN Valid;
/* Are the contents of the cache segment data newer than those on disk. */
BOOLEAN Dirty;
/* Page out in progress */
/* Page out in progress */
BOOLEAN PageOut;
ULONG MappedCount;
/* Entry in the list of segments for this BCB. */
@ -62,12 +62,12 @@ typedef struct _INTERNAL_BCB
CSHORT RefCount; /* (At offset 0x34 on WinNT4) */
} INTERNAL_BCB, *PINTERNAL_BCB;
VOID
VOID
STDCALL
CcMdlReadCompleteDev(IN PMDL MdlChain,
IN PFILE_OBJECT FileObject);
VOID
VOID
STDCALL
CcMdlWriteCompleteDev(IN PLARGE_INTEGER FileOffset,
IN PMDL MdlChain,
@ -86,13 +86,13 @@ CcRosGetCacheSegment(PBCB Bcb,
VOID
CcInitView(VOID);
NTSTATUS
NTSTATUS
CcRosFreeCacheSegment(PBCB, PCACHE_SEGMENT);
NTSTATUS
NTSTATUS
ReadCacheSegment(PCACHE_SEGMENT CacheSeg);
NTSTATUS
NTSTATUS
WriteCacheSegment(PCACHE_SEGMENT CacheSeg);
VOID CcInit(VOID);
@ -100,7 +100,7 @@ VOID CcInit(VOID);
NTSTATUS
CcRosUnmapCacheSegment(PBCB Bcb, ULONG FileOffset, BOOLEAN NowDirty);
PCACHE_SEGMENT
PCACHE_SEGMENT
CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset);
NTSTATUS
@ -109,7 +109,7 @@ CcRosGetCacheSegmentChain(PBCB Bcb,
ULONG Length,
PCACHE_SEGMENT* CacheSeg);
VOID
VOID
CcInitCacheZeroPage(VOID);
NTSTATUS
@ -118,13 +118,13 @@ CcRosMarkDirtyCacheSegment(PBCB Bcb, ULONG FileOffset);
NTSTATUS
CcRosFlushDirtyPages(ULONG Target, PULONG Count);
VOID
VOID
CcRosDereferenceCache(PFILE_OBJECT FileObject);
VOID
VOID
CcRosReferenceCache(PFILE_OBJECT FileObject);
VOID
VOID
CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer);
NTSTATUS
@ -141,7 +141,7 @@ CcRosRequestCacheSegment (BCB* Bcb,
PBOOLEAN UptoDate,
CACHE_SEGMENT** CacheSeg);
NTSTATUS
NTSTATUS
CcTryToInitializeFileCache(PFILE_OBJECT FileObject);
/*

View file

@ -4,7 +4,7 @@
* FILE: include/internal/debug.h
* PURPOSE: Useful debugging macros
* PROGRAMMER: David Welch (welch@mcmail.com)
* UPDATE HISTORY:
* UPDATE HISTORY:
* 28/05/98: Created
*/

View file

@ -185,7 +185,7 @@ static __inline _SEH_FILTER(_SEH_ExSystemExceptionFilter)
/* OTHER FUNCTIONS **********************************************************/
LONGLONG
LONGLONG
FASTCALL
ExfpInterlockedExchange64(LONGLONG volatile * Destination,
PLONGLONG Exchange);

View file

@ -1,5 +1,5 @@
/*
*
*
*/
#ifndef __INTERNAL_HAL_HAL_H

View file

@ -232,31 +232,31 @@ VOID
NtEarlyInitVdm(VOID);
VOID
KeApplicationProcessorInitDispatcher(VOID);
VOID
VOID
KeCreateApplicationProcessorIdleThread(ULONG Id);
typedef
VOID
typedef
VOID
STDCALL
(*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine,
(*PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine,
PVOID StartContext);
VOID
STDCALL
Ke386InitThreadWithContext(PKTHREAD Thread,
Ke386InitThreadWithContext(PKTHREAD Thread,
PKSYSTEM_ROUTINE SystemRoutine,
PKSTART_ROUTINE StartRoutine,
PVOID StartContext,
PCONTEXT Context);
VOID
STDCALL
KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine,
PKSTART_ROUTINE StartRoutine,
PVOID StartContext,
KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine,
PKSTART_ROUTINE StartRoutine,
PVOID StartContext,
BOOLEAN UserThread,
KTRAP_FRAME TrapFrame);
#ifdef CONFIG_SMP
#define LOCK "lock ; "
#else
@ -281,7 +281,7 @@ KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine,
#define Ke386SetLocalDescriptorTable(X) \
__asm__("lldt %0\n\t" \
: /* no outputs */ \
: "m" (X));
: "m" (X));
#define Ke386SetGlobalDescriptorTable(X) \
__asm__("lgdt %0\n\t" \
: /* no outputs */ \
@ -307,11 +307,11 @@ static inline LONG Ke386TestAndClearBit(ULONG BitPos, volatile PULONG Addr)
{
LONG OldBit;
__asm__ __volatile__(LOCK
__asm__ __volatile__(LOCK
"btrl %2,%1\n\t"
"sbbl %0,%0\n\t"
:"=r" (OldBit),"=m" (*Addr)
:"Ir" (BitPos)
:"Ir" (BitPos)
: "memory");
return OldBit;
}
@ -324,7 +324,7 @@ static inline LONG Ke386TestAndSetBit(ULONG BitPos, volatile PULONG Addr)
"btsl %2,%1\n\t"
"sbbl %0,%0\n\t"
:"=r" (OldBit),"=m" (*Addr)
:"Ir" (BitPos)
:"Ir" (BitPos)
: "memory");
return OldBit;
}

View file

@ -10,7 +10,7 @@
* Page access attributes (or these together)
*/
#define PA_READ (1<<0)
#define PA_WRITE ((1<<0)+(1<<1))
#define PA_WRITE ((1<<0)+(1<<1))
#define PA_EXECUTE PA_READ
#define PA_PCD (1<<4)
#define PA_PWT (1<<3)

View file

@ -52,7 +52,7 @@
#define KPCR_SELF 0x1C
#define KPCR_GDT 0x3C
#define KPCR_TSS 0x40
#define KPCR_CURRENT_THREAD 0x124
#define KPCR_CURRENT_THREAD 0x124
#define KPCR_NPX_THREAD 0x2A4
#ifndef __ASM__
@ -67,7 +67,7 @@ typedef struct _KPROCESSOR_STATE {
PVOID SpecialRegisters;
} KPROCESSOR_STATE;
/* ProcessoR Control Block */
/* ProcessoR Control Block */
typedef struct _KPRCB {
USHORT MinorVersion;
USHORT MajorVersion;

View file

@ -18,7 +18,7 @@ FsRtlpInitFileLockingImplementation(VOID);
VOID STDCALL
FsRtlpFileLockCancelRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
@ -30,7 +30,7 @@ FsRtlpCheckLockForReadOrWriteAccess(
IN ULONG Key,
IN PFILE_OBJECT FileObject,
IN PEPROCESS Process,
IN BOOLEAN Read
IN BOOLEAN Read
);
NTSTATUS FASTCALL

View file

@ -64,7 +64,7 @@ typedef struct _DEVOBJ_EXTENSION {
ULONG StartIoFlags;
struct _VPB *Vpb;
} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
typedef struct _PRIVATE_DRIVER_EXTENSIONS {
struct _PRIVATE_DRIVER_EXTENSIONS *Link;
PVOID ClientIdentificationAddress;
@ -382,7 +382,7 @@ IopCreateDevice(PVOID ObjectBody,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes);
NTSTATUS
NTSTATUS
STDCALL
IopAttachVpb(PDEVICE_OBJECT DeviceObject);
@ -531,14 +531,14 @@ IopReinitializeDrivers(VOID);
/* file.c */
NTSTATUS
NTSTATUS
STDCALL
IopCreateFile(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes);
VOID
VOID
STDCALL
IopDeleteFile(PVOID ObjectBody);
@ -549,19 +549,19 @@ IopSecurityFile(PVOID ObjectBody,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR SecurityDescriptor,
PULONG BufferLength);
NTSTATUS
STDCALL
IopQueryNameFile(PVOID ObjectBody,
POBJECT_NAME_INFORMATION ObjectNameInfo,
ULONG Length,
PULONG ReturnLength);
VOID
VOID
STDCALL
IopCloseFile(PVOID ObjectBody,
ULONG HandleCount);
/* plugplay.c */
NTSTATUS INIT_FUNCTION

View file

@ -19,7 +19,7 @@ extern "C" {
WORD wMaxModBits;
BYTE ModNumber[1];
} MODIFIERS, *PMODIFIERS;
#define TYPEDEF_VK_TO_WCHARS(i) \
typedef struct _VK_TO_WCHARS ## i { \
BYTE VirtualKey; \
@ -49,7 +49,7 @@ extern "C" {
WCHAR wchComposed;
USHORT uFlags;
} DEADKEY, *PDEADKEY;
typedef WCHAR *DEADKEY_LPWSTR;
#define DKF_DEAD 1
@ -106,7 +106,7 @@ typedef struct _LIGATURE ## i { \
#define CAPLOKALTGR 4
#define KANALOK 8
#define GRPSELTAP 0x80
#ifdef __cplusplus
};

View file

@ -42,7 +42,7 @@ VOID
KdbSymInit(IN PMODULE_TEXT_SECTION NtoskrnlTextSection,
IN PMODULE_TEXT_SECTION LdrHalTextSection);
BOOLEAN
BOOLEAN
KdbSymPrintAddress(IN PVOID Address);
VOID
@ -135,17 +135,17 @@ VOID
STDCALL
KdpScreenInit(struct _KD_DISPATCH_TABLE *DispatchTable,
ULONG BootPhase);
VOID
STDCALL
KdpSerialInit(struct _KD_DISPATCH_TABLE *DispatchTable,
ULONG BootPhase);
VOID
STDCALL
KdpInitDebugLog(struct _KD_DISPATCH_TABLE *DispatchTable,
ULONG BootPhase);
/* KD ROUTINES ***************************************************************/
KD_CONTINUE_TYPE
@ -156,7 +156,7 @@ KdpEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
PKTRAP_FRAME TrapFrame,
BOOLEAN FirstChance,
BOOLEAN Gdb);
ULONG
STDCALL
KdpPrintString(PANSI_STRING String);
@ -164,7 +164,7 @@ KdpPrintString(PANSI_STRING String);
BOOLEAN
STDCALL
KdpDetectConflicts(PCM_RESOURCE_LIST DriverList);
/* KD GLOBALS ***************************************************************/
/* serial debug connection */
@ -188,13 +188,13 @@ typedef struct _KDP_DEBUG_MODE
UCHAR Screen :1;
UCHAR Serial :1;
UCHAR File :1;
/* Currently Supported Wrappers */
UCHAR Pice :1;
UCHAR Gdb :1;
UCHAR Bochs :1;
};
/* Generic Value */
ULONG Value;
};
@ -222,7 +222,7 @@ typedef struct _KD_DISPATCH_TABLE
LIST_ENTRY KdProvidersList;
PKDP_INIT_ROUTINE KdpInitRoutine;
PKDP_PRINT_ROUTINE KdpPrintRoutine;
PKDP_PROMPT_ROUTINE KdpPromptRoutine;
PKDP_PROMPT_ROUTINE KdpPromptRoutine;
PKDP_EXCEPTION_ROUTINE KdpExceptionRoutine;
} KD_DISPATCH_TABLE, *PKD_DISPATCH_TABLE;
@ -243,13 +243,13 @@ extern PKDP_INIT_ROUTINE InitRoutines[KdMax];
/* Wrapper Init Function */
extern PKDP_INIT_ROUTINE WrapperInitRoutine;
/* Dispatch Tables for Native Providers */
extern KD_DISPATCH_TABLE DispatchTable[KdMax];
/* Dispatch Table for the Wrapper */
extern KD_DISPATCH_TABLE WrapperTable;
/* The KD Native Provider List */
extern LIST_ENTRY KdProviders;

View file

@ -89,7 +89,7 @@ LONG
KdbpDisassemble(
IN ULONG Address,
IN ULONG IntelSyntax);
LONG
KdbpGetInstLength(
IN ULONG Address);
@ -198,7 +198,7 @@ KdbpInsertBreakPoint(
IN PCHAR ConditionExpression OPTIONAL,
IN BOOLEAN Global,
OUT PULONG BreakPointNumber OPTIONAL);
BOOLEAN
KdbpDeleteBreakPoint(
IN LONG BreakPointNr OPTIONAL,

View file

@ -14,5 +14,5 @@ VOID
STDCALL
KdpBochsInit(struct _KD_DISPATCH_TABLE *DispatchTable,
ULONG BootPhase);
#endif /* __INCLUDE_INTERNAL_KD_BOCHS_H */

View file

@ -16,5 +16,5 @@ KdpGdbStubInit(struct _KD_DISPATCH_TABLE *DispatchTable,
ULONG BootPhase);
extern KD_PORT_INFORMATION GdbPortInfo;
#endif /* __INCLUDE_INTERNAL_KD_BOCHS_H */

View file

@ -68,20 +68,20 @@ typedef struct _KTHREAD
{
/* For waiting on thread exit */
DISPATCHER_HEADER DispatcherHeader; /* 00 */
/* List of mutants owned by the thread */
LIST_ENTRY MutantListHead; /* 10 */
PVOID InitialStack; /* 18 */
ULONG_PTR StackLimit; /* 1C */
/* Pointer to the thread's environment block in user memory */
struct _TEB *Teb; /* 20 */
/* Pointer to the thread's TLS array */
PVOID TlsArray; /* 24 */
PVOID KernelStack; /* 28 */
UCHAR DebugActive; /* 2C */
/* Thread state (one of THREAD_STATE_xxx constants below) */
UCHAR State; /* 2D */
BOOLEAN Alerted[2]; /* 2E */
@ -157,7 +157,7 @@ typedef struct _KTHREAD
} KTHREAD;
#include <poppack.h>
typedef struct _KEXECUTE_OPTIONS
{
UCHAR ExecuteDisable:1;
@ -176,7 +176,7 @@ typedef struct _KEXECUTE_OPTIONS
* KERNEL VERSION: 5.2
* DOCUMENTATION: http://reactos.com/wiki/index.php/KPROCESS
*/
typedef struct _KPROCESS
typedef struct _KPROCESS
{
DISPATCHER_HEADER Header; /* 000 */
LIST_ENTRY ProfileListHead; /* 010 */
@ -187,7 +187,7 @@ typedef struct _KPROCESS
UCHAR Iopl; /* 032 */
UCHAR Unused; /* 033 */
ULONG ActiveProcessors; /* 034 */
ULONG KernelTime; /* 038 */
ULONG KernelTime; /* 038 */
ULONG UserTime; /* 03C */
LIST_ENTRY ReadyListHead; /* 040 */
LIST_ENTRY SwapListEntry; /* 048 */
@ -195,7 +195,7 @@ typedef struct _KPROCESS
LIST_ENTRY ThreadListHead; /* 050 */
KSPIN_LOCK ProcessLock; /* 058 */
KAFFINITY Affinity; /* 05C */
union {
union {
struct {
ULONG AutoAlignment:1; /* 060.0 */
ULONG DisableBoost:1; /* 060.1 */
@ -239,7 +239,7 @@ typedef enum _KTHREAD_STATE {
Ready,
Running,
Standby,
Terminated,
Terminated,
Waiting,
Transition,
DeferredReady,
@ -253,7 +253,7 @@ typedef enum _KTHREAD_STATE {
PKTHREAD _Thread = KeGetCurrentThread(); \
if (_Thread) _Thread->KernelApcDisable--; \
}
#define KeLeaveCriticalRegion(X) \
{ \
PKTHREAD _Thread = KeGetCurrentThread(); \
@ -275,30 +275,30 @@ typedef enum _KTHREAD_STATE {
/* Thread Scheduler Functions */
/* Readies a Thread for Execution. */
VOID
VOID
STDCALL
KiDispatchThreadNoLock(ULONG NewThreadStatus);
/* Readies a Thread for Execution. */
VOID
VOID
STDCALL
KiDispatchThread(ULONG NewThreadStatus);
/* Puts a Thread into a block state. */
VOID
STDCALL
KiBlockThread(PNTSTATUS Status,
UCHAR Alertable,
KiBlockThread(PNTSTATUS Status,
UCHAR Alertable,
ULONG WaitMode,
UCHAR WaitReason);
/* Removes a thread out of a block state. */
/* Removes a thread out of a block state. */
VOID
STDCALL
KiUnblockThread(PKTHREAD Thread,
PNTSTATUS WaitStatus,
KiUnblockThread(PKTHREAD Thread,
PNTSTATUS WaitStatus,
KPRIORITY Increment);
NTSTATUS
STDCALL
KeSuspendThread(PKTHREAD Thread);
@ -306,7 +306,7 @@ KeSuspendThread(PKTHREAD Thread);
NTSTATUS
FASTCALL
KiSwapContext(PKTHREAD NewThread);
/* gmutex.c ********************************************************************/
VOID
@ -314,8 +314,8 @@ FASTCALL
KiAcquireGuardedMutexContented(PKGUARDED_MUTEX GuardedMutex);
/* gate.c **********************************************************************/
VOID
VOID
FASTCALL
KeInitializeGate(PKGATE Gate);
@ -331,16 +331,16 @@ KeWaitForGate(PKGATE Gate,
/* ipi.c ********************************************************************/
BOOLEAN STDCALL
KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
BOOLEAN STDCALL
KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
IN struct _KEXCEPTION_FRAME* ExceptionFrame);
VOID
KiIpiSendRequest(ULONG TargetSet,
VOID
KiIpiSendRequest(ULONG TargetSet,
ULONG IpiRequest);
VOID
KeIpiGenericCall(VOID (STDCALL *WorkerRoutine)(PVOID),
VOID
KeIpiGenericCall(VOID (STDCALL *WorkerRoutine)(PVOID),
PVOID Argument);
/* next file ***************************************************************/
@ -375,7 +375,7 @@ typedef enum _CACHED_MODULE_TYPE {
} CACHED_MODULE_TYPE, *PCACHED_MODULE_TYPE;
extern PLOADER_MODULE CachedModules[MaximumCachedModuleType];
VOID STDCALL
VOID STDCALL
DbgBreakPointNoBugCheck(VOID);
STDCALL
@ -419,7 +419,7 @@ KeProfileInterruptWithSource(
IN KPROFILE_SOURCE Source
);
BOOLEAN
BOOLEAN
STDCALL
KiRosPrintAddress(PVOID Address);
@ -435,8 +435,8 @@ VOID inline FASTCALL KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID);
VOID
STDCALL
KeInitializeThread(struct _KPROCESS* Process,
PKTHREAD Thread,
KeInitializeThread(struct _KPROCESS* Process,
PKTHREAD Thread,
PKSYSTEM_ROUTINE SystemRoutine,
PKSTART_ROUTINE StartRoutine,
PVOID StartContext,
@ -474,22 +474,22 @@ VOID KeDumpStackFrames(PULONG Frame);
BOOLEAN KiTestAlert(VOID);
VOID
FASTCALL
KiAbortWaitThread(PKTHREAD Thread,
FASTCALL
KiAbortWaitThread(PKTHREAD Thread,
NTSTATUS WaitStatus,
KPRIORITY Increment);
VOID
STDCALL
KeInitializeProcess(struct _KPROCESS *Process,
KPRIORITY Priority,
KAFFINITY Affinity,
LARGE_INTEGER DirectoryTableBase);
ULONG
STDCALL
KeForceResumeThread(IN PKTHREAD Thread);
BOOLEAN STDCALL KiInsertTimer(PKTIMER Timer, LARGE_INTEGER DueTime);
VOID inline FASTCALL KiSatisfyObjectWait(PDISPATCHER_HEADER Object, PKTHREAD Thread);
@ -508,18 +508,18 @@ VOID STDCALL KiDeliverApc(KPROCESSOR_MODE PreviousMode,
VOID
STDCALL
KiKernelApcDeliveryCheck(VOID);
LONG
STDCALL
KiInsertQueue(IN PKQUEUE Queue,
IN PLIST_ENTRY Entry,
LONG
STDCALL
KiInsertQueue(IN PKQUEUE Queue,
IN PLIST_ENTRY Entry,
BOOLEAN Head);
ULONG
STDCALL
KeSetProcess(struct _KPROCESS* Process,
KeSetProcess(struct _KPROCESS* Process,
KPRIORITY Increment);
VOID STDCALL KeInitializeEventPair(PKEVENT_PAIR EventPair);
VOID STDCALL KiInitializeUserApc(IN PVOID Reserved,
@ -567,7 +567,7 @@ KiMoveApcState (PKAPC_STATE OldState,
VOID
KiAddProfileEvent(KPROFILE_SOURCE Source, ULONG Pc);
VOID
VOID
KiDispatchException(PEXCEPTION_RECORD ExceptionRecord,
PCONTEXT Context,
PKTRAP_FRAME Tf,

View file

@ -35,7 +35,7 @@ LdrInitModuleManagement (
NTSTATUS
STDCALL
LdrpMapSystemDll(PEPROCESS Process,
LdrpMapSystemDll(PEPROCESS Process,
PVOID *DllBase);
NTSTATUS
@ -48,11 +48,11 @@ LdrpGetSystemDllEntryPoints(VOID);
PVOID
LdrpGetSystemDllEntryPoint (VOID);
PVOID
PVOID
LdrpGetSystemDllApcDispatcher(VOID);
PVOID
PVOID
LdrpGetSystemDllExceptionDispatcher(VOID);
PVOID
PVOID
LdrpGetSystemDllCallbackDispatcher(VOID);
PVOID
LdrpGetSystemDllRaiseExceptionDispatcher(VOID);

View file

@ -301,7 +301,7 @@ extern MM_STATS MmStats;
typedef struct _MM_PAGEOP
{
/* Type of operation. */
ULONG OpType;
ULONG OpType;
/* Number of threads interested in this operation. */
ULONG ReferenceCount;
/* Event that will be set when the operation is completed. */
@ -315,7 +315,7 @@ typedef struct _MM_PAGEOP
ULONG Hash;
struct _MM_PAGEOP* Next;
struct _ETHREAD* Thread;
/*
/*
* These fields are used to identify the operation if it is against a
* virtual memory area.
*/
@ -361,7 +361,7 @@ typedef struct _MM_REGION
LIST_ENTRY RegionListEntry;
} MM_REGION, *PMM_REGION;
typedef VOID (*PMM_FREE_PAGE_FUNC)(PVOID Context, PMEMORY_AREA MemoryArea,
typedef VOID (*PMM_FREE_PAGE_FUNC)(PVOID Context, PMEMORY_AREA MemoryArea,
PVOID Address, PFN_TYPE Page,
SWAPENTRY SwapEntry, BOOLEAN Dirty);
@ -404,12 +404,12 @@ MmCreateMemoryArea(
PMEMORY_AREA STDCALL
MmLocateMemoryAreaByAddress(
PMADDRESS_SPACE AddressSpace,
PMADDRESS_SPACE AddressSpace,
PVOID Address);
ULONG_PTR STDCALL
MmFindGapAtAddress(
PMADDRESS_SPACE AddressSpace,
PMADDRESS_SPACE AddressSpace,
PVOID Address);
NTSTATUS STDCALL
@ -431,7 +431,7 @@ MmDumpMemoryAreas(PMADDRESS_SPACE AddressSpace);
PMEMORY_AREA STDCALL
MmLocateMemoryAreaByRegion(
PMADDRESS_SPACE AddressSpace,
PMADDRESS_SPACE AddressSpace,
PVOID Address,
ULONG_PTR Length);
@ -476,7 +476,7 @@ VOID MmBuildMdlFromPages(PMDL Mdl, PULONG Pages);
VOID MiShutdownMemoryManager(VOID);
VOID MmInit1(ULONG_PTR FirstKernelPhysAddress,
VOID MmInit1(ULONG_PTR FirstKernelPhysAddress,
ULONG_PTR LastKernelPhysAddress,
ULONG_PTR LastKernelAddress,
PADDRESS_RANGE BIOSMemoryMap,
@ -507,7 +507,7 @@ BOOLEAN MmReserveSwapPages(ULONG Nr);
NTSTATUS MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_TYPE Page);
NTSTATUS STDCALL
NTSTATUS STDCALL
MmDumpToPagingFile(ULONG BugCode,
ULONG BugCodeParameter1,
ULONG BugCodeParameter2,
@ -525,7 +525,7 @@ NTSTATUS
STDCALL
MmCreateProcessAddressSpace(IN struct _EPROCESS* Process,
IN PSECTION_OBJECT Section OPTIONAL);
NTSTATUS
STDCALL
MmCreatePeb(PEPROCESS Process);
@ -535,7 +535,7 @@ STDCALL
MmCreateTeb(PEPROCESS Process,
PCLIENT_ID ClientId,
PINITIAL_TEB InitialTeb);
VOID
STDCALL
MmDeleteTeb(PEPROCESS Process,
@ -562,7 +562,7 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
/* anonmem.c *****************************************************************/
NTSTATUS MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked);
@ -632,12 +632,12 @@ MmCreateKernelStack(BOOLEAN GuiStack);
VOID
STDCALL
MmDeleteKernelStack(PVOID Stack,
MmDeleteKernelStack(PVOID Stack,
BOOLEAN GuiStack);
/* balace.c ******************************************************************/
VOID MmInitializeMemoryConsumer(ULONG Consumer,
VOID MmInitializeMemoryConsumer(ULONG Consumer,
NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed));
VOID MmInitializeBalancer(ULONG NrAvailablePages, ULONG NrSystemPages);
@ -658,7 +658,7 @@ struct _MM_RMAP_ENTRY* MmGetRmapListHeadPage(PFN_TYPE Page);
VOID MmInsertRmap(PFN_TYPE Page, PEPROCESS Process, PVOID Address);
VOID MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
VOID MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
VOID (*DeleteMapping)(PVOID Context, PEPROCESS Process, PVOID Address));
VOID MmDeleteRmap(PFN_TYPE Page, PEPROCESS Process, PVOID Address);
@ -712,7 +712,7 @@ PFN_TYPE MmChangeHyperspaceMapping(PVOID Address, PFN_TYPE Page);
PFN_TYPE MmDeleteHyperspaceMapping(PVOID Address);
NTSTATUS MmCreateVirtualMappingForKernel(PVOID Address,
NTSTATUS MmCreateVirtualMappingForKernel(PVOID Address,
ULONG flProtect,
PPFN_TYPE Pages,
ULONG PageCount);
@ -720,13 +720,13 @@ NTSTATUS MmCreateVirtualMappingForKernel(PVOID Address,
NTSTATUS MmCommitPagedPoolAddress(PVOID Address, BOOLEAN Locked);
NTSTATUS MmCreateVirtualMapping(struct _EPROCESS* Process,
PVOID Address,
PVOID Address,
ULONG flProtect,
PPFN_TYPE Pages,
ULONG PageCount);
NTSTATUS MmCreateVirtualMappingUnsafe(struct _EPROCESS* Process,
PVOID Address,
PVOID Address,
ULONG flProtect,
PPFN_TYPE Pages,
ULONG PageCount);
@ -737,7 +737,7 @@ VOID MmSetPageProtect(struct _EPROCESS* Process,
PVOID Address,
ULONG flProtect);
BOOLEAN MmIsPagePresent(struct _EPROCESS* Process,
BOOLEAN MmIsPagePresent(struct _EPROCESS* Process,
PVOID Address);
VOID MmInitGlobalKernelPageDirectory(VOID);
@ -793,10 +793,10 @@ VOID MmDeletePageTable(struct _EPROCESS* Process, PVOID Address);
PFN_TYPE MmGetPfnForProcess(struct _EPROCESS* Process, PVOID Address);
NTSTATUS
NTSTATUS
STDCALL
MmCopyMmInfo(struct _EPROCESS* Src,
struct _EPROCESS* Dest,
MmCopyMmInfo(struct _EPROCESS* Src,
struct _EPROCESS* Dest,
PPHYSICAL_ADDRESS DirectoryTableBase);
NTSTATUS MmReleaseMmInfo(struct _EPROCESS* Process);
@ -804,7 +804,7 @@ NTSTATUS MmReleaseMmInfo(struct _EPROCESS* Process);
NTSTATUS Mmi386ReleaseMmInfo(struct _EPROCESS* Process);
VOID MmDeleteVirtualMapping(struct _EPROCESS* Process,
PVOID Address,
PVOID Address,
BOOL FreePage,
BOOL* WasDirty,
PPFN_TYPE Page);
@ -827,9 +827,9 @@ NTSTATUS MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages);
/* region.c ************************************************************/
NTSTATUS MmAlterRegion(PMADDRESS_SPACE AddressSpace, PVOID BaseAddress,
PLIST_ENTRY RegionListHead, PVOID StartAddress, ULONG Length,
ULONG NewType, ULONG NewProtect,
NTSTATUS MmAlterRegion(PMADDRESS_SPACE AddressSpace, PVOID BaseAddress,
PLIST_ENTRY RegionListHead, PVOID StartAddress, ULONG Length,
ULONG NewType, ULONG NewProtect,
PMM_ALTER_REGION_FUNC AlterFunc);
VOID MmInitialiseRegion(PLIST_ENTRY RegionListHead, ULONG Length, ULONG Type,
@ -840,7 +840,7 @@ PMM_REGION MmFindRegion(PVOID BaseAddress, PLIST_ENTRY RegionListHead, PVOID Add
/* section.c *****************************************************************/
PVOID STDCALL
PVOID STDCALL
MmAllocateSection (IN ULONG Length, PVOID BaseAddress);
NTSTATUS STDCALL
@ -849,7 +849,7 @@ MmQuerySectionView(PMEMORY_AREA MemoryArea,
PMEMORY_BASIC_INFORMATION Info,
PULONG ResultLength);
NTSTATUS
NTSTATUS
MmProtectSectionView(PMADDRESS_SPACE AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID BaseAddress,
@ -857,7 +857,7 @@ MmProtectSectionView(PMADDRESS_SPACE AddressSpace,
ULONG Protect,
PULONG OldProtect);
NTSTATUS
NTSTATUS
MmWritePageSectionView(PMADDRESS_SPACE AddressSpace,
PMEMORY_AREA MArea,
PVOID Address,
@ -879,24 +879,24 @@ MmCreateSection (OUT PSECTION_OBJECT * SectionObject,
IN HANDLE FileHandle OPTIONAL,
IN PFILE_OBJECT File OPTIONAL);
NTSTATUS
NTSTATUS
MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked);
NTSTATUS
NTSTATUS
MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID Address,
struct _MM_PAGEOP* PageOp);
NTSTATUS
NTSTATUS
MmCreatePhysicalMemorySection(VOID);
NTSTATUS
NTSTATUS
MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked);

View file

@ -64,7 +64,7 @@ VOID KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock);
#endif /* __ASM__ */
/*
*
*
*/
#define MM_STACK_SIZE (3*4096)

View file

@ -36,65 +36,65 @@ typedef struct _OBJECT_TYPE
* PURPOSE: Name of the type
*/
UNICODE_STRING TypeName;
/*
* PURPOSE: Total number of objects of this type
*/
ULONG TotalObjects;
/*
* PURPOSE: Total number of handles of this type
*/
ULONG TotalHandles;
/*
* PURPOSE: Peak objects of this type
*/
ULONG PeakObjects;
/*
* PURPOSE: Peak handles of this type
*/
ULONG PeakHandles;
/*
* PURPOSE: Paged pool charge
*/
ULONG PagedPoolCharge;
/*
* PURPOSE: Nonpaged pool charge
*/
ULONG NonpagedPoolCharge;
/*
* PURPOSE: Mapping of generic access rights
*/
PGENERIC_MAPPING Mapping;
/*
* PURPOSE: Dumps the object
* NOTE: To be defined
*/
VOID STDCALL_FUNC (*Dump)(VOID);
/*
* PURPOSE: Opens the object
* NOTE: To be defined
*/
VOID STDCALL_FUNC (*Open)(VOID);
/*
* PURPOSE: Called to close an object if OkayToClose returns true
*/
VOID STDCALL_FUNC (*Close)(PVOID ObjectBody,
ULONG HandleCount);
/*
* PURPOSE: Called to delete an object when the last reference is removed
*/
VOID STDCALL_FUNC (*Delete)(PVOID ObjectBody);
/*
* PURPOSE: Called when an open attempts to open a file apparently
* residing within the object
@ -162,20 +162,20 @@ typedef struct _OBJECT_HEADER
struct _DIRECTORY_OBJECT* Parent;
POBJECT_TYPE ObjectType;
PSECURITY_DESCRIPTOR SecurityDescriptor;
/*
* PURPOSE: Object type
* NOTE: This overlaps the first member of the object body
*/
CSHORT Type;
/*
* PURPOSE: Object size
* NOTE: This overlaps the second member of the object body
*/
CSHORT Size;
} OBJECT_HEADER, *POBJECT_HEADER;
@ -183,7 +183,7 @@ typedef struct _DIRECTORY_OBJECT
{
CSHORT Type;
CSHORT Size;
/*
* PURPOSE: Head of the list of our subdirectories
*/
@ -204,7 +204,7 @@ typedef struct _TYPE_OBJECT
{
CSHORT Type;
CSHORT Size;
/* pointer to object type data */
POBJECT_TYPE ObjectType;
} TYPE_OBJECT, *PTYPE_OBJECT;
@ -327,14 +327,14 @@ ObpDereferenceCachedSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescripto
VOID
FASTCALL
ObInitializeFastReference(IN PEX_FAST_REF FastRef,
ObInitializeFastReference(IN PEX_FAST_REF FastRef,
PVOID Object);
PVOID
FASTCALL
ObFastReplaceObject(IN PEX_FAST_REF FastRef,
PVOID Object);
PVOID
FASTCALL
ObFastReferenceObject(IN PEX_FAST_REF FastRef);
@ -343,7 +343,7 @@ VOID
FASTCALL
ObFastDereferenceObject(IN PEX_FAST_REF FastRef,
PVOID Object);
/* Secure object information functions */
typedef struct _CAPTURED_OBJECT_ATTRIBUTES

View file

@ -1,8 +1,8 @@
#ifndef __INTERNAL_POOL_H
#define __INTERNAL_POOL_H
PVOID STDCALL ExAllocateNonPagedPoolWithTag (POOL_TYPE type,
ULONG size,
PVOID STDCALL ExAllocateNonPagedPoolWithTag (POOL_TYPE type,
ULONG size,
ULONG Tag,
PVOID Caller);

View file

@ -11,19 +11,19 @@ typedef struct _EPORT
{
KSPIN_LOCK Lock;
KSEMAPHORE Semaphore;
USHORT Type;
USHORT State;
struct _EPORT * RequestPort;
struct _EPORT * OtherPort;
ULONG QueueLength;
LIST_ENTRY QueueListHead;
ULONG ConnectQueueLength;
LIST_ENTRY ConnectQueueListHead;
ULONG MaxDataLength;
ULONG MaxConnectInfoLength;
ULONG MaxPoolUsage; /* size of NP zone */
@ -144,8 +144,8 @@ extern FAST_MUTEX LpcpLock;
/* Code in ntoskrnl/lpc/reply.c */
NTSTATUS STDCALL
EiReplyOrRequestPort (IN PEPORT Port,
IN PLPC_MESSAGE LpcReply,
EiReplyOrRequestPort (IN PEPORT Port,
IN PLPC_MESSAGE LpcReply,
IN ULONG MessageType,
IN PEPORT Sender);

View file

@ -69,9 +69,9 @@ static inline LONG KePPCTestAndClearBit(ULONG BitPos, volatile PULONG Addr)
{
ULONG OldValue, NewValue;
__asm__ __volatile__ ("lwarx %0,0,%1"
__asm__ __volatile__ ("lwarx %0,0,%1"
: "=r" (OldValue), "=r" (*Addr)
:
:
: "memory");
NewValue = OldValue & ~(1<<BitPos);
@ -92,9 +92,9 @@ static inline LONG KePPCTestAndSetBit(ULONG BitPos, volatile PULONG Addr)
{
ULONG OldValue, NewValue;
__asm__ __volatile__ ("lwarx %0,0,%1"
__asm__ __volatile__ ("lwarx %0,0,%1"
: "=r" (OldValue), "=r" (*Addr)
:
:
: "memory");
NewValue = OldValue | (1<<BitPos);

View file

@ -156,7 +156,7 @@ typedef struct _ETHREAD
ULONG ApcNeeded:1;
};
ULONG SameThreadPassiveFlags; /* 248 */
};
};
UCHAR ForwardClusterOnly; /* 24C */
UCHAR DisablePageFaultClustering; /* 24D */
UCHAR ActiveFaultCount; /* 24E */
@ -169,7 +169,7 @@ typedef struct _ETHREAD
typedef struct _ETHREAD *PETHREAD;
#endif /* __USE_W32API */
#include <pshpack4.h>
/*
* NAME: EPROCESS
@ -183,15 +183,15 @@ struct _EPROCESS
KPROCESS Pcb; /* 000 */
EX_PUSH_LOCK ProcessLock; /* 078 */
LARGE_INTEGER CreateTime; /* 080 */
LARGE_INTEGER ExitTime; /* 088 */
LARGE_INTEGER ExitTime; /* 088 */
EX_RUNDOWN_REF RundownProtect; /* 090 */
HANDLE UniqueProcessId; /* 094 */
LIST_ENTRY ActiveProcessLinks; /* 098 */
HANDLE UniqueProcessId; /* 094 */
LIST_ENTRY ActiveProcessLinks; /* 098 */
ULONG QuotaUsage[3]; /* 0A0 */
ULONG QuotaPeak[3]; /* 0AC */
ULONG CommitCharge; /* 0B8 */
ULONG PeakVirtualSize; /* 0BC */
ULONG VirtualSize; /* 0C0 */
ULONG CommitCharge; /* 0B8 */
ULONG PeakVirtualSize; /* 0BC */
ULONG VirtualSize; /* 0C0 */
LIST_ENTRY SessionProcessLinks; /* 0C4 */
PVOID DebugPort; /* 0CC */
PVOID ExceptionPort; /* 0D0 */
@ -284,7 +284,7 @@ struct _EPROCESS
};
ULONG Flags; /* 240 */
};
NTSTATUS ExitStatus; /* 244 */
USHORT NextPageColor; /* 248 */
union {
@ -299,13 +299,13 @@ struct _EPROCESS
ULONG Cookie; /* 270 */
/***************************************************************
* REACTOS SPECIFIC START
***************************************************************/
* REACTOS SPECIFIC START
***************************************************************/
/* FIXME WILL BE DEPRECATED WITH PUSHLOCK SUPPORT IN 0.3.0 */
KEVENT LockEvent; /* 274 */
ULONG LockCount; /* 284 */
struct _KTHREAD *LockOwner; /* 288 */
/* FIXME MOVE TO AVL TREES */
MADDRESS_SPACE AddressSpace; /* 28C */
};
@ -333,7 +333,7 @@ VOID STDCALL PiDeleteThread(PVOID ObjectBody);
VOID PsReapThreads(VOID);
VOID PsInitializeThreadReaper(VOID);
VOID PsQueueThreadReap(PETHREAD Thread);
NTSTATUS
NTSTATUS
PsInitializeThread(PEPROCESS Process,
PETHREAD* ThreadPtr,
POBJECT_ATTRIBUTES ObjectAttributes,
@ -357,12 +357,12 @@ NTSTATUS
STDCALL
PspAssignPrimaryToken(PEPROCESS Process,
HANDLE TokenHandle);
VOID STDCALL PsExitSpecialApc(PKAPC Apc,
VOID STDCALL PsExitSpecialApc(PKAPC Apc,
PKNORMAL_ROUTINE *NormalRoutine,
PVOID *NormalContext,
PVOID *SystemArgument1,
PVOID *SystemArgument2);
NTSTATUS
STDCALL
PspInitializeProcessSecurity(PEPROCESS Process,
@ -373,7 +373,7 @@ VOID
STDCALL
PspSystemThreadStartup(PKSTART_ROUTINE StartRoutine,
PVOID StartContext);
NTSTATUS
PsInitializeIdleOrFirstThread (
PEPROCESS Process,
@ -383,7 +383,7 @@ PsInitializeIdleOrFirstThread (
BOOLEAN First);
/*
* Internal thread priorities, added by Phillip Susi
* TODO: rebalence these to make use of all priorities... the ones above 16
* TODO: rebalence these to make use of all priorities... the ones above 16
* can not all be used right now
*/
#define PROCESS_PRIO_IDLE 3
@ -394,8 +394,8 @@ PsInitializeIdleOrFirstThread (
VOID STDCALL PiDeleteProcess(PVOID ObjectBody);
VOID
STDCALL
VOID
STDCALL
PspReapRoutine(PVOID Context);
VOID
@ -443,15 +443,15 @@ PiSuspendThreadNormalRoutine(PVOID NormalContext,
PVOID SystemArgument2);
VOID
PsInitialiseSuspendImplementation(VOID);
NTSTATUS
NTSTATUS
STDCALL
PspExitProcess(PEPROCESS Process);
VOID
STDCALL
VOID
STDCALL
PspDeleteProcess(PVOID ObjectBody);
VOID
VOID
STDCALL
PspDeleteThread(PVOID ObjectBody);

View file

@ -111,8 +111,8 @@ BOOLEAN SepInitSDs(VOID);
VOID SeDeassignPrimaryToken(struct _EPROCESS *Process);
NTSTATUS STDCALL
SepCreateImpersonationTokenDacl(PTOKEN Token,
NTSTATUS STDCALL
SepCreateImpersonationTokenDacl(PTOKEN Token,
PTOKEN PrimaryToken,
PACL *Dacl);
@ -156,7 +156,7 @@ SepDuplicateToken(PTOKEN Token,
SECURITY_IMPERSONATION_LEVEL Level,
KPROCESSOR_MODE PreviousMode,
PTOKEN* NewAccessToken);
NTSTATUS
SepCaptureSecurityQualityOfService(IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN KPROCESSOR_MODE AccessMode,

View file

@ -38,14 +38,14 @@
typedef struct _KV86M_TRAP_FRAME
{
KTRAP_FRAME Tf;
ULONG SavedExceptionStack;
/*
* These are put on the top of the stack by the routine that entered
* v86 mode so the exception handlers can find the control information
*/
struct _KV86M_REGISTERS* regs;
struct _KV86M_REGISTERS* regs;
ULONG orig_ebp;
} KV86M_TRAP_FRAME, *PKV86M_TRAP_FRAME;

View file

@ -53,7 +53,7 @@ typedef struct _KV86M_REGISTERS
ULONG Gs;
/*
* Control registers
* Control registers
*/
ULONG Eip;
ULONG Cs;
@ -66,7 +66,7 @@ typedef struct _KV86M_REGISTERS
*/
ULONG RecoveryAddress;
UCHAR RecoveryInstruction[4];
ULONG Vif;
ULONG Vif;
ULONG Flags;
PNTSTATUS PStatus;
} KV86M_REGISTERS, *PKV86M_REGISTERS;

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/adapter.c
* PURPOSE: DMA handling
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/arcname.c
* PURPOSE: Creates ARC names for boot devices
*
*
* PROGRAMMERS: Eric Kohl (ekohl@rz-online.de)
*/

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/bootlog.c
* PURPOSE: Boot log file support
*
*
* PROGRAMMERS: Eric Kohl
*/

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/contrller.c
* PURPOSE: Implements the controller object
*
*
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
*/
@ -45,7 +45,7 @@ IoAllocateController(PCONTROLLER_OBJECT ControllerObject,
/* Initialize the Wait Context Block */
DeviceObject->Queue.Wcb.DeviceContext = Context;
DeviceObject->Queue.Wcb.DeviceRoutine = ExecutionRoutine;
/* Insert the Device Queue */
if (!KeInsertDeviceQueue(&ControllerObject->DeviceWaitQueue,
&DeviceObject->Queue.Wcb.WaitQueueEntry));
@ -53,9 +53,9 @@ IoAllocateController(PCONTROLLER_OBJECT ControllerObject,
Result = ExecutionRoutine(DeviceObject,
DeviceObject->CurrentIrp,
NULL,
Context);
Context);
}
if (Result == DeallocateObject)
{
IoFreeController(ControllerObject);
@ -83,7 +83,7 @@ IoCreateController(ULONG Size)
/* Initialize an empty OBA */
InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL);
/* Create the Object */
Status = ObCreateObject(KernelMode,
IoControllerObjectType,
@ -95,7 +95,7 @@ IoCreateController(ULONG Size)
0,
(PVOID*)&Controller);
if (!NT_SUCCESS(Status)) return NULL;
/* Insert it */
Status = ObInsertObject(Controller,
NULL,
@ -104,16 +104,16 @@ IoCreateController(ULONG Size)
NULL,
&Handle);
if (!NT_SUCCESS(Status)) return NULL;
/* Close the dummy handle */
NtClose(Handle);
/* Zero the Object and set its data */
RtlZeroMemory(Controller, sizeof(CONTROLLER_OBJECT) + Size);
Controller->Type = IO_TYPE_CONTROLLER;
Controller->Size = sizeof(CONTROLLER_OBJECT) + Size;
Controller->ControllerExtension = (Controller + 1);
/* Initialize its Queue */
KeInitializeDeviceQueue(&Controller->DeviceWaitQueue);
@ -140,7 +140,7 @@ IoDeleteController(PCONTROLLER_OBJECT ControllerObject)
/*
* @implemented
*
* FUNCTION: Releases a previously allocated controller object when a
* FUNCTION: Releases a previously allocated controller object when a
* device has finished an I/O request
* ARGUMENTS:
* ControllerObject = Controller object to be released
@ -157,8 +157,8 @@ IoFreeController(PCONTROLLER_OBJECT ControllerObject)
if ((QueueEntry = KeRemoveDeviceQueue(&ControllerObject->DeviceWaitQueue)))
{
/* Get the Device Object */
DeviceObject = CONTAINING_RECORD(QueueEntry,
DEVICE_OBJECT,
DeviceObject = CONTAINING_RECORD(QueueEntry,
DEVICE_OBJECT,
Queue.Wcb.WaitQueueEntry);
/* Call the routine */
Result = DeviceObject->Queue.Wcb.DeviceRoutine(DeviceObject,

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS Kernel
* FILE: ntoskrnl/io/device.c
* PURPOSE: Device Object Management, including Notifications and Queues.
*
*
* PROGRAMMERS: Alex Ionescu
* David Welch (welch@cwcom.net)
*/
@ -33,7 +33,7 @@ KSPIN_LOCK ShutdownListLock;
/* PRIVATE FUNCTIONS **********************************************************/
VOID
VOID
IoShutdownRegisteredDevices(VOID)
{
PSHUTDOWN_ENTRY ShutdownEntry;
@ -75,7 +75,7 @@ IoShutdownRegisteredDevices(VOID)
}
}
NTSTATUS
NTSTATUS
FASTCALL
IopInitializeDevice(PDEVICE_NODE DeviceNode,
PDRIVER_OBJECT DriverObject)
@ -180,7 +180,7 @@ IopGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
HANDLE FileHandle;
NTSTATUS Status;
DPRINT("IoGetDeviceObjectPointer(ObjectName %wZ, DesiredAccess %x,"
DPRINT("IoGetDeviceObjectPointer(ObjectName %wZ, DesiredAccess %x,"
"FileObject %p DeviceObject %p)\n",
ObjectName, DesiredAccess, FileObject, DeviceObject);
@ -216,7 +216,7 @@ IopGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
*DeviceObject = IoGetRelatedDeviceObject(LocalFileObject);
*FileObject = LocalFileObject;
}
/* Close the handle */
ZwClose(FileHandle);
return Status;
@ -242,7 +242,7 @@ IopGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
* Status
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
IoAttachDevice(PDEVICE_OBJECT SourceDevice,
PUNICODE_STRING TargetDeviceName,
@ -251,21 +251,21 @@ IoAttachDevice(PDEVICE_OBJECT SourceDevice,
NTSTATUS Status;
PFILE_OBJECT FileObject;
PDEVICE_OBJECT TargetDevice;
/* Call the helper routine for an attach operation */
DPRINT("IoAttachDevice\n");
Status = IopGetDeviceObjectPointer(TargetDeviceName,
FILE_READ_ATTRIBUTES,
Status = IopGetDeviceObjectPointer(TargetDeviceName,
FILE_READ_ATTRIBUTES,
&FileObject,
&TargetDevice,
IO_ATTACH_DEVICE_API);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to get Device Object\n");
return Status;
}
/* Attach the device */
IoAttachDeviceToDeviceStackSafe(SourceDevice, TargetDevice, AttachedDevice);
@ -280,7 +280,7 @@ IoAttachDevice(PDEVICE_OBJECT SourceDevice,
* Status
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
IoAttachDeviceByPointer(IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice)
@ -305,20 +305,20 @@ IoAttachDeviceByPointer(IN PDEVICE_OBJECT SourceDevice,
* Status
* @implemented
*/
PDEVICE_OBJECT
PDEVICE_OBJECT
STDCALL
IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice,
PDEVICE_OBJECT TargetDevice)
{
NTSTATUS Status;
PDEVICE_OBJECT LocalAttach;
/* Attach it safely */
DPRINT("IoAttachDeviceToDeviceStack\n");
Status = IoAttachDeviceToDeviceStackSafe(SourceDevice,
TargetDevice,
&LocalAttach);
/* Return it */
DPRINT("IoAttachDeviceToDeviceStack DONE: %x\n", LocalAttach);
return LocalAttach;
@ -335,17 +335,17 @@ IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice,
{
PDEVICE_OBJECT AttachedDevice;
PDEVOBJ_EXTENSION SourceDeviceExtension;
DPRINT("IoAttachDeviceToDeviceStack(SourceDevice %x, TargetDevice %x)\n",
SourceDevice, TargetDevice);
/* Get the Attached Device and source extension */
AttachedDevice = IoGetAttachedDevice(TargetDevice);
SourceDeviceExtension = SourceDevice->DeviceObjectExtension;
/* Make sure that it's in a correct state */
if (!(AttachedDevice->DeviceObjectExtension->ExtensionFlags &
(DOE_UNLOAD_PENDING | DOE_DELETE_PENDING |
if (!(AttachedDevice->DeviceObjectExtension->ExtensionFlags &
(DOE_UNLOAD_PENDING | DOE_DELETE_PENDING |
DOE_REMOVE_PENDING | DOE_REMOVE_PROCESSED)))
{
/* Update fields */
@ -355,16 +355,16 @@ IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice,
SourceDevice->AlignmentRequirement = AttachedDevice->AlignmentRequirement;
SourceDevice->SectorSize = AttachedDevice->SectorSize;
SourceDevice->Vpb = AttachedDevice->Vpb;
/* Set the attachment in the device extension */
SourceDeviceExtension->AttachedTo = AttachedDevice;
}
else
else
{
/* Device was unloading or being removed */
AttachedDevice = NULL;
}
/* Return the attached device */
*AttachedToDeviceObject = AttachedDevice;
return STATUS_SUCCESS;
@ -402,7 +402,7 @@ IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice,
* Status
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
IoCreateDevice(PDRIVER_OBJECT DriverObject,
ULONG DeviceExtensionSize,
@ -421,38 +421,38 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
ULONG AlignedDeviceExtensionSize;
ULONG TotalSize;
HANDLE TempHandle;
ASSERT_IRQL(PASSIVE_LEVEL);
DPRINT("IoCreateDevice(DriverObject %x)\n",DriverObject);
/* Generate a name if we have to */
if (DeviceCharacteristics & FILE_AUTOGENERATED_DEVICE_NAME)
{
swprintf(AutoNameBuffer,
L"\\Device\\%08lx",
InterlockedIncrementUL(&IopDeviceObjectNumber));
InterlockedIncrementUL(&IopDeviceObjectNumber));
RtlInitUnicodeString(&AutoName, AutoNameBuffer);
DeviceName = &AutoName;
}
/* Initialize the Object Attributes */
InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL);
/* Honor exclusive flag */
ObjectAttributes.Attributes |= OBJ_EXCLUSIVE;
/* Create a permanent object for named devices */
if (DeviceName != NULL)
{
ObjectAttributes.Attributes |= OBJ_PERMANENT;
}
/* Align the Extension Size to 8-bytes */
AlignedDeviceExtensionSize = (DeviceExtensionSize + 7) &~ 7;
DPRINT("AlignedDeviceExtensionSize %x\n", AlignedDeviceExtensionSize);
/* Total Size */
TotalSize = AlignedDeviceExtensionSize +
TotalSize = AlignedDeviceExtensionSize +
sizeof(DEVICE_OBJECT) + sizeof(DEVOBJ_EXTENSION);
DPRINT("TotalSize %x\n", TotalSize);
@ -466,51 +466,51 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
0,
0,
(PVOID*)&CreatedDeviceObject);
if (!NT_SUCCESS(Status))
{
DPRINT1("IoCreateDevice() ObCreateObject failed, status: 0x%08X\n", Status);
return Status;
}
/* Clear the whole Object and extension so we don't null stuff manually */
RtlZeroMemory(CreatedDeviceObject, TotalSize);
DPRINT("CreatedDeviceObject %x\n", CreatedDeviceObject);
/*
/*
* Setup the Type and Size. Note that we don't use the aligned size,
* because that's only padding for the DevObjExt and not part of the Object.
*/
CreatedDeviceObject->Type = IO_TYPE_DEVICE;
CreatedDeviceObject->Size = sizeof(DEVICE_OBJECT) + DeviceExtensionSize;
/* The kernel extension is after the driver internal extension */
DeviceObjectExtension = (PDEVOBJ_EXTENSION)
((ULONG_PTR)(CreatedDeviceObject + 1) +
((ULONG_PTR)(CreatedDeviceObject + 1) +
AlignedDeviceExtensionSize);
/* Set the Type and Size. Question: why is Size 0 on Windows? */
DPRINT("DeviceObjectExtension %x\n", DeviceObjectExtension);
DeviceObjectExtension->Type = IO_TYPE_DEVICE_OBJECT_EXTENSION;
DeviceObjectExtension->Size = 0;
/* Link the Object and Extension */
DeviceObjectExtension->DeviceObject = CreatedDeviceObject;
CreatedDeviceObject->DeviceObjectExtension = DeviceObjectExtension;
/* Set Device Object Data */
/* Set Device Object Data */
CreatedDeviceObject->DeviceType = DeviceType;
CreatedDeviceObject->Characteristics = DeviceCharacteristics;
CreatedDeviceObject->DeviceExtension = CreatedDeviceObject + 1;
CreatedDeviceObject->StackSize = 1;
CreatedDeviceObject->AlignmentRequirement = 1; /* FIXME */
/* Set the Flags */
/* FIXME: After the Driver is Loaded, the flag below should be removed */
CreatedDeviceObject->Flags = DO_DEVICE_INITIALIZING;
if (Exclusive) CreatedDeviceObject->Flags |= DO_EXCLUSIVE;
if (DeviceName) CreatedDeviceObject->Flags |= DO_DEVICE_HAS_NAME;
/* Attach a Vpb for Disks and Tapes, and create the Device Lock */
if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK ||
CreatedDeviceObject->DeviceType == FILE_DEVICE_VIRTUAL_DISK ||
@ -519,13 +519,13 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
{
/* Create Vpb */
IopAttachVpb(CreatedDeviceObject);
/* Initialize Lock Event */
KeInitializeEvent(&CreatedDeviceObject->DeviceLock,
SynchronizationEvent,
TRUE);
}
/* Set the right Sector Size */
switch (DeviceType)
{
@ -539,7 +539,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
CreatedDeviceObject->SectorSize = 2048;
break;
}
/* Create the Device Queue */
KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue);
@ -550,22 +550,22 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
0,
NULL,
&TempHandle);
if (!NT_SUCCESS(Status))
{
DPRINT1("Cannot insert Device Object into Handle Table\n");
*DeviceObject = NULL;
return Status;
}
/* Now do the final linking */
ObReferenceObject(DriverObject);
CreatedDeviceObject->DriverObject = DriverObject;
CreatedDeviceObject->NextDevice = DriverObject->DeviceObject;
DriverObject->DeviceObject = CreatedDeviceObject;
NtClose(TempHandle);
/* Return to caller */
*DeviceObject = CreatedDeviceObject;
return STATUS_SUCCESS;
@ -577,7 +577,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
* Status
* @implemented
*/
VOID
VOID
STDCALL
IoDeleteDevice(PDEVICE_OBJECT DeviceObject)
{
@ -605,17 +605,17 @@ IoDeleteDevice(PDEVICE_OBJECT DeviceObject)
Previous = Previous->NextDevice;
Previous->NextDevice = DeviceObject->NextDevice;
}
/* I guess this should be removed later... but it shouldn't cause problems */
DeviceObject->DeviceObjectExtension->ExtensionFlags |= DOE_DELETE_PENDING;
/* Make the object temporary. This should automatically remove the device
from the namespace */
ObMakeTemporaryObject(DeviceObject);
/* Dereference the driver object */
ObDereferenceObject(DeviceObject->DriverObject);
/* Remove the keep-alive reference */
ObDereferenceObject(DeviceObject);
}
@ -629,9 +629,9 @@ IoDeleteDevice(PDEVICE_OBJECT DeviceObject)
VOID
STDCALL
IoDetachDevice(PDEVICE_OBJECT TargetDevice)
{
DPRINT("IoDetachDevice(TargetDevice %x)\n", TargetDevice);
{
DPRINT("IoDetachDevice(TargetDevice %x)\n", TargetDevice);
/* Remove the attachment */
TargetDevice->AttachedDevice->DeviceObjectExtension->AttachedTo = NULL;
TargetDevice->AttachedDevice = NULL;
@ -649,47 +649,47 @@ IoEnumerateDeviceObjectList(IN PDRIVER_OBJECT DriverObject,
{
ULONG ActualDevices = 1;
PDEVICE_OBJECT CurrentDevice = DriverObject->DeviceObject;
DPRINT1("IoEnumerateDeviceObjectList\n");
/* Find out how many devices we'll enumerate */
while ((CurrentDevice = CurrentDevice->NextDevice))
{
ActualDevices++;
}
/* Go back to the first */
CurrentDevice = DriverObject->DeviceObject;
/* Start by at least returning this */
*ActualNumberDeviceObjects = ActualDevices;
/* Check if we can support so many */
if ((ActualDevices * 4) > DeviceObjectListSize)
{
/* Fail because the buffer was too small */
return STATUS_BUFFER_TOO_SMALL;
}
/* Check if the caller only wanted the size */
if (DeviceObjectList)
if (DeviceObjectList)
{
/* Loop through all the devices */
while (ActualDevices)
{
/* Reference each Device */
ObReferenceObject(CurrentDevice);
/* Add it to the list */
*DeviceObjectList = CurrentDevice;
/* Go to the next one */
CurrentDevice = CurrentDevice->NextDevice;
ActualDevices--;
DeviceObjectList++;
}
}
/* Return the status */
return STATUS_SUCCESS;
}
@ -700,18 +700,18 @@ IoEnumerateDeviceObjectList(IN PDRIVER_OBJECT DriverObject,
* Status
* @implemented
*/
PDEVICE_OBJECT
PDEVICE_OBJECT
STDCALL
IoGetAttachedDevice(PDEVICE_OBJECT DeviceObject)
{
PDEVICE_OBJECT Current = DeviceObject;
/* Get the last attached device */
while (Current->AttachedDevice)
while (Current->AttachedDevice)
{
Current = Current->AttachedDevice;
}
/* Return it */
return Current;
}
@ -722,12 +722,12 @@ IoGetAttachedDevice(PDEVICE_OBJECT DeviceObject)
* Status
* @implemented
*/
PDEVICE_OBJECT
PDEVICE_OBJECT
STDCALL
IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
{
PDEVICE_OBJECT Current = IoGetAttachedDevice(DeviceObject);
/* Reference the ATtached Device */
ObReferenceObject(Current);
return Current;
@ -750,7 +750,7 @@ IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
* Status
* @implemented
*/
NTSTATUS
NTSTATUS
STDCALL
IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
IN ACCESS_MASK DesiredAccess,
@ -758,10 +758,10 @@ IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName,
OUT PDEVICE_OBJECT *DeviceObject)
{
/* Call the helper routine for a normal operation */
return IopGetDeviceObjectPointer(ObjectName,
DesiredAccess,
FileObject,
DeviceObject,
return IopGetDeviceObjectPointer(ObjectName,
DesiredAccess,
FileObject,
DeviceObject,
0);
}
@ -776,26 +776,26 @@ IoGetDiskDeviceObject(IN PDEVICE_OBJECT FileSystemDeviceObject,
PDEVOBJ_EXTENSION DeviceExtension;
PVPB Vpb;
KIRQL OldIrql;
/* Make sure there's a VPB */
if (!FileSystemDeviceObject->Vpb) return STATUS_INVALID_PARAMETER;
/* Acquire it */
IoAcquireVpbSpinLock(&OldIrql);
/* Get the Device Extension */
DeviceExtension = FileSystemDeviceObject->DeviceObjectExtension;
/* Make sure this one has a VPB too */
Vpb = DeviceExtension->Vpb;
if (!Vpb) return STATUS_INVALID_PARAMETER;
/* Make sure someone it's mounted */
if ((!Vpb->ReferenceCount) || (Vpb->Flags & VPB_MOUNTED)) return STATUS_VOLUME_DISMOUNTED;
/* Return the Disk Device Object */
*DiskDeviceObject = Vpb->RealDevice;
/* Release the lock */
IoReleaseVpbSpinLock(OldIrql);
return STATUS_SUCCESS;
@ -810,16 +810,16 @@ IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
{
PDEVOBJ_EXTENSION DeviceExtension = DeviceObject->DeviceObjectExtension;
PDEVICE_OBJECT LowerDeviceObject = NULL;
/* Make sure it's not getting deleted */
if (DeviceExtension->ExtensionFlags & (DOE_UNLOAD_PENDING |
if (DeviceExtension->ExtensionFlags & (DOE_UNLOAD_PENDING |
DOE_DELETE_PENDING |
DOE_REMOVE_PENDING |
DOE_REMOVE_PENDING |
DOE_REMOVE_PROCESSED))
{
/* Get the Lower Device Object */
LowerDeviceObject = DeviceExtension->AttachedTo;
/* Get the Lower Device Object */
LowerDeviceObject = DeviceExtension->AttachedTo;
/* Reference it */
ObReferenceObject(LowerDeviceObject);
}
@ -837,12 +837,12 @@ IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
* Status
* @implemented
*/
PDEVICE_OBJECT
PDEVICE_OBJECT
STDCALL
IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
{
PDEVICE_OBJECT DeviceObject = FileObject->DeviceObject;
/* Get logical volume mounted on a physical/virtual/logical device */
if (FileObject->Vpb && FileObject->Vpb->DeviceObject)
{
@ -853,7 +853,7 @@ IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
* Check if file object has an associated device object mounted by some
* other file system.
*/
if (FileObject->DeviceObject->Vpb &&
if (FileObject->DeviceObject->Vpb &&
FileObject->DeviceObject->Vpb->DeviceObject)
{
DeviceObject = FileObject->DeviceObject->Vpb->DeviceObject;
@ -878,7 +878,7 @@ IoRegisterLastChanceShutdownNotification(IN PDEVICE_OBJECT DeviceObject)
* @implemented
*/
NTSTATUS
STDCALL
STDCALL
IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
{
PSHUTDOWN_ENTRY Entry;
@ -930,10 +930,10 @@ IoStartNextPacketByKey(PDEVICE_OBJECT DeviceObject,
{
PKDEVICE_QUEUE_ENTRY entry;
PIRP Irp;
entry = KeRemoveByKeyDeviceQueue(&DeviceObject->DeviceQueue,
Key);
if (entry != NULL)
{
Irp = CONTAINING_RECORD(entry,
@ -947,7 +947,7 @@ IoStartNextPacketByKey(PDEVICE_OBJECT DeviceObject,
{
DPRINT("No next irp\n");
DeviceObject->CurrentIrp = NULL;
}
}
}
/*
@ -961,22 +961,22 @@ IoStartNextPacketByKey(PDEVICE_OBJECT DeviceObject,
*/
VOID
STDCALL
IoStartNextPacket(PDEVICE_OBJECT DeviceObject,
IoStartNextPacket(PDEVICE_OBJECT DeviceObject,
BOOLEAN Cancelable)
{
PKDEVICE_QUEUE_ENTRY entry;
PIRP Irp;
DPRINT("IoStartNextPacket(DeviceObject %x, Cancelable %d)\n",
DeviceObject,Cancelable);
entry = KeRemoveDeviceQueue(&DeviceObject->DeviceQueue);
if (entry!=NULL)
{
Irp = CONTAINING_RECORD(entry,IRP,Tail.Overlay.DeviceQueueEntry);
DeviceObject->CurrentIrp = Irp;
DeviceObject->DriverObject->DriverStartIo(DeviceObject,Irp);
DeviceObject->DriverObject->DriverStartIo(DeviceObject,Irp);
}
else
{
@ -999,24 +999,24 @@ IoStartNextPacket(PDEVICE_OBJECT DeviceObject,
VOID
STDCALL
IoStartPacket(PDEVICE_OBJECT DeviceObject,
PIRP Irp,
PULONG Key,
PIRP Irp,
PULONG Key,
PDRIVER_CANCEL CancelFunction)
{
BOOLEAN stat;
KIRQL oldirql;
DPRINT("IoStartPacket(Irp %x)\n", Irp);
ASSERT_IRQL(DISPATCH_LEVEL);
IoAcquireCancelSpinLock(&oldirql);
if (CancelFunction != NULL)
{
Irp->CancelRoutine = CancelFunction;
}
if (Key!=0)
{
stat = KeInsertByKeyDeviceQueue(&DeviceObject->DeviceQueue,
@ -1028,10 +1028,10 @@ IoStartPacket(PDEVICE_OBJECT DeviceObject,
stat = KeInsertDeviceQueue(&DeviceObject->DeviceQueue,
&Irp->Tail.Overlay.DeviceQueueEntry);
}
if (!stat)
{
{
IoReleaseCancelSpinLock(DISPATCH_LEVEL);
DeviceObject->CurrentIrp = Irp;
DeviceObject->DriverObject->DriverStartIo(DeviceObject,Irp);
@ -1061,8 +1061,8 @@ IoSynchronousInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
/*
* @implemented
*/
VOID
STDCALL
VOID
STDCALL
IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
{
PSHUTDOWN_ENTRY ShutdownEntry;

View file

@ -1,10 +1,10 @@
/* $Id:$
*
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/deviface.c
* PURPOSE: Device interface functions
*
*
* PROGRAMMERS: Filip Navara (xnavara@volny.cz)
* Matthew Brace (ismarc@austin.rr.com)
* Hervé Poussineau (hpoussin@reactos.com)
@ -53,30 +53,30 @@ IoGetDeviceInterfaceAlias(
* Returns a list of device interfaces of a particular device interface class.
*
* Parameters
* InterfaceClassGuid
* InterfaceClassGuid
* Points to a class GUID specifying the device interface class.
*
* PhysicalDeviceObject
* PhysicalDeviceObject
* Points to an optional PDO that narrows the search to only the
* device interfaces of the device represented by the PDO.
* device interfaces of the device represented by the PDO.
*
* Flags
* Flags
* Specifies flags that modify the search for device interfaces. The
* DEVICE_INTERFACE_INCLUDE_NONACTIVE flag specifies that the list of
* returned symbolic links should contain also disabled device
* interfaces in addition to the enabled ones.
* interfaces in addition to the enabled ones.
*
* SymbolicLinkList
* SymbolicLinkList
* Points to a character pointer that is filled in on successful return
* with a list of unicode strings identifying the device interfaces
* that match the search criteria. The newly allocated buffer contains
* a list of symbolic link names. Each unicode string in the list is
* null-terminated; the end of the whole list is marked by an additional
* NULL. The caller is responsible for freeing the buffer (ExFreePool)
* when it is no longer needed.
* when it is no longer needed.
* If no device interfaces match the search criteria, this routine
* returns STATUS_SUCCESS and the string contains a single NULL
* character.
* character.
*
* Status
* @implemented
@ -117,7 +117,7 @@ IoGetDeviceInterfaces(
ULONG i = 0;
ULONG j = 0;
OBJECT_ATTRIBUTES ObjectAttributes;
Status = RtlStringFromGUID(InterfaceClassGuid, &GuidString);
if (!NT_SUCCESS(Status))
{
@ -159,17 +159,17 @@ IoGetDeviceInterfaces(
}
DPRINT("IoGetDeviceInterfaces() called with PDO, not implemented.\n");
return STATUS_NOT_IMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
else
{
{
InitializeObjectAttributes(
&ObjectAttributes,
&BaseKeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = ZwOpenKey(
&InterfaceKey,
KEY_READ,
@ -206,7 +206,7 @@ IoGetDeviceInterfaces(
fip,
Size,
&Size);
if (!NT_SUCCESS(Status))
{
DPRINT("ZwQueryKey() Failed. (0x%X)\n", Status);
@ -239,7 +239,7 @@ IoGetDeviceInterfaces(
bip = (PKEY_BASIC_INFORMATION)ExAllocatePool(NonPagedPool, Size);
ASSERT(bip != NULL);
Status = ZwEnumerateKey(
InterfaceKey,
i,
@ -247,7 +247,7 @@ IoGetDeviceInterfaces(
bip,
Size,
&Size);
if (!NT_SUCCESS(Status))
{
DPRINT("ZwEnumerateKey() Failed.(0x%X)\n", Status);
@ -259,7 +259,7 @@ IoGetDeviceInterfaces(
ZwClose(InterfaceKey);
return Status;
}
SubKeyName.Length = 0;
SubKeyName.MaximumLength = BaseKeyName.Length + bip->NameLength + sizeof(WCHAR);
SubKeyName.Buffer = ExAllocatePool(NonPagedPool, SubKeyName.MaximumLength);
@ -323,7 +323,7 @@ IoGetDeviceInterfaces(
bfip,
Size,
&Size);
if (!NT_SUCCESS(Status))
{
DPRINT("ZwQueryKey() Failed. (0x%X)\n", Status);
@ -334,7 +334,7 @@ IoGetDeviceInterfaces(
ZwClose(InterfaceKey);
return Status;
}
for(j = 0; j < bfip->SubKeys; j++)
{
Status = ZwEnumerateKey(
@ -387,12 +387,12 @@ IoGetDeviceInterfaces(
ZwClose(InterfaceKey);
return Status;
}
if (!wcsncmp(bip->Name, L"Control", bip->NameLength))
{
continue;
}
SymbolicLinkKeyName.Length = 0;
SymbolicLinkKeyName.MaximumLength = SubKeyName.Length + bip->NameLength + sizeof(WCHAR);
SymbolicLinkKeyName.Buffer = ExAllocatePool(NonPagedPool, SymbolicLinkKeyName.MaximumLength);
@ -409,7 +409,7 @@ IoGetDeviceInterfaces(
ASSERT(ControlKeyName.Buffer != NULL);
RtlCopyUnicodeString(&ControlKeyName, &SymbolicLinkKeyName);
RtlAppendUnicodeStringToString(&ControlKeyName, &Control);
ExFreePool(bip);
InitializeObjectAttributes(
@ -440,16 +440,16 @@ IoGetDeviceInterfaces(
}
Status = ZwQueryValueKey(
SymbolicLinkKey,
&SymbolicLink,
SymbolicLinkKey,
&SymbolicLink,
KeyValuePartialInformation,
NULL,
0,
&Size);
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
continue;
if (Status != STATUS_BUFFER_TOO_SMALL)
{
DPRINT("ZwQueryValueKey() Failed.(0x%X)\n", Status);
@ -497,7 +497,7 @@ IoGetDeviceInterfaces(
Status = RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, ControlKeyName.Buffer);
if (NT_SUCCESS(Status))
{
{
/* Put the name in the string here */
if (SymLinkList == NULL)
{
@ -525,7 +525,7 @@ IoGetDeviceInterfaces(
RtlCopyMemory(SymLinkListPtr, vpip->Data, vpip->DataLength);
SymLinkListPtr[vpip->DataLength / sizeof(WCHAR)] = 0;
SymLinkListPtr[1] = '?';
}
}
}
RtlFreeUnicodeString(&SymbolicLinkKeyName);
@ -549,7 +549,7 @@ IoGetDeviceInterfaces(
}
*SymbolicLinkList = SymLinkList;
RtlFreeUnicodeString(&BaseKeyName);
ZwClose(InterfaceKey);
ExFreePool(bfip);
@ -584,20 +584,20 @@ IoRegisterDeviceInterface(
OBJECT_ATTRIBUTES ObjectAttributes;
ULONG i;
NTSTATUS Status;
if (!(PhysicalDeviceObject->Flags & DO_BUS_ENUMERATED_DEVICE))
{
DPRINT("PhysicalDeviceObject 0x%p is not a valid Pdo\n", PhysicalDeviceObject);
return STATUS_INVALID_PARAMETER_1;
}
Status = RtlStringFromGUID(InterfaceClassGuid, &GuidString);
if (!NT_SUCCESS(Status))
{
DPRINT("RtlStringFromGUID() failed with status 0x%08lx\n", Status);
return Status;
}
/* Create Pdo name: \Device\xxxxxxxx (unnamed device) */
Status = ObQueryNameString(
PhysicalDeviceObject,
@ -610,7 +610,7 @@ IoRegisterDeviceInterface(
return Status;
}
ASSERT(PdoNameInfo->Name.Length);
/* Create base key name for this interface: HKLM\SYSTEM\CurrentControlSet\DeviceClasses\{GUID}\##?#ACPI#PNP0501#1#{GUID} */
ASSERT(PhysicalDeviceObject->DeviceObjectExtension->DeviceNode);
InstancePath = &PhysicalDeviceObject->DeviceObjectExtension->DeviceNode->InstancePath;
@ -641,7 +641,7 @@ IoRegisterDeviceInterface(
}
RtlAppendUnicodeToString(&BaseKeyName, L"#");
RtlAppendUnicodeStringToString(&BaseKeyName, &GuidString);
/* Create BaseKeyName key in registry */
InitializeObjectAttributes(
&ObjectAttributes,
@ -649,7 +649,7 @@ IoRegisterDeviceInterface(
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE | OBJ_OPENIF,
NULL, /* RootDirectory */
NULL); /* SecurityDescriptor */
Status = ZwCreateKey(
&InterfaceKey,
KEY_WRITE,
@ -658,14 +658,14 @@ IoRegisterDeviceInterface(
NULL, /* Class */
REG_OPTION_VOLATILE,
NULL); /* Disposition */
if (!NT_SUCCESS(Status))
{
DPRINT("ZwCreateKey() failed with status 0x%08lx\n", Status);
ExFreePool(BaseKeyName.Buffer);
return Status;
}
/* Write DeviceInstance entry. Value is InstancePath */
Status = ZwSetValueKey(
InterfaceKey,
@ -681,7 +681,7 @@ IoRegisterDeviceInterface(
ExFreePool(BaseKeyName.Buffer);
return Status;
}
/* Create subkey. Name is #ReferenceString */
SubKeyName.Length = 0;
SubKeyName.MaximumLength = sizeof(WCHAR);
@ -700,7 +700,7 @@ IoRegisterDeviceInterface(
RtlAppendUnicodeToString(&SubKeyName, L"#");
if (ReferenceString && ReferenceString->Length)
RtlAppendUnicodeStringToString(&SubKeyName, ReferenceString);
/* Create SubKeyName key in registry */
InitializeObjectAttributes(
&ObjectAttributes,
@ -708,7 +708,7 @@ IoRegisterDeviceInterface(
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
InterfaceKey, /* RootDirectory */
NULL); /* SecurityDescriptor */
Status = ZwCreateKey(
&SubKey,
KEY_WRITE,
@ -717,7 +717,7 @@ IoRegisterDeviceInterface(
NULL, /* Class */
REG_OPTION_VOLATILE,
NULL); /* Disposition */
if (!NT_SUCCESS(Status))
{
DPRINT("ZwCreateKey() failed with status 0x%08lx\n", Status);
@ -725,7 +725,7 @@ IoRegisterDeviceInterface(
ExFreePool(BaseKeyName.Buffer);
return Status;
}
/* Create symbolic link name: \??\ACPI#PNP0501#1#{GUID}\ReferenceString */
SymbolicLinkName->Length = 0;
SymbolicLinkName->MaximumLength = SymbolicLinkName->Length
@ -764,7 +764,7 @@ IoRegisterDeviceInterface(
RtlAppendUnicodeStringToString(SymbolicLinkName, ReferenceString);
}
SymbolicLinkName->Buffer[SymbolicLinkName->Length] = '\0';
/* Create symbolic link */
DPRINT("IoRegisterDeviceInterface(): creating symbolic link %wZ -> %wZ\n", SymbolicLinkName, &PdoNameInfo->Name);
Status = IoCreateSymbolicLink(SymbolicLinkName, &PdoNameInfo->Name);
@ -778,7 +778,7 @@ IoRegisterDeviceInterface(
ExFreePool(SymbolicLinkName->Buffer);
return Status;
}
/* Write symbolic link name in registry */
Status = ZwSetValueKey(
SubKey,
@ -792,12 +792,12 @@ IoRegisterDeviceInterface(
DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status);
ExFreePool(SymbolicLinkName->Buffer);
}
ZwClose(InterfaceKey);
ZwClose(SubKey);
ExFreePool(SubKeyName.Buffer);
ExFreePool(BaseKeyName.Buffer);
return Status;
}
@ -816,10 +816,10 @@ IoSetDeviceInterfaceState(
PWCHAR StartPosition;
PWCHAR EndPosition;
NTSTATUS Status;
if (SymbolicLinkName == NULL)
return STATUS_INVALID_PARAMETER_1;
DPRINT("IoSetDeviceInterfaceState('%wZ', %d)\n", SymbolicLinkName, Enable);
Status = IoGetDeviceObjectPointer(SymbolicLinkName,
0, /* DesiredAccess */
@ -827,7 +827,7 @@ IoSetDeviceInterfaceState(
&PhysicalDeviceObject);
if (!NT_SUCCESS(Status))
return Status;
/* Symbolic link name is \??\ACPI#PNP0501#1#{GUID}\ReferenceString */
/* Get GUID from SymbolicLinkName */
StartPosition = wcschr(SymbolicLinkName->Buffer, L'{');
@ -836,16 +836,16 @@ IoSetDeviceInterfaceState(
return STATUS_INVALID_PARAMETER_1;
GuidString.Buffer = StartPosition;
GuidString.MaximumLength = GuidString.Length = (ULONG_PTR)(EndPosition + 1) - (ULONG_PTR)StartPosition;
IopNotifyPlugPlayNotification(
PhysicalDeviceObject,
EventCategoryDeviceInterfaceChange,
Enable ? (LPGUID)&GUID_DEVICE_INTERFACE_ARRIVAL : (LPGUID)&GUID_DEVICE_INTERFACE_REMOVAL,
&GuidString,
(PVOID)SymbolicLinkName);
ObDereferenceObject(FileObject);
return STATUS_SUCCESS;
}

View file

@ -1389,7 +1389,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
/* Set ending CHS values */
PartitionSector->Partition[j].EndingCylinder = EndCylinder & 0xff;
PartitionSector->Partition[j].EndingHead = EndHead;
PartitionSector->Partition[j].EndingSector =
PartitionSector->Partition[j].EndingSector =
((EndCylinder & 0x0300) >> 2) + (EndSector & 0x3f);
/* Calculate start sector and sector count */
@ -1433,7 +1433,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
if (IsContainerPartition (PartitionBuffer->PartitionEntry[i + j].PartitionType))
{
ContainerEntry = TRUE;
NextPartitionOffset =
NextPartitionOffset =
PartitionBuffer->PartitionEntry[i + j].StartingOffset.QuadPart;
#if defined(__GNUC__)

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/driver.c
* PURPOSE: Loading and unloading of drivers
*
*
* PROGRAMMERS: David Welch (welch@cwcom.net)
* Filip Navara (xnavara@volny.cz)
*/
@ -121,7 +121,7 @@ IopInitDriverImplementation(VOID)
InitializeListHead(&DriverReinitListHead);
KeInitializeSpinLock(&DriverReinitListLock);
DriverReinitTailEntry = NULL;
InitializeListHead(&DriverBootReinitListHead);
KeInitializeSpinLock(&DriverBootReinitListLock);
DriverBootReinitTailEntry = NULL;
@ -235,7 +235,7 @@ IopCreateDriverObject(
RtlInitUnicodeString(&DriverName, NameBuffer);
DPRINT("Driver name: '%wZ'\n", &DriverName);
Buffer = (PWSTR)ExAllocatePool(NonPagedPool, DriverName.Length);
/* If we don't success, it is not a problem. Our driver
* object will not have associated driver name... */
@ -548,9 +548,9 @@ IopInitializeDriverModule(
UNICODE_STRING RegistryKey;
PDRIVER_INITIALIZE DriverEntry;
NTSTATUS Status;
DriverEntry = ModuleObject->EntryPoint;
if (ServiceName != NULL && ServiceName->Length != 0)
{
RegistryKey.Length = 0;
@ -588,9 +588,9 @@ IopInitializeDriverModule(
IopMarkLastReinitializeDriver();
Status = DriverEntry(*DriverObject, &RegistryKey);
RtlFreeUnicodeString(&RegistryKey);
if (!NT_SUCCESS(Status))
{
ObMakeTemporaryObject(*DriverObject);
@ -624,7 +624,7 @@ IopAttachFilterDriversCallback(
PMODULE_OBJECT ModuleObject;
PDRIVER_OBJECT DriverObject;
NTSTATUS Status;
for (Filters = ValueData;
((ULONG_PTR)Filters - (ULONG_PTR)ValueData) < ValueLength &&
*Filters != 0;
@ -632,7 +632,7 @@ IopAttachFilterDriversCallback(
{
DPRINT("Filter Driver: %S (%wZ)\n", Filters, &DeviceNode->InstancePath);
ServiceName.Buffer = Filters;
ServiceName.MaximumLength =
ServiceName.MaximumLength =
ServiceName.Length = wcslen(Filters) * sizeof(WCHAR);
/* Load and initialize the filter driver */
@ -694,7 +694,7 @@ IopAttachFilterDrivers(
/*
* First load the device filters
*/
QueryTable[0].QueryRoutine = IopAttachFilterDriversCallback;
if (Lower)
QueryTable[0].Name = L"LowerFilters";
@ -706,10 +706,10 @@ IopAttachFilterDrivers(
QueryTable[1].Name = NULL;
KeyBuffer = ExAllocatePool(
PagedPool,
PagedPool,
(49 * sizeof(WCHAR)) + DeviceNode->InstancePath.Length);
wcscpy(KeyBuffer, L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\");
wcscat(KeyBuffer, DeviceNode->InstancePath.Buffer);
wcscat(KeyBuffer, DeviceNode->InstancePath.Buffer);
RtlQueryRegistryValues(
RTL_REGISTRY_ABSOLUTE,
@ -766,11 +766,11 @@ IopAttachFilterDrivers(
ExFreePool(KeyBuffer);
}
return STATUS_SUCCESS;
}
static NTSTATUS STDCALL
static NTSTATUS STDCALL
IopGetGroupOrderList(PWSTR ValueName,
ULONG ValueType,
PVOID ValueData,
@ -1223,7 +1223,7 @@ IopInitializeBuiltinDriver(
Status = IopInitializeDriverModule(DeviceNode, ModuleObject,
&DeviceNode->ServiceName, FALSE, &DriverObject);
if (!NT_SUCCESS(Status))
{
if (ModuleDeviceNode == NULL)
@ -1244,7 +1244,7 @@ IopInitializeBuiltinDriver(
*
* Parameters
* None
*
*
* Return Value
* None
*/
@ -1336,20 +1336,20 @@ IopLoadDriver(PSERVICE Service)
if (Service->ErrorControl == 1)
{
/* Log error */
}
}
else if (Service->ErrorControl == 2)
{
if (IsLastKnownGood == FALSE)
{
/* Boot last known good configuration */
}
}
}
else if (Service->ErrorControl == 3)
{
if (IsLastKnownGood == FALSE)
{
/* Boot last known good configuration */
}
}
else
{
/* BSOD! */
@ -1368,7 +1368,7 @@ IopLoadDriver(PSERVICE Service)
*
* Parameters
* None
*
*
* Return Value
* None
*/
@ -1392,7 +1392,7 @@ IopInitializeSystemDrivers(VOID)
DPRINT("Group: %wZ\n", &CurrentGroup->GroupName);
/* Load all drivers with a valid tag */
/* Load all drivers with a valid tag */
for (i = 0; i < CurrentGroup->TagCount; i++)
{
ServiceEntry = ServiceListHead.Flink;
@ -1456,7 +1456,7 @@ IopInitializeSystemDrivers(VOID)
* Whether to unload Plug & Plug or only legacy drivers. If this
* parameter is set to FALSE, the routine will unload only legacy
* drivers.
*
*
* Return Value
* Status
*
@ -1670,22 +1670,22 @@ IoCreateDriver (
UNICODE_STRING ServiceKeyName;
HANDLE hDriver;
ULONG i;
/* First, create a unique name for the driver if we don't have one */
if (!DriverName) {
/* Create a random name and set up the string*/
NameLength = swprintf(NameBuffer, L"\\Driver\\%08u", KeTickCount);
LocalDriverName.Length = NameLength * sizeof(WCHAR);
LocalDriverName.MaximumLength = LocalDriverName.Length + sizeof(UNICODE_NULL);
LocalDriverName.Buffer = NameBuffer;
} else {
/* So we can avoid another code path, use a local var */
LocalDriverName = *DriverName;
}
/* Initialize the Attributes */
ObjectSize = sizeof(DRIVER_OBJECT) + sizeof(DRIVER_EXTENSION);
InitializeObjectAttributes(&ObjectAttributes,
@ -1693,7 +1693,7 @@ IoCreateDriver (
OBJ_PERMANENT | OBJ_CASE_INSENSITIVE,
NULL,
NULL);
/* Create the Object */
Status = ObCreateObject(KernelMode,
IoDriverObjectType,
@ -1704,10 +1704,10 @@ IoCreateDriver (
0,
0,
(PVOID*)&DriverObject);
/* Return on failure */
if (!NT_SUCCESS(Status)) return Status;
/* Set up the Object */
RtlZeroMemory(DriverObject, ObjectSize);
DriverObject->Type = IO_TYPE_DRIVER;
@ -1716,13 +1716,13 @@ IoCreateDriver (
DriverObject->DriverExtension = (PDRIVER_EXTENSION)(DriverObject + 1);
DriverObject->DriverExtension->DriverObject = DriverObject;
DriverObject->DriverInit = InitializationFunction;
/* Invalidate all Major Functions */
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
{
DriverObject->MajorFunction[i] = IopInvalidDeviceRequest;
}
/* Set up the Service Key Name */
ServiceKeyName.Buffer = ExAllocatePool(PagedPool, LocalDriverName.Length + sizeof(WCHAR));
ServiceKeyName.Length = LocalDriverName.Length;
@ -1730,10 +1730,10 @@ IoCreateDriver (
RtlMoveMemory(ServiceKeyName.Buffer, LocalDriverName.Buffer, LocalDriverName.Length);
ServiceKeyName.Buffer[ServiceKeyName.Length / sizeof(WCHAR)] = L'\0';
DriverObject->DriverExtension->ServiceKeyName = ServiceKeyName;
/* Also store it in the Driver Object. This is a bit of a hack. */
RtlMoveMemory(&DriverObject->DriverName, &ServiceKeyName, sizeof(UNICODE_STRING));
/* Add the Object and get its handle */
Status = ObInsertObject(DriverObject,
NULL,
@ -1741,10 +1741,10 @@ IoCreateDriver (
0,
NULL,
&hDriver);
/* Return on Failure */
if (!NT_SUCCESS(Status)) return Status;
/* Now reference it */
Status = ObReferenceObjectByHandle(hDriver,
0,
@ -1753,16 +1753,16 @@ IoCreateDriver (
(PVOID*)&DriverObject,
NULL);
ZwClose(hDriver);
/* Finally, call its init function */
Status = (*InitializationFunction)(DriverObject, NULL);
if (!NT_SUCCESS(Status)) {
/* If it didn't work, then kill the object */
ObMakeTemporaryObject(DriverObject);
ObDereferenceObject(DriverObject);
}
/* Return the Status */
return Status;
}
@ -1789,7 +1789,7 @@ IoDeleteDriver (
* Parameters
* DriverServiceName
* Name of the service to load (registry key).
*
*
* Return Value
* Status
*
@ -1811,9 +1811,9 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
PMODULE_OBJECT ModuleObject;
PDRIVER_OBJECT DriverObject;
WCHAR *cur;
PAGED_CODE();
PreviousMode = KeGetPreviousMode();
/*
@ -1969,7 +1969,7 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
}
IopInitializeDevice(DeviceNode, DriverObject);
ReleaseCapturedString:
RtlReleaseCapturedUnicodeString(&CapturedDriverServiceName,
PreviousMode,
@ -1986,7 +1986,7 @@ ReleaseCapturedString:
* Parameters
* DriverServiceName
* Name of the service to unload (registry key).
*
*
* Return Value
* Status
*
@ -2022,7 +2022,7 @@ IoRegisterDriverReinitialization(
ReinitItem->DriverObject = DriverObject;
ReinitItem->ReinitRoutine = ReinitRoutine;
ReinitItem->Context = Context;
DriverObject->Flags |= DRVO_REINIT_REGISTERED;
ExInterlockedInsertTailList(
@ -2051,7 +2051,7 @@ IoRegisterBootDriverReinitialization(
ReinitItem->DriverObject = DriverObject;
ReinitItem->ReinitRoutine = DriverReinitializationRoutine;
ReinitItem->Context = Context;
DriverObject->Flags |= DRVO_BOOTREINIT_REGISTERED;
ExInterlockedInsertTailList(
@ -2086,9 +2086,9 @@ IoAllocateDriverObjectExtension(
if (NewDriverExtension == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
return STATUS_INSUFFICIENT_RESOURCES;
}
OldIrql = KeRaiseIrqlToDpcLevel();
NewDriverExtension->Link = DriverObject->DriverSection;
@ -2112,7 +2112,7 @@ IoAllocateDriverObjectExtension(
*DriverObjectExtension = &NewDriverExtension->Extension;
return STATUS_SUCCESS;
return STATUS_SUCCESS;
}
/*

View file

@ -1,9 +1,9 @@
/*
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/efi.c
* PURPOSE: EFI Unimplemented Function Calls
*
*
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
*/
@ -24,7 +24,7 @@ NtAddBootEntry(
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
STDCALL
NtDeleteBootEntry(
@ -35,7 +35,7 @@ NtDeleteBootEntry(
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
STDCALL
NtEnumerateBootEntries(
@ -46,7 +46,7 @@ NtEnumerateBootEntries(
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
STDCALL
NtQueryBootEntryOrder(
@ -57,7 +57,7 @@ NtQueryBootEntryOrder(
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
STDCALL
NtQueryBootOptions(
@ -68,7 +68,7 @@ NtQueryBootOptions(
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
STDCALL
NtSetBootEntryOrder(
@ -79,22 +79,22 @@ NtSetBootEntryOrder(
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
STDCALL
NTSTATUS
STDCALL
NtSetBootOptions(
ULONG Unknown1,
ULONG Unknown1,
ULONG Unknown2
)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
STDCALL
}
NTSTATUS
STDCALL
NtTranslateFilePath(
ULONG Unknown1,
ULONG Unknown1,
ULONG Unknown2,
ULONG Unknown3
)

View file

@ -457,7 +457,7 @@ IopFreeApc(PKAPC Apc,
{
/* Free the APC */
ExFreePool(Apc);
}
}
VOID
STDCALL
@ -470,25 +470,25 @@ IopRaiseHardError(PKAPC Apc,
PIRP Irp = (PIRP)NormalContext;
//PVPB Vpb = (PVPB)SystemArgument1;
//PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)SystemArgument2;
/* FIXME: UNIMPLEMENTED */
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
}
}
/*
* @implemented
*/
VOID
STDCALL
VOID
STDCALL
IoRaiseHardError(PIRP Irp,
PVPB Vpb,
PDEVICE_OBJECT RealDeviceObject)
{
PETHREAD Thread = (PETHREAD)&Irp->Tail.Overlay.Thread;
PKAPC ErrorApc;
/* Don't do anything if hard errors are disabled on the thread */
if (Thread->HardErrorsAreDisabled)
{
@ -497,10 +497,10 @@ IoRaiseHardError(PIRP Irp,
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
return;
}
/* Setup an APC */
ErrorApc = ExAllocatePoolWithTag(NonPagedPool,
sizeof(KAPC),
ErrorApc = ExAllocatePoolWithTag(NonPagedPool,
sizeof(KAPC),
TAG('K', 'A', 'P', 'C'));
KeInitializeApc(ErrorApc,
&Thread->Tcb,
@ -510,7 +510,7 @@ IoRaiseHardError(PIRP Irp,
(PKNORMAL_ROUTINE)IopRaiseHardError,
KernelMode,
Irp);
/* Queue an APC to deal with the error (see osr documentation) */
KeInsertQueueApc(ErrorApc, Vpb, RealDeviceObject, 0);
}
@ -518,8 +518,8 @@ IoRaiseHardError(PIRP Irp,
/*
* @unimplemented
*/
BOOLEAN
STDCALL
BOOLEAN
STDCALL
IoRaiseInformationalHardError(NTSTATUS ErrorStatus,
PUNICODE_STRING String,
PKTHREAD Thread)
@ -543,7 +543,7 @@ IoRaiseInformationalHardError(NTSTATUS ErrorStatus,
*
* @implemented
*/
BOOLEAN
BOOLEAN
STDCALL
IoSetThreadHardErrorMode(IN BOOLEAN HardErrorEnabled)
{

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/event.c
* PURPOSE: Implements named events
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/
@ -68,7 +68,7 @@ IoCreateSynchronizationEvent(PUNICODE_STRING EventName,
PKEVENT Event;
HANDLE Handle;
NTSTATUS Status;
PreviousMode = ExGetPreviousMode();
InitializeObjectAttributes(&ObjectAttributes,

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,10 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/fs.c
* PURPOSE: Filesystem functions
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/
@ -152,7 +152,7 @@ NtFsControlFile (
StackPtr->FileObject = FileObject;
StackPtr->DeviceObject = DeviceObject;
StackPtr->Parameters.FileSystemControl.InputBufferLength = InputBufferSize;
StackPtr->Parameters.FileSystemControl.OutputBufferLength =
StackPtr->Parameters.FileSystemControl.OutputBufferLength =
OutputBufferSize;
StackPtr->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
@ -672,7 +672,7 @@ IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject)
* If the FILE_OBJECT's VPB is defined,
* get the device from it.
*/
if (NULL != (Vpb = FileObject->Vpb))
if (NULL != (Vpb = FileObject->Vpb))
{
if (NULL != (DeviceObject = Vpb->DeviceObject))
{
@ -685,7 +685,7 @@ IoGetBaseFileSystemDeviceObject(IN PFILE_OBJECT FileObject)
* in the FILE_OBJECT's DeviceObject.
*/
DeviceObject = FileObject->DeviceObject;
if (NULL == (Vpb = DeviceObject->Vpb))
if (NULL == (Vpb = DeviceObject->Vpb))
{
/* DeviceObject->Vpb UNDEFINED! */
return DeviceObject;

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/iocomp.c
* PURPOSE: No purpose listed.
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/
@ -13,13 +13,13 @@
#define NDEBUG
#include <internal/debug.h>
#define IOC_TAG TAG('I', 'O', 'C', 'T')
#define IOC_TAG TAG('I', 'O', 'C', 'T')
POBJECT_TYPE ExIoCompletionType;
NPAGED_LOOKASIDE_LIST IoCompletionPacketLookaside;
static GENERIC_MAPPING ExIoCompletionMapping =
static GENERIC_MAPPING ExIoCompletionMapping =
{
STANDARD_RIGHTS_READ | IO_COMPLETION_QUERY_STATE,
STANDARD_RIGHTS_WRITE | IO_COMPLETION_MODIFY_STATE,
@ -35,7 +35,7 @@ static const INFORMATION_CLASS_INFO ExIoCompletionInfoClass[] = {
/* FUNCTIONS *****************************************************************/
VOID
VOID
STDCALL
IopDeleteIoCompletion(PVOID ObjectBody)
{
@ -48,19 +48,19 @@ IopDeleteIoCompletion(PVOID ObjectBody)
/* Rundown the Queue */
FirstEntry = KeRundownQueue(Queue);
/* Clean up the IRPs */
if (FirstEntry) {
CurrentEntry = FirstEntry;
do {
/* Get the Packet */
Packet = CONTAINING_RECORD(CurrentEntry, IO_COMPLETION_PACKET, ListEntry);
/* Go to next Entry */
CurrentEntry = CurrentEntry->Flink;
/* Free it */
ExFreeToNPagedLookasideList(&IoCompletionPacketLookaside, Packet);
} while (FirstEntry != CurrentEntry);
@ -85,13 +85,13 @@ IoSetIoCompletion(IN PVOID IoCompletion,
/* Allocate the Packet */
Packet = ExAllocateFromNPagedLookasideList(&IoCompletionPacketLookaside);
if (NULL == Packet) return STATUS_NO_MEMORY;
/* Set up the Packet */
Packet->Key = KeyContext;
Packet->Context = ApcContext;
Packet->IoStatus.Status = IoStatus;
Packet->IoStatus.Information = IoStatusInformation;
/* Insert the Queue */
KeInsertQueue(Queue, &Packet->ListEntry);
@ -121,7 +121,7 @@ FASTCALL
IopInitIoCompletionImplementation(VOID)
{
/* Create the IO Completion Type */
ExIoCompletionType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
ExIoCompletionType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
RtlInitUnicodeString(&ExIoCompletionType->TypeName, L"IoCompletion");
ExIoCompletionType->Tag = IOC_TAG;
ExIoCompletionType->PeakObjects = 0;
@ -163,7 +163,7 @@ NtCreateIoCompletion(OUT PHANDLE IoCompletionHandle,
HANDLE hIoCompletionHandle;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
if (PreviousMode != KernelMode) {
@ -177,7 +177,7 @@ NtCreateIoCompletion(OUT PHANDLE IoCompletionHandle,
Status = _SEH_GetExceptionCode();
} _SEH_END;
if (!NT_SUCCESS(Status)) {
return Status;
@ -194,10 +194,10 @@ NtCreateIoCompletion(OUT PHANDLE IoCompletionHandle,
0,
0,
(PVOID*)&Queue);
/* Check for success */
if (NT_SUCCESS(Status)) {
/* Initialize the Queue */
KeInitializeQueue(Queue, NumberOfConcurrentThreads);
@ -209,7 +209,7 @@ NtCreateIoCompletion(OUT PHANDLE IoCompletionHandle,
NULL,
&hIoCompletionHandle);
ObDereferenceObject(Queue);
if (NT_SUCCESS(Status)) {
_SEH_TRY {
@ -221,7 +221,7 @@ NtCreateIoCompletion(OUT PHANDLE IoCompletionHandle,
} _SEH_END;
}
}
/* Return Status */
return Status;
}
@ -235,9 +235,9 @@ NtOpenIoCompletion(OUT PHANDLE IoCompletionHandle,
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
HANDLE hIoCompletionHandle;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
if(PreviousMode != KernelMode) {
_SEH_TRY {
@ -255,7 +255,7 @@ NtOpenIoCompletion(OUT PHANDLE IoCompletionHandle,
return Status;
}
}
/* Open the Object */
Status = ObOpenObjectByName(ObjectAttributes,
ExIoCompletionType,
@ -264,7 +264,7 @@ NtOpenIoCompletion(OUT PHANDLE IoCompletionHandle,
DesiredAccess,
NULL,
&hIoCompletionHandle);
if (NT_SUCCESS(Status)) {
_SEH_TRY {
@ -275,8 +275,8 @@ NtOpenIoCompletion(OUT PHANDLE IoCompletionHandle,
Status = _SEH_GetExceptionCode();
} _SEH_END;
}
/* Return Status */
/* Return Status */
return Status;
}
@ -292,7 +292,7 @@ NtQueryIoCompletion(IN HANDLE IoCompletionHandle,
PKQUEUE Queue;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Check buffers and parameters */
@ -316,10 +316,10 @@ NtQueryIoCompletion(IN HANDLE IoCompletionHandle,
PreviousMode,
(PVOID*)&Queue,
NULL);
/* Check for Success */
if (NT_SUCCESS(Status)) {
_SEH_TRY {
/* Return Info */
@ -358,7 +358,7 @@ NtRemoveIoCompletion(IN HANDLE IoCompletionHandle,
PLIST_ENTRY ListEntry;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
if (PreviousMode != KernelMode) {
@ -386,13 +386,13 @@ NtRemoveIoCompletion(IN HANDLE IoCompletionHandle,
Status = _SEH_GetExceptionCode();
} _SEH_END;
if (!NT_SUCCESS(Status)) {
return Status;
}
}
/* Open the Object */
Status = ObReferenceObjectByHandle(IoCompletionHandle,
IO_COMPLETION_MODIFY_STATE,
@ -400,7 +400,7 @@ NtRemoveIoCompletion(IN HANDLE IoCompletionHandle,
PreviousMode,
(PVOID*)&Queue,
NULL);
/* Check for success */
if (NT_SUCCESS(Status)) {
@ -409,21 +409,21 @@ NtRemoveIoCompletion(IN HANDLE IoCompletionHandle,
/* If we got a timeout or user_apc back, return the status */
if ((NTSTATUS)ListEntry == STATUS_TIMEOUT || (NTSTATUS)ListEntry == STATUS_USER_APC) {
Status = (NTSTATUS)ListEntry;
Status = (NTSTATUS)ListEntry;
} else {
/* Get the Packet Data */
Packet = CONTAINING_RECORD(ListEntry, IO_COMPLETION_PACKET, ListEntry);
_SEH_TRY {
/* Return it */
*CompletionKey = Packet->Key;
*CompletionContext = Packet->Context;
*IoStatusBlock = Packet->IoStatus;
} _SEH_HANDLE {
Status = _SEH_GetExceptionCode();
@ -432,11 +432,11 @@ NtRemoveIoCompletion(IN HANDLE IoCompletionHandle,
/* Free packet */
ExFreeToNPagedLookasideList(&IoCompletionPacketLookaside, Packet);
}
/* Dereference the Object */
ObDereferenceObject(Queue);
}
/* Return status */
return Status;
}
@ -454,9 +454,9 @@ NtSetIoCompletion(IN HANDLE IoCompletionPortHandle,
{
NTSTATUS Status;
PKQUEUE Queue;
PAGED_CODE();
/* Get the Object */
Status = ObReferenceObjectByHandle(IoCompletionPortHandle,
IO_COMPLETION_MODIFY_STATE,
@ -464,20 +464,20 @@ NtSetIoCompletion(IN HANDLE IoCompletionPortHandle,
ExGetPreviousMode(),
(PVOID*)&Queue,
NULL);
/* Check for Success */
if (NT_SUCCESS(Status)) {
/* Set the Completion */
Status = IoSetIoCompletion(Queue,
CompletionKey,
Status = IoSetIoCompletion(Queue,
CompletionKey,
CompletionContext,
CompletionStatus,
CompletionInformation,
CompletionStatus,
CompletionInformation,
TRUE);
ObDereferenceObject(Queue);
}
/* Return status */
return Status;
}

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS Kernel
* FILE: ntoskrnl/io/iomgr.c
* PURPOSE: I/O Manager Initialization and Misc Utility Functions
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/
@ -36,21 +36,21 @@ GENERIC_MAPPING IopFileMapping = {
FILE_GENERIC_WRITE,
FILE_GENERIC_EXECUTE,
FILE_ALL_ACCESS};
static KSPIN_LOCK CancelSpinLock;
extern LIST_ENTRY ShutdownListHead;
extern KSPIN_LOCK ShutdownListLock;
/* INIT FUNCTIONS ************************************************************/
VOID
VOID
INIT_FUNCTION
IoInitCancelHandling(VOID)
{
KeInitializeSpinLock(&CancelSpinLock);
}
VOID
VOID
INIT_FUNCTION
IoInitShutdownNotification (VOID)
{
@ -68,13 +68,13 @@ IoInit (VOID)
HANDLE Handle;
IopInitDriverImplementation();
/*
* Register iomgr types: DeviceObjectType
*/
IoDeviceObjectType = ExAllocatePool (NonPagedPool,
sizeof (OBJECT_TYPE));
IoDeviceObjectType->Tag = TAG_DEVICE_TYPE;
IoDeviceObjectType->TotalObjects = 0;
IoDeviceObjectType->TotalHandles = 0;
@ -93,7 +93,7 @@ IoInit (VOID)
IoDeviceObjectType->OkayToClose = NULL;
IoDeviceObjectType->Create = NULL;
IoDeviceObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device");
ObpCreateTypeObject(IoDeviceObjectType);
@ -103,7 +103,7 @@ IoInit (VOID)
* (alias DriverObjectType)
*/
IoFileObjectType = ExAllocatePool (NonPagedPool, sizeof (OBJECT_TYPE));
IoFileObjectType->Tag = TAG_FILE_TYPE;
IoFileObjectType->TotalObjects = 0;
IoFileObjectType->TotalHandles = 0;
@ -122,11 +122,11 @@ IoInit (VOID)
IoFileObjectType->OkayToClose = NULL;
IoFileObjectType->Create = IopCreateFile;
IoFileObjectType->DuplicationNotify = NULL;
RtlInitUnicodeString(&IoFileObjectType->TypeName, L"File");
ObpCreateTypeObject(IoFileObjectType);
/*
* Register iomgr types: AdapterObjectType
*/
@ -237,7 +237,7 @@ IoInit (VOID)
PnpInit();
}
VOID
VOID
INIT_FUNCTION
IoInit2(BOOLEAN BootLog)
{
@ -247,7 +247,7 @@ IoInit2(BOOLEAN BootLog)
NTSTATUS Status;
IoCreateDriverList();
KeInitializeSpinLock (&IoStatisticsLock);
/* Initialize raw filesystem driver */
@ -293,10 +293,10 @@ IoInit2(BOOLEAN BootLog)
IopInvalidateDeviceRelations(
IopRootDeviceNode,
BusRelations);
/* Start boot logging */
IopInitBootLog(BootLog);
/* Load boot start drivers */
IopInitializeBootDrivers();
}
@ -307,7 +307,7 @@ INIT_FUNCTION
IoInit3(VOID)
{
NTSTATUS Status;
/* Create ARC names for boot devices */
IoCreateArcNames();
@ -339,7 +339,7 @@ IoInit3(VOID)
IoAssignDriveLetters((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock,
NULL,
NULL,
NULL);
NULL);
}
/* FUNCTIONS *****************************************************************/
@ -347,8 +347,8 @@ IoInit3(VOID)
/*
* @implemented
*/
VOID
STDCALL
VOID
STDCALL
IoAcquireCancelSpinLock(PKIRQL Irql)
{
KeAcquireSpinLock(&CancelSpinLock,Irql);
@ -357,7 +357,7 @@ IoAcquireCancelSpinLock(PKIRQL Irql)
/*
* @implemented
*/
PVOID
PVOID
STDCALL
IoGetInitialStack(VOID)
{
@ -367,7 +367,7 @@ IoGetInitialStack(VOID)
/*
* @implemented
*/
VOID
VOID
STDCALL
IoGetStackLimits(OUT PULONG LowLimit,
OUT PULONG HighLimit)
@ -403,7 +403,7 @@ IoIsWdmVersionAvailable(IN UCHAR MajorVersion,
* @implemented
*/
VOID
STDCALL
STDCALL
IoReleaseCancelSpinLock(KIRQL Irql)
{
KeReleaseSpinLock(&CancelSpinLock,Irql);

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/iowork.c
* PURPOSE: Manage IO system work queues
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
* Robert Dickenson (odin@pnc.com.au)
*/
@ -44,9 +44,9 @@ IoWorkItemCallback(PVOID Parameter)
* @implemented
*/
VOID STDCALL
IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem,
IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem,
IN PIO_WORKITEM_ROUTINE WorkerRoutine,
IN WORK_QUEUE_TYPE QueueType,
IN WORK_QUEUE_TYPE QueueType,
IN PVOID Context)
/*
* FUNCTION: Inserts a work item in a queue for one of the system worker
@ -56,7 +56,7 @@ IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem,
* QueueType = Queue to insert it in
*/
{
ExInitializeWorkItem(&IoWorkItem->Item, IoWorkItemCallback,
ExInitializeWorkItem(&IoWorkItem->Item, IoWorkItemCallback,
(PVOID)IoWorkItem);
IoWorkItem->WorkerRoutine = WorkerRoutine;
IoWorkItem->Context = Context;
@ -83,8 +83,8 @@ PIO_WORKITEM STDCALL
IoAllocateWorkItem(PDEVICE_OBJECT DeviceObject)
{
PIO_WORKITEM IoWorkItem = NULL;
IoWorkItem =
IoWorkItem =
ExAllocatePoolWithTag(NonPagedPool, sizeof(IO_WORKITEM), TAG_IOWI);
if (IoWorkItem == NULL)
{

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/irp.c
* PURPOSE: Handle IRPs
*
*
* PROGRAMMERS: Hartmut Birr
* Alex Ionescu (alex@relsoft.net)
* David Welch (welch@mcmail.com)
@ -22,7 +22,7 @@
/* PRIVATE FUNCTIONS ********************************************************/
VOID
VOID
STDCALL
IopFreeIrpKernelApc(PKAPC Apc,
PKNORMAL_ROUTINE *NormalRoutine,
@ -34,7 +34,7 @@ IopFreeIrpKernelApc(PKAPC Apc,
IoFreeIrp(CONTAINING_RECORD(Apc, IRP, Tail.Apc));
}
VOID
VOID
STDCALL
IopAbortIrpKernelApc(PKAPC Apc)
{
@ -44,7 +44,7 @@ IopAbortIrpKernelApc(PKAPC Apc)
/*
* FUNCTION: Performs the second stage of irp completion for read/write irps
*
*
* Called as a special kernel APC kernel-routine or directly from IofCompleteRequest()
*
* Note that we'll never see irp's flagged IRP_PAGING_IO (IRP_MOUNT_OPERATION)
@ -52,7 +52,7 @@ IopAbortIrpKernelApc(PKAPC Apc)
* cleanup/completion is fully taken care of in IoCompleteRequest.
* -Gunnar
*/
VOID
VOID
STDCALL
IopCompleteRequest(PKAPC Apc,
PKNORMAL_ROUTINE* NormalRoutine,
@ -67,15 +67,15 @@ IopCompleteRequest(PKAPC Apc,
BOOLEAN SyncIrp;
if (Apc) DPRINT("IoSecondStageCompletition with APC: %x\n", Apc);
/* Get data from the APC */
FileObject = (PFILE_OBJECT)(*SystemArgument1);
Irp = CONTAINING_RECORD(Apc, IRP, Tail.Apc);
DPRINT("IoSecondStageCompletition, %x\n", Irp);
/* Save the User Event */
UserEvent = Irp->UserEvent;
/* Remember if the IRP is Sync or not */
SyncIrp = Irp->Flags & IRP_SYNCHRONOUS_API ? TRUE : FALSE;
@ -90,17 +90,17 @@ IopCompleteRequest(PKAPC Apc,
Irp->AssociatedIrp.SystemBuffer,
Irp->IoStatus.Information);
}
/* Also check if we should de-allocate it */
if (Irp->Flags & IRP_DEALLOCATE_BUFFER)
{
ExFreePoolWithTag(Irp->AssociatedIrp.SystemBuffer, TAG_SYS_BUF);
}
}
/* Now we got rid of these two... */
Irp->Flags &= ~(IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER);
/* Check if there's an MDL */
while ((Mdl = Irp->MdlAddress))
{
@ -111,15 +111,15 @@ IopCompleteRequest(PKAPC Apc,
/* Remove the IRP from the list of Thread Pending IRPs */
RemoveEntryList(&Irp->ThreadListEntry);
InitializeListHead(&Irp->ThreadListEntry);
InitializeListHead(&Irp->ThreadListEntry);
#if 1
/* Check for Success but allow failure for Async IRPs */
if (NT_SUCCESS(Irp->IoStatus.Status) ||
if (NT_SUCCESS(Irp->IoStatus.Status) ||
(Irp->PendingReturned &&
!SyncIrp &&
(FileObject == NULL || FileObject->Flags & FO_SYNCHRONOUS_IO)))
{
{
_SEH_TRY
{
/* Save the IOSB Information */
@ -130,7 +130,7 @@ IopCompleteRequest(PKAPC Apc,
/* Ignore any error */
}
_SEH_END;
/* Check if there's an event */
if (UserEvent)
{
@ -163,9 +163,9 @@ IopCompleteRequest(PKAPC Apc,
/* Signal the File Object Instead */
KeSetEvent(&FileObject->Event, 0, FALSE);
}
/* Now call the User APC if one was requested */
if (Irp->Overlay.AsynchronousParameters.UserApcRoutine != NULL)
{
@ -197,7 +197,7 @@ IopCompleteRequest(PKAPC Apc,
}
}
else
{
{
/* Signal the Events only if PendingReturned and we have a File Object */
if (FileObject && Irp->PendingReturned)
{
@ -214,7 +214,7 @@ IopCompleteRequest(PKAPC Apc,
/* Ignore any error */
}
_SEH_END;
/* Signal our event if we have one */
if (UserEvent)
{
@ -229,7 +229,7 @@ IopCompleteRequest(PKAPC Apc,
else
{
#if 1
/* FIXME: This is necessary to fix bug #609 */
/* FIXME: This is necessary to fix bug #609 */
_SEH_TRY
{
*Irp->UserIosb = Irp->IoStatus;
@ -242,27 +242,27 @@ IopCompleteRequest(PKAPC Apc,
#endif
/* We'll report the Status to the File Object, not the IRP */
FileObject->FinalStatus = Irp->IoStatus.Status;
/* Signal the File Object ONLY if this was Async */
KeSetEvent(&FileObject->Event, 0, FALSE);
}
}
/* Dereference the Event if it's an ASYNC IRP on a File Object */
if (UserEvent && !SyncIrp && FileObject)
{
if (UserEvent != &FileObject->Event)
{
ObDereferenceObject(UserEvent);
}
}
}
}
}
/* Dereference the File Object */
if (FileObject) ObDereferenceObject(FileObject);
/* Free the IRP */
if (Irp) IoFreeIrp(Irp);
if (Irp) IoFreeIrp(Irp);
#else
@ -294,7 +294,7 @@ IopCompleteRequest(PKAPC Apc,
}
}
}
/* Signal the user event, if one exist */
if (UserEvent)
{
@ -331,7 +331,7 @@ IopCompleteRequest(PKAPC Apc,
Irp = NULL;
}
}
/* Free the Irp if it hasn't already */
if (Irp) IoFreeIrp(Irp);
@ -339,7 +339,7 @@ IopCompleteRequest(PKAPC Apc,
{
/* Dereference the user event, if it is an event object */
/* FIXME: Remove last check when I/O code is fixed */
if (UserEvent && !SyncIrp && UserEvent != &FileObject->Event)
if (UserEvent && !SyncIrp && UserEvent != &FileObject->Event)
{
ObDereferenceObject(UserEvent);
}
@ -361,14 +361,14 @@ IopCompleteRequest(PKAPC Apc,
* ChargeQuota = Charge allocation to current threads quota
* RETURNS: Irp allocated
*/
PIRP
PIRP
STDCALL
IoAllocateIrp(CCHAR StackSize,
BOOLEAN ChargeQuota)
{
PIRP Irp;
USHORT Size = IoSizeOfIrp(StackSize);
/* Check if we shoudl charge quota */
if (ChargeQuota)
{
@ -391,7 +391,7 @@ IoAllocateIrp(CCHAR StackSize,
/* Now Initialize it */
IoInitializeIrp(Irp, Size, StackSize);
/* Return it */
return Irp;
}
@ -401,7 +401,7 @@ IoAllocateIrp(CCHAR StackSize,
*
* FUNCTION: Allocates and sets up an IRP to be sent to lower level drivers
* ARGUMENTS:
* MajorFunction = One of IRP_MJ_READ, IRP_MJ_WRITE,
* MajorFunction = One of IRP_MJ_READ, IRP_MJ_WRITE,
* IRP_MJ_FLUSH_BUFFERS or IRP_MJ_SHUTDOWN
* DeviceObject = Device object to send the irp to
* Buffer = Buffer into which data will be read or written
@ -431,17 +431,17 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
/* Allocate IRP */
if (!(Irp = IoAllocateIrp(DeviceObject->StackSize,TRUE))) return Irp;
/* Get the Stack */
StackPtr = IoGetNextIrpStackLocation(Irp);
/* Write the Major function and then deal with it */
StackPtr->MajorFunction = (UCHAR)MajorFunction;
StackPtr->MajorFunction = (UCHAR)MajorFunction;
/* Do not handle the following here */
if (MajorFunction != IRP_MJ_FLUSH_BUFFERS &&
MajorFunction != IRP_MJ_SHUTDOWN &&
MajorFunction != IRP_MJ_PNP)
MajorFunction != IRP_MJ_PNP)
{
/* Check if this is Buffered IO */
if (DeviceObject->Flags & DO_BUFFERED_IO)
@ -450,10 +450,10 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
Irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithTag(NonPagedPool,
Length,
TAG_SYS_BUF);
/* Set flags */
Irp->Flags = IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER;
/* Handle special IRP_MJ_WRITE Case */
if (MajorFunction == IRP_MJ_WRITE)
{
@ -471,7 +471,7 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
{
/* Use an MDL for Direct I/O */
Irp->MdlAddress = MmCreateMdl(NULL, Buffer, Length);
/* Use the right Access Type */
if (MajorFunction == IRP_MJ_READ)
{
@ -481,7 +481,7 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
{
AccessType = IoWriteAccess;
}
/* Probe and Lock */
_SEH_FILTER(FreeAndGoOn)
{
@ -489,7 +489,7 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
IoFreeMdl(Irp->MdlAddress);
IoFreeIrp(Irp);
return EXCEPTION_CONTINUE_SEARCH;
}
}
_SEH_TRY
{
/* Do the probe */
@ -504,10 +504,10 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
Irp = NULL;
}
_SEH_END;
if (!Irp)
return NULL;
}
}
else
{
/* Neither, use the buffer */
@ -525,12 +525,12 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
StackPtr->Parameters.Write.ByteOffset = *StartingOffset;
}
}
/* Set the Current Thread and IOSB */
if (!IoStatusBlock) KEBUGCHECK(0); /* Temporary to catch illegal ROS Drivers */
Irp->UserIosb = IoStatusBlock;
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
/* Set the Status Block after all is done */
return Irp;
}
@ -716,7 +716,7 @@ IoBuildDeviceIoControlRequest (ULONG IoControlCode,
Irp = NULL;
}
_SEH_END;
if (!Irp)
return NULL;
}
@ -760,7 +760,7 @@ IoBuildDeviceIoControlRequest (ULONG IoControlCode,
* RETURNS: The IRP allocated on success, or
* NULL on failure
*/
PIRP
PIRP
STDCALL
IoBuildSynchronousFsdRequest(ULONG MajorFunction,
PDEVICE_OBJECT DeviceObject,
@ -771,12 +771,12 @@ IoBuildSynchronousFsdRequest(ULONG MajorFunction,
PIO_STATUS_BLOCK IoStatusBlock)
{
PIRP Irp;
DPRINT("IoBuildSynchronousFsdRequest(MajorFunction %x, DeviceObject %x, "
"Buffer %x, Length %x, StartingOffset %x, Event %x, "
"IoStatusBlock %x\n",MajorFunction,DeviceObject,Buffer,Length,
StartingOffset,Event,IoStatusBlock);
/* Do the big work to set up the IRP */
Irp = IoBuildAsynchronousFsdRequest(MajorFunction,
DeviceObject,
@ -784,7 +784,7 @@ IoBuildSynchronousFsdRequest(ULONG MajorFunction,
Length,
StartingOffset,
IoStatusBlock );
/* Set the Event which makes it Syncronous */
Irp->UserEvent = Event;
@ -796,26 +796,26 @@ IoBuildSynchronousFsdRequest(ULONG MajorFunction,
/*
* @implemented
*/
BOOLEAN
STDCALL
BOOLEAN
STDCALL
IoCancelIrp(PIRP Irp)
{
KIRQL oldlvl;
PDRIVER_CANCEL CancelRoutine;
DPRINT("IoCancelIrp(Irp %x)\n",Irp);
IoAcquireCancelSpinLock(&oldlvl);
Irp->Cancel = TRUE;
CancelRoutine = IoSetCancelRoutine(Irp, NULL);
if (CancelRoutine == NULL)
{
IoReleaseCancelSpinLock(oldlvl);
return(FALSE);
}
Irp->CancelIrql = oldlvl;
CancelRoutine(IoGetCurrentIrpStackLocation(Irp)->DeviceObject, Irp);
return(TRUE);
@ -830,7 +830,7 @@ IoCancelIrp(PIRP Irp)
* Thread to cancel requests for.
*/
VOID
VOID
STDCALL
IoCancelThreadIo(PETHREAD Thread)
{
@ -877,7 +877,7 @@ IoCancelThreadIo(PETHREAD Thread)
DPRINT1("Thread with dead IRPs!");
ASSERT(FALSE);
}
OldIrql = KfRaiseIrql(APC_LEVEL);
}
@ -901,7 +901,7 @@ IoCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* @implemented
*/
VOID
VOID
STDCALL
IoCompleteRequest(PIRP Irp,
CCHAR PriorityBoost)
@ -913,7 +913,7 @@ IoCompleteRequest(PIRP Irp,
/*
* @implemented
*/
VOID
VOID
STDCALL
IoEnqueueIrp(IN PIRP Irp)
{
@ -925,7 +925,7 @@ IoEnqueueIrp(IN PIRP Irp)
*
* FUNCTION: Sends an IRP to the next lower driver
*/
NTSTATUS
NTSTATUS
FASTCALL
IofCallDriver(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
@ -938,10 +938,10 @@ IofCallDriver(PDEVICE_OBJECT DeviceObject,
/* Get the Driver Object */
DriverObject = DeviceObject->DriverObject;
/* Set the Stack Location */
IoSetNextIrpStackLocation(Irp);
/* Get the current one */
Param = IoGetCurrentIrpStackLocation(Irp);
@ -949,7 +949,7 @@ IofCallDriver(PDEVICE_OBJECT DeviceObject,
/* Get the Device Object */
Param->DeviceObject = DeviceObject;
/* Call it */
return DriverObject->MajorFunction[Param->MajorFunction](DeviceObject, Irp);
}
@ -967,7 +967,7 @@ IofCallDriver(PDEVICE_OBJECT DeviceObject,
* PriorityBoost = Increment by which to boost the priority of the
* thread making the request
*/
VOID
VOID
FASTCALL
IofCompleteRequest(PIRP Irp,
CCHAR PriorityBoost)
@ -985,17 +985,17 @@ IofCompleteRequest(PIRP Irp,
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
ASSERT(!Irp->CancelRoutine);
ASSERT(Irp->IoStatus.Status != STATUS_PENDING);
/* Get the Current Stack */
StackPtr = IoGetCurrentIrpStackLocation(Irp);
IoSkipCurrentIrpStackLocation(Irp);
/* Loop the Stacks and complete the IRPs */
for (;Irp->CurrentLocation <= (Irp->StackCount + 1); StackPtr++)
{
/* Set Pending Returned */
Irp->PendingReturned = StackPtr->Control & SL_PENDING_RETURNED;
/*
* Completion routines expect the current irp stack location to be the same as when
* IoSetCompletionRoutine was called to set them. A side effect is that completion
@ -1014,9 +1014,9 @@ IofCompleteRequest(PIRP Irp,
}
/* Check if there is a Completion Routine to Call */
if ((NT_SUCCESS(Irp->IoStatus.Status) &&
if ((NT_SUCCESS(Irp->IoStatus.Status) &&
(StackPtr->Control & SL_INVOKE_ON_SUCCESS)) ||
(!NT_SUCCESS(Irp->IoStatus.Status) &&
(!NT_SUCCESS(Irp->IoStatus.Status) &&
(StackPtr->Control & SL_INVOKE_ON_ERROR)) ||
(Irp->Cancel && (StackPtr->Control & SL_INVOKE_ON_CANCEL)))
{
@ -1035,10 +1035,10 @@ IofCompleteRequest(PIRP Irp,
if (IoGetCurrentIrpStackLocation(Irp)->Control & SL_PENDING_RETURNED)
{
Irp->PendingReturned = TRUE;
}
}
}
}
/* Move to next stack */
IoSkipCurrentIrpStackLocation(Irp);
}
@ -1055,7 +1055,7 @@ IofCompleteRequest(PIRP Irp,
/* Decrement and get the old count */
MasterIrpCount = InterlockedDecrement(&MasterIrp->AssociatedIrp.IrpCount);
/* Free MDLs and IRP */
while ((Mdl = Irp->MdlAddress))
{
@ -1063,7 +1063,7 @@ IofCompleteRequest(PIRP Irp,
IoFreeMdl(Mdl);
}
IoFreeIrp(Irp);
/* Complete the Master IRP */
if (!MasterIrpCount) IofCompleteRequest(MasterIrp, IO_NO_INCREMENT);
return;
@ -1083,14 +1083,14 @@ IofCompleteRequest(PIRP Irp,
DPRINT("Handling Sync Paging or Close I/O\n");
*Irp->UserIosb = Irp->IoStatus;
KeSetEvent(Irp->UserEvent, PriorityBoost, FALSE);
/* Free the IRP for a Paging I/O Only, Close is handled by us */
if (Irp->Flags & IRP_SYNCHRONOUS_PAGING_IO)
{
DPRINT("Handling Sync Paging I/O\n");
IoFreeIrp(Irp);
}
}
}
else
{
DPRINT1("BUG BUG, YOU SHOULDNT BE HERE\n");
@ -1121,7 +1121,7 @@ IofCompleteRequest(PIRP Irp,
DPRINT("Unlocking MDL: %x\n", Mdl);
MmUnlockPages(Mdl);
Mdl = Mdl->Next;
}
}
/* Check if we should exit because of a Deferred I/O (page 168) */
if (Irp->Flags & IRP_DEFER_IO_COMPLETION && !Irp->PendingReturned)
@ -1129,7 +1129,7 @@ IofCompleteRequest(PIRP Irp,
DPRINT("Quick return\n");
return;
}
/* Now queue the special APC */
if (!Irp->Cancel)
{
@ -1173,7 +1173,7 @@ IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject,
* ARGUMENTS:
* Irp = Irp to free
*/
VOID
VOID
STDCALL
IoFreeIrp(PIRP Irp)
{
@ -1209,14 +1209,14 @@ IoGetRequestorSessionId(IN PIRP Irp,
OUT PULONG pSessionId)
{
*pSessionId = IoGetRequestorProcess(Irp)->Session;
return STATUS_SUCCESS;
}
/*
* @implemented
*/
PIRP
PIRP
STDCALL
IoGetTopLevelIrp(VOID)
{
@ -1232,7 +1232,7 @@ IoGetTopLevelIrp(VOID)
* PacketSize = Size in bytes of the IRP
* StackSize = Number of stack locations in the IRP
*/
VOID
VOID
STDCALL
IoInitializeIrp(PIRP Irp,
USHORT PacketSize,
@ -1241,10 +1241,10 @@ IoInitializeIrp(PIRP Irp,
ASSERT(Irp != NULL);
DPRINT("IoInitializeIrp(StackSize %x, Irp %x)\n",StackSize, Irp);
/* Clear it */
RtlZeroMemory(Irp, PacketSize);
/* Set the Header and other data */
Irp->Type = IO_TYPE_IRP;
Irp->Size = PacketSize;
@ -1252,11 +1252,11 @@ IoInitializeIrp(PIRP Irp,
Irp->CurrentLocation = StackSize + 1;
Irp->ApcEnvironment = KeGetCurrentThread()->ApcStateIndex;
Irp->Tail.Overlay.CurrentStackLocation = (PIO_STACK_LOCATION)(Irp + 1) + StackSize;
/* Initialize the Thread List */
InitializeListHead(&Irp->ThreadListEntry);
DPRINT("Irp->Tail.Overlay.CurrentStackLocation %x\n", Irp->Tail.Overlay.CurrentStackLocation);
DPRINT("Irp->Tail.Overlay.CurrentStackLocation %x\n", Irp->Tail.Overlay.CurrentStackLocation);
}
/*
@ -1275,14 +1275,14 @@ IoInitializeIrp(PIRP Irp,
*
* @implemented
*/
BOOLEAN
BOOLEAN
STDCALL
IoIsOperationSynchronous(IN PIRP Irp)
{
/* Check the flags */
if ((Irp->Flags & IRP_SYNCHRONOUS_PAGING_IO) ||
(Irp->Flags & IRP_SYNCHRONOUS_API) ||
(IoGetCurrentIrpStackLocation(Irp)->FileObject->Flags &
(Irp->Flags & IRP_SYNCHRONOUS_API) ||
(IoGetCurrentIrpStackLocation(Irp)->FileObject->Flags &
FO_SYNCHRONOUS_IO))
{
/* Synch API or Paging I/O is OK, as is Sync File I/O */
@ -1316,7 +1316,7 @@ IoIsValidNameGraftingBuffer(IN PIRP Irp,
* NOTE: The caller is responsible for incrementing
* Irp->AssociatedIrp.IrpCount.
*/
PIRP
PIRP
STDCALL
IoMakeAssociatedIrp(PIRP Irp,
CCHAR StackSize)
@ -1335,15 +1335,15 @@ IoMakeAssociatedIrp(PIRP Irp,
/* Associate them */
AssocIrp->AssociatedIrp.MasterIrp = Irp;
return AssocIrp;
}
/*
* @implemented
*/
NTSTATUS
STDCALL
NTSTATUS
STDCALL
IoPageRead(PFILE_OBJECT FileObject,
PMDL Mdl,
PLARGE_INTEGER Offset,
@ -1353,19 +1353,19 @@ IoPageRead(PFILE_OBJECT FileObject,
PIRP Irp;
PIO_STACK_LOCATION StackPtr;
PDEVICE_OBJECT DeviceObject;
DPRINT("IoPageRead(FileObject %x, Mdl %x)\n",
FileObject, Mdl);
/* Get the Device Object */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
/* Allocate IRP */
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
/* Get the Stack */
StackPtr = IoGetNextIrpStackLocation(Irp);
/* Create the IRP Settings */
Irp->MdlAddress = Mdl;
Irp->UserBuffer = MmGetMdlVirtualAddress(Mdl);
@ -1375,13 +1375,13 @@ IoPageRead(PFILE_OBJECT FileObject,
Irp->Flags = IRP_PAGING_IO | IRP_NOCACHE | IRP_SYNCHRONOUS_PAGING_IO | IRP_INPUT_OPERATION;
Irp->Tail.Overlay.OriginalFileObject = FileObject;
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
/* Set the Stack Settings */
StackPtr->Parameters.Read.Length = MmGetMdlByteCount(Mdl);
StackPtr->Parameters.Read.ByteOffset = *Offset;
StackPtr->MajorFunction = IRP_MJ_READ;
StackPtr->FileObject = FileObject;
/* Call the Driver */
return IofCallDriver(DeviceObject, Irp);
}
@ -1389,43 +1389,43 @@ IoPageRead(PFILE_OBJECT FileObject,
/*
* @implemented
*/
VOID
VOID
STDCALL
IoQueueThreadIrp(IN PIRP Irp)
{
KIRQL OldIrql;
/* Raise to APC */
OldIrql = KfRaiseIrql(APC_LEVEL);
/*
* Synchronous irp's are queued to requestor thread. If they are not
* completed when the thread exits, they are canceled (cleaned up).
* - Gunnar
*/
InsertTailList(&Irp->Tail.Overlay.Thread->IrpList, &Irp->ThreadListEntry);
/* Lower back */
KfLowerIrql(OldIrql);
}
/*
* @implemented
* Reference: Chris Cant's "Writing WDM Device Drivers"
* Reference: Chris Cant's "Writing WDM Device Drivers"
*/
VOID
VOID
STDCALL
IoReuseIrp(IN OUT PIRP Irp,
IN NTSTATUS Status)
{
UCHAR AllocationFlags;
/* Get the old flags */
AllocationFlags = Irp->AllocationFlags;
/* Reinitialize the IRP */
IoInitializeIrp(Irp, Irp->Size, Irp->StackCount);
/* Duplicate the data */
Irp->IoStatus.Status = Status;
Irp->AllocationFlags = AllocationFlags;
@ -1444,8 +1444,8 @@ IoSetTopLevelIrp(IN PIRP Irp)
/*
* @implemented
*/
NTSTATUS
STDCALL
NTSTATUS
STDCALL
IoSynchronousPageWrite(PFILE_OBJECT FileObject,
PMDL Mdl,
PLARGE_INTEGER Offset,
@ -1455,19 +1455,19 @@ IoSynchronousPageWrite(PFILE_OBJECT FileObject,
PIRP Irp;
PIO_STACK_LOCATION StackPtr;
PDEVICE_OBJECT DeviceObject;
DPRINT("IoSynchronousPageWrite(FileObject %x, Mdl %x)\n",
FileObject, Mdl);
/* Get the Device Object */
DeviceObject = IoGetRelatedDeviceObject(FileObject);
/* Allocate IRP */
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
/* Get the Stack */
StackPtr = IoGetNextIrpStackLocation(Irp);
/* Create the IRP Settings */
Irp->MdlAddress = Mdl;
Irp->UserBuffer = MmGetMdlVirtualAddress(Mdl);
@ -1477,13 +1477,13 @@ IoSynchronousPageWrite(PFILE_OBJECT FileObject,
Irp->Flags = IRP_PAGING_IO | IRP_NOCACHE | IRP_SYNCHRONOUS_PAGING_IO;
Irp->Tail.Overlay.OriginalFileObject = FileObject;
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
/* Set the Stack Settings */
StackPtr->Parameters.Write.Length = MmGetMdlByteCount(Mdl);
StackPtr->Parameters.Write.ByteOffset = *Offset;
StackPtr->MajorFunction = IRP_MJ_WRITE;
StackPtr->FileObject = FileObject;
/* Call the Driver */
return IofCallDriver(DeviceObject, Irp);
}

View file

@ -1,10 +1,10 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/irq.c
* PURPOSE: IRQ handling
*
*
* PROGRAMMERS: David Welch (welch@mcmail.com)
*/
@ -38,7 +38,7 @@ IoConnectInterrupt(PKINTERRUPT* InterruptObject,
/*
* FUNCTION: Registers a driver's isr to be called when its device interrupts
* ARGUMENTS:
* InterruptObject (OUT) = Points to the interrupt object created on
* InterruptObject (OUT) = Points to the interrupt object created on
* return
* ServiceRoutine = Routine to be called when the device interrupts
* ServiceContext = Parameter to be passed to ServiceRoutine
@ -46,7 +46,7 @@ IoConnectInterrupt(PKINTERRUPT* InterruptObject,
* access between the isr and other driver routines. This is
* required if the isr handles more than one vector or the
* driver has more than one isr
* Vector = Interrupt vector to allocate
* Vector = Interrupt vector to allocate
* (returned from HalGetInterruptVector)
* Irql = DIRQL returned from HalGetInterruptVector
* SynchronizeIrql = DIRQL at which the isr will execute. This must
@ -65,18 +65,18 @@ IoConnectInterrupt(PKINTERRUPT* InterruptObject,
{
PKINTERRUPT Interrupt;
ULONG i, count;
ASSERT_IRQL(PASSIVE_LEVEL);
DPRINT("IoConnectInterrupt(Vector %x)\n",Vector);
ProcessorEnableMask &= ((1 << KeNumberProcessors) - 1);
if (ProcessorEnableMask == 0)
{
return STATUS_INVALID_PARAMETER;
}
for (i = 0, count = 0; i < KeNumberProcessors; i++)
{
if (ProcessorEnableMask & (1 << i))

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/plugplay.c
* PURPOSE: Plug-and-play interface routines
*
*
* PROGRAMMERS: Eric Kohl <eric.kohl@t-online.de>
*/

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpdma.c
* PURPOSE: PnP manager DMA routines
*
*
* PROGRAMMERS: Filip Navara (xnavara@volny.cz)
*/
@ -223,9 +223,9 @@ IoGetDmaAdapter(
PDMA_ADAPTER Result = NULL;
PDMA_ADAPTER_INTERNAL ResultInternal = NULL;
PADAPTER_OBJECT HalAdapter;
DPRINT("IoGetDmaAdapter called\n");
/*
* Try to create DMA adapter through bus driver
*/
@ -233,11 +233,11 @@ IoGetDmaAdapter(
{
if (DeviceDescription->InterfaceType == 0x0F /*PNPBus*/ ||
DeviceDescription->InterfaceType == 0xFFFFFFFF)
{
{
RtlCopyMemory(&PrivateDeviceDescription, DeviceDescription,
sizeof(DEVICE_DESCRIPTION));
Status = IoGetDeviceProperty(PhysicalDeviceObject,
DevicePropertyLegacyBusType, sizeof(INTERFACE_TYPE),
DevicePropertyLegacyBusType, sizeof(INTERFACE_TYPE),
&PrivateDeviceDescription.InterfaceType, &ResultLength);
if (!NT_SUCCESS(Status))
{
@ -249,7 +249,7 @@ IoGetDmaAdapter(
Stack.Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
Stack.Parameters.QueryInterface.Version = 1;
Stack.Parameters.QueryInterface.Interface = (PINTERFACE)&BusInterface;
Stack.Parameters.QueryInterface.InterfaceType =
Stack.Parameters.QueryInterface.InterfaceType =
&GUID_BUS_INTERFACE_STANDARD;
Status = IopInitiatePnpIrp(PhysicalDeviceObject, &IoStatusBlock,
IRP_MN_QUERY_INTERFACE, &Stack);

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr.c
* PURPOSE: Initializes the PnP manager
*
*
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
@ -159,8 +159,8 @@ IoGetDeviceProperty(
KeyNameBuffer = ExAllocatePool(PagedPool,
(49 * sizeof(WCHAR)) + DeviceNode->InstancePath.Length);
DPRINT("KeyNameBuffer: %x, value %S\n",
DPRINT("KeyNameBuffer: %x, value %S\n",
KeyNameBuffer, RegistryPropertyName);
if (KeyNameBuffer == NULL)
@ -283,7 +283,7 @@ IoInvalidateDeviceState(
* @param DeviceObject Device to get the registry key for.
* @param DevInstKeyType Type of the key to return.
* @param DesiredAccess Access mask (eg. KEY_READ | KEY_WRITE).
* @param DevInstRegKey Handle to the opened registry key on
* @param DevInstRegKey Handle to the opened registry key on
* successful return.
*
* @return Status.
@ -362,7 +362,7 @@ IoOpenDeviceRegistryKey(
if (DevInstKeyType & PLUGPLAY_REGKEY_CURRENT_HWPROFILE)
RtlAppendUnicodeToString(&KeyName, ProfileKeyName);
if (DevInstKeyType & PLUGPLAY_REGKEY_DRIVER)
{
RtlAppendUnicodeToString(&KeyName, ClassKeyName);
@ -1384,11 +1384,11 @@ IopActionConfigureChildServices(
{
WCHAR RegKeyBuffer[MAX_PATH];
UNICODE_STRING RegKey;
RegKey.Length = 0;
RegKey.MaximumLength = sizeof(RegKeyBuffer);
RegKey.Buffer = RegKeyBuffer;
/*
* Retrieve configuration from Enum key
*/

View file

@ -1,10 +1,10 @@
/* $Id:$
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpnotify.c
* PURPOSE: Plug & Play notification functions
*
*
* PROGRAMMERS: Filip Navara (xnavara@volny.cz)
* Hervé Poussineau (hpoussin@reactos.com)
*/
@ -67,16 +67,16 @@ IoRegisterPlugPlayNotification(
PPNP_NOTIFY_ENTRY Entry;
PWSTR SymbolicLinkList;
NTSTATUS Status;
PAGED_CODE();
DPRINT("IoRegisterPlugPlayNotification(EventCategory 0x%x, EventCategoryFlags 0x%lx, DriverObject %p) called.\n",
EventCategory,
EventCategoryFlags,
DriverObject);
ObReferenceObject(DriverObject);
/* Try to allocate entry for notification before sending any notification */
Entry = ExAllocatePoolWithTag(
NonPagedPool,
@ -88,7 +88,7 @@ IoRegisterPlugPlayNotification(
ObDereferenceObject(DriverObject);
return STATUS_INSUFFICIENT_RESOURCES;
}
if (EventCategory == EventCategoryTargetDeviceChange
&& EventCategoryFlags & PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES)
{
@ -108,7 +108,7 @@ IoRegisterPlugPlayNotification(
DPRINT1("IoRegisterPlugPlayNotification(): need to send notifications for existing interfaces!\n");
ExFreePool(SymbolicLinkList);
}
Entry->PnpNotificationProc = CallbackRoutine;
Entry->EventCategory = EventCategory;
Entry->Context = Context;
@ -141,12 +141,12 @@ IoRegisterPlugPlayNotification(
break;
}
}
KeAcquireGuardedMutex(&PnpNotifyListLock);
InsertHeadList(&PnpNotifyListHead,
&Entry->PnpNotifyList);
KeReleaseGuardedMutex(&PnpNotifyListLock);
DPRINT("IoRegisterPlugPlayNotification() returns NotificationEntry %p\n",
Entry);
*NotificationEntry = Entry;
@ -162,18 +162,18 @@ IoUnregisterPlugPlayNotification(
IN PVOID NotificationEntry)
{
PPNP_NOTIFY_ENTRY Entry;
PAGED_CODE();
Entry = (PPNP_NOTIFY_ENTRY)NotificationEntry;
DPRINT("IoUnregisterPlugPlayNotification(NotificationEntry %p) called\n",
Entry);
KeAcquireGuardedMutex(&PnpNotifyListLock);
RtlFreeUnicodeString(&Entry->Guid);
RemoveEntryList(&Entry->PnpNotifyList);
KeReleaseGuardedMutex(&PnpNotifyListLock);
return STATUS_SUCCESS;
}
@ -189,16 +189,16 @@ IopNotifyPlugPlayNotification(
PLIST_ENTRY Entry;
PVOID NotificationStructure;
BOOLEAN CallCurrentEntry;
ASSERT(DeviceObject);
KeAcquireGuardedMutex(&PnpNotifyListLock);
if (IsListEmpty(&PnpNotifyListHead))
{
KeReleaseGuardedMutex(&PnpNotifyListLock);
return;
}
switch (EventCategory)
{
case EventCategoryDeviceInterfaceChange:
@ -246,17 +246,17 @@ IopNotifyPlugPlayNotification(
return;
}
}
/* Loop through procedures registred in PnpNotifyListHead
* list to find those that meet some criteria.
*/
Entry = PnpNotifyListHead.Flink;
while (Entry != &PnpNotifyListHead)
{
ChangeEntry = CONTAINING_RECORD(Entry, PNP_NOTIFY_ENTRY, PnpNotifyList);
CallCurrentEntry = FALSE;
switch (EventCategory)
{
case EventCategoryDeviceInterfaceChange:
@ -284,18 +284,18 @@ IopNotifyPlugPlayNotification(
break;
}
}
if (CallCurrentEntry)
{
/* Call entry into new allocated memory */
DPRINT("IopNotifyPlugPlayNotification(): found suitable callback %p\n",
ChangeEntry);
(ChangeEntry->PnpNotificationProc)(
NotificationStructure,
ChangeEntry->Context);
}
Entry = Entry->Flink;
}
KeReleaseGuardedMutex(&PnpNotifyListLock);

Some files were not shown because too many files have changed in this diff Show more