mirror of
https://github.com/reactos/reactos.git
synced 2025-05-10 20:27:45 +00:00
- Partly Implement KsRegisterFilterWithNoKSPins
- Implement _KsEdit svn path=/trunk/; revision=42310
This commit is contained in:
parent
3f5c25c304
commit
ace530421a
2 changed files with 146 additions and 18 deletions
|
@ -1842,23 +1842,6 @@ KsDeviceRegisterAdapterObject(
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
_KsEdit(
|
|
||||||
IN KSOBJECT_BAG ObjectBag,
|
|
||||||
IN OUT PVOID* PointerToPointerToItem,
|
|
||||||
IN ULONG NewSize,
|
|
||||||
IN ULONG OldSize,
|
|
||||||
IN ULONG Tag)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@unimplemented
|
@unimplemented
|
||||||
*/
|
*/
|
||||||
|
@ -2093,6 +2076,62 @@ KsRegisterFilterWithNoKSPins(
|
||||||
IN KSPIN_MEDIUM* MediumList,
|
IN KSPIN_MEDIUM* MediumList,
|
||||||
IN GUID* CategoryList OPTIONAL)
|
IN GUID* CategoryList OPTIONAL)
|
||||||
{
|
{
|
||||||
|
ULONG Size, Index;
|
||||||
|
NTSTATUS Status;
|
||||||
|
PWSTR SymbolicLinkList;
|
||||||
|
//PUCHAR Buffer;
|
||||||
|
HANDLE hKey;
|
||||||
|
UNICODE_STRING InterfaceString;
|
||||||
|
//UNICODE_STRING FilterData = RTL_CONSTANT_STRING(L"FilterData");
|
||||||
|
|
||||||
|
if (!InterfaceClassGUID || !PinCount || !PinDirection || !MediumList)
|
||||||
|
{
|
||||||
|
/* all these parameters are required */
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate filter data value size */
|
||||||
|
Size = PinCount * sizeof(KSPIN_MEDIUM);
|
||||||
|
if (CategoryList)
|
||||||
|
{
|
||||||
|
/* add category list */
|
||||||
|
Size += PinCount * sizeof(GUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME generate filter data blob */
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
|
/* get symbolic link list */
|
||||||
|
Status = IoGetDeviceInterfaces(InterfaceClassGUID, DeviceObject, DEVICE_INTERFACE_INCLUDE_NONACTIVE, &SymbolicLinkList);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* initialize first symbolic link */
|
||||||
|
RtlInitUnicodeString(&InterfaceString, SymbolicLinkList);
|
||||||
|
|
||||||
|
/* open first device interface registry key */
|
||||||
|
Status = IoOpenDeviceInterfaceRegistryKey(&InterfaceString, GENERIC_WRITE, &hKey);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* write filter data */
|
||||||
|
//Status = ZwSetValueKey(hKey, &FilterData, 0, REG_BINARY, Buffer, Size);
|
||||||
|
|
||||||
|
/* close the key */
|
||||||
|
ZwClose(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PinCount)
|
||||||
|
{
|
||||||
|
/* update medium cache */
|
||||||
|
for(Index = 0; Index < PinCount; Index++)
|
||||||
|
{
|
||||||
|
KsCacheMedium(&InterfaceString, &MediumList[Index], PinDirection[Index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free the symbolic link list */
|
||||||
|
ExFreePool(SymbolicLinkList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,5 +298,94 @@ KsFreeObjectBag(
|
||||||
FreeItem(Bag);
|
FreeItem(Bag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@implemented
|
||||||
|
*/
|
||||||
|
KSDDKAPI
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
_KsEdit(
|
||||||
|
IN KSOBJECT_BAG ObjectBag,
|
||||||
|
IN OUT PVOID* PointerToPointerToItem,
|
||||||
|
IN ULONG NewSize,
|
||||||
|
IN ULONG OldSize,
|
||||||
|
IN ULONG Tag)
|
||||||
|
{
|
||||||
|
PKSIOBJECT_BAG Bag;
|
||||||
|
PKSIOBJECT_BAG_ENTRY BagEntry;
|
||||||
|
PVOID Item;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* get real object bag */
|
||||||
|
Bag = (PKSIOBJECT_BAG)ObjectBag;
|
||||||
|
|
||||||
|
/* acquire bag mutex */
|
||||||
|
KeWaitForSingleObject(Bag->BagMutex, Executive, KernelMode, FALSE, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
if (*PointerToPointerToItem)
|
||||||
|
{
|
||||||
|
/* search object bag for this entry */
|
||||||
|
BagEntry = KspFindObjectBagItem(&Bag->ObjectList, *PointerToPointerToItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* pointer to null, allocate new entry */
|
||||||
|
BagEntry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BagEntry || NewSize > OldSize)
|
||||||
|
{
|
||||||
|
/* entry does not exist or new entry must be allocated */
|
||||||
|
Item = AllocateItem(NonPagedPool, NewSize);
|
||||||
|
|
||||||
|
if (!Item)
|
||||||
|
{
|
||||||
|
/* not enough resources */
|
||||||
|
KeReleaseMutex(Bag->BagMutex, FALSE);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now add the item to the object bag */
|
||||||
|
Status = KsAddItemToObjectBag((KSOBJECT_BAG)Bag, Item, NULL);
|
||||||
|
/* check for success */
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* failed to add item */
|
||||||
|
FreeItem(Item);
|
||||||
|
KeReleaseMutex(Bag->BagMutex, FALSE);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*PointerToPointerToItem)
|
||||||
|
{
|
||||||
|
/* object exists */
|
||||||
|
if (OldSize >= NewSize)
|
||||||
|
{
|
||||||
|
/* copy old contents */
|
||||||
|
RtlMoveMemory(Item, *PointerToPointerToItem, NewSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* copy new contents */
|
||||||
|
RtlMoveMemory(Item, *PointerToPointerToItem, OldSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BagEntry)
|
||||||
|
{
|
||||||
|
/* remove old entry */
|
||||||
|
KsRemoveItemFromObjectBag(ObjectBag, BagEntry->Item, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* store item */
|
||||||
|
*PointerToPointerToItem = Item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* release bag mutex */
|
||||||
|
KeReleaseMutex(Bag->BagMutex, FALSE);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue