mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
- Remove WINE-isms from KeDeviceQueue code
- Fix memory corruption that happened pretty much everytime you pressed a key or moved the mouse -- reponsible for countless crashes, including the famous ASSERT during 1-stage setup. - Remove anti-memory-corruption-workaround from VFAT - Note: If you're going to do use device queues in your driver, please learn how. Kthxbye. Patch by Alex Ionescu <alex.ionescu@reactos.org> _____ Alex, Marry me, KJK::Hyperion XOXOXO See issue #3116 for more details. svn path=/trunk/; revision=33633
This commit is contained in:
parent
af1376546d
commit
b16ac9683a
5 changed files with 44 additions and 52 deletions
|
@ -52,7 +52,6 @@ NTSTATUS VfatFlushVolume(PDEVICE_EXTENSION DeviceExt, PVFATFCB VolumeFcb)
|
||||||
ListEntry = ListEntry->Flink;
|
ListEntry = ListEntry->Flink;
|
||||||
if (!vfatFCBIsDirectory(Fcb))
|
if (!vfatFCBIsDirectory(Fcb))
|
||||||
{
|
{
|
||||||
if (Fcb->PadPad51) continue; // Corrupt FCB
|
|
||||||
ExAcquireResourceExclusiveLite(&Fcb->MainResource, TRUE);
|
ExAcquireResourceExclusiveLite(&Fcb->MainResource, TRUE);
|
||||||
Status = VfatFlushFile(DeviceExt, Fcb);
|
Status = VfatFlushFile(DeviceExt, Fcb);
|
||||||
ExReleaseResourceLite (&Fcb->MainResource);
|
ExReleaseResourceLite (&Fcb->MainResource);
|
||||||
|
|
|
@ -322,21 +322,6 @@ typedef struct _VFATFCB
|
||||||
{
|
{
|
||||||
/* FCB header required by ROS/NT */
|
/* FCB header required by ROS/NT */
|
||||||
FSRTL_COMMON_FCB_HEADER RFCB;
|
FSRTL_COMMON_FCB_HEADER RFCB;
|
||||||
ULONG PadPad;
|
|
||||||
ULONG PadPad2;
|
|
||||||
ULONG PadPad3;
|
|
||||||
ULONG PadPad4;
|
|
||||||
ULONG PadPad5;
|
|
||||||
ULONG PadPad50;
|
|
||||||
ULONG PadPad51;
|
|
||||||
ULONG PadPad52;
|
|
||||||
ULONG PadPad53;
|
|
||||||
ULONG PadPad54;
|
|
||||||
ULONG PadPad55;
|
|
||||||
ULONG PadPad56;
|
|
||||||
ULONG PadPad6;
|
|
||||||
ULONG PadPad7;
|
|
||||||
ULONG PadPad8;
|
|
||||||
SECTION_OBJECT_POINTERS SectionObjectPointers;
|
SECTION_OBJECT_POINTERS SectionObjectPointers;
|
||||||
ERESOURCE MainResource;
|
ERESOURCE MainResource;
|
||||||
ERESOURCE PagingIoResource;
|
ERESOURCE PagingIoResource;
|
||||||
|
|
|
@ -798,9 +798,6 @@ HandleReadIrp(
|
||||||
/* Go to next packet and complete this request */
|
/* Go to next packet and complete this request */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
|
||||||
if (IsInStartIo)
|
|
||||||
IoStartNextPacket(DeviceObject, TRUE);
|
|
||||||
|
|
||||||
(VOID)IoSetCancelRoutine(Irp, NULL);
|
(VOID)IoSetCancelRoutine(Irp, NULL);
|
||||||
IoCompleteRequest(Irp, IO_KEYBOARD_INCREMENT);
|
IoCompleteRequest(Irp, IO_KEYBOARD_INCREMENT);
|
||||||
DeviceExtension->PendingIrp = NULL;
|
DeviceExtension->PendingIrp = NULL;
|
||||||
|
@ -818,8 +815,6 @@ HandleReadIrp(
|
||||||
IoMarkIrpPending(Irp);
|
IoMarkIrpPending(Irp);
|
||||||
DeviceExtension->PendingIrp = Irp;
|
DeviceExtension->PendingIrp = Irp;
|
||||||
Status = STATUS_PENDING;
|
Status = STATUS_PENDING;
|
||||||
if (!IsInStartIo)
|
|
||||||
IoStartPacket(DeviceObject, Irp, NULL, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -774,9 +774,6 @@ HandleReadIrp(
|
||||||
/* Go to next packet and complete this request */
|
/* Go to next packet and complete this request */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
|
||||||
if (IsInStartIo)
|
|
||||||
IoStartNextPacket(DeviceObject, TRUE);
|
|
||||||
|
|
||||||
(VOID)IoSetCancelRoutine(Irp, NULL);
|
(VOID)IoSetCancelRoutine(Irp, NULL);
|
||||||
IoCompleteRequest(Irp, IO_MOUSE_INCREMENT);
|
IoCompleteRequest(Irp, IO_MOUSE_INCREMENT);
|
||||||
DeviceExtension->PendingIrp = NULL;
|
DeviceExtension->PendingIrp = NULL;
|
||||||
|
@ -794,8 +791,6 @@ HandleReadIrp(
|
||||||
IoMarkIrpPending(Irp);
|
IoMarkIrpPending(Irp);
|
||||||
DeviceExtension->PendingIrp = Irp;
|
DeviceExtension->PendingIrp = Irp;
|
||||||
Status = STATUS_PENDING;
|
Status = STATUS_PENDING;
|
||||||
if (!IsInStartIo)
|
|
||||||
IoStartPacket(DeviceObject, Irp, NULL, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -86,6 +86,8 @@ KeInsertByKeyDeviceQueue(IN PKDEVICE_QUEUE DeviceQueue,
|
||||||
{
|
{
|
||||||
KLOCK_QUEUE_HANDLE DeviceLock;
|
KLOCK_QUEUE_HANDLE DeviceLock;
|
||||||
BOOLEAN Inserted;
|
BOOLEAN Inserted;
|
||||||
|
PLIST_ENTRY NextEntry;
|
||||||
|
PKDEVICE_QUEUE_ENTRY LastEntry;
|
||||||
ASSERT_DEVICE_QUEUE(DeviceQueue);
|
ASSERT_DEVICE_QUEUE(DeviceQueue);
|
||||||
|
|
||||||
DPRINT("KeInsertByKeyDeviceQueue() DevQueue %p, Entry %p, SortKey 0x%x\n", DeviceQueue, DeviceQueueEntry, SortKey);
|
DPRINT("KeInsertByKeyDeviceQueue() DevQueue %p, Entry %p, SortKey 0x%x\n", DeviceQueue, DeviceQueueEntry, SortKey);
|
||||||
|
@ -105,12 +107,34 @@ KeInsertByKeyDeviceQueue(IN PKDEVICE_QUEUE DeviceQueue,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Insert new entry after the last entry with SortKey less or equal to passed-in SortKey */
|
/* Make sure the list isn't empty */
|
||||||
InsertAscendingListFIFO(&DeviceQueue->DeviceListHead,
|
NextEntry = &DeviceQueue->DeviceListHead;
|
||||||
DeviceQueueEntry,
|
if (!IsListEmpty(NextEntry))
|
||||||
KDEVICE_QUEUE_ENTRY,
|
{
|
||||||
DeviceListEntry,
|
/* Get the last entry */
|
||||||
SortKey);
|
LastEntry = CONTAINING_RECORD(NextEntry->Blink,
|
||||||
|
KDEVICE_QUEUE_ENTRY,
|
||||||
|
DeviceListEntry);
|
||||||
|
|
||||||
|
/* Check if our sort key is lower */
|
||||||
|
if (SortKey < LastEntry->SortKey)
|
||||||
|
{
|
||||||
|
/* Loop each sort key */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
/* Get the next entry */
|
||||||
|
NextEntry = NextEntry->Flink;
|
||||||
|
LastEntry = CONTAINING_RECORD(NextEntry,
|
||||||
|
KDEVICE_QUEUE_ENTRY,
|
||||||
|
DeviceListEntry);
|
||||||
|
|
||||||
|
/* Keep looping until we find a place to insert */
|
||||||
|
} while (SortKey >= LastEntry->SortKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now insert us */
|
||||||
|
InsertTailList(NextEntry, &DeviceQueueEntry->DeviceListEntry);
|
||||||
Inserted = TRUE;
|
Inserted = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,40 +223,34 @@ KeRemoveByKeyDeviceQueue(IN PKDEVICE_QUEUE DeviceQueue,
|
||||||
KDEVICE_QUEUE_ENTRY,
|
KDEVICE_QUEUE_ENTRY,
|
||||||
DeviceListEntry);
|
DeviceListEntry);
|
||||||
|
|
||||||
if (SortKey >= ReturnEntry->SortKey)
|
/* Check if we can just get the first entry */
|
||||||
|
if (ReturnEntry->SortKey <= SortKey)
|
||||||
{
|
{
|
||||||
|
/* Get the first entry */
|
||||||
ReturnEntry = CONTAINING_RECORD(ListEntry->Flink,
|
ReturnEntry = CONTAINING_RECORD(ListEntry->Flink,
|
||||||
KDEVICE_QUEUE_ENTRY,
|
KDEVICE_QUEUE_ENTRY,
|
||||||
DeviceListEntry);
|
DeviceListEntry);
|
||||||
|
|
||||||
/* Remove it from the list */
|
|
||||||
RemoveEntryList(&ReturnEntry->DeviceListEntry);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Find entry with SortKey greater than or equal to the passed-in SortKey */
|
/* Loop the list */
|
||||||
LIST_FOR_EACH(ReturnEntry, &DeviceQueue->DeviceListHead, KDEVICE_QUEUE_ENTRY, DeviceListEntry)
|
ListEntry = DeviceQueue->DeviceListHead.Flink;
|
||||||
|
while (TRUE)
|
||||||
{
|
{
|
||||||
/* Check if keys match */
|
/* Get the next entry and check if the key is low enough */
|
||||||
if (ReturnEntry->SortKey >= SortKey)
|
|
||||||
{
|
|
||||||
/* We found it, so just remove it */
|
|
||||||
RemoveEntryList(&ReturnEntry->DeviceListEntry);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if we found something */
|
|
||||||
if (!ReturnEntry)
|
|
||||||
{
|
|
||||||
/* Not found, return the first entry */
|
|
||||||
ListEntry = RemoveHeadList(&DeviceQueue->DeviceListHead);
|
|
||||||
ReturnEntry = CONTAINING_RECORD(ListEntry,
|
ReturnEntry = CONTAINING_RECORD(ListEntry,
|
||||||
KDEVICE_QUEUE_ENTRY,
|
KDEVICE_QUEUE_ENTRY,
|
||||||
DeviceListEntry);
|
DeviceListEntry);
|
||||||
|
if (SortKey <= ReturnEntry->SortKey) break;
|
||||||
|
|
||||||
|
/* Try the next one */
|
||||||
|
ListEntry = ListEntry->Flink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We have an entry, remove it now */
|
||||||
|
RemoveEntryList(&ReturnEntry->DeviceListEntry);
|
||||||
|
|
||||||
/* Set it as non-inserted */
|
/* Set it as non-inserted */
|
||||||
ReturnEntry->Inserted = FALSE;
|
ReturnEntry->Inserted = FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue