ReactOS  0.4.14-dev-554-g2f8d847
ksuser.c File Reference
#include "ksuser.h"
#include <debug.h>
Include dependency graph for ksuser.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI KsiCreateObjectType (HANDLE hHandle, LPWSTR ObjectType, PVOID Buffer, ULONG BufferSize, ACCESS_MASK DesiredAccess, PHANDLE phHandle)
 
KSDDKAPI DWORD NTAPI KsCreateAllocator (HANDLE ConnectionHandle, PKSALLOCATOR_FRAMING AllocatorFraming, PHANDLE AllocatorHandle)
 
KSDDKAPI DWORD NTAPI KsCreateClock (HANDLE ConnectionHandle, PKSCLOCK_CREATE ClockCreate, PHANDLE ClockHandle)
 
KSDDKAPI DWORD NTAPI KsCreatePin (HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle)
 
KSDDKAPI DWORD NTAPI KsCreateTopologyNode (HANDLE ParentHandle, PKSNODE_CREATE NodeCreate, IN ACCESS_MASK DesiredAccess, OUT PHANDLE NodeHandle)
 
BOOL APIENTRY DllMain (HANDLE hModule, DWORD ulreason, LPVOID lpReserved)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file ksuser.c.

Function Documentation

◆ DllMain()

BOOL APIENTRY DllMain ( HANDLE  hModule,
DWORD  ulreason,
LPVOID  lpReserved 
)

Definition at line 256 of file ksuser.c.

257 {
258  switch (ulreason)
259  {
260  case DLL_PROCESS_ATTACH:
261  case DLL_THREAD_ATTACH:
262  case DLL_THREAD_DETACH:
263  case DLL_PROCESS_DETACH:
264  break;
265  }
266 
267  return TRUE;
268 }
#define TRUE
Definition: types.h:120
#define DLL_THREAD_ATTACH
Definition: compat.h:121
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_THREAD_DETACH
Definition: compat.h:122
#define DLL_PROCESS_DETACH
Definition: compat.h:119

◆ KsCreateAllocator()

KSDDKAPI DWORD NTAPI KsCreateAllocator ( HANDLE  ConnectionHandle,
PKSALLOCATOR_FRAMING  AllocatorFraming,
PHANDLE  AllocatorHandle 
)

Definition at line 107 of file ksuser.c.

111 {
115  sizeof(KSALLOCATOR_FRAMING),
116  GENERIC_READ,
118 }
#define KSSTRING_Allocator
Definition: ks.h:50
NTSTATUS NTAPI KsiCreateObjectType(HANDLE hHandle, LPWSTR ObjectType, PVOID Buffer, ULONG BufferSize, ACCESS_MASK DesiredAccess, PHANDLE phHandle)
Definition: ksuser.c:15
_In_ PKSALLOCATOR_FRAMING AllocatorFraming
Definition: ks.h:4518
#define GENERIC_READ
Definition: compat.h:124
_In_ PKSALLOCATOR_FRAMING _Out_ PHANDLE AllocatorHandle
Definition: ks.h:4518
_In_ PKSPIN_CONNECT _In_ ACCESS_MASK _Out_ PHANDLE ConnectionHandle
Definition: ks.h:4536

Referenced by CKsAllocator::KsCreateAllocatorAndGetHandle().

◆ KsCreateClock()

KSDDKAPI DWORD NTAPI KsCreateClock ( HANDLE  ConnectionHandle,
PKSCLOCK_CREATE  ClockCreate,
PHANDLE  ClockHandle 
)

Definition at line 145 of file ksuser.c.

148 {
151  (PVOID) ClockCreate,
152  sizeof(KSCLOCK_CREATE),
153  GENERIC_READ,
154  ClockHandle);
155 }
NTSTATUS NTAPI KsiCreateObjectType(HANDLE hHandle, LPWSTR ObjectType, PVOID Buffer, ULONG BufferSize, ACCESS_MASK DesiredAccess, PHANDLE phHandle)
Definition: ksuser.c:15
_In_ PKSCLOCK_CREATE _Out_ PHANDLE ClockHandle
Definition: ks.h:4527
#define KSSTRING_Clock
Definition: ks.h:49
#define GENERIC_READ
Definition: compat.h:124
_In_ PKSCLOCK_CREATE ClockCreate
Definition: ks.h:4527
_In_ PKSPIN_CONNECT _In_ ACCESS_MASK _Out_ PHANDLE ConnectionHandle
Definition: ks.h:4536

Referenced by CKsProxy::CreateClockInstance().

◆ KsCreatePin()

KSDDKAPI DWORD NTAPI KsCreatePin ( HANDLE  FilterHandle,
PKSPIN_CONNECT  Connect,
ACCESS_MASK  DesiredAccess,
PHANDLE  ConnectionHandle 
)

Definition at line 192 of file ksuser.c.

196 {
197  ULONG BufferSize = sizeof(KSPIN_CONNECT);
199 
200  BufferSize += DataFormat->FormatSize;
201 
202  return KsiCreateObjectType(FilterHandle,
203  KSSTRING_Pin,
204  Connect,
205  BufferSize,
208 
209 }
NTSTATUS NTAPI KsiCreateObjectType(HANDLE hHandle, LPWSTR ObjectType, PVOID Buffer, ULONG BufferSize, ACCESS_MASK DesiredAccess, PHANDLE phHandle)
Definition: ksuser.c:15
_In_ PKSPIN_CONNECT Connect
Definition: ks.h:4536
#define KSSTRING_Pin
Definition: ks.h:48
#define BufferSize
Definition: classpnp.h:419
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
unsigned int ULONG
Definition: retypes.h:1
_In_ PKSPIN_CONNECT _In_ ACCESS_MASK _Out_ PHANDLE ConnectionHandle
Definition: ks.h:4536
KSDATAFORMAT * PKSDATAFORMAT

Referenced by CreateMixerPinAndSetFormat(), CreatePinCallback(), CInputPin::CreatePinHandle(), COutputPin::CreatePinHandle(), InstantiatePins(), MMixerOpenMidiPin(), MMixerOpenWavePin(), OpenPin(), and TestKs().

◆ KsCreateTopologyNode()

KSDDKAPI DWORD NTAPI KsCreateTopologyNode ( HANDLE  ParentHandle,
PKSNODE_CREATE  NodeCreate,
IN ACCESS_MASK  DesiredAccess,
OUT PHANDLE  NodeHandle 
)

Definition at line 240 of file ksuser.c.

244 {
245  return KsiCreateObjectType( ParentHandle,
247  (PVOID) NodeCreate,
248  sizeof(KSNODE_CREATE),
250  NodeHandle);
251 }
NTSTATUS NTAPI KsiCreateObjectType(HANDLE hHandle, LPWSTR ObjectType, PVOID Buffer, ULONG BufferSize, ACCESS_MASK DesiredAccess, PHANDLE phHandle)
Definition: ksuser.c:15
_In_ PKSNODE_CREATE NodeCreate
Definition: ks.h:4546
_In_ PKSNODE_CREATE _In_ ACCESS_MASK _Out_ PHANDLE NodeHandle
Definition: ks.h:4546
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
#define KSSTRING_TopologyNode
Definition: ks.h:52

Referenced by CKsNode_Constructor().

◆ KsiCreateObjectType()

NTSTATUS NTAPI KsiCreateObjectType ( HANDLE  hHandle,
LPWSTR  ObjectType,
PVOID  Buffer,
ULONG  BufferSize,
ACCESS_MASK  DesiredAccess,
PHANDLE  phHandle 
)

Definition at line 15 of file ksuser.c.

21 {
23  SIZE_T Length;
24  SIZE_T TotalSize;
25  LPWSTR pStr;
29 
30  /* get length of object type */
32 
33  /* get length for request */
34  TotalSize = (Length * sizeof(WCHAR)) + BufferSize;
35 
36  /* append space for '\\'*/
37  TotalSize += sizeof(WCHAR);
38 
39  /* allocate buffer */
40  pStr = HeapAlloc(GetProcessHeap(), 0, TotalSize);
41  if (!pStr)
42  {
43  /* out of memory */
45  }
46 
47  /* copy object type */
48  wcscpy(pStr, ObjectType);
49 
50  /* append slash */
51  pStr[Length] = L'\\';
52 
53  /* append parameters */
54  memcpy(&pStr[Length+1], Buffer, BufferSize);
55 
56  /* initialize object name */
57  ObjectName.Buffer = pStr;
58  ObjectName.Length = ObjectName.MaximumLength = TotalSize;
59 
60  /* initialize object attributes */
62 
63  /* create the object */
65 
66  /* free buffer */
67  HeapFree(GetProcessHeap(), 0, pStr);
68 
69  /* check for success */
70  if (!NT_SUCCESS(Status))
71  {
72  /* failed zero handle */
73  *phHandle = INVALID_HANDLE_VALUE;
74 
75  /* convert error code */
77  }
78 
79  /* done */
80  return Status;
81 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
ObjectType
Definition: metafile.c:80
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:62
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define BufferSize
Definition: classpnp.h:419
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by KsCreateAllocator(), KsCreateClock(), KsCreatePin(), and KsCreateTopologyNode().