disable regular kmode apc's around Resource locks

svn path=/trunk/; revision=6805
This commit is contained in:
Gunnar Dalsnes 2003-11-27 00:52:16 +00:00
parent 1d9998a97f
commit ebdb1b6328
8 changed files with 76 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/* $Id: import.c,v 1.24 2003/10/16 14:48:22 ekohl Exp $
/* $Id: import.c,v 1.25 2003/11/27 00:48:11 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -143,6 +143,7 @@ CmImportBinaryHive (PCHAR ChunkBase,
ExInitializeResourceLite(&Hive->HiveResource);
/* Acquire hive list lock exclusively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&CmiHiveListLock, TRUE);
/* Add the new hive to the hive list */
@ -150,6 +151,7 @@ CmImportBinaryHive (PCHAR ChunkBase,
/* Release hive list lock */
ExReleaseResourceLite(&CmiHiveListLock);
KeLeaveCriticalRegion();
*RegistryHive = Hive;

View file

@ -140,6 +140,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
KeyObject->SubKeys = NULL;
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&KeyObject->RegistryHive->HiveResource, TRUE);
/* add key to subkeys of parent if needed */
@ -155,6 +156,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
DPRINT("CmiAddSubKey() failed (Status %lx)\n", Status);
/* Release hive lock */
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
ObDereferenceObject(Object);
return STATUS_UNSUCCESSFUL;
@ -186,6 +188,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
/* Release hive lock */
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
ObDereferenceObject(Object);
@ -220,6 +223,7 @@ NtDeleteKey(IN HANDLE KeyHandle)
}
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -238,6 +242,7 @@ NtDeleteKey(IN HANDLE KeyHandle)
/* Release hive lock */
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
DPRINT("PointerCount %lu\n", ObGetObjectPointerCount((PVOID)KeyObject));
@ -300,6 +305,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
}
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -314,6 +320,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
if (RegistryHive == CmiVolatileHive)
{
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
DPRINT("No more volatile entries\n");
return(STATUS_NO_MORE_ENTRIES);
@ -336,6 +343,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
if (Index >= KeyCell->NumberOfSubKeys)
{
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
DPRINT("No more non-volatile entries\n");
return(STATUS_NO_MORE_ENTRIES);
@ -348,6 +356,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
if (KeyCell->HashTableOffset == (BLOCK_OFFSET)-1)
{
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return(STATUS_NO_MORE_ENTRIES);
}
@ -357,6 +366,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
{
DPRINT("CmiGetBlock() failed\n");
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return STATUS_UNSUCCESSFUL;
}
@ -368,6 +378,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
if (SubKeyCell == NULL)
{
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
DPRINT("No more entries\n");
return(STATUS_NO_MORE_ENTRIES);
@ -511,6 +522,7 @@ NtEnumerateKey(IN HANDLE KeyHandle,
}
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
DPRINT("Returning status %x\n", Status);
@ -560,6 +572,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
}
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -577,6 +590,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
if (!NT_SUCCESS(Status))
{
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return Status;
}
@ -714,6 +728,7 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
}
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return Status;
@ -746,6 +761,7 @@ NtFlushKey(IN HANDLE KeyHandle)
RegistryHive = KeyObject->RegistryHive;
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&RegistryHive->HiveResource,
TRUE);
@ -760,6 +776,7 @@ NtFlushKey(IN HANDLE KeyHandle)
}
ExReleaseResourceLite(&RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
@ -861,6 +878,7 @@ NtQueryKey(IN HANDLE KeyHandle,
}
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -994,6 +1012,7 @@ NtQueryKey(IN HANDLE KeyHandle,
}
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return(Status);
@ -1037,6 +1056,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
}
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -1055,6 +1075,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
{
DPRINT("CmiScanKeyForValue() failed with status %x\n", Status);
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return(Status);
}
@ -1190,6 +1211,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
}
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return Status;
@ -1233,6 +1255,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
return(Status);
/* Acquire hive lock exclucively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -1250,6 +1273,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
DPRINT("Value not found. Status 0x%X\n", Status);
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return(Status);
}
@ -1273,6 +1297,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
DPRINT("Cannot add value. Status 0x%X\n", Status);
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return(Status);
}
@ -1337,6 +1362,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
DPRINT("CmiAllocateBlock() failed (Status %lx)\n", Status);
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
return(Status);
@ -1361,6 +1387,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
CmiMarkBlockDirty (RegistryHive, KeyObject->KeyCellOffset);
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
CmiSyncHives();
@ -1391,6 +1418,7 @@ NtDeleteValueKey (IN HANDLE KeyHandle,
}
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -1405,6 +1433,7 @@ NtDeleteValueKey (IN HANDLE KeyHandle,
/* Release hive lock */
ExReleaseResourceLite (&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject (KeyObject);
@ -1591,6 +1620,7 @@ NtQueryMultipleValueKey (IN HANDLE KeyHandle,
}
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -1666,6 +1696,7 @@ NtQueryMultipleValueKey (IN HANDLE KeyHandle,
/* Release hive lock */
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject(KeyObject);
@ -1723,6 +1754,7 @@ NtSaveKey (IN HANDLE KeyHandle,
}
/* Acquire hive lock exclucively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite (&KeyObject->RegistryHive->HiveResource,
TRUE);
@ -1731,6 +1763,7 @@ NtSaveKey (IN HANDLE KeyHandle,
{
DPRINT1 ("Cannot save a volatile key\n");
ExReleaseResourceLite (&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject (KeyObject);
return STATUS_ACCESS_DENIED;
}
@ -1740,6 +1773,7 @@ NtSaveKey (IN HANDLE KeyHandle,
{
DPRINT1 ("CmiCreateTempHive() failed (Status %lx)\n", Status);
ExReleaseResourceLite (&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject (KeyObject);
return(Status);
}
@ -1753,6 +1787,7 @@ NtSaveKey (IN HANDLE KeyHandle,
DPRINT1 ("CmiCopyKey() failed (Status %lx)\n", Status);
CmiRemoveRegistryHive (TempHive);
ExReleaseResourceLite (&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject (KeyObject);
return(Status);
}
@ -1768,6 +1803,7 @@ NtSaveKey (IN HANDLE KeyHandle,
/* Release hive lock */
ExReleaseResourceLite(&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject (KeyObject);
@ -1806,6 +1842,7 @@ NtSetInformationKey (IN HANDLE KeyHandle,
}
/* Acquire hive lock */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite (&KeyObject->RegistryHive->HiveResource, TRUE);
VERIFY_KEY_OBJECT(KeyObject);
@ -1818,6 +1855,7 @@ NtSetInformationKey (IN HANDLE KeyHandle,
/* Release hive lock */
ExReleaseResourceLite (&KeyObject->RegistryHive->HiveResource);
KeLeaveCriticalRegion();
ObDereferenceObject (KeyObject);
@ -1858,6 +1896,7 @@ NtUnloadKey (IN POBJECT_ATTRIBUTES KeyObjectAttributes)
DPRINT ("RegistryHive %p\n", RegistryHive);
/* Acquire hive list lock exclusively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite (&CmiHiveListLock,
TRUE);
@ -1869,6 +1908,7 @@ NtUnloadKey (IN POBJECT_ATTRIBUTES KeyObjectAttributes)
/* Release hive list lock */
ExReleaseResourceLite (&CmiHiveListLock);
KeLeaveCriticalRegion();
CmiRemoveRegistryHive (RegistryHive);

View file

@ -1091,6 +1091,7 @@ CmiCreateVolatileHive(PREGISTRY_HIVE *RegistryHive)
ExInitializeResourceLite (&Hive->HiveResource);
/* Acquire hive list lock exclusively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite (&CmiHiveListLock,
TRUE);
@ -1100,6 +1101,7 @@ CmiCreateVolatileHive(PREGISTRY_HIVE *RegistryHive)
/* Release hive list lock */
ExReleaseResourceLite (&CmiHiveListLock);
KeLeaveCriticalRegion();
VERIFY_REGISTRY_HIVE (Hive);
@ -1213,6 +1215,7 @@ CmiCreateTempHive(PREGISTRY_HIVE *RegistryHive)
ExInitializeResourceLite (&Hive->HiveResource);
/* Acquire hive list lock exclusively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite (&CmiHiveListLock,
TRUE);
@ -1222,6 +1225,7 @@ CmiCreateTempHive(PREGISTRY_HIVE *RegistryHive)
/* Release hive list lock */
ExReleaseResourceLite (&CmiHiveListLock);
KeLeaveCriticalRegion();
VERIFY_REGISTRY_HIVE (Hive);
@ -1279,11 +1283,13 @@ CmiLoadHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
ExInitializeResourceLite (&Hive->HiveResource);
/* Add the new hive to the hive list */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite (&CmiHiveListLock,
TRUE);
InsertTailList (&CmiHiveListHead,
&Hive->HiveList);
ExReleaseResourceLite (&CmiHiveListLock);
KeLeaveCriticalRegion();
VERIFY_REGISTRY_HIVE(Hive);
@ -1310,6 +1316,7 @@ CmiRemoveRegistryHive(PREGISTRY_HIVE RegistryHive)
return STATUS_UNSUCCESSFUL;
/* Acquire hive list lock exclusively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite (&CmiHiveListLock,
TRUE);
@ -1318,6 +1325,7 @@ CmiRemoveRegistryHive(PREGISTRY_HIVE RegistryHive)
/* Release hive list lock */
ExReleaseResourceLite (&CmiHiveListLock);
KeLeaveCriticalRegion();
/* Release file names */
RtlFreeUnicodeString (&RegistryHive->HiveFileName);

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.114 2003/11/17 02:12:50 hyperion Exp $
/* $Id: registry.c,v 1.115 2003/11/27 00:48:11 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -988,6 +988,7 @@ CmShutdownRegistry(VOID)
}
/* Acquire hive list lock exclusively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&CmiHiveListLock, TRUE);
Entry = CmiHiveListHead.Flink;
@ -1013,6 +1014,7 @@ CmShutdownRegistry(VOID)
/* Release hive list lock */
ExReleaseResourceLite(&CmiHiveListLock);
KeLeaveCriticalRegion();
DPRINT1("CmShutdownRegistry() done\n");
}
@ -1029,6 +1031,7 @@ CmiHiveSyncRoutine(PVOID DeferredContext)
CmiHiveSyncPending = FALSE;
/* Acquire hive list lock exclusively */
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&CmiHiveListLock, TRUE);
Entry = CmiHiveListHead.Flink;
@ -1054,6 +1057,7 @@ CmiHiveSyncRoutine(PVOID DeferredContext)
/* Release hive list lock */
ExReleaseResourceLite(&CmiHiveListLock);
KeLeaveCriticalRegion();
DPRINT("DeferredContext %x\n", DeferredContext);
ExFreePool(DeferredContext);

View file

@ -1,4 +1,4 @@
/* $Id: fs.c,v 1.38 2003/11/09 19:04:54 ekohl Exp $
/* $Id: fs.c,v 1.39 2003/11/27 00:50:05 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -183,6 +183,7 @@ IoShutdownRegisteredFileSystems(VOID)
DPRINT("IoShutdownRegisteredFileSystems()\n");
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&FileSystemListLock,TRUE);
KeInitializeEvent(&Event,
NotificationEvent,
@ -216,6 +217,7 @@ IoShutdownRegisteredFileSystems(VOID)
}
ExReleaseResourceLite(&FileSystemListLock);
KeLeaveCriticalRegion();
}
@ -360,6 +362,7 @@ IoMountVolume(IN PDEVICE_OBJECT DeviceObject,
return(STATUS_UNRECOGNIZED_VOLUME);
}
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&FileSystemListLock,TRUE);
current_entry = FileSystemListHead.Flink;
while (current_entry!=(&FileSystemListHead))
@ -389,6 +392,7 @@ IoMountVolume(IN PDEVICE_OBJECT DeviceObject,
Status = IopLoadFileSystem(DevObject);
if (!NT_SUCCESS(Status))
{
KeLeaveCriticalRegion();
return(Status);
}
ExAcquireResourceSharedLite(&FileSystemListLock,TRUE);
@ -399,6 +403,7 @@ IoMountVolume(IN PDEVICE_OBJECT DeviceObject,
DeviceObject->Vpb->Flags = DeviceObject->Vpb->Flags |
VPB_MOUNTED;
ExReleaseResourceLite(&FileSystemListLock);
KeLeaveCriticalRegion();
return(STATUS_SUCCESS);
case STATUS_UNRECOGNIZED_VOLUME:
@ -407,6 +412,7 @@ IoMountVolume(IN PDEVICE_OBJECT DeviceObject,
}
}
ExReleaseResourceLite(&FileSystemListLock);
KeLeaveCriticalRegion();
return(STATUS_UNRECOGNIZED_VOLUME);
}
@ -575,6 +581,7 @@ IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
assert(Fs!=NULL);
Fs->DeviceObject = DeviceObject;
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&FileSystemListLock, TRUE);
/* The RAW filesystem device objects must be last in the list so the
@ -586,6 +593,7 @@ IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
&Fs->Entry);
ExReleaseResourceLite(&FileSystemListLock);
KeLeaveCriticalRegion();
IopNotifyFileSystemChange(DeviceObject,
TRUE);
@ -603,6 +611,7 @@ IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
DPRINT("IoUnregisterFileSystem(DeviceObject %x)\n",DeviceObject);
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&FileSystemListLock, TRUE);
current_entry = FileSystemListHead.Flink;
while (current_entry!=(&FileSystemListHead))
@ -613,12 +622,14 @@ IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
RemoveEntryList(current_entry);
ExFreePool(current);
ExReleaseResourceLite(&FileSystemListLock);
KeLeaveCriticalRegion();
IopNotifyFileSystemChange(DeviceObject, FALSE);
return;
}
current_entry = current_entry->Flink;
}
ExReleaseResourceLite(&FileSystemListLock);
KeLeaveCriticalRegion();
}

View file

@ -1,4 +1,4 @@
/* $Id: rawfs.c,v 1.6 2003/07/21 21:53:51 royce Exp $
/* $Id: rawfs.c,v 1.7 2003/11/27 00:50:22 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -640,9 +640,11 @@ RawFsMount(IN PRAWFS_IRP_CONTEXT IrpContext)
VolumeFcb->RFCB.AllocationSize.QuadPart = VolumeFcb->RFCB.FileSize.QuadPart;
DeviceExt->VolumeFcb = VolumeFcb;
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&GlobalData->VolumeListLock, TRUE);
InsertHeadList(&GlobalData->VolumeListHead, &DeviceExt->VolumeListEntry);
ExReleaseResourceLite(&GlobalData->VolumeListLock);
KeLeaveCriticalRegion();
/* No serial number */
DeviceObject->Vpb->SerialNumber = 0;

View file

@ -96,17 +96,20 @@ VOID FASTCALL IntRestoreWinLock(WINLOCK_TYPE Type)
inline VOID IntAcquireWinLockShared()
{
KeEnterCriticalRegion();
ExAcquireResourceSharedLite(&WinLock, TRUE /*Wait*/ );
}
inline VOID IntAcquireWinLockExclusive()
{
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite(&WinLock, TRUE /*Wait*/ );
}
inline VOID IntReleaseWinLock()
{
ExReleaseResourceLite(&WinLock );
KeLeaveCriticalRegion();
}
inline BOOL IntInitializeWinLock()

View file

@ -38,6 +38,7 @@ EngAcquireSemaphore ( IN HSEMAPHORE hsem )
{
// www.osr.com/ddk/graphics/gdifncs_14br.htm
ASSERT(hsem);
KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite ( (PERESOURCE)hsem, TRUE );
}
@ -51,6 +52,7 @@ EngReleaseSemaphore ( IN HSEMAPHORE hsem )
// www.osr.com/ddk/graphics/gdifncs_5u3r.htm
ASSERT(hsem);
ExReleaseResourceLite ( (PERESOURCE)hsem );
KeLeaveCriticalRegion();
}
/*