Author: janderwald
Date: Tue Jul 28 15:52:57 2009
New Revision: 42268
URL:
http://svn.reactos.org/svn/reactos?rev=42268&view=rev
Log:
- Implement KsGetObjectFromFileObject, KsGetObjectFromFileObject, KsGetObjectTypeFromIrp,
KsGetParent
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/kstypes.h
trunk/reactos/drivers/ksfilter/ks/misc.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 15:52:57 2009
@@ -512,6 +512,11 @@
/* initialize create item list */
InitializeListHead(&Header->ItemList);
+
+ /* initialize basic header */
+ Header->BasicHeader.Type = KsObjectTypeDevice;
+ Header->BasicHeader.KsDevice = &Header->KsDevice;
+ Header->BasicHeader.Parent.KsDevice = &Header->KsDevice;
/* are there any create items provided */
if (ItemsCount && ItemsList)
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 15:52:57 2009
@@ -653,7 +653,6 @@
KsSetDevicePnpAndBaseObject(Header, PhysicalDeviceObject, NextDeviceObject);
/* initialize IKsDevice interface */
Header->lpVtblIKsDevice = &vt_IKsDevice;
- Header->Type = KsObjectTypeDevice;
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 15:52:57 2009
@@ -865,6 +865,7 @@
This->FilterFactory = iface;
This->FileObject = IoStack->FileObject;
This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice;
+ This->Header.Parent.KsFilterFactory = iface->lpVtbl->GetStruct(iface);
This->Header.Type = KsObjectTypeFilter;
/* allocate the stream descriptors */
@@ -919,6 +920,7 @@
This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice;
This->ObjectHeader->Type = KsObjectTypeFilter;
This->ObjectHeader->Unknown = (PUNKNOWN)&This->lpVtbl;
+ This->ObjectHeader->ObjectType = (PVOID)&This->Filter;
/* completed initialization */
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 15:52:57
2009
@@ -185,6 +185,7 @@
This->FilterFactory.FilterDescriptor = Descriptor;
This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice;
This->Header.Type = KsObjectTypeFilterFactory;
+ This->Header.Parent.KsDevice =
&DeviceExtension->DeviceHeader->KsDevice;
This->DeviceHeader = DeviceExtension->DeviceHeader;
InitializeListHead(&This->SymbolicLinkList);
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 15:52:57 2009
@@ -28,6 +28,7 @@
UNICODE_STRING ObjectClass;
PUNKNOWN Unknown;
+ PVOID ObjectType;
PDEVICE_OBJECT TargetDevice;
LIST_ENTRY TargetDeviceListEntry;
@@ -55,11 +56,17 @@
{
KSOBJECTTYPE Type;
PKSDEVICE KsDevice;
+ union
+ {
+ PKSDEVICE KsDevice;
+ PKSFILTERFACTORY KsFilterFactory;
+ PKSFILTER KsFilter;
+ }Parent;
}KSBASIC_HEADER, *PKSBASIC_HEADER;
typedef struct
{
- KSOBJECTTYPE Type;
+ KSBASIC_HEADER BasicHeader;
KSDEVICE KsDevice;
IKsDeviceVtbl *lpVtblIKsDevice;
Modified: trunk/reactos/drivers/ksfilter/ks/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/misc.c…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] Tue Jul 28 15:52:57 2009
@@ -140,7 +140,7 @@
}
/*
- @unimplemented
+ @implemented
*/
KSDDKAPI
PVOID
@@ -148,50 +148,66 @@
KsGetObjectFromFileObject(
IN PFILE_OBJECT FileObject)
{
+ PKSIOBJECT_HEADER ObjectHeader;
+
+ /* get object header */
+ ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext;
+
+ /* return associated object */
+ return ObjectHeader->ObjectType;
+}
+
+/*
+ @implemented
+*/
+KSDDKAPI
+KSOBJECTTYPE
+NTAPI
+KsGetObjectTypeFromFileObject(
+ IN PFILE_OBJECT FileObject)
+{
+ PKSIOBJECT_HEADER ObjectHeader;
+
+ /* get object header */
+ ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext;
+ /* return type */
+ return ObjectHeader->Type;
+}
+
+/*
+ @implemented
+*/
+KSOBJECTTYPE
+NTAPI
+KsGetObjectTypeFromIrp(
+ IN PIRP Irp)
+{
+ PKSIOBJECT_HEADER ObjectHeader;
+ PIO_STACK_LOCATION IoStack;
+
+ /* get current irp stack */
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+ /* get object header */
+ ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext;
+ /* return type */
+ return ObjectHeader->Type;
+}
+
+/*
+ @unimplemented
+*/
+PUNKNOWN
+NTAPI
+KsGetOuterUnknown(
+ IN PVOID Object)
+{
UNIMPLEMENTED
return NULL;
-}
-
-/*
- @unimplemented
-*/
-KSDDKAPI
-KSOBJECTTYPE
-NTAPI
-KsGetObjectTypeFromFileObject(
- IN PFILE_OBJECT FileObject)
-{
- UNIMPLEMENTED
- return (KSOBJECTTYPE)-1;
-}
-
-/*
- @unimplemented
-*/
-KSOBJECTTYPE
-NTAPI
-KsGetObjectTypeFromIrp(
- IN PIRP Irp)
-{
- UNIMPLEMENTED
- return (KSOBJECTTYPE)-1;
-}
-
-/*
- @unimplemented
-*/
-PUNKNOWN
-NTAPI
-KsGetOuterUnknown(
- IN PVOID Object)
-{
- UNIMPLEMENTED
- return NULL;
-
-}
-
-/*
- @unimplemented
+
+}
+
+/*
+ @implemented
*/
KSDDKAPI
PVOID
@@ -199,8 +215,11 @@
KsGetParent(
IN PVOID Object)
{
- UNIMPLEMENTED
- return NULL;
-}
-
-
+ PKSBASIC_HEADER BasicHeader = (PKSBASIC_HEADER)((ULONG_PTR)Object -
sizeof(KSBASIC_HEADER));
+ /* sanity check */
+ ASSERT(BasicHeader->Parent.KsDevice != NULL);
+ /* return object type */
+ return (PVOID)BasicHeader->Parent.KsDevice;
+}
+
+