mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
[KSUSER, KS, SYSAUDIO]
- Make pin / node / allocator create requests compatible to ms by removing obsolete slash before object class - Return correct error code in ksuser's KsCreatePin - ReactOS KS is now able to create audio pins in Windows XP, though playback is not yet working - All changes except ksuser change has been verified to work with VBox 3.2.10 - KS user changes not tested yet as KSStudio not working in trunk svn path=/trunk/; revision=49428
This commit is contained in:
parent
f2e646d5b4
commit
c600a169fb
5 changed files with 53 additions and 42 deletions
|
@ -1,34 +1,19 @@
|
|||
/*
|
||||
* KSUSER.DLL - ReactOS
|
||||
*
|
||||
* Copyright 2008 Magnus Olsen and Dmitry Chapyshev
|
||||
*
|
||||
* 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
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Kernel Streaming
|
||||
* FILE: dll/directx/ksuser/ksuser.c
|
||||
* PURPOSE: KS USER functions
|
||||
* PROGRAMMER: Magnus Olsen and Dmitry Chapyshev and Johannes Anderwald
|
||||
*/
|
||||
|
||||
|
||||
#include "ksuser.h"
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
NTSTATUS NTAPI KsiCreateObjectType( HANDLE hHandle, PVOID guidstr, PVOID Buffer, ULONG BufferSize, ACCESS_MASK DesiredAccess, PHANDLE phHandle);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
KsiCreateObjectType( HANDLE hHandle,
|
||||
PVOID IID,
|
||||
LPWSTR ObjectType,
|
||||
PVOID Buffer,
|
||||
ULONG BufferSize,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
|
@ -42,31 +27,56 @@ KsiCreateObjectType( HANDLE hHandle,
|
|||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
|
||||
Length = wcslen(IID);
|
||||
/* get length of object type */
|
||||
Length = wcslen(ObjectType);
|
||||
|
||||
TotalSize = (Length * sizeof(WCHAR)) + BufferSize + 4 * sizeof(WCHAR);
|
||||
/* get length for request */
|
||||
TotalSize = (Length * sizeof(WCHAR)) + BufferSize;
|
||||
|
||||
/* append space for '\\'*/
|
||||
TotalSize += sizeof(WCHAR);
|
||||
|
||||
/* allocate buffer */
|
||||
pStr = HeapAlloc(GetProcessHeap(), 0, TotalSize);
|
||||
if (!pStr)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
pStr[0] = L'\\';
|
||||
wcscpy(&pStr[1], (LPWSTR)IID);
|
||||
pStr[Length+1] = L'\\';
|
||||
memcpy(&pStr[Length+2], Buffer, BufferSize);
|
||||
pStr[Length+3+(BufferSize/sizeof(WCHAR))] = L'\0';
|
||||
{
|
||||
/* out of memory */
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&ObjectName, pStr);
|
||||
/* copy object type */
|
||||
wcscpy(pStr, ObjectType);
|
||||
|
||||
/* append slash */
|
||||
pStr[Length] = L'\\';
|
||||
|
||||
/* append parameters */
|
||||
memcpy(&pStr[Length+1], Buffer, BufferSize);
|
||||
|
||||
/* initialize object name */
|
||||
ObjectName.Buffer = pStr;
|
||||
ObjectName.Length = ObjectName.MaximumLength = TotalSize;
|
||||
|
||||
/* initialize object attributes */
|
||||
InitializeObjectAttributes(&ObjectAttributes, &ObjectName, OBJ_CASE_INSENSITIVE, hHandle, NULL);
|
||||
|
||||
/* create the object */
|
||||
Status = NtCreateFile(phHandle, DesiredAccess, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, 0, 1, 0, NULL, 0);
|
||||
|
||||
/* free buffer */
|
||||
HeapFree(GetProcessHeap(), 0, pStr);
|
||||
|
||||
/* check for success */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* failed zero handle */
|
||||
*phHandle = INVALID_HANDLE_VALUE;
|
||||
|
||||
/* convert error code */
|
||||
Status = RtlNtStatusToDosError(Status);
|
||||
}
|
||||
|
||||
/* done */
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -1739,22 +1739,24 @@ FindMatchingCreateItem(
|
|||
PLIST_ENTRY Entry;
|
||||
PCREATE_ITEM_ENTRY CreateItemEntry;
|
||||
UNICODE_STRING RefString;
|
||||
LPWSTR pStr;
|
||||
|
||||
/* get terminator */
|
||||
pStr = wcschr(Buffer, L'\\');
|
||||
|
||||
#ifndef MS_KSUSER
|
||||
/* remove '\' slash */
|
||||
Buffer++;
|
||||
BufferSize -= sizeof(WCHAR);
|
||||
#endif
|
||||
/* sanity check */
|
||||
ASSERT(pStr != NULL);
|
||||
|
||||
if (!wcschr(Buffer, L'\\'))
|
||||
if (pStr == Buffer)
|
||||
{
|
||||
RtlInitUnicodeString(&RefString, Buffer);
|
||||
// skip slash
|
||||
RtlInitUnicodeString(&RefString, ++pStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// request is for pin / node / allocator
|
||||
RefString.Buffer = Buffer;
|
||||
RefString.Length = RefString.MaximumLength = ((ULONG_PTR)wcschr(Buffer, L'\\') - (ULONG_PTR)Buffer);
|
||||
RefString.Length = BufferSize = RefString.MaximumLength = ((ULONG_PTR)pStr - (ULONG_PTR)Buffer);
|
||||
}
|
||||
|
||||
/* point to first entry */
|
||||
|
|
|
@ -95,7 +95,7 @@ KspCopyCreateRequest(
|
|||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
/* get object class length */
|
||||
ObjectLength = (wcslen(ObjectClass) + 2) * sizeof(WCHAR);
|
||||
ObjectLength = (wcslen(ObjectClass) + 1) * sizeof(WCHAR);
|
||||
|
||||
/* check for minium length requirement */
|
||||
if (ObjectLength + *Size > IoStack->FileObject->FileName.MaximumLength)
|
||||
|
|
|
@ -27,7 +27,7 @@ KspCreateObjectType(
|
|||
|
||||
/* calculate request length */
|
||||
Name.Length = 0;
|
||||
Name.MaximumLength = wcslen(ObjectType) * sizeof(WCHAR) + CreateParametersSize + 2 * sizeof(WCHAR);
|
||||
Name.MaximumLength = wcslen(ObjectType) * sizeof(WCHAR) + CreateParametersSize + 1 * sizeof(WCHAR);
|
||||
Name.MaximumLength += sizeof(WCHAR);
|
||||
/* acquire request buffer */
|
||||
Name.Buffer = AllocateItem(NonPagedPool, Name.MaximumLength);
|
||||
|
@ -42,7 +42,6 @@ KspCreateObjectType(
|
|||
* For pins the parent is the reference string used in registration
|
||||
* For clocks it is full path for pin\{ClockGuid}\ClockCreateParams
|
||||
*/
|
||||
RtlAppendUnicodeToString(&Name, L"\\");
|
||||
RtlAppendUnicodeToString(&Name, ObjectType);
|
||||
RtlAppendUnicodeToString(&Name, L"\\");
|
||||
/* append create parameters */
|
||||
|
|
|
@ -398,7 +398,7 @@ GetConnectRequest(
|
|||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
/* get object class length */
|
||||
ObjectLength = (wcslen(KSSTRING_Pin) + 2) * sizeof(WCHAR);
|
||||
ObjectLength = (wcslen(KSSTRING_Pin) + 1) * sizeof(WCHAR);
|
||||
|
||||
/* check for minium length requirement */
|
||||
if (ObjectLength + sizeof(KSPIN_CONNECT) > IoStack->FileObject->FileName.MaximumLength)
|
||||
|
|
Loading…
Reference in a new issue