ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2007
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
888 discussions
Start a n
N
ew thread
[fireball] 30069: - Make use of the function Herve implemented in previous commit to flush key buffer at the beginning of every page in usetup. See issue #2131 for more details.
by fireball@svn.reactos.org
Author: fireball Date: Fri Nov 2 16:13:55 2007 New Revision: 30069 URL:
http://svn.reactos.org/svn/reactos?rev=30069&view=rev
Log: - Make use of the function Herve implemented in previous commit to flush key buffer at the beginning of every page in usetup. See issue #2131 for more details. Modified: trunk/reactos/base/setup/usetup/interface/consup.c trunk/reactos/base/setup/usetup/interface/consup.h trunk/reactos/base/setup/usetup/interface/usetup.c Modified: trunk/reactos/base/setup/usetup/interface/consup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
============================================================================== --- trunk/reactos/base/setup/usetup/interface/consup.c (original) +++ trunk/reactos/base/setup/usetup/interface/consup.c Fri Nov 2 16:13:55 2007 @@ -128,6 +128,12 @@ NULL); } +BOOL +CONSOLE_Flush(VOID) +{ + return FlushConsoleInputBuffer(StdInput); +} + SHORT CONSOLE_GetCursorX(VOID) { Modified: trunk/reactos/base/setup/usetup/interface/consup.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
============================================================================== --- trunk/reactos/base/setup/usetup/interface/consup.h (original) +++ trunk/reactos/base/setup/usetup/interface/consup.h Fri Nov 2 16:13:55 2007 @@ -56,6 +56,9 @@ VOID CONSOLE_ConOutPuts( IN LPCSTR szText); + +BOOL +CONSOLE_Flush(VOID); SHORT CONSOLE_GetCursorX(VOID); Modified: trunk/reactos/base/setup/usetup/interface/usetup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
============================================================================== --- trunk/reactos/base/setup/usetup/interface/usetup.c (original) +++ trunk/reactos/base/setup/usetup/interface/usetup.c Fri Nov 2 16:13:55 2007 @@ -3582,6 +3582,8 @@ CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup "); + CONSOLE_Flush(); + switch (Page) { /* Start page */
17 years, 1 month
1
0
0
0
[hpoussin] 30068: Report STATUS_NOT_SUPPORTED when IOCTL is not supported
by hpoussin@svn.reactos.org
Author: hpoussin Date: Fri Nov 2 16:01:15 2007 New Revision: 30068 URL:
http://svn.reactos.org/svn/reactos?rev=30068&view=rev
Log: Report STATUS_NOT_SUPPORTED when IOCTL is not supported Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c trunk/reactos/drivers/input/mouclass/mouclass.c Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbd…
============================================================================== --- trunk/reactos/drivers/input/kbdclass/kbdclass.c (original) +++ trunk/reactos/drivers/input/kbdclass/kbdclass.c Fri Nov 2 16:01:15 2007 @@ -120,7 +120,7 @@ IN PIRP Irp) { PCLASS_DEVICE_EXTENSION DeviceExtension; - NTSTATUS Status = Irp->IoStatus.Status; + NTSTATUS Status = STATUS_NOT_SUPPORTED; DPRINT("IRP_MJ_DEVICE_CONTROL\n"); @@ -203,7 +203,6 @@ DPRINT1("Port DO stub for major function 0x%lx\n", IoGetCurrentIrpStackLocation(Irp)->MajorFunction); ASSERT(FALSE); - Status = Irp->IoStatus.Status; } } } @@ -212,7 +211,6 @@ DPRINT1("Class DO stub for major function 0x%lx\n", IoGetCurrentIrpStackLocation(Irp)->MajorFunction); ASSERT(FALSE); - Status = Irp->IoStatus.Status; } Irp->IoStatus.Status = Status; Modified: trunk/reactos/drivers/input/mouclass/mouclass.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mou…
============================================================================== --- trunk/reactos/drivers/input/mouclass/mouclass.c (original) +++ trunk/reactos/drivers/input/mouclass/mouclass.c Fri Nov 2 16:01:15 2007 @@ -120,7 +120,7 @@ IN PIRP Irp) { PCLASS_DEVICE_EXTENSION DeviceExtension; - NTSTATUS Status = Irp->IoStatus.Status; + NTSTATUS Status = STATUS_NOT_SUPPORTED; DPRINT("IRP_MJ_DEVICE_CONTROL\n"); @@ -180,7 +180,6 @@ DPRINT1("Port DO stub for major function 0x%lx\n", IoGetCurrentIrpStackLocation(Irp)->MajorFunction); ASSERT(FALSE); - Status = Irp->IoStatus.Status; } } } @@ -189,7 +188,6 @@ DPRINT1("Class DO stub for major function 0x%lx\n", IoGetCurrentIrpStackLocation(Irp)->MajorFunction); ASSERT(FALSE); - Status = Irp->IoStatus.Status; } Irp->IoStatus.Status = Status;
17 years, 1 month
1
0
0
0
[hpoussin] 30067: Add method to flush console input buffer
by hpoussin@svn.reactos.org
Author: hpoussin Date: Fri Nov 2 15:37:50 2007 New Revision: 30067 URL:
http://svn.reactos.org/svn/reactos?rev=30067&view=rev
Log: Add method to flush console input buffer Modified: trunk/reactos/base/setup/usetup/native/utils/console.c Modified: trunk/reactos/base/setup/usetup/native/utils/console.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/native/u…
============================================================================== --- trunk/reactos/base/setup/usetup/native/utils/console.c (original) +++ trunk/reactos/base/setup/usetup/native/utils/console.c Fri Nov 2 15:37:50 2007 @@ -57,7 +57,7 @@ FILE_ALL_ACCESS, &ObjectAttributes, &IoStatusBlock, - 0, + FILE_OPEN, FILE_SYNCHRONOUS_IO_ALERT); if (!NT_SUCCESS(Status)) return FALSE; @@ -74,8 +74,8 @@ FILE_ALL_ACCESS, &ObjectAttributes, &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_ALERT); + FILE_OPEN, + 0); if (!NT_SUCCESS(Status)) return FALSE; @@ -92,15 +92,12 @@ BOOL WINAPI FreeConsole(VOID) { - DPRINT("FreeConsole() called\n"); - if (StdInput != INVALID_HANDLE_VALUE) NtClose(StdInput); if (StdOutput != INVALID_HANDLE_VALUE) NtClose(StdOutput); - DPRINT("FreeConsole() done\n"); return TRUE; } @@ -148,17 +145,54 @@ } BOOL WINAPI +FlushConsoleInputBuffer( + IN HANDLE hConsoleInput) +{ + LARGE_INTEGER Offset, Timeout; + IO_STATUS_BLOCK IoStatusBlock; + KEYBOARD_INPUT_DATA InputData; + NTSTATUS Status; + + do + { + Offset.QuadPart = 0; + Status = NtReadFile( + hConsoleInput, + NULL, + NULL, + NULL, + &IoStatusBlock, + &InputData, + sizeof(KEYBOARD_INPUT_DATA), + &Offset, + 0); + if (Status == STATUS_PENDING) + { + Timeout.QuadPart = -100; + Status = NtWaitForSingleObject(hConsoleInput, FALSE, &Timeout); + if (Status == STATUS_TIMEOUT) + { + NtCancelIoFile(hConsoleInput, &IoStatusBlock); + return TRUE; + } + } + } while (NT_SUCCESS(Status)); + return FALSE; +} + +BOOL WINAPI ReadConsoleInput( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead) { + LARGE_INTEGER Offset; IO_STATUS_BLOCK IoStatusBlock; KEYBOARD_INPUT_DATA InputData; NTSTATUS Status; - lpBuffer->EventType = KEY_EVENT; + Offset.QuadPart = 0; Status = NtReadFile( hConsoleInput, NULL, @@ -167,11 +201,17 @@ &IoStatusBlock, &InputData, sizeof(KEYBOARD_INPUT_DATA), - NULL, + &Offset, 0); - if (!NT_SUCCESS(Status)) - return FALSE; - + if (Status == STATUS_PENDING) + { + Status = NtWaitForSingleObject(hConsoleInput, FALSE, NULL); + Status = IoStatusBlock.Status; + } + if (!NT_SUCCESS(Status)) + return FALSE; + + lpBuffer->EventType = KEY_EVENT; Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent); if (!NT_SUCCESS(Status)) return FALSE;
17 years, 1 month
1
0
0
0
[hpoussin] 30066: Support IRP cancellation
by hpoussin@svn.reactos.org
Author: hpoussin Date: Fri Nov 2 15:36:50 2007 New Revision: 30066 URL:
http://svn.reactos.org/svn/reactos?rev=30066&view=rev
Log: Support IRP cancellation Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c trunk/reactos/drivers/input/kbdclass/kbdclass.h trunk/reactos/drivers/input/mouclass/mouclass.c trunk/reactos/drivers/input/mouclass/mouclass.h Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbd…
============================================================================== --- trunk/reactos/drivers/input/kbdclass/kbdclass.c (original) +++ trunk/reactos/drivers/input/kbdclass/kbdclass.c Fri Nov 2 15:36:50 2007 @@ -19,6 +19,12 @@ static DRIVER_DISPATCH IrpStub; static DRIVER_ADD_DEVICE ClassAddDevice; static DRIVER_STARTIO ClassStartIo; +static DRIVER_CANCEL ClassCancelRoutine; +static NTSTATUS +HandleReadIrp( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + BOOLEAN IsInStartIo); static VOID NTAPI DriverUnload(IN PDRIVER_OBJECT DriverObject) @@ -82,7 +88,13 @@ IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PCLASS_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + KIRQL OldIrql; + NTSTATUS Status; + DPRINT("IRP_MJ_READ\n"); + + ASSERT(DeviceExtension->Common.IsClassDO); if (!((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsClassDO) return ForwardIrpAndForget(DeviceObject, Irp); @@ -96,9 +108,10 @@ return STATUS_BUFFER_TOO_SMALL; } - IoMarkIrpPending(Irp); - IoStartPacket(DeviceObject, Irp, NULL, NULL); - return STATUS_PENDING; + KeAcquireSpinLock(&DeviceExtension->SpinLock, &OldIrql); + Status = HandleReadIrp(DeviceObject, Irp, FALSE); + KeReleaseSpinLock(&DeviceExtension->SpinLock, OldIrql); + return Status; } static NTSTATUS NTAPI @@ -370,7 +383,6 @@ InitializeListHead(&DeviceExtension->ListHead); KeInitializeSpinLock(&DeviceExtension->ListSpinLock); KeInitializeSpinLock(&DeviceExtension->SpinLock); - DeviceExtension->ReadIsPending = FALSE; DeviceExtension->InputCount = 0; DeviceExtension->PortData = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(KEYBOARD_INPUT_DATA), CLASS_TAG); if (!DeviceExtension->PortData) @@ -454,56 +466,16 @@ IN OUT PULONG ConsumedCount) { PCLASS_DEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension; - PIRP Irp = NULL; KIRQL OldIrql; SIZE_T InputCount = DataEnd - DataStart; SIZE_T ReadSize; + DPRINT("ClassCallback()\n"); + ASSERT(ClassDeviceExtension->Common.IsClassDO); KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql); - - DPRINT("ClassCallback()\n"); - /* A filter driver might have consumed all the data already; I'm - * not sure if they are supposed to move the packets when they - * consume them though. - */ - if (ClassDeviceExtension->ReadIsPending == TRUE && InputCount) - { - /* A read request is waiting for input, so go straight to it */ - NTSTATUS Status; - SIZE_T NumberOfEntries; - - Irp = ClassDeviceObject->CurrentIrp; - ClassDeviceObject->CurrentIrp = NULL; - - NumberOfEntries = MIN( - InputCount, - IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length / sizeof(KEYBOARD_INPUT_DATA)); - - Status = FillEntries( - ClassDeviceObject, - Irp, - DataStart, - NumberOfEntries); - - if (NT_SUCCESS(Status)) - { - /* Go to next packet and complete this request with STATUS_SUCCESS */ - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = NumberOfEntries * sizeof(KEYBOARD_INPUT_DATA); - - ClassDeviceExtension->ReadIsPending = FALSE; - - /* Skip the packet we just sent away */ - DataStart += NumberOfEntries; - (*ConsumedCount) += (ULONG)NumberOfEntries; - InputCount -= NumberOfEntries; - } - } - - /* If we have data from the port driver and a higher service to send the data to */ - if (InputCount != 0) + if (InputCount > 0) { if (ClassDeviceExtension->InputCount + InputCount > ClassDeviceExtension->DriverExtension->DataQueueSize) { @@ -529,19 +501,12 @@ ClassDeviceExtension->InputCount += ReadSize; (*ConsumedCount) += (ULONG)ReadSize; - } - else - { - DPRINT("ClassCallback(): no more data to process\n"); - } - + + /* Complete pending IRP (if any) */ + if (ClassDeviceExtension->PendingIrp) + HandleReadIrp(ClassDeviceObject, ClassDeviceExtension->PendingIrp, FALSE); + } KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql); - - if (Irp != NULL) - { - IoStartNextPacket(ClassDeviceObject, FALSE); - IoCompleteRequest(Irp, IO_KEYBOARD_INCREMENT); - } DPRINT("Leaving ClassCallback()\n"); return TRUE; @@ -693,6 +658,7 @@ DPRINT("IoCreateDevice() failed with status 0x%08lx\n", Status); goto cleanup; } + IoSetStartIoAttributes(Fdo, TRUE, TRUE); DeviceExtension = (PPORT_DEVICE_EXTENSION)Fdo->DeviceExtension; RtlZeroMemory(DeviceExtension, sizeof(PORT_DEVICE_EXTENSION)); @@ -753,25 +719,60 @@ } static VOID NTAPI -ClassStartIo( +ClassCancelRoutine( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PCLASS_DEVICE_EXTENSION ClassDeviceExtension = DeviceObject->DeviceExtension; + KIRQL OldIrql; + BOOLEAN wasQueued = FALSE; + + DPRINT("ClassCancelRoutine(DeviceObject %p, Irp %p)\n", DeviceObject, Irp); + + ASSERT(ClassDeviceExtension->Common.IsClassDO); + + KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql); + IoAcquireCancelSpinLock(&OldIrql); + if (ClassDeviceExtension->PendingIrp == Irp) + { + ClassDeviceExtension->PendingIrp = NULL; + wasQueued = TRUE; + } + KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql); + + if (wasQueued) + { + Irp->IoStatus.Status = STATUS_CANCELLED; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + else + { + /* Hm, this shouldn't happen */ + ASSERT(FALSE); + } +} + +static NTSTATUS +HandleReadIrp( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + BOOLEAN IsInStartIo) +{ PCLASS_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + NTSTATUS Status; + + DPRINT("HandleReadIrp(DeviceObject %p, Irp %p)\n", DeviceObject, Irp); ASSERT(DeviceExtension->Common.IsClassDO); if (DeviceExtension->InputCount > 0) { - KIRQL oldIrql; - NTSTATUS Status; SIZE_T NumberOfEntries; NumberOfEntries = MIN( DeviceExtension->InputCount, IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length / sizeof(KEYBOARD_INPUT_DATA)); - - KeAcquireSpinLock(&DeviceExtension->SpinLock, &oldIrql); Status = FillEntries( DeviceObject, @@ -790,22 +791,55 @@ } DeviceExtension->InputCount -= NumberOfEntries; - DeviceExtension->ReadIsPending = FALSE; Irp->IoStatus.Information = NumberOfEntries * sizeof(KEYBOARD_INPUT_DATA); } /* Go to next packet and complete this request */ Irp->IoStatus.Status = Status; - KeReleaseSpinLock(&DeviceExtension->SpinLock, oldIrql); - + + if (IsInStartIo) + IoStartNextPacket(DeviceObject, TRUE); + + (VOID)IoSetCancelRoutine(Irp, NULL); IoCompleteRequest(Irp, IO_KEYBOARD_INCREMENT); - IoStartNextPacket(DeviceObject, FALSE); + DeviceExtension->PendingIrp = NULL; } else { - DeviceExtension->ReadIsPending = TRUE; - } + (VOID)IoSetCancelRoutine(Irp, ClassCancelRoutine); + if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL)) + { + DeviceExtension->PendingIrp = NULL; + Status = STATUS_CANCELLED; + } + else + { + IoMarkIrpPending(Irp); + DeviceExtension->PendingIrp = Irp; + Status = STATUS_PENDING; + if (!IsInStartIo) + IoStartPacket(DeviceObject, Irp, NULL, NULL); + } + } + return Status; +} + +static VOID NTAPI +ClassStartIo( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PCLASS_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + KIRQL OldIrql; + + DPRINT("ClassStartIo(DeviceObject %p, Irp %p)\n", DeviceObject, Irp); + + ASSERT(DeviceExtension->Common.IsClassDO); + + KeAcquireSpinLock(&DeviceExtension->SpinLock, &OldIrql); + HandleReadIrp(DeviceObject, Irp, TRUE); + KeReleaseSpinLock(&DeviceExtension->SpinLock, OldIrql); } static VOID NTAPI Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbd…
============================================================================== --- trunk/reactos/drivers/input/kbdclass/kbdclass.h (original) +++ trunk/reactos/drivers/input/kbdclass/kbdclass.h Fri Nov 2 15:36:50 2007 @@ -59,7 +59,7 @@ LIST_ENTRY ListHead; KSPIN_LOCK ListSpinLock; KSPIN_LOCK SpinLock; - BOOLEAN ReadIsPending; + PIRP PendingIrp; SIZE_T InputCount; PKEYBOARD_INPUT_DATA PortData; LPCWSTR DeviceName; Modified: trunk/reactos/drivers/input/mouclass/mouclass.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mou…
============================================================================== --- trunk/reactos/drivers/input/mouclass/mouclass.c (original) +++ trunk/reactos/drivers/input/mouclass/mouclass.c Fri Nov 2 15:36:50 2007 @@ -1,9 +1,9 @@ -/* +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS Mouse class driver * FILE: drivers/mouclass/mouclass.c * PURPOSE: Mouse class driver - * + * * PROGRAMMERS: Hervé Poussineau (hpoussin(a)reactos.org) */ @@ -19,6 +19,12 @@ static DRIVER_DISPATCH IrpStub; static DRIVER_ADD_DEVICE ClassAddDevice; static DRIVER_STARTIO ClassStartIo; +static DRIVER_CANCEL ClassCancelRoutine; +static NTSTATUS +HandleReadIrp( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + BOOLEAN IsInStartIo); static VOID NTAPI DriverUnload(IN PDRIVER_OBJECT DriverObject) @@ -82,7 +88,13 @@ IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PCLASS_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + KIRQL OldIrql; + NTSTATUS Status; + DPRINT("IRP_MJ_READ\n"); + + ASSERT(DeviceExtension->Common.IsClassDO); if (!((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsClassDO) return ForwardIrpAndForget(DeviceObject, Irp); @@ -96,9 +108,10 @@ return STATUS_BUFFER_TOO_SMALL; } - IoMarkIrpPending(Irp); - IoStartPacket(DeviceObject, Irp, NULL, NULL); - return STATUS_PENDING; + KeAcquireSpinLock(&DeviceExtension->SpinLock, &OldIrql); + Status = HandleReadIrp(DeviceObject, Irp, FALSE); + KeReleaseSpinLock(&DeviceExtension->SpinLock, OldIrql); + return Status; } static NTSTATUS NTAPI @@ -347,9 +360,8 @@ InitializeListHead(&DeviceExtension->ListHead); KeInitializeSpinLock(&DeviceExtension->ListSpinLock); KeInitializeSpinLock(&DeviceExtension->SpinLock); - DeviceExtension->ReadIsPending = FALSE; DeviceExtension->InputCount = 0; - DeviceExtension->PortData = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(KEYBOARD_INPUT_DATA), CLASS_TAG); + DeviceExtension->PortData = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(MOUSE_INPUT_DATA), CLASS_TAG); if (!DeviceExtension->PortData) { ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG); @@ -430,56 +442,16 @@ IN OUT PULONG ConsumedCount) { PCLASS_DEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension; - PIRP Irp = NULL; KIRQL OldIrql; SIZE_T InputCount = DataEnd - DataStart; SIZE_T ReadSize; + DPRINT("ClassCallback()\n"); + ASSERT(ClassDeviceExtension->Common.IsClassDO); KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql); - - DPRINT("ClassCallback()\n"); - /* A filter driver might have consumed all the data already; I'm - * not sure if they are supposed to move the packets when they - * consume them though. - */ - if (ClassDeviceExtension->ReadIsPending == TRUE && InputCount) - { - /* A read request is waiting for input, so go straight to it */ - NTSTATUS Status; - SIZE_T NumberOfEntries; - - Irp = ClassDeviceObject->CurrentIrp; - ClassDeviceObject->CurrentIrp = NULL; - - NumberOfEntries = MIN( - InputCount, - IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length / sizeof(MOUSE_INPUT_DATA)); - - Status = FillEntries( - ClassDeviceObject, - Irp, - DataStart, - NumberOfEntries); - - if (NT_SUCCESS(Status)) - { - /* Go to next packet and complete this request with STATUS_SUCCESS */ - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = NumberOfEntries * sizeof(MOUSE_INPUT_DATA); - - ClassDeviceExtension->ReadIsPending = FALSE; - - /* Skip the packet we just sent away */ - DataStart += NumberOfEntries; - (*ConsumedCount) += (ULONG)NumberOfEntries; - InputCount -= NumberOfEntries; - } - } - - /* If we have data from the port driver and a higher service to send the data to */ - if (InputCount != 0) + if (InputCount > 0) { if (ClassDeviceExtension->InputCount + InputCount > ClassDeviceExtension->DriverExtension->DataQueueSize) { @@ -505,19 +477,12 @@ ClassDeviceExtension->InputCount += ReadSize; (*ConsumedCount) += (ULONG)ReadSize; - } - else - { - DPRINT("ClassCallback(): no more data to process\n"); - } - + + /* Complete pending IRP (if any) */ + if (ClassDeviceExtension->PendingIrp) + HandleReadIrp(ClassDeviceObject, ClassDeviceExtension->PendingIrp, FALSE); + } KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql); - - if (Irp != NULL) - { - IoStartNextPacket(ClassDeviceObject, FALSE); - IoCompleteRequest(Irp, IO_MOUSE_INCREMENT); - } DPRINT("Leaving ClassCallback()\n"); return TRUE; @@ -669,6 +634,7 @@ DPRINT("IoCreateDevice() failed with status 0x%08lx\n", Status); goto cleanup; } + IoSetStartIoAttributes(Fdo, TRUE, TRUE); DeviceExtension = (PPORT_DEVICE_EXTENSION)Fdo->DeviceExtension; RtlZeroMemory(DeviceExtension, sizeof(PORT_DEVICE_EXTENSION)); @@ -729,25 +695,60 @@ } static VOID NTAPI -ClassStartIo( +ClassCancelRoutine( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PCLASS_DEVICE_EXTENSION ClassDeviceExtension = DeviceObject->DeviceExtension; + KIRQL OldIrql; + BOOLEAN wasQueued = FALSE; + + DPRINT("ClassCancelRoutine(DeviceObject %p, Irp %p)\n", DeviceObject, Irp); + + ASSERT(ClassDeviceExtension->Common.IsClassDO); + + KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql); + IoAcquireCancelSpinLock(&OldIrql); + if (ClassDeviceExtension->PendingIrp == Irp) + { + ClassDeviceExtension->PendingIrp = NULL; + wasQueued = TRUE; + } + KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql); + + if (wasQueued) + { + Irp->IoStatus.Status = STATUS_CANCELLED; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + else + { + /* Hm, this shouldn't happen */ + ASSERT(FALSE); + } +} + +static NTSTATUS +HandleReadIrp( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + BOOLEAN IsInStartIo) +{ PCLASS_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + NTSTATUS Status; + + DPRINT("HandleReadIrp(DeviceObject %p, Irp %p)\n", DeviceObject, Irp); ASSERT(DeviceExtension->Common.IsClassDO); if (DeviceExtension->InputCount > 0) { - KIRQL oldIrql; - NTSTATUS Status; SIZE_T NumberOfEntries; NumberOfEntries = MIN( DeviceExtension->InputCount, IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length / sizeof(MOUSE_INPUT_DATA)); - - KeAcquireSpinLock(&DeviceExtension->SpinLock, &oldIrql); Status = FillEntries( DeviceObject, @@ -766,22 +767,55 @@ } DeviceExtension->InputCount -= NumberOfEntries; - DeviceExtension->ReadIsPending = FALSE; Irp->IoStatus.Information = NumberOfEntries * sizeof(MOUSE_INPUT_DATA); } /* Go to next packet and complete this request */ Irp->IoStatus.Status = Status; - KeReleaseSpinLock(&DeviceExtension->SpinLock, oldIrql); - + + if (IsInStartIo) + IoStartNextPacket(DeviceObject, TRUE); + + (VOID)IoSetCancelRoutine(Irp, NULL); IoCompleteRequest(Irp, IO_MOUSE_INCREMENT); - IoStartNextPacket(DeviceObject, FALSE); + DeviceExtension->PendingIrp = NULL; } else { - DeviceExtension->ReadIsPending = TRUE; - } + (VOID)IoSetCancelRoutine(Irp, ClassCancelRoutine); + if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL)) + { + DeviceExtension->PendingIrp = NULL; + Status = STATUS_CANCELLED; + } + else + { + IoMarkIrpPending(Irp); + DeviceExtension->PendingIrp = Irp; + Status = STATUS_PENDING; + if (!IsInStartIo) + IoStartPacket(DeviceObject, Irp, NULL, NULL); + } + } + return Status; +} + +static VOID NTAPI +ClassStartIo( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PCLASS_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + KIRQL OldIrql; + + DPRINT("ClassStartIo(DeviceObject %p, Irp %p)\n", DeviceObject, Irp); + + ASSERT(DeviceExtension->Common.IsClassDO); + + KeAcquireSpinLock(&DeviceExtension->SpinLock, &OldIrql); + HandleReadIrp(DeviceObject, Irp, TRUE); + KeReleaseSpinLock(&DeviceExtension->SpinLock, OldIrql); } static VOID NTAPI Modified: trunk/reactos/drivers/input/mouclass/mouclass.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mou…
============================================================================== --- trunk/reactos/drivers/input/mouclass/mouclass.h (original) +++ trunk/reactos/drivers/input/mouclass/mouclass.h Fri Nov 2 15:36:50 2007 @@ -59,7 +59,7 @@ LIST_ENTRY ListHead; KSPIN_LOCK ListSpinLock; KSPIN_LOCK SpinLock; - BOOLEAN ReadIsPending; + PIRP PendingIrp; SIZE_T InputCount; PMOUSE_INPUT_DATA PortData; LPCWSTR DeviceName;
17 years, 1 month
1
0
0
0
[janderwald] 30065: - add szClass to static context menu struct - remove szCmd from static context menu struct - let ShellExecuteEx do the work of executing static context menu - remove DoOpenExplore function, the verbs "open" + "explore" are now read from registry depending on the class - check if there are dynamic / static available shell extensions
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Nov 2 15:08:57 2007 New Revision: 30065 URL:
http://svn.reactos.org/svn/reactos?rev=30065&view=rev
Log: - add szClass to static context menu struct - remove szCmd from static context menu struct - let ShellExecuteEx do the work of executing static context menu - remove DoOpenExplore function, the verbs "open" + "explore" are now read from registry depending on the class - check if there are dynamic / static available shell extensions Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_item…
============================================================================== --- trunk/reactos/dll/win32/shell32/shv_item_cmenu.c (original) +++ trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Fri Nov 2 15:08:57 2007 @@ -46,7 +46,7 @@ typedef struct _StaticShellEntry_ { LPWSTR szVerb; - LPWSTR szCmd; + LPWSTR szClass; struct _StaticShellEntry_ * Next; }StaticShellEntry, *PStaticShellEntry; @@ -208,8 +208,8 @@ while(nextEntry) { nextEntry = nextEntry->Next; - free(curEntry->szCmd); free(curEntry->szVerb); + free(curEntry->szClass); free(curEntry); curEntry = nextEntry; } @@ -368,37 +368,10 @@ } void -SH_AddStaticEntry(ItemCmImpl * This, HKEY hKey, WCHAR *szVerb) -{ - WCHAR szBuffer[50]; - WCHAR szCmd[100]; - DWORD dwCmd, dwBuffer; - LONG result; - HKEY hSubKey; +SH_AddStaticEntry(ItemCmImpl * This, HKEY hKey, WCHAR *szVerb, WCHAR * szClass) +{ PStaticShellEntry curEntry; PStaticShellEntry lastEntry = NULL; - - wcscpy(szBuffer, szVerb); - wcscat(szBuffer, L"\\command"); - - TRACE("szBuffer %s\n", debugstr_w(szBuffer)); - - result = RegOpenKeyExW(hKey, szBuffer, 0, KEY_READ, &hSubKey); - if (result != ERROR_SUCCESS) - { - TRACE("RegOpenKeyEx failed with 0x%x\n", result); - return; - } - dwCmd = sizeof(szCmd); - dwBuffer = 50; - result = RegEnumValueW(hSubKey, 0, szBuffer, &dwBuffer, 0, NULL, (LPBYTE)szCmd, &dwCmd); - RegCloseKey(hSubKey); - if (result != ERROR_SUCCESS) - { - TRACE("RegGetValueW failed with 0x%x\n", result); - return; - } - TRACE("SH_AddStaticEntry szBuffer %s szCmd %s\n", debugstr_w(szBuffer), debugstr_w(szCmd)); curEntry = This->head; @@ -413,12 +386,14 @@ curEntry = curEntry->Next; } + TRACE("adding verb %s szClass %s\n", debugstr_w(szVerb), debugstr_w(szClass)); + curEntry = malloc(sizeof(StaticShellEntry)); if (curEntry) { curEntry->Next = NULL; - curEntry->szCmd = wcsdup(szCmd); curEntry->szVerb = wcsdup(szVerb); + curEntry->szClass = wcsdup(szClass); } if (lastEntry) @@ -432,14 +407,12 @@ } void -SH_AddStaticEntryForKey(ItemCmImpl * This, HKEY hKey) +SH_AddStaticEntryForKey(ItemCmImpl * This, HKEY hKey, WCHAR * szClass) { LONG result; DWORD dwIndex; WCHAR szName[40]; DWORD dwName; - - TRACE("SH_AddStaticEntryForKey entered\n"); dwIndex = 0; do @@ -450,8 +423,7 @@ szName[39] = 0; if (result == ERROR_SUCCESS) { - TRACE("szVerb %s\n", debugstr_w(szName)); - SH_AddStaticEntry(This, hKey, szName); + SH_AddStaticEntry(This, hKey, szName, szClass); } dwIndex++; }while(result == ERROR_SUCCESS); @@ -472,7 +444,7 @@ result = RegOpenKeyExW(HKEY_CLASSES_ROOT, szBuffer, 0, KEY_READ | KEY_QUERY_VALUE, &hKey); if (result == ERROR_SUCCESS) { - SH_AddStaticEntryForKey(This, hKey); + SH_AddStaticEntryForKey(This, hKey, szExt); RegCloseKey(hKey); } @@ -480,13 +452,15 @@ result = RegGetValueW(HKEY_CLASSES_ROOT, szExt, NULL, RRF_RT_REG_SZ, NULL, (LPBYTE)szBuffer, &dwBuffer); if (result == ERROR_SUCCESS) { + UINT length = strlenW(szBuffer); wcscat(szBuffer, L"\\shell"); TRACE("szBuffer %s\n", debugstr_w(szBuffer)); result = RegOpenKeyExW(HKEY_CLASSES_ROOT, szBuffer, 0, KEY_READ | KEY_QUERY_VALUE, &hKey); if (result == ERROR_SUCCESS) { - SH_AddStaticEntryForKey(This, hKey); + szBuffer[length] = 0; + SH_AddStaticEntryForKey(This, hKey, szBuffer); RegCloseKey(hKey); } } @@ -496,18 +470,31 @@ result = RegGetValueW(HKEY_CLASSES_ROOT, szExt, L"PerceivedType", RRF_RT_REG_SZ, NULL, (LPBYTE)&szBuffer[23], &dwBuffer); if (result == ERROR_SUCCESS) { + UINT length = strlenW(szBuffer); wcscat(szBuffer, L"\\shell"); TRACE("szBuffer %s\n", debugstr_w(szBuffer)); result = RegOpenKeyExW(HKEY_CLASSES_ROOT, szBuffer, 0, KEY_READ | KEY_QUERY_VALUE, &hKey); if (result == ERROR_SUCCESS) { - SH_AddStaticEntryForKey(This, hKey); + szBuffer[length] = 0; + SH_AddStaticEntryForKey(This, hKey, szBuffer); RegCloseKey(hKey); } } RegCloseKey(hKey); } + +void +SH_AddStaticEntrySpecial(ItemCmImpl * This) +{ + if (_ILIsFolder(This->apidl[0])) // && (This->rfg & SFGAO_BROWSABLE)) + { + SH_AddStaticEntryForFileClass(This, L"Folder"); + } +} + + UINT SH_AddStaticEntryToMenu(HMENU hMenu, UINT indexMenu, ItemCmImpl * This) { @@ -584,7 +571,6 @@ char sBuffer[100]; WCHAR szExt[10]; - static const char sExplore[] = { '&','E','x','p','l','o','r','e',0 }; static const char sCopy[] = { '&','C','o','p','y',0 }; static const char sCut[] = { '&','C','u','t',0 }; static const char sDelete[] = { '&','D','e','l','e','t','e',0 }; @@ -602,10 +588,15 @@ sBuffer[0] = '.'; MultiByteToWideChar( CP_ACP, 0, sBuffer, -1, (LPWSTR)szExt, 10); SH_AddStaticEntryForFileClass(This, szExt); - indexMenu = SH_AddStaticEntryToMenu(hmenu, indexMenu, This); - _InsertMenuItem(hmenu, ++indexMenu, TRUE, 0, MFT_SEPARATOR, NULL, 0); - } - + } + else + { + SH_AddStaticEntrySpecial(This); + + } + indexMenu = SH_AddStaticEntryToMenu(hmenu, indexMenu, This); + + SetMenuDefaultItem(hmenu, 0, MF_BYPOSITION); pDataObj = IDataObject_Constructor(NULL, This->pidl, This->apidl, This->cidl); if (pDataObj) { @@ -619,21 +610,7 @@ _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Select", MFS_ENABLED); TRACE("rfg %x\n", This->rfg); - if (This->rfg & SFGAO_BROWSABLE) - { - if(This->bAllValues) - { - _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED); - _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, GetLocalizedString(hLocalMenu, FCIDM_SHVIEW_EXPLORE, sExplore, sBuffer), MFS_ENABLED); - } - else - { - _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, GetLocalizedString(hLocalMenu, FCIDM_SHVIEW_EXPLORE, sExplore, sBuffer), MFS_ENABLED); - _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED); - } - } - - SetMenuDefaultItem(hmenu, 0, MF_BYPOSITION); + if (This->rfg & (SFGAO_CANCOPY | SFGAO_CANMOVE)) { @@ -668,51 +645,6 @@ } return MAKE_HRESULT(SEVERITY_SUCCESS, 0, lastindex); -} - -/************************************************************************** -* DoOpenExplore -* -* for folders only -*/ - -static void DoOpenExplore( - IContextMenu2 *iface, - HWND hwnd, - LPCSTR verb) -{ - ItemCmImpl *This = (ItemCmImpl *)iface; - - UINT i, bFolderFound = FALSE; - LPITEMIDLIST pidlFQ; - SHELLEXECUTEINFOA sei; - - /* Find the first item in the list that is not a value. These commands - should never be invoked if there isn't at least one folder item in the list.*/ - - for(i = 0; i<This->cidl; i++) - { - if(!_ILIsValue(This->apidl[i])) - { - bFolderFound = TRUE; - break; - } - } - - if (!bFolderFound) return; - - pidlFQ = ILCombine(This->pidl, This->apidl[i]); - - ZeroMemory(&sei, sizeof(sei)); - sei.cbSize = sizeof(sei); - sei.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_CLASSNAME; - sei.lpIDList = pidlFQ; - sei.lpClass = "Folder"; - sei.hwnd = hwnd; - sei.nShow = SW_SHOWNORMAL; - sei.lpVerb = verb; - ShellExecuteExA(&sei); - SHFree(pidlFQ); } /************************************************************************** @@ -905,15 +837,10 @@ DoStaticShellExtensions(ItemCmImpl *This, LPCMINVOKECOMMANDINFO lpcmi) { UINT i; - WCHAR szTarget[MAX_PATH]; - WCHAR szTemp[MAX_PATH]; - WCHAR *ptr, *szCmd; PStaticShellEntry curEntry; LPITEMIDLIST pidl; - STARTUPINFOW sInfo; - PROCESS_INFORMATION pi; - - static const WCHAR szP1[] = { '%', '1', 0 }; + UINT bFolderFound = FALSE; + SHELLEXECUTEINFOW sei; TRACE("DoStaticShellExtensions entered with lpVerb %x first %x last %x\n", LOWORD(lpcmi->lpVerb), This->iIdSCMFirst, This->iIdSCMLast); @@ -935,47 +862,38 @@ return E_UNEXPECTED; } - ExpandEnvironmentStringsW(curEntry->szCmd, szTarget, MAX_PATH); - - ptr = wcsstr(szTarget, szP1); - if (ptr) - { - ptr[1] = 's'; - pidl = ILCombine(This->pidl, This->apidl[0]); - if (pidl) - { - WCHAR szPath[MAX_PATH]; - if (SHGetPathFromIDListW(pidl, szPath)) - { - sprintfW(szTemp, szTarget, szPath); - } - SHFree(pidl); - } - else - { - ptr[0] = 0; - } - ptr = szTemp; - } - else - { - ptr = szTarget; - } - - ZeroMemory(&sInfo, sizeof(sInfo)); - sInfo.cb = sizeof(sizeof(sInfo)); - szCmd = wcsdup(ptr); - - if (!szCmd) - return E_OUTOFMEMORY; - - if (CreateProcessW(NULL, szCmd, NULL, NULL,FALSE,0,NULL,NULL,&sInfo, &pi)) - { - CloseHandle( pi.hProcess ); - CloseHandle( pi.hThread ); - } - free(szCmd); - return S_OK; + for(i = 0; i<This->cidl; i++) + { + if(!_ILIsValue(This->apidl[i])) + { + bFolderFound = TRUE; + break; + } + } + + if (bFolderFound && wcsicmp(curEntry->szClass, L"Folder")) + { + /* when there is a folder with item selected + * do nothing + */ + return S_OK; + } + + TRACE("curEntry %p verb %s szClass %s\n", curEntry, debugstr_w(curEntry->szVerb), debugstr_w(curEntry->szClass)); + + pidl = ILCombine(This->pidl, This->apidl[0]); + + ZeroMemory(&sei, sizeof(sei)); + sei.cbSize = sizeof(sei); + sei.fMask = SEE_MASK_CLASSNAME | SEE_MASK_IDLIST; + sei.lpIDList = pidl; + sei.lpClass = curEntry->szClass; + sei.hwnd = lpcmi->hwnd; + sei.nShow = SW_SHOWNORMAL; + sei.lpVerb = curEntry->szVerb; + ShellExecuteExW(&sei); + SHFree(pidl); + return S_OK; } HRESULT @@ -1032,14 +950,6 @@ { switch(LOWORD(lpcmi->lpVerb)) { - case FCIDM_SHVIEW_EXPLORE: - TRACE("Verb FCIDM_SHVIEW_EXPLORE\n"); - DoOpenExplore(iface, lpcmi->hwnd, "explore"); - break; - case FCIDM_SHVIEW_OPEN: - TRACE("Verb FCIDM_SHVIEW_OPEN\n"); - DoOpenExplore(iface, lpcmi->hwnd, "open"); - break; case FCIDM_SHVIEW_RENAME: TRACE("Verb FCIDM_SHVIEW_RENAME\n"); DoRename(iface, lpcmi->hwnd); @@ -1061,16 +971,21 @@ DoProperties(iface, lpcmi->hwnd); break; default: - if (LOWORD(lpcmi->lpVerb) >= This->iIdSHEFirst && LOWORD(lpcmi->lpVerb) <= This->iIdSHELast) + TRACE("iIdSHEFirst %x iIdSHELast %x iIdSCMFirst %x iIdSCMLast %x\n", This->iIdSHEFirst, This->iIdSHELast, This->iIdSCMFirst, This->iIdSCMLast); + if (This->iIdSHEFirst && This->iIdSHELast) { - return DoDynamicShellExtensions(This, lpcmi); + if (LOWORD(lpcmi->lpVerb) >= This->iIdSHEFirst && LOWORD(lpcmi->lpVerb) <= This->iIdSHELast) + { + return DoDynamicShellExtensions(This, lpcmi); + } } - - if (LOWORD(lpcmi->lpVerb) >= This->iIdSCMFirst && LOWORD(lpcmi->lpVerb) <= This->iIdSCMLast) + if (This->iIdSCMFirst && This->iIdSCMLast) { - return DoStaticShellExtensions(This, lpcmi); + if (LOWORD(lpcmi->lpVerb) >= This->iIdSCMFirst && LOWORD(lpcmi->lpVerb) <= This->iIdSCMLast) + { + return DoStaticShellExtensions(This, lpcmi); + } } - FIXME("Unhandled Verb %xl\n",LOWORD(lpcmi->lpVerb)); } }
17 years, 1 month
1
0
0
0
[jimtabor] 30064: Win32k: - Forked dcutil and gdibatch. - Added our first batch SetBrushOrg. - cleaned up dcutil. - Added dcattr support for NtGdiSetBrushOrg. - Tested with qemu and hardware. Needs vendor app testing.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Nov 2 07:23:31 2007 New Revision: 30064 URL:
http://svn.reactos.org/svn/reactos?rev=30064&view=rev
Log: Win32k: - Forked dcutil and gdibatch. - Added our first batch SetBrushOrg. - cleaned up dcutil. - Added dcattr support for NtGdiSetBrushOrg. - Tested with qemu and hardware. Needs vendor app testing. Added: trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c - copied, changed from r30063, trunk/reactos/subsystems/win32/win32k/objects/dcutil.c Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c trunk/reactos/subsystems/win32/win32k/objects/dcutil.c trunk/reactos/subsystems/win32/win32k/win32k.rbuild Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/brush.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/brush.c Fri Nov 2 07:23:31 2007 @@ -624,6 +624,31 @@ dc->Dc_Attr.ptlBrushOrigin.x = XOrg; dc->Dc_Attr.ptlBrushOrigin.y = YOrg; + + if (dc->pDc_Attr) + { + PDC_ATTR Dc_Attr = dc->pDc_Attr; + NTSTATUS Status = STATUS_SUCCESS; + _SEH_TRY + { + ProbeForWrite(Dc_Attr, + sizeof(DC_ATTR), + 1); + Dc_Attr->ptlBrushOrigin = dc->Dc_Attr.ptlBrushOrigin; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + DC_UnlockDc(dc); + SetLastNtError(Status); + return FALSE; + } + } DC_UnlockDc(dc); return TRUE; Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c Fri Nov 2 07:23:31 2007 @@ -30,8 +30,7 @@ Dc_Attr->ulPenClr = dc->Dc_Attr.ulPenClr; Dc_Attr->crPenClr = dc->Dc_Attr.crPenClr; - Dc_Attr->ptlBrushOrigin.x = dc->Dc_Attr.ptlBrushOrigin.x; - Dc_Attr->ptlBrushOrigin.y = dc->Dc_Attr.ptlBrushOrigin.y; + Dc_Attr->ptlBrushOrigin = dc->Dc_Attr.ptlBrushOrigin; Dc_Attr->lTextAlign = dc->Dc_Attr.lTextAlign; Dc_Attr->lTextExtra = dc->Dc_Attr.lTextExtra; @@ -40,16 +39,11 @@ Dc_Attr->iMapMode = dc->Dc_Attr.iMapMode; Dc_Attr->iGraphicsMode = dc->Dc_Attr.iGraphicsMode; - Dc_Attr->ptlCurrent.x = dc->Dc_Attr.ptlCurrent.x; - Dc_Attr->ptlCurrent.y = dc->Dc_Attr.ptlCurrent.y; - Dc_Attr->ptlWindowOrg.x = dc->Dc_Attr.ptlWindowOrg.x; - Dc_Attr->ptlWindowOrg.y = dc->Dc_Attr.ptlWindowOrg.y; - Dc_Attr->szlWindowExt.cx = dc->Dc_Attr.szlWindowExt.cx; - Dc_Attr->szlWindowExt.cy = dc->Dc_Attr.szlWindowExt.cy; - Dc_Attr->ptlViewportOrg.x = dc->Dc_Attr.ptlViewportOrg.x; - Dc_Attr->ptlViewportOrg.y = dc->Dc_Attr.ptlViewportOrg.y; - Dc_Attr->szlViewportExt.cx = dc->Dc_Attr.szlViewportExt.cx; - Dc_Attr->szlViewportExt.cy = dc->Dc_Attr.szlViewportExt.cy; + Dc_Attr->ptlCurrent = dc->Dc_Attr.ptlCurrent; + Dc_Attr->ptlWindowOrg = dc->Dc_Attr.ptlWindowOrg; + Dc_Attr->szlWindowExt = dc->Dc_Attr.szlWindowExt; + Dc_Attr->ptlViewportOrg = dc->Dc_Attr.ptlViewportOrg; + Dc_Attr->szlViewportExt = dc->Dc_Attr.szlViewportExt; Dc_Attr->ulDirty_ = dc->Dc_Attr.ulDirty_; //Copy flags! We may have set them. @@ -268,80 +262,3 @@ return Ret; } -// -// -// Gdi Batch Flush support functions. -// - - -// -// Process the batch. -// -ULONG -FASTCALL -GdiFlushUserBatch(HDC hDC, PGDIBATCHHDR pHdr) -{ - switch(pHdr->Cmd) - { - case GdiBCPatBlt: // Highest pri first! - case GdiBCPolyPatBlt: - case GdiBCTextOut: - case GdiBCExtTextOut: - case GdiBCSetBrushOrg: - case GdiBCExtSelClipRgn: - case GdiBCSelObj: - case GdiBCDelObj: - case GdiBCDelRgn: - default: - return 0; - } - return pHdr->Size; // Return the full size of the structure. -} - -/* - * NtGdiFlush - * - * Flushes the calling thread's current batch. - */ -VOID -APIENTRY -NtGdiFlush(VOID) -{ - UNIMPLEMENTED; -} - -/* - * NtGdiFlushUserBatch - * - * Callback for thread batch flush routine. - * - * Think small & fast! - */ -NTSTATUS -APIENTRY -NtGdiFlushUserBatch(VOID) -{ - PTEB pTeb = NtCurrentTeb(); - ULONG GdiBatchCount = pTeb->GdiBatchCount; - - if( (GdiBatchCount > 0) && (GdiBatchCount <= GDIBATCHBUFSIZE)) - { - HDC hDC = (HDC) pTeb->GdiTebBatch.HDC; - if (hDC) - { - PULONG pHdr = &pTeb->GdiTebBatch.Buffer[0]; - // No need to init anything, just go! - for (; GdiBatchCount > 0; GdiBatchCount--) - { - // Process Gdi Batch! - pHdr += GdiFlushUserBatch( hDC, (PGDIBATCHHDR) pHdr ); - } - // Exit and clear out for the next round. - pTeb->GdiTebBatch.Offset = 0; - pTeb->GdiBatchCount = 0; - pTeb->GdiTebBatch.HDC = 0; - } - } - return STATUS_SUCCESS; -} - Copied: trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c (from r30063, trunk/reactos/subsystems/win32/win32k/objects/dcutil.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c Fri Nov 2 07:23:31 2007 @@ -4,269 +4,6 @@ #define NDEBUG #include <debug.h> -static -VOID -CopytoUserDcAttr(PDC dc, PDC_ATTR Dc_Attr, FLONG Dirty) -{ - Dc_Attr->hpen = dc->Dc_Attr.hpen; - Dc_Attr->hbrush = dc->Dc_Attr.hbrush; - Dc_Attr->hColorSpace = dc->Dc_Attr.hColorSpace; - Dc_Attr->hlfntNew = dc->Dc_Attr.hlfntNew; - - Dc_Attr->jROP2 = dc->Dc_Attr.jROP2; - Dc_Attr->jFillMode = dc->Dc_Attr.jFillMode; - Dc_Attr->jStretchBltMode = dc->Dc_Attr.jStretchBltMode; - Dc_Attr->lRelAbs = dc->Dc_Attr.lRelAbs; - Dc_Attr->jBkMode = dc->Dc_Attr.jBkMode; - - Dc_Attr->crBackgroundClr = dc->Dc_Attr.crBackgroundClr; - Dc_Attr->ulBackgroundClr = dc->Dc_Attr.ulBackgroundClr; - Dc_Attr->crForegroundClr = dc->Dc_Attr.crForegroundClr; - Dc_Attr->ulForegroundClr = dc->Dc_Attr.ulForegroundClr; - - Dc_Attr->ulBrushClr = dc->Dc_Attr.ulBrushClr; - Dc_Attr->crBrushClr = dc->Dc_Attr.crBrushClr; - - Dc_Attr->ulPenClr = dc->Dc_Attr.ulPenClr; - Dc_Attr->crPenClr = dc->Dc_Attr.crPenClr; - - Dc_Attr->ptlBrushOrigin.x = dc->Dc_Attr.ptlBrushOrigin.x; - Dc_Attr->ptlBrushOrigin.y = dc->Dc_Attr.ptlBrushOrigin.y; - - Dc_Attr->lTextAlign = dc->Dc_Attr.lTextAlign; - Dc_Attr->lTextExtra = dc->Dc_Attr.lTextExtra; - Dc_Attr->cBreak = dc->Dc_Attr.cBreak; - Dc_Attr->lBreakExtra = dc->Dc_Attr.lBreakExtra; - Dc_Attr->iMapMode = dc->Dc_Attr.iMapMode; - Dc_Attr->iGraphicsMode = dc->Dc_Attr.iGraphicsMode; - - Dc_Attr->ptlCurrent.x = dc->Dc_Attr.ptlCurrent.x; - Dc_Attr->ptlCurrent.y = dc->Dc_Attr.ptlCurrent.y; - Dc_Attr->ptlWindowOrg.x = dc->Dc_Attr.ptlWindowOrg.x; - Dc_Attr->ptlWindowOrg.y = dc->Dc_Attr.ptlWindowOrg.y; - Dc_Attr->szlWindowExt.cx = dc->Dc_Attr.szlWindowExt.cx; - Dc_Attr->szlWindowExt.cy = dc->Dc_Attr.szlWindowExt.cy; - Dc_Attr->ptlViewportOrg.x = dc->Dc_Attr.ptlViewportOrg.x; - Dc_Attr->ptlViewportOrg.y = dc->Dc_Attr.ptlViewportOrg.y; - Dc_Attr->szlViewportExt.cx = dc->Dc_Attr.szlViewportExt.cx; - Dc_Attr->szlViewportExt.cy = dc->Dc_Attr.szlViewportExt.cy; - - Dc_Attr->ulDirty_ = dc->Dc_Attr.ulDirty_; //Copy flags! We may have set them. - - XForm2MatrixS( &Dc_Attr->mxWorldToDevice, &dc->w.xformWorld2Vport); - XForm2MatrixS( &Dc_Attr->mxDevicetoWorld, &dc->w.xformVport2World); - XForm2MatrixS( &Dc_Attr->mxWorldToPage, &dc->w.xformWorld2Wnd); -} - -static -VOID -CopyFromUserDcAttr(PDC dc, PDC_ATTR Dc_Attr, FLONG Dirty) -{ - if ( (Dirty & DIRTY_FILL) || (Dc_Attr->ulDirty_ & DIRTY_FILL)) - { - dc->Dc_Attr.ulBrushClr = Dc_Attr->ulBrushClr; - dc->Dc_Attr.crBrushClr = Dc_Attr->crBrushClr; - Dc_Attr->ulDirty_ &= ~DIRTY_FILL; - } - if ( Dirty & DIRTY_LINE || (Dc_Attr->ulDirty_ & DIRTY_LINE)) - { - dc->Dc_Attr.crBackgroundClr = Dc_Attr->crBackgroundClr; - dc->Dc_Attr.ulBackgroundClr = Dc_Attr->ulBackgroundClr; - dc->Dc_Attr.ulPenClr = Dc_Attr->ulPenClr; - dc->Dc_Attr.crPenClr = Dc_Attr->crPenClr; - Dc_Attr->ulDirty_ &= ~DIRTY_LINE; - } - if ( Dirty & DIRTY_TEXT || (Dc_Attr->ulDirty_ & DIRTY_TEXT)) - { - dc->Dc_Attr.crForegroundClr = Dc_Attr->crForegroundClr; - dc->Dc_Attr.ulForegroundClr = Dc_Attr->ulForegroundClr; - Dc_Attr->ulDirty_ &= ~DIRTY_TEXT; - } - - if ( Dirty & (DC_MODE_DIRTY|DC_FONTTEXT_DIRTY) || - (Dc_Attr->ulDirty_ & (DC_MODE_DIRTY|DC_FONTTEXT_DIRTY))) - { - dc->Dc_Attr.jROP2 = Dc_Attr->jROP2; - dc->Dc_Attr.iGraphicsMode = Dc_Attr->iGraphicsMode; - dc->Dc_Attr.lFillMode = Dc_Attr->lFillMode; - dc->Dc_Attr.flFontMapper = Dc_Attr->flFontMapper; - dc->Dc_Attr.lBreakExtra = Dc_Attr->lBreakExtra; - dc->Dc_Attr.cBreak = Dc_Attr->cBreak; - } -} - -static -BOOL -ReadWriteVMDcAttr(PDC dc, FLONG Dirty, BOOL Write) -{ - BOOL Ret = FALSE; - KeEnterCriticalRegion(); - { - INT Index = GDI_HANDLE_GET_INDEX(dc->hHmgr); - PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; - HANDLE ProcessId = (HANDLE)(((ULONG_PTR)(Entry->ProcessId)) & ~1); - DC_ATTR lDc_AttrData; - - if(Entry->UserData) - { - NTSTATUS Status = ZwReadVirtualMemory ( ProcessId, - &(Entry->UserData), - &lDc_AttrData, - sizeof(DC_ATTR), - NULL ); - if (Write) - { - if (NT_SUCCESS(Status)) CopytoUserDcAttr(dc, &lDc_AttrData, Dirty); - Ret = TRUE; - } - else - { - if (NT_SUCCESS(Status)) CopyFromUserDcAttr(dc, &lDc_AttrData, Dirty); - Ret = TRUE; - } - if (Write) - Status = ZwWriteVirtualMemory ( ProcessId, - &(Entry->UserData), - &lDc_AttrData, - sizeof(DC_ATTR), - NULL ); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - Ret = FALSE; - } - } - } - KeLeaveCriticalRegion(); - return Ret; -} - - -BOOL -FASTCALL -DCU_UpdateUserXForms(PDC pDC, ULONG uMask) -{ - PDC_ATTR DC_Attr = pDC->pDc_Attr; - - if (!uMask) return FALSE; - - if (!DC_Attr) return FALSE; - else - { - NTSTATUS Status = STATUS_SUCCESS; - KeEnterCriticalRegion(); - _SEH_TRY - { - ProbeForWrite(DC_Attr, - sizeof(DC_ATTR), - 1); - if (uMask & WORLD_XFORM_CHANGED) - XForm2MatrixS( &DC_Attr->mxWorldToDevice, &pDC->w.xformWorld2Vport); - - if (uMask & DEVICE_TO_WORLD_INVALID) - XForm2MatrixS( &DC_Attr->mxDevicetoWorld, &pDC->w.xformVport2World); - - if (uMask & WORLD_TO_PAGE_IDENTITY) - XForm2MatrixS( &DC_Attr->mxWorldToPage, &pDC->w.xformWorld2Wnd); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - KeLeaveCriticalRegion(); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return FALSE; - } - } - return TRUE; -} - -BOOL -FASTCALL -DCU_SyncDcAttrtoUser(PDC dc, FLONG Dirty) -{ - BOOL TryHarder = FALSE; - PDC_ATTR Dc_Attr = dc->pDc_Attr; - if (!Dirty) return FALSE; - if (!Dc_Attr) return FALSE; - else - { - NTSTATUS Status = STATUS_SUCCESS; - KeEnterCriticalRegion(); - _SEH_TRY - { - ProbeForWrite(Dc_Attr, - sizeof(DC_ATTR), - 1); - CopytoUserDcAttr( dc, Dc_Attr, Dirty); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - KeLeaveCriticalRegion(); - if(!NT_SUCCESS(Status)) TryHarder = TRUE; - if (TryHarder) return ReadWriteVMDcAttr( dc, Dirty, TRUE); - } - return TRUE; -} - -BOOL -FASTCALL -DCU_SynchDcAttrtoUser(HDC hDC, FLONG Dirty) -{ - PDC pDC = DC_LockDc ( hDC ); - if (!pDC) return FALSE; - BOOL Ret = DCU_SyncDcAttrtoUser(pDC, Dirty); - DC_UnlockDc( pDC ); - return Ret; -} - -BOOL -FASTCALL -DCU_SyncDcAttrtoW32k(PDC dc, FLONG Dirty) -{ - BOOL TryHarder = FALSE; - PDC_ATTR Dc_Attr = dc->pDc_Attr; - if (!Dirty) return FALSE; - if (!Dc_Attr) return FALSE; - else - { - NTSTATUS Status = STATUS_SUCCESS; - KeEnterCriticalRegion(); - _SEH_TRY - { - ProbeForRead(Dc_Attr, - sizeof(DC_ATTR), - 1); - CopyFromUserDcAttr( dc, Dc_Attr, Dirty); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - KeLeaveCriticalRegion(); - if(!NT_SUCCESS(Status)) TryHarder = TRUE; - if (TryHarder) return ReadWriteVMDcAttr( dc, Dirty, FALSE); - } - return TRUE; -} - -BOOL -FASTCALL -DCU_SynchDcAttrtoW32k(HDC hDC, FLONG Dirty) -{ - PDC pDC = DC_LockDc ( hDC ); - if (!pDC) return FALSE; - BOOL Ret = DCU_SyncDcAttrtoW32k(pDC, Dirty); - DC_UnlockDc( pDC ); - return Ret; -} // // @@ -281,20 +18,38 @@ FASTCALL GdiFlushUserBatch(HDC hDC, PGDIBATCHHDR pHdr) { + PDC dc = DC_LockDc(hDC); + if (!dc) return 0; + // The thread is on the end of sunset. switch(pHdr->Cmd) { case GdiBCPatBlt: // Highest pri first! + break; case GdiBCPolyPatBlt: + break; case GdiBCTextOut: + break; case GdiBCExtTextOut: + break; case GdiBCSetBrushOrg: + { + PGDIBSSETBRHORG pgSBO = (PGDIBSSETBRHORG) pHdr; + dc->Dc_Attr.ptlBrushOrigin = pgSBO->ptlBrushOrigin; + break; + } case GdiBCExtSelClipRgn: + break; case GdiBCSelObj: + break; case GdiBCDelObj: + break; case GdiBCDelRgn: + break; default: + DC_UnlockDc(dc); return 0; } + DC_UnlockDc(dc); return pHdr->Size; // Return the full size of the structure. } Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/wi…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/win32k.rbuild (original) +++ trunk/reactos/subsystems/win32/win32k/win32k.rbuild Fri Nov 2 07:23:31 2007 @@ -148,6 +148,7 @@ <file>dcutil.c</file> <file>dibobj.c</file> <file>fillshap.c</file> + <file>gdibatch.c</file> <file>gdiobj.c</file> <file>icm.c</file> <file>line.c</file>
17 years, 1 month
1
0
0
0
[jimtabor] 30063: Move GDI_BATCH_LIMIT where it should go.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Nov 2 05:56:21 2007 New Revision: 30063 URL:
http://svn.reactos.org/svn/reactos?rev=30063&view=rev
Log: Move GDI_BATCH_LIMIT where it should go. Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h trunk/reactos/include/reactos/win32k/ntgdityp.h trunk/reactos/subsystems/win32/win32k/main/dllmain.c Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gd…
============================================================================== --- trunk/reactos/dll/win32/gdi32/include/gdi32p.h (original) +++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h Fri Nov 2 05:56:21 2007 @@ -6,7 +6,6 @@ * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net) */ -#define GDI_BATCH_LIMIT 20 /* DATA **********************************************************************/ Modified: trunk/reactos/include/reactos/win32k/ntgdityp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntg…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdityp.h (original) +++ trunk/reactos/include/reactos/win32k/ntgdityp.h Fri Nov 2 05:56:21 2007 @@ -78,6 +78,7 @@ } GETDCPOINT, *PGETDCPOINT; #define GDIBATCHBUFSIZE 0x136 +#define GDI_BATCH_LIMIT 20 typedef enum _GDIBATCHCMD { Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ma…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/main/dllmain.c (original) +++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c Fri Nov 2 05:56:21 2007 @@ -117,7 +117,7 @@ { /* map the gdi handle table to user land */ Process->Peb->GdiSharedHandleTable = GDI_MapHandleTable(GdiTableSection, Process); - Process->Peb->GdiDCAttributeList = 5; + Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT; } /* setup process flags */
17 years, 1 month
1
0
0
0
[janderwald] 30062: - turn off debug messages for X-time :)
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Nov 2 05:50:07 2007 New Revision: 30062 URL:
http://svn.reactos.org/svn/reactos?rev=30062&view=rev
Log: - turn off debug messages for X-time :) Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_item…
============================================================================== --- trunk/reactos/dll/win32/shell32/shv_item_cmenu.c (original) +++ trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Fri Nov 2 05:50:07 2007 @@ -23,7 +23,7 @@ #define COBJMACROS #define NONAMELESSUNION #define NONAMELESSSTRUCT -#define YDEBUG +//#define YDEBUG #include "winerror.h" #include "wine/debug.h"
17 years, 1 month
1
0
0
0
[janderwald] 30061: - refactor dynamic context menu loading - dynamic shell extensions should now work - WinRar extension is now working except for the email handling thing
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Nov 2 05:49:14 2007 New Revision: 30061 URL:
http://svn.reactos.org/svn/reactos?rev=30061&view=rev
Log: - refactor dynamic context menu loading - dynamic shell extensions should now work - WinRar extension is now working except for the email handling thing Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_item…
============================================================================== --- trunk/reactos/dll/win32/shell32/shv_item_cmenu.c (original) +++ trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Fri Nov 2 05:49:14 2007 @@ -50,6 +50,14 @@ struct _StaticShellEntry_ * Next; }StaticShellEntry, *PStaticShellEntry; +typedef struct _DynamicShellEntry_ +{ + UINT iIdCmdFirst; + UINT NumIds; + IContextMenu * CMenu; + struct _DynamicShellEntry_ * Next; +}DynamicShellEntry, *PDynamicShellEntry; + /************************************************************************** * IContextMenu Implementation */ @@ -62,9 +70,7 @@ LPITEMIDLIST *apidl; /* array of child pidls */ UINT cidl; BOOL bAllValues; - IContextMenu ** ecmenu; - UINT esize; - UINT ecount; + PDynamicShellEntry dhead; PStaticShellEntry head; UINT iIdSCMFirst; UINT iIdSCMLast; @@ -74,7 +80,7 @@ } ItemCmImpl; UINT -SH_EnumerateDynamicContextHandlerForKey(LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj, LPITEMIDLIST pidlFolder); +SH_EnumerateDynamicContextHandlerForKey(LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj); WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls); WCHAR *strdupW(LPWSTR str); static const IContextMenu2Vtbl cmvt; @@ -190,7 +196,7 @@ ULONG refCount = InterlockedDecrement(&This->ref); PStaticShellEntry curEntry; PStaticShellEntry nextEntry; - UINT i; + TRACE("(%p)->(count=%i)\n", This, refCount + 1); @@ -207,11 +213,6 @@ free(curEntry); curEntry = nextEntry; } - for(i = 0; i < This->ecount; i++) - { - IContextMenu_Release(This->ecmenu[i]); - } - HeapFree(GetProcessHeap(), 0, This->ecmenu); if(This->pSFParent) IShellFolder_Release(This->pSFParent); @@ -261,71 +262,41 @@ DoCustomItemAction(ItemCmImpl *This, LPARAM lParam, UINT uMsg) { IContextMenu2 * cmenu; - IContextMenu * menu; MEASUREITEMSTRUCT * lpmis = (MEASUREITEMSTRUCT *)lParam; - DRAWITEMSTRUCT * drawItem = (DRAWITEMSTRUCT *)lParam; HRESULT hResult; - + UINT i; + PDynamicShellEntry curEntry; TRACE("DoCustomItemAction entered with uMsg %x lParam %p\n", uMsg, lParam); - if (uMsg == WM_MEASUREITEM) + curEntry = This->dhead; + i = This->iIdSHEFirst; + + + while(curEntry) { - menu = This->ecmenu[lpmis->itemID - This->iIdSHEFirst]; + if (i == lpmis->itemID) + break; + + i++; + curEntry = curEntry->Next; } - else if (uMsg == WM_DRAWITEM) - { - menu = This->ecmenu[drawItem->itemID - This->iIdSHEFirst]; - } - else - { - ERR("unexpected message\n"); - return E_FAIL; - } - - if (!menu) - { - ERR("item is not valid\n"); - return E_FAIL; - } - - hResult = menu->lpVtbl->QueryInterface(menu, &IID_IContextMenu2, (void**)&cmenu); + + if (!curEntry) + return E_FAIL; + + hResult = IContextMenu_QueryInterface(curEntry->CMenu, &IID_IContextMenu2, (void**)&cmenu); if (hResult != S_OK) { ERR("failed to get IID_IContextMenu2 interface\n"); return hResult; } - hResult = cmenu->lpVtbl->HandleMenuMsg(cmenu, uMsg, (WPARAM)0, lParam); + hResult = IContextMenu2_HandleMenuMsg(cmenu, uMsg, (WPARAM)0, lParam); + IContextMenu2_Release(cmenu); + TRACE("returning hResult %x\n", hResult); return hResult; -} - -BOOL -SH_EnlargeContextMenuArray(ItemCmImpl *This, UINT newsize) -{ - BOOL ret = FALSE; - - if (This->ecmenu == NULL) - { - This->ecmenu = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, sizeof(IContextMenu*) *10); - if(This->ecmenu) - ret = TRUE; - This->ecount = 0; - This->esize = 10; - } - else - { - IContextMenu ** newcmenu = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IContextMenu*)*newsize); - if (newcmenu) - { - memcpy(newcmenu, This->ecmenu, This->ecount * sizeof(IContextMenu*)); - HeapFree(GetProcessHeap(), 0, This->ecmenu); - This->ecmenu = newcmenu; - ret = TRUE; - } - } - return ret; } UINT @@ -335,13 +306,13 @@ WCHAR buffer[111]; char ebuf[10]; HRESULT hr; - IContextMenu * cmenu; HRESULT hResult; - UINT idCmdFirst = 0x5000; + UINT idCmdFirst = 0x6000; UINT idCmdLast = 0xFFF0; + PDynamicShellEntry curEntry; static WCHAR szAny[] = { '*',0}; - SH_EnumerateDynamicContextHandlerForKey(szAny, This, pDataObj, This->pidl); + SH_EnumerateDynamicContextHandlerForKey(szAny, This, pDataObj); for (i = 0; i < This->cidl; i++) { @@ -355,7 +326,7 @@ if (hr == S_OK) { memcpy(&buffer[6], pwszCLSID, 38 * sizeof(WCHAR)); - SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj, This->pidl); + SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj); } } @@ -364,22 +335,33 @@ ebuf[0] = L'.'; buffer[0] = L'\0'; if (MultiByteToWideChar(CP_ACP, 0, ebuf, -1, buffer, 111)) - SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj, This->pidl); + SH_EnumerateDynamicContextHandlerForKey(buffer, This, pDataObj); } } - - TRACE("SH_LoadContextMenuHandlers num extensions %u\n", This->ecount); - This->iIdSHEFirst = idCmdFirst; - for (i = 0; i < This->ecount; i++) - { - cmenu = This->ecmenu[i]; - hResult = cmenu->lpVtbl->QueryContextMenu(cmenu, hMenu, indexMenu, idCmdFirst, idCmdLast, CMF_NORMAL); - if (SUCCEEDED(hResult)) - { - idCmdFirst += (hResult & 0xFFFF); - indexMenu +=(hResult & 0xFFFF); - } - } + TRACE("-- done loading\n"); + if (!This->dhead) + { + This->iIdSHEFirst = 0; + This->iIdSHELast = 0; + return indexMenu; + } + + curEntry = This->dhead; + do + { + + hResult = IContextMenu_QueryContextMenu(curEntry->CMenu, hMenu, indexMenu, idCmdFirst, idCmdLast, CMF_NORMAL); + if (SUCCEEDED(hResult)) + { + curEntry->iIdCmdFirst = idCmdFirst; + curEntry->NumIds = LOWORD(hResult); + indexMenu += curEntry->NumIds; + idCmdFirst += curEntry->NumIds + 0x10; + } + TRACE("curEntry %p hresult %x contextmenu %p cmdfirst %x num ids %x\n", curEntry, hResult, curEntry->CMenu, curEntry->iIdCmdFirst, curEntry->NumIds); + curEntry = curEntry->Next; + }while(curEntry); + This->iIdSHELast = idCmdFirst; TRACE("SH_LoadContextMenuHandlers first %x last %x\n", This->iIdSHEFirst, This->iIdSHELast); return indexMenu; @@ -1000,20 +982,28 @@ DoDynamicShellExtensions(ItemCmImpl *This, LPCMINVOKECOMMANDINFO lpcmi) { HRESULT hResult = NOERROR; - UINT i; - - TRACE("DoDynamicShellExtensions %p verb %x count %u\n",This, LOWORD(lpcmi->lpVerb), This->ecount); - for(i = 0; i < This->ecount; i++) - { - IContextMenu * cmenu = This->ecmenu[i]; - - hResult = cmenu->lpVtbl->InvokeCommand(cmenu, lpcmi); - if (SUCCEEDED(hResult)) - { + PDynamicShellEntry curEntry; + UINT id; + + curEntry = This->dhead; + id = LOWORD(lpcmi->lpVerb); + + while(curEntry) + { + if (curEntry->iIdCmdFirst <= id && curEntry->iIdCmdFirst + curEntry->NumIds >= id) break; - } - } - TRACE("DoShellExtensions result %x\n", hResult); + + curEntry = curEntry->Next; + } + + if (!curEntry) + return E_FAIL; + + lpcmi->lpVerb -= curEntry->iIdCmdFirst; + + hResult = IContextMenu_InvokeCommand(curEntry->CMenu, lpcmi); + + TRACE("DoDynamicShellExtensions hResult %x verb %x first %x\n", hResult, lpcmi->lpVerb, curEntry->iIdCmdFirst); return hResult; } @@ -1190,12 +1180,12 @@ }; HRESULT -SH_LoadDynamicContextMenuHandler(HKEY hKey, const CLSID * szClass, IContextMenu** ppv, IDataObject * pDataObj, LPITEMIDLIST pidlFolder) +SH_LoadDynamicContextMenuHandler(HKEY hKey, const CLSID * szClass, ItemCmImpl *This, IDataObject * pDataObj) { HRESULT hr; IContextMenu * cmobj; IShellExtInit *shext; - + PDynamicShellEntry curEntry; TRACE("SH_LoadDynamicContextMenuHandler entered with %s\n",wine_dbgstr_guid(szClass)); hr = SHCoCreateInstance(NULL, szClass, NULL, &IID_IContextMenu, (void**)&cmobj); @@ -1204,7 +1194,6 @@ TRACE("SHCoCreateInstance failed %x\n", GetLastError()); return hr; } - hr = cmobj->lpVtbl->QueryInterface(cmobj, &IID_IShellExtInit, (void**)&shext); if (hr != S_OK) { @@ -1215,21 +1204,43 @@ hr = shext->lpVtbl->Initialize(shext, NULL, pDataObj, hKey); if (hr != S_OK) { - TRACE("Failed to initialize shell extension\n"); + TRACE("Failed to initialize shell extension error %x\n", hr); shext->lpVtbl->Release(shext); cmobj->lpVtbl->Release(cmobj); + return hr; + } + curEntry = malloc(sizeof(DynamicShellEntry)); + if(!curEntry) + { + return E_OUTOFMEMORY; + } + + curEntry->iIdCmdFirst = 0; + curEntry->Next = NULL; + curEntry->NumIds = 0; + curEntry->CMenu = cmobj; + + if (This->dhead) + { + PDynamicShellEntry pEntry = This->dhead; + + while(pEntry->Next) + { + pEntry = pEntry->Next; + } + + pEntry->Next = curEntry; } else { - shext->lpVtbl->Release(shext); - *ppv = cmobj; + This->dhead = curEntry; } return hr; } UINT -SH_EnumerateDynamicContextHandlerForKey(const LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj, LPITEMIDLIST pidlFolder) +SH_EnumerateDynamicContextHandlerForKey(const LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj) { HKEY hKey; WCHAR szKey[MAX_PATH] = {0}; @@ -1237,7 +1248,6 @@ DWORD dwIndex, dwName; LONG res; HRESULT hResult; - IContextMenu * cmobj; UINT index; CLSID clsid; static const WCHAR szShellEx[] = { '\\','s','h','e','l','l','e','x','\\','C','o','n','t','e','x','t','M','e','n','u','H','a','n','d','l','e','r','s',0 }; @@ -1273,18 +1283,7 @@ TRACE("hResult %x szKey %s name %s\n",hResult, debugstr_w(szKey), debugstr_w(szName)); if (hResult == S_OK) { - hResult = SH_LoadDynamicContextMenuHandler(hKey, &clsid, &cmobj, pDataObj, pidlFolder); - } - if (hResult == S_OK) - { - if (This->ecount + 1 > This->esize) - { - if (!SH_EnlargeContextMenuArray(This, max(This->esize * 2, 10))) - break; - } - - This->ecmenu[This->ecount] = cmobj; - This->ecount++; + SH_LoadDynamicContextMenuHandler(hKey, &clsid, This, pDataObj); } } dwIndex++;
17 years, 1 month
1
0
0
0
[jimtabor] 30060: Assign define for gdi buffer size.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Nov 2 05:42:09 2007 New Revision: 30060 URL:
http://svn.reactos.org/svn/reactos?rev=30060&view=rev
Log: Assign define for gdi buffer size. Modified: trunk/reactos/include/reactos/win32k/ntgdityp.h trunk/reactos/subsystems/win32/win32k/objects/dcutil.c Modified: trunk/reactos/include/reactos/win32k/ntgdityp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntg…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdityp.h (original) +++ trunk/reactos/include/reactos/win32k/ntgdityp.h Fri Nov 2 05:42:09 2007 @@ -77,6 +77,8 @@ GdiGetDCOrg = 6, } GETDCPOINT, *PGETDCPOINT; +#define GDIBATCHBUFSIZE 0x136 + typedef enum _GDIBATCHCMD { GdiBCPatBlt, Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c Fri Nov 2 05:42:09 2007 @@ -324,7 +324,7 @@ PTEB pTeb = NtCurrentTeb(); ULONG GdiBatchCount = pTeb->GdiBatchCount; - if( (GdiBatchCount > 0) && (GdiBatchCount <= 310)) // 310 UL size of Buffer in TEB. + if( (GdiBatchCount > 0) && (GdiBatchCount <= GDIBATCHBUFSIZE)) { HDC hDC = (HDC) pTeb->GdiTebBatch.HDC; if (hDC)
17 years, 1 month
1
0
0
0
← Newer
1
...
83
84
85
86
87
88
89
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Results per page:
10
25
50
100
200