Author: janderwald
Date: Wed Feb 11 03:34:32 2009
New Revision: 39546
URL:
http://svn.reactos.org/svn/reactos?rev=39546&view=rev
Log:
- Implement KsCreateTopologyNode, KsCreatePin
Modified:
trunk/reactos/drivers/ksfilter/ks/connectivity.c
trunk/reactos/drivers/ksfilter/ks/ksfunc.h
trunk/reactos/drivers/ksfilter/ks/topology.c
Modified: trunk/reactos/drivers/ksfilter/ks/connectivity.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/connec…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] Wed Feb 11 03:34:32
2009
@@ -7,7 +7,21 @@
IN ACCESS_MASK DesiredAccess,
OUT PHANDLE ConnectionHandle)
{
- return STATUS_SUCCESS;
+ UINT ConnectSize = sizeof(KSPIN_CONNECT);
+
+ PKSDATAFORMAT_WAVEFORMATEX Format = (PKSDATAFORMAT_WAVEFORMATEX)(Connect + 1);
+ if (Format->DataFormat.FormatSize == sizeof(KSDATAFORMAT) ||
+ Format->DataFormat.FormatSize == sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX))
+ {
+ ConnectSize += Format->DataFormat.FormatSize;
+ }
+
+ return KspCreateObjectType(FilterHandle,
+ L"{146F1A80-4791-11D0-A5D6-28DB04C10000}",
+ (PVOID)Connect,
+ ConnectSize,
+ DesiredAccess,
+ ConnectionHandle);
}
KSDDKAPI NTSTATUS NTAPI
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] Wed Feb 11 03:34:32 2009
@@ -11,7 +11,15 @@
#define TAG_KSDEVICE TAG('K', 'S', 'E', 'D')
#define TAG_KSOBJECT_TAG TAG('K', 'S', 'O', 'H')
-
+NTSTATUS
+NTAPI
+KspCreateObjectType(
+ IN HANDLE ParentHandle,
+ IN LPWSTR ObjectType,
+ PVOID CreateParameters,
+ UINT CreateParametersSize,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PHANDLE NodeHandle);
Modified: trunk/reactos/drivers/ksfilter/ks/topology.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/topolo…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] Wed Feb 11 03:34:32 2009
@@ -1,13 +1,65 @@
-#include <ntddk.h>
-#include <debug.h>
-#include <ks.h>
+#include "priv.h"
/* ===============================================================
Topology Functions
*/
+NTSTATUS
+NTAPI
+KspCreateObjectType(
+ IN HANDLE ParentHandle,
+ IN LPWSTR ObjectType,
+ PVOID CreateParameters,
+ UINT CreateParametersSize,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PHANDLE NodeHandle)
+{
+ NTSTATUS Status;
+ IO_STATUS_BLOCK IoStatusBlock;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING Name;
+
+ Name.Length = (wcslen(ObjectType) + 1) * sizeof(WCHAR) + CreateParametersSize;
+ Name.MaximumLength += sizeof(WCHAR);
+ Name.Buffer = ExAllocatePool(NonPagedPool, Name.MaximumLength);
+
+ if (!Name.Buffer)
+ {
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ wcscpy(Name.Buffer, ObjectType);
+ Name.Buffer[wcslen(ObjectType)] = '\\';
+
+ RtlMoveMemory(Name.Buffer + wcslen(ObjectType) +1, CreateParameters,
CreateParametersSize);
+
+ Name.Buffer[Name.Length / 2] = L'\0';
+
+ InitializeObjectAttributes(&ObjectAttributes, &Name, OBJ_KERNEL_HANDLE |
OBJ_CASE_INSENSITIVE, ParentHandle, NULL);
+
+
+ Status = IoCreateFile(NodeHandle,
+ DesiredAccess,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ NULL,
+ 0,
+ 0,
+ FILE_OPEN,
+ FILE_SYNCHRONOUS_IO_NONALERT,
+ NULL,
+ 0,
+ CreateFileTypeNone,
+ NULL,
+ IO_NO_PARAMETER_CHECKING | IO_FORCE_ACCESS_CHECK);
+
+ ExFreePool(Name.Buffer);
+ return Status;
+}
+
+
/*
- @unimplemented
+ @implemented
*/
KSDDKAPI NTSTATUS NTAPI
KsCreateTopologyNode(
@@ -16,8 +68,12 @@
IN ACCESS_MASK DesiredAccess,
OUT PHANDLE NodeHandle)
{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
+ return KspCreateObjectType(ParentHandle,
+ L"{0621061A-EE75-11D0-B915-00A0C9223196}",
+ (PVOID)NodeCreate,
+ sizeof(KSNODE_CREATE),
+ DesiredAccess,
+ NodeHandle);
}
/*