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
July 2009
----- 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
27 participants
605 discussions
Start a n
N
ew thread
[sginsberg] 42280: - Fix 41969 -- the wrong flag got set, creating a broken, unusable debug object. Please make sure you know basic C before trying some clever optimization. Debuggers should now work again...
by sginsberg@svn.reactos.org
Author: sginsberg Date: Tue Jul 28 23:48:49 2009 New Revision: 42280 URL:
http://svn.reactos.org/svn/reactos?rev=42280&view=rev
Log: - Fix 41969 -- the wrong flag got set, creating a broken, unusable debug object. Please make sure you know basic C before trying some clever optimization. Debuggers should now work again... Modified: trunk/reactos/ntoskrnl/dbgk/dbgkobj.c Modified: trunk/reactos/ntoskrnl/dbgk/dbgkobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/dbgk/dbgkobj.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/dbgk/dbgkobj.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/dbgk/dbgkobj.c [iso-8859-1] Tue Jul 28 23:48:49 2009 @@ -1564,7 +1564,11 @@ FALSE); /* Set the Flags */ - DebugObject->Flags = Flags; + DebugObject->Flags = 0; + if (Flags & DBGK_KILL_PROCESS_ON_EXIT) + { + DebugObject->KillProcessOnExit = TRUE; + } /* Insert it */ Status = ObInsertObject((PVOID)DebugObject,
15 years, 4 months
1
0
0
0
[janderwald] 42279: - Implement KsAcquireControl, KsReleaseControl - Add create item for creation of pins and topology nodes - Implement pin creation handler
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Jul 28 21:32:22 2009 New Revision: 42279 URL:
http://svn.reactos.org/svn/reactos?rev=42279&view=rev
Log: - Implement KsAcquireControl, KsReleaseControl - Add create item for creation of pins and topology nodes - Implement pin creation handler Modified: trunk/reactos/drivers/ksfilter/ks/api.c trunk/reactos/drivers/ksfilter/ks/device.c trunk/reactos/drivers/ksfilter/ks/filter.c trunk/reactos/drivers/ksfilter/ks/filterfactory.c trunk/reactos/drivers/ksfilter/ks/ksfunc.h trunk/reactos/drivers/ksfilter/ks/kstypes.h trunk/reactos/drivers/ksfilter/ks/pin.c Modified: trunk/reactos/drivers/ksfilter/ks/api.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/api.c?…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/api.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/api.c [iso-8859-1] Tue Jul 28 21:32:22 2009 @@ -1449,7 +1449,7 @@ } /* - @unimplemented + @implemented */ KSDDKAPI VOID @@ -1457,8 +1457,32 @@ KsAcquireControl( IN PVOID Object) { - UNIMPLEMENTED -} + PKSBASIC_HEADER BasicHeader = (PKSBASIC_HEADER)((ULONG_PTR)Object - sizeof(KSBASIC_HEADER)); + + /* sanity check */ + ASSERT(BasicHeader->Type == KsObjectTypeFilter || BasicHeader->Type == KsObjectTypePin); + + KeWaitForSingleObject(&BasicHeader->ControlMutex, Executive, KernelMode, FALSE, NULL); + +} + +/* + @implemented +*/ +VOID +NTAPI +KsReleaseControl( + IN PVOID Object) +{ + PKSBASIC_HEADER BasicHeader = (PKSBASIC_HEADER)((ULONG_PTR)Object - sizeof(KSBASIC_HEADER)); + + /* sanity check */ + ASSERT(BasicHeader->Type == KsObjectTypeFilter || BasicHeader->Type == KsObjectTypePin); + + KeReleaseMutex(&BasicHeader->ControlMutex, FALSE); +} + + /* @implemented @@ -1796,17 +1820,6 @@ /* @unimplemented */ -VOID -NTAPI -KsReleaseControl( - IN PVOID Object) -{ - UNIMPLEMENTED -} - -/* - @unimplemented -*/ NTSTATUS NTAPI KsRegisterFilterWithNoKSPins( Modified: trunk/reactos/drivers/ksfilter/ks/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/device…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/device.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/device.c [iso-8859-1] Tue Jul 28 21:32:22 2009 @@ -683,7 +683,6 @@ Header->KsDevice.Descriptor = Descriptor; KsSetDevicePnpAndBaseObject(Header, PhysicalDeviceObject, NextDeviceObject); - /* FIXME Power state */ if (Descriptor) Modified: trunk/reactos/drivers/ksfilter/ks/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] Tue Jul 28 21:32:22 2009 @@ -899,6 +899,60 @@ return STATUS_SUCCESS; } +NTSTATUS +NTAPI +IKsFilter_DispatchCreatePin( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + IKsFilterImpl * This; + PKSOBJECT_CREATE_ITEM CreateItem; + PKSPIN_CONNECT Connect; + NTSTATUS Status; + + /* get the create item */ + CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); + + /* get the filter object */ + This = (IKsFilterImpl*)CreateItem->Context; + + /* acquire control mutex */ + KeWaitForSingleObject(&This->Header.ControlMutex, Executive, KernelMode, FALSE, NULL); + + /* now validate the connect request */ + Status = KsValidateConnectRequest(Irp, This->PinDescriptorCount, This->PinDescriptors, &Connect); + + if (NT_SUCCESS(Status)) + { + /* create the pin */ + Status = KspCreatePin(DeviceObject, Irp, This->Header.KsDevice, This->FilterFactory, (IKsFilter*)&This->lpVtbl, Connect); + } + + /* release control mutex */ + KeReleaseMutex(&This->Header.ControlMutex, FALSE); + + if (Status != STATUS_PENDING) + { + /* complete request */ + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + /* done */ + return Status; +} + +NTSTATUS +NTAPI +IKsFilter_DispatchCreateNode( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + UNIMPLEMENTED + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_UNSUCCESSFUL; +} + NTSTATUS NTAPI @@ -913,6 +967,7 @@ PIO_STACK_LOCATION IoStack; PDEVICE_EXTENSION DeviceExtension; NTSTATUS Status; + PKSOBJECT_CREATE_ITEM CreateItem; /* get device extension */ DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension; @@ -943,7 +998,6 @@ /* get current irp stack */ IoStack = IoGetCurrentIrpStackLocation(Irp); - /* initialize object bag */ This->Filter.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG)); if (!This->Filter.Bag) @@ -953,6 +1007,25 @@ return STATUS_INSUFFICIENT_RESOURCES; } + /* allocate create items */ + CreateItem = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM) * 2); + if (!CreateItem) + { + /* no memory */ + FreeItem(This); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* initialize pin create item */ + CreateItem[0].Create = IKsFilter_DispatchCreatePin; + CreateItem[0].Context = (PVOID)This; + CreateItem[0].Flags = KSCREATE_ITEM_FREEONSTOP; + RtlInitUnicodeString(&CreateItem[0].ObjectClass, KSSTRING_Pin); + /* initialize node create item */ + CreateItem[1].Create = IKsFilter_DispatchCreateNode; + CreateItem[1].Context = (PVOID)This; + CreateItem[1].Flags = KSCREATE_ITEM_FREEONSTOP; + RtlInitUnicodeString(&CreateItem[1].ObjectClass, KSSTRING_TopologyNode); KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->lpVtblIKsDevice; @@ -970,6 +1043,7 @@ This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice; This->Header.Parent.KsFilterFactory = iface->lpVtbl->GetStruct(iface); This->Header.Type = KsObjectTypeFilter; + KeInitializeMutex(&This->Header.ControlMutex, 0); KeInitializeMutex(&This->ProcessingMutex, 0); @@ -979,6 +1053,7 @@ { /* what can go wrong, goes wrong */ FreeItem(This); + FreeItem(CreateItem); return Status; } @@ -989,7 +1064,7 @@ { /* failed to add filter */ FreeItem(This); - + FreeItem(CreateItem); return Status; } @@ -1006,12 +1081,12 @@ /* free filter instance */ FreeItem(This); - + FreeItem(CreateItem); return Status; } /* now allocate the object header */ - Status = KsAllocateObjectHeader((PVOID*)&This->ObjectHeader, 0, NULL, Irp, &DispatchTable); + Status = KsAllocateObjectHeader((PVOID*)&This->ObjectHeader, 2, CreateItem, Irp, &DispatchTable); if (!NT_SUCCESS(Status)) { /* failed to allocate object header */ Modified: trunk/reactos/drivers/ksfilter/ks/filterfactory.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/filterfactory.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/filterfactory.c [iso-8859-1] Tue Jul 28 21:32:22 2009 @@ -192,6 +192,9 @@ InitializeListHead(&This->SymbolicLinkList); InitializeListHead(&This->FilterInstanceList); + /* initialize filter factory control mutex */ + KeInitializeMutex(&This->Header.ControlMutex, 0); + /* does the device use a reference string */ if (RefString || !Descriptor->ReferenceGuid) { Modified: trunk/reactos/drivers/ksfilter/ks/ksfunc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/ksfunc…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/ksfunc.h [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/ksfunc.h [iso-8859-1] Tue Jul 28 21:32:22 2009 @@ -114,4 +114,14 @@ IN OUT PULONG Size, OUT PVOID * Result); +NTSTATUS +KspCreatePin( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + IN PKSDEVICE KsDevice, + IN IKsFilterFactory * FilterFactory, + IN IKsFilter* Filter, + IN PKSPIN_CONNECT Connect); + + #endif Modified: trunk/reactos/drivers/ksfilter/ks/kstypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/kstype…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/kstypes.h [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/kstypes.h [iso-8859-1] Tue Jul 28 21:32:22 2009 @@ -59,6 +59,7 @@ { KSOBJECTTYPE Type; PKSDEVICE KsDevice; + KMUTEX ControlMutex; union { PKSDEVICE KsDevice; Modified: trunk/reactos/drivers/ksfilter/ks/pin.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/pin.c?…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/pin.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/pin.c [iso-8859-1] Tue Jul 28 21:32:22 2009 @@ -519,3 +519,17 @@ UNIMPLEMENTED return NULL; } + +NTSTATUS +KspCreatePin( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + IN PKSDEVICE KsDevice, + IN IKsFilterFactory * FilterFactory, + IN IKsFilter* Filter, + IN PKSPIN_CONNECT Connect) +{ + + return STATUS_NOT_IMPLEMENTED; +} +
15 years, 4 months
1
0
0
0
[janderwald] 42278: - Copy Filter descriptor for each instantiated filter - Implement KsFilterAddTopologyConnections, KsFilterCreatePinFactory
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Jul 28 20:38:13 2009 New Revision: 42278 URL:
http://svn.reactos.org/svn/reactos?rev=42278&view=rev
Log: - Copy Filter descriptor for each instantiated filter - Implement KsFilterAddTopologyConnections, KsFilterCreatePinFactory Modified: trunk/reactos/drivers/ksfilter/ks/filter.c Modified: trunk/reactos/drivers/ksfilter/ks/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] Tue Jul 28 20:38:13 2009 @@ -773,7 +773,6 @@ return STATUS_INSUFFICIENT_RESOURCES; } - /* allocate pin descriptor array */ This->PinDescriptors = AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR) * FilterDescriptor->PinDescriptorsCount); if(!This->PinDescriptors) @@ -828,6 +827,80 @@ } NTSTATUS +IKsFilter_CopyFilterDescriptor( + IKsFilterImpl * This, + const KSFILTER_DESCRIPTOR* FilterDescriptor) +{ + This->Filter.Descriptor = (const KSFILTER_DESCRIPTOR*)AllocateItem(NonPagedPool, sizeof(KSFILTER_DESCRIPTOR)); + if (!This->Filter.Descriptor) + return STATUS_INSUFFICIENT_RESOURCES; + + /* copy all fields */ + RtlMoveMemory((PVOID)This->Filter.Descriptor, FilterDescriptor, sizeof(KSFILTER_DESCRIPTOR)); + + + /* perform deep copy of pin descriptors */ + if (FilterDescriptor->PinDescriptorsCount) + { + KSPIN_DESCRIPTOR_EX * PinDescriptors = (KSPIN_DESCRIPTOR_EX *)AllocateItem(NonPagedPool, FilterDescriptor->PinDescriptorSize * FilterDescriptor->PinDescriptorsCount); + + + if (!PinDescriptors) + { + FreeItem((PVOID)This->Filter.Descriptor); + return STATUS_INSUFFICIENT_RESOURCES; + } + RtlMoveMemory((PVOID)PinDescriptors, FilterDescriptor->PinDescriptors, FilterDescriptor->PinDescriptorSize * FilterDescriptor->PinDescriptorsCount); + + /* brain-dead gcc hack */ + RtlMoveMemory((PVOID)&This->Filter.Descriptor->PinDescriptors, PinDescriptors, sizeof(PKSPIN_DESCRIPTOR_EX)); + + } + + /* perform deep copy of node descriptors */ + if (FilterDescriptor->NodeDescriptorsCount) + { + KSNODE_DESCRIPTOR* NodeDescriptor = AllocateItem(NonPagedPool, FilterDescriptor->NodeDescriptorsCount * FilterDescriptor->NodeDescriptorSize); + if (!NodeDescriptor) + { + if (This->Filter.Descriptor->PinDescriptors) + FreeItem((PVOID)This->Filter.Descriptor->PinDescriptors); + FreeItem((PVOID)This->Filter.Descriptor); + return STATUS_INSUFFICIENT_RESOURCES; + } + RtlMoveMemory((PVOID)NodeDescriptor, FilterDescriptor->NodeDescriptors, FilterDescriptor->NodeDescriptorsCount * FilterDescriptor->NodeDescriptorSize); + + /* brain-dead gcc hack */ + RtlMoveMemory((PVOID)&This->Filter.Descriptor->NodeDescriptors, NodeDescriptor, sizeof(PKSNODE_DESCRIPTOR)); + } + + /* perform deep copy of connections descriptors */ + if (FilterDescriptor->NodeDescriptorsCount) + { + KSTOPOLOGY_CONNECTION* Connections = AllocateItem(NonPagedPool, sizeof(KSTOPOLOGY_CONNECTION) * FilterDescriptor->ConnectionsCount); + if (!Connections) + { + if (This->Filter.Descriptor->PinDescriptors) + FreeItem((PVOID)This->Filter.Descriptor->PinDescriptors); + + if (This->Filter.Descriptor->NodeDescriptors) + FreeItem((PVOID)This->Filter.Descriptor->PinDescriptors); + + FreeItem((PVOID)This->Filter.Descriptor); + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlMoveMemory((PVOID)Connections, FilterDescriptor->Connections, sizeof(KSTOPOLOGY_CONNECTION) * FilterDescriptor->ConnectionsCount); + + /* brain-dead gcc hack */ + RtlMoveMemory((PVOID)&This->Filter.Descriptor->Connections, Connections, sizeof(PKSTOPOLOGY_CONNECTION)); + } + + return STATUS_SUCCESS; +} + + +NTSTATUS NTAPI KspCreateFilter( IN PDEVICE_OBJECT DeviceObject, @@ -858,6 +931,15 @@ if (!This) return STATUS_INSUFFICIENT_RESOURCES; + /* copy filter descriptor */ + Status = IKsFilter_CopyFilterDescriptor(This, Factory->FilterDescriptor); + if (!NT_SUCCESS(Status)) + { + /* not enough memory */ + FreeItem(This); + return STATUS_INSUFFICIENT_RESOURCES; + } + /* get current irp stack */ IoStack = IoGetCurrentIrpStackLocation(Irp); @@ -868,8 +950,10 @@ { /* no memory */ FreeItem(This); - return STATUS_INSUFFICIENT_RESOURCES; - } + return STATUS_INSUFFICIENT_RESOURCES; + } + + KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->lpVtblIKsDevice; KsDevice->lpVtbl->InitializeObjectBag(KsDevice, (PKSIOBJECT_BAG)This->Filter.Bag, NULL); @@ -977,7 +1061,7 @@ } /* - @unimplemented + @implemented */ KSDDKAPI NTSTATUS @@ -987,8 +1071,41 @@ IN ULONG NewConnectionsCount, IN const KSTOPOLOGY_CONNECTION *const NewTopologyConnections) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + ULONG Count; + KSTOPOLOGY_CONNECTION * Connections; + IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(Filter, IKsFilterImpl, Filter); + + Count = This->Filter.Descriptor->ConnectionsCount + NewConnectionsCount; + + /* allocate array */ + Connections = AllocateItem(NonPagedPool, Count * sizeof(KSTOPOLOGY_CONNECTION)); + if (!Connections) + return STATUS_INSUFFICIENT_RESOURCES; + + /* FIXME verify connections */ + + if (This->Filter.Descriptor->ConnectionsCount) + { + /* copy old connections */ + RtlMoveMemory(Connections, This->Filter.Descriptor->Connections, sizeof(KSTOPOLOGY_CONNECTION) * This->Filter.Descriptor->ConnectionsCount); + } + + /* add new connections */ + RtlMoveMemory((PVOID)(Connections + This->Filter.Descriptor->ConnectionsCount), NewTopologyConnections, NewConnectionsCount); + + /* add the new connections */ + RtlMoveMemory((PVOID)&This->Filter.Descriptor->ConnectionsCount, &Count, sizeof(ULONG)); /* brain-dead gcc hack */ + + /* free old connections array */ + if (This->Filter.Descriptor->ConnectionsCount) + { + FreeItem((PVOID)This->Filter.Descriptor->Connections); + } + + /* brain-dead gcc hack */ + RtlMoveMemory((PVOID)&This->Filter.Descriptor->Connections, Connections, sizeof(KSTOPOLOGY_CONNECTION*)); + + return STATUS_SUCCESS; } /* @@ -1020,18 +1137,82 @@ } /* - @unimplemented + @implemented */ KSDDKAPI NTSTATUS NTAPI KsFilterCreatePinFactory ( IN PKSFILTER Filter, - IN const KSPIN_DESCRIPTOR_EX *const PinDescriptor, + IN const KSPIN_DESCRIPTOR_EX *const InPinDescriptor, OUT PULONG PinID) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + ULONG Count; + ULONG *PinInstanceCount; + KSPIN_DESCRIPTOR_EX * PinDescriptorsEx; + KSPIN_DESCRIPTOR * PinDescriptors; + IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(Filter, IKsFilterImpl, Filter); + + /* calculate existing count */ + Count = This->PinDescriptorCount + 1; + + /* allocate pin descriptors array */ + PinDescriptorsEx = AllocateItem(NonPagedPool, max(This->Filter.Descriptor->PinDescriptorSize, sizeof(KSPIN_DESCRIPTOR_EX)) * Count); + if (!PinDescriptorsEx) + return STATUS_INSUFFICIENT_RESOURCES; + + /* allocate pin instance count array */ + PinInstanceCount = AllocateItem(NonPagedPool, sizeof(ULONG) * Count); + if (!PinInstanceCount) + { + /* not enough memory */ + FreeItem(PinDescriptorsEx); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* allocate pin descriptor array for pin property handling */ + PinDescriptors = AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR) * Count); + if (!PinDescriptors) + { + /* not enough memory */ + FreeItem(PinDescriptorsEx); + FreeItem(PinInstanceCount); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* now copy all fields */ + if (Count > 1) + { + /* copy old descriptors */ + RtlMoveMemory(PinDescriptorsEx, This->Filter.Descriptor->PinDescriptors, max(This->Filter.Descriptor->PinDescriptorSize, sizeof(KSPIN_DESCRIPTOR_EX)) * This->PinDescriptorCount); + RtlMoveMemory(PinInstanceCount, This->PinInstanceCount, This->PinDescriptorCount * sizeof(ULONG)); + RtlMoveMemory(PinDescriptors, This->PinDescriptors, sizeof(KSPIN_DESCRIPTOR) * This->PinDescriptorCount); + + /* now free old descriptors */ + FreeItem(This->PinInstanceCount); + FreeItem((PVOID)This->Filter.Descriptor->PinDescriptors); + FreeItem(This->PinDescriptors); + } + + /* add new pin factory */ + RtlMoveMemory((PVOID)((ULONG_PTR)PinDescriptorsEx + max(This->Filter.Descriptor->PinDescriptorSize, sizeof(KSPIN_DESCRIPTOR_EX)) * This->PinDescriptorCount), InPinDescriptor, sizeof(KSPIN_DESCRIPTOR)); + RtlMoveMemory((PVOID)(PinDescriptors + This->PinDescriptorCount), &InPinDescriptor->PinDescriptor, sizeof(KSPIN_DESCRIPTOR)); + + /* replace old descriptor by using a gcc-compliant hack */ + RtlMoveMemory((PVOID)&This->Filter.Descriptor->PinDescriptors, PinDescriptorsEx, sizeof(KSPIN_DESCRIPTOR_EX*)); + RtlMoveMemory((PVOID)&This->Filter.Descriptor->PinDescriptorsCount, &Count, sizeof(ULONG)); + + This->PinDescriptors = PinDescriptors; + This->PinInstanceCount = PinInstanceCount; + + /* store new pin id */ + *PinID = This->PinDescriptorCount; + + /* increment pin descriptor count */ + This->PinDescriptorCount++; + + return STATUS_SUCCESS; + } /*
15 years, 4 months
1
0
0
0
[janderwald] 42277: - Implement KsFilterAcquireProcessingMutex, KsFilterReleaseProcessingMutex, KsFilterGetChildPinCount, KsFilterRegisterPowerCallbacks, KsGetFilterFromIrp
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Jul 28 19:01:36 2009 New Revision: 42277 URL:
http://svn.reactos.org/svn/reactos?rev=42277&view=rev
Log: - Implement KsFilterAcquireProcessingMutex, KsFilterReleaseProcessingMutex, KsFilterGetChildPinCount, KsFilterRegisterPowerCallbacks, KsGetFilterFromIrp Modified: trunk/reactos/drivers/ksfilter/ks/filter.c Modified: trunk/reactos/drivers/ksfilter/ks/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] Tue Jul 28 19:01:36 2009 @@ -25,7 +25,11 @@ ULONG PinDescriptorCount; PKSFILTERFACTORY Factory; PFILE_OBJECT FileObject; - + KMUTEX ProcessingMutex; + + + PFNKSFILTERPOWER Sleep; + PFNKSFILTERPOWER Wake; ULONG *PinInstanceCount; }IKsFilterImpl; @@ -882,6 +886,8 @@ This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice; This->Header.Parent.KsFilterFactory = iface->lpVtbl->GetStruct(iface); This->Header.Type = KsObjectTypeFilter; + KeInitializeMutex(&This->ProcessingMutex, 0); + /* allocate the stream descriptors */ Status = IKsFilter_CreateDescriptors(This, (PKSFILTER_DESCRIPTOR)Factory->FilterDescriptor); @@ -943,15 +949,46 @@ } /* + @implemented +*/ +KSDDKAPI +VOID +NTAPI +KsFilterAcquireProcessingMutex( + IN PKSFILTER Filter) +{ + IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(Filter, IKsFilterImpl, Filter); + + KeWaitForSingleObject(&This->ProcessingMutex, Executive, KernelMode, FALSE, NULL); +} + +/* + @implemented +*/ +KSDDKAPI +VOID +NTAPI +KsFilterReleaseProcessingMutex( + IN PKSFILTER Filter) +{ + IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(Filter, IKsFilterImpl, Filter); + + KeReleaseMutex(&This->ProcessingMutex, FALSE); +} + +/* @unimplemented */ KSDDKAPI -VOID -NTAPI -KsFilterAcquireProcessingMutex( - IN PKSFILTER Filter) -{ - UNIMPLEMENTED +NTSTATUS +NTAPI +KsFilterAddTopologyConnections ( + IN PKSFILTER Filter, + IN ULONG NewConnectionsCount, + IN const KSTOPOLOGY_CONNECTION *const NewTopologyConnections) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; } /* @@ -960,33 +997,6 @@ KSDDKAPI VOID NTAPI -KsFilterReleaseProcessingMutex( - IN PKSFILTER Filter) -{ - UNIMPLEMENTED -} - -/* - @unimplemented -*/ -KSDDKAPI -NTSTATUS -NTAPI -KsFilterAddTopologyConnections ( - IN PKSFILTER Filter, - IN ULONG NewConnectionsCount, - IN const KSTOPOLOGY_CONNECTION *const NewTopologyConnections) -{ - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; -} - -/* - @unimplemented -*/ -KSDDKAPI -VOID -NTAPI KsFilterAttemptProcessing( IN PKSFILTER Filter, IN BOOLEAN Asynchronous) @@ -1038,7 +1048,7 @@ } /* - @unimplemented + @implemented */ KSDDKAPI ULONG @@ -1047,8 +1057,15 @@ IN PKSFILTER Filter, IN ULONG PinId) { - UNIMPLEMENTED - return 0; + IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(Filter, IKsFilterImpl, Filter); + + if (PinId >= This->PinDescriptorCount) + { + /* index is out of bounds */ + return 0; + } + /* return pin instance count */ + return This->PinInstanceCount[PinId]; } /* @@ -1066,7 +1083,7 @@ } /* - @unimplemented + @implemented */ KSDDKAPI VOID @@ -1076,11 +1093,14 @@ IN PFNKSFILTERPOWER Sleep OPTIONAL, IN PFNKSFILTERPOWER Wake OPTIONAL) { - UNIMPLEMENTED + IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(Filter, IKsFilterImpl, Filter); + + This->Sleep = Sleep; + This->Wake = Wake; } /* - @unimplemented + @implemented */ KSDDKAPI PKSFILTER @@ -1088,7 +1108,31 @@ KsGetFilterFromIrp( IN PIRP Irp) { - UNIMPLEMENTED - return NULL; -} - + PIO_STACK_LOCATION IoStack; + PKSIOBJECT_HEADER ObjectHeader; + + /* get current irp stack location */ + IoStack = IoGetCurrentIrpStackLocation(Irp); + + /* sanity check */ + ASSERT(IoStack->FileObject); + + /* get object header */ + ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext; + + if (ObjectHeader->Type == KsObjectTypeFilter) + { + /* irp is targeted at the filter */ + return (PKSFILTER)ObjectHeader->ObjectType; + } + else if (ObjectHeader->Type == KsObjectTypePin) + { + /* irp is for a pin */ + return KsPinGetParentFilter((PKSPIN)ObjectHeader->ObjectType); + } + else + { + /* irp is unappropiate to retrieve a filter */ + return NULL; + } +}
15 years, 4 months
1
0
0
0
[janderwald] 42276: - Add KsPinGetParentFilter prototype
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Jul 28 18:42:36 2009 New Revision: 42276 URL:
http://svn.reactos.org/svn/reactos?rev=42276&view=rev
Log: - Add KsPinGetParentFilter prototype Modified: trunk/reactos/include/psdk/ks.h Modified: trunk/reactos/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ks.h?rev=4227…
============================================================================== --- trunk/reactos/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ks.h [iso-8859-1] Tue Jul 28 18:42:36 2009 @@ -3135,6 +3135,12 @@ IN PFNKSINTERSECTHANDLEREX IntersectHandler OPTIONAL, IN PVOID HandlerContext OPTIONAL); +KSDDKAPI PKSFILTER NTAPI +KsPinGetParentFilter( + IN PKSPIN Pin + ); + + /* Does this belong here? */ KSDDKAPI NTSTATUS NTAPI @@ -3864,6 +3870,7 @@ KsFilterAcquireProcessingMutex( IN PKSFILTER Filter); + KSDDKAPI NTSTATUS NTAPI
15 years, 4 months
1
0
0
0
[janderwald] 42275: - Implement KsGetObjectFromFileObject, KsGetObjectFromFileObject, KsGetObjectTypeFromIrp, KsGetParent - Create object bag for IKsFilter, IKsFilterFactory and IKsDevice
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Jul 28 18:18:05 2009 New Revision: 42275 URL:
http://svn.reactos.org/svn/reactos?rev=42275&view=rev
Log: - Implement KsGetObjectFromFileObject, KsGetObjectFromFileObject, KsGetObjectTypeFromIrp, KsGetParent - Create object bag for IKsFilter, IKsFilterFactory and IKsDevice Modified: trunk/reactos/drivers/ksfilter/ks/api.c trunk/reactos/drivers/ksfilter/ks/bag.c trunk/reactos/drivers/ksfilter/ks/device.c trunk/reactos/drivers/ksfilter/ks/filter.c trunk/reactos/drivers/ksfilter/ks/filterfactory.c trunk/reactos/drivers/ksfilter/ks/ksiface.h trunk/reactos/drivers/ksfilter/ks/kstypes.h Modified: trunk/reactos/drivers/ksfilter/ks/api.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/api.c?…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/api.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/api.c [iso-8859-1] Tue Jul 28 18:18:05 2009 @@ -509,6 +509,8 @@ InitializeListHead(&Header->TargetDeviceList); /* initialize power dispatch list */ InitializeListHead(&Header->PowerDispatchList); + /* initialize object bag lists */ + InitializeListHead(&Header->ObjectBags); /* initialize create item list */ InitializeListHead(&Header->ItemList); Modified: trunk/reactos/drivers/ksfilter/ks/bag.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/bag.c?…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/bag.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/bag.c [iso-8859-1] Tue Jul 28 18:18:05 2009 @@ -9,8 +9,17 @@ #include "priv.h" -/* - @unimplemented +typedef struct +{ + LIST_ENTRY Entry; + PVOID Item; + PFNKSFREE Free; + ULONG References; +}KSIOBJECT_BAG_ENTRY, *PKSIOBJECT_BAG_ENTRY; + + +/* + @implemented */ KSDDKAPI NTSTATUS @@ -19,12 +28,56 @@ IN PKSDEVICE Device, OUT KSOBJECT_BAG* ObjectBag) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; -} - -/* - @unimplemented + PKSIDEVICE_HEADER DeviceHeader; + PKSIOBJECT_BAG Bag; + IKsDevice *KsDevice; + + /* get real device header */ + DeviceHeader = (PKSIDEVICE_HEADER)CONTAINING_RECORD(Device, KSIDEVICE_HEADER, KsDevice); + + /* allocate a object bag ctx */ + Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG)); + if (!Bag) + return STATUS_INSUFFICIENT_RESOURCES; + + /* get device interface */ + KsDevice = (IKsDevice*)&DeviceHeader->lpVtblIKsDevice; + + /* initialize object bag */ + return KsDevice->lpVtbl->InitializeObjectBag(KsDevice, Bag, NULL); +} + +PKSIOBJECT_BAG_ENTRY +KspFindObjectBagItem( + IN PLIST_ENTRY ObjectList, + IN PVOID Item) +{ + PLIST_ENTRY Entry; + PKSIOBJECT_BAG_ENTRY BagEntry; + + /* point to first item */ + Entry = ObjectList->Flink; + /* first scan the list if the item is already inserted */ + while(Entry != ObjectList) + { + /* get bag entry */ + BagEntry = (PKSIOBJECT_BAG_ENTRY)CONTAINING_RECORD(Entry, KSIOBJECT_BAG_ENTRY, Entry); + + if (BagEntry->Item == Item) + { + /* found entry */ + return BagEntry; + } + /* move to next entry */ + Entry = Entry->Flink; + } + /* item not in this object bag */ + return NULL; +} + + +/* + @implemented */ NTSTATUS NTAPI @@ -33,12 +86,88 @@ IN PVOID Item, IN PFNKSFREE Free OPTIONAL) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; -} - -/* - @unimplemented + PKSIOBJECT_BAG Bag; + PKSIOBJECT_BAG_ENTRY BagEntry; + + /* get real object bag */ + Bag = (PKSIOBJECT_BAG)ObjectBag; + + /* acquire bag mutex */ + KeWaitForSingleObject(Bag->BagMutex, Executive, KernelMode, FALSE, NULL); + + /* is the item already present in this object bag */ + BagEntry = KspFindObjectBagItem(&Bag->ObjectList, Item); + + if (BagEntry) + { + /* is is, update reference count */ + InterlockedIncrement((PLONG)&BagEntry->References); + /* release mutex */ + KeReleaseMutex(Bag->BagMutex, FALSE); + /* return result */ + return STATUS_SUCCESS; + } + + /* item is new, allocate entry */ + BagEntry = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG_ENTRY)); + if (!BagEntry) + { + /* no memory */ + KeReleaseMutex(Bag->BagMutex, FALSE); + /* return result */ + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* initialize bag entry */ + BagEntry->References = 1; + BagEntry->Item = Item; + if (Free) + BagEntry->Free = Free; + else + BagEntry->Free = ExFreePool; + + /* insert item */ + InsertTailList(&Bag->ObjectList, &Bag->Entry); + + /* release mutex */ + KeReleaseMutex(Bag->BagMutex, FALSE); + + /* done */ + return STATUS_SUCCESS; +} + +ULONG +KspGetObjectItemReferenceCount( + IN PKSIDEVICE_HEADER DeviceHeader, + IN PVOID Item) +{ + PLIST_ENTRY Entry; + PKSIOBJECT_BAG OtherBag; + PKSIOBJECT_BAG_ENTRY OtherBagEntry; + ULONG TotalRefs = 0; + + /* scan all object bags and see if item is present there */ + Entry = DeviceHeader->ObjectBags.Flink; + while(Entry != &DeviceHeader->ObjectBags) + { + /* get other bag */ + OtherBag = (PKSIOBJECT_BAG)CONTAINING_RECORD(Entry, KSIOBJECT_BAG, Entry); + + /* is the item present there */ + OtherBagEntry = KspFindObjectBagItem(&OtherBag->ObjectList, Item); + + if (OtherBagEntry) + TotalRefs++; + + /* move to next item */ + Entry = Entry->Flink; + } + + return TotalRefs; +} + +/* + @implemented */ KSDDKAPI ULONG @@ -48,8 +177,61 @@ IN PVOID Item, IN BOOLEAN Free) { - UNIMPLEMENTED - return 0; + PKSIOBJECT_BAG Bag; + PKSIOBJECT_BAG_ENTRY BagEntry; + ULONG TotalRefs; + + /* get real object bag */ + Bag = (PKSIOBJECT_BAG)ObjectBag; + + /* acquire bag mutex */ + KeWaitForSingleObject(Bag->BagMutex, Executive, KernelMode, FALSE, NULL); + + /* is the item already present in this object bag */ + BagEntry = KspFindObjectBagItem(&Bag->ObjectList, Item); + + if (!BagEntry) + { + /* item was not in this object bag */ + KeReleaseMutex(Bag->BagMutex, FALSE); + return 0; + } + + /* set current refs count */ + TotalRefs = BagEntry->References; + + /* get total refs count */ + TotalRefs += KspGetObjectItemReferenceCount((PKSIDEVICE_HEADER)Bag->DeviceHeader, Item); + + /* decrease reference count */ + InterlockedDecrement((PLONG)&BagEntry->References); + + if (BagEntry->References == 0) + { + /* remove the entry */ + RemoveEntryList(&BagEntry->Entry); + } + + if (TotalRefs == 1) + { + /* does the caller want to free the item */ + if (Free) + { + /* free the item */ + BagEntry->Free(BagEntry->Item); + } + } + if (BagEntry->References == 0) + { + /* free bag item entry */ + FreeItem(BagEntry); + } + + /* release mutex */ + KeReleaseMutex(Bag->BagMutex, FALSE); + + + return TotalRefs; } /* @@ -66,14 +248,55 @@ return STATUS_NOT_IMPLEMENTED; } +/* + @implemented +*/ KSDDKAPI VOID NTAPI KsFreeObjectBag( IN KSOBJECT_BAG ObjectBag) { - UNIMPLEMENTED -} - - - + PLIST_ENTRY Entry; + PKSIOBJECT_BAG Bag; + PKSIOBJECT_BAG_ENTRY BagEntry; + ULONG TotalRefs; + + /* get real object bag */ + Bag = (PKSIOBJECT_BAG)ObjectBag; + + /* acquire bag mutex */ + KeWaitForSingleObject(Bag->BagMutex, Executive, KernelMode, FALSE, NULL); + + while(!IsListEmpty(&Bag->ObjectList)) + { + /* get an bag entry */ + Entry = RemoveHeadList(&Bag->ObjectList); + /* access bag entry item */ + BagEntry = (PKSIOBJECT_BAG_ENTRY)CONTAINING_RECORD(Entry, KSIOBJECT_BAG, Entry); + + /* check if the item is present in some other bag */ + TotalRefs = KspGetObjectItemReferenceCount((PKSIDEVICE_HEADER)Bag->DeviceHeader, &BagEntry->Item); + + if (TotalRefs == 0) + { + /* item is ready to be freed */ + BagEntry->Free(BagEntry->Item); + } + + /* free bag entry item */ + FreeItem(BagEntry); + } + + /* remove bag entry from device object list */ + RemoveEntryList(&Bag->Entry); + + /* release bag mutex */ + KeReleaseMutex(Bag->BagMutex, FALSE); + + /* now free object bag */ + FreeItem(Bag); +} + + + Modified: trunk/reactos/drivers/ksfilter/ks/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/device…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/device.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/device.c [iso-8859-1] Tue Jul 28 18:18:05 2009 @@ -66,13 +66,26 @@ NTAPI IKsDevice_fnInitializeObjectBag( IN IKsDevice * iface, - IN struct KSIOBJECTBAG *Bag, - IN KMUTANT * Mutant) -{ - //PKSIDEVICE_HEADER This = (PKSIDEVICE_HEADER)CONTAINING_RECORD(iface, KSIDEVICE_HEADER, lpVtblIKsDevice); - - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + IN PKSIOBJECT_BAG Bag, + IN PRKMUTEX Mutex) +{ + PKSIDEVICE_HEADER This = (PKSIDEVICE_HEADER)CONTAINING_RECORD(iface, KSIDEVICE_HEADER, lpVtblIKsDevice); + + if (!Mutex) + { + /* use device mutex */ + Mutex = &This->DeviceMutex; + } + + /* initialize object bag */ + Bag->BagMutex = Mutex; + Bag->DeviceHeader = (PKSIDEVICE_HEADER)This; + InitializeListHead(&Bag->ObjectList); + + /* insert bag into device list */ + InsertTailList(&This->ObjectBags, &Bag->Entry); + + return STATUS_SUCCESS; } NTSTATUS @@ -627,6 +640,7 @@ PDEVICE_EXTENSION DeviceExtension; PKSIDEVICE_HEADER Header; ULONG Index; + IKsDevice * KsDevice; NTSTATUS Status = STATUS_SUCCESS; /* get device extension */ @@ -644,6 +658,23 @@ DPRINT1("Failed to allocate device header with %x\n", Status); return Status; } + + /* initialize IKsDevice interface */ + Header->lpVtblIKsDevice = &vt_IKsDevice; + Header->ref = 1; + + /* initialize object bag */ + Header->KsDevice.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG)); + if (!Header->KsDevice.Bag) + { + /* no memory */ + KsFreeDeviceHeader((KSDEVICE_HEADER*)&DeviceExtension->DeviceHeader); + return STATUS_INSUFFICIENT_RESOURCES; + } + + KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->lpVtblIKsDevice; + KsDevice->lpVtbl->InitializeObjectBag(KsDevice, Header->KsDevice.Bag, NULL); + /* initialize device header */ Header->KsDevice.FunctionalDeviceObject = FunctionalDeviceObject; @@ -651,9 +682,7 @@ Header->KsDevice.NextDeviceObject = NextDeviceObject; Header->KsDevice.Descriptor = Descriptor; KsSetDevicePnpAndBaseObject(Header, PhysicalDeviceObject, NextDeviceObject); - /* initialize IKsDevice interface */ - Header->lpVtblIKsDevice = &vt_IKsDevice; - Header->ref = 1; + /* FIXME Power state */ Modified: trunk/reactos/drivers/ksfilter/ks/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] Tue Jul 28 18:18:05 2009 @@ -831,6 +831,7 @@ IN IKsFilterFactory *iface) { IKsFilterImpl * This; + IKsDevice *KsDevice; PKSFILTERFACTORY Factory; PIO_STACK_LOCATION IoStack; PDEVICE_EXTENSION DeviceExtension; @@ -856,10 +857,24 @@ /* get current irp stack */ IoStack = IoGetCurrentIrpStackLocation(Irp); + + /* initialize object bag */ + This->Filter.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG)); + if (!This->Filter.Bag) + { + /* no memory */ + FreeItem(This); + return STATUS_INSUFFICIENT_RESOURCES; + } + + KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->lpVtblIKsDevice; + KsDevice->lpVtbl->InitializeObjectBag(KsDevice, (PKSIOBJECT_BAG)This->Filter.Bag, NULL); + /* initialize filter instance */ This->ref = 1; This->lpVtbl = &vt_IKsFilter; This->lpVtblKsControl = &vt_IKsControl; + This->Filter.Descriptor = Factory->FilterDescriptor; This->Factory = Factory; This->FilterFactory = iface; Modified: trunk/reactos/drivers/ksfilter/ks/filterfactory.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/filterfactory.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/filterfactory.c [iso-8859-1] Tue Jul 28 18:18:05 2009 @@ -173,6 +173,7 @@ PDEVICE_EXTENSION DeviceExtension; KSOBJECT_CREATE_ITEM CreateItem; BOOL FreeString = FALSE; + IKsDevice * KsDevice; IKsFilterFactoryImpl * This = (IKsFilterFactoryImpl*)CONTAINING_RECORD(iface, IKsFilterFactoryImpl, lpVtbl); @@ -253,7 +254,14 @@ /* return filterfactory */ *FilterFactory = &This->FilterFactory; - /*FIXME create object bag */ + /* create a object bag for the filter factory */ + This->FilterFactory.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG)); + if (This->FilterFactory.Bag) + { + /* initialize object bag */ + KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->lpVtblIKsDevice; + KsDevice->lpVtbl->InitializeObjectBag(KsDevice, (PKSIOBJECT_BAG)This->FilterFactory.Bag, NULL); + } } Modified: trunk/reactos/drivers/ksfilter/ks/ksiface.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/ksifac…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/ksiface.h [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/ksiface.h [iso-8859-1] Tue Jul 28 18:18:05 2009 @@ -13,6 +13,15 @@ STDMETHOD_(ULONG,AddRef)(THIS) PURE; \ STDMETHOD_(ULONG,Release)(THIS) PURE; #endif + +typedef struct +{ + LIST_ENTRY Entry; + LIST_ENTRY ObjectList; + PRKMUTEX BagMutex; + PVOID DeviceHeader; +}KSIOBJECT_BAG, *PKSIOBJECT_BAG; + /***************************************************************************** * IKsAllocator @@ -199,7 +208,6 @@ #undef INTERFACE #define INTERFACE IKsDevice -struct KSIOBJECTBAG; struct KSPOWER_ENTRY; DECLARE_INTERFACE_(IKsDevice, IUnknown) @@ -209,8 +217,8 @@ STDMETHOD_(KSDEVICE*,GetStruct)(THIS) PURE; STDMETHOD_(NTSTATUS, InitializeObjectBag)(THIS_ - IN struct KSIOBJECTBAG *Bag, - IN KMUTANT * Mutant) PURE; + IN PKSIOBJECT_BAG Bag, + IN PRKMUTEX Mutex) PURE; STDMETHOD_(NTSTATUS,AcquireDevice)(THIS) PURE; STDMETHOD_(NTSTATUS,ReleaseDevice)(THIS) PURE; Modified: trunk/reactos/drivers/ksfilter/ks/kstypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/kstype…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/kstypes.h [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/kstypes.h [iso-8859-1] Tue Jul 28 18:18:05 2009 @@ -1,5 +1,8 @@ #ifndef KSTYPES_H__ #define KSTYPES_H__ + +#include <ntddk.h> +#include <ks.h> typedef struct { @@ -87,9 +90,9 @@ KSDEVICE_DESCRIPTOR* Descriptor; LIST_ENTRY PowerDispatchList; + LIST_ENTRY ObjectBags; }KSIDEVICE_HEADER, *PKSIDEVICE_HEADER; - typedef struct {
15 years, 4 months
1
0
0
0
[fireball] 42274: - SwitchDesktop: Fix SetWindowPos call to not alter desktop's height and width but just make it visible.
by fireball@svn.reactos.org
Author: fireball Date: Tue Jul 28 16:36:17 2009 New Revision: 42274 URL:
http://svn.reactos.org/svn/reactos?rev=42274&view=rev
Log: - SwitchDesktop: Fix SetWindowPos call to not alter desktop's height and width but just make it visible. Modified: branches/arwinss/reactos/dll/win32/user32/win.c Modified: branches/arwinss/reactos/dll/win32/user32/win.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
============================================================================== --- branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] Tue Jul 28 16:36:17 2009 @@ -3407,9 +3407,9 @@ SetWindowPos(hWnd, NULL, 0, 0, - 800,//nmh->ShowDesktop.Width, - 600,//nmh->ShowDesktop.Height, - SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW); + 0, + 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); UpdateWindow(hWnd); RedrawWindow(NULL, NULL, 0, RDW_INVALIDATE | RDW_FRAME | RDW_ERASENOW | RDW_ALLCHILDREN);
15 years, 4 months
1
0
0
0
[fireball] 42273: Giannis Adamopoulos - Add minimal mouse input support to the gdi/user driver: * Implement SendInput and SetCursor * Bring in some helper functions from winex11.drv driver
by fireball@svn.reactos.org
Author: fireball Date: Tue Jul 28 16:33:16 2009 New Revision: 42273 URL:
http://svn.reactos.org/svn/reactos?rev=42273&view=rev
Log: Giannis Adamopoulos - Add minimal mouse input support to the gdi/user driver: * Implement SendInput and SetCursor * Bring in some helper functions from winex11.drv driver Added: branches/arwinss/reactos/dll/win32/winent.drv/mouse.c (with props) Modified: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c branches/arwinss/reactos/dll/win32/winent.drv/winent.h branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild Added: branches/arwinss/reactos/dll/win32/winent.drv/mouse.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/mouse.c (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/mouse.c [iso-8859-1] Tue Jul 28 16:33:16 2009 @@ -1,0 +1,272 @@ +/* + * X11 mouse driver + * + * Copyright 1998 Ulrich Weigand + * Copyright 2007 Henri Verbeet + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include <stdio.h> +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#define NTOS_USER_MODE +#include <ndk/ntndk.h> +#include "ntrosgdi.h" +#include "win32k/rosuser.h" +#include "winent.h" +#include "wine/server.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(cursor); + +/**********************************************************************/ + +#define NB_BUTTONS 9 /* Windows can handle 5 buttons and the wheel too */ + +static const UINT button_down_flags[NB_BUTTONS] = +{ + MOUSEEVENTF_LEFTDOWN, + MOUSEEVENTF_MIDDLEDOWN, + MOUSEEVENTF_RIGHTDOWN, + MOUSEEVENTF_WHEEL, + MOUSEEVENTF_WHEEL, + MOUSEEVENTF_XDOWN, /* FIXME: horizontal wheel */ + MOUSEEVENTF_XDOWN, + MOUSEEVENTF_XDOWN, + MOUSEEVENTF_XDOWN +}; + +static const UINT button_up_flags[NB_BUTTONS] = +{ + MOUSEEVENTF_LEFTUP, + MOUSEEVENTF_MIDDLEUP, + MOUSEEVENTF_RIGHTUP, + 0, + 0, + MOUSEEVENTF_XUP, + MOUSEEVENTF_XUP, + MOUSEEVENTF_XUP, + MOUSEEVENTF_XUP +}; + +BYTE key_state_table[256]; + +/*********************************************************************** + * clip_point_to_rect + * + * Clip point to the provided rectangle + */ +static inline void clip_point_to_rect( LPCRECT rect, LPPOINT pt ) +{ + if (pt->x < rect->left) pt->x = rect->left; + else if (pt->x >= rect->right) pt->x = rect->right - 1; + if (pt->y < rect->top) pt->y = rect->top; + else if (pt->y >= rect->bottom) pt->y = rect->bottom - 1; +} + +/*********************************************************************** + * get_key_state + */ +static WORD get_key_state(void) +{ + WORD ret = 0; + + if (GetSystemMetrics( SM_SWAPBUTTON )) + { + if (key_state_table[VK_RBUTTON] & 0x80) ret |= MK_LBUTTON; + if (key_state_table[VK_LBUTTON] & 0x80) ret |= MK_RBUTTON; + } + else + { + if (key_state_table[VK_LBUTTON] & 0x80) ret |= MK_LBUTTON; + if (key_state_table[VK_RBUTTON] & 0x80) ret |= MK_RBUTTON; + } + if (key_state_table[VK_MBUTTON] & 0x80) ret |= MK_MBUTTON; + if (key_state_table[VK_SHIFT] & 0x80) ret |= MK_SHIFT; + if (key_state_table[VK_CONTROL] & 0x80) ret |= MK_CONTROL; + if (key_state_table[VK_XBUTTON1] & 0x80) ret |= MK_XBUTTON1; + if (key_state_table[VK_XBUTTON2] & 0x80) ret |= MK_XBUTTON2; + return ret; +} + + +/*********************************************************************** + * queue_raw_mouse_message + */ +static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y, + DWORD data, DWORD time, DWORD extra_info, UINT injected_flags ) +{ + MSLLHOOKSTRUCT hook; + + hook.pt.x = x; + hook.pt.y = y; + hook.mouseData = MAKELONG( 0, data ); + hook.flags = injected_flags; + hook.time = time; + hook.dwExtraInfo = extra_info; + + if (HOOK_CallHooks( WH_MOUSE_LL, HC_ACTION, message, (LPARAM)&hook, TRUE )) return; + + SERVER_START_REQ( send_hardware_message ) + { + req->id = (injected_flags & LLMHF_INJECTED) ? 0 : GetCurrentThreadId(); + req->win = wine_server_user_handle( hwnd ); + req->msg = message; + req->wparam = MAKEWPARAM( get_key_state(), data ); + req->lparam = 0; + req->x = x; + req->y = y; + req->time = time; + req->info = extra_info; + wine_server_call( req ); + } + SERVER_END_REQ; + +} + + +/*********************************************************************** + * X11DRV_send_mouse_input + */ +void RosDrv_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y, + DWORD data, DWORD time, DWORD extra_info, UINT injected_flags ) +{ + POINT pt; + POINT cursor_pos; + + if (flags & MOUSEEVENTF_MOVE && flags & MOUSEEVENTF_ABSOLUTE) + { + if (injected_flags & LLMHF_INJECTED) + { + pt.x = (x * GetSystemMetrics(SM_CXVIRTUALSCREEN)) >> 16; + pt.y = (y * GetSystemMetrics(SM_CYVIRTUALSCREEN)) >> 16; + } + else + { + pt.x = x; + pt.y = y; + + GetCursorPos(&cursor_pos); + if (cursor_pos.x == x && cursor_pos.y == y && + (flags & ~(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE))) + flags &= ~MOUSEEVENTF_MOVE; + + } + } + else if (flags & MOUSEEVENTF_MOVE) + { + int accel[3], xMult = 1, yMult = 1; + + /* dx and dy can be negative numbers for relative movements */ + SystemParametersInfoW(SPI_GETMOUSE, 0, accel, 0); + + if (abs(x) > accel[0] && accel[2] != 0) + { + xMult = 2; + if ((abs(x) > accel[1]) && (accel[2] == 2)) xMult = 4; + } + if (abs(y) > accel[0] && accel[2] != 0) + { + yMult = 2; + if ((abs(y) > accel[1]) && (accel[2] == 2)) yMult = 4; + } + + GetCursorPos(&cursor_pos); + pt.x = cursor_pos.x + (long)x * xMult; + pt.y = cursor_pos.y + (long)y * yMult; + } + else + { + GetCursorPos(&pt); + } + + if (flags & MOUSEEVENTF_MOVE) + { + queue_raw_mouse_message( WM_MOUSEMOVE, hwnd, pt.x, pt.y, data, time, + extra_info, injected_flags ); + RosDrv_SetCursorPos(pt.x, pt.y); + //if ((injected_flags & LLMHF_INJECTED) && + // ((flags & MOUSEEVENTF_ABSOLUTE) || x || y)) /* we have to actually move the cursor */ + //{ + // X11DRV_SetCursorPos( pt.x, pt.y ); + //} + //else + //{ + // wine_tsx11_lock(); + // clip_point_to_rect( &cursor_clip, &pt); + // cursor_pos = pt; + // wine_tsx11_unlock(); + //} + } + if (flags & MOUSEEVENTF_LEFTDOWN) + { + key_state_table[VK_LBUTTON] |= 0xc0; + queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_RBUTTONDOWN : WM_LBUTTONDOWN, + hwnd, pt.x, pt.y, data, time, extra_info, injected_flags ); + } + if (flags & MOUSEEVENTF_LEFTUP) + { + key_state_table[VK_LBUTTON] &= ~0x80; + queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_RBUTTONUP : WM_LBUTTONUP, + hwnd, pt.x, pt.y, data, time, extra_info, injected_flags ); + } + if (flags & MOUSEEVENTF_RIGHTDOWN) + { + key_state_table[VK_RBUTTON] |= 0xc0; + queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_LBUTTONDOWN : WM_RBUTTONDOWN, + hwnd, pt.x, pt.y, data, time, extra_info, injected_flags ); + } + if (flags & MOUSEEVENTF_RIGHTUP) + { + key_state_table[VK_RBUTTON] &= ~0x80; + queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_LBUTTONUP : WM_RBUTTONUP, + hwnd, pt.x, pt.y, data, time, extra_info, injected_flags ); + } + if (flags & MOUSEEVENTF_MIDDLEDOWN) + { + key_state_table[VK_MBUTTON] |= 0xc0; + queue_raw_mouse_message( WM_MBUTTONDOWN, hwnd, pt.x, pt.y, data, time, + extra_info, injected_flags ); + } + if (flags & MOUSEEVENTF_MIDDLEUP) + { + key_state_table[VK_MBUTTON] &= ~0x80; + queue_raw_mouse_message( WM_MBUTTONUP, hwnd, pt.x, pt.y, data, time, + extra_info, injected_flags ); + } + if (flags & MOUSEEVENTF_WHEEL) + { + queue_raw_mouse_message( WM_MOUSEWHEEL, hwnd, pt.x, pt.y, data, time, + extra_info, injected_flags ); + } + if (flags & MOUSEEVENTF_XDOWN) + { + key_state_table[VK_XBUTTON1 + data - 1] |= 0xc0; + queue_raw_mouse_message( WM_XBUTTONDOWN, hwnd, pt.x, pt.y, data, time, + extra_info, injected_flags ); + } + if (flags & MOUSEEVENTF_XUP) + { + key_state_table[VK_XBUTTON1 + data - 1] &= ~0x80; + queue_raw_mouse_message( WM_XBUTTONUP, hwnd, pt.x, pt.y, data, time, + extra_info, injected_flags ); + } +} + Propchange: branches/arwinss/reactos/dll/win32/winent.drv/mouse.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] Tue Jul 28 16:33:16 2009 @@ -19,6 +19,7 @@ #define NTOS_USER_MODE #include <ndk/ntndk.h> #include "ntrosgdi.h" +#include "win32k/rosuser.h" #include "winent.h" #include "wine/server.h" #include "wine/debug.h" @@ -129,8 +130,26 @@ UINT CDECL RosDrv_SendInput( UINT count, LPINPUT inputs, int size ) { - UNIMPLEMENTED; - return 0; + UINT i; + + for (i = 0; i < count; i++, inputs++) + { + switch(inputs->type) + { + case INPUT_MOUSE: + RosDrv_send_mouse_input( 0, inputs->mi.dwFlags, inputs->mi.dx, inputs->mi.dy, + inputs->mi.mouseData, inputs->mi.time, + inputs->mi.dwExtraInfo, LLMHF_INJECTED ); + break; + case INPUT_KEYBOARD: + FIXME( "INPUT_KEYBOARD not supported\n" ); + break; + case INPUT_HARDWARE: + FIXME( "INPUT_HARDWARE not supported\n" ); + break; + } + } + return count; } INT CDECL RosDrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str, @@ -152,27 +171,45 @@ return -1; } -void CDECL RosDrv_SetCursor( CURSORICONINFO *info ) -{ - UNIMPLEMENTED; +void CDECL RosDrv_SetCursor( HCURSOR hCursor ) +{ + ICONINFO IconInfo; + BITMAP bitmap; + + if (hCursor == NULL) + { + RosUserSetCursor(NULL); + } + else + { + if( GetIconInfo(hCursor, &IconInfo) ) + { + /* Create handle mappings for IconInfo.hbmMask and + IconInfo.hbmColor in kernel mode */ + if( GetObjectW(IconInfo.hbmMask, sizeof(bitmap), &bitmap)) + RosGdiCreateBitmap(NULL, IconInfo.hbmMask, &bitmap, bitmap.bmBits); + + if( GetObjectW(IconInfo.hbmColor, sizeof(bitmap), &bitmap)) + RosGdiCreateBitmap(NULL, IconInfo.hbmColor, &bitmap, bitmap.bmBits); + + RosUserSetCursor( &IconInfo ); + } + } } BOOL CDECL RosDrv_GetCursorPos( LPPOINT pt ) { - UNIMPLEMENTED; - return FALSE; + return RosUserGetCursorPos( pt ); } BOOL CDECL RosDrv_SetCursorPos( INT x, INT y ) { - UNIMPLEMENTED; - return FALSE; + return RosUserSetCursorPos( x, y ); } BOOL CDECL RosDrv_ClipCursor( LPCRECT clip ) { - UNIMPLEMENTED; - return FALSE; + return RosUserClipCursor( clip ); } BOOL CDECL RosDrv_GetScreenSaveActive(void) Modified: branches/arwinss/reactos/dll/win32/winent.drv/winent.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] Tue Jul 28 16:33:16 2009 @@ -38,3 +38,11 @@ const RECT *lprect, LPCWSTR wstr, UINT count, const INT *lpDx ); +void RosDrv_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y, + DWORD data, DWORD time, DWORD extra_info, UINT injected_flags ); + +BOOL CDECL RosDrv_SetCursorPos( INT x, INT y ); + +LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ); + +BOOL CDECL RosDrv_GetCursorPos( LPPOINT pt ); Modified: branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild [iso-8859-1] Tue Jul 28 16:33:16 2009 @@ -9,6 +9,7 @@ <file>gdidrv.c</file> <file>main.c</file> <file>userdrv.c</file> + <file>mouse.c</file> <file>winent.rc</file>
15 years, 4 months
1
0
0
0
[fireball] 42272: Giannis Adamopoulos - Implement mouse input thread support in win32csr (based on win32k/ntuser/input.c from trunk).
by fireball@svn.reactos.org
Author: fireball Date: Tue Jul 28 16:23:34 2009 New Revision: 42272 URL:
http://svn.reactos.org/svn/reactos?rev=42272&view=rev
Log: Giannis Adamopoulos - Implement mouse input thread support in win32csr (based on win32k/ntuser/input.c from trunk). Added: branches/arwinss/reactos/subsystems/win32/csrss/win32csr/input.c (with props) Modified: branches/arwinss/reactos/subsystems/win32/csrss/win32csr/dllmain.c branches/arwinss/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild Modified: branches/arwinss/reactos/subsystems/win32/csrss/win32csr/dllmain.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] Tue Jul 28 16:23:34 2009 @@ -575,6 +575,7 @@ return TRUE; } +void CsrInitInputSupport(); BOOL WINAPI Win32CsrInitialization(PCSRSS_API_DEFINITION *ApiDefinitions, @@ -598,6 +599,8 @@ *InitComplete = Win32CsrInitComplete; *HardError = Win32CsrHardError; + CsrInitInputSupport(); + return TRUE; } Added: branches/arwinss/reactos/subsystems/win32/csrss/win32csr/input.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/csrss/win32csr/input.c (added) +++ branches/arwinss/reactos/subsystems/win32/csrss/win32csr/input.c [iso-8859-1] Tue Jul 28 16:23:34 2009 @@ -1,0 +1,190 @@ +/* + * PROJECT: ReactOS CSRSS + * LICENSE: GPL - See COPYING in the top level directory + * FILE: subsystems/win32/csrss/api/input.c + * PURPOSE: CSRSS input support + * COPYRIGHT: Casper S. Hornstrup (chorns(a)users.sourceforge.net) + * + * this file is heavily based on subsystems\win32\win32k\ntuser\input.c from trunk + */ + +#define NDEBUG +#include "w32csr.h" +#include <debug.h> +#include <ntddmou.h> +#include <ntddkbd.h> + +#define ClearMouseInput(mi) \ + mi.dx = 0; \ + mi.dy = 0; \ + mi.mouseData = 0; \ + mi.dwFlags = 0; + +#define SendMouseEvent(mi) \ + if(mi.dx != 0 || mi.dy != 0) \ + mi.dwFlags |= MOUSEEVENTF_MOVE; \ + if(mi.dwFlags) \ + mouse_event(mi.dwFlags,mi.dx,mi.dy, mi.mouseData, 0); \ + ClearMouseInput(mi); + +VOID FASTCALL +ProcessMouseInputData(PMOUSE_INPUT_DATA Data, ULONG InputCount) +{ + PMOUSE_INPUT_DATA mid; + MOUSEINPUT mi; + ULONG i; + + ClearMouseInput(mi); + mi.time = 0; + mi.dwExtraInfo = 0; + for(i = 0; i < InputCount; i++) + { + mid = (Data + i); + mi.dx += mid->LastX; + mi.dy += mid->LastY; + + /* Check if the mouse move is absolute */ + if (mid->Flags == MOUSE_MOVE_ABSOLUTE) + { + /* Set flag and convert to screen location */ + mi.dwFlags |= MOUSEEVENTF_ABSOLUTE; + mi.dx = mi.dx / (65535 / (GetSystemMetrics(SM_CXVIRTUALSCREEN) - 1)); + mi.dy = mi.dy / (65535 / (GetSystemMetrics(SM_CYVIRTUALSCREEN) - 1)); + } + + if(mid->ButtonFlags) + { + if(mid->ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) + { + mi.dwFlags |= MOUSEEVENTF_LEFTDOWN; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_LEFT_BUTTON_UP) + { + mi.dwFlags |= MOUSEEVENTF_LEFTUP; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_MIDDLE_BUTTON_DOWN) + { + mi.dwFlags |= MOUSEEVENTF_MIDDLEDOWN; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_MIDDLE_BUTTON_UP) + { + mi.dwFlags |= MOUSEEVENTF_MIDDLEUP; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_RIGHT_BUTTON_DOWN) + { + mi.dwFlags |= MOUSEEVENTF_RIGHTDOWN; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_RIGHT_BUTTON_UP) + { + mi.dwFlags |= MOUSEEVENTF_RIGHTUP; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_BUTTON_4_DOWN) + { + mi.mouseData |= XBUTTON1; + mi.dwFlags |= MOUSEEVENTF_XDOWN; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_BUTTON_4_UP) + { + mi.mouseData |= XBUTTON1; + mi.dwFlags |= MOUSEEVENTF_XUP; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_BUTTON_5_DOWN) + { + mi.mouseData |= XBUTTON2; + mi.dwFlags |= MOUSEEVENTF_XDOWN; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_BUTTON_5_UP) + { + mi.mouseData |= XBUTTON2; + mi.dwFlags |= MOUSEEVENTF_XUP; + SendMouseEvent(mi); + } + if(mid->ButtonFlags & MOUSE_WHEEL) + { + mi.mouseData = mid->ButtonData; + mi.dwFlags |= MOUSEEVENTF_WHEEL; + SendMouseEvent(mi); + } + } + } + + SendMouseEvent(mi); +} + +DWORD WINAPI MouseInputThread(LPVOID lpParameter) +{ + UNICODE_STRING MouseDeviceName = RTL_CONSTANT_STRING(L"\\Device\\PointerClass0"); + OBJECT_ATTRIBUTES MouseObjectAttributes; + IO_STATUS_BLOCK Iosb; + HANDLE MouseDeviceHandle; + NTSTATUS Status; + + InitializeObjectAttributes(&MouseObjectAttributes, + &MouseDeviceName, + 0, + NULL, + NULL); + + do + { + Sleep(1000); + Status = NtOpenFile(&MouseDeviceHandle, + FILE_ALL_ACCESS, + &MouseObjectAttributes, + &Iosb, + 0, + FILE_SYNCHRONOUS_IO_ALERT); + } while (!NT_SUCCESS(Status)); + + while(1) + { + MOUSE_INPUT_DATA MouseInput; + Status = NtReadFile(MouseDeviceHandle, + NULL, + NULL, + NULL, + &Iosb, + &MouseInput, + sizeof(MOUSE_INPUT_DATA), + NULL, + NULL); + //if(Status == STATUS_ALERTED) + //{ + // break; + //} + if(Status == STATUS_PENDING) + { + NtWaitForSingleObject(MouseDeviceHandle, FALSE, NULL); + Status = Iosb.Status; + } + if(!NT_SUCCESS(Status)) + { + DPRINT1("Win32K: Failed to read from mouse.\n"); + return Status; + } + DPRINT("MouseEvent\n"); + + ProcessMouseInputData(&MouseInput, Iosb.Information / sizeof(MOUSE_INPUT_DATA)); + } +} + + +void CsrInitInputSupport() +{ + HANDLE MouseThreadHandle; + + ClipCursor(NULL); + SetCursorPos(GetSystemMetrics( SM_CXVIRTUALSCREEN ) /2, + GetSystemMetrics( SM_CYVIRTUALSCREEN ) /2); + + MouseThreadHandle = CreateThread(NULL, 0, MouseInputThread, NULL, 0,NULL); +} Propchange: branches/arwinss/reactos/subsystems/win32/csrss/win32csr/input.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/arwinss/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild [iso-8859-1] Tue Jul 28 16:23:34 2009 @@ -23,5 +23,6 @@ <file>guiconsole.c</file> <file>tuiconsole.c</file> <file>appswitch.c</file> + <file>input.c</file> <file>win32csr.rc</file> </module>
15 years, 4 months
1
0
0
0
[fireball] 42271: - Add XBUTTONx defines.
by fireball@svn.reactos.org
Author: fireball Date: Tue Jul 28 16:18:48 2009 New Revision: 42271 URL:
http://svn.reactos.org/svn/reactos?rev=42271&view=rev
Log: - Add XBUTTONx defines. Modified: branches/arwinss/reactos/include/psdk/winuser.h Modified: branches/arwinss/reactos/include/psdk/winuser.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/psdk/wi…
============================================================================== --- branches/arwinss/reactos/include/psdk/winuser.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/psdk/winuser.h [iso-8859-1] Tue Jul 28 16:18:48 2009 @@ -1843,6 +1843,8 @@ #define WM_APP 32768 #define WM_GETTITLEBARINFOEX 0x033F +#define XBUTTON1 0x0001 +#define XBUTTON2 0x0002 #if (_WIN32_WINNT >= 0x0400) #define WHEEL_DELTA 120
15 years, 4 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
61
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
Results per page:
10
25
50
100
200